MRPT logo

mrpt::system::CDirectoryExplorer Class Reference

This class allows the enumeration of the files/directories that exist into a given path. More...

#include <mrpt/system/CDirectoryExplorer.h>

List of all members.

Classes

struct  TFileInfo
 This represents the information about each file. More...

Public Types

typedef std::deque< TFileInfoTFileInfoList
 The list type used in "explore".

Static Public Member Functions

static void explore (const std::string &path, const unsigned long mask, TFileInfoList &outList)
 The path of the directory to examine must be passed to this constructor, among the According to the following parameters, the object will collect the list of files, which can be modified later through other methods in this class.
static void sortByName (TFileInfoList &lstFiles, bool ascendingOrder=true)
 Sort the file entries by name, in ascending or descending order.
static void filterByExtension (TFileInfoList &lstFiles, const std::string &extension)
 Remove from the list of files those whose extension does not coincide (without case) with the given one.

Detailed Description

This class allows the enumeration of the files/directories that exist into a given path.

The only existing method is "explore" and returns the list of found files & directories. Refer to the example in /samples/UTILS/directoryExplorer

See also:
CFileSystemWatcher

Definition at line 50 of file CDirectoryExplorer.h.


Member Typedef Documentation

The list type used in "explore".

See also:
explore

Definition at line 80 of file CDirectoryExplorer.h.


Member Function Documentation

static void mrpt::system::CDirectoryExplorer::explore ( const std::string &  path,
const unsigned long  mask,
TFileInfoList outList 
) [static]

The path of the directory to examine must be passed to this constructor, among the According to the following parameters, the object will collect the list of files, which can be modified later through other methods in this class.

Parameters:
path The path to examine (IT MUST BE A DIRECTORY), e.g "d:\temp\", or "/usr/include/"
mask One or the OR'ed combination of the values "FILE_ATTRIB_ARCHIVE" and "FILE_ATTRIB_DIRECTORY", depending on what file types do you want in the list (These values are platform-independent).
outList The list of found files/directories is stored here.
See also:
sortByName
static void mrpt::system::CDirectoryExplorer::filterByExtension ( TFileInfoList lstFiles,
const std::string &  extension 
) [static]

Remove from the list of files those whose extension does not coincide (without case) with the given one.

Example: filterByExtension(lst,"txt");

static void mrpt::system::CDirectoryExplorer::sortByName ( TFileInfoList lstFiles,
bool  ascendingOrder = true 
) [static]

Sort the file entries by name, in ascending or descending order.




Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009