2 * InvalidArgumentException.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 /* InvalidArgumentException member functions implementation.
17 #include <InvalidArgumentException.hpp>
28 InvalidArgumentException::InvalidArgumentException()
30 this->reason = (char*) calloc(strlen("Invalid argument : unknown") + 1, sizeof(char));
31 strcpy(this->reason, "Invalid argument : unknown");
35 InvalidArgumentException::InvalidArgumentException(const InvalidArgumentException& rInvalidArgumentException)
37 const char* reason = rInvalidArgumentException.toString();
38 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
39 strcpy(this->reason, reason);
44 InvalidArgumentException::InvalidArgumentException(const char* name)
46 this->reason = (char*) calloc(strlen("Invalid argument : ") + strlen(name) + 1, sizeof(char));
47 sprintf(this->reason, "Invalid argument : %s", name);
51 InvalidArgumentException::~InvalidArgumentException()
57 const char* InvalidArgumentException::toString(void) const
59 return (const char*)(this->reason);
63 const InvalidArgumentException& InvalidArgumentException::operator = (const InvalidArgumentException& rInvalidArgumentException)
65 const char* reason = rInvalidArgumentException.toString();
66 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));