00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BITERROR_H
00020 #define BITERROR_H
00021
00026 #include <stdexcept>
00027
00028 namespace bit
00029 {
00030
00036 class bit_error: public std::runtime_error
00037 {
00038 public:
00039 bit_error(const std::string s="bit: Unknown error."):
00040 std::runtime_error(s),
00041 m_error_string(s)
00042 {}
00043
00044 ~bit_error() throw ()
00045 { }
00046
00047 virtual const char * what () const throw ()
00048 {
00049 return m_error_string.c_str();
00050 }
00051
00052 protected:
00053 std::string m_error_string;
00054 }
00055 ;
00056
00057 namespace error
00058 {
00059
00064 class invalid_iterator: public bit_error
00065 {
00066 public:
00067 invalid_iterator(): bit_error("bit: Attempted to use invalid iterator")
00068 { }
00069 }
00070 ;
00071
00076 class invalid_container_op: public bit_error
00077 {
00078 public:
00079 invalid_container_op(): bit_error("bit: Using container methods on a FieldBase descendant that is not valid for that descendant.")
00080 { }
00081 }
00082 ;
00083
00088 class name: public bit_error
00089 {
00090 public:
00091 name(): bit_error("bit: Name identifiers may not contain the following characters: .[]")
00092 { }
00093 name(const std::string s): bit_error(s)
00094 {
00095 m_error_string = "bit: The name \"" + s + "\" is invalid. Name identifiers may not contain the following characters: .[]";
00096 }
00097 }
00098 ;
00099
00104 class no_record: public bit_error
00105 {
00106 public:
00107 no_record(): bit_error("bit:FieldBuffer: record() method called, but this instance does not have a record.")
00108 { }
00109 }
00110 ;
00111
00116 class invalid_index: public bit_error
00117 {
00118 public:
00119 invalid_index(): bit_error("bit: Invalid index.")
00120 { }
00121 }
00122 ;
00123
00124 }
00125
00126 }
00127
00128 #include <bit/error_field.h>
00129 #include <bit/error_record.h>
00130 #include <bit/error_indices.h>
00131 #include <bit/error_type.h>
00132
00133 #endif
00134