1 #ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 #define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 4 #if defined(_MSC_VER) || \ 5 (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 10 #include "yaml-cpp/emitterstyle.h" 11 #include "yaml-cpp/dll.h" 12 #include "yaml-cpp/node/type.h" 13 #include "yaml-cpp/node/ptr.h" 14 #include "yaml-cpp/node/detail/node_ref.h" 23 node& operator=(
const node&) =
delete;
25 bool is(
const node& rhs)
const {
return m_pRef == rhs.m_pRef; }
26 const node_ref* ref()
const {
return m_pRef.get(); }
28 bool is_defined()
const {
return m_pRef->is_defined(); }
29 const Mark& mark()
const {
return m_pRef->mark(); }
30 NodeType::value type()
const {
return m_pRef->type(); }
32 const std::string& scalar()
const {
return m_pRef->scalar(); }
33 const std::string& tag()
const {
return m_pRef->tag(); }
34 EmitterStyle::value style()
const {
return m_pRef->style(); }
37 bool equals(
const T& rhs, shared_memory_holder pMemory);
38 bool equals(
const char* rhs, shared_memory_holder pMemory);
44 m_pRef->mark_defined();
45 for (nodes::iterator it = m_dependencies.begin();
46 it != m_dependencies.end(); ++it)
47 (*it)->mark_defined();
48 m_dependencies.clear();
51 void add_dependency(
node& rhs) {
55 m_dependencies.insert(&rhs);
58 void set_ref(
const node& rhs) {
63 void set_data(
const node& rhs) {
66 m_pRef->set_data(*rhs.m_pRef);
69 void set_mark(
const Mark& mark) { m_pRef->set_mark(mark); }
71 void set_type(NodeType::value type) {
72 if (type != NodeType::Undefined)
74 m_pRef->set_type(type);
80 void set_scalar(
const std::string& scalar) {
82 m_pRef->set_scalar(scalar);
84 void set_tag(
const std::string& tag) {
90 void set_style(EmitterStyle::value style) {
92 m_pRef->set_style(style);
96 std::size_t size()
const {
return m_pRef->size(); }
99 return static_cast<const node_ref&
>(*m_pRef).begin();
104 return static_cast<const node_ref&
>(*m_pRef).end();
109 void push_back(
node& input, shared_memory_holder pMemory) {
110 m_pRef->push_back(input, pMemory);
111 input.add_dependency(*
this);
113 void insert(
node& key,
node& value, shared_memory_holder pMemory) {
114 m_pRef->insert(key, value, pMemory);
115 key.add_dependency(*
this);
116 value.add_dependency(*
this);
120 template <
typename Key>
121 node*
get(
const Key& key, shared_memory_holder pMemory)
const {
125 return static_cast<const node_ref&
>(*m_pRef).get(key, pMemory);
127 template <
typename Key>
128 node&
get(
const Key& key, shared_memory_holder pMemory) {
129 node& value = m_pRef->get(key, pMemory);
130 value.add_dependency(*
this);
133 template <
typename Key>
134 bool remove(
const Key& key, shared_memory_holder pMemory) {
135 return m_pRef->remove(key, pMemory);
138 node*
get(
node& key, shared_memory_holder pMemory)
const {
142 return static_cast<const node_ref&
>(*m_pRef).get(key, pMemory);
144 node&
get(
node& key, shared_memory_holder pMemory) {
145 node& value = m_pRef->get(key, pMemory);
146 key.add_dependency(*
this);
147 value.add_dependency(*
this);
150 bool remove(
node& key, shared_memory_holder pMemory) {
151 return m_pRef->remove(key, pMemory);
155 template <
typename Key,
typename Value>
156 void force_insert(
const Key& key,
const Value& value,
157 shared_memory_holder pMemory) {
158 m_pRef->force_insert(key, value, pMemory);
162 shared_node_ref m_pRef;
163 typedef std::set<node*> nodes;
164 nodes m_dependencies;
169 #endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
Definition: node_iterator.h:55
Definition: DrawableObjectLoader.h:10
Definition: node_ref.h:17