|
template<class type > |
bool | ReadFile (File &f, type &t) |
|
template<class type > |
bool | WriteFile (File &f, const type &t) |
|
template<class type > |
bool | ReadArrayFile (File &f, type *t, int n) |
|
template<class type > |
bool | WriteArrayFile (File &f, const type *t, int n) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (bool) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (char) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (signed char) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (unsigned char) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (short) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (int) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (long) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (unsigned long long) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (float) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (double) |
|
| _DECLARE_READ_WRITE_FILE_BASIC (long double) |
|
A unified interface for reading/writing binary data to file.
A consistent interface for reading/writing data is given by the template methods ReadFile() and WriteFile(). A class can be read/written to file in two ways: 1) Read/WriteFile() can be overloaded to read/write the data directly, or 2) use the default Read/WriteFile(), but define the following methods in the class:
For structs of contiguous data, the macro _DEFINE_READ_WRITE_FILE_BASIC(T) will overload the the Read/WriteFile functions to automatically read the data from file contiguously for objects of type T.