Skip to content

Commit bedb28f

Browse files
Liosanjbeder
authored andcommitted
Add missing YAML_CPP_API to exceptions.h, fixing MSVC compilation with BUILD_SHARED_LIBS (#462)
1 parent 86c69bb commit bedb28f

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

include/yaml-cpp/exceptions.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
108108
}
109109
}
110110

111-
class Exception : public std::runtime_error {
111+
class YAML_CPP_API Exception : public std::runtime_error {
112112
public:
113113
Exception(const Mark& mark_, const std::string& msg_)
114114
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
@@ -133,15 +133,15 @@ class Exception : public std::runtime_error {
133133
}
134134
};
135135

136-
class ParserException : public Exception {
136+
class YAML_CPP_API ParserException : public Exception {
137137
public:
138138
ParserException(const Mark& mark_, const std::string& msg_)
139139
: Exception(mark_, msg_) {}
140140
ParserException(const ParserException&) = default;
141141
virtual ~ParserException() noexcept;
142142
};
143143

144-
class RepresentationException : public Exception {
144+
class YAML_CPP_API RepresentationException : public Exception {
145145
public:
146146
RepresentationException(const Mark& mark_, const std::string& msg_)
147147
: Exception(mark_, msg_) {}
@@ -150,15 +150,15 @@ class RepresentationException : public Exception {
150150
};
151151

152152
// representation exceptions
153-
class InvalidScalar : public RepresentationException {
153+
class YAML_CPP_API InvalidScalar : public RepresentationException {
154154
public:
155155
InvalidScalar(const Mark& mark_)
156156
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
157157
InvalidScalar(const InvalidScalar&) = default;
158158
virtual ~InvalidScalar() noexcept;
159159
};
160160

161-
class KeyNotFound : public RepresentationException {
161+
class YAML_CPP_API KeyNotFound : public RepresentationException {
162162
public:
163163
template <typename T>
164164
KeyNotFound(const Mark& mark_, const T& key_)
@@ -169,7 +169,7 @@ class KeyNotFound : public RepresentationException {
169169
};
170170

171171
template <typename T>
172-
class TypedKeyNotFound : public KeyNotFound {
172+
class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
173173
public:
174174
TypedKeyNotFound(const Mark& mark_, const T& key_)
175175
: KeyNotFound(mark_, key_), key(key_) {}
@@ -184,15 +184,15 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
184184
return TypedKeyNotFound<T>(mark, key);
185185
}
186186

187-
class InvalidNode : public RepresentationException {
187+
class YAML_CPP_API InvalidNode : public RepresentationException {
188188
public:
189189
InvalidNode()
190190
: RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
191191
InvalidNode(const InvalidNode&) = default;
192192
virtual ~InvalidNode() noexcept;
193193
};
194194

195-
class BadConversion : public RepresentationException {
195+
class YAML_CPP_API BadConversion : public RepresentationException {
196196
public:
197197
explicit BadConversion(const Mark& mark_)
198198
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
@@ -206,47 +206,47 @@ class TypedBadConversion : public BadConversion {
206206
explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
207207
};
208208

209-
class BadDereference : public RepresentationException {
209+
class YAML_CPP_API BadDereference : public RepresentationException {
210210
public:
211211
BadDereference()
212212
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
213213
BadDereference(const BadDereference&) = default;
214214
virtual ~BadDereference() noexcept;
215215
};
216216

217-
class BadSubscript : public RepresentationException {
217+
class YAML_CPP_API BadSubscript : public RepresentationException {
218218
public:
219219
BadSubscript()
220220
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
221221
BadSubscript(const BadSubscript&) = default;
222222
virtual ~BadSubscript() noexcept;
223223
};
224224

225-
class BadPushback : public RepresentationException {
225+
class YAML_CPP_API BadPushback : public RepresentationException {
226226
public:
227227
BadPushback()
228228
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
229229
BadPushback(const BadPushback&) = default;
230230
virtual ~BadPushback() noexcept;
231231
};
232232

233-
class BadInsert : public RepresentationException {
233+
class YAML_CPP_API BadInsert : public RepresentationException {
234234
public:
235235
BadInsert()
236236
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
237237
BadInsert(const BadInsert&) = default;
238238
virtual ~BadInsert() noexcept;
239239
};
240240

241-
class EmitterException : public Exception {
241+
class YAML_CPP_API EmitterException : public Exception {
242242
public:
243243
EmitterException(const std::string& msg_)
244244
: Exception(Mark::null_mark(), msg_) {}
245245
EmitterException(const EmitterException&) = default;
246246
virtual ~EmitterException() noexcept;
247247
};
248248

249-
class BadFile : public Exception {
249+
class YAML_CPP_API BadFile : public Exception {
250250
public:
251251
BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
252252
BadFile(const BadFile&) = default;

0 commit comments

Comments
 (0)