jaula API Reference  version 1.4.0
jaula_exception.h
1 
2 /*
3  * jaula_exception.h : JSON Analysis User Library Acronym
4  * Error handling definitions
5  *
6  * Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com>
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or (at
11  * your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21  *
22  * svn info:
23  * $Author: morongo $
24  * $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_exception.h $
25  * $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $
26  * $Revision: 45 $
27  */
28 
29 #ifndef _JAULA_EXCEPTION_H_
30 #define _JAULA_EXCEPTION_H_
31 
32 #include <ostream>
33 #include <string>
34 
39 namespace JAULA
40 { // namespace JAULA
41 
53  class Exception
54  { // class Exception
55  public:
56 
60  enum ExCode
61  { // enum ExCode
71  , SYNTAX_ERROR
72  }; // enum ExCode
73 
92  , std::string const &detail = ""
93  , std::string const &action = ""
94  , std::string const &origin = "");
95 
104  Exception(Exception const &orig);
105 
109  virtual ~Exception();
110 
114  ExCode getCode(void) const;
115 
124  virtual std::string const &getDetail(void) const;
125 
129  std::string const &getAction(void) const;
130 
138  std::string const &getOrigin(void) const;
139 
148  void display(std::ostream &ostr) const;
149 
156  void setDetail(std::string const &detail);
157 
163  void setAction(std::string const &action);
164 
171  void setOrigin(std::string const &origin);
172 
183  void addOrigin(std::string const &origin);
184 
199  Exception &operator=(Exception const &orig);
200 
201  protected:
202 
208  void setCode(ExCode code);
209 
210  private:
211 
216 
220  std::string detail_;
221 
225  std::string action_;
226 
230  std::string origin_;
231  }; // class Exception
232 
233 } // namespace JAULA
234 
235 
253 std::ostream &operator<<(std::ostream &ostr, JAULA::Exception const &ex);
254 #endif
255 
256 // EOF $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $
Definition: jaula_exception.h:69
void setDetail(std::string const &detail)
Establishes the description for the exception.
Definition: jaula_exception.cc:129
void display(std::ostream &ostr) const
Represents the instance in a stream.
Definition: jaula_exception.cc:82
virtual ~Exception()
Destructor.
Definition: jaula_exception.cc:59
std::string origin_
Container for where the exception was detected.
Definition: jaula_exception.h:230
std::ostream & operator<<(std::ostream &ostr, JAULA::Exception const &ex)
Insertion operator extension for Exceptions.
Definition: jaula_exception.cc:171
void setAction(std::string const &action)
Establishes the action that caused the exception.
Definition: jaula_exception.cc:134
virtual std::string const & getDetail(void) const
Retrieves the detailed description for the exception.
Definition: jaula_exception.cc:67
Exception(ExCode code=NO_ERROR, std::string const &detail="", std::string const &action="", std::string const &origin="")
Constructor.
Definition: jaula_exception.cc:42
Base class for error handling exceptions.
Definition: jaula_exception.h:53
std::string const & getAction(void) const
Retrieves the action that caused the exception.
Definition: jaula_exception.cc:72
Definition: jaula_exception.h:67
Definition: jaula_exception.h:65
void setOrigin(std::string const &origin)
Establishes the method being run when the exception arose.
Definition: jaula_exception.cc:139
std::string detail_
Container for exception textual detail.
Definition: jaula_exception.h:220
std::string const & getOrigin(void) const
Retrieves the method being run when the exception arose.
Definition: jaula_exception.cc:77
ExCode code_
Container for error code.
Definition: jaula_exception.h:215
void addOrigin(std::string const &origin)
Attachs a new origin after the existing ones.
Definition: jaula_exception.cc:144
void setCode(ExCode code)
Establishes the error code for the exception.
Definition: jaula_exception.cc:124
Definition: jaula_exception.h:63
ExCode getCode(void) const
Retrieves the error code for the exception.
Definition: jaula_exception.cc:62
Exception & operator=(Exception const &orig)
Assignment operator.
Definition: jaula_exception.cc:155
std::string action_
Container action causing the exception.
Definition: jaula_exception.h:225
ExCode
Enumeration of available error codes.
Definition: jaula_exception.h:60


Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.


Copyright (c) 2007, 2008, 2009 Kombo Morongo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

API Reference Generated for jaula by

doxygen

jaula project hosted by

SourceForge.net Logo