1 #ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 #define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 4 #if defined(_MSC_VER) || \ 5 (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 10 #include "yaml-cpp/mark.h" 11 #include "yaml-cpp/traits.h" 19 const char*
const YAML_DIRECTIVE_ARGS =
20 "YAML directives must have exactly one argument";
21 const char*
const YAML_VERSION =
"bad YAML version: ";
22 const char*
const YAML_MAJOR_VERSION =
"YAML major version too large";
23 const char*
const REPEATED_YAML_DIRECTIVE =
"repeated YAML directive";
24 const char*
const TAG_DIRECTIVE_ARGS =
25 "TAG directives must have exactly two arguments";
26 const char*
const REPEATED_TAG_DIRECTIVE =
"repeated TAG directive";
27 const char*
const CHAR_IN_TAG_HANDLE =
28 "illegal character found while scanning tag handle";
29 const char*
const TAG_WITH_NO_SUFFIX =
"tag handle with no suffix";
30 const char*
const END_OF_VERBATIM_TAG =
"end of verbatim tag not found";
31 const char*
const END_OF_MAP =
"end of map not found";
32 const char*
const END_OF_MAP_FLOW =
"end of map flow not found";
33 const char*
const END_OF_SEQ =
"end of sequence not found";
34 const char*
const END_OF_SEQ_FLOW =
"end of sequence flow not found";
35 const char*
const MULTIPLE_TAGS =
36 "cannot assign multiple tags to the same node";
37 const char*
const MULTIPLE_ANCHORS =
38 "cannot assign multiple anchors to the same node";
39 const char*
const MULTIPLE_ALIASES =
40 "cannot assign multiple aliases to the same node";
41 const char*
const ALIAS_CONTENT =
42 "aliases can't have any content, *including* tags";
43 const char*
const INVALID_HEX =
"bad character found while scanning hex number";
44 const char*
const INVALID_UNICODE =
"invalid unicode: ";
45 const char*
const INVALID_ESCAPE =
"unknown escape character: ";
46 const char*
const UNKNOWN_TOKEN =
"unknown token";
47 const char*
const DOC_IN_SCALAR =
"illegal document indicator in scalar";
48 const char*
const EOF_IN_SCALAR =
"illegal EOF in scalar";
49 const char*
const CHAR_IN_SCALAR =
"illegal character in scalar";
50 const char*
const TAB_IN_INDENTATION =
51 "illegal tab when looking for indentation";
52 const char*
const FLOW_END =
"illegal flow end";
53 const char*
const BLOCK_ENTRY =
"illegal block entry";
54 const char*
const MAP_KEY =
"illegal map key";
55 const char*
const MAP_VALUE =
"illegal map value";
56 const char*
const ALIAS_NOT_FOUND =
"alias not found after *";
57 const char*
const ANCHOR_NOT_FOUND =
"anchor not found after &";
58 const char*
const CHAR_IN_ALIAS =
59 "illegal character found while scanning alias";
60 const char*
const CHAR_IN_ANCHOR =
61 "illegal character found while scanning anchor";
62 const char*
const ZERO_INDENT_IN_BLOCK =
63 "cannot set zero indentation for a block scalar";
64 const char*
const CHAR_IN_BLOCK =
"unexpected character in block scalar";
65 const char*
const AMBIGUOUS_ANCHOR =
66 "cannot assign the same alias to multiple nodes";
67 const char*
const UNKNOWN_ANCHOR =
"the referenced anchor is not defined";
69 const char*
const INVALID_NODE =
70 "invalid node; this may result from using a map iterator as a sequence " 71 "iterator, or vice-versa";
72 const char*
const INVALID_SCALAR =
"invalid scalar";
73 const char*
const KEY_NOT_FOUND =
"key not found";
74 const char*
const BAD_CONVERSION =
"bad conversion";
75 const char*
const BAD_DEREFERENCE =
"bad dereference";
76 const char*
const BAD_SUBSCRIPT =
"operator[] call on a scalar";
77 const char*
const BAD_PUSHBACK =
"appending to a non-sequence";
78 const char*
const BAD_INSERT =
"inserting in a non-convertible-to-map";
80 const char*
const UNMATCHED_GROUP_TAG =
"unmatched group tag";
81 const char*
const UNEXPECTED_END_SEQ =
"unexpected end sequence token";
82 const char*
const UNEXPECTED_END_MAP =
"unexpected end map token";
83 const char*
const SINGLE_QUOTED_CHAR =
84 "invalid character in single-quoted string";
85 const char*
const INVALID_ANCHOR =
"invalid anchor";
86 const char*
const INVALID_ALIAS =
"invalid alias";
87 const char*
const INVALID_TAG =
"invalid tag";
88 const char*
const BAD_FILE =
"bad file";
91 inline const std::string KEY_NOT_FOUND_WITH_KEY(
92 const T&,
typename disable_if<is_numeric<T>>::type* = 0) {
96 inline const std::string KEY_NOT_FOUND_WITH_KEY(
const std::string& key) {
97 std::stringstream stream;
98 stream << KEY_NOT_FOUND <<
": " << key;
102 template <
typename T>
103 inline const std::string KEY_NOT_FOUND_WITH_KEY(
104 const T& key,
typename enable_if<is_numeric<T>>::type* = 0) {
105 std::stringstream stream;
106 stream << KEY_NOT_FOUND <<
": " << key;
111 class YAML_CPP_API
Exception :
public std::runtime_error {
114 : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
123 static const std::string build_what(
const Mark& mark,
124 const std::string& msg) {
125 if (mark.is_null()) {
129 std::stringstream output;
130 output <<
"yaml-cpp: error at line " << mark.line + 1 <<
", column " 131 << mark.column + 1 <<
": " << msg;
163 template <
typename T>
171 template <
typename T>
181 template <
typename T>
203 template <
typename T>
257 #endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 Definition: exceptions.h:233
Definition: exceptions.h:153
Definition: exceptions.h:241
Definition: exceptions.h:217
Definition: exceptions.h:249
Definition: exceptions.h:225
Definition: exceptions.h:195
Definition: exceptions.h:136
Definition: exceptions.h:204
Definition: exceptions.h:161
Definition: exceptions.h:111
Definition: exceptions.h:187
Definition: DrawableObjectLoader.h:10
Definition: exceptions.h:172
Definition: exceptions.h:209
Definition: exceptions.h:144