#include <UFile.h>
|
static int | erase (const std::string &filePath) |
|
static bool | exists (const std::string &filePath) |
|
static std::string | getExtension (const std::string &filePath) |
|
static std::string | getName (const std::string &filePath) |
|
static long | length (const std::string &filePath) |
|
static int | rename (const std::string &oldFilePath, const std::string &newFilePath) |
|
Class UFile.
This class can be used to modify/erase files on hard drive.
Definition at line 35 of file UFile.h.
◆ UFile()
UFile::UFile |
( |
const std::string & |
path | ) |
|
|
inline |
Create a UFile object with path initialized to an existing file .
- Parameters
-
path | the path to an existing file |
Definition at line 82 of file UFile.h.
◆ ~UFile()
◆ erase()
int UFile::erase |
( |
const std::string & |
filePath | ) |
|
|
static |
Erase a file.
- Parameters
-
- Returns
- 0 if success.
Definition at line 60 of file UFile.cpp.
◆ exists() [1/2]
bool UFile::exists |
( |
const std::string & |
filePath | ) |
|
|
static |
Check if a file exists.
- Parameters
-
- Returns
- true if the file exists, otherwise false.
Definition at line 27 of file UFile.cpp.
◆ exists() [2/2]
Check if the file exists.
- Returns
- true if the path exits
Definition at line 95 of file UFile.h.
◆ getExtension() [1/2]
std::string UFile::getExtension |
( |
const std::string & |
filePath | ) |
|
|
static |
◆ getExtension() [2/2]
std::string UFile::getExtension |
( |
| ) |
|
|
inline |
Get the file extension.
- Returns
- the file extension
Definition at line 131 of file UFile.h.
◆ getName() [1/2]
std::string UFile::getName |
( |
const std::string & |
filePath | ) |
|
|
static |
Get the file name from a file path (with extension).
- Parameters
-
- Returns
- the file name.
Definition at line 71 of file UFile.cpp.
◆ getName() [2/2]
std::string UFile::getName |
( |
| ) |
|
|
inline |
Get the file name without the path.
- Returns
- the file name
Definition at line 126 of file UFile.h.
◆ isValid()
Check if the file exists. Same as exists().
- Returns
- true if the path exits
Definition at line 89 of file UFile.h.
◆ length() [1/2]
long UFile::length |
( |
const std::string & |
filePath | ) |
|
|
static |
Get the file length.
- Parameters
-
- Returns
- long the length of the file in bytes. Return -1 if the file doesn't exist.
Definition at line 39 of file UFile.cpp.
◆ length() [2/2]
Get the length of the file.
- Returns
- long the length of the file in bytes. Return -1 if the file doesn't exist.
Definition at line 101 of file UFile.h.
◆ rename() [1/2]
int UFile::rename |
( |
const std::string & |
oldFilePath, |
|
|
const std::string & |
newFilePath |
|
) |
| |
|
static |
Rename a file.
- Parameters
-
oldFilePath | the old file path |
newFilePath | the new file path |
- Returns
- 0 if success.
Definition at line 65 of file UFile.cpp.
◆ rename() [2/2]
int UFile::rename |
( |
const std::string & |
newName | ) |
|
|
inline |
Rename the file name. The path stays the same.
- Parameters
-
Definition at line 107 of file UFile.h.
◆ path_
The documentation for this class was generated from the following files: