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