rapidyaml 0.14.0
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
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
template<size_t N>
 NodeScalar (const char(&s)[N]) noexcept
 initialize as an untagged scalar
 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
 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 112 of file tree.hpp.

Constructor & Destructor Documentation

◆ NodeScalar() [1/7]

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

initialize as an empty scalar

Definition at line 121 of file tree.hpp.

121: tag(), scalar(), anchor() {} // NOLINT

◆ NodeScalar() [2/7]

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

initialize as an untagged scalar

Definition at line 125 of file tree.hpp.

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

◆ NodeScalar() [3/7]

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

Definition at line 126 of file tree.hpp.

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

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

◆ NodeScalar() [5/7]

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

Definition at line 131 of file tree.hpp.

131: 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 143 of file tree.hpp.

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

◆ clear()

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

Definition at line 145 of file tree.hpp.

145{ 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 147 of file tree.hpp.

148 {
149 csubstr trimmed = ref.begins_with('*') ? ref.sub(1) : ref;
150 anchor = trimmed;
151 if((!has_scalar) || !scalar.ends_with(trimmed))
152 scalar = ref;
153 }
basic_substring< const char > csubstr
an immutable string view
Definition substr.hpp:2357
bool begins_with(const C c) const noexcept
true if the first character of the string is c
Definition substr.hpp:851

Member Data Documentation

◆ tag

csubstr c4::yml::NodeScalar::tag

Definition at line 114 of file tree.hpp.

◆ scalar

csubstr c4::yml::NodeScalar::scalar

Definition at line 115 of file tree.hpp.

◆ anchor

csubstr c4::yml::NodeScalar::anchor

Definition at line 116 of file tree.hpp.


The documentation for this struct was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/v0.14.0/src/c4/yml/tree.hpp