feisty meow concerns codebase  2.140
filesystem::filename_tree Class Reference

#include <filename_tree.h>

Inheritance diagram for filesystem::filename_tree:
Collaboration diagram for filesystem::filename_tree:

Public Member Functions

 filename_tree ()
 
virtual ~filename_tree ()
 
virtual int packed_size () const
 Estimates the space needed for the packed structure. More...
 
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form". More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form". More...
 
- Public Member Functions inherited from nodes::packable_tree
 packable_tree ()
 constructs a new tree with a root and zero branches. More...
 
int recursive_packed_size () const
 spiders the tree starting at this node to calculate the packed size. More...
 
void recursive_pack (basis::byte_array &packed_form) const
 packs the whole tree starting at this node into the packed form. More...
 
- Public Member Functions inherited from nodes::tree
 tree ()
 constructs a new tree with a root and zero branches. More...
 
virtual ~tree ()
 destroys the tree by recursively destroying all child tree nodes. More...
 
 DEFINE_CLASS_NAME ("tree")
 
virtual treebranch (int branch_number) const
 Returns the specified branch of this tree. More...
 
virtual int which (tree *branch_to_find) const
 Returns the branch number for a particular branch in this tree. More...
 
virtual int branches () const
 Returns the number of branches currently connected to this tree. More...
 
virtual treeparent () const
 Returns the tree node that is the immediate ancestor of this one. More...
 
virtual treeroot () const
 Locates and returns the absolute root of the tree containing this tree. More...
 
virtual int depth () const
 Returns the distance of "this" from the root. The root's depth is 0. More...
 
virtual void attach (tree *new_branch)
 Attaches the specified branch to the current tree. More...
 
virtual void insert (int branch_place, tree *new_branch)
 inserts "new_branch" before the branches starting at "branch_place". More...
 
virtual basis::outcome prune (tree *branch_to_cut)
 Removes the specified branch from this tree. More...
 
virtual basis::outcome prune_index (int branch_to_cut)
 Removes the branch at the specified index from this tree. More...
 
iterator start (traversal_directions direction) const
 Returns a fresh iterator positioned at this tree node. More...
 
virtual bool generate_path (path &to_follow) const
 Returns the path to "this" path_tree from its root. More...
 
- Public Member Functions inherited from nodes::node
 node (int number_of_links=0)
 the constructor provides for "number_of_links" links initially. More...
 
virtual ~node ()
 the destructor simply invalidates the node. More...
 
int links () const
 Returns the number of links the node currently holds. More...
 
void set_link (int link_number, node *new_link)
 Connects the node "new_link" to this node. More...
 
nodeget_link (int link_number) const
 Returns the node that is connected to the specified "link_number". More...
 
void zap_link (int link_number)
 the specified link is removed from the node. More...
 
void insert_link (int where, node *to_add=NULL_POINTER)
 adds a new link prior to the position specified in "where". More...
 
int which (node *to_find) const
 locates the index where "to_find" lives in our list of links. More...
 

Public Attributes

filename _dirname
 the full directory name at this position. More...
 
filename_list _files
 the filenames that are at this node in the tree. More...
 
int _depth
 how far below root node are we. More...
 

Additional Inherited Members

- Public Types inherited from nodes::tree
enum  traversal_directions {
  prefix , infix , postfix , to_branches ,
  reverse_branches
}
 
enum  elevator_directions { TOWARD_ROOT , AWAY_FROM_ROOT }
 
- Static Public Member Functions inherited from nodes::packable_tree
static packable_treerecursive_unpack (basis::byte_array &packed_form, packable_tree_factory &creator)
 unpacks a tree stored in "packed_form" and returns it. More...
 

Detailed Description

Definition at line 32 of file filename_tree.h.

Constructor & Destructor Documentation

◆ filename_tree()

filesystem::filename_tree::filename_tree ( )

Definition at line 29 of file filename_tree.cpp.

◆ ~filename_tree()

filesystem::filename_tree::~filename_tree ( )
virtual

Definition at line 31 of file filename_tree.cpp.

References _dirname, _files, and structures::amorph< contents >::reset().

Member Function Documentation

◆ pack()

void filesystem::filename_tree::pack ( basis::byte_array packed_form) const
virtual

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements basis::packable.

Definition at line 37 of file filename_tree.cpp.

References _depth, _dirname, _files, structures::attach(), filesystem::filename::pack(), and filesystem::filename_list::pack().

◆ packed_size()

int filesystem::filename_tree::packed_size ( ) const
virtual

Estimates the space needed for the packed structure.

Implements basis::packable.

Definition at line 33 of file filename_tree.cpp.

References _dirname, _files, filesystem::filename::packed_size(), filesystem::filename_list::packed_size(), and structures::PACKED_SIZE_INT32.

◆ unpack()

bool filesystem::filename_tree::unpack ( basis::byte_array packed_form)
virtual

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements basis::packable.

Definition at line 43 of file filename_tree.cpp.

References _depth, _dirname, _files, structures::detach(), filesystem::filename::unpack(), and filesystem::filename_list::unpack().

Member Data Documentation

◆ _depth

int filesystem::filename_tree::_depth

how far below root node are we.

Definition at line 37 of file filename_tree.h.

Referenced by filesystem::directory_tree::add_path(), filesystem::directory_tree::depth(), pack(), and unpack().

◆ _dirname

◆ _files


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