gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
DirectoryScanner Class Reference

#include <DirectoryScanner.H>

Inheritance diagram for DirectoryScanner:
[legend]
Collaboration diagram for DirectoryScanner:
[legend]

Public Member Functions

 DirectoryScanner ()
 
 DirectoryScanner (std::string path)
 
virtual ~DirectoryScanner ()
 
int open (std::string path)
 
int close (void)
 
int findAll (const std::vector< std::string > &dontInclude)
 
void keepWithPattern (const std::string pattern)
 
std::string getPath ()
 

Static Public Member Functions

static std::string getHomeDir ()
 
static int mkDir (const std::string &pathname, mode_t mode)
 

Private Attributes

DIRdir
 
std::string path
 

Detailed Description

Scan a directory for contents, either directories or other files. The found names are in the inherited std::vector of std::strings.

Examples:
DirectoryScannerTest.C.

Definition at line 63 of file DirectoryScanner.H.

Constructor & Destructor Documentation

◆ DirectoryScanner() [1/2]

DirectoryScanner::DirectoryScanner ( )
inline

Empty constructor call open to operate.

Definition at line 69 of file DirectoryScanner.H.

◆ DirectoryScanner() [2/2]

DirectoryScanner::DirectoryScanner ( std::string  path)
inline

Can the directory at path. The directoryItems are filled.

Parameters
pathThe path to scan for files/directories

Definition at line 76 of file DirectoryScanner.H.

◆ ~DirectoryScanner()

virtual DirectoryScanner::~DirectoryScanner ( )
inlinevirtual

Definition at line 81 of file DirectoryScanner.H.

Member Function Documentation

◆ close()

int DirectoryScanner::close ( void  )
inline

Close the directory

Returns
NO_ERROR or the appropriate error on failure.

Definition at line 104 of file DirectoryScanner.H.

Here is the call graph for this function:

◆ findAll()

int DirectoryScanner::findAll ( const std::vector< std::string > &  dontInclude)
inline

The directoryItems are filled in the directory represented by path.

Parameters
dontIncludeThe directories or files not to include
Returns
NO_ERROR or the appropriate error on failure.
Examples:
DirectoryScannerTest.C.

Definition at line 119 of file DirectoryScanner.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHomeDir()

static std::string DirectoryScanner::getHomeDir ( )
inlinestatic

Get the user's home directory

Returns
The user's home directory if successful, empty string otherwise

Definition at line 170 of file DirectoryScanner.H.

◆ getPath()

std::string DirectoryScanner::getPath ( )
inline

Find the current path.

Returns
The current path.
Examples:
DirectoryScannerTest.C.

Definition at line 162 of file DirectoryScanner.H.

◆ keepWithPattern()

void DirectoryScanner::keepWithPattern ( const std::string  pattern)
inline

Keep any item which has pattern in the path/name.

Parameters
patternThe pattern to find in the path/name

Definition at line 153 of file DirectoryScanner.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkDir()

static int DirectoryScanner::mkDir ( const std::string &  pathname,
mode_t  mode 
)
inlinestatic

Make a directory.

Parameters
pathnameThe directory to make

Definition at line 182 of file DirectoryScanner.H.

Here is the call graph for this function:

◆ open()

int DirectoryScanner::open ( std::string  path)
inline

Open the directory at path.

Parameters
pathThe path to scan for files/directories
Returns
NO_ERROR or the appropriate error on failure.

Definition at line 90 of file DirectoryScanner.H.

Here is the call graph for this function:

Member Data Documentation

◆ dir

DIR* DirectoryScanner::dir
private

Definition at line 64 of file DirectoryScanner.H.

◆ path

std::string DirectoryScanner::path
private

Definition at line 65 of file DirectoryScanner.H.


The documentation for this class was generated from the following file:
gtkIOStream: DirectoryScanner Class Reference
GTK+ IOStream  Beta