senf::console::DirectoryNode Class Reference
[The node tree]
Config/console tree directory node.
More...
#include <senf/Utils/Console/Node.hh>
List of all members.
Detailed Description
Config/console tree directory node.
This node type provides the internal and root nodes of the tree. It allows to add arbitrary children and supports directory traversal.
Nodes are normally not instantiated manually but are created using factory calls. Special add() members however allow externally allocated node objects.
Nodes may be added to the tree only once, otherwise chaos will ensue. Since nodes are always managed dynamically, there is a special ScopedDirectory proxy template which provides a DirectoryNode facade. ScopedDirectory is used if a class wants to manage it's own directory as a data member.
Every node is assigned a (new) name when it is added to a directory. If the directory already has an entry of that name, the name is made unique by appending a suffix of the form '-n' where n is a number starting at 1. If the name is empty, int is set to 'unnamed' and then uniquified as above. Automatically providing unique names simplifies adding configuration/console support to generic components.
Definition at line 406 of file Node.hh.
Member Typedef Documentation
typedef ChildMap::const_iterator senf::console::DirectoryNode:: |
child_iterator |
|
|
|
|
|
typedef boost::iterator_range<ChildMap::const_iterator> senf::console::DirectoryNode:: |
ChildrenRange |
|
|
|
|
|
typedef boost::shared_ptr<DirectoryNode const> senf::console::DirectoryNode:: |
cptr |
|
|
|
|
|
typedef boost::shared_ptr<DirectoryNode> senf::console::DirectoryNode:: |
ptr |
|
|
|
|
|
typedef DirectoryNode& senf::console::DirectoryNode:: |
return_type |
|
|
|
|
|
typedef boost::weak_ptr<DirectoryNode> senf::console::DirectoryNode:: |
weak_ptr |
|
|
|
|
|
Constructor & Destructor Documentation
senf::console::DirectoryNode:: |
~DirectoryNode |
() |
|
|
|
|
senf::console::DirectoryNode:: |
DirectoryNode |
() |
|
|
|
|
Member Function Documentation
template<class Factory >
Factory::result_type senf::console::DirectoryNode:: |
add |
( |
std::string const & |
name, |
|
|
|
Factory const & |
factory, |
|
|
|
typename boost::enable_if< boost::is_convertible< Factory const &, detail::NodeFactory const & > >::type * |
= 0
|
) |
|
Generic child node factory.
This member is used to create a new child node of the current directory. The type of node created depends on the type of argument passed.
Definition at line 58 of file Node.cti.
template<class NodeType >
NodeType & senf::console::DirectoryNode:: |
add |
( |
std::string const & |
name, |
|
|
|
NodeType & |
node, |
|
|
|
typename boost::enable_if< boost::is_convertible< NodeType &, GenericNode & > >::type * |
= 0
|
) |
|
template<class NodeType >
NodeType & senf::console::DirectoryNode:: |
add |
( |
std::string const & |
name, |
|
|
|
boost::shared_ptr< NodeType > |
node |
) |
|
Add node to tree.
Adds the node to the tree as a child of this node. The node is given the name name. If a node of that name already exists, a numeric suffix of the form '-n' is added to the name until the name is unique. If name is empty, it is set to 'unnamed'.
Definition at line 37 of file Node.cti.
Return iterator range over all children.
The returned range is sorted by child name.
Definition at line 214 of file Node.cci.
Return iterator range of completions for s.
The returned range is sorted by child name.
Definition at line 221 of file Node.cci.
Set node documentation.
Definition at line 232 of file Node.cci.
Get child node automatically dereferencing links.
- Exceptions:
-
Definition at line 174 of file Node.cci.
Get command child node (dereferencing links).
Same as operator()
- Exceptions:
-
Definition at line 198 of file Node.cci.
Get directory child node (dereferencing links).
Same as operator[]
- Exceptions:
-
Definition at line 181 of file Node.cci.
Get child node without dereferencing links.
- Exceptions:
-
Definition at line 179 of file Node.cc.
bool senf::console::DirectoryNode:: |
hasChild |
( |
std::string const & |
name |
) |
|
true
, if there is a child with name name
Definition at line 166 of file Node.cci.
Get command child node (dereferencing links).
Same as getCommand()
- Exceptions:
-
Definition at line 208 of file Node.cci.
Get directory child node (dereferencing links).
Same as getDirectory
- Exceptions:
-
Definition at line 191 of file Node.cci.
Remove node name from the tree.
The returned pointer may either be discarded, which will automatically dispose the removed node, or it may be saved and/or re-attached at some other place in the tree.
Definition at line 144 of file Node.cc.
Set node short documentation.
Definition at line 239 of file Node.cci.
Friends And Related Function Documentation
The documentation for this class was generated from the following files: