jaula API Reference
version 1.4.0
|
00001 00002 /* 00003 * jaula_exception.h : JSON Analysis User Library Acronym 00004 * Error handling definitions 00005 * 00006 * Copyright (C) 2007, 2008, 2009 Kombo Morongo <morongo666@gmail.com> 00007 * 00008 * This library is free software; you can redistribute it and/or modify it 00009 * under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 2.1 of the License, or (at 00011 * your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00015 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00016 * License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this library; if not, write to the Free Software Foundation, 00020 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00021 * 00022 * svn info: 00023 * $Author: morongo $ 00024 * $HeadURL: https://jaula.svn.sourceforge.net/svnroot/jaula/tags/jaula-1.4.0/jaula/jaula_exception.h $ 00025 * $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $ 00026 * $Revision: 45 $ 00027 */ 00028 00029 #ifndef _JAULA_EXCEPTION_H_ 00030 #define _JAULA_EXCEPTION_H_ 00031 00032 #include <ostream> 00033 #include <string> 00034 00039 namespace JAULA 00040 { // namespace JAULA 00041 00053 class Exception 00054 { // class Exception 00055 public: 00056 00060 enum ExCode 00061 { // enum ExCode 00063 NO_ERROR 00065 , BAD_DATA_TYPE 00067 , NAME_DUPLICATED 00069 , 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 00148 void display(std::ostream &ostr) const; 00149 00156 void setDetail(std::string const &detail); 00157 00163 void setAction(std::string const &action); 00164 00171 void setOrigin(std::string const &origin); 00172 00183 void addOrigin(std::string const &origin); 00184 00199 Exception &operator=(Exception const &orig); 00200 00201 protected: 00202 00208 void setCode(ExCode code); 00209 00210 private: 00211 00215 ExCode code_; 00216 00220 std::string detail_; 00221 00225 std::string action_; 00226 00230 std::string origin_; 00231 }; // class Exception 00232 00233 } // namespace JAULA 00234 00235 00253 std::ostream &operator<<(std::ostream &ostr, JAULA::Exception const &ex); 00254 #endif 00255 00256 // EOF $Id: jaula_exception.h 45 2009-01-11 16:17:03Z morongo $