rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
c4::yml::ReadResult Struct Reference

A lightweight truthy type, used to enable reporting the offending node when a deserializing error happens in nested reads. More...

#include <common.hpp>

Public Types

enum  : id_type { VALID = NONE - 1 }

Public Member Functions

 operator bool () const noexcept
 convert to boolean to signify success/error
 ReadResult () noexcept
 construct as success
 ReadResult (id_type node_) noexcept
 construct as failure on the given node id
 ReadResult (id_type parent_, id_type node_) noexcept
 construct as failure on the given parent_, IF node_ is NONE
 ReadResult (bool ok, id_type node_) noexcept
 adapter: will match legacy user code (read() implementations returning bool).
 ReadResult (ReadResult result, id_type) noexcept
 adapter: will match up-to-date user code (read() implementations returning ReadResult).

Public Attributes

id_type node

Detailed Description

A lightweight truthy type, used to enable reporting the offending node when a deserializing error happens in nested reads.

It reports the innermost node causing the error, or true (empty-initialized) when there is no error.

Definition at line 161 of file common.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : id_type
Enumerator
VALID 

Definition at line 164 of file common.hpp.

164: id_type { VALID = NONE - 1 }; // NOLINT
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
Definition common.hpp:124
@ NONE
an index to none
Definition common.hpp:131

Constructor & Destructor Documentation

◆ ReadResult() [1/5]

c4::yml::ReadResult::ReadResult ( )
inlinenoexcept

construct as success

Definition at line 174 of file common.hpp.

174: node(VALID) {}

Referenced by ReadResult().

◆ ReadResult() [2/5]

c4::yml::ReadResult::ReadResult ( id_type node_)
inlineexplicitnoexcept

construct as failure on the given node id

Definition at line 177 of file common.hpp.

178 : node(node_) {}

◆ ReadResult() [3/5]

c4::yml::ReadResult::ReadResult ( id_type parent_,
id_type node_ )
inlineexplicitnoexcept

construct as failure on the given parent_, IF node_ is NONE

Definition at line 181 of file common.hpp.

182 : node(node_ != NONE ? VALID : parent_) {}

◆ ReadResult() [4/5]

c4::yml::ReadResult::ReadResult ( bool ok,
id_type node_ )
inlineexplicitnoexcept

adapter: will match legacy user code (read() implementations returning bool).

On error, this will report node_ as the offending node.

This is an adapter ctor used by rapidyaml in the functions calling read(), and enables rapidyaml to work both with legacy and up-to-date user implementations of read(). See for example Tree::deserialize().

Definition at line 200 of file common.hpp.

201 : node(ok ? VALID : node_) {}

◆ ReadResult() [5/5]

c4::yml::ReadResult::ReadResult ( ReadResult result,
id_type  )
inlineexplicitnoexcept

adapter: will match up-to-date user code (read() implementations returning ReadResult).

On error, this will report the node in the original ReadResult.

This is an adapter ctor used by rapidyaml in the functions calling read(), and enables rapidyaml to work both with legacy and up-to-date user implementations of read(). See for example Tree::deserialize().

Definition at line 212 of file common.hpp.

213 : node(result.node) {}

Member Function Documentation

◆ operator bool()

c4::yml::ReadResult::operator bool ( ) const
inlinenoexcept

convert to boolean to signify success/error

Definition at line 169 of file common.hpp.

169{ return node == VALID; }

Member Data Documentation

◆ node


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