1 |
|
2 |
/* $Id$ */ |
3 |
|
4 |
/******************************************************* |
5 |
* |
6 |
* Copyright 2003-2007 by ACceSS MNRF |
7 |
* Copyright 2007 by University of Queensland |
8 |
* |
9 |
* http://esscc.uq.edu.au |
10 |
* Primary Business: Queensland, Australia |
11 |
* Licensed under the Open Software License version 3.0 |
12 |
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
* |
14 |
*******************************************************/ |
15 |
|
16 |
#include "EsysException.h" |
17 |
|
18 |
using namespace esysUtils; |
19 |
|
20 |
const std::string EsysException::exceptionNameValue("GeneralEsysException"); |
21 |
|
22 |
std::ostream &operator<<(std::ostream &output, EsysException &inException){ |
23 |
output << inException.toString(); |
24 |
return output; |
25 |
} |
26 |
|
27 |
EsysException::EsysException(): |
28 |
exception(), |
29 |
m_reason() |
30 |
{ |
31 |
updateMessage(); |
32 |
} |
33 |
|
34 |
EsysException::EsysException(const std::string &exceptionReason): |
35 |
exception(), |
36 |
m_reason(exceptionReason) |
37 |
{ |
38 |
updateMessage(); |
39 |
} |
40 |
|
41 |
// Copy Constructor. |
42 |
EsysException::EsysException(const EsysException &inException): |
43 |
exception(inException) |
44 |
{ |
45 |
*this=inException; |
46 |
} |
47 |
|
48 |
EsysException::EsysException( const char *cStr ): |
49 |
exception(), |
50 |
m_reason(cStr) |
51 |
{ |
52 |
updateMessage(); |
53 |
} |
54 |
|
55 |
EsysException::~EsysException() |
56 |
{} |
57 |
|
58 |
const std::string & EsysException::exceptionName() const |
59 |
{ |
60 |
return exceptionNameValue; |
61 |
} |
62 |
|
63 |
// |
64 |
// Overloaded assignment operator. |
65 |
EsysException& EsysException::operator=(const EsysException &inException) |
66 |
{ |
67 |
if (this != &inException) |
68 |
{ |
69 |
// |
70 |
// call the base class operator= |
71 |
// win32 refactor: parent class operator= shares pointer the result is |
72 |
// all classes try to free the same pointer, dies on windows badly. |
73 |
// exception::operator=(inException); |
74 |
// |
75 |
// copy the message buffer into this EsysException |
76 |
m_reason = inException.m_reason; |
77 |
updateMessage(); |
78 |
} |
79 |
return *this; |
80 |
} |