mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Modernization: Use "override" when overriding base class methods (#753)
This commit is contained in:

committed by
Jesse Beder

parent
99d95d8edc
commit
0fddd1e5bd
@@ -24,21 +24,21 @@ class EmitFromEvents : public EventHandler {
|
|||||||
public:
|
public:
|
||||||
EmitFromEvents(Emitter& emitter);
|
EmitFromEvents(Emitter& emitter);
|
||||||
|
|
||||||
virtual void OnDocumentStart(const Mark& mark);
|
void OnDocumentStart(const Mark& mark) override;
|
||||||
virtual void OnDocumentEnd();
|
void OnDocumentEnd() override;
|
||||||
|
|
||||||
virtual void OnNull(const Mark& mark, anchor_t anchor);
|
void OnNull(const Mark& mark, anchor_t anchor) override;
|
||||||
virtual void OnAlias(const Mark& mark, anchor_t anchor);
|
void OnAlias(const Mark& mark, anchor_t anchor) override;
|
||||||
virtual void OnScalar(const Mark& mark, const std::string& tag,
|
void OnScalar(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, const std::string& value);
|
anchor_t anchor, const std::string& value) override;
|
||||||
|
|
||||||
virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
|
void OnSequenceStart(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, EmitterStyle::value style);
|
anchor_t anchor, EmitterStyle::value style) override;
|
||||||
virtual void OnSequenceEnd();
|
void OnSequenceEnd() override;
|
||||||
|
|
||||||
virtual void OnMapStart(const Mark& mark, const std::string& tag,
|
void OnMapStart(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, EmitterStyle::value style);
|
anchor_t anchor, EmitterStyle::value style) override;
|
||||||
virtual void OnMapEnd();
|
void OnMapEnd() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void BeginNode();
|
void BeginNode();
|
||||||
|
@@ -149,7 +149,7 @@ class YAML_CPP_API Exception : public std::runtime_error {
|
|||||||
public:
|
public:
|
||||||
Exception(const Mark& mark_, const std::string& msg_)
|
Exception(const Mark& mark_, const std::string& msg_)
|
||||||
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
|
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
|
||||||
virtual ~Exception() YAML_CPP_NOEXCEPT;
|
~Exception() YAML_CPP_NOEXCEPT override;
|
||||||
|
|
||||||
Exception(const Exception&) = default;
|
Exception(const Exception&) = default;
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ class YAML_CPP_API ParserException : public Exception {
|
|||||||
ParserException(const Mark& mark_, const std::string& msg_)
|
ParserException(const Mark& mark_, const std::string& msg_)
|
||||||
: Exception(mark_, msg_) {}
|
: Exception(mark_, msg_) {}
|
||||||
ParserException(const ParserException&) = default;
|
ParserException(const ParserException&) = default;
|
||||||
virtual ~ParserException() YAML_CPP_NOEXCEPT;
|
~ParserException() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API RepresentationException : public Exception {
|
class YAML_CPP_API RepresentationException : public Exception {
|
||||||
@@ -183,7 +183,7 @@ class YAML_CPP_API RepresentationException : public Exception {
|
|||||||
RepresentationException(const Mark& mark_, const std::string& msg_)
|
RepresentationException(const Mark& mark_, const std::string& msg_)
|
||||||
: Exception(mark_, msg_) {}
|
: Exception(mark_, msg_) {}
|
||||||
RepresentationException(const RepresentationException&) = default;
|
RepresentationException(const RepresentationException&) = default;
|
||||||
virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
|
~RepresentationException() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// representation exceptions
|
// representation exceptions
|
||||||
@@ -192,7 +192,7 @@ class YAML_CPP_API InvalidScalar : public RepresentationException {
|
|||||||
InvalidScalar(const Mark& mark_)
|
InvalidScalar(const Mark& mark_)
|
||||||
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
|
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
|
||||||
InvalidScalar(const InvalidScalar&) = default;
|
InvalidScalar(const InvalidScalar&) = default;
|
||||||
virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
|
~InvalidScalar() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API KeyNotFound : public RepresentationException {
|
class YAML_CPP_API KeyNotFound : public RepresentationException {
|
||||||
@@ -202,7 +202,7 @@ class YAML_CPP_API KeyNotFound : public RepresentationException {
|
|||||||
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
|
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
|
||||||
}
|
}
|
||||||
KeyNotFound(const KeyNotFound&) = default;
|
KeyNotFound(const KeyNotFound&) = default;
|
||||||
virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
|
~KeyNotFound() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -210,7 +210,7 @@ class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
|
|||||||
public:
|
public:
|
||||||
TypedKeyNotFound(const Mark& mark_, const T& key_)
|
TypedKeyNotFound(const Mark& mark_, const T& key_)
|
||||||
: KeyNotFound(mark_, key_), key(key_) {}
|
: KeyNotFound(mark_, key_), key(key_) {}
|
||||||
virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT = default;
|
~TypedKeyNotFound() YAML_CPP_NOEXCEPT override = default;
|
||||||
|
|
||||||
T key;
|
T key;
|
||||||
};
|
};
|
||||||
@@ -227,7 +227,7 @@ class YAML_CPP_API InvalidNode : public RepresentationException {
|
|||||||
: RepresentationException(Mark::null_mark(),
|
: RepresentationException(Mark::null_mark(),
|
||||||
ErrorMsg::INVALID_NODE_WITH_KEY(key)) {}
|
ErrorMsg::INVALID_NODE_WITH_KEY(key)) {}
|
||||||
InvalidNode(const InvalidNode&) = default;
|
InvalidNode(const InvalidNode&) = default;
|
||||||
virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
|
~InvalidNode() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API BadConversion : public RepresentationException {
|
class YAML_CPP_API BadConversion : public RepresentationException {
|
||||||
@@ -235,7 +235,7 @@ class YAML_CPP_API BadConversion : public RepresentationException {
|
|||||||
explicit BadConversion(const Mark& mark_)
|
explicit BadConversion(const Mark& mark_)
|
||||||
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
|
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
|
||||||
BadConversion(const BadConversion&) = default;
|
BadConversion(const BadConversion&) = default;
|
||||||
virtual ~BadConversion() YAML_CPP_NOEXCEPT;
|
~BadConversion() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -249,7 +249,7 @@ class YAML_CPP_API BadDereference : public RepresentationException {
|
|||||||
BadDereference()
|
BadDereference()
|
||||||
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
|
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
|
||||||
BadDereference(const BadDereference&) = default;
|
BadDereference(const BadDereference&) = default;
|
||||||
virtual ~BadDereference() YAML_CPP_NOEXCEPT;
|
~BadDereference() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API BadSubscript : public RepresentationException {
|
class YAML_CPP_API BadSubscript : public RepresentationException {
|
||||||
@@ -259,7 +259,7 @@ class YAML_CPP_API BadSubscript : public RepresentationException {
|
|||||||
: RepresentationException(Mark::null_mark(),
|
: RepresentationException(Mark::null_mark(),
|
||||||
ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
|
ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
|
||||||
BadSubscript(const BadSubscript&) = default;
|
BadSubscript(const BadSubscript&) = default;
|
||||||
virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
|
~BadSubscript() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API BadPushback : public RepresentationException {
|
class YAML_CPP_API BadPushback : public RepresentationException {
|
||||||
@@ -267,7 +267,7 @@ class YAML_CPP_API BadPushback : public RepresentationException {
|
|||||||
BadPushback()
|
BadPushback()
|
||||||
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
|
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
|
||||||
BadPushback(const BadPushback&) = default;
|
BadPushback(const BadPushback&) = default;
|
||||||
virtual ~BadPushback() YAML_CPP_NOEXCEPT;
|
~BadPushback() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API BadInsert : public RepresentationException {
|
class YAML_CPP_API BadInsert : public RepresentationException {
|
||||||
@@ -275,7 +275,7 @@ class YAML_CPP_API BadInsert : public RepresentationException {
|
|||||||
BadInsert()
|
BadInsert()
|
||||||
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
|
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
|
||||||
BadInsert(const BadInsert&) = default;
|
BadInsert(const BadInsert&) = default;
|
||||||
virtual ~BadInsert() YAML_CPP_NOEXCEPT;
|
~BadInsert() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API EmitterException : public Exception {
|
class YAML_CPP_API EmitterException : public Exception {
|
||||||
@@ -283,14 +283,14 @@ class YAML_CPP_API EmitterException : public Exception {
|
|||||||
EmitterException(const std::string& msg_)
|
EmitterException(const std::string& msg_)
|
||||||
: Exception(Mark::null_mark(), msg_) {}
|
: Exception(Mark::null_mark(), msg_) {}
|
||||||
EmitterException(const EmitterException&) = default;
|
EmitterException(const EmitterException&) = default;
|
||||||
virtual ~EmitterException() YAML_CPP_NOEXCEPT;
|
~EmitterException() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class YAML_CPP_API BadFile : public Exception {
|
class YAML_CPP_API BadFile : public Exception {
|
||||||
public:
|
public:
|
||||||
BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
|
BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
|
||||||
BadFile(const BadFile&) = default;
|
BadFile(const BadFile&) = default;
|
||||||
virtual ~BadFile() YAML_CPP_NOEXCEPT;
|
~BadFile() YAML_CPP_NOEXCEPT override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,25 +31,25 @@ class NodeBuilder : public EventHandler {
|
|||||||
NodeBuilder(NodeBuilder&&) = delete;
|
NodeBuilder(NodeBuilder&&) = delete;
|
||||||
NodeBuilder& operator=(const NodeBuilder&) = delete;
|
NodeBuilder& operator=(const NodeBuilder&) = delete;
|
||||||
NodeBuilder& operator=(NodeBuilder&&) = delete;
|
NodeBuilder& operator=(NodeBuilder&&) = delete;
|
||||||
virtual ~NodeBuilder();
|
~NodeBuilder() override;
|
||||||
|
|
||||||
Node Root();
|
Node Root();
|
||||||
|
|
||||||
virtual void OnDocumentStart(const Mark& mark);
|
void OnDocumentStart(const Mark& mark) override;
|
||||||
virtual void OnDocumentEnd();
|
void OnDocumentEnd() override;
|
||||||
|
|
||||||
virtual void OnNull(const Mark& mark, anchor_t anchor);
|
void OnNull(const Mark& mark, anchor_t anchor) override;
|
||||||
virtual void OnAlias(const Mark& mark, anchor_t anchor);
|
void OnAlias(const Mark& mark, anchor_t anchor) override;
|
||||||
virtual void OnScalar(const Mark& mark, const std::string& tag,
|
void OnScalar(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, const std::string& value);
|
anchor_t anchor, const std::string& value) override;
|
||||||
|
|
||||||
virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
|
void OnSequenceStart(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, EmitterStyle::value style);
|
anchor_t anchor, EmitterStyle::value style) override;
|
||||||
virtual void OnSequenceEnd();
|
void OnSequenceEnd() override;
|
||||||
|
|
||||||
virtual void OnMapStart(const Mark& mark, const std::string& tag,
|
void OnMapStart(const Mark& mark, const std::string& tag,
|
||||||
anchor_t anchor, EmitterStyle::value style);
|
anchor_t anchor, EmitterStyle::value style) override;
|
||||||
virtual void OnMapEnd();
|
void OnMapEnd() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
detail::node& Push(const Mark& mark, anchor_t anchor);
|
detail::node& Push(const Mark& mark, anchor_t anchor);
|
||||||
|
@@ -46,7 +46,7 @@ class SettingChange : public SettingChangeBase {
|
|||||||
SettingChange& operator=(const SettingChange&) = delete;
|
SettingChange& operator=(const SettingChange&) = delete;
|
||||||
SettingChange& operator=(SettingChange&&) = delete;
|
SettingChange& operator=(SettingChange&&) = delete;
|
||||||
|
|
||||||
virtual void pop() { m_pCurSetting->restore(m_oldSetting); }
|
void pop() override { m_pCurSetting->restore(m_oldSetting); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Setting<T>* m_pCurSetting;
|
Setting<T>* m_pCurSetting;
|
||||||
|
Reference in New Issue
Block a user