Public Member Functions | List of all members
ndn::BoostInfoTree Class Reference

BoostInfoTree is provided for compatibility with the Boost INFO property list format used in ndn-cxx. More...

#include <boost-info-parser.hpp>

Public Member Functions

 BoostInfoTree (const std::string &value="", BoostInfoTree *parent=0)
 
void addSubtree (const std::string &treeName, ptr_lib::shared_ptr< BoostInfoTree > newTree)
 Insert a BoostInfoTree as a sub-tree with the given name. More...
 
const BoostInfoTreecreateSubtree (const std::string &treeName, const std::string &value="")
 Create a new BoostInfo and insert it as a sub-tree with the given name. More...
 
std::vector< const BoostInfoTree * > operator[] (const std::string &key) const
 Look up using the key and return a list of the subtrees. More...
 
const std::string * getFirstValue (const std::string &key) const
 Look up using the key and return string value of the first subtree. More...
 
const std::string & getValue () const
 
BoostInfoTreegetParent ()
 
BoostInfoTreegetLastChild ()
 
std::string prettyPrint (int indentLevel=1) const
 

Detailed Description

BoostInfoTree is provided for compatibility with the Boost INFO property list format used in ndn-cxx.

Each node in the tree may have a name and a value as well as associated sub-trees. The sub-tree names are not unique, and so sub-trees are stored as dictionaries where the key is a sub-tree name and the values are the sub-trees sharing the same name.

Nodes can be accessed with a path syntax, as long as nodes in the path do not contain the path separator '/' in their names.

Member Function Documentation

void ndn::BoostInfoTree::addSubtree ( const std::string &  treeName,
ptr_lib::shared_ptr< BoostInfoTree newTree 
)

Insert a BoostInfoTree as a sub-tree with the given name.

Parameters
treeNameThe name of the new sub-tree.
newTreeThe sub-tree to add.
const BoostInfoTree & ndn::BoostInfoTree::createSubtree ( const std::string &  treeName,
const std::string &  value = "" 
)

Create a new BoostInfo and insert it as a sub-tree with the given name.

Parameters
treeNameThe name of the new sub-tree.
valueThe value associated with the new sub-tree.
Returns
The created sub-tree.
const std::string* ndn::BoostInfoTree::getFirstValue ( const std::string &  key) const
inline

Look up using the key and return string value of the first subtree.

Parameters
keyThe key which may be a path separated with '/'.
Returns
A pointer to the string value or 0 if not found. Note that this pointer may no longer be valid after this BoostInfoTree is modified.
vector< const BoostInfoTree * > ndn::BoostInfoTree::operator[] ( const std::string &  key) const

Look up using the key and return a list of the subtrees.

Parameters
keyThe key which may be a path separated with '/'.
Returns
A new vector with pointers to the subtrees.

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