Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5b03bb

Browse files
committed
Run clang-format.
1 parent 086fec5 commit b5b03bb

10 files changed

Lines changed: 35 additions & 43 deletions

File tree

include/yaml-cpp/exceptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const char* const BAD_FILE = "bad file";
8989

9090
template <typename T>
9191
inline const std::string KEY_NOT_FOUND_WITH_KEY(
92-
const T&, typename disable_if<is_numeric<T> >::type* = 0) {
92+
const T&, typename disable_if<is_numeric<T>>::type* = 0) {
9393
return KEY_NOT_FOUND;
9494
}
9595

@@ -101,7 +101,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
101101

102102
template <typename T>
103103
inline const std::string KEY_NOT_FOUND_WITH_KEY(
104-
const T& key, typename enable_if<is_numeric<T> >::type* = 0) {
104+
const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
105105
std::stringstream stream;
106106
stream << KEY_NOT_FOUND << ": " << key;
107107
return stream.str();

include/yaml-cpp/node/convert.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ struct convert<bool> {
163163

164164
// std::map
165165
template <typename K, typename V>
166-
struct convert<std::map<K, V> > {
166+
struct convert<std::map<K, V>> {
167167
static Node encode(const std::map<K, V>& rhs) {
168168
Node node(NodeType::Map);
169169
for (typename std::map<K, V>::const_iterator it = rhs.begin();
@@ -190,7 +190,7 @@ struct convert<std::map<K, V> > {
190190

191191
// std::vector
192192
template <typename T>
193-
struct convert<std::vector<T> > {
193+
struct convert<std::vector<T>> {
194194
static Node encode(const std::vector<T>& rhs) {
195195
Node node(NodeType::Sequence);
196196
for (typename std::vector<T>::const_iterator it = rhs.begin();
@@ -217,7 +217,7 @@ struct convert<std::vector<T> > {
217217

218218
// std::list
219219
template <typename T>
220-
struct convert<std::list<T> > {
220+
struct convert<std::list<T>> {
221221
static Node encode(const std::list<T>& rhs) {
222222
Node node(NodeType::Sequence);
223223
for (typename std::list<T>::const_iterator it = rhs.begin();
@@ -269,16 +269,15 @@ struct convert<std::array<T, N>> {
269269
return true;
270270
}
271271

272-
private:
273-
272+
private:
274273
static bool isNodeValid(const Node& node) {
275274
return node.IsSequence() && node.size() == N;
276275
}
277276
};
278277

279278
// std::pair
280279
template <typename T, typename U>
281-
struct convert<std::pair<T, U> > {
280+
struct convert<std::pair<T, U>> {
282281
static Node encode(const std::pair<T, U>& rhs) {
283282
Node node(NodeType::Sequence);
284283
node.push_back(rhs.first);

include/yaml-cpp/node/detail/node_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ template <typename V>
5555
class node_iterator_base
5656
: public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
5757
std::ptrdiff_t, node_iterator_value<V>*,
58-
node_iterator_value<V> > {
58+
node_iterator_value<V>> {
5959
private:
6060
struct enabler {};
6161

include/yaml-cpp/node/emit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
2727

2828
/** Converts the node to a YAML string. */
2929
YAML_CPP_API std::string Dump(const Node& node);
30-
} // namespace YAML
30+
} // namespace YAML
3131

3232
#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66

src/emit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ std::string Dump(const Node& node) {
2222
emitter << node;
2323
return emitter.c_str();
2424
}
25-
} // namespace YAML
25+
} // namespace YAML

src/nodebuilder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
4848
Pop();
4949
}
5050

51-
void NodeBuilder::OnSequenceStart(const Mark& mark,
52-
const std::string& tag, anchor_t anchor,
53-
EmitterStyle::value style) {
51+
void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
52+
anchor_t anchor, EmitterStyle::value style) {
5453
detail::node& node = Push(mark, anchor);
5554
node.set_tag(tag);
5655
node.set_type(NodeType::Sequence);

src/null.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace YAML {
44
_Null Null;
55

66
bool IsNullString(const std::string& str) {
7-
return str.empty() || str == "~" || str == "null" || str == "Null" || str == "NULL";
7+
return str.empty() || str == "~" || str == "null" || str == "Null" ||
8+
str == "NULL";
89
}
910
}

src/ptr_vector.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,21 @@ class ptr_vector : private YAML::noncopyable {
2222
public:
2323
ptr_vector() {}
2424

25-
void clear() {
26-
m_data.clear();
27-
}
25+
void clear() { m_data.clear(); }
2826

2927
std::size_t size() const { return m_data.size(); }
3028
bool empty() const { return m_data.empty(); }
3129

32-
void push_back(std::unique_ptr<T>&& t) {
33-
m_data.push_back(std::move(t));
34-
}
30+
void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
3531
T& operator[](std::size_t i) { return *m_data[i]; }
3632
const T& operator[](std::size_t i) const { return *m_data[i]; }
3733

38-
T& back() {
39-
return *(m_data.back().get());
40-
}
34+
T& back() { return *(m_data.back().get()); }
4135

42-
const T& back() const {
43-
return *(m_data.back().get());
44-
}
36+
const T& back() const { return *(m_data.back().get()); }
4537

4638
private:
47-
std::vector<std::unique_ptr<T>> m_data;
39+
std::vector<std::unique_ptr<T>> m_data;
4840
};
4941
}
5042

src/scanner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ void Scanner::EnsureTokensInQueue() {
6565
}
6666

6767
// no token? maybe we've actually finished
68-
if (m_endedStream) {
68+
if (m_endedStream) {
6969
return;
70-
}
70+
}
7171

7272
// no? then scan...
7373
ScanNextToken();

test/node/node_test.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ using ::testing::Eq;
1414

1515
#define EXPECT_THROW_REPRESENTATION_EXCEPTION(statement, message) \
1616
ASSERT_THROW(statement, RepresentationException); \
17-
try { \
18-
statement; \
17+
try { \
18+
statement; \
1919
} catch (const RepresentationException& e) { \
20-
EXPECT_EQ(e.msg, message); \
20+
EXPECT_EQ(e.msg, message); \
2121
}
2222

2323
namespace YAML {
@@ -132,7 +132,7 @@ TEST(NodeTest, ConstIteratorOnConstUndefinedNode) {
132132
std::size_t count = 0;
133133
for (const_iterator it = undefinedCn.begin(); it != undefinedCn.end(); ++it) {
134134
count++;
135-
}
135+
}
136136
EXPECT_EQ(0, count);
137137
}
138138

@@ -144,7 +144,8 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) {
144144
Node& nonConstUndefinedNode = const_cast<Node&>(undefinedCn);
145145

146146
std::size_t count = 0;
147-
for (iterator it = nonConstUndefinedNode.begin(); it != nonConstUndefinedNode.end(); ++it) {
147+
for (iterator it = nonConstUndefinedNode.begin();
148+
it != nonConstUndefinedNode.end(); ++it) {
148149
count++;
149150
}
150151
EXPECT_EQ(0, count);
@@ -163,19 +164,19 @@ TEST(NodeTest, SimpleSubkeys) {
163164
}
164165

165166
TEST(NodeTest, StdArray) {
166-
std::array<int, 5> evens {{ 2, 4, 6, 8, 10 }};
167+
std::array<int, 5> evens{{2, 4, 6, 8, 10}};
167168
Node node;
168169
node["evens"] = evens;
169170
std::array<int, 5> actualEvens = node["evens"].as<std::array<int, 5>>();
170171
EXPECT_EQ(evens, actualEvens);
171172
}
172173

173174
TEST(NodeTest, StdArrayWrongSize) {
174-
std::array<int, 3> evens {{ 2, 4, 6 }};
175+
std::array<int, 3> evens{{2, 4, 6}};
175176
Node node;
176177
node["evens"] = evens;
177-
EXPECT_THROW_REPRESENTATION_EXCEPTION((node["evens"].as<std::array<int, 5>>()),
178-
ErrorMsg::BAD_CONVERSION);
178+
EXPECT_THROW_REPRESENTATION_EXCEPTION(
179+
(node["evens"].as<std::array<int, 5>>()), ErrorMsg::BAD_CONVERSION);
179180
}
180181

181182
TEST(NodeTest, StdVector) {
@@ -189,7 +190,7 @@ TEST(NodeTest, StdVector) {
189190

190191
Node node;
191192
node["primes"] = primes;
192-
EXPECT_EQ(primes, node["primes"].as<std::vector<int> >());
193+
EXPECT_EQ(primes, node["primes"].as<std::vector<int>>());
193194
}
194195

195196
TEST(NodeTest, StdList) {
@@ -203,7 +204,7 @@ TEST(NodeTest, StdList) {
203204

204205
Node node;
205206
node["primes"] = primes;
206-
EXPECT_EQ(primes, node["primes"].as<std::list<int> >());
207+
EXPECT_EQ(primes, node["primes"].as<std::list<int>>());
207208
}
208209

209210
TEST(NodeTest, StdMap) {
@@ -216,7 +217,7 @@ TEST(NodeTest, StdMap) {
216217

217218
Node node;
218219
node["squares"] = squares;
219-
std::map<int, int> actualSquares = node["squares"].as<std::map<int, int> >();
220+
std::map<int, int> actualSquares = node["squares"].as<std::map<int, int>>();
220221
EXPECT_EQ(squares, actualSquares);
221222
}
222223

@@ -228,7 +229,7 @@ TEST(NodeTest, StdPair) {
228229
Node node;
229230
node["pair"] = p;
230231
std::pair<int, std::string> actualP =
231-
node["pair"].as<std::pair<int, std::string> >();
232+
node["pair"].as<std::pair<int, std::string>>();
232233
EXPECT_EQ(p, actualP);
233234
}
234235

0 commit comments

Comments
 (0)