rapidyaml  0.16.0
parseandemitYAML,anddoitfast
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
 
NodeScalar & operator= (NodeScalar &&) noexcept=default
 
NodeScalar & operator= (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 169 of file tree.hpp.

Constructor & Destructor Documentation

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

initialize as an empty scalar

Definition at line 178 of file tree.hpp.

178 : tag(), scalar(), anchor() {} // NOLINT
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
template<size_t N>
c4::yml::NodeScalar::NodeScalar ( const char(&)  s[N])
inlinenoexcept

initialize as an untagged scalar

Definition at line 182 of file tree.hpp.

182 : tag(), scalar(s), anchor() {}
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
c4::yml::NodeScalar::NodeScalar ( csubstr  s)
inlinenoexcept

Definition at line 183 of file tree.hpp.

183 : tag(), scalar(s), anchor() {}
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
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 187 of file tree.hpp.

187 : tag(t), scalar(s), anchor() {}
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
c4::yml::NodeScalar::NodeScalar ( csubstr  t,
csubstr  s 
)
inlinenoexcept

Definition at line 188 of file tree.hpp.

188 : tag(t), scalar(s), anchor() {}
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
c4::yml::NodeScalar::~NodeScalar ( )
defaultnoexcept
c4::yml::NodeScalar::NodeScalar ( NodeScalar &&  )
defaultnoexcept
c4::yml::NodeScalar::NodeScalar ( NodeScalar const &  )
defaultnoexcept

Member Function Documentation

NodeScalar& c4::yml::NodeScalar::operator= ( NodeScalar &&  )
defaultnoexcept
NodeScalar& c4::yml::NodeScalar::operator= ( NodeScalar const &  )
defaultnoexcept
bool c4::yml::NodeScalar::empty ( ) const
inlinenoexcept

Definition at line 200 of file tree.hpp.

200 { return tag.empty() && scalar.empty() && anchor.empty(); }
csubstr anchor
Definition: tree.hpp:173
csubstr scalar
Definition: tree.hpp:172
bool empty() const noexcept
Definition: substr.hpp:356
void c4::yml::NodeScalar::clear ( )
inlinenoexcept

Definition at line 202 of file tree.hpp.

202 { tag.clear(); scalar.clear(); anchor.clear(); }
csubstr anchor
Definition: tree.hpp:173
void clear() noexcept
Definition: substr.hpp:265
csubstr scalar
Definition: tree.hpp:172
void c4::yml::NodeScalar::set_ref_maybe_replacing_scalar ( csubstr  ref,
bool  has_scalar 
)
inline

Definition at line 204 of file tree.hpp.

205  {
206  csubstr trimmed = ref.begins_with('*') ? ref.sub(1) : ref;
207  anchor = trimmed;
208  if((!has_scalar) || !scalar.ends_with(trimmed))
209  scalar = ref;
210  }
csubstr anchor
Definition: tree.hpp:173
bool ends_with(const C c) const noexcept
true if the last character of the string is c
Definition: substr.hpp:894
basic_substring< const char > csubstr
an immutable string view
Definition: substr.hpp:2356
csubstr scalar
Definition: tree.hpp:172
bool begins_with(const C c) const noexcept
true if the first character of the string is c
Definition: substr.hpp:850

Member Data Documentation

csubstr c4::yml::NodeScalar::tag

Definition at line 171 of file tree.hpp.

csubstr c4::yml::NodeScalar::scalar

Definition at line 172 of file tree.hpp.

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

csubstr c4::yml::NodeScalar::anchor

Definition at line 173 of file tree.hpp.


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