From b5b03bb9ad6325f844314e397fb3f1b1c58eeeff Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Wed, 12 Oct 2016 00:00:39 -0500 Subject: [PATCH] Run clang-format. --- include/yaml-cpp/exceptions.h | 4 +-- include/yaml-cpp/node/convert.h | 11 ++++---- include/yaml-cpp/node/detail/node_iterator.h | 2 +- include/yaml-cpp/node/emit.h | 2 +- src/emit.cpp | 2 +- src/nodebuilder.cpp | 5 ++-- src/null.cpp | 3 ++- src/ptr_vector.h | 18 ++++--------- src/scanner.cpp | 4 +-- test/node/node_test.cpp | 27 ++++++++++---------- 10 files changed, 35 insertions(+), 43 deletions(-) diff --git a/include/yaml-cpp/exceptions.h b/include/yaml-cpp/exceptions.h index 5d44c05..c554539 100644 --- a/include/yaml-cpp/exceptions.h +++ b/include/yaml-cpp/exceptions.h @@ -89,7 +89,7 @@ const char* const BAD_FILE = "bad file"; template inline const std::string KEY_NOT_FOUND_WITH_KEY( - const T&, typename disable_if >::type* = 0) { + const T&, typename disable_if>::type* = 0) { return KEY_NOT_FOUND; } @@ -101,7 +101,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) { template inline const std::string KEY_NOT_FOUND_WITH_KEY( - const T& key, typename enable_if >::type* = 0) { + const T& key, typename enable_if>::type* = 0) { std::stringstream stream; stream << KEY_NOT_FOUND << ": " << key; return stream.str(); diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index f232de7..45a878a 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -163,7 +163,7 @@ struct convert { // std::map template -struct convert > { +struct convert> { static Node encode(const std::map& rhs) { Node node(NodeType::Map); for (typename std::map::const_iterator it = rhs.begin(); @@ -190,7 +190,7 @@ struct convert > { // std::vector template -struct convert > { +struct convert> { static Node encode(const std::vector& rhs) { Node node(NodeType::Sequence); for (typename std::vector::const_iterator it = rhs.begin(); @@ -217,7 +217,7 @@ struct convert > { // std::list template -struct convert > { +struct convert> { static Node encode(const std::list& rhs) { Node node(NodeType::Sequence); for (typename std::list::const_iterator it = rhs.begin(); @@ -269,8 +269,7 @@ struct convert> { return true; } -private: - + private: static bool isNodeValid(const Node& node) { return node.IsSequence() && node.size() == N; } @@ -278,7 +277,7 @@ private: // std::pair template -struct convert > { +struct convert> { static Node encode(const std::pair& rhs) { Node node(NodeType::Sequence); node.push_back(rhs.first); diff --git a/include/yaml-cpp/node/detail/node_iterator.h b/include/yaml-cpp/node/detail/node_iterator.h index d5f4af8..4337df4 100644 --- a/include/yaml-cpp/node/detail/node_iterator.h +++ b/include/yaml-cpp/node/detail/node_iterator.h @@ -55,7 +55,7 @@ template class node_iterator_base : public std::iterator, std::ptrdiff_t, node_iterator_value*, - node_iterator_value > { + node_iterator_value> { private: struct enabler {}; diff --git a/include/yaml-cpp/node/emit.h b/include/yaml-cpp/node/emit.h index 9154b51..032268c 100644 --- a/include/yaml-cpp/node/emit.h +++ b/include/yaml-cpp/node/emit.h @@ -27,6 +27,6 @@ YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); /** Converts the node to a YAML string. */ YAML_CPP_API std::string Dump(const Node& node); -} // namespace YAML +} // namespace YAML #endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/src/emit.cpp b/src/emit.cpp index 67f68a9..51bc791 100644 --- a/src/emit.cpp +++ b/src/emit.cpp @@ -22,4 +22,4 @@ std::string Dump(const Node& node) { emitter << node; return emitter.c_str(); } -} // namespace YAML +} // namespace YAML diff --git a/src/nodebuilder.cpp b/src/nodebuilder.cpp index 20ec3ac..093d2ef 100644 --- a/src/nodebuilder.cpp +++ b/src/nodebuilder.cpp @@ -48,9 +48,8 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag, Pop(); } -void NodeBuilder::OnSequenceStart(const Mark& mark, - const std::string& tag, anchor_t anchor, - EmitterStyle::value style) { +void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { detail::node& node = Push(mark, anchor); node.set_tag(tag); node.set_type(NodeType::Sequence); diff --git a/src/null.cpp b/src/null.cpp index 7158bd4..d12dd08 100644 --- a/src/null.cpp +++ b/src/null.cpp @@ -4,6 +4,7 @@ namespace YAML { _Null Null; bool IsNullString(const std::string& str) { - return str.empty() || str == "~" || str == "null" || str == "Null" || str == "NULL"; + return str.empty() || str == "~" || str == "null" || str == "Null" || + str == "NULL"; } } diff --git a/src/ptr_vector.h b/src/ptr_vector.h index 3ebed28..955aebd 100644 --- a/src/ptr_vector.h +++ b/src/ptr_vector.h @@ -22,29 +22,21 @@ class ptr_vector : private YAML::noncopyable { public: ptr_vector() {} - void clear() { - m_data.clear(); - } + void clear() { m_data.clear(); } std::size_t size() const { return m_data.size(); } bool empty() const { return m_data.empty(); } - void push_back(std::unique_ptr&& t) { - m_data.push_back(std::move(t)); - } + void push_back(std::unique_ptr&& t) { m_data.push_back(std::move(t)); } T& operator[](std::size_t i) { return *m_data[i]; } const T& operator[](std::size_t i) const { return *m_data[i]; } - T& back() { - return *(m_data.back().get()); - } + T& back() { return *(m_data.back().get()); } - const T& back() const { - return *(m_data.back().get()); - } + const T& back() const { return *(m_data.back().get()); } private: - std::vector> m_data; + std::vector> m_data; }; } diff --git a/src/scanner.cpp b/src/scanner.cpp index 3c9e7af..b5cfcc1 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -65,9 +65,9 @@ void Scanner::EnsureTokensInQueue() { } // no token? maybe we've actually finished - if (m_endedStream) { + if (m_endedStream) { return; - } + } // no? then scan... ScanNextToken(); diff --git a/test/node/node_test.cpp b/test/node/node_test.cpp index 24c57ec..035f1d0 100644 --- a/test/node/node_test.cpp +++ b/test/node/node_test.cpp @@ -14,10 +14,10 @@ using ::testing::Eq; #define EXPECT_THROW_REPRESENTATION_EXCEPTION(statement, message) \ ASSERT_THROW(statement, RepresentationException); \ - try { \ - statement; \ + try { \ + statement; \ } catch (const RepresentationException& e) { \ - EXPECT_EQ(e.msg, message); \ + EXPECT_EQ(e.msg, message); \ } namespace YAML { @@ -132,7 +132,7 @@ TEST(NodeTest, ConstIteratorOnConstUndefinedNode) { std::size_t count = 0; for (const_iterator it = undefinedCn.begin(); it != undefinedCn.end(); ++it) { count++; - } + } EXPECT_EQ(0, count); } @@ -144,7 +144,8 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) { Node& nonConstUndefinedNode = const_cast(undefinedCn); std::size_t count = 0; - for (iterator it = nonConstUndefinedNode.begin(); it != nonConstUndefinedNode.end(); ++it) { + for (iterator it = nonConstUndefinedNode.begin(); + it != nonConstUndefinedNode.end(); ++it) { count++; } EXPECT_EQ(0, count); @@ -163,7 +164,7 @@ TEST(NodeTest, SimpleSubkeys) { } TEST(NodeTest, StdArray) { - std::array evens {{ 2, 4, 6, 8, 10 }}; + std::array evens{{2, 4, 6, 8, 10}}; Node node; node["evens"] = evens; std::array actualEvens = node["evens"].as>(); @@ -171,11 +172,11 @@ TEST(NodeTest, StdArray) { } TEST(NodeTest, StdArrayWrongSize) { - std::array evens {{ 2, 4, 6 }}; + std::array evens{{2, 4, 6}}; Node node; node["evens"] = evens; - EXPECT_THROW_REPRESENTATION_EXCEPTION((node["evens"].as>()), - ErrorMsg::BAD_CONVERSION); + EXPECT_THROW_REPRESENTATION_EXCEPTION( + (node["evens"].as>()), ErrorMsg::BAD_CONVERSION); } TEST(NodeTest, StdVector) { @@ -189,7 +190,7 @@ TEST(NodeTest, StdVector) { Node node; node["primes"] = primes; - EXPECT_EQ(primes, node["primes"].as >()); + EXPECT_EQ(primes, node["primes"].as>()); } TEST(NodeTest, StdList) { @@ -203,7 +204,7 @@ TEST(NodeTest, StdList) { Node node; node["primes"] = primes; - EXPECT_EQ(primes, node["primes"].as >()); + EXPECT_EQ(primes, node["primes"].as>()); } TEST(NodeTest, StdMap) { @@ -216,7 +217,7 @@ TEST(NodeTest, StdMap) { Node node; node["squares"] = squares; - std::map actualSquares = node["squares"].as >(); + std::map actualSquares = node["squares"].as>(); EXPECT_EQ(squares, actualSquares); } @@ -228,7 +229,7 @@ TEST(NodeTest, StdPair) { Node node; node["pair"] = p; std::pair actualP = - node["pair"].as >(); + node["pair"].as>(); EXPECT_EQ(p, actualP); }