#include <mcllib/MCFile.h>
Inheritance diagram for MCFile:
Public Types | |
enum | ESeekWhence { MCSEEKSTART = 0, MCSEEKCUR = 1, MCSEEKEND = 2 } |
Enumeration indicating how the seek() method should operate. More... | |
enum | EStdHandle { MCSTDIN = 0, MCSTDOUT = 1, MCSTDERR = 2 } |
Standard file handles. More... | |
Public Member Functions | |
bool | isStdHandle () |
Check to see if the file refers to a standard file handle. | |
MCFile (const MCString &name) | |
Construct a file which represents a file in the filesystem. | |
MCFile (EStdHandle hdl) | |
Construct a file which represents one of the standard files. | |
MCFile () | |
Default constructor. | |
void | open (mcintn flags, mcintn mode=0666) |
Open the file. | |
mcintn | print (const char *fmt,...) |
Write formatted output to the file in the style of printf(). | |
mcintn | printf (const char *fmt,...) |
Write formatted output to the file in the style of printf(). | |
mcint64 | seek (mcint64 offset, ESeekWhence whence) |
Position within the file. | |
void | sync () |
Block until the file's contents are physically on the disk. | |
mcintn | vprint (const char *fmt, va_list ap) |
Write formatted output to the file in the style of vprintf(). | |
mcintn | vprintf (const char *fmt, va_list ap) |
vprintf to the file. | |
~MCFile () | |
Destructor. | |
Static Public Attributes | |
const mcintn | MCAPPEND |
Flag indicating open the file for append. | |
const mcintn | MCCREATE |
Flag indicating that the file should be created if it doesn't exist. | |
const mcintn | MCEXCL |
Flag indicating that create should fail if the file already exists. | |
const mcintn | MCMAKE |
Convenience to open a file read-write, creating if necessary. | |
const mcintn | MCMAKEEMPTY |
Flag indicating to create the file is necessary and erase any existing content (truncate). | |
const mcintn | MCRDONLY |
Flag indicating open the file read only. | |
const mcintn | MCRDWR |
Flag indicating open the file for reading and writing. | |
const mcintn | MCSYNC |
Flag indicating that writes block until the data is physically on disk. | |
const mcintn | MCTRUNC |
Flag indicating that the file should be truncated (emptied). | |
const mcintn | MCWRONLY |
Flag indicating open the file write only. |
Platform Note: The print() set of functions ensure that new-lines are output as CR-NL on platforms where this is the normal line ending (e.g. WIN32 platforms).
|
Enumeration indicating how the seek() method should operate.
|
|
Standard file handles.
|
|
Default constructor. Calls to open() on files created in this way will throw an exception. |
|
Construct a file which represents one of the standard files. Calls to open() on files created in this way will throw an exception.
|
|
Construct a file which represents a file in the filesystem. Construction does not create the file or access the filesystem.
|
|
Destructor. If the file is open (and does not represent a standard file - stdin, stdout, stderr) it is closed. |
|
Check to see if the file refers to a standard file handle.
|
|
Open the file.
|
|
Write formatted output to the file in the style of printf(). A new-line is added at the end of the output if one is missing. An exception is thrown if the output fails.
|
|
Write formatted output to the file in the style of printf(). An exception is thrown if the output fails.
|
|
Position within the file. An exception is thrown if the seek fails (e.g. because the file is not open).
|
|
Block until the file's contents are physically on the disk. If pending writes have been buffered they will be synchronized to the disk. |
|
Write formatted output to the file in the style of vprintf(). A new-line is added at the end of the output if one is missing. An exception is thrown if the output fails.
|
|
vprintf to the file. An exception is thrown if the output fails. Write formatted output to the file in the style of vprintf(). An exception is thrown if the output fails.
|
|
Flag indicating open the file for append. The file is opened read/write and positioned at the end. Use in the open() method. |
|
Flag indicating that the file should be created if it doesn't exist. Use in the open() method. |
|
Convenience to open a file read-write, creating if necessary. Equivalent to MCRDWR | MCCREATE |
|
Flag indicating to create the file is necessary and erase any existing content (truncate). Equivalent to MCMAKE | MCTRUNC |
|
Flag indicating open the file read only. Use in the open() method |
|
Flag indicating open the file for reading and writing. This is the same as MCRDONLY | MCWRONLY. Use in the open() method |
|
Flag indicating that writes block until the data is physically on disk. Use in the open() method |
|
Flag indicating that the file should be truncated (emptied). Use in the open() method |
|
Flag indicating open the file write only. Use in the open() method |