Config/console node tree base-class. More...
#include <senf/Utils/Console/Node.hh>
Public Types | |
typedef boost::shared_ptr< GenericNode > | ptr |
typedef boost::shared_ptr< GenericNode const > | cptr |
typedef boost::weak_ptr< GenericNode > | weak_ptr |
Public Member Functions | |
virtual | ~GenericNode () |
std::string const & | name () const |
Node name. More... | |
boost::shared_ptr< DirectoryNode > | parent () const |
Parent node. More... | |
std::string | path () const |
Node path. More... | |
std::string | path (DirectoryNode const &root) const |
Node path up to root. More... | |
ptr | unlink () |
Remove node from it's parent directory. More... | |
void | rename (std::string const &newName) |
Rename node name in it's parent directory. More... | |
bool | active () const |
true , if node is attached to the root() node More... | |
void | help (std::ostream &output) const |
Write help info to output. More... | |
std::string | shorthelp () const |
Get short (one-line) documentation. More... | |
ptr | thisptr () |
Get smart pointer to node. More... | |
cptr | thisptr () const |
Get smart pointer to node (const) More... | |
bool | isChildOf (DirectoryNode &parent) const |
true , if node is a child of parent More... | |
bool | operator== (GenericNode &other) const |
true , if this and other are the same node More... | |
bool | operator!= (GenericNode &other) const |
true , if this and other are different nodes More... | |
bool | isDirectory () const |
true , if this is a directory node More... | |
bool | isLink () const |
true , if this is a link node More... | |
bool | isCommand () const |
true , if this is a command node More... | |
GenericNode const & | followLink () const |
Follow link if this node is a link node. More... | |
GenericNode & | followLink () |
Follow link if this node is a link node. More... | |
virtual void | v_help (std::ostream &output) const =0 |
Provide help information. More... | |
virtual std::string | v_shorthelp () const =0 |
Provide short documentation. More... | |
Protected Member Functions | |
GenericNode () | |
void | name (std::string const &name) |
Config/console node tree base-class.
GenericNode is the base class of all node objects. There are two basic node types derived from GenericNode: DirectoryNode and CommandNode.
All nodes are dynamically allocated and automatically managed using reference counting.
All nodes are normally linked into a single tree which root node is senf::console::root(). Nodes may however be orphaned (not linked to the tree) either directly (the node has no parent) or indirectly (the node has a parent but is part of an orphaned subtree which is not linked to the root node).
Every active (non-orphaned) node (except the root() node) has a non-empty node name. This name is assigned to the node when adding the node to the tree.
typedef boost::shared_ptr<GenericNode const> senf::console::GenericNode::cptr |
typedef boost::shared_ptr<GenericNode> senf::console::GenericNode::ptr |
typedef boost::weak_ptr<GenericNode> senf::console::GenericNode::weak_ptr |
|
virtual |
|
protected |
bool senf::console::GenericNode::active | ( | ) | const |
GenericNode const& senf::console::GenericNode::followLink | ( | ) | const |
Follow link if this
node is a link node.
GenericNode& senf::console::GenericNode::followLink | ( | ) |
Follow link if this
node is a link node.
void senf::console::GenericNode::help | ( | std::ostream & | output | ) | const |
Write help info to output.
bool senf::console::GenericNode::isChildOf | ( | DirectoryNode & | parent | ) | const |
bool senf::console::GenericNode::isCommand | ( | ) | const |
true
, if this is a command node
bool senf::console::GenericNode::isDirectory | ( | ) | const |
true
, if this is a directory node
bool senf::console::GenericNode::isLink | ( | ) | const |
true
, if this is a link node
std::string const& senf::console::GenericNode::name | ( | ) | const |
Node name.
|
protected |
bool senf::console::GenericNode::operator!= | ( | GenericNode & | other | ) | const |
true
, if this and other are different nodes
bool senf::console::GenericNode::operator== | ( | GenericNode & | other | ) | const |
true
, if this and other are the same node
boost::shared_ptr<DirectoryNode> senf::console::GenericNode::parent | ( | ) | const |
Parent node.
May be null, if the node is the root node or if it is not linked to the tree
std::string senf::console::GenericNode::path | ( | ) | const |
std::string senf::console::GenericNode::path | ( | DirectoryNode const & | root | ) | const |
void senf::console::GenericNode::rename | ( | std::string const & | newName | ) |
std::string senf::console::GenericNode::shorthelp | ( | ) | const |
Get short (one-line) documentation.
ptr senf::console::GenericNode::thisptr | ( | ) |
Get smart pointer to node.
cptr senf::console::GenericNode::thisptr | ( | ) | const |
Get smart pointer to node (const)
ptr senf::console::GenericNode::unlink | ( | ) |
Remove node from it's parent directory.
You may either discard the return value and thereby dispose the node or may re-attach the node at some other place using DirectoryNode::add().
|
pure virtual |
Provide help information.
This member must be implemented in derived classes to provide node specific help information.
|
pure virtual |
Provide short documentation.
This member must be implemented in derived classes to provide node specific documentation.