JC::SConfig::Node Class Reference

Class that represents a Node. More...

#include <sconfig.hpp>

Collaboration diagram for JC::SConfig::Node:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Node (const string &name="")
 Default constructor.
 Node (const Node &node)
 ~Node ()
Nodeoperator= (const Node &old)
void CopyTo (Node &target) const
 Creates a valid copy of the actual object.
void Clear ()
 Resets private members.
bool HasChildren () const
 Checks if there are child Nodes.
bool HasPairs () const
 Checks if there are any Pairs inside this Node.
PairAddPair (const Pair &pair)
 Inserts a new Pair to the actual Node.
NodeAddNode (const Node &node)
 Inserts a new Node child to the actual Node.
const PairFirstPair () const
 Gets the first Pair.
PairFirstPair ()
const PairFirstPair (const string &name) const
 Gets the first Pair with a specific key name.
PairFirstPair (const string &name)
const NodeFirstNode () const
 Gets the first Node.
NodeFirstNode ()
const NodeFirstNode (const string &name) const
 Gets the first child Node with a specific name.
NodeFirstNode (const string &name)
void Print () const
 Prints the actual Node.
const NodeNextSibling () const
 Gets the next Node sibling.
NodeNextSibling ()
const NodeNextSibling (const string &name) const
 Gets the next Node sibling with a specific name.
NodeNextSibling (const string &name)
const NodePreviousSibling () const
 Gets the previous Node sibling.
NodePreviousSibling ()
const NodePreviousSibling (const string &name) const
 Gets the previous Node sibling with a specific name.
NodePreviousSibling (const string &name)
const NodeParent () const
 Gets the parent Node.
NodeParent ()
int Depth () const
 Gets the Node's depth relative to it's parent.
const string & Name () const
 Gets the name.
void Name (const string &name)
 Sets the name.
bool Path (const string &path, string &store, char token= '.') const
 Convenient function to access a Pair's value.
template<class O>
bool TPath (const string &path, O &store, char token= '.') const
 Same as Path() but templated, so that result is converted to the desired type. Be _very_ careful with destination type.

Private Attributes

string m_Name
Nodem_PreviousSibling
Nodem_NextSibling
Nodem_Parent
Node_lastNode
Pair_lastPair
t_node_list m_Children
t_pair_list m_Pairs

Friends

class SConfigParser


Detailed Description

Class that represents a Node.

Constructor & Destructor Documentation

Node::Node ( const string &  name = ""  ) 

Default constructor.

Parameters:
name string for node name.

Node::Node ( const Node node  ) 

JC::SConfig::Node::~Node (  )  [inline]


Member Function Documentation

Node & Node::operator= ( const Node old  ) 

void Node::CopyTo ( Node target  )  const

Creates a valid copy of the actual object.

Parameters:
target the destination where to copy the object.

void Node::Clear (  ) 

Resets private members.

bool Node::HasChildren (  )  const

Checks if there are child Nodes.

Returns:
True if there is 1 or more child Nodes, otherwise False is returned.

bool Node::HasPairs (  )  const

Checks if there are any Pairs inside this Node.

Returns:
True if there is 1 or more Pairs, otherwise False is returned.

Pair * Node::AddPair ( const Pair pair  ) 

Inserts a new Pair to the actual Node.

Parameters:
pair Pair object to insert (a new Pair object is created).
Returns:
Pointer to the created Pair.

Node * Node::AddNode ( const Node node  ) 

Inserts a new Node child to the actual Node.

Parameters:
node Node object to insert (a new Node object is created).
Returns:
Pointer to the created Node.

const Pair * Node::FirstPair (  )  const

Gets the first Pair.

Returns:
A pointer to the first Pair or NULL if there are no Pairs.

Pair * Node::FirstPair (  ) 

const Pair * Node::FirstPair ( const string &  name  )  const

Gets the first Pair with a specific key name.

Parameters:
name the Pair's key to search for.
Returns:
A pointer to the first Pair with the specified key name, NULL is returned if nothing was found.

Pair * Node::FirstPair ( const string &  name  ) 

const Node * Node::FirstNode (  )  const

Gets the first Node.

Returns:
A pointer to the first Node or NULL if there are no child Nodes.

Node * Node::FirstNode (  ) 

const Node * Node::FirstNode ( const string &  name  )  const

Gets the first child Node with a specific name.

Parameters:
name the Node's name to search for.
Returns:
A pointer to the first Node with the specified name, NULL is returned if nothing was found.

Node * Node::FirstNode ( const string &  name  ) 

void Node::Print (  )  const

Prints the actual Node.

const Node * Node::NextSibling (  )  const

Gets the next Node sibling.

Returns:
A pointer to the next sibling, or NULL if there are no siblings left.

Node * Node::NextSibling (  ) 

const Node * Node::NextSibling ( const string &  name  )  const

Gets the next Node sibling with a specific name.

Parameters:
name the Node's name to search for.
Returns:
A pointer to the next sibling, with the specified name, or NULL if there are no siblings left with that name.

Node * Node::NextSibling ( const string &  name  ) 

const Node * Node::PreviousSibling (  )  const

Gets the previous Node sibling.

Returns:
A pointer to the previous sibling, with the specified name, or NULL if there are no siblings left with that name.

Node * Node::PreviousSibling (  ) 

const Node * Node::PreviousSibling ( const string &  name  )  const

Gets the previous Node sibling with a specific name.

Parameters:
name the Node's name to search for.
Returns:
A pointer to the previous sibling, with the specified name, or NULL if there are no siblings left with that name.

Node * Node::PreviousSibling ( const string &  name  ) 

const Node * Node::Parent (  )  const

Gets the parent Node.

Returns:
A pointer to the parent Node, or NULL if there's no parent (this Node is the root Node).

Node * Node::Parent (  ) 

int Node::Depth (  )  const

Gets the Node's depth relative to it's parent.

Returns:
Integer value representing the depth of the current Node.

const string & Node::Name (  )  const

Gets the name.

Returns:
the name

void Node::Name ( const string &  name  ) 

Sets the name.

Parameters:
name the string to set

bool Node::Path ( const string &  path,
string &  store,
char  token = '.' 
) const

Convenient function to access a Pair's value.

Parameters:
path string with a list of Nodes names and a Pair key, separated by a token (ex. "myApp.mainWindow.width").
store destination to store the Pair's value.
token token used to separate Nodes and Pairs in path.
Returns:
True if Pair was found, otherwise False.

template<class O>
bool JC::SConfig::Node::TPath ( const string &  path,
O &  store,
char  token = '.' 
) const [inline]

Same as Path() but templated, so that result is converted to the desired type. Be _very_ careful with destination type.

Parameters:
path string with a list of Nodes names and a Pair key, separated by a token (ex. "myApp.mainWindow.width").
store destination to store the Pair's value.
token token used to separate Nodes and Pairs in path.
Returns:
True if Pair was found, otherwise False.


Friends And Related Function Documentation

friend class SConfigParser [friend]


Member Data Documentation

string JC::SConfig::Node::m_Name [private]


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

Generated on Fri Apr 3 16:53:54 2009 for libsconfig by  doxygen 1.5.6