senf::console::GenericNode Class Reference
[The node tree]

Config/console node tree base-class. More...

#include <senf/Utils/Console/Node.hh>

Inheritance diagram for senf::console::GenericNode:
Inheritance graph
[legend]

List of all members.


Detailed Description

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.

Definition at line 256 of file 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.
boost::shared_ptr< DirectoryNode parent () const
  Parent node.
std::string  path () const
  Node path.
std::string  path (DirectoryNode const &root) const
  Node path up to root.
ptr  unlink ()
  Remove node from it's parent directory.
bool  active () const
  true, if node is attached to the root() node
void  help (std::ostream &output) const
  Write help info to output.
std::string  shorthelp () const
  Get short (one-line) documentation.
ptr  thisptr ()
  Get smart pointer to node.
cptr  thisptr () const
  Get smart pointer to node (const).
bool  isChildOf (DirectoryNode &parent) const
  true, if node is a child of parent
bool  operator== (GenericNode &other) const
  true, if this and other are the same node
bool  operator!= (GenericNode &other) const
  true, if this and other are different nodes
bool  isDirectory () const
  true, if this is a directory node
bool  isLink () const
  true, if this is a link node
bool  isCommand () const
  true, if this is a command node
GenericNode const &  followLink () const
  Follow link if this node is a link node.
GenericNode followLink ()
  Follow link if this node is a link node.
virtual void  v_help (std::ostream &output) const =0
  Provide help information.
virtual std::string  v_shorthelp () const =0
  Provide short documentation.

Protected Member Functions

  GenericNode ()
void  name (std::string const &name)

Member Typedef Documentation

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

Constructor & Destructor Documentation

senf::console::GenericNode::
~GenericNode ()

Definition at line 47 of file Node.cci.

senf::console::GenericNode::
GenericNode ()

Definition at line 56 of file Node.cci.


Member Function Documentation

bool senf::console::GenericNode::
active ()

true, if node is attached to the root() node

Definition at line 99 of file Node.cc.

senf::console::GenericNode & senf::console::GenericNode::
followLink ()

Follow link if this node is a link node.

Definition at line 130 of file Node.cci.

senf::console::GenericNode const & senf::console::GenericNode::
followLink ()

Follow link if this node is a link node.

Definition at line 122 of file Node.cci.

void senf::console::GenericNode::
help ( std::ostream &  output )

Write help info to output.

Definition at line 80 of file Node.cci.

bool senf::console::GenericNode::
isChildOf ( DirectoryNode parent )

true, if node is a child of parent

Will also return true, if parent is the current node.

Definition at line 108 of file Node.cc.

bool senf::console::GenericNode::
isCommand ()

true, if this is a command node

Definition at line 116 of file Node.cci.

bool senf::console::GenericNode::
isDirectory ()

true, if this is a directory node

Definition at line 104 of file Node.cci.

bool senf::console::GenericNode::
isLink ()

true, if this is a link node

Definition at line 110 of file Node.cci.

void senf::console::GenericNode::
name ( std::string const &  name )

Definition at line 60 of file Node.cci.

std::string const & senf::console::GenericNode::
name ()

Node name.

Definition at line 50 of file Node.cci.

bool senf::console::GenericNode::
operator!= ( GenericNode other )

true, if this and other are different nodes

Definition at line 98 of file Node.cci.

bool senf::console::GenericNode::
operator== ( GenericNode other )

true, if this and other are the same node

Definition at line 92 of file Node.cci.

boost::shared_ptr< senf::console::DirectoryNode > senf::console::GenericNode::
parent ()

Parent node.

May be null, if the node is the root node or if it is not linked to the tree

Definition at line 65 of file Node.cci.

std::string senf::console::GenericNode::
path ( DirectoryNode const &  root )

Node path up to root.

The node path is built by joining the names of all parent nodes up to root with '/' chars.

Definition at line 82 of file Node.cc.

std::string senf::console::GenericNode::
path ()

Node path.

The node path is built by joining the names of all parent nodes with '/' chars.

Definition at line 70 of file Node.cc.

std::string senf::console::GenericNode::
shorthelp ()

Get short (one-line) documentation.

Definition at line 86 of file Node.cci.

senf::console::GenericNode::cptr senf::console::GenericNode::
thisptr ()

Get smart pointer to node (const).

Reimplemented in senf::console::DirectoryNode, senf::console::CommandNode, senf::console::SimpleCommandNode, and senf::console::OverloadedCommandNode.

Definition at line 41 of file Node.cci.

senf::console::GenericNode::ptr senf::console::GenericNode::
thisptr ()

senf::console::GenericNode::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().

Definition at line 72 of file Node.cci.

virtual void senf::console::GenericNode::
v_help ( std::ostream &  output )

Provide help information.

This member must be implemented in derived classes to provide node specific help information.

virtual std::string senf::console::GenericNode::
v_shorthelp ()

Provide short documentation.

This member must be implemented in derived classes to provide node specific documentation.


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