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 /* LogicException member functions implementation.
16 #include <LogicException.hpp>
27 LogicException::LogicException()
29 this->reason = (char*) calloc(strlen("Logic exception : no detail") + 1, sizeof(char));
30 strcpy(this->reason, "Logic exception : no detail");
34 LogicException::LogicException(const LogicException& rLogicException)
36 const char* reason = rLogicException.toString();
37 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
38 strcpy(this->reason, reason);
43 LogicException::LogicException(const char* detail)
45 this->reason = (char*) calloc(strlen("Logic exception : ") + strlen(detail) + 1, sizeof(char));
46 sprintf(this->reason, "Logic exception : %s", detail);
50 LogicException::~LogicException()
56 const char* LogicException::toString(void) const
58 return (const char*)(this->reason);
62 const LogicException& LogicException::operator = (const LogicException& rLogicException)
64 const char* reason = rLogicException.toString();
65 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));