rapidyaml  0.16.0
parseandemitYAML,anddoitfast
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 More...
 
 ReadResult () noexcept
 construct as success More...
 
 ReadResult (id_type node_) noexcept
 construct as failure on the given node id More...
 
 ReadResult (id_type parent_, id_type node_) noexcept
 construct as failure on the given parent_, IF node_ is NONE More...
 
 ReadResult (bool ok, id_type node_) noexcept
 adapter: will match legacy user code (read() implementations returning bool). More...
 
 ReadResult (ReadResult result, id_type) noexcept
 adapter: will match up-to-date user code (read() implementations returning ReadResult). More...
 

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 : id_type
Enumerator
VALID 

Definition at line 164 of file common.hpp.

164 : id_type { VALID = NONE - 1 }; // NOLINT
an index to none
Definition: common.hpp:131
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

Constructor & Destructor Documentation

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

construct as success

Definition at line 174 of file common.hpp.

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_) {}
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_) {}
an index to none
Definition: common.hpp:131
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_) {}
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

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


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