Generic File. More...
#include <rfile.h>
Public Member Functions | |
RFile (void) | |
RFile (const RURI &uri) | |
RFile (const RFile &file) | |
virtual void | Open (RIO::ModeType mode) |
void | Open (const RURI &uri, RIO::ModeType mode) |
virtual void | Close (void) |
int | Compare (const RFile &file) const |
int | Compare (const RFile *file) const |
int | Compare (const RString &uri) const |
const RURI & | GetURI (void) const |
void | SetURI (const RURI &uri) |
const RString | GetFileName (void) const |
virtual | ~RFile (void) |
Static Public Member Functions | |
static RChar | GetDirSeparator (void) |
static void | RemoveFile (const RURI &uri) |
static void | RenameFile (const RURI &olduri, const RURI &newuri) |
static RURI | GetTempFile (void) |
static bool | Exists (const RURI &uri) |
static bool | IsDir (const RURI &uri) |
Protected Attributes | |
RIO::ModeType | Mode |
RURI | URI |
Detailed Description
Generic File.
The RFile class represents a file (text files, directories...).
Constructor & Destructor Documentation
RFile | ( | void | ) |
Default constructor.
|
virtual |
Destruct the file.
Member Function Documentation
|
virtual |
Open the file
- Parameters
-
mode The open mode for the file.
Reimplemented in RXMLParser, RTextFile, RKeyValueFile< K >, RIOFile, RRecFile< C, bOrder >, RBlockFile, RCSVFile, RXMLFile, RBinaryFile, RDir, and RHTMLFile.
void Open | ( | const RURI & | uri, |
RIO::ModeType | mode | ||
) |
Open the file
- Parameters
-
uri URI of the file. mode The open mode for the file.
|
virtual |
Close the file.
Reimplemented in RTextFile, RKeyValueFile< K >, RIOFile, RRecFile< C, bOrder >, RBlockFile, RCSVFile, RXMLFile, and RDir.
int Compare | ( | const RFile & | file | ) | const |
int Compare | ( | const RFile * | file | ) | const |
int Compare | ( | const RString & | uri | ) | const |
const RURI& GetURI | ( | void | ) | const |
Return the URI of the file including.
void SetURI | ( | const RURI & | uri | ) |
Set the URI of the file.
- Parameters
-
uri URI of the file.
const RString GetFileName | ( | void | ) | const |
Return the name of the file. If the fullname doesn't have a slash at the end, the part between the last slash and the end of the fullname is considered to be the file name. If the fullname has a slash at the end, an empty string is returned here.
- Returns
- a string containing the name.
|
static |
Get the separator used for the directories.
|
static |
Remove a file from the disk.
- Parameters
-
uri URI of the file.
Rename a file from the disk.
- Parameters
-
olduri Old URI of the file. newuri New URI of the file.
|
static |
Get a name for a temporary file.
- Attention
- Under Unix-like OS (such as Linux), a empty file is created by the OS to ensure that a given name cannot be used by multiple calls. It can be necessary to delete manually the file (normally, the temporary directory is automatically emptied).
- Returns
- Name of the file.
|
static |
Test if an URI correspond to an existing file or directory that can be accessed. If the URI is correct but the calling application has the not the correct rights, the function returns false.
- Parameters
-
uri URI to test.
|
static |
Test if an URI is a directory or not. If the directory exists but the calling application has the not the correct rights, the function returns false.
- Parameters
-
uri URI to test.
Field Documentation
|
protected |
How the file has to be used.
|
protected |
URI of the File.