2 * HostNotFoundException.cxx
4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
7 * This program is free software; you can redistribute
8 * it and/or modify it under the terms of the license
9 *(GNU LGPL) which comes with this package.
13 /* HostNotFoundException member functions implementation.
16 #include <HostNotFoundException.hpp>
27 HostNotFoundException::HostNotFoundException()
29 this->reason = (char*) calloc(strlen("Host not found : unknown") + 1, sizeof(char));
30 strcpy(this->reason, "Host not found : unknown");
34 HostNotFoundException::HostNotFoundException(const HostNotFoundException& rHostNotFoundException)
36 const char* reason = rHostNotFoundException.toString();
37 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
38 strcpy(this->reason, reason);
43 HostNotFoundException::HostNotFoundException(const char* name)
45 this->reason = (char*) calloc(strlen("Host not found : ") + strlen(name) + 1, sizeof(char));
46 sprintf(this->reason, "Host not found : %s", name);
50 HostNotFoundException::~HostNotFoundException()
56 const char* HostNotFoundException::toString(void) const
58 return (const char*)(this->reason);
62 const HostNotFoundException& HostNotFoundException::operator = (const HostNotFoundException& rHostNotFoundException)
64 const char* reason = rHostNotFoundException.toString();
65 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));