|
jaffarCommon
|
#include <file.hpp>
Public Member Functions | |
| MemoryFile (const MemoryFile &)=delete | |
| void | operator= (const MemoryFile &)=delete |
| ~MemoryFile () | |
| __JAFFAR_COMMON__INLINE__ void | setReadOnly () |
| __JAFFAR_COMMON__INLINE__ void | unsetReadOnly () |
| __JAFFAR_COMMON__INLINE__ void | setWriteOnly () |
| __JAFFAR_COMMON__INLINE__ void | unsetWriteOnly () |
| __JAFFAR_COMMON__INLINE__ void | setOpened () |
| __JAFFAR_COMMON__INLINE__ void | unsetOpened () |
| __JAFFAR_COMMON__INLINE__ bool | isReadOnly () const |
| __JAFFAR_COMMON__INLINE__ bool | isWriteOnly () const |
| __JAFFAR_COMMON__INLINE__ bool | isOpened () const |
| __JAFFAR_COMMON__INLINE__ void | setWriteCallback (const std::function< void(const int64_t, MemoryFile *)> callback) |
| __JAFFAR_COMMON__INLINE__ void | setReadCallback (const std::function< void(const int64_t, MemoryFile *)> callback) |
| __JAFFAR_COMMON__INLINE__ void | unsetWriteCallback () |
| __JAFFAR_COMMON__INLINE__ void | unsetReadCallback () |
| __JAFFAR_COMMON__INLINE__ int | resize (const size_t newSize) |
| __JAFFAR_COMMON__INLINE__ void | setSize (const size_t size) |
| __JAFFAR_COMMON__INLINE__ size_t | getSize () const |
Static Public Member Functions | |
| static __JAFFAR_COMMON__INLINE__ int64_t | fread (void *const buffer, const size_t size, const size_t count, MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ int64_t | fwrite (const void *buffer, const size_t size, const size_t count, MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ int64_t | ftello64 (MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ int64_t | ftell (MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ void | rewind (MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ int | fflush (MemoryFile *file) |
| static __JAFFAR_COMMON__INLINE__ int | fseeko64 (MemoryFile *const file, const int64_t offset, const int origin) |
| static __JAFFAR_COMMON__INLINE__ int | fseek (MemoryFile *const file, const int64_t offset, const int origin) |
| static __JAFFAR_COMMON__INLINE__ int | feof (MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ void | clearerr (MemoryFile *const file) |
| static __JAFFAR_COMMON__INLINE__ int | ferror (MemoryFile *const file) |
Friends | |
| class | MemoryFileDirectory |
Represents a file object that exists entirely in memory. It exposes a C-like interface for light refactoring of programs that depend on accessing the filesystem directly
|
inline |
Destructor for the memory file class. it frees the buffer created at allocation time
|
inlinestatic |
Clears the error code(s)
| [in] | file | The file to clear errors for |
|
inlinestatic |
Indicates whether we've reached the end of file
| [in] | file | The file to inquire for end of file |
|
inlinestatic |
Returns the value of the internal error value corresponding to the last operation
| [in] | file | The file to check errors for |
|
inlinestatic |
Ensures the write operations have finished. No effect for mem buffers as all operations finish within their call.
| [in] | file | The file to flush |
|
inlinestatic |
Reads from the mem file into a buffer.
Reading advances the internal head for as many bytes as size*count, until the end of file.
| [in] | buffer | The buffer onto which to copy the data |
| [in] | size | The size of each element to copy |
| [in] | count | The number of elements to copy |
| [in] | file | The memory file from which to read |
|
inlinestatic |
Ensures the write operations have finished. No effect for mem buffers as all operations finish within their call.
| [in] | file | The file whose head to move |
| [in] | offset | The number of bytes to move the internal head |
| [in] | origin | The point relative to which we apply the offset |
|
inlinestatic |
(mirror for fseek - has no different effect or interface) Ensures the write operations have finished. No effect for mem buffers as all operations finish within their call.
| [in] | file | The file whose head to move |
| [in] | offset | The number of bytes to move the internal head |
| [in] | origin | The point relative to which we apply the offset |
|
inlinestatic |
Returns the internal position of the file's head
| [in] | file | The file to evaluate |
|
inlinestatic |
(mirror for ftell - has no different effect or interface) Returns the internal position of the file's head
| [in] | file | The file to evaluate |
|
inlinestatic |
Writes into the mem file from a buffer
Writing advances the internal head for as many bytes as size*count, until the end of file.
| [in] | buffer | The buffer from which to read the data |
| [in] | size | The size of each element to copy |
| [in] | count | The number of elements to copy |
| [in] | file | The memory file to write into |
|
inline |
Function to get file size directly
|
inline |
Gets the opened flag from the file
|
inline |
Gets the read-only flag from the file
|
inline |
Gets the write-only flag from the file
|
inline |
Function to resize file It fills with zeroes any additional bytes allocated In case of shrinking, this operation keeps the internal buffer unchanged (no freed space).
| [in] | newSize | The new desired size for the file |
|
inlinestatic |
Resets the internal position of the file's head to the start of the file
| [in] | file | The file to rewind |
|
inline |
Sets the opened flag in the file
|
inline |
Sets a callback that will be called when a read is made
| [in] | callback | Read-callback to set |
|
inline |
Sets the read only flag in the file
|
inline |
Function to set size directly without resizing internal buffer – use at your own risk.
| [in] | size | The internal size to set |
|
inline |
Sets a callback that will be called when a write is made
| [in] | callback | Write-callback to set |
|
inline |
Sets the write only flag in the file
|
inline |
Clears the opened flag from the file
|
inline |
Function to unset the read callback
|
inline |
Clears the read only flag from the file
|
inline |
Function to unset the write callback
|
inline |
Clears the read only flag from the file