Public Member Functions | Static Public Member Functions | Private Attributes
UDirectory Class Reference

#include <UDirectory.h>

List of all members.

Public Member Functions

const std::list< std::string > & getFileNames () const
std::string getNextFileName ()
std::string getNextFilePath ()
bool isValid ()
UDirectoryoperator= (const UDirectory &dir)
void rewind ()
void setPath (const std::string &path, const std::string &extensions="")
 UDirectory (const std::string &path="", const std::string &extensions="")
 UDirectory (const UDirectory &dir)
void update ()
 ~UDirectory ()

Static Public Member Functions

static std::string currentDir (bool trailingSeparator=false)
static bool exists (const std::string &dirPath)
static std::string getDir (const std::string &filePath)
static std::string homeDir ()
static bool makeDir (const std::string &dirPath)
static bool removeDir (const std::string &dirPath)
static std::string separator ()

Private Attributes

std::vector< std::string > extensions_
std::list< std::string > fileNames_
std::list< std::string >::iterator iFileName_
std::string path_

Detailed Description

Class UDirectory.

This class can be used to get file names in a directory.

Definition at line 34 of file UDirectory.h.


Constructor & Destructor Documentation

UDirectory::UDirectory ( const std::string &  path = "",
const std::string &  extensions = "" 
)

Create a UDirectory object with path initialized to an existing "path" and with filter "extensions".

Parameters:
paththe path to an existing directory
extensionsfilter to get only file names with the extensions specified, format is a list of extensions separated by a space: "jpg bmp" get only file names finishing by jpg or bmp.

Definition at line 62 of file UDirectory.cpp.

Definition at line 70 of file UDirectory.cpp.

Definition at line 90 of file UDirectory.cpp.


Member Function Documentation

std::string UDirectory::currentDir ( bool  trailingSeparator = false) [static]

Get the current directory.

Parameters:
trailingSeparatorIf true, a '/' is added to the path.
Returns:
the current directory

Definition at line 308 of file UDirectory.cpp.

bool UDirectory::exists ( const std::string &  dirPath) [static]

Check if a directory exists.

Parameters:
dirPaththe directory path
Returns:
true if the directory exists

Definition at line 248 of file UDirectory.cpp.

std::string UDirectory::getDir ( const std::string &  filePath) [static]

Get the directory path of a file path.

Parameters:
filePaththe file path
Returns:
the directory path of the file

Definition at line 272 of file UDirectory.cpp.

const std::list<std::string>& UDirectory::getFileNames ( ) const [inline]

Get all file names.

See also:
UDirectory()
Returns:
all the file names in directory matching the set extensions.

Definition at line 129 of file UDirectory.h.

std::string UDirectory::getNextFileName ( )

Get the next file name.

Returns:
the next file name

Definition at line 220 of file UDirectory.cpp.

std::string UDirectory::getNextFilePath ( )

Get the next file path.

Returns:
the next file path

Definition at line 231 of file UDirectory.cpp.

std::string UDirectory::homeDir ( ) [static]

Return the "home" directory.

Returns:
the directory path.

Definition at line 354 of file UDirectory.cpp.

Check is the directory exists.

Returns:
if directory exists.

Definition at line 215 of file UDirectory.cpp.

bool UDirectory::makeDir ( const std::string &  dirPath) [static]

Make a directory.

Parameters:
dirPaththe directory path
Returns:
true on success, false otherwise.

Definition at line 332 of file UDirectory.cpp.

UDirectory & UDirectory::operator= ( const UDirectory dir)

Definition at line 75 of file UDirectory.cpp.

bool UDirectory::removeDir ( const std::string &  dirPath) [static]

Remove a directory.

Parameters:
dirPaththe directory path
Returns:
true on success, false otherwise.

Definition at line 343 of file UDirectory.cpp.

Return the pointer of file names to beginning.

Definition at line 242 of file UDirectory.cpp.

std::string UDirectory::separator ( ) [static]

Return \ (Win32) or / (Unix) depending of the platform.

Definition at line 375 of file UDirectory.cpp.

void UDirectory::setPath ( const std::string &  path,
const std::string &  extensions = "" 
)

Set path of the directory.

Parameters:
paththe new directory path.

Definition at line 94 of file UDirectory.cpp.

Update indexed file names (if the directory changed).

Definition at line 103 of file UDirectory.cpp.


Member Data Documentation

std::vector<std::string> UDirectory::extensions_ [private]

Definition at line 138 of file UDirectory.h.

std::list<std::string> UDirectory::fileNames_ [private]

Definition at line 139 of file UDirectory.h.

std::list<std::string>::iterator UDirectory::iFileName_ [private]

Definition at line 140 of file UDirectory.h.

std::string UDirectory::path_ [private]

Definition at line 137 of file UDirectory.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sat Jul 23 2016 11:44:31