#include <cel_filepath.h>
This class ensures the file path is normalized and reduces the risk of inproper file path validation. The codes that deals with any file paths had better use the class instead of the real file path.
Almost all the member functions provided in the class uses the functions provided in FileUtils namespace.
- See Also
- FileUtils, FileUtils::normalizePath
Celartem::Path::Path |
( |
const Path & |
inFilePath | ) |
|
|
inline |
This constructor is for duplicating the Path instance.
- Parameters
-
inFilePath | The file path to be stored. |
Celartem::Path::Path |
( |
const String & |
inFilePath | ) |
|
|
inline |
This constructor initializes the instance with the specified file path.
- Parameters
-
inFilePath | The file path to be stored. |
Celartem::Path::Path |
( |
const char * |
inFilePath | ) |
|
|
inline |
This constructor initializes the instance with the specified file path.
- Parameters
-
inFilePath | The file path to be stored. |
Celartem::Path::Path |
( |
const utf8s & |
inFilePath | ) |
|
|
inline |
This constructor initializes the instance with the specified file path.
- Parameters
-
inFilePath | The file path to be stored. |
Celartem::Path::Path |
( |
const UChar2 * |
inFilePath | ) |
|
|
inline |
This constructor initializes the instance with the specified file path.
- Parameters
-
inFilePath | The file path to be stored. |
Celartem::Path::Path |
( |
const UChar4 * |
inFilePath | ) |
|
|
inline |
This constructor initializes the instance with the specified file path.
- Parameters
-
inFilePath | The file path to be stored. |
void Celartem::Path::assign |
( |
const String & |
inFilePath | ) |
|
|
inline |
bool Celartem::Path::deleteFile |
( |
| ) |
const |
|
inline |
This function delete the file.
- Returns
true
if success, otherwise false
.
bool Celartem::Path::doesExist |
( |
| ) |
const |
|
inline |
This function checks whether the file exists or not.
- Returns
true
if the file exists, otherwise false
.
String Celartem::Path::getBodyFileName |
( |
| ) |
const |
|
inline |
This function returns the body file name.
If you pass "C:\foo\bar\baz.txt" for the function, it returns "baz.txt". On Windows, this function also works with '/' path separator.
- Returns
- The body file name.
String Celartem::Path::getExtension |
( |
| ) |
const |
|
inline |
This function returns the extension ".XXX".
- Returns
- The extension.
String Celartem::Path::getPath |
( |
| ) |
const |
|
inline |
This function explicitly convert the instance into String. You can assume the file path returned is normalized.
- Returns
- The normalized file path.
- See Also
- assign
bool Celartem::Path::isDirectory |
( |
| ) |
const |
|
inline |
This function checks whether the specified path is a directory or not.
- Returns
true
if the path is a directory, otherwise false
.
Celartem::Path::operator String |
( |
| ) |
const |
|
inline |
This function implicitly convert the instance into String. You can assume the file path returned is normalized.
- Returns
- The normalized file path.
- See Also
- assign
Path& Celartem::Path::operator= |
( |
const Path & |
inFilePath | ) |
|
|
inline |
This function duplicates the specified Path instance.
- Parameters
-
inFilePath | The file path to be stored. |
- Returns
- Reference to this instance.
Path& Celartem::Path::operator= |
( |
const String & |
inFilePath | ) |
|
|
inline |
This function set the specified file path to this instance.
- Parameters
-
inFilePath | The file path to be stored. |
- Returns
- Reference to this instance.
- See Also
- assign
Path& Celartem::Path::operator= |
( |
const utf8s & |
inFilePath | ) |
|
|
inline |
This function set the specified file path to this instance.
- Parameters
-
inFilePath | The file path to be stored. |
- Returns
- Reference to this instance.
- See Also
- assign
Path& Celartem::Path::operator= |
( |
const UChar2 * |
inFilePath | ) |
|
|
inline |
This function set the specified file path to this instance.
- Parameters
-
inFilePath | The file path to be stored. |
- Returns
- Reference to this instance.
- See Also
- assign
Path& Celartem::Path::operator= |
( |
const UChar4 * |
inFilePath | ) |
|
|
inline |
This function set the specified file path to this instance.
- Parameters
-
inFilePath | The file path to be stored. |
- Returns
- Reference to this instance.
- See Also
- assign
bool Celartem::Path::overwriteWith |
( |
const Path & |
inSrc, |
|
|
bool |
forceOverwrite = false |
|
) |
| const |
|
inline |
This function overwrite the file with the specified file; it actually does copy of the specified file.
- Parameters
-
inSrc | The copy source file. |
forceOverwrite | if the parameter is true , then this function overwrites the existing file, otherwise the function fails. |
- Returns
true
if success, otherwise false
.
String Celartem::Path::removeExtension |
( |
| ) |
const |
|
inline |
This function removes the extension (including '.').
- Returns
- The result path.
String Celartem::Path::removeFileNameFromPath |
( |
| ) |
const |
|
inline |
This function removes the body file name from the specified path. If you pass "C:\foo\bar\baz" for the function, it returns "C:\foo\bar\" and never removes the last '\' from the path. On Windows, this function also works with '/' path separator.
- Returns
- The result path.
String Celartem::Path::removeTrailingPathSeparator |
( |
| ) |
const |
|
inline |
This function removes the traling path separator from the specified path. If you pass "C:\foo\bar\baz\" for the function, it returns "C:\foo\bar\baz". On Windows, this function also works with '/' path separator.
- Returns
- The result path.
bool Celartem::Path::replaceWith |
( |
const Path & |
inReplacer | ) |
const |
|
inline |
This function replaces the file with another file.
- Parameters
-
inReplacer | File name that specifies the file that overwrites the file. |
- Returns
true
if success, otherwise false
.
The documentation for this class was generated from the following file: