/[escript]/branches/windows_from_1431_trunk/esysUtils/src/EsysException.h
ViewVC logotype

Diff of /branches/windows_from_1431_trunk/esysUtils/src/EsysException.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1440 by trankine, Thu Feb 28 04:56:16 2008 UTC revision 1441 by trankine, Thu Feb 28 06:50:26 2008 UTC
# Line 2  Line 2 
2  /* $Id$ */  /* $Id$ */
3    
4  /*******************************************************  /*******************************************************
5   *  *
6   *           Copyright 2003-2007 by ACceSS MNRF  *           Copyright 2003-2007 by ACceSS MNRF
7   *       Copyright 2007 by University of Queensland  *       Copyright 2007 by University of Queensland
8   *  *
9   *                http://esscc.uq.edu.au  *                http://esscc.uq.edu.au
10   *        Primary Business: Queensland, Australia  *        Primary Business: Queensland, Australia
11   *  Licensed under the Open Software License version 3.0  *  Licensed under the Open Software License version 3.0
12   *     http://www.opensource.org/licenses/osl-3.0.php  *     http://www.opensource.org/licenses/osl-3.0.php
13   *  *
14   *******************************************************/  *******************************************************/
15    
16  #ifndef ESYSEXCEPTION_H  #ifndef ESYSEXCEPTION_H
17  #define ESYSEXCEPTION_H  #define ESYSEXCEPTION_H
# Line 19  Line 19 
19    
20  #include <string>  #include <string>
21  #include <exception>  #include <exception>
 #include <algorithm>  
22    
23  namespace esysUtils  namespace esysUtils
24  {  {
# Line 110  namespace esysUtils Line 109  namespace esysUtils
109            
110      @return the string for the exception reason.      @return the string for the exception reason.
111      */      */
     inline  
112      const std::string& reason() const;      const std::string& reason() const;
113    
114      /**      /**
# Line 136  namespace esysUtils Line 134  namespace esysUtils
134      \brief      \brief
135      update m_exceptionMessage after a reason update.      update m_exceptionMessage after a reason update.
136      **/      **/
137      inline void updateMessage();      void updateMessage();
138    
139      //      //
140      // the exception reason      // the exception reason
# Line 149  namespace esysUtils Line 147  namespace esysUtils
147      //      //
148      // the exception name is immutable and class-wide.      // the exception name is immutable and class-wide.
149      // Inheritor note; you need one of these too.      // Inheritor note; you need one of these too.
150      // and an overloaded exceptionName in your .cpp implementation file.      // and an overloaded exceptionName() in your .cpp implementation file.
151      static const std::string exceptionNameValue;      static const std::string exceptionNameValue;
152    
153    };    };
# Line 167  namespace esysUtils Line 165  namespace esysUtils
165    
166    ////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////
167    
168      inline
169    const std::string & EsysException::reason() const    const std::string & EsysException::reason() const
170    {    {
171      return m_reason;      return m_reason;
172    }    }
173        
174    // return the message as a std::string    // return the message as a std::string
175      inline
176    const std::string & EsysException::toString() const    const std::string & EsysException::toString() const
177    {    {
178      return m_exceptionMessage;      return m_exceptionMessage;
179    }    }
180    
181      inline
182    void EsysException::setReason(const std::string &new_reason)    void EsysException::setReason(const std::string &new_reason)
183    {    {
184      m_reason = new_reason;      m_reason = new_reason;
185      updateMessage();      updateMessage();
186    }    }
187    
188      inline
189    const char*  EsysException::what() const    const char*  EsysException::what() const
190    {    {
191      return m_exceptionMessage.c_str();      return m_exceptionMessage.c_str();
# Line 191  namespace esysUtils Line 193  namespace esysUtils
193    
194    
195    
196      inline
197    void EsysException::updateMessage()    void EsysException::updateMessage()
198    {    {
199      m_exceptionMessage = exceptionName() + ": " + m_reason;      m_exceptionMessage = exceptionName() + ": " + m_reason;

Legend:
Removed from v.1440  
changed lines
  Added in v.1441

  ViewVC Help
Powered by ViewVC 1.1.26