1 #ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 #define VALUE_DETAIL_NODE_REF_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/dll.h" 11 #include "yaml-cpp/node/type.h" 12 #include "yaml-cpp/node/ptr.h" 13 #include "yaml-cpp/node/detail/node_data.h" 19 node_ref() : m_pData(new node_data) {}
20 node_ref(
const node_ref&) =
delete;
21 node_ref& operator=(
const node_ref&) =
delete;
23 bool is_defined()
const {
return m_pData->is_defined(); }
24 const Mark& mark()
const {
return m_pData->mark(); }
25 NodeType::value type()
const {
return m_pData->type(); }
26 const std::string& scalar()
const {
return m_pData->scalar(); }
27 const std::string& tag()
const {
return m_pData->tag(); }
28 EmitterStyle::value style()
const {
return m_pData->style(); }
30 void mark_defined() { m_pData->mark_defined(); }
31 void set_data(
const node_ref& rhs) { m_pData = rhs.m_pData; }
33 void set_mark(
const Mark& mark) { m_pData->set_mark(mark); }
34 void set_type(NodeType::value type) { m_pData->set_type(type); }
35 void set_tag(
const std::string& tag) { m_pData->set_tag(tag); }
36 void set_null() { m_pData->set_null(); }
37 void set_scalar(
const std::string& scalar) { m_pData->set_scalar(scalar); }
38 void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
41 std::size_t size()
const {
return m_pData->size(); }
43 const_node_iterator begin()
const {
44 return static_cast<const node_data&
>(*m_pData).begin();
46 node_iterator begin() {
return m_pData->begin(); }
48 const_node_iterator end()
const {
49 return static_cast<const node_data&
>(*m_pData).end();
51 node_iterator end() {
return m_pData->end(); }
54 void push_back(node& node, shared_memory_holder pMemory) {
55 m_pData->push_back(node, pMemory);
57 void insert(node& key, node& value, shared_memory_holder pMemory) {
58 m_pData->insert(key, value, pMemory);
62 template <
typename Key>
63 node*
get(
const Key& key, shared_memory_holder pMemory)
const {
64 return static_cast<const node_data&
>(*m_pData).get(key, pMemory);
66 template <
typename Key>
67 node&
get(
const Key& key, shared_memory_holder pMemory) {
68 return m_pData->get(key, pMemory);
70 template <
typename Key>
71 bool remove(
const Key& key, shared_memory_holder pMemory) {
72 return m_pData->remove(key, pMemory);
75 node*
get(node& key, shared_memory_holder pMemory)
const {
76 return static_cast<const node_data&
>(*m_pData).get(key, pMemory);
78 node&
get(node& key, shared_memory_holder pMemory) {
79 return m_pData->get(key, pMemory);
81 bool remove(node& key, shared_memory_holder pMemory) {
82 return m_pData->remove(key, pMemory);
86 template <
typename Key,
typename Value>
87 void force_insert(
const Key& key,
const Value& value,
88 shared_memory_holder pMemory) {
89 m_pData->force_insert(key, value, pMemory);
93 shared_node_data m_pData;
98 #endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66