ROSE 0.11.145.192
Public Types | Public Member Functions | List of all members
Sawyer::Yaml::Node Class Reference

Description

YAML node.

Definition at line 325 of file Sawyer/Yaml.h.

#include <Sawyer/Yaml.h>

Public Types

enum  eType {
  None ,
  SequenceType ,
  MapType ,
  ScalarType
}
 Enumeration of node types. More...
 

Public Member Functions

 Node ()
 Default constructor.
 
 Node (const Node &node)
 Copy constructor.
 
 ~Node ()
 Destructor.
 
 operator bool () const
 Predicate to test whether node exists.
 
bool operator! () const
 Predicate to test whether node exists.
 
void clear ()
 Completely clear node.
 
size_t size () const
 Get size of node.
 
Nodeinsert (const size_t index)
 Insert sequence item at given index.
 
NodepushFront ()
 Add new sequence index to front.
 
NodepushBack ()
 Add new sequence index to back.
 
bool exists (const std::string &key) const
 Test whether a map item exists without inserting it.
 
eType Type () const
 
bool IsNone () const
 
bool IsSequence () const
 
bool IsMap () const
 
bool IsScalar () const
 
void Clear ()
 
size_t Size () const
 
NodeInsert (const size_t index)
 
NodePushFront ()
 
NodePushBack ()
 
void Erase (const size_t index)
 
void Erase (const std::string &key)
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 
template<typename T >
As () const
 
template<typename T >
As (const T &defaultValue) const
 
 Node (const std::string &value)
 Assignment constructors.
 
 Node (const char *value)
 Assignment constructors.
 
eType type () const
 Functions for checking type of node.
 
bool isNone () const
 Functions for checking type of node.
 
bool isSequence () const
 Functions for checking type of node.
 
bool isMap () const
 Functions for checking type of node.
 
bool isScalar () const
 Functions for checking type of node.
 
template<typename T >
as () const
 Get node as given template type.
 
template<typename T >
as (const T &defaultValue) const
 Get node as given template type.
 
Nodeoperator[] (const size_t index)
 Get sequence/map item.
 
Nodeoperator[] (const size_t index) const
 Get sequence/map item.
 
Nodeoperator[] (const std::string &key)
 Get sequence/map item.
 
Nodeoperator[] (const std::string &key) const
 Get sequence/map item.
 
void erase (const size_t index)
 Erase item.
 
void erase (const std::string &key)
 Erase item.
 
Nodeoperator= (const Node &node)
 Assignment operators.
 
Nodeoperator= (const std::string &value)
 Assignment operators.
 
Nodeoperator= (const char *value)
 Assignment operators.
 
template<class T >
Nodeoperator= (const T &value)
 Assignment operators.
 
Iterator begin ()
 Get start iterator.
 
ConstIterator begin () const
 Get start iterator.
 
Iterator end ()
 Get end iterator.
 
ConstIterator end () const
 Get end iterator.
 

Member Enumeration Documentation

◆ eType

Enumeration of node types.

Definition at line 330 of file Sawyer/Yaml.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

Sawyer::Yaml::Node::Node ( const std::string &  value)
explicit

Assignment constructors.

Converts node to scalar type if needed.

◆ Node() [2/2]

Sawyer::Yaml::Node::Node ( const char *  value)
explicit

Assignment constructors.

Converts node to scalar type if needed.

Member Function Documentation

◆ type()

eType Sawyer::Yaml::Node::type ( ) const
inline

Functions for checking type of node.

Definition at line 358 of file Sawyer/Yaml.h.

◆ isNone()

bool Sawyer::Yaml::Node::isNone ( ) const
inline

Functions for checking type of node.

Definition at line 359 of file Sawyer/Yaml.h.

Referenced by operator bool(), and operator!().

◆ isSequence()

bool Sawyer::Yaml::Node::isSequence ( ) const
inline

Functions for checking type of node.

Definition at line 360 of file Sawyer/Yaml.h.

◆ isMap()

bool Sawyer::Yaml::Node::isMap ( ) const
inline

Functions for checking type of node.

Definition at line 361 of file Sawyer/Yaml.h.

◆ isScalar()

bool Sawyer::Yaml::Node::isScalar ( ) const
inline

Functions for checking type of node.

Definition at line 362 of file Sawyer/Yaml.h.

◆ operator bool()

Sawyer::Yaml::Node::operator bool ( ) const
inlineexplicit

Predicate to test whether node exists.

Returns true unless the node isNone.

Definition at line 368 of file Sawyer/Yaml.h.

References isNone().

◆ operator!()

bool Sawyer::Yaml::Node::operator! ( ) const
inline

Predicate to test whether node exists.

Returns true if node isNone.

Definition at line 375 of file Sawyer/Yaml.h.

References isNone().

◆ clear()

void Sawyer::Yaml::Node::clear ( )
inline

Completely clear node.

Definition at line 380 of file Sawyer/Yaml.h.

◆ as() [1/2]

template<typename T >
T Sawyer::Yaml::Node::as ( ) const
inline

Get node as given template type.

Definition at line 386 of file Sawyer/Yaml.h.

◆ as() [2/2]

template<typename T >
T Sawyer::Yaml::Node::as ( const T &  defaultValue) const
inline

Get node as given template type.

Definition at line 391 of file Sawyer/Yaml.h.

◆ size()

size_t Sawyer::Yaml::Node::size ( ) const
inline

Get size of node.

Nodes of type None or Scalar will return 0.

Definition at line 399 of file Sawyer/Yaml.h.

◆ insert()

Node & Sawyer::Yaml::Node::insert ( const size_t  index)
inline

Insert sequence item at given index.

Converts node to sequence type if needed. Adding new item to end of sequence if index is larger than sequence size.

Definition at line 406 of file Sawyer/Yaml.h.

◆ pushFront()

Node & Sawyer::Yaml::Node::pushFront ( )
inline

Add new sequence index to front.

Converts node to sequence type if needed.

Definition at line 411 of file Sawyer/Yaml.h.

◆ pushBack()

Node & Sawyer::Yaml::Node::pushBack ( )
inline

Add new sequence index to back.

Converts node to sequence type if needed.

Definition at line 416 of file Sawyer/Yaml.h.

◆ operator[]() [1/4]

Node & Sawyer::Yaml::Node::operator[] ( const size_t  index)

Get sequence/map item.

Converts node to sequence/map type if needed.

index Sequence index. Returns None type Node if index is unknown. key Map key. Creates a new node if key is unknown unless this is const.

◆ operator[]() [2/4]

Node & Sawyer::Yaml::Node::operator[] ( const size_t  index) const

Get sequence/map item.

Converts node to sequence/map type if needed.

index Sequence index. Returns None type Node if index is unknown. key Map key. Creates a new node if key is unknown unless this is const.

◆ operator[]() [3/4]

Node & Sawyer::Yaml::Node::operator[] ( const std::string &  key)

Get sequence/map item.

Converts node to sequence/map type if needed.

index Sequence index. Returns None type Node if index is unknown. key Map key. Creates a new node if key is unknown unless this is const.

◆ operator[]() [4/4]

Node & Sawyer::Yaml::Node::operator[] ( const std::string &  key) const

Get sequence/map item.

Converts node to sequence/map type if needed.

index Sequence index. Returns None type Node if index is unknown. key Map key. Creates a new node if key is unknown unless this is const.

◆ exists()

bool Sawyer::Yaml::Node::exists ( const std::string &  key) const
inline

Test whether a map item exists without inserting it.

Definition at line 433 of file Sawyer/Yaml.h.

◆ erase() [1/2]

void Sawyer::Yaml::Node::erase ( const size_t  index)
inline

Erase item.

No action if node is not a sequence or map.

Definition at line 443 of file Sawyer/Yaml.h.

◆ erase() [2/2]

void Sawyer::Yaml::Node::erase ( const std::string &  key)
inline

Erase item.

No action if node is not a sequence or map.

Definition at line 444 of file Sawyer/Yaml.h.

◆ operator=()

template<class T >
Node & Sawyer::Yaml::Node::operator= ( const T &  value)
inline

Assignment operators.

Definition at line 455 of file Sawyer/Yaml.h.

◆ begin() [1/2]

Iterator Sawyer::Yaml::Node::begin ( )
inline

Get start iterator.

Definition at line 464 of file Sawyer/Yaml.h.

◆ begin() [2/2]

ConstIterator Sawyer::Yaml::Node::begin ( ) const
inline

Get start iterator.

Definition at line 465 of file Sawyer/Yaml.h.

◆ end() [1/2]

Iterator Sawyer::Yaml::Node::end ( )
inline

Get end iterator.

Definition at line 471 of file Sawyer/Yaml.h.

◆ end() [2/2]

ConstIterator Sawyer::Yaml::Node::end ( ) const
inline

Get end iterator.

Definition at line 472 of file Sawyer/Yaml.h.

◆ As() [1/2]

template<typename T >
T Sawyer::Yaml::Node::As ( ) const
inline

Definition at line 494 of file Sawyer/Yaml.h.

◆ As() [2/2]

template<typename T >
T Sawyer::Yaml::Node::As ( const T &  defaultValue) const
inline

Definition at line 499 of file Sawyer/Yaml.h.


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