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 /* MsgException member functions implementation.
16 #include <MsgException.hpp>
27 MsgException::MsgException()
29 this->reason = (char*) calloc(strlen("Internal exception : unknown reason") + 1, sizeof(char));
30 strcpy(this->reason, "Internal exception : unknown reason");
34 MsgException::MsgException(const MsgException& rMsgException)
36 const char* reason = rMsgException.toString();
37 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));
38 strcpy(this->reason, reason);
42 MsgException::MsgException(const char* reason)
44 this->reason = (char*) calloc(strlen("Internal exception : ") + strlen(reason) + 1, sizeof(char));
45 sprintf(this->reason, "Invalid exception : %s", reason);
49 MsgException::~MsgException()
55 const char* MsgException::toString(void) const
57 return (const char*)(this->reason);
61 const MsgException& MsgException::operator = (const MsgException& rMsgException)
63 const char* reason = rMsgException.toString();
64 this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char));