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

A base for classes employed to traverse a file_tree. More...

#include <file_tree.h>

Inheritance diagram for file_tree::traverser:
no_copy dataset::driver

Public Member Functions

virtual ~traverser ()=default
 Destructor.
 
void operator() (entry const &entry)
 Apply the traverser function-wise to an element of a file_tree. More...
 
virtual void enter_dir (std::string const &dirname)
 Do something (or nohting) on entering a directory. More...
 
virtual void at_file (std::string const &filename)
 Do something (or nothing) on reaching a file. More...
 
virtual void leave_dir (std::string const &dirname)
 Do something (or nohting) on leaving a directory. More...
 

Protected Attributes

node const * _cur_dir = nullptr
 Pointer the node representing the latest directory that traversal has reached.
 
path_t _cur_path
 The absolute path of the object that traversal has reached.
 

Detailed Description

A base for classes employed to traverse a file_tree.

A traverser encapsulates the actions to be taken at the junctures of a file_tree traversal:-

  • At entering directory
  • At a file
  • At leaving a directory.

Definition at line 285 of file file_tree.h.

Member Function Documentation

virtual void file_tree::traverser::at_file ( std::string const &  filename)
inlinevirtual

Do something (or nothing) on reaching a file.

Parameters
filenameThe absolute name of the file.

Reimplemented in dataset::driver.

Definition at line 306 of file file_tree.h.

virtual void file_tree::traverser::enter_dir ( std::string const &  dirname)
inlinevirtual

Do something (or nohting) on entering a directory.

Parameters
dirnameThe absolute name of the directory.

Definition at line 302 of file file_tree.h.

virtual void file_tree::traverser::leave_dir ( std::string const &  dirname)
inlinevirtual

Do something (or nohting) on leaving a directory.

Parameters
dirnameThe absolute name of the directory.

Definition at line 310 of file file_tree.h.

void file_tree::traverser::operator() ( entry const &  entry)

Apply the traverser function-wise to an element of a file_tree.

Parameters
entryThe element to which the traverser shall be applied.

Definition at line 73 of file file_tree.cpp.


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