ROSE  0.11.124.0
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 <Rose/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...
 
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.
 

Member Enumeration Documentation

Enumeration of node types.

Definition at line 333 of file Yaml.h.

Constructor & Destructor Documentation

Rose::Yaml::Node::Node ( )

Default constructor.

Rose::Yaml::Node::Node ( const Node node)

Copy constructor.

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

Assignment constructors.

Converts node to scalar type if needed.

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

Assignment constructors.

Converts node to scalar type if needed.

Rose::Yaml::Node::~Node ( )

Destructor.

Member Function Documentation

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().

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().

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

Completely clear node.

Definition at line 383 of file Yaml.h.

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.

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.

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

Add new sequence index to front.

Converts node to sequence type if needed.

Definition at line 414 of file Yaml.h.

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

Add new sequence index to back.

Converts node to sequence type if needed.

Definition at line 419 of file Yaml.h.

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.
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.
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.
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.
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.

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: