2 * InvalidArgumentException.cxx
\r
4 * Copyright 2006,2007 Martin Quinson, Malek Cherier
\r
5 * All right reserved.
\r
7 * This program is free software; you can redistribute
\r
8 * it and/or modify it under the terms of the license
\r
9 *(GNU LGPL) which comes with this package.
\r
13 /* InvalidArgumentException member functions implementation.
\r
17 #include <InvalidArgumentException.hpp>
\r
28 InvalidArgumentException::InvalidArgumentException()
\r
30 this->reason = (char*) calloc(strlen("Invalid argument : unknown") + 1, sizeof(char));
\r
31 strcpy(this->reason, "Invalid argument : unknown");
\r
35 InvalidArgumentException::InvalidArgumentException(const InvalidArgumentException& rInvalidArgumentException)
\r
37 const char* reason = rInvalidArgumentException.toString();
\r
38 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
39 strcpy(this->reason, reason);
\r
44 InvalidArgumentException::InvalidArgumentException(const char* name)
\r
46 this->reason = (char*) calloc(strlen("Invalid argument : ") + strlen(name) + 1, sizeof(char));
\r
47 sprintf(this->reason, "Invalid argument : %s", name);
\r
51 InvalidArgumentException::~InvalidArgumentException()
\r
57 const char* InvalidArgumentException::toString(void) const
\r
59 return (const char*)(this->reason);
\r
63 const InvalidArgumentException& InvalidArgumentException::operator = (const InvalidArgumentException& rInvalidArgumentException)
\r
65 const char* reason = rInvalidArgumentException.toString();
\r
66 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
\r
73 }// namespace SimGrid
\r