Tree Class Reference
A tree of file names, representing a directory hierarcy.
More...
#include <file.h>
List of all members.
Public Types |
typedef std::list< Tree * > | children_t |
| data storage type for the tree
|
Public Member Functions |
void | add_child (Tree *tree) |
| add a child to the tree and give ownership thereof to the tree
|
void | add_child (FileName const &name, FileStatus const &status) |
| add child to this node (no error detection is done)
|
children_t const & | children () const |
| get children of this node
|
int | depth () const |
| Return the relative depth in of this node within the tree. The top item in the tree has depth of 0, its children have depth of 1, etc.
|
FileName | name () const |
| get name of this node
|
Tree & | operator= (Tree const &r) |
FileName | path () const |
| get pathname of this node -- as specified by parent hierarchy not by inquiring the current directory -- use convert_to_absolute_path if you need the complete pathname.
|
void | remove_child (FileName const &name) |
| remove a specified child of this node ( warning: O(n)!)
|
FileStatus const & | status () const |
| get info for this node
|
| Tree (std::string const &name, FileStatus const &status, Tree *parent=0, int depth=0) |
| Tree (Tree const &r) |
| copy constructor
|
| Tree (Tree *parent=0) |
| ~Tree () |
| destructor
|
Private Attributes |
children_t | children_ |
| This node's children (if this is a dir).
|
int | depth_ |
| Depth within the hierarchy, top = 0.
|
std::string | name_ |
| This node's name.
|
Tree * | parent_ |
| This node's parent directory.
|
FileStatus | status_ |
| This node's status.
|
Friends |
class | FileName |
Detailed Description
A tree of file names, representing a directory hierarcy.
The FileName::Tree class is meant for implementing simplistic directory hierarchies. It is not a general purpose tool. See FileName::tree();
Definition at line 1297 of file file.h.
Member Typedef Documentation
data storage type for the tree
Definition at line 1306 of file file.h.
Constructor & Destructor Documentation
Construct an empty tree
Definition at line 1322 of file file.h.
Tree |
( |
std::string const & |
name, |
|
|
FileStatus const & |
status, |
|
|
Tree * |
parent = 0 , |
|
|
int |
depth = 0 | |
|
) |
| | |
Construct a tree node with no children but specified name and file info
Definition at line 1332 of file file.h.
Member Function Documentation
void add_child |
( |
Tree * |
tree |
) |
|
add a child to the tree and give ownership thereof to the tree
Definition at line 1376 of file file.h.
add child to this node (no error detection is done)
Definition at line 1370 of file file.h.
get children of this node
Definition at line 1367 of file file.h.
Return the relative depth in of this node within the tree. The top item in the tree has depth of 0, its children have depth of 1, etc.
Definition at line 1362 of file file.h.
get name of this node
Definition at line 1353 of file file.h.
get pathname of this node -- as specified by parent hierarchy not by inquiring the current directory -- use convert_to_absolute_path if you need the complete pathname.
Definition at line 2288 of file file.cxx.
void remove_child |
( |
FileName const & |
name |
) |
|
remove a specified child of this node ( warning: O(n)!)
Definition at line 2266 of file file.cxx.
get info for this node
Definition at line 1350 of file file.h.
Friends And Related Function Documentation
Member Data Documentation
This node's children (if this is a dir).
Definition at line 1314 of file file.h.
Depth within the hierarchy, top = 0.
Definition at line 1318 of file file.h.
std::string name_ [private] |
This node's name.
Definition at line 1313 of file file.h.
This node's parent directory.
Definition at line 1316 of file file.h.
This node's status.
Definition at line 1312 of file file.h.
The documentation for this class was generated from the following files: