#include "squid.h"
#include "TextException.h"
+TextException::TextException()
+{
+ message=NULL;
+ theFileName=NULL;
+ theLineNo=0;
+}
+
+TextException::TextException(const TextException& right) :
+ message((right.message?xstrdup(right.message):NULL)), theFileName(right.theFileName), theLineNo(right.theLineNo)
+{
+}
+
TextException::TextException(const char *aMsg, const char *aFileName, int aLineNo):
message(xstrdup(aMsg)), theFileName(aFileName), theLineNo(aLineNo)
{}
TextException::~TextException() throw()
{
- xfree(message);
+ if(message) xfree(message);
+}
+
+TextException& TextException::operator=(const TextException &right)
+{
+ if(this==&right) return *this;
+ if(message) xfree(message);
+ message=(right.message?xstrdup(right.message):NULL);
+ theFileName=right.theFileName;
+ theLineNo=right.theLineNo;
+
+ return *this;
}
const char *TextException::what() const throw()
{
public:
+ TextException();
TextException(const char *aMessage, const char *aFileName = 0, int aLineNo = -1);
+ TextException(const TextException& right);
virtual ~TextException() throw();
virtual const char *what() const throw();
+ TextException& operator=(const TextException &right);
+
public:
char *message; // read-only