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