Skip to content

Commit

Permalink
#2175: undo changes to EmitterNodeType
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Jan 5, 2024
1 parent 1999447 commit 9477c94
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 46 deletions.
4 changes: 2 additions & 2 deletions lib/yaml-cpp/include/yaml-cpp/emitfromevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class EmitFromEvents : public EventHandler {
anchor_t anchor, const std::string& value) override;

void OnSequenceStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override;
anchor_t anchor, EmitterStyle style) override;
void OnSequenceEnd() override;

void OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override;
anchor_t anchor, EmitterStyle style) override;
void OnMapEnd() override;

private:
Expand Down
4 changes: 1 addition & 3 deletions lib/yaml-cpp/include/yaml-cpp/emitterstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#endif

namespace YAML {
struct EmitterStyle {
enum value { Default, Block, Flow };
};
enum class EmitterStyle { Default, Block, Flow };
}

#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 changes: 2 additions & 2 deletions lib/yaml-cpp/include/yaml-cpp/eventhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class EventHandler {
anchor_t anchor, const std::string& value) = 0;

virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) = 0;
anchor_t anchor, EmitterStyle style) = 0;
virtual void OnSequenceEnd() = 0;

virtual void OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) = 0;
anchor_t anchor, EmitterStyle style) = 0;
virtual void OnMapEnd() = 0;

virtual void OnAnchor(const Mark& /*mark*/,
Expand Down
8 changes: 4 additions & 4 deletions lib/yaml-cpp/include/yaml-cpp/node/detail/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class node {

bool is_defined() const { return m_pRef->is_defined(); }
const Mark& mark() const { return m_pRef->mark(); }
NodeType::value type() const { return m_pRef->type(); }
NodeType type() const { return m_pRef->type(); }

const std::string& scalar() const { return m_pRef->scalar(); }
const std::string& tag() const { return m_pRef->tag(); }
EmitterStyle::value style() const { return m_pRef->style(); }
EmitterStyle style() const { return m_pRef->style(); }

template <typename T>
bool equals(const T& rhs, shared_memory_holder pMemory);
Expand Down Expand Up @@ -73,7 +73,7 @@ class node {

void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }

void set_type(NodeType::value type) {
void set_type(NodeType type) {
if (type != NodeType::Undefined)
mark_defined();
m_pRef->set_type(type);
Expand All @@ -92,7 +92,7 @@ class node {
}

// style
void set_style(EmitterStyle::value style) {
void set_style(EmitterStyle style) {
mark_defined();
m_pRef->set_style(style);
}
Expand Down
12 changes: 6 additions & 6 deletions lib/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ class YAML_CPP_API node_data {

void mark_defined();
void set_mark(const Mark& mark);
void set_type(NodeType::value type);
void set_type(NodeType type);
void set_tag(const std::string& tag);
void set_null();
void set_scalar(const std::string& scalar);
void set_style(EmitterStyle::value style);
void set_style(EmitterStyle style);

bool is_defined() const { return m_isDefined; }
const Mark& mark() const { return m_mark; }
NodeType::value type() const {
NodeType type() const {
return m_isDefined ? m_type : NodeType::Undefined;
}
const std::string& scalar() const { return m_scalar; }
const std::string& tag() const { return m_tag; }
EmitterStyle::value style() const { return m_style; }
EmitterStyle style() const { return m_style; }

// size/iterator
std::size_t size() const;
Expand Down Expand Up @@ -100,9 +100,9 @@ class YAML_CPP_API node_data {
private:
bool m_isDefined;
Mark m_mark;
NodeType::value m_type;
NodeType m_type;
std::string m_tag;
EmitterStyle::value m_style;
EmitterStyle m_style;

// scalar
std::string m_scalar;
Expand Down
8 changes: 4 additions & 4 deletions lib/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ class node_ref {

bool is_defined() const { return m_pData->is_defined(); }
const Mark& mark() const { return m_pData->mark(); }
NodeType::value type() const { return m_pData->type(); }
NodeType type() const { return m_pData->type(); }
const std::string& scalar() const { return m_pData->scalar(); }
const std::string& tag() const { return m_pData->tag(); }
EmitterStyle::value style() const { return m_pData->style(); }
EmitterStyle style() const { return m_pData->style(); }

void mark_defined() { m_pData->mark_defined(); }
void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }

void set_mark(const Mark& mark) { m_pData->set_mark(mark); }
void set_type(NodeType::value type) { m_pData->set_type(type); }
void set_type(NodeType type) { m_pData->set_type(type); }
void set_tag(const std::string& tag) { m_pData->set_tag(tag); }
void set_null() { m_pData->set_null(); }
void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); }
void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
void set_style(EmitterStyle style) { m_pData->set_style(style); }

// size/iterator
std::size_t size() const { return m_pData->size(); }
Expand Down
8 changes: 4 additions & 4 deletions lib/yaml-cpp/include/yaml-cpp/node/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace YAML {
inline Node::Node()
: m_isValid(true), m_invalidKey{}, m_pMemory(nullptr), m_pNode(nullptr) {}

inline Node::Node(NodeType::value type)
inline Node::Node(NodeType type)
: m_isValid(true),
m_invalidKey{},
m_pMemory(new detail::memory_holder),
Expand Down Expand Up @@ -79,7 +79,7 @@ inline Mark Node::Mark() const {
return m_pNode ? m_pNode->mark() : Mark::null_mark();
}

inline NodeType::value Node::Type() const {
inline NodeType Node::Type() const {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
return m_pNode ? m_pNode->type() : NodeType::Null;
Expand Down Expand Up @@ -180,13 +180,13 @@ inline void Node::SetTag(const std::string& tag) {
m_pNode->set_tag(tag);
}

inline EmitterStyle::value Node::Style() const {
inline EmitterStyle Node::Style() const {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
return m_pNode ? m_pNode->style() : EmitterStyle::Default;
}

inline void Node::SetStyle(EmitterStyle::value style) {
inline void Node::SetStyle(EmitterStyle style) {
EnsureNodeExists();
m_pNode->set_style(style);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/yaml-cpp/include/yaml-cpp/node/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class YAML_CPP_API Node {
using const_iterator = YAML::const_iterator;

Node();
explicit Node(NodeType::value type);
explicit Node(NodeType type);
template <typename T>
explicit Node(const T& rhs);
explicit Node(const detail::iterator_value& rhs);
Node(const Node& rhs);
~Node();

YAML::Mark Mark() const;
NodeType::value Type() const;
NodeType Type() const;
bool IsDefined() const;
bool IsNull() const { return Type() == NodeType::Null; }
bool IsScalar() const { return Type() == NodeType::Scalar; }
Expand All @@ -73,8 +73,8 @@ class YAML_CPP_API Node {

// style
// WARNING: This API might change in future releases.
EmitterStyle::value Style() const;
void SetStyle(EmitterStyle::value style);
EmitterStyle Style() const;
void SetStyle(EmitterStyle style);

// assignment
bool is(const Node& rhs) const;
Expand Down
4 changes: 1 addition & 3 deletions lib/yaml-cpp/include/yaml-cpp/node/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#endif

namespace YAML {
struct NodeType {
enum value { Undefined, Null, Scalar, Sequence, Map };
};
enum class NodeType { Undefined, Null, Scalar, Sequence, Map };
}

#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 changes: 2 additions & 2 deletions lib/yaml-cpp/src/emitfromevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void EmitFromEvents::OnScalar(const Mark&, const std::string& tag,

void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag,
anchor_t anchor,
EmitterStyle::value style) {
EmitterStyle style) {
BeginNode();
EmitProps(tag, anchor);
switch (style) {
Expand All @@ -72,7 +72,7 @@ void EmitFromEvents::OnSequenceEnd() {
}

void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) {
anchor_t anchor, EmitterStyle style) {
BeginNode();
EmitProps(tag, anchor);
switch (style) {
Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/src/node_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void node_data::mark_defined() {

void node_data::set_mark(const Mark& mark) { m_mark = mark; }

void node_data::set_type(NodeType::value type) {
void node_data::set_type(NodeType type) {
if (type == NodeType::Undefined) {
m_type = type;
m_isDefined = false;
Expand Down Expand Up @@ -73,7 +73,7 @@ void node_data::set_type(NodeType::value type) {

void node_data::set_tag(const std::string& tag) { m_tag = tag; }

void node_data::set_style(EmitterStyle::value style) { m_style = style; }
void node_data::set_style(EmitterStyle style) { m_style = style; }

void node_data::set_null() {
m_isDefined = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/src/nodebuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
}

void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) {
anchor_t anchor, EmitterStyle style) {
detail::node& node = Push(mark, anchor);
node.set_tag(tag);
node.set_type(NodeType::Sequence);
Expand All @@ -63,7 +63,7 @@ void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
void NodeBuilder::OnSequenceEnd() { Pop(); }

void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) {
anchor_t anchor, EmitterStyle style) {
detail::node& node = Push(mark, anchor);
node.set_type(NodeType::Map);
node.set_tag(tag);
Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/src/nodebuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class NodeBuilder : public EventHandler {
anchor_t anchor, const std::string& value) override;

void OnSequenceStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override;
anchor_t anchor, EmitterStyle style) override;
void OnSequenceEnd() override;

void OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override;
anchor_t anchor, EmitterStyle style) override;
void OnMapEnd() override;

private:
Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/util/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class NullEventHandler : public YAML::EventHandler {
const std::string&) override {}

void OnSequenceStart(const YAML::Mark&, const std::string&, YAML::anchor_t,
YAML::EmitterStyle::value) override {}
YAML::EmitterStyle) override {}
void OnSequenceEnd() override {}

void OnMapStart(const YAML::Mark&, const std::string&, YAML::anchor_t,
YAML::EmitterStyle::value) override {}
YAML::EmitterStyle) override {}
void OnMapEnd() override {}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/util/read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class NullEventHandler : public YAML::EventHandler {
void OnScalar(const Mark&, const std::string&, anchor_t,
const std::string&) override {}
void OnSequenceStart(const Mark&, const std::string&, anchor_t,
YAML::EmitterStyle::value style) override {}
YAML::EmitterStyle style) override {}
void OnSequenceEnd() override {}
void OnMapStart(const Mark&, const std::string&, anchor_t,
YAML::EmitterStyle::value style) override {}
YAML::EmitterStyle style) override {}
void OnMapEnd() override {}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-cpp/util/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class NullEventHandler : public YAML::EventHandler {
void OnScalar(const Mark&, const std::string&, anchor_t,
const std::string&) override {}
void OnSequenceStart(const Mark&, const std::string&, anchor_t,
YAML::EmitterStyle::value style) override {}
YAML::EmitterStyle style) override {}
void OnSequenceEnd() override {}
void OnMapStart(const Mark&, const std::string&, anchor_t,
YAML::EmitterStyle::value style) override {}
YAML::EmitterStyle style) override {}
void OnMapEnd() override {}
};

Expand Down

0 comments on commit 9477c94

Please sign in to comment.