/[escript]/trunk/esysUtils/src/EsysException.cpp
ViewVC logotype

Contents of /trunk/esysUtils/src/EsysException.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (show annotations)
Fri Jan 11 07:45:58 2008 UTC (13 years, 8 months ago) by trankine
File size: 2057 byte(s)
And get the *(&(*&(* name right
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 std;
19 using namespace esysUtils;
20
21 ostream &operator<<(ostream &output, EsysException &inException){
22 output << inException.toString();
23 return output;
24 }
25
26 EsysException::EsysException():
27 exception()
28 {
29 }
30
31 EsysException::EsysException(const string &exceptionReason):
32 exception()
33 {
34 reason() << exceptionReason;
35 }
36
37 // Copy Constructor.
38 EsysException::EsysException(const EsysException &inException):
39 exception(inException)
40 {
41 *this=inException;
42 }
43
44 EsysException::EsysException( const char *cStr ):
45 exception()
46 {
47 reason() << cStr;
48 }
49
50 EsysException::~EsysException() throw()
51 {}
52
53 string EsysException::exceptionName() const
54 {
55 return "GeneralEsysException";
56 }
57 ostringstream& EsysException::reason()
58 {
59 return m_reason;
60 }
61 //
62 // Overloaded assignment operator.
63 EsysException& EsysException::operator=(const EsysException &inException) {
64 if (this != &inException) {
65 //
66 // call the base class operator=
67 // win32 refactor: parent class operator= shares pointer the result is
68 // all classes try to free the same pointer, dies on windows badly.
69 // this->exception::operator=(dynamic_cast<const exception&>(inException));
70 //
71 // copy the message buffer into this EsysException
72 m_reason << inException.m_reason.str(); // copy the message buffer into this EsysException
73 }
74 return *this;
75 }
76
77 // return the message as a string
78 string EsysException::toString() const {
79 return exceptionName() + ": " + m_reason.str();
80 }
81
82 const char* EsysException::what() const throw() {
83 //
84 m_exceptionMessage=toString();
85 return m_exceptionMessage.c_str();
86 }

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26