clang-format only the files changed on the cppref branch

Make SettingChanges move ctor default
This commit is contained in:
Ted Lyngmo 2019-03-13 07:24:03 +01:00
parent 0beba2c30f
commit 0b2309d17b
36 changed files with 113 additions and 111 deletions

View File

@ -22,10 +22,10 @@ class YAML_CPP_API Binary {
Binary(const unsigned char *data_, std::size_t size_)
: m_data{}, m_unownedData(data_), m_unownedSize(size_) {}
Binary() : Binary(nullptr, 0) {}
Binary(const Binary&) = default;
Binary(Binary&&) = default;
Binary& operator=(const Binary&) = default;
Binary& operator=(Binary&&) = default;
Binary(const Binary &) = default;
Binary(Binary &&) = default;
Binary &operator=(const Binary &) = default;
Binary &operator=(Binary &&) = default;
bool owned() const { return !m_unownedData; }
std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
@ -66,6 +66,6 @@ class YAML_CPP_API Binary {
const unsigned char *m_unownedData;
std::size_t m_unownedSize;
};
}
} // namespace YAML
#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -35,6 +35,6 @@ class AnchorDict {
private:
std::vector<T> m_data;
};
}
} // namespace YAML
#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -250,6 +250,6 @@ inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
return emitter.SetLocalPrecision(precision);
}
}
} // namespace YAML
#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -41,7 +41,7 @@ class YAML_CPP_API memory_holder {
private:
shared_memory m_pMemory;
};
}
}
} // namespace detail
} // namespace YAML
#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -7,11 +7,11 @@
#pragma once
#endif
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/dll.h"
#include "yaml-cpp/node/type.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/node/detail/node_ref.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h"
#include <set>
namespace YAML {
@ -163,7 +163,7 @@ class node {
typedef std::set<node*> nodes;
nodes m_dependencies;
};
}
}
} // namespace detail
} // namespace YAML
#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -7,11 +7,11 @@
#pragma once
#endif
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/iterator.h"
#include "yaml-cpp/exceptions.h"
#include "yaml-cpp/node/detail/memory.h"
#include "yaml-cpp/node/detail/node.h"
#include "yaml-cpp/exceptions.h"
#include "yaml-cpp/node/iterator.h"
#include "yaml-cpp/node/node.h"
#include <string>
namespace YAML {
@ -366,7 +366,7 @@ template <typename T>
inline typename to_value_t<T>::return_type to_value(const T& t) {
return to_value_t<T>(t)();
}
}
} // namespace detail
// indexing
template <typename Key>
@ -374,8 +374,8 @@ inline const Node Node::operator[](const Key& key) const {
if (!m_isValid)
throw InvalidNode();
EnsureNodeExists();
detail::node* value = static_cast<const detail::node&>(*m_pNode)
.get(detail::to_value(key), m_pMemory);
detail::node* value = static_cast<const detail::node&>(*m_pNode).get(
detail::to_value(key), m_pMemory);
if (!value) {
return Node(ZombieNode);
}
@ -443,6 +443,6 @@ inline void Node::force_insert(const Key& key, const Value& value) {
// free functions
inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
}
} // namespace YAML
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -56,7 +56,7 @@ class YAML_CPP_API ostream_wrapper {
template <std::size_t N>
inline ostream_wrapper& operator<<(ostream_wrapper& stream,
const char(&str)[N]) {
const char (&str)[N]) {
stream.write(str, N - 1);
return stream;
}
@ -71,6 +71,6 @@ inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
stream.write(&ch, 1);
return stream;
}
}
} // namespace YAML
#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -86,6 +86,6 @@ class YAML_CPP_API Parser {
std::unique_ptr<Scanner> m_pScanner;
std::unique_ptr<Directives> m_pDirectives;
};
}
} // namespace YAML
#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -7,8 +7,8 @@
#pragma once
#endif
#include <stack>
#include <cassert>
#include <stack>
namespace YAML {
struct CollectionType {
@ -36,6 +36,6 @@ class CollectionStack {
private:
std::stack<CollectionType::value> collectionStack;
};
}
} // namespace YAML
#endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -26,7 +26,11 @@ namespace YAML {
class GraphBuilderAdapter : public EventHandler {
public:
GraphBuilderAdapter(GraphBuilderInterface& builder)
: m_builder(builder), m_containers{}, m_anchors{}, m_pRootNode(nullptr), m_pKeyNode(nullptr) {}
: m_builder(builder),
m_containers{},
m_anchors{},
m_pRootNode(nullptr),
m_pKeyNode(nullptr) {}
GraphBuilderAdapter(const GraphBuilderAdapter&) = delete;
GraphBuilderAdapter(GraphBuilderAdapter&&) = delete;
GraphBuilderAdapter& operator=(const GraphBuilderAdapter&) = delete;
@ -78,6 +82,6 @@ class GraphBuilderAdapter : public EventHandler {
void RegisterAnchor(anchor_t anchor, void* pNode);
void DispositionNode(void* pNode);
};
}
} // namespace YAML
#endif // GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -14,4 +14,4 @@ const std::string Directives::TranslateTagHandle(
return it->second;
}
}
} // namespace YAML

View File

@ -16,10 +16,11 @@ std::string ToString(YAML::anchor_t anchor) {
stream << anchor;
return stream.str();
}
}
} // namespace
namespace YAML {
EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter), m_stateStack{} {}
EmitFromEvents::EmitFromEvents(Emitter& emitter)
: m_emitter(emitter), m_stateStack{} {}
void EmitFromEvents::OnDocumentStart(const Mark&) {}
@ -116,4 +117,4 @@ void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
if (anchor)
m_emitter << Anchor(ToString(anchor));
}
}
} // namespace YAML

View File

@ -906,4 +906,4 @@ Emitter& Emitter::Write(const Binary& binary) {
return *this;
}
}
} // namespace YAML

View File

@ -30,8 +30,7 @@ EmitterState::EmitterState()
m_hasAnchor(false),
m_hasTag(false),
m_hasNonContent(false),
m_docCount(0)
{}
m_docCount(0) {}
EmitterState::~EmitterState() {}
@ -367,4 +366,4 @@ bool EmitterState::SetDoublePrecision(std::size_t value,
_Set(m_doublePrecision, value, scope);
return true;
}
}
} // namespace YAML

View File

@ -145,7 +145,12 @@ class EmitterState {
struct Group {
explicit Group(GroupType::value type_)
: type(type_), flowType{}, indent(0), childCount(0), longKey(false), modifiedSettings{} {}
: type(type_),
flowType{},
indent(0),
childCount(0),
longKey(false),
modifiedSettings{} {}
GroupType::value type;
FlowType::value flowType;
@ -198,6 +203,6 @@ void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
assert(false);
}
}
}
} // namespace YAML
#endif // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -8,8 +8,8 @@
#include "regeximpl.h"
#include "stringsource.h"
#include "yaml-cpp/binary.h" // IWYU pragma: keep
#include "yaml-cpp/ostream_wrapper.h"
#include "yaml-cpp/null.h"
#include "yaml-cpp/ostream_wrapper.h"
namespace YAML {
namespace Utils {
@ -258,7 +258,7 @@ bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
}
return true;
}
}
} // namespace
StringFormat::value ComputeStringFormat(const std::string& str,
EMITTER_MANIP strFormat,
@ -401,8 +401,8 @@ bool WriteComment(ostream_wrapper& out, const std::string& str,
for (std::string::const_iterator i = str.begin();
GetNextCodePointAndAdvance(codePoint, i, str.end());) {
if (codePoint == '\n') {
out << "\n" << IndentTo(curIndent) << "#"
<< Indentation(postCommentIndent);
out << "\n"
<< IndentTo(curIndent) << "#" << Indentation(postCommentIndent);
out.set_comment();
} else {
WriteCodePoint(out, codePoint);
@ -479,5 +479,5 @@ bool WriteBinary(ostream_wrapper& out, const Binary& binary) {
false);
return true;
}
}
}
} // namespace Utils
} // namespace YAML

View File

@ -14,8 +14,8 @@ namespace YAML {
namespace detail {
const std::string& node_data::empty_scalar() {
static const std::string svalue;
return svalue;
static const std::string svalue;
return svalue;
}
node_data::node_data()
@ -28,8 +28,7 @@ node_data::node_data()
m_sequence{},
m_seqSize(0),
m_map{},
m_undefinedPairs{}
{}
m_undefinedPairs{} {}
void node_data::mark_defined() {
if (m_type == NodeType::Undefined)
@ -244,7 +243,8 @@ bool node_data::remove(node& key, shared_memory_holder /* pMemory */) {
if (m_type != NodeType::Map)
return false;
for(kv_pairs::iterator it = m_undefinedPairs.begin(); it != m_undefinedPairs.end();) {
for (kv_pairs::iterator it = m_undefinedPairs.begin();
it != m_undefinedPairs.end();) {
kv_pairs::iterator jt = std::next(it);
if (it->first->is(key))
m_undefinedPairs.erase(it);
@ -312,5 +312,5 @@ void node_data::convert_sequence_to_map(shared_memory_holder pMemory) {
reset_sequence();
m_type = NodeType::Map;
}
}
}
} // namespace detail
} // namespace YAML

View File

@ -16,8 +16,7 @@ NodeBuilder::NodeBuilder()
m_stack{},
m_anchors{},
m_keys{},
m_mapDepth(0)
{
m_mapDepth(0) {
m_anchors.push_back(nullptr); // since the anchors start at 1
}
@ -133,4 +132,4 @@ void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) {
m_anchors.push_back(&node);
}
}
}
} // namespace YAML

View File

@ -69,6 +69,6 @@ class NodeBuilder : public EventHandler {
std::vector<PushedKey> m_keys;
std::size_t m_mapDepth;
};
}
} // namespace YAML
#endif // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -98,4 +98,4 @@ bool NodeEvents::IsAliased(const detail::node& node) const {
RefCount::const_iterator it = m_refCount.find(node.ref());
return it != m_refCount.end() && it->second > 1;
}
}
} // namespace YAML

View File

@ -63,6 +63,6 @@ class NodeEvents {
typedef std::map<const detail::node_ref*, int> RefCount;
RefCount m_refCount;
};
}
} // namespace YAML
#endif // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -14,7 +14,12 @@ ostream_wrapper::ostream_wrapper()
m_comment(false) {}
ostream_wrapper::ostream_wrapper(std::ostream& stream)
: m_buffer{}, m_pStream(&stream), m_pos(0), m_row(0), m_col(0), m_comment(false) {}
: m_buffer{},
m_pStream(&stream),
m_pos(0),
m_row(0),
m_col(0),
m_comment(false) {}
ostream_wrapper::~ostream_wrapper() {}
@ -54,4 +59,4 @@ void ostream_wrapper::update_pos(char ch) {
m_comment = false;
}
}
}
} // namespace YAML

View File

@ -126,4 +126,4 @@ void Parser::PrintTokens(std::ostream& out) {
m_pScanner->pop();
}
}
}
} // namespace YAML

View File

@ -40,6 +40,6 @@ class ptr_vector {
private:
std::vector<std::unique_ptr<T>> m_data;
};
}
} // namespace YAML
#endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -10,7 +10,8 @@ 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()) {}
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) {
@ -39,4 +40,4 @@ RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
ret.m_params.push_back(ex2);
return ret;
}
}
} // namespace YAML

View File

@ -17,8 +17,7 @@ Scanner::Scanner(std::istream& in)
m_simpleKeys{},
m_indents{},
m_indentRefs{},
m_flows{}
{}
m_flows{} {}
Scanner::~Scanner() {}

View File

@ -434,4 +434,4 @@ void Scanner::ScanBlockScalar() {
token.value = scalar;
m_tokens.push(token);
}
}
} // namespace YAML

View File

@ -8,8 +8,8 @@
#endif
#include <memory>
#include <vector>
#include <utility>
#include <vector>
namespace YAML {
class SettingChangeBase;
@ -18,9 +18,7 @@ template <typename T>
class Setting {
public:
Setting() : m_value() {}
Setting(const T& value) : m_value() {
set(value);
}
Setting(const T& value) : m_value() { set(value); }
const T get() const { return m_value; }
std::unique_ptr<SettingChangeBase> set(const T& value);
@ -39,9 +37,9 @@ class SettingChangeBase {
template <typename T>
class SettingChange : public SettingChangeBase {
public:
SettingChange(Setting<T>* pSetting) :
m_pCurSetting(pSetting),
m_oldSetting(*pSetting) // copy old setting to save its state
SettingChange(Setting<T>* pSetting)
: m_pCurSetting(pSetting),
m_oldSetting(*pSetting) // copy old setting to save its state
{}
SettingChange(const SettingChange&) = delete;
SettingChange(SettingChange&&) = delete;
@ -66,7 +64,7 @@ class SettingChanges {
public:
SettingChanges() : m_settingChanges{} {}
SettingChanges(const SettingChanges&) = delete;
SettingChanges(SettingChanges&& rhs) : m_settingChanges(std::move(rhs.m_settingChanges)) {}
SettingChanges(SettingChanges&&) = default;
SettingChanges& operator=(const SettingChanges&) = delete;
~SettingChanges() { clear(); }
@ -100,6 +98,6 @@ class SettingChanges {
typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
setting_changes m_settingChanges;
};
}
} // namespace YAML
#endif // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -19,8 +19,7 @@ SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives)
m_directives(directives),
m_pCollectionStack(new CollectionStack),
m_anchors{},
m_curAnchor(0)
{}
m_curAnchor(0) {}
SingleDocParser::~SingleDocParser() {}
@ -413,4 +412,4 @@ anchor_t SingleDocParser::LookupAnchor(const Mark& mark,
return it->second;
}
}
} // namespace YAML

View File

@ -63,6 +63,6 @@ class SingleDocParser {
anchor_t m_curAnchor;
};
}
} // namespace YAML
#endif // SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -111,24 +111,15 @@ static UtfIntroState s_introTransitions[][uictMax] = {
static char s_introUngetCount[][uictMax] = {
// uict00, uictBB, uictBF, uictEF, uictFE, uictFF, uictAscii, uictOther
{0, 1, 1, 0, 0, 0, 0, 1},
{0, 2, 2, 2, 2, 2, 2, 2},
{3, 3, 3, 3, 0, 3, 3, 3},
{4, 4, 4, 4, 4, 0, 4, 4},
{1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1},
{2, 2, 2, 2, 2, 0, 2, 2},
{2, 2, 2, 2, 0, 2, 2, 2},
{0, 1, 1, 1, 1, 1, 1, 1},
{0, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1},
{0, 2, 2, 2, 2, 2, 2, 2},
{0, 3, 3, 3, 3, 3, 3, 3},
{4, 4, 4, 4, 4, 4, 4, 4},
{2, 0, 2, 2, 2, 2, 2, 2},
{3, 3, 0, 3, 3, 3, 3, 3},
{1, 1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 0, 0, 0, 0, 1}, {0, 2, 2, 2, 2, 2, 2, 2},
{3, 3, 3, 3, 0, 3, 3, 3}, {4, 4, 4, 4, 4, 0, 4, 4},
{1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1},
{2, 2, 2, 2, 2, 0, 2, 2}, {2, 2, 2, 2, 0, 2, 2, 2},
{0, 1, 1, 1, 1, 1, 1, 1}, {0, 2, 2, 2, 2, 2, 2, 2},
{1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1},
{0, 2, 2, 2, 2, 2, 2, 2}, {0, 3, 3, 3, 3, 3, 3, 3},
{4, 4, 4, 4, 4, 4, 4, 4}, {2, 0, 2, 2, 2, 2, 2, 2},
{3, 3, 0, 3, 3, 3, 3, 3}, {1, 1, 1, 1, 1, 1, 1, 1},
};
inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) {
@ -197,8 +188,7 @@ Stream::Stream(std::istream& input)
m_readahead{},
m_pPrefetched(new unsigned char[YAML_PREFETCH_SIZE]),
m_nPrefetchedAvailable(0),
m_nPrefetchedUsed(0)
{
m_nPrefetchedUsed(0) {
typedef std::istream::traits_type char_traits;
if (!input)
@ -449,4 +439,4 @@ void Stream::StreamInUtf32() const {
QueueUnicodeCodepoint(m_readahead, ch);
}
}
} // namespace YAML

View File

@ -74,6 +74,6 @@ inline bool Stream::ReadAheadTo(size_t i) const {
return true;
return _ReadAheadTo(i);
}
}
} // namespace YAML
#endif // STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -43,6 +43,6 @@ inline const StreamCharSource StreamCharSource::operator+(int i) const {
source.m_offset = 0;
return source;
}
}
} // namespace YAML
#endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -6,7 +6,8 @@
#include "token.h"
namespace YAML {
Tag::Tag(const Token& token) : type(static_cast<TYPE>(token.data)), handle{}, value{} {
Tag::Tag(const Token& token)
: type(static_cast<TYPE>(token.data)), handle{}, value{} {
switch (type) {
case VERBATIM:
value = token.value;
@ -46,4 +47,4 @@ const std::string Tag::Translate(const Directives& directives) {
}
throw std::runtime_error("yaml-cpp: internal error, bad tag type");
}
}
} // namespace YAML

View File

@ -14,10 +14,11 @@
namespace YAML {
const std::string TokenNames[] = {
"DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START", "BLOCK_MAP_START",
"BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", "FLOW_SEQ_START",
"FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", "FLOW_MAP_COMPACT",
"FLOW_ENTRY", "KEY", "VALUE", "ANCHOR", "ALIAS", "TAG", "SCALAR"};
"DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START",
"BLOCK_MAP_START", "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY",
"FLOW_SEQ_START", "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END",
"FLOW_MAP_COMPACT", "FLOW_ENTRY", "KEY", "VALUE",
"ANCHOR", "ALIAS", "TAG", "SCALAR"};
struct Token {
// enums
@ -64,6 +65,6 @@ struct Token {
std::vector<std::string> params;
int data;
};
}
} // namespace YAML
#endif // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@ -1,6 +1,6 @@
#include "gtest/gtest.h"
#include "regex_yaml.h"
#include "stream.h"
#include "gtest/gtest.h"
using YAML::RegEx;
using YAML::Stream;
@ -174,4 +174,4 @@ TEST(RegExTest, StringOr) {
EXPECT_EQ(1, ex.Match(str));
}
}
} // namespace