coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
file_tree Struct Reference

Encapsulates a set of directory/file trees. More...

#include <file_tree.h>

Inheritance diagram for file_tree:
no_copy

Classes

struct  no_filter
 Type representing the null filter for selecting files. More...
 
struct  node
 Type of a node in a file_tree. More...
 
struct  traverser
 A base for classes employed to traverse a file_tree. More...
 

Public Types

using child_list = node::child_list
 Type of a sequence of sibling nodes in a file_tree
 
using node_ptr = node::node_ptr
 Type of a pointer to a node
 
using entry = node::entry
 Type of an element in a child_list.
 

Public Member Functions

 file_tree ()
 Default constructor.
 
unsigned files () const
 Get the number of files in the file_tree
 
void traverse (traverser &action)
 Traverse the file_tree. More...
 
template<typename Filter = file_tree::no_filter>
void add (std::string const &path, Filter &filter)
 Add files from a path to the file_tree. More...
 
template<class InIter , class Filter = file_tree::no_filter>
void add (InIter start, InIter end, Filter &filter)
 Add files from a path to the file_tree. More...
 

Private Attributes

node _root
 The root node of the file_tree. More...
 
unsigned _files = 0
 The number of files in the file_tree. More...
 

Detailed Description

Encapsulates a set of directory/file trees.

struct file_tree encapsulates a set of directory/file trees, notionally united at a root node that does not represent any file-system object, but just affords entry to the set.

Definition at line 55 of file file_tree.h.

Member Function Documentation

template<typename Filter = file_tree::no_filter>
void file_tree::add ( std::string const &  path,
Filter &  filter 
)
inline

Add files from a path to the file_tree.

Parameters
pathThe path from files are to be added.
filterAn optional filter for selecting the files to be added.

Files within path that satisfy filter are recursively added to the file_tree. filter defaults to no_filter, which is satisfied by any file.

Definition at line 357 of file file_tree.h.

template<class InIter , class Filter = file_tree::no_filter>
void file_tree::add ( InIter  start,
InIter  end,
Filter &  filter 
)
inline

Add files from a path to the file_tree.

Template Parameters
InIterAn input iterator type.
Parameters
startAn iterator to the start of a seqence of file or directory names.
endThe end of the sequence commencing at start.
filterAn optional filter for selecting the files to be added.

All selected files within the members of the argument sequence are added to the file_tree.

Definition at line 379 of file file_tree.h.

void file_tree::traverse ( traverser action)
inline

Traverse the file_tree.

Parameters
actionA traverser to be applied to each node in the file_tree.

Definition at line 343 of file file_tree.h.

Member Data Documentation

unsigned file_tree::_files = 0
private

The number of files in the file_tree.

This data member is updated by adding files to the tree so that the population of the tree may be queried without calculation.

Definition at line 396 of file file_tree.h.

node file_tree::_root
private

The root node of the file_tree.

The root node does not represent any filesystem object; it simply unites all the top-level filesystem objects that are represented.

Definition at line 390 of file file_tree.h.


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