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 ()
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 36 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 63 of file UDirectory.cpp.

Definition at line 71 of file UDirectory.cpp.

Definition at line 91 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 298 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 238 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 262 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 125 of file UDirectory.h.

std::string UDirectory::getNextFileName ( )

Get the next file name.

Returns:
the next file name

Definition at line 221 of file UDirectory.cpp.

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

Return the "home" directory.

Returns:
the directory path.

Definition at line 344 of file UDirectory.cpp.

Check is the directory exists.

Returns:
if directory exists.

Definition at line 216 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 322 of file UDirectory.cpp.

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

Definition at line 76 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 333 of file UDirectory.cpp.

Return the pointer of file names to beginning.

Definition at line 232 of file UDirectory.cpp.

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

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

Definition at line 365 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 95 of file UDirectory.cpp.

Update indexed file names (if the directory changed).

Definition at line 104 of file UDirectory.cpp.


Member Data Documentation

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

Definition at line 134 of file UDirectory.h.

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

Definition at line 135 of file UDirectory.h.

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

Definition at line 136 of file UDirectory.h.

std::string UDirectory::path_ [private]

Definition at line 133 of file UDirectory.h.


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


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Thu Aug 27 2015 13:00:34