mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Modernize: Use "default" for destructors and copy constructors (#751)
This commit is contained in:

committed by
Jesse Beder

parent
e6b3a92e67
commit
a6ed66abca
@@ -17,7 +17,7 @@ struct Mark;
|
|||||||
|
|
||||||
class EventHandler {
|
class EventHandler {
|
||||||
public:
|
public:
|
||||||
virtual ~EventHandler() {}
|
virtual ~EventHandler() = default;
|
||||||
|
|
||||||
virtual void OnDocumentStart(const Mark& mark) = 0;
|
virtual void OnDocumentStart(const Mark& mark) = 0;
|
||||||
virtual void OnDocumentEnd() = 0;
|
virtual void OnDocumentEnd() = 0;
|
||||||
|
@@ -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 {}
|
virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT = default;
|
||||||
|
|
||||||
T key;
|
T key;
|
||||||
};
|
};
|
||||||
|
@@ -42,11 +42,7 @@ inline Node::Node(const detail::iterator_value& rhs)
|
|||||||
m_pMemory(rhs.m_pMemory),
|
m_pMemory(rhs.m_pMemory),
|
||||||
m_pNode(rhs.m_pNode) {}
|
m_pNode(rhs.m_pNode) {}
|
||||||
|
|
||||||
inline Node::Node(const Node& rhs)
|
inline Node::Node(const Node& rhs) = default;
|
||||||
: m_isValid(rhs.m_isValid),
|
|
||||||
m_invalidKey(rhs.m_invalidKey),
|
|
||||||
m_pMemory(rhs.m_pMemory),
|
|
||||||
m_pNode(rhs.m_pNode) {}
|
|
||||||
|
|
||||||
inline Node::Node(Zombie)
|
inline Node::Node(Zombie)
|
||||||
: m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
|
: m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
|
||||||
@@ -57,7 +53,7 @@ inline Node::Node(Zombie, const std::string& key)
|
|||||||
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
|
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
|
||||||
: m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
|
: m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
|
||||||
|
|
||||||
inline Node::~Node() {}
|
inline Node::~Node() = default;
|
||||||
|
|
||||||
inline void Node::EnsureNodeExists() const {
|
inline void Node::EnsureNodeExists() const {
|
||||||
if (!m_isValid)
|
if (!m_isValid)
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
namespace YAML {
|
namespace YAML {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct iterator_value : public Node, std::pair<Node, Node> {
|
struct iterator_value : public Node, std::pair<Node, Node> {
|
||||||
iterator_value() {}
|
iterator_value() = default;
|
||||||
explicit iterator_value(const Node& rhs)
|
explicit iterator_value(const Node& rhs)
|
||||||
: Node(rhs),
|
: Node(rhs),
|
||||||
std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
|
std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
|
||||||
|
@@ -16,7 +16,7 @@ Emitter::Emitter() : m_pState(new EmitterState), m_stream{} {}
|
|||||||
Emitter::Emitter(std::ostream& stream)
|
Emitter::Emitter(std::ostream& stream)
|
||||||
: m_pState(new EmitterState), m_stream(stream) {}
|
: m_pState(new EmitterState), m_stream(stream) {}
|
||||||
|
|
||||||
Emitter::~Emitter() {}
|
Emitter::~Emitter() = default;
|
||||||
|
|
||||||
const char* Emitter::c_str() const { return m_stream.str(); }
|
const char* Emitter::c_str() const { return m_stream.str(); }
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ EmitterState::EmitterState()
|
|||||||
m_hasNonContent(false),
|
m_hasNonContent(false),
|
||||||
m_docCount(0) {}
|
m_docCount(0) {}
|
||||||
|
|
||||||
EmitterState::~EmitterState() {}
|
EmitterState::~EmitterState() = default;
|
||||||
|
|
||||||
// SetLocalValue
|
// SetLocalValue
|
||||||
// . We blindly tries to set all possible formatters to this value
|
// . We blindly tries to set all possible formatters to this value
|
||||||
|
@@ -11,19 +11,19 @@
|
|||||||
namespace YAML {
|
namespace YAML {
|
||||||
|
|
||||||
// These destructors are defined out-of-line so the vtable is only emitted once.
|
// These destructors are defined out-of-line so the vtable is only emitted once.
|
||||||
Exception::~Exception() YAML_CPP_NOEXCEPT {}
|
Exception::~Exception() YAML_CPP_NOEXCEPT = default;
|
||||||
ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
|
ParserException::~ParserException() YAML_CPP_NOEXCEPT = default;
|
||||||
RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
|
RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT = default;
|
||||||
InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
|
InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT = default;
|
||||||
KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
|
KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT = default;
|
||||||
InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
|
InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT = default;
|
||||||
BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
|
BadConversion::~BadConversion() YAML_CPP_NOEXCEPT = default;
|
||||||
BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
|
BadDereference::~BadDereference() YAML_CPP_NOEXCEPT = default;
|
||||||
BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
|
BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT = default;
|
||||||
BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
|
BadPushback::~BadPushback() YAML_CPP_NOEXCEPT = default;
|
||||||
BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
|
BadInsert::~BadInsert() YAML_CPP_NOEXCEPT = default;
|
||||||
EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
|
EmitterException::~EmitterException() YAML_CPP_NOEXCEPT = default;
|
||||||
BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
|
BadFile::~BadFile() YAML_CPP_NOEXCEPT = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef YAML_CPP_NOEXCEPT
|
#undef YAML_CPP_NOEXCEPT
|
||||||
|
@@ -19,7 +19,7 @@ NodeBuilder::NodeBuilder()
|
|||||||
m_anchors.push_back(nullptr); // since the anchors start at 1
|
m_anchors.push_back(nullptr); // since the anchors start at 1
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeBuilder::~NodeBuilder() {}
|
NodeBuilder::~NodeBuilder() = default;
|
||||||
|
|
||||||
Node NodeBuilder::Root() {
|
Node NodeBuilder::Root() {
|
||||||
if (!m_pRoot)
|
if (!m_pRoot)
|
||||||
|
@@ -21,7 +21,7 @@ ostream_wrapper::ostream_wrapper(std::ostream& stream)
|
|||||||
m_col(0),
|
m_col(0),
|
||||||
m_comment(false) {}
|
m_comment(false) {}
|
||||||
|
|
||||||
ostream_wrapper::~ostream_wrapper() {}
|
ostream_wrapper::~ostream_wrapper() = default;
|
||||||
|
|
||||||
void ostream_wrapper::write(const std::string& str) {
|
void ostream_wrapper::write(const std::string& str) {
|
||||||
if (m_pStream) {
|
if (m_pStream) {
|
||||||
|
@@ -15,7 +15,7 @@ Parser::Parser() : m_pScanner{}, m_pDirectives{} {}
|
|||||||
|
|
||||||
Parser::Parser(std::istream& in) : Parser() { Load(in); }
|
Parser::Parser(std::istream& in) : Parser() { Load(in); }
|
||||||
|
|
||||||
Parser::~Parser() {}
|
Parser::~Parser() = default;
|
||||||
|
|
||||||
Parser::operator bool() const {
|
Parser::operator bool() const {
|
||||||
return m_pScanner.get() && !m_pScanner->empty();
|
return m_pScanner.get() && !m_pScanner->empty();
|
||||||
|
@@ -34,7 +34,7 @@ class YAML_CPP_API RegEx {
|
|||||||
explicit RegEx(char ch);
|
explicit RegEx(char ch);
|
||||||
RegEx(char a, char z);
|
RegEx(char a, char z);
|
||||||
RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
|
RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
|
||||||
~RegEx() {}
|
~RegEx() = default;
|
||||||
|
|
||||||
friend YAML_CPP_API RegEx operator!(const RegEx& ex);
|
friend YAML_CPP_API RegEx operator!(const RegEx& ex);
|
||||||
friend YAML_CPP_API RegEx operator|(const RegEx& ex1, const RegEx& ex2);
|
friend YAML_CPP_API RegEx operator|(const RegEx& ex1, const RegEx& ex2);
|
||||||
|
@@ -19,7 +19,7 @@ Scanner::Scanner(std::istream& in)
|
|||||||
m_indentRefs{},
|
m_indentRefs{},
|
||||||
m_flows{} {}
|
m_flows{} {}
|
||||||
|
|
||||||
Scanner::~Scanner() {}
|
Scanner::~Scanner() = default;
|
||||||
|
|
||||||
bool Scanner::empty() {
|
bool Scanner::empty() {
|
||||||
EnsureTokensInQueue();
|
EnsureTokensInQueue();
|
||||||
|
@@ -30,7 +30,7 @@ class Setting {
|
|||||||
|
|
||||||
class SettingChangeBase {
|
class SettingChangeBase {
|
||||||
public:
|
public:
|
||||||
virtual ~SettingChangeBase() {}
|
virtual ~SettingChangeBase() = default;
|
||||||
virtual void pop() = 0;
|
virtual void pop() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives)
|
|||||||
m_anchors{},
|
m_anchors{},
|
||||||
m_curAnchor(0) {}
|
m_curAnchor(0) {}
|
||||||
|
|
||||||
SingleDocParser::~SingleDocParser() {}
|
SingleDocParser::~SingleDocParser() = default;
|
||||||
|
|
||||||
// HandleDocument
|
// HandleDocument
|
||||||
// . Handles the next document
|
// . Handles the next document
|
||||||
|
@@ -13,12 +13,11 @@ namespace YAML {
|
|||||||
class StreamCharSource {
|
class StreamCharSource {
|
||||||
public:
|
public:
|
||||||
StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {}
|
StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {}
|
||||||
StreamCharSource(const StreamCharSource& source)
|
StreamCharSource(const StreamCharSource& source) = default;
|
||||||
: m_offset(source.m_offset), m_stream(source.m_stream) {}
|
|
||||||
StreamCharSource(StreamCharSource&&) = default;
|
StreamCharSource(StreamCharSource&&) = default;
|
||||||
StreamCharSource& operator=(const StreamCharSource&) = delete;
|
StreamCharSource& operator=(const StreamCharSource&) = delete;
|
||||||
StreamCharSource& operator=(StreamCharSource&&) = delete;
|
StreamCharSource& operator=(StreamCharSource&&) = delete;
|
||||||
~StreamCharSource() {}
|
~StreamCharSource() = default;
|
||||||
|
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
char operator[](std::size_t i) const { return m_stream.CharAt(m_offset + i); }
|
char operator[](std::size_t i) const { return m_stream.CharAt(m_offset + i); }
|
||||||
|
Reference in New Issue
Block a user