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 A>
00048 parse_error (A const& context,
00049 error_type error):
00050 sbuild::error<T>(format_error(context, null(), null(), error, null(), null()))
00051 {
00052 }
00053
00060 template<typename A>
00061 parse_error (error_type error,
00062 A const& detail):
00063 sbuild::error<T>(format_error(null(), null(), null(), error, detail, null()))
00064 {
00065 }
00066
00074 parse_error (size_t line,
00075 error_type error,
00076 std::string const& detail):
00077 sbuild::error<T>(format_error(line, null(), null(), error, detail, null()))
00078 {
00079 }
00080
00089 parse_error (size_t line,
00090 std::string const& group,
00091 error_type error,
00092 std::string const& detail):
00093 sbuild::error<T>(format_error(line, group, null(), error, detail, null()))
00094 {
00095 }
00096
00106 parse_error (size_t line,
00107 std::string const& group,
00108 std::string const& key,
00109 error_type error,
00110 std::string const& detail):
00111 sbuild::error<T>(format_error(line, group, key, error, detail, null()))
00112 {
00113 }
00114
00122 parse_error (std::string const& group,
00123 error_type error,
00124 std::string const& detail):
00125 sbuild::error<T>(format_error(group, null(), null(), error, detail, null()))
00126 {
00127 }
00128
00137 parse_error (std::string const& group,
00138 std::string const& key,
00139 error_type error,
00140 std::string const& detail):
00141 sbuild::error<T>(format_error(group, key, null(), error, detail, null()))
00142 {
00143 }
00144
00151 template<typename A>
00152 parse_error (A const& context,
00153 std::runtime_error const& error):
00154 sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null()))
00155 {
00156 }
00157
00164 parse_error (size_t line,
00165 std::runtime_error const& error):
00166 sbuild::error<T>(sbuild::error<T>::format_error(line, null(), null(), error, null(), null()))
00167 {
00168 }
00169
00177 parse_error (size_t line,
00178 std::string const& group,
00179 std::runtime_error const& error):
00180 sbuild::error<T>(sbuild::error<T>::format_error(line, group, null(), error, null(), null()))
00181 {
00182 }
00183
00192 parse_error (size_t line,
00193 std::string const& group,
00194 std::string const& key,
00195 std::runtime_error const& error):
00196 sbuild::error<T>(sbuild::error<T>::format_error(line, group, key, error, null(), null()))
00197 {
00198 }
00199
00206 parse_error (std::string const& group,
00207 std::runtime_error const& error):
00208 sbuild::error<T>(sbuild::error<T>::format_error(group, null(), null(), error, null(), null()))
00209 {
00210 }
00211
00219 parse_error (std::string const& group,
00220 std::string const& key,
00221 std::runtime_error const& error):
00222 sbuild::error<T>(sbuild::error<T>::format_error(group, key, null(), error, null(), null()))
00223 {
00224 }
00225
00226 };
00227
00228 }
00229
00230 #endif
00231
00232
00233
00234
00235
00236