#include <UDirectory.h>
|
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 () |
|
Class UDirectory.
This class can be used to get file names in a directory.
Definition at line 36 of file UDirectory.h.
◆ UDirectory() [1/2]
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
-
path | the path to an existing directory |
extensions | filter 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.
◆ UDirectory() [2/2]
◆ ~UDirectory()
UDirectory::~UDirectory |
( |
| ) |
|
◆ currentDir()
std::string UDirectory::currentDir |
( |
bool |
trailingSeparator = false | ) |
|
|
static |
Get the current directory.
- Parameters
-
trailingSeparator | If true, a '/' is added to the path. |
- Returns
- the current directory
Definition at line 298 of file UDirectory.cpp.
◆ exists()
bool UDirectory::exists |
( |
const std::string & |
dirPath | ) |
|
|
static |
Check if a directory exists.
- Parameters
-
dirPath | the directory path |
- Returns
- true if the directory exists
Definition at line 238 of file UDirectory.cpp.
◆ getDir()
std::string UDirectory::getDir |
( |
const std::string & |
filePath | ) |
|
|
static |
Get the directory path of a file path.
- Parameters
-
- Returns
- the directory path of the file
Definition at line 262 of file UDirectory.cpp.
◆ getFileNames()
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.
◆ getNextFileName()
std::string UDirectory::getNextFileName |
( |
| ) |
|
Get the next file name.
- Returns
- the next file name
Definition at line 221 of file UDirectory.cpp.
◆ homeDir()
std::string UDirectory::homeDir |
( |
| ) |
|
|
static |
Return the "home" directory.
- Returns
- the directory path.
Definition at line 344 of file UDirectory.cpp.
◆ isValid()
bool UDirectory::isValid |
( |
| ) |
|
Check is the directory exists.
- Returns
- if directory exists.
Definition at line 216 of file UDirectory.cpp.
◆ makeDir()
bool UDirectory::makeDir |
( |
const std::string & |
dirPath | ) |
|
|
static |
Make a directory.
- Parameters
-
dirPath | the directory path |
- Returns
- true on success, false otherwise.
Definition at line 322 of file UDirectory.cpp.
◆ operator=()
◆ removeDir()
bool UDirectory::removeDir |
( |
const std::string & |
dirPath | ) |
|
|
static |
Remove a directory.
- Parameters
-
dirPath | the directory path |
- Returns
- true on success, false otherwise.
Definition at line 333 of file UDirectory.cpp.
◆ rewind()
void UDirectory::rewind |
( |
| ) |
|
Return the pointer of file names to beginning.
Definition at line 232 of file UDirectory.cpp.
◆ separator()
std::string UDirectory::separator |
( |
| ) |
|
|
static |
Return \ (Win32) or / (Unix) depending of the platform.
Definition at line 365 of file UDirectory.cpp.
◆ setPath()
void UDirectory::setPath |
( |
const std::string & |
path, |
|
|
const std::string & |
extensions = "" |
|
) |
| |
Set path of the directory.
- Parameters
-
path | the new directory path. |
Definition at line 95 of file UDirectory.cpp.
◆ update()
void UDirectory::update |
( |
| ) |
|
Update indexed file names (if the directory changed).
Definition at line 104 of file UDirectory.cpp.
◆ extensions_
std::vector<std::string> UDirectory::extensions_ |
|
private |
◆ fileNames_
std::list<std::string> UDirectory::fileNames_ |
|
private |
◆ iFileName_
std::list<std::string>::iterator UDirectory::iFileName_ |
|
private |
◆ path_
std::string UDirectory::path_ |
|
private |
The documentation for this class was generated from the following files: