00001 00008 #ifndef DECODEEXCEPTION_HPP_INCLUDED 00009 #define DECODEEXCEPTION_HPP_INCLUDED 00010 00011 #include <stdexcept> 00012 #include <string> 00013 00018 class UnknownSectionException 00019 : public std::runtime_error 00020 { 00021 public: 00022 UnknownSectionException(std::string const & section) 00023 : std::runtime_error 00024 (std::string("Section [") 00025 + section 00026 + "] not supported") 00027 { 00028 } 00029 }; 00030 00031 00037 class SectionFormatParseException 00038 : public std::runtime_error 00039 { 00040 public: 00041 SectionFormatParseException(std::string const & format) 00042 : std::runtime_error 00043 (std::string("Failed to parse format of section [") 00044 + format 00045 + "]") 00046 { 00047 } 00048 }; 00049 00050 00055 class EndOfDataException 00056 : public std::runtime_error 00057 { 00058 public: 00059 EndOfDataException() 00060 : std::runtime_error( 00061 std::string("Section incomplete") 00062 ) 00063 { 00064 } 00065 }; 00066 00067 00072 class SectionFinishedBeforeEof 00073 : public std::runtime_error 00074 { 00075 public: 00076 SectionFinishedBeforeEof() 00077 : std::runtime_error( 00078 std::string( 00079 "Section decoded before end of file reached" 00080 ) 00081 ) 00082 { 00083 } 00084 }; 00085 00086 00092 class MalformedConditional 00093 : public std::runtime_error 00094 { 00095 public: 00096 MalformedConditional(std::string const & field) 00097 : std::runtime_error( 00098 std::string("Section conditional references unknown field [" 00099 + field 00100 + "]" 00101 ) 00102 ) 00103 { 00104 } 00105 }; 00106 00111 class BadlyAlignedBlockExit 00112 : public std::runtime_error 00113 { 00114 public: 00115 BadlyAlignedBlockExit(std::string const & field) 00116 : std::runtime_error( 00117 std::string("Length field [" 00118 + field 00119 + "] is not at an 8 bit boundary" 00120 ) 00121 ) 00122 { 00123 } 00124 }; 00125 00126 00127 #endif // defined DECODEEXCEPTION_HPP_INCLUDED 00128