wex  v21.04.0
Public Member Functions | List of all members
wex::dir Class Reference

Offers find_files method. More...

#include <wex/dir.h>

Inheritance diagram for wex::dir:
Inheritance graph
[legend]

Public Member Functions

 dir (const path &path, const data::dir &data=data::dir())
 Constructor. More...
 
virtual ~dir ()
 Destructor.
 
virtual bool on_dir (const path &)
 Virtual interface. More...
 
virtual bool on_file (const path &)
 Do something with the file. More...
 
const auto & data () const
 Other methods. More...
 
int find_files ()
 Finds matching files. More...
 
const auto & get_path () const
 Returns the path.
 

Additional Inherited Members

- Static Public Member Functions inherited from wex::interruptible
static bool cancel ()
 Cancel interruptible process. More...
 
static bool is_cancelled ()
 Check whether process was cancelled.
 
static bool is_running ()
 Is process running.
 
static bool start ()
 Starts interruptible process. More...
 
static void stop ()
 Stops interruptible process.
 

Detailed Description

Offers find_files method.

By overriding on_dir and on_file you can take care of what to do with the result.

Constructor & Destructor Documentation

◆ dir()

wex::dir::dir ( const path path,
const data::dir data = data::dir() 
)

Constructor.

Parameters
paththe dir to start finding
datathe dir data

Member Function Documentation

◆ data()

const auto& wex::dir::data ( ) const
inline

Other methods.

Returns the data.

◆ find_files()

int wex::dir::find_files ( )

Finds matching files.

This results in recursive calls for on_dir and on_file. Returns number of files matching, or -1 if error.

◆ on_dir()

virtual bool wex::dir::on_dir ( const path )
inlinevirtual

Virtual interface.

Do something with the dir. Not made pure virtual, to allow this class to be tested by calling find_files.

Reimplemented in wex::report::dir.

◆ on_file()

virtual bool wex::dir::on_file ( const path )
inlinevirtual

Do something with the file.

Not made pure virtual, to allow this class to be tested by calling find_files.

Reimplemented in wex::report::tool_dir, and wex::report::dir.