rapidyaml  0.11.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 107 of file tree.hpp.

Constructor & Destructor Documentation

◆ NodeScalar() [1/7]

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

initialize as an empty scalar

Definition at line 116 of file tree.hpp.

116 : tag(), scalar(), anchor() {} // NOLINT
csubstr scalar
Definition: tree.hpp:110
csubstr anchor
Definition: tree.hpp:111

◆ NodeScalar() [2/7]

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

initialize as an untagged scalar

Definition at line 120 of file tree.hpp.

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

◆ NodeScalar() [3/7]

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

Definition at line 121 of file tree.hpp.

121 : 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 125 of file tree.hpp.

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

◆ NodeScalar() [5/7]

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

Definition at line 126 of file tree.hpp.

126 : 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 138 of file tree.hpp.

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

References empty().

◆ clear()

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

Definition at line 140 of file tree.hpp.

140 { tag.clear(); scalar.clear(); anchor.clear(); }

◆ set_ref_maybe_replacing_scalar()

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

Definition at line 142 of file tree.hpp.

143  {
144  csubstr trimmed = ref.begins_with('*') ? ref.sub(1) : ref;
145  anchor = trimmed;
146  if((!has_scalar) || !scalar.ends_with(trimmed))
147  scalar = ref;
148  }

Member Data Documentation

◆ tag

csubstr c4::yml::NodeScalar::tag

Definition at line 109 of file tree.hpp.

◆ scalar

csubstr c4::yml::NodeScalar::scalar

Definition at line 110 of file tree.hpp.

◆ anchor

csubstr c4::yml::NodeScalar::anchor

Definition at line 111 of file tree.hpp.


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