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

Description

YAML node.

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

#include <util/Sawyer/Yaml.h>

Public Types

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

Public Member Functions

 Node ()
 Default constructor. More...
 
 Node (const Node &node)
 Copy constructor. More...
 
 ~Node ()
 Destructor. More...
 
 operator bool () const
 Predicate to test whether node exists. More...
 
bool operator! () const
 Predicate to test whether node exists. More...
 
void clear ()
 Completely clear node. More...
 
size_t size () const
 Get size of node. More...
 
Nodeinsert (const size_t index)
 Insert sequence item at given index. More...
 
NodepushFront ()
 Add new sequence index to front. More...
 
NodepushBack ()
 Add new sequence index to back. More...
 
bool exists (const std::string &key) const
 Test whether a map item exists without inserting it. More...
 
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. More...
 
 Node (const char *value)
 Assignment constructors. More...
 
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. More...
 
Nodeoperator[] (const size_t index) const
 Get sequence/map item. More...
 
Nodeoperator[] (const std::string &key)
 Get sequence/map item. More...
 
Nodeoperator[] (const std::string &key) const
 Get sequence/map item. More...
 
void erase (const size_t index)
 Erase item. More...
 
void erase (const std::string &key)
 Erase item. More...
 
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

Enumeration of node types.

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

Constructor & Destructor Documentation

Sawyer::Yaml::Node::Node ( )

Default constructor.

Sawyer::Yaml::Node::Node ( const Node node)

Copy constructor.

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

Assignment constructors.

Converts node to scalar type if needed.

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

Assignment constructors.

Converts node to scalar type if needed.

Sawyer::Yaml::Node::~Node ( )

Destructor.

Member Function Documentation

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 util/Sawyer/Yaml.h.

References isNone().

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

Predicate to test whether node exists.

Returns true if node isNone.

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

References isNone().

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

Completely clear node.

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

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

Get size of node.

Nodes of type None or Scalar will return 0.

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

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 util/Sawyer/Yaml.h.

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 util/Sawyer/Yaml.h.

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 util/Sawyer/Yaml.h.

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

Get sequence/map item.

Converts node to sequence/map type if needed.

Parameters
indexSequence index. Returns None type Node if index is unknown.
keyMap key. Creates a new node if key is unknown unless this is const.
Node& Sawyer::Yaml::Node::operator[] ( const size_t  index) const

Get sequence/map item.

Converts node to sequence/map type if needed.

Parameters
indexSequence index. Returns None type Node if index is unknown.
keyMap key. Creates a new node if key is unknown unless this is const.
Node& Sawyer::Yaml::Node::operator[] ( const std::string &  key)

Get sequence/map item.

Converts node to sequence/map type if needed.

Parameters
indexSequence index. Returns None type Node if index is unknown.
keyMap key. Creates a new node if key is unknown unless this is const.
Node& Sawyer::Yaml::Node::operator[] ( const std::string &  key) const

Get sequence/map item.

Converts node to sequence/map type if needed.

Parameters
indexSequence index. Returns None type Node if index is unknown.
keyMap key. Creates a new node if key is unknown unless this is const.
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 util/Sawyer/Yaml.h.

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 util/Sawyer/Yaml.h.

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 util/Sawyer/Yaml.h.


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