00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SBUILD_PARSE_ERROR_H
00020 #define SBUILD_PARSE_ERROR_H
00021
00022 #include <sbuild/sbuild-custom-error.h>
00023 #include <sbuild/sbuild-null.h>
00024
00025 #include <map>
00026 #include <string>
00027
00028 namespace sbuild
00029 {
00030
00034 template<typename T>
00035 class parse_error : public error<T>
00036 {
00037 public:
00038 typedef typename error<T>::error_type error_type;
00039
00046 template<typename C>
00047 parse_error (C const& context,
00048 error_type error):
00049 sbuild::error<T>(format_error(context, null(), null(), error, null(), null()),
00050 format_reason(context, null(), null(), error, null(), null()))
00051 {
00052 }
00053
00060 template<typename D>
00061 parse_error (error_type error,
00062 D const& detail):
00063 sbuild::error<T>(format_error(null(), null(), null(), error, detail, null()),
00064 format_reason(null(), null(), null(), error, detail, null()))
00065 {
00066 }
00067
00075 template<typename D>
00076 parse_error (size_t line,
00077 error_type error,
00078 D const& detail):
00079 sbuild::error<T>(format_error(line, null(), null(), error, detail, null()),
00080 format_reason(line, null(), null(), error, detail, null()))
00081 {
00082 }
00083
00092 template<typename D>
00093 parse_error (size_t line,
00094 std::string const& group,
00095 error_type error,
00096 D const& detail):
00097 sbuild::error<T>(format_error(line, group, null(), error, detail, null()),
00098 format_reason(line, group, null(), error, detail, null()))
00099 {
00100 }
00101
00111 template<typename D>
00112 parse_error (size_t line,
00113 std::string const& group,
00114 std::string const& key,
00115 error_type error,
00116 D const& detail):
00117 sbuild::error<T>(format_error(line, group, key, error, detail, null()),
00118 format_reason(line, group, key, error, detail, null()))
00119 {
00120 }
00121
00129 template<typename D>
00130 parse_error (std::string const& group,
00131 error_type error,
00132 D const& detail):
00133 sbuild::error<T>(format_error(group, null(), null(), error, detail, null()),
00134 format_reason(group, null(), null(), error, detail, null()))
00135 {
00136 }
00137
00146 template<typename D>
00147 parse_error (std::string const& group,
00148 std::string const& key,
00149 error_type error,
00150 D const& detail):
00151 sbuild::error<T>(format_error(group, key, null(), error, detail, null()),
00152 format_reason(group, key, null(), error, detail, null()))
00153 {
00154 }
00155
00162 template<typename C>
00163 parse_error (C const& context,
00164 std::runtime_error const& error):
00165 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null()),
00166 sbuild::error<T>::format_reason(context, null(), null(), error, null(), null()))
00167 {
00168 }
00169
00176 parse_error (size_t line,
00177 std::runtime_error const& error):
00178 sbuild::error<T>(sbuild::error<T>::format_error(line, null(), null(), error, null(), null()),
00179 sbuild::error<T>::format_reason(line, null(), null(), error, null(), null()))
00180 {
00181 }
00182
00190 parse_error (size_t line,
00191 std::string const& group,
00192 std::runtime_error const& error):
00193 sbuild::error<T>(sbuild::error<T>::format_error(line, group, null(), error, null(), null()),
00194 sbuild::error<T>::format_reason(line, group, null(), error, null(), null()))
00195 {
00196 }
00197
00206 parse_error (size_t line,
00207 std::string const& group,
00208 std::string const& key,
00209 std::runtime_error const& error):
00210 sbuild::error<T>(sbuild::error<T>::format_error(line, group, key, error, null(), null()),
00211 sbuild::error<T>::format_reason(line, group, key, error, null(), null()))
00212 {
00213 }
00214
00221 parse_error (std::string const& group,
00222 std::runtime_error const& error):
00223 sbuild::error<T>(sbuild::error<T>::format_error(group, null(), null(), error, null(), null()),
00224 sbuild::error<T>::format_reason(group, null(), null(), error, null(), null()))
00225 {
00226 }
00227
00235 parse_error (std::string const& group,
00236 std::string const& key,
00237 std::runtime_error const& error):
00238 sbuild::error<T>(sbuild::error<T>::format_error(group, key, null(), error, null(), null()),
00239 sbuild::error<T>::format_reason(group, key, null(), error, null(), null()))
00240 {
00241 }
00242
00243 };
00244
00245 }
00246
00247 #endif
00248
00249
00250
00251
00252
00253