MySQL 9.1.0
Source Code Documentation
Dir_Walker Class Reference

Class to scan the directory hierarchy using a depth first scan. More...

#include <os0file.h>

Classes

struct  Entry
 Directory names for the depth first directory scan. More...
 

Public Types

using Path = std::string
 

Static Public Member Functions

static bool is_directory (const Path &path)
 Check if the path is a directory. More...
 
template<typename F >
static void walk (const Path &basedir, bool recursive, F &&f)
 Depth first traversal of the directory starting from basedir. More...
 

Private Types

using Function = std::function< void(const Path &, size_t)>
 

Static Private Member Functions

static void walk_posix (const Path &basedir, bool recursive, Function &&f)
 Depth first traversal of the directory starting from basedir. More...
 

Detailed Description

Class to scan the directory hierarchy using a depth first scan.

Member Typedef Documentation

◆ Function

using Dir_Walker::Function = std::function<void(const Path &, size_t)>
private

◆ Path

using Dir_Walker::Path = std::string

Member Function Documentation

◆ is_directory()

bool Dir_Walker::is_directory ( const Path path)
static

Check if the path is a directory.

The file/directory must exist.

Parameters
[in]pathThe path to check
Returns
true if it is a directory

◆ walk()

template<typename F >
static void Dir_Walker::walk ( const Path basedir,
bool  recursive,
F &&  f 
)
inlinestatic

Depth first traversal of the directory starting from basedir.

Parameters
[in]basedirStart scanning from this directory
[in]recursivetrue if scan should be recursive
[in]fFunction to call for each entry

◆ walk_posix()

void Dir_Walker::walk_posix ( const Path basedir,
bool  recursive,
Function &&  f 
)
staticprivate

Depth first traversal of the directory starting from basedir.

Parameters
[in]basedirStart scanning from this directory
[in]recursivetrue if scan should be recursive
[in]fFunction to call for each entry

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