Skip to content

Commit

Permalink
Add missing YAML_CPP_API to exceptions.h, fixing MSVC compilation wit…
Browse files Browse the repository at this point in the history
…h BUILD_SHARED_LIBS (#462)
  • Loading branch information
Liosan authored and jbeder committed Feb 1, 2017
1 parent 86c69bb commit bedb28f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions include/yaml-cpp/exceptions.h
Expand Up @@ -108,7 +108,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
}
}

class Exception : public std::runtime_error {
class YAML_CPP_API Exception : public std::runtime_error {
public:
Exception(const Mark& mark_, const std::string& msg_)
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
Expand All @@ -133,15 +133,15 @@ class Exception : public std::runtime_error {
}
};

class ParserException : public Exception {
class YAML_CPP_API ParserException : public Exception {
public:
ParserException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
ParserException(const ParserException&) = default;
virtual ~ParserException() noexcept;
};

class RepresentationException : public Exception {
class YAML_CPP_API RepresentationException : public Exception {
public:
RepresentationException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
Expand All @@ -150,15 +150,15 @@ class RepresentationException : public Exception {
};

// representation exceptions
class InvalidScalar : public RepresentationException {
class YAML_CPP_API InvalidScalar : public RepresentationException {
public:
InvalidScalar(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
InvalidScalar(const InvalidScalar&) = default;
virtual ~InvalidScalar() noexcept;
};

class KeyNotFound : public RepresentationException {
class YAML_CPP_API KeyNotFound : public RepresentationException {
public:
template <typename T>
KeyNotFound(const Mark& mark_, const T& key_)
Expand All @@ -169,7 +169,7 @@ class KeyNotFound : public RepresentationException {
};

template <typename T>
class TypedKeyNotFound : public KeyNotFound {
class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
public:
TypedKeyNotFound(const Mark& mark_, const T& key_)
: KeyNotFound(mark_, key_), key(key_) {}
Expand All @@ -184,15 +184,15 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
return TypedKeyNotFound<T>(mark, key);
}

class InvalidNode : public RepresentationException {
class YAML_CPP_API InvalidNode : public RepresentationException {
public:
InvalidNode()
: RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
InvalidNode(const InvalidNode&) = default;
virtual ~InvalidNode() noexcept;
};

class BadConversion : public RepresentationException {
class YAML_CPP_API BadConversion : public RepresentationException {
public:
explicit BadConversion(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
Expand All @@ -206,47 +206,47 @@ class TypedBadConversion : public BadConversion {
explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
};

class BadDereference : public RepresentationException {
class YAML_CPP_API BadDereference : public RepresentationException {
public:
BadDereference()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
BadDereference(const BadDereference&) = default;
virtual ~BadDereference() noexcept;
};

class BadSubscript : public RepresentationException {
class YAML_CPP_API BadSubscript : public RepresentationException {
public:
BadSubscript()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
BadSubscript(const BadSubscript&) = default;
virtual ~BadSubscript() noexcept;
};

class BadPushback : public RepresentationException {
class YAML_CPP_API BadPushback : public RepresentationException {
public:
BadPushback()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
BadPushback(const BadPushback&) = default;
virtual ~BadPushback() noexcept;
};

class BadInsert : public RepresentationException {
class YAML_CPP_API BadInsert : public RepresentationException {
public:
BadInsert()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
BadInsert(const BadInsert&) = default;
virtual ~BadInsert() noexcept;
};

class EmitterException : public Exception {
class YAML_CPP_API EmitterException : public Exception {
public:
EmitterException(const std::string& msg_)
: Exception(Mark::null_mark(), msg_) {}
EmitterException(const EmitterException&) = default;
virtual ~EmitterException() noexcept;
};

class BadFile : public Exception {
class YAML_CPP_API BadFile : public Exception {
public:
BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
BadFile(const BadFile&) = default;
Expand Down

0 comments on commit bedb28f

Please sign in to comment.