| 18 | namespace YAML { |
| 19 | namespace detail { |
| 20 | class node { |
| 21 | private: |
| 22 | struct less { |
| 23 | bool operator ()(const node* l, const node* r) const {return l->m_index < r->m_index;} |
| 24 | }; |
| 25 | |
| 26 | public: |
| 27 | node() : m_pRef(new node_ref), m_dependencies{}, m_index{} {} |
| 28 | node(const node&) = delete; |
| 29 | node& operator=(const node&) = delete; |
| 30 | |
| 31 | bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; } |
| 32 | const node_ref* ref() const { return m_pRef.get(); } |
| 33 | |
| 34 | bool is_defined() const { return m_pRef->is_defined(); } |
| 35 | const Mark& mark() const { return m_pRef->mark(); } |
| 36 | NodeType::value type() const { return m_pRef->type(); } |
| 37 | |
| 38 | const std::string& scalar() const { return m_pRef->scalar(); } |
| 39 | const std::string& tag() const { return m_pRef->tag(); } |
| 40 | EmitterStyle::value style() const { return m_pRef->style(); } |
| 41 | |
| 42 | template <typename T> |
| 43 | bool equals(const T& rhs, shared_memory_holder pMemory); |
| 44 | bool equals(const char* rhs, shared_memory_holder pMemory); |
| 45 | |
| 46 | void mark_defined() { |
| 47 | if (is_defined()) |
| 48 | return; |
| 49 | |
| 50 | m_pRef->mark_defined(); |
| 51 | for (node* dependency : m_dependencies) |
| 52 | dependency->mark_defined(); |
| 53 | m_dependencies.clear(); |
| 54 | } |
| 55 | |
| 56 | void add_dependency(node& rhs) { |
| 57 | if (is_defined()) |
| 58 | rhs.mark_defined(); |
| 59 | else |
| 60 | m_dependencies.insert(&rhs); |
| 61 | } |
| 62 | |
| 63 | void set_ref(const node& rhs) { |
| 64 | if (rhs.is_defined()) |
| 65 | mark_defined(); |
| 66 | m_pRef = rhs.m_pRef; |
| 67 | } |
| 68 | void set_data(const node& rhs) { |
| 69 | if (rhs.is_defined()) |
| 70 | mark_defined(); |
| 71 | m_pRef->set_data(*rhs.m_pRef); |
| 72 | } |
| 73 | |
| 74 | void set_mark(const Mark& mark) { m_pRef->set_mark(mark); } |
| 75 | |
| 76 | void set_type(NodeType::value type) { |
| 77 | if (type != NodeType::Undefined) |
nothing calls this directly
no test coverage detected