rapidyaml  0.8.0
parse and emit YAML, and do it fast
c4::yml::NodeScalar Struct Reference

a node scalar is a csubstr, which may be tagged and anchored. More...

#include <tree.hpp>

Public Member Functions

 NodeScalar () noexcept
 initialize as an empty scalar More...
 
template<size_t N>
 NodeScalar (const char(&s)[N]) noexcept
 initialize as an untagged scalar More...
 
 NodeScalar (csubstr s) noexcept
 
template<size_t N, size_t M>
 NodeScalar (const char(&t)[N], const char(&s)[N]) noexcept
 initialize as a tagged scalar More...
 
 NodeScalar (csubstr t, csubstr s) noexcept
 
 ~NodeScalar () noexcept=default
 
 NodeScalar (NodeScalar &&) noexcept=default
 
 NodeScalar (NodeScalar const &) noexcept=default
 
NodeScalaroperator= (NodeScalar &&) noexcept=default
 
NodeScalaroperator= (NodeScalar const &) noexcept=default
 
bool empty () const noexcept
 
void clear () noexcept
 
void set_ref_maybe_replacing_scalar (csubstr ref, bool has_scalar) RYML_NOEXCEPT
 

Public Attributes

csubstr tag
 
csubstr scalar
 
csubstr anchor
 

Detailed Description

a node scalar is a csubstr, which may be tagged and anchored.

Definition at line 63 of file tree.hpp.

Constructor & Destructor Documentation

◆ NodeScalar() [1/7]

c4::yml::NodeScalar::NodeScalar ( )
inlinenoexcept

initialize as an empty scalar

Definition at line 72 of file tree.hpp.

72 : tag(), scalar(), anchor() {} // NOLINT
csubstr scalar
Definition: tree.hpp:66
csubstr anchor
Definition: tree.hpp:67

◆ NodeScalar() [2/7]

template<size_t N>
c4::yml::NodeScalar::NodeScalar ( const char(&)  s[N])
inlinenoexcept

initialize as an untagged scalar

Definition at line 76 of file tree.hpp.

76 : tag(), scalar(s), anchor() {}

◆ NodeScalar() [3/7]

c4::yml::NodeScalar::NodeScalar ( csubstr  s)
inlinenoexcept

Definition at line 77 of file tree.hpp.

77 : tag(), scalar(s), anchor() {}

◆ NodeScalar() [4/7]

template<size_t N, size_t M>
c4::yml::NodeScalar::NodeScalar ( const char(&)  t[N],
const char(&)  s[N] 
)
inlinenoexcept

initialize as a tagged scalar

Definition at line 81 of file tree.hpp.

81 : tag(t), scalar(s), anchor() {}

◆ NodeScalar() [5/7]

c4::yml::NodeScalar::NodeScalar ( csubstr  t,
csubstr  s 
)
inlinenoexcept

Definition at line 82 of file tree.hpp.

82 : tag(t), scalar(s), anchor() {}

◆ ~NodeScalar()

c4::yml::NodeScalar::~NodeScalar ( )
defaultnoexcept

◆ NodeScalar() [6/7]

c4::yml::NodeScalar::NodeScalar ( NodeScalar &&  )
defaultnoexcept

◆ NodeScalar() [7/7]

c4::yml::NodeScalar::NodeScalar ( NodeScalar const &  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

NodeScalar& c4::yml::NodeScalar::operator= ( NodeScalar &&  )
defaultnoexcept

◆ operator=() [2/2]

NodeScalar& c4::yml::NodeScalar::operator= ( NodeScalar const &  )
defaultnoexcept

◆ empty()

bool c4::yml::NodeScalar::empty ( ) const
inlinenoexcept

Definition at line 94 of file tree.hpp.

94 { return tag.empty() && scalar.empty() && anchor.empty(); }

References empty().

Referenced by empty().

◆ clear()

void c4::yml::NodeScalar::clear ( )
inlinenoexcept

◆ set_ref_maybe_replacing_scalar()

void c4::yml::NodeScalar::set_ref_maybe_replacing_scalar ( csubstr  ref,
bool  has_scalar 
)
inline

Definition at line 98 of file tree.hpp.

99  {
100  csubstr trimmed = ref.begins_with('*') ? ref.sub(1) : ref;
101  anchor = trimmed;
102  if((!has_scalar) || !scalar.ends_with(trimmed))
103  scalar = ref;
104  }

Member Data Documentation

◆ tag

csubstr c4::yml::NodeScalar::tag

Definition at line 65 of file tree.hpp.

Referenced by c4::yml::NodeInit::_add_flags(), and c4::yml::NodeInit::_check().

◆ scalar

csubstr c4::yml::NodeScalar::scalar

Definition at line 66 of file tree.hpp.

Referenced by c4::yml::NodeInit::_check(), and c4::yml::Tree::find_child().

◆ anchor

csubstr c4::yml::NodeScalar::anchor

Definition at line 67 of file tree.hpp.

Referenced by c4::yml::NodeInit::_add_flags().


The documentation for this struct was generated from the following file: