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

committed by
Jesse Beder

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