ROSE  0.11.96.11
Public Types | Public Member Functions | List of all members
Rose::Yaml::Node Class Reference

Description

YAML node.

Definition at line 328 of file Yaml.h.

#include <Yaml.h>

Public Types

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

Public Member Functions

 Node ()
 Default constructor.
 
 Node (const Node &node)
 Copy constructor.
 
 ~Node ()
 Destructor.
 
 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.
 
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 back. More...
 
NodepushBack ()
 Add new sequence index to front. 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.
 
Iterator begin ()
 Get start iterator.
 
ConstIterator begin () const
 Get start iterator.
 
Iterator end ()
 Get end iterator.
 
ConstIterator end () const
 Get end iterator.
 

Constructor & Destructor Documentation

◆ Node() [1/2]

Rose::Yaml::Node::Node ( const std::string &  value)

Assignment constructors.

Converts node to scalar type if needed.

◆ Node() [2/2]

Rose::Yaml::Node::Node ( const char *  value)

Assignment constructors.

Converts node to scalar type if needed.

Member Function Documentation

◆ operator bool()

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

Predicate to test whether node exists.

Returns true unless the node isNone.

Definition at line 371 of file Yaml.h.

References isNone().

Here is the call graph for this function:

◆ operator!()

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

Predicate to test whether node exists.

Returns true if node isNone.

Definition at line 378 of file Yaml.h.

References isNone().

Here is the call graph for this function:

◆ size()

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

Get size of node.

  Nodes of type None or Scalar will return 0. 

Definition at line 402 of file Yaml.h.

◆ insert()

Node& Rose::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 409 of file Yaml.h.

◆ pushFront()

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

Add new sequence index to back.

Converts node to sequence type if needed.

Definition at line 414 of file Yaml.h.

◆ pushBack()

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

Add new sequence index to front.

Converts node to sequence type if needed.

Definition at line 419 of file Yaml.h.

◆ operator[]() [1/4]

Node& Rose::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.

◆ operator[]() [2/4]

Node& Rose::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.

◆ operator[]() [3/4]

Node& Rose::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.

◆ operator[]() [4/4]

Node& Rose::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.

◆ erase() [1/2]

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

Erase item.

No action if node is not a sequence or map.

Definition at line 440 of file Yaml.h.

◆ erase() [2/2]

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

Erase item.

No action if node is not a sequence or map.

Definition at line 441 of file Yaml.h.


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