00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00047 #ifndef FASTFORMAT_INCL_FASTFORMAT_HPP_EXCEPTIONS
00048 #define FASTFORMAT_INCL_FASTFORMAT_HPP_EXCEPTIONS
00049
00050
00051
00052
00053
00054 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
00055 # define FASTFORMAT_VER_FASTFORMAT_HPP_EXCEPTIONS_MAJOR 1
00056 # define FASTFORMAT_VER_FASTFORMAT_HPP_EXCEPTIONS_MINOR 1
00057 # define FASTFORMAT_VER_FASTFORMAT_HPP_EXCEPTIONS_REVISION 1
00058 # define FASTFORMAT_VER_FASTFORMAT_HPP_EXCEPTIONS_EDIT 6
00059 #endif
00060
00061
00062
00063
00064
00065 #ifndef __cplusplus
00066 # error This file can only be included in C++ compilation units
00067 #endif
00068
00069
00070
00071
00072
00073 #include <fastformat/fastformat.h>
00074 #include <fastformat/quality/contract.h>
00075 #include <fastformat/quality/cover.h>
00076
00077 #include <stlsoft/stlsoft.h>
00078
00079 #include <exception>
00080 #include <stdexcept>
00081 #include <string>
00082
00083
00084
00085
00086
00087 #if !defined(FASTFORMAT_NO_NAMESPACE)
00088 namespace fastformat
00089 {
00090 #endif
00091
00092
00093
00094
00095
00102 class fastformat_exception
00103 : public std::runtime_error
00104 {
00105 public:
00106
00107 typedef std::runtime_error parent_class_type;
00109 typedef fastformat_exception class_type;
00111 typedef std::string multibyte_string_type;
00113 typedef std::basic_string<ff_char_t> string_type;
00114
00115 public:
00116
00120 explicit fastformat_exception(char const* message)
00121 : parent_class_type(validate_message_(message))
00122 {
00123 FASTFORMAT_COVER_MARK_ENTRY();
00124 }
00125 virtual ~fastformat_exception() stlsoft_throw_0() = 0;
00126
00127 private:
00129 class_type& operator =(class_type const&);
00130
00131 protected:
00132 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
00133 static ff_char_t const* validate_format_(ff_char_t const* format)
00134 {
00135 FASTFORMAT_CONTRACT_ENFORCE_PRECONDITION_PARAMS_APPL_LAYER(NULL != format, "format parameter may not be null");
00136
00137 FASTFORMAT_COVER_MARK_ENTRY();
00138
00139 return format;
00140 }
00141 static ff_char_t const* validate_format_(ff_char_t const* format, size_t cchFormat)
00142 {
00143 FASTFORMAT_CONTRACT_ENFORCE_PRECONDITION_PARAMS_APPL_LAYER((NULL != format || 0 == cchFormat), "format string pointer may not be null unless length is zero");
00144 STLSOFT_SUPPRESS_UNUSED(cchFormat);
00145
00146 FASTFORMAT_COVER_MARK_ENTRY();
00147
00148 return format;
00149 }
00150 static char const* validate_message_(char const* message)
00151 {
00152 FASTFORMAT_CONTRACT_ENFORCE_PRECONDITION_PARAMS_APPL_LAYER(NULL != message, "message parameter may not be null");
00153
00154 FASTFORMAT_COVER_MARK_ENTRY();
00155
00156 return message;
00157 }
00158 #endif
00159 };
00160
00165 class format_parsing_exception
00166 : public fastformat_exception
00167 {
00168 public:
00169
00170 typedef fastformat_exception parent_class_type;
00172 typedef format_parsing_exception class_type;
00174 typedef parent_class_type::multibyte_string_type message_string_type;
00176 typedef parent_class_type::string_type string_type;
00177
00178 public:
00179
00185 format_parsing_exception(char const* message, ff_parse_code_t code, ff_char_t const* format)
00186 : parent_class_type(validate_message_(message))
00187 , code(code)
00188 , format(validate_format_(format))
00189 {
00190 FASTFORMAT_COVER_MARK_ENTRY();
00191 }
00199 format_parsing_exception(char const* message, ff_parse_code_t code, ff_char_t const* format, size_t cchFormat)
00200 : parent_class_type(validate_message_(message))
00201 , code(code)
00202 , format(validate_format_(format, cchFormat), cchFormat)
00203 {
00204 FASTFORMAT_COVER_MARK_ENTRY();
00205 }
00206 virtual ~format_parsing_exception() stlsoft_throw_0() = 0;
00207 private:
00209 class_type& operator =(class_type const&);
00210
00211 public:
00212
00213 const ff_parse_code_t code;
00215 const string_type format;
00216 };
00217
00220 class illformed_format_exception
00221 : public format_parsing_exception
00222 {
00223 public:
00224
00225 typedef format_parsing_exception parent_class_type;
00227 typedef illformed_format_exception class_type;
00229 typedef parent_class_type::string_type string_type;
00230
00231 public:
00232
00238 illformed_format_exception(char const* message, ff_parse_code_t code, ff_char_t const* format)
00239 : parent_class_type(message, code, format)
00240 {
00241 FASTFORMAT_COVER_MARK_ENTRY();
00242 }
00250 illformed_format_exception(char const* message, ff_parse_code_t code, ff_char_t const* format, size_t cchFormat)
00251 : parent_class_type(message, code, format, cchFormat)
00252 {
00253 FASTFORMAT_COVER_MARK_ENTRY();
00254 }
00255 private:
00257 class_type& operator =(class_type const&);
00258 };
00259
00270 class mismatched_replacements_exception
00271 : public fastformat_exception
00272 {
00273 public:
00274
00275 typedef fastformat_exception parent_class_type;
00277 typedef mismatched_replacements_exception class_type;
00279 typedef parent_class_type::string_type string_type;
00280
00281 public:
00282
00289 explicit mismatched_replacements_exception(char const* message, ff_replacement_code_t code, int numberOfReplacements, int firstMismatchedReplacementIndex)
00290 : parent_class_type(validate_message_(message))
00291 , code(code)
00292 , numberOfReplacements(numberOfReplacements)
00293 , firstMismatchedReplacementIndex(firstMismatchedReplacementIndex)
00294 {
00295 FASTFORMAT_COVER_MARK_ENTRY();
00296 }
00297 virtual ~mismatched_replacements_exception() stlsoft_throw_0() = 0;
00298 private:
00300 class_type& operator =(class_type const&);
00301
00302 public:
00303
00304 const ff_replacement_code_t code;
00306 const int numberOfReplacements;
00308 const int firstMismatchedReplacementIndex;
00309 };
00310
00317 class missing_argument_exception
00318 : public mismatched_replacements_exception
00319 {
00320 public:
00321
00322 typedef mismatched_replacements_exception parent_class_type;
00324 typedef missing_argument_exception class_type;
00326 typedef parent_class_type::string_type string_type;
00327
00328 public:
00329
00336 missing_argument_exception(char const* message, ff_replacement_code_t code, int numberOfReplacements, int firstMismatchedReplacementIndex)
00337 : parent_class_type(validate_message_(message), code, numberOfReplacements, firstMismatchedReplacementIndex)
00338 {
00339 FASTFORMAT_COVER_MARK_ENTRY();
00340 }
00341 private:
00343 class_type& operator =(class_type const&);
00344 };
00345
00355 class unreferenced_argument_exception
00356 : public mismatched_replacements_exception
00357 {
00358 public:
00359
00360 typedef mismatched_replacements_exception parent_class_type;
00362 typedef unreferenced_argument_exception class_type;
00364 typedef parent_class_type::string_type string_type;
00365
00366 public:
00367
00374 unreferenced_argument_exception(char const* message, ff_replacement_code_t code, int numberOfReplacements, int firstMismatchedReplacementIndex)
00375 : parent_class_type(validate_message_(message), code, numberOfReplacements, firstMismatchedReplacementIndex)
00376 {
00377 FASTFORMAT_COVER_MARK_ENTRY();
00378 }
00379 private:
00381 class_type& operator =(class_type const&);
00382 };
00383
00394 class bundle_exception
00395 : public fastformat_exception
00396 {
00397 public:
00398
00399 typedef fastformat_exception parent_class_type;
00401 typedef bundle_exception class_type;
00403 typedef parent_class_type::string_type string_type;
00404
00405 public:
00406
00410 explicit bundle_exception(char const* message)
00411 : parent_class_type(validate_message_(message))
00412 {
00413 FASTFORMAT_COVER_MARK_ENTRY();
00414 }
00415 virtual ~bundle_exception() stlsoft_throw_0() = 0;
00416 private:
00418 class_type& operator =(class_type const&);
00419 };
00420
00421
00422
00423
00424
00425 #ifndef FASTFORMAT_DOCUMENTATION_SKIP_SECTION
00426
00427 inline fastformat_exception::~fastformat_exception() stlsoft_throw_0()
00428 {}
00429
00430 inline format_parsing_exception::~format_parsing_exception() stlsoft_throw_0()
00431 {}
00432
00433 inline mismatched_replacements_exception::~mismatched_replacements_exception() stlsoft_throw_0()
00434 {}
00435
00436 inline bundle_exception::~bundle_exception() stlsoft_throw_0()
00437 {}
00438
00439 #endif
00440
00441
00442
00443
00444
00445 #if !defined(FASTFORMAT_NO_NAMESPACE)
00446 }
00447 #endif
00448
00449
00450
00451
00452
00453 #ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT
00454 # pragma once
00455 #endif
00456
00457
00458
00459 #endif
00460
00461