LCOV - code coverage report
Current view: top level - usr/include/yaml-cpp/node/detail - node_ref.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 12 14 85.7 %
Date: 2025-08-24 09:11:10 Functions: 24 33 72.7 %

          Line data    Source code
       1             : #ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
       2             : #define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
       3             : 
       4             : #if defined(_MSC_VER) ||                                            \
       5             :     (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
       6             :      (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
       7             : #pragma once
       8             : #endif
       9             : 
      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"
      14             : 
      15             : namespace YAML {
      16             : namespace detail {
      17             : class node_ref {
      18             :  public:
      19             :   node_ref() : m_pData(new node_data) {}
      20             :   node_ref(const node_ref&) = delete;
      21             :   node_ref& operator=(const node_ref&) = delete;
      22             : 
      23       41110 :   bool is_defined() const { return m_pData->is_defined(); }
      24           0 :   const Mark& mark() const { return m_pData->mark(); }
      25       42681 :   NodeType::value type() const { return m_pData->type(); }
      26       36154 :   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(); }
      29             : 
      30       18674 :   void mark_defined() { m_pData->mark_defined(); }
      31             :   void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }
      32             : 
      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        1442 :   void set_null() { m_pData->set_null(); }
      37       17232 :   void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); }
      38             :   void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
      39             : 
      40             :   // size/iterator
      41           0 :   std::size_t size() const { return m_pData->size(); }
      42             : 
      43             :   const_node_iterator begin() const {
      44             :     return static_cast<const node_data&>(*m_pData).begin();
      45             :   }
      46        1113 :   node_iterator begin() { return m_pData->begin(); }
      47             : 
      48             :   const_node_iterator end() const {
      49             :     return static_cast<const node_data&>(*m_pData).end();
      50             :   }
      51        1113 :   node_iterator end() { return m_pData->end(); }
      52             : 
      53             :   // sequence
      54             :   void push_back(node& node, shared_memory_holder pMemory) {
      55             :     m_pData->push_back(node, pMemory);
      56             :   }
      57             :   void insert(node& key, node& value, shared_memory_holder pMemory) {
      58             :     m_pData->insert(key, value, pMemory);
      59             :   }
      60             : 
      61             :   // indexing
      62             :   template <typename Key>
      63        1542 :   node* get(const Key& key, shared_memory_holder pMemory) const {
      64        1542 :     return static_cast<const node_data&>(*m_pData).get(key, pMemory);
      65             :   }
      66             :   template <typename Key>
      67        9407 :   node& get(const Key& key, shared_memory_holder pMemory) {
      68        9407 :     return m_pData->get(key, pMemory);
      69             :   }
      70             :   template <typename Key>
      71             :   bool remove(const Key& key, shared_memory_holder pMemory) {
      72             :     return m_pData->remove(key, pMemory);
      73             :   }
      74             : 
      75             :   node* get(node& key, shared_memory_holder pMemory) const {
      76             :     return static_cast<const node_data&>(*m_pData).get(key, pMemory);
      77             :   }
      78             :   node& get(node& key, shared_memory_holder pMemory) {
      79             :     return m_pData->get(key, pMemory);
      80             :   }
      81             :   bool remove(node& key, shared_memory_holder pMemory) {
      82             :     return m_pData->remove(key, pMemory);
      83             :   }
      84             : 
      85             :   // map
      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);
      90             :   }
      91             : 
      92             :  private:
      93             :   shared_node_data m_pData;
      94             : };
      95             : }
      96             : }
      97             : 
      98             : #endif  // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66

Generated by: LCOV version 1.14