Fix comments on previous commit

This commit is contained in:
Ted Lyngmo 2019-03-12 17:45:33 +01:00
parent 5ab904311f
commit d1a722aba9
15 changed files with 42 additions and 59 deletions

View File

@ -22,6 +22,7 @@ namespace YAML {
template <class T>
class AnchorDict {
public:
AnchorDict() : m_data{} {}
void Register(anchor_t anchor, T value) {
if (anchor > m_data.size()) {
m_data.resize(anchor);
@ -32,7 +33,7 @@ class AnchorDict {
T Get(anchor_t anchor) const { return m_data[anchor - 1]; }
private:
std::vector<T> m_data{};
std::vector<T> m_data;
};
}

View File

@ -16,7 +16,6 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/emitterdef.h"
#include "yaml-cpp/emittermanip.h"
#include "yaml-cpp/noncopyable.h"
#include "yaml-cpp/null.h"
#include "yaml-cpp/ostream_wrapper.h"
@ -28,10 +27,12 @@ struct _Null;
namespace YAML {
class EmitterState;
class YAML_CPP_API Emitter : private noncopyable {
class YAML_CPP_API Emitter {
public:
Emitter();
explicit Emitter(std::ostream& stream);
Emitter(const Emitter&) = delete;
Emitter& operator=(const Emitter&) = delete;
~Emitter();
// output

View File

@ -22,12 +22,13 @@ namespace YAML {
namespace detail {
class YAML_CPP_API memory {
public:
memory() : m_nodes{} {}
node& create_node();
void merge(const memory& rhs);
private:
typedef std::set<shared_node> Nodes;
Nodes m_nodes{};
Nodes m_nodes;
};
class YAML_CPP_API memory_holder {

View File

@ -15,7 +15,7 @@
#include <string>
namespace YAML {
inline Node::Node() : m_isValid(true), m_pMemory(nullptr), m_pNode(NULL) {}
inline Node::Node() : m_isValid(true), m_pMemory(nullptr), m_pNode(nullptr) {}
inline Node::Node(NodeType::value type)
: m_isValid(true),
@ -42,7 +42,7 @@ inline Node::Node(const Node& rhs)
m_pMemory(rhs.m_pMemory),
m_pNode(rhs.m_pNode) {}
inline Node::Node(Zombie) : m_isValid(false), m_pMemory{}, m_pNode(NULL) {}
inline Node::Node(Zombie) : m_isValid(false), m_pMemory{}, m_pNode(nullptr) {}
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
: m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}

View File

@ -1,23 +0,0 @@
#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if defined(_MSC_VER) || \
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/dll.h"
namespace YAML {
// this is basically boost::noncopyable
class YAML_CPP_API noncopyable {
protected:
noncopyable() = default;
~noncopyable() = default;
noncopyable(const noncopyable&) = delete;
noncopyable& operator=(const noncopyable&) = delete;
};
}
#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -11,7 +11,6 @@
#include <memory>
#include "yaml-cpp/dll.h"
#include "yaml-cpp/noncopyable.h"
namespace YAML {
class EventHandler;
@ -24,11 +23,17 @@ struct Token;
* A parser turns a stream of bytes into one stream of "events" per YAML
* document in the input stream.
*/
class YAML_CPP_API Parser : private noncopyable {
class YAML_CPP_API Parser {
public:
/** Constructs an empty parser (with no input. */
Parser();
/** non copyable but movable */
Parser(const Parser&) = delete;
Parser(Parser&&) = default;
Parser& operator=(const Parser&) = delete;
Parser& operator=(Parser&&) = default;
/**
* Constructs a parser from the given input stream. The input stream must
* live as long as the parser.

View File

@ -17,6 +17,7 @@ struct CollectionType {
class CollectionStack {
public:
CollectionStack() : collectionStack{} {}
CollectionType::value GetCurCollectionType() const {
if (collectionStack.empty())
return CollectionType::NoCollection;
@ -33,7 +34,7 @@ class CollectionStack {
}
private:
std::stack<CollectionType::value> collectionStack{};
std::stack<CollectionType::value> collectionStack;
};
}

View File

@ -1,12 +1,7 @@
#include "directives.h"
namespace YAML {
Directives::Directives() : version{true, 1, 2}, tags{} {
/* Version:
** bool isDefault;
** int major, minor;
*/
}
Directives::Directives() : version{true, 1, 2}, tags{} {}
const std::string Directives::TranslateTagHandle(
const std::string& handle) const {

View File

@ -12,15 +12,17 @@
#include <memory>
#include <vector>
#include "yaml-cpp/noncopyable.h"
namespace YAML {
// TODO: This class is no longer needed
template <typename T>
class ptr_vector : private YAML::noncopyable {
class ptr_vector {
public:
ptr_vector() : m_data{} {}
ptr_vector(const ptr_vector&) = delete;
ptr_vector(ptr_vector&&) = default;
ptr_vector& operator=(const ptr_vector&) = delete;
ptr_vector& operator=(ptr_vector&&) = default;
void clear() { m_data.clear(); }

View File

@ -10,12 +10,7 @@ RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch), m_z(0), m_params{} {}
RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z), m_params{} {}
RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op), m_a(0), m_z(0), m_params(str.begin(), str.end()) {
/*
for (std::size_t i = 0; i < str.size(); i++)
m_params.push_back(RegEx(str[i]));
*/
}
RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op), m_a(0), m_z(0), m_params(str.begin(), str.end()) {}
// combination constructors
RegEx operator!(const RegEx& ex) {

View File

@ -31,7 +31,7 @@ enum REGEX_OP {
class YAML_CPP_API RegEx {
public:
RegEx();
RegEx(char ch);
explicit RegEx(char ch);
RegEx(char a, char z);
RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
~RegEx() {}
@ -53,7 +53,7 @@ class YAML_CPP_API RegEx {
int Match(const Source& source) const;
private:
RegEx(REGEX_OP op);
explicit RegEx(REGEX_OP op);
template <typename Source>
bool IsValidSource(const Source& source) const;

View File

@ -9,7 +9,7 @@
#include <memory>
#include <vector>
#include "yaml-cpp/noncopyable.h"
#include <utility>
namespace YAML {
class SettingChangeBase;
@ -37,7 +37,7 @@ class SettingChangeBase {
};
template <typename T>
class SettingChange : public SettingChangeBase, private noncopyable {
class SettingChange : public SettingChangeBase {
public:
SettingChange(Setting<T>* pSetting) :
m_pCurSetting(pSetting),
@ -62,9 +62,12 @@ inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) {
return pChange;
}
class SettingChanges : private noncopyable {
class SettingChanges {
public:
SettingChanges() : m_settingChanges{} {}
SettingChanges(const SettingChanges&) = delete;
SettingChanges(SettingChanges&& rhs) : m_settingChanges(std::move(rhs.m_settingChanges)) {}
SettingChanges& operator=(const SettingChanges&) = delete;
~SettingChanges() { clear(); }
void clear() {

View File

@ -12,7 +12,6 @@
#include <string>
#include "yaml-cpp/anchor.h"
#include "yaml-cpp/noncopyable.h"
namespace YAML {
class CollectionStack;
@ -23,9 +22,13 @@ struct Directives;
struct Mark;
struct Token;
class SingleDocParser : private noncopyable {
class SingleDocParser {
public:
SingleDocParser(Scanner& scanner, const Directives& directives);
SingleDocParser(const SingleDocParser&) = delete;
SingleDocParser(SingleDocParser&&) = delete;
SingleDocParser& operator=(const SingleDocParser&) = delete;
SingleDocParser& operator=(SingleDocParser&&) = delete;
~SingleDocParser();
void HandleDocument(EventHandler& eventHandler);

View File

@ -7,7 +7,6 @@
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include "yaml-cpp/mark.h"
#include <cstddef>
#include <deque>
@ -17,7 +16,7 @@
#include <string>
namespace YAML {
class Stream : private noncopyable {
class Stream {
public:
friend class StreamCharSource;

View File

@ -7,7 +7,6 @@
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include <cstddef>
namespace YAML {
@ -16,6 +15,9 @@ class StreamCharSource {
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(StreamCharSource&&) = delete;
StreamCharSource& operator=(const StreamCharSource&) = delete;
StreamCharSource& operator=(StreamCharSource&&) = delete;
~StreamCharSource() {}
operator bool() const;
@ -27,8 +29,6 @@ class StreamCharSource {
private:
std::size_t m_offset;
const Stream& m_stream;
StreamCharSource& operator=(const StreamCharSource&); // non-assignable
};
inline StreamCharSource::operator bool() const {