gtkutil::VFSTreePopulator Class Reference

#include <VFSTreePopulator.h>

Data Structures

struct  Visitor

Public Member Functions

 VFSTreePopulator (GtkTreeStore *store, GtkTreeIter *toplevel=NULL)
virtual ~VFSTreePopulator ()
void addPath (const std::string &path)
void forEachNode (Visitor &visitor)

Private Types

typedef std::map< std::string,
GtkTreeIter * > 
NamedIterMap

Private Member Functions

GtkTreeIter * addRecursive (const std::string &path)

Private Attributes

GtkTreeStore * _store
GtkTreeIter * _topLevel
NamedIterMap _iters
std::set< std::string_explicitPaths

Detailed Description

Utility class to construct a GtkTreeStore from a series of string paths in the form "models/first/second/object.lwo" or similar. The class accepts the Tree Store and then string paths, one by one, adding each one to the tree in the appropriate place.

Since the VFSTreePopulator has no knowledge of the column data to be inserted into the tree, it does not set any of the values but merely calls gtk_tree_store_append to get a GtkTreeIter* pointing to the newly-added row. In order to insert the data, the calling code must then call the visitor function which will provide the visitor with two objects - the created GtkTreeIter*, and the full input string which the visitor can then use to populate the data appropriately.

When the VFSTreePopulator is destroyed it will free any temporary structures used during tree creation, such as the hashtable of GtkTreeIter* objects used to locate parent nodes. The GtkTreeModel will not be destroyed since it is owned by the calling code.

Definition at line 31 of file VFSTreePopulator.h.


Member Typedef Documentation

Definition at line 41 of file VFSTreePopulator.h.


Constructor & Destructor Documentation

gtkutil::VFSTreePopulator::VFSTreePopulator ( GtkTreeStore *  store,
GtkTreeIter *  toplevel = NULL 
)

Construct a VFSTreePopulator which will populate the given tree store.

Parameters:
store Tree store to populate.
toplevel GtkTreeIter pointing to the toplevel node, under which all paths should be added. Default is NULL to indicate that paths should be added under the tree root.
virtual gtkutil::VFSTreePopulator::~VFSTreePopulator (  )  [virtual]

Destroy the VFSTreePopulator and all temporary data.


Member Function Documentation

void gtkutil::VFSTreePopulator::addPath ( const std::string path  ) 

Add a single VFS string to the tree, which will be split automatically and inserted at the correct place in the tree.

GtkTreeIter* gtkutil::VFSTreePopulator::addRecursive ( const std::string path  )  [private]
void gtkutil::VFSTreePopulator::forEachNode ( Visitor visitor  ) 

Visit each node in the constructed tree, passing the GtkTreeIter* and the VFS string to the visitor object so that data can be inserted.


Field Documentation

Definition at line 46 of file VFSTreePopulator.h.

Definition at line 42 of file VFSTreePopulator.h.

GtkTreeStore* gtkutil::VFSTreePopulator::_store [private]

Definition at line 34 of file VFSTreePopulator.h.

GtkTreeIter* gtkutil::VFSTreePopulator::_topLevel [private]

Definition at line 37 of file VFSTreePopulator.h.


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

Generated by  doxygen 1.6.2