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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 468 - (hide annotations)
Wed Jan 25 06:50:39 2006 UTC (17 years, 1 month ago) by jgs
File size: 2308 byte(s)
reorganised esysUtils to remove inc directory
1 jgs 82 /*
2     ******************************************************************************
3     * *
4     * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5     * *
6     * This software is the property of ACcESS. No part of this code *
7     * may be copied in any form or by any means without the expressed written *
8     * consent of ACcESS. Copying, use or modification of this software *
9     * by any unauthorised person is illegal unless that person has a software *
10     * license agreement with ACcESS. *
11     * *
12     ******************************************************************************
13     */
14    
15 jgs 468 #include "EsysException.h"
16 jgs 82
17     using namespace std;
18     using namespace esysUtils;
19    
20     ostream &operator<<(ostream &output, EsysException &inException){
21     output << inException.toString();
22     return output;
23     }
24    
25     EsysException::EsysException():
26     exception()
27     {
28     }
29    
30     EsysException::EsysException(const string &exceptionReason):
31     exception()
32     {
33     reason() << exceptionReason;
34     }
35    
36     // Copy Constructor.
37     EsysException::EsysException(const EsysException &inException):
38     exception(inException)
39     {
40     *this=inException;
41     }
42    
43     EsysException::EsysException( const char *cStr ):
44     exception()
45     {
46     reason() << cStr;
47     }
48    
49     EsysException::~EsysException() throw()
50     {}
51    
52     string EsysException::exceptionName() const
53     {
54     return "GeneralEsysException";
55     }
56     ostringstream& EsysException::reason()
57     {
58     return m_reason;
59     }
60     //
61     // Overloaded assignment operator.
62     EsysException& EsysException::operator=(const EsysException &inException) {
63     if (this != &inException) {
64     //
65     // call the base class operator=
66     this->exception::operator=(dynamic_cast<const exception&>(inException));
67     //
68     // copy the message buffer into this EsysException
69     m_reason << inException.m_reason.str();
70     }
71     return *this;
72     }
73    
74     // return the message as a string
75     string EsysException::toString() const {
76     return exceptionName() + ": " + m_reason.str();
77     }
78    
79     const char* EsysException::what() const throw() {
80     //
81     m_exceptionMessage=toString();
82     return m_exceptionMessage.c_str();
83     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26