System file reference class. More...
Public Types | |
enum | eFileAccess { kReadOnly , kWriteOnly , kAppend , kReadWrite } |
Enumeration to open a file. More... | |
Public Member Functions | |
File () noexcept | |
Create a File class. | |
File (const char *pFileName, eFileAccess uAccess=kReadOnly) noexcept | |
Create a File class with a file. | |
File (Filename *pFileName, eFileAccess uAccess=kReadOnly) noexcept | |
Create a File class with a Filename. | |
~File () | |
Close any open file. | |
Filename * | get_filename (void) noexcept |
Return Filename object. | |
void * | get_file_pointer (void) const noexcept |
Return the native file reference. | |
void | set_file_pointer (void *pFile) noexcept |
Set the native file reference. | |
uint_t | is_opened (void) const noexcept |
Return TRUE if a file is open. | |
eError | open (const char *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Open a file using a Burgerlib pathname. | |
eError | open (Filename *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Open a file using a Filename. | |
eError | open_async (const char *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Open a file asynchronously. | |
eError | open_async (Filename *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Open a file asynchronously. | |
eError | close (void) noexcept |
Close open file. | |
eError | close_async (void) noexcept |
Close open file asynchronously. | |
uint64_t | get_file_size (void) noexcept |
Return the size of a file in bytes. | |
uintptr_t | read (void *pOutput, uintptr_t uSize) noexcept |
Read data from an open file. | |
eError | read_async (void *pOutput, uintptr_t uSize) noexcept |
Read open file asynchronously. | |
uintptr_t | write (const void *pInput, uintptr_t uSize) noexcept |
Write data into an open file. | |
uint64_t | get_mark (void) noexcept |
Get the current file mark. | |
eError | set_mark (uint64_t uMark) noexcept |
Set the current file mark. | |
eError | set_mark_at_EOF (void) noexcept |
Set the current file mark at the end of the file. | |
eError | get_modification_time (TimeDate_t *pOutput) noexcept |
Get the time the file was last modified. | |
eError | get_creation_time (TimeDate_t *pOutput) noexcept |
Get the time the file was created. | |
eError | set_modification_time (const TimeDate_t *pInput) noexcept |
Set the time the file was last modified. | |
eError | set_creation_time (const TimeDate_t *pInput) noexcept |
Set the time the file was created. | |
eError | set_creator_type (uint32_t uCreatorType) noexcept |
Set the file's auxiliary type. | |
eError | set_file_type (uint32_t uFileType) noexcept |
Set the file's type code. | |
uint32_t | get_creator_type (void) noexcept |
Get the file's auxiliary type. | |
uint32_t | get_file_type (void) noexcept |
Get the file's type code. | |
eError | set_creator_and_file_type (uint32_t uCreatorType, uint32_t uFileType) noexcept |
Set the file's auxiliary and file type. | |
eError | read_c_string (char *pOutput, uintptr_t uLength) noexcept |
Read a "C" string with the terminating zero to a file stream. | |
uint32_t | read_big_uint32 (void) noexcept |
Read a big endian 32-bit value from a file. | |
uint16_t | read_big_uint16 (void) noexcept |
Read a big endian 16-bit value from a file. | |
uint32_t | read_little_uint32 (void) noexcept |
Read a little endian 32-bit value from a file. | |
uint16_t | read_little_uint16 (void) noexcept |
Read a little endian 16-bit value from a file. | |
Static Public Member Functions | |
static File * | New (const char *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Create a new File instance. | |
static File * | New (Filename *pFileName, eFileAccess uAccess=kReadOnly) noexcept |
Create a new File instance. | |
Protected Attributes | |
void * | m_pFile |
Open file reference. | |
Filename | m_Filename |
Name of the file that was opened. | |
uint_t | m_bUsingFSRef |
True if using MacOS 9 or higher APIs (MacOS Only) | |
Private Member Functions | |
File (const File &)=delete | |
File & | operator= (const File &)=delete |
File (File &&)=delete | |
File & | operator= (File &&)=delete |
System file reference class.
A functional equivalent to FILE *, except files are all considered binary and pathnames are only Burgerlib format.
Enumeration to open a file.
Used by open(const char*, eFileAccess) to determine the method of opening a file.
|
privatedelete |
|
privatedelete |
|
noexcept |
|
noexcept |
Create a File class with a file.
Open a file and initialize the variables. If the file open operation fails, all file access functions will fail until a new file is opened.
Use is_opened() const to test if the file successfully opened.
pFileName | Pointer to a "C" string containing a Burgerlib pathname |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Create a File class with a Filename.
Open a file and initialize the variables. If the file open operation fails, all file access functions will fail until a new file is opened.
Use is_opened() const to test if the file successfully opened.
pFileName | Pointer to a Filename object |
uAccess | Enumeration on permissions requested on the opened file |
Burger::File::~File | ( | ) |
|
noexcept |
Close open file.
Close previously opened file. If there was no open file, this function performs no operation and returns kErrorNone
|
noexcept |
Close open file asynchronously.
Queue up a close file event, if needed.
|
noexcept |
Get the time the file was created.
If a file is open, query the operating system for the time the file was created.
pOutput | Pointer to a TimeDate_t to receive the file creation time |
|
noexcept |
Get the file's auxiliary type.
If a file is open, call the MacOS operating system to get the file's auxiliary type.
The file's auxiliary type is usually set to the application ID code.
|
inlinenoexcept |
Return the native file reference.
If a file was opened, the underlying operating system will create a file reference and it is stored within the File object.
|
noexcept |
Return the size of a file in bytes.
If a file is open, query the operating system for the size of the file in bytes.
|
noexcept |
Get the file's type code.
If a file is open, call the MacOS operating system to get the file's type code.
|
inlinenoexcept |
Return Filename object.
If a file was opened, the filename is cached in the File object. This call will return a pointer to that cached filename.
|
noexcept |
Get the current file mark.
If a file is open, query the operating system for the location of the file mark for future reads or writes.
|
noexcept |
Get the time the file was last modified.
If a file is open, query the operating system for the last time the file was modified.
pOutput | Pointer to a TimeDate_t to receive the file modification time |
|
inlinenoexcept |
|
staticnoexcept |
Create a new File instance.
Allocate memory using Burger::Alloc() and initialize a File with it.
pFileName | Pointer to a "C" string containing a Burgerlib pathname |
uAccess | Enumeration on permissions requested on the opened file |
|
staticnoexcept |
Create a new File instance.
Allocate memory using Burger::Alloc() and initialize a File with it.
pFileName | Pointer to a Burger::Filename object |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Open a file using a Burgerlib pathname.
Close any previously opened file and open a new file.
pFileName | Pointer to a "C" string containing a Burgerlib pathname |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Open a file using a Filename.
Close any previously opened file and open a new file.
pFileName | Pointer to a Filename object |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Open a file asynchronously.
Create an event in the FileManager queue to open this file.
pFileName | Pointer to a "C" string containing a Burgerlib pathname |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Open a file asynchronously.
Create an event in the FileManager queue to open this file.
pFileName | Pointer to a Filename object |
uAccess | Enumeration on permissions requested on the opened file |
|
noexcept |
Read data from an open file.
If a file is open, perform a read operation. This function will fail if the file was not opened for read access.
pOutput | Pointer to a buffer of data to read from a file |
uSize | Number of bytes to read |
|
noexcept |
Read open file asynchronously.
Queue up a read file event.
pOutput | Pointer to buffer to receive the data. |
uSize | Size in byte of the read operation. |
|
noexcept |
Read a big endian 16-bit value from a file.
Given a file opened for reading, read a 16-bit value in big endian format from the file stream.
|
noexcept |
Read a big endian 32-bit value from a file.
Given a file opened for reading, read a 32-bit value in big endian format from the file stream.
|
noexcept |
Read a "C" string with the terminating zero to a file stream.
Read a "C" string with a terminating zero from the file stream. If the string read is larger than the buffer, it is truncated. The buffer will have an ending zero on valid read or a trucated read. If uLength was zero, then pInput can be nullptr
pOutput | Pointer to a "C" string to write. |
uLength | Size of the buffer (To prevent overruns) |
|
noexcept |
Read a little endian 16-bit value from a file.
Given a file opened for reading, read a 16-bit value in little endian format from the file stream.
|
noexcept |
Read a little endian 32-bit value from a file.
Given a file opened for reading, read a 32-bit value in little endian format from the file stream.
|
noexcept |
Set the time the file was created.
If a file is open, call the operating system to set the file creation time to the passed value.
pInput | Pointer to a TimeDate_t to use for the new file creation time |
|
noexcept |
Set the file's auxiliary and file type.
If a file is open, call the MacOS operating system to set the file's auxiliary and file types to the passed values.
The file's auxiliary type is usually set to the application ID code.
uCreatorType | Value to set the file's auxiliary type |
uFileType | Value to set the file's type |
|
noexcept |
Set the file's auxiliary type.
If a file is open, call the MacOS operating system to set the file's auxiliary type to the passed value.
The file's auxiliary type is usually set to the application ID code.
uCreatorType | Value to set the file's creator type |
|
inlinenoexcept |
Set the native file reference.
If using platform specific code to open a file using special privileges beyond the Burgerlib API, this call will allow code to manually set the file reference.
pFile | Native file reference. |
|
noexcept |
Set the file's type code.
If a file is open, call the MacOS operating system to set the file's type to the passed value.
uFileType | Value to set the file's type |
|
noexcept |
Set the current file mark.
If a file is open, set the read/write mark at the location passed.
uMark | Value to set the new file mark to. |
|
noexcept |
Set the current file mark at the end of the file.
If a file is open, set the read/write mark to the end of the file.
|
noexcept |
Set the time the file was last modified.
If a file is open, call the operating system to set the file modification time to the passed value.
pInput | Pointer to a TimeDate_t to use for the new file modification time |
|
noexcept |
Write data into an open file.
If a file is open, perform a write operation. This function will fail if the file was not opened for write access.
pInput | Pointer to a buffer of data to write to a file |
uSize | Number of bytes to write |
|
protected |
Name of the file that was opened.
|
protected |
Open file reference.