/[escript]/branches/windows_from_1383_trunk/esysUtils/src/EsysException.cpp
ViewVC logotype

Contents of /branches/windows_from_1383_trunk/esysUtils/src/EsysException.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1398 - (show annotations)
Wed Jan 23 07:46:09 2008 UTC (13 years, 2 months ago) by trankine
File size: 2258 byte(s)
Remove the throw() modifier from the destructor declaration.
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 #include <iostream>
18
19 using namespace std;
20 using namespace esysUtils;
21
22 ostream &operator<<(ostream &output, EsysException &inException){
23 output << inException.toString();
24 return output;
25 }
26
27 EsysException::EsysException():
28 exception()
29 {
30 std::cout << "EsysException() called\n";
31 }
32
33 EsysException::EsysException(const string &exceptionReason):
34 exception()
35 {
36 std::cout << "EsysException(const string &exceptionReason) called\n";
37
38 reason() << exceptionReason;
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 {
51 std::cout << "EsysException::EsysException( const char *cStr )\n";
52
53 reason() << cStr;
54 }
55
56 EsysException::~EsysException()
57 {}
58
59 string EsysException::exceptionName() const
60 {
61 return "GeneralEsysException";
62 }
63 ostringstream& EsysException::reason()
64 {
65 return m_reason;
66 }
67 //
68 // Overloaded assignment operator.
69 EsysException& EsysException::operator=(const EsysException &inException) {
70 if (this != &inException) {
71 //
72 // call the base class operator=
73 // win32 refactor: parent class operator= shares pointer the result is
74 // all classes try to free the same pointer, dies on windows badly.
75 // this->exception::operator=(dynamic_cast<const exception&>(inException));
76 //
77 // copy the message buffer into this EsysException
78 m_reason << inException.m_reason.str(); // copy the message buffer into this EsysException
79 }
80 return *this;
81 }
82
83 // return the message as a string
84 string EsysException::toString() const {
85 return exceptionName() + ": " + m_reason.str();
86 }
87
88 const char* EsysException::what() const throw() {
89 //
90 m_exceptionMessage=toString();
91 return m_exceptionMessage.c_str();
92 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26