Clipper
|
Definition for a generic container Object. More...
#include <container.h>
Public Member Functions | |
Container (const String name="") | |
constructor: make null object or top object in a tree | |
Container (Container &parent, const String &path) | |
constructor: from any other member and a relative path | |
virtual void | update () |
update: hierarchical content update function | |
String | path () const |
get the path of this tree object | |
String | name () const |
get the name of this tree object | |
void | set_name (const String &name) |
set the name of this tree object | |
bool | is_destroyed_with_parent () const |
is this object to be destroyed when parent is destroyed? | |
void | set_destroyed_with_parent (const bool d=true) |
set this object to be destroyed when parent is destroyed | |
void | move (const String &path) |
'move' method moves this object to somewhere else in the hierarchy | |
bool | has_parent () const |
test if this object has a parent | |
const Container & | parent () const |
get the parent of this object | |
Container & | parent () |
get the parent of this object | |
int | num_children () const |
return number of children | |
const Container & | child (const int &i) const |
get the i'th child of this object | |
Container & | child (const int &i) |
get the i'th child of this object | |
const Container & | ultimate_parent () const |
get the ultimate parent of this object - the top of the tree | |
Container & | ultimate_parent () |
get the ultimate parent of this object - the top of the tree | |
Container * | parent_ptr () |
get the parent of this object (NULL on fail) | |
template<class T > | |
T * | parent_of_type_ptr () |
search up the tree for a parent of the specified type (NULL on fail) | |
Container * | find_path_ptr (const String &path) |
find an object using a directory-like path (NULL on fail) | |
virtual | ~Container () |
destructor: virtual | |
void | debug () |
Definition for a generic container Object.
Container is a definition for a generic container object with a name, parents, and children. Any object that wants to be part of the tree simply subclasses this class. The class also implements search and move objects. The tree is navigate using unix-like pathnames. A recursive update method can be overridden to update content after altering the hierarchy.
The top container in a tree is created by passing Container() as its parent.