00001 00002 /* 00003 jaula_exception.h : JSON Analysis User Library Acronym 00004 Error handling definitions 00005 00006 Copyright (C) 2007 Kombo Morongo <morongo666@gmail.com> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00021 00022 svn info: 00023 00024 $Author: morongo $ 00025 $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/trunk/jaula/jaula_exception.h $ 00026 $Id: jaula_exception.h 2 2007-04-13 19:00:00Z morongo $ 00027 $Revision: 2 $ 00028 */ 00029 00030 #ifndef _JAULA_EXCEPTION_H_ 00031 #define _JAULA_EXCEPTION_H_ 00032 00033 #include <ostream> 00034 #include <string> 00035 00044 namespace JAULA 00045 { // namespace JAULA 00046 00058 class Exception 00059 { // class Exception 00060 public: 00061 00065 enum ExCode 00066 { // enum ExCode 00067 NO_ERROR 00068 , BAD_DATA_TYPE 00069 , NAME_DUPLICATED 00070 , LEXAN_ERROR 00071 , SYNTAX_ERROR 00072 }; // enum ExCode 00073 00091 Exception(ExCode code = NO_ERROR 00092 , std::string const &detail = "" 00093 , std::string const &action = "" 00094 , std::string const &origin = ""); 00095 00104 Exception(Exception const &orig); 00105 00109 virtual ~Exception(); 00110 00114 ExCode getCode(void) const; 00115 00124 virtual std::string const &getDetail(void) const; 00125 00129 std::string const &getAction(void) const; 00130 00138 std::string const &getOrigin(void) const; 00139 00150 void display(std::ostream &ostr) const; 00151 00158 void setDetail(std::string const &detail); 00159 00165 void setAction(std::string const &action); 00166 00173 void setOrigin(std::string const &origin); 00174 00185 void addOrigin(std::string const &origin); 00186 00203 Exception &operator=(Exception const &orig); 00204 00205 protected: 00206 00212 void setCode(ExCode code); 00213 00214 private: 00215 00219 ExCode code_; 00220 00224 std::string detail_; 00225 00229 std::string action_; 00230 00234 std::string origin_; 00235 }; // class Exception 00236 00237 } // namespace JAULA 00238 00239 00240 00258 std::ostream &operator<<(std::ostream &ostr, JAULA::Exception const &ex); 00259 #endif 00260 00261 // EOF $Id: jaula_exception.h 2 2007-04-13 19:00:00Z morongo $
Copyright (c) 2007 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".