mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Run clang-format.
This commit is contained in:
@@ -270,7 +270,6 @@ struct convert<std::array<T, N>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static bool isNodeValid(const Node& node) {
|
static bool isNodeValid(const Node& node) {
|
||||||
return node.IsSequence() && node.size() == N;
|
return node.IsSequence() && node.size() == N;
|
||||||
}
|
}
|
||||||
|
@@ -48,9 +48,8 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
|
|||||||
Pop();
|
Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeBuilder::OnSequenceStart(const Mark& mark,
|
void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
|
||||||
const std::string& tag, anchor_t anchor,
|
anchor_t anchor, EmitterStyle::value style) {
|
||||||
EmitterStyle::value style) {
|
|
||||||
detail::node& node = Push(mark, anchor);
|
detail::node& node = Push(mark, anchor);
|
||||||
node.set_tag(tag);
|
node.set_tag(tag);
|
||||||
node.set_type(NodeType::Sequence);
|
node.set_type(NodeType::Sequence);
|
||||||
|
@@ -4,6 +4,7 @@ namespace YAML {
|
|||||||
_Null Null;
|
_Null Null;
|
||||||
|
|
||||||
bool IsNullString(const std::string& str) {
|
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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,26 +22,18 @@ class ptr_vector : private YAML::noncopyable {
|
|||||||
public:
|
public:
|
||||||
ptr_vector() {}
|
ptr_vector() {}
|
||||||
|
|
||||||
void clear() {
|
void clear() { m_data.clear(); }
|
||||||
m_data.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t size() const { return m_data.size(); }
|
std::size_t size() const { return m_data.size(); }
|
||||||
bool empty() const { return m_data.empty(); }
|
bool empty() const { return m_data.empty(); }
|
||||||
|
|
||||||
void push_back(std::unique_ptr<T>&& t) {
|
void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
|
||||||
m_data.push_back(std::move(t));
|
|
||||||
}
|
|
||||||
T& operator[](std::size_t i) { return *m_data[i]; }
|
T& operator[](std::size_t i) { return *m_data[i]; }
|
||||||
const T& operator[](std::size_t i) const { return *m_data[i]; }
|
const T& operator[](std::size_t i) const { return *m_data[i]; }
|
||||||
|
|
||||||
T& back() {
|
T& back() { return *(m_data.back().get()); }
|
||||||
return *(m_data.back().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const T& back() const {
|
const T& back() const { return *(m_data.back().get()); }
|
||||||
return *(m_data.back().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<T>> m_data;
|
std::vector<std::unique_ptr<T>> m_data;
|
||||||
|
@@ -144,7 +144,8 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) {
|
|||||||
Node& nonConstUndefinedNode = const_cast<Node&>(undefinedCn);
|
Node& nonConstUndefinedNode = const_cast<Node&>(undefinedCn);
|
||||||
|
|
||||||
std::size_t count = 0;
|
std::size_t count = 0;
|
||||||
for (iterator it = nonConstUndefinedNode.begin(); it != nonConstUndefinedNode.end(); ++it) {
|
for (iterator it = nonConstUndefinedNode.begin();
|
||||||
|
it != nonConstUndefinedNode.end(); ++it) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
EXPECT_EQ(0, count);
|
EXPECT_EQ(0, count);
|
||||||
@@ -174,8 +175,8 @@ TEST(NodeTest, StdArrayWrongSize) {
|
|||||||
std::array<int, 3> evens{{2, 4, 6}};
|
std::array<int, 3> evens{{2, 4, 6}};
|
||||||
Node node;
|
Node node;
|
||||||
node["evens"] = evens;
|
node["evens"] = evens;
|
||||||
EXPECT_THROW_REPRESENTATION_EXCEPTION((node["evens"].as<std::array<int, 5>>()),
|
EXPECT_THROW_REPRESENTATION_EXCEPTION(
|
||||||
ErrorMsg::BAD_CONVERSION);
|
(node["evens"].as<std::array<int, 5>>()), ErrorMsg::BAD_CONVERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NodeTest, StdVector) {
|
TEST(NodeTest, StdVector) {
|
||||||
|
Reference in New Issue
Block a user