00001 /****************************************************************************/ 00007 // Exceptions for used by some utility classes 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef UtilExceptions_h 00020 #define UtilExceptions_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <string> 00033 #include <stdexcept> 00034 00035 00036 // =========================================================================== 00037 // class definitions 00038 // =========================================================================== 00044 class InvalidArgument : public std::runtime_error { 00045 public: 00047 InvalidArgument(const std::string &message) 00048 : std::runtime_error(message) {} 00049 00050 }; 00051 00052 00059 class ProcessError : public std::runtime_error { 00060 public: 00062 ProcessError() 00063 : std::runtime_error("Process Error") {} 00064 00066 ProcessError(const std::string &msg) 00067 : std::runtime_error(msg) {} 00068 00069 }; 00070 00071 00076 class EmptyData : public std::runtime_error { 00077 public: 00079 EmptyData() 00080 : std::runtime_error("Empty Data") {} 00081 00082 }; 00083 00084 00091 class NumberFormatException : public std::runtime_error { 00092 public: 00094 NumberFormatException() 00095 : std::runtime_error("Number Format") {} 00096 00097 }; 00098 00099 00105 class BoolFormatException : public std::runtime_error { 00106 public: 00108 BoolFormatException() 00109 : std::runtime_error("Bool Format") {} 00110 00111 }; 00112 00113 00119 class OutOfBoundsException : public std::runtime_error { 00120 public: 00122 OutOfBoundsException() 00123 : std::runtime_error("Out Of Bounds") {} 00124 00125 }; 00126 00127 00133 class UnknownElement : public std::runtime_error { 00134 public: 00136 UnknownElement() 00137 : std::runtime_error("Unknown Element") {} 00138 00140 UnknownElement(const std::string &msg) 00141 : std::runtime_error(msg) {} 00142 00143 }; 00144 00145 00146 class IOError : public ProcessError { 00147 public: 00149 IOError(const std::string &message) 00150 : ProcessError(message) {} 00151 00152 }; 00153 00154 00155 #endif 00156 00157 /****************************************************************************/
1.5.6