Isle
|
Abstract base class providing an interface for file-like storage with binary and text read/write operations. More...
#include <legostorage.h>
Public Types | |
enum | OpenFlags { c_read = 1 , c_write = 2 , c_text = 4 } |
File open mode flags for storage operations. More... | |
Public Member Functions | |
LegoStorage () | |
Default constructor initializing mode to zero. More... | |
virtual | ~LegoStorage () |
Virtual destructor for safe polymorphic destruction. More... | |
virtual LegoResult | Read (void *p_buffer, LegoU32 p_size)=0 |
Read bytes from storage into buffer. More... | |
virtual LegoResult | Write (const void *p_buffer, LegoU32 p_size)=0 |
Write bytes from buffer into storage. More... | |
virtual LegoResult | GetPosition (LegoU32 &p_position)=0 |
Get current read/write position in stream. More... | |
virtual LegoResult | SetPosition (LegoU32 p_position)=0 |
Set current read/write position in stream. More... | |
virtual LegoBool | IsWriteMode () |
Returns TRUE if object was opened in write mode. More... | |
virtual LegoBool | IsReadMode () |
Returns TRUE if object was opened in read mode. More... | |
LegoStorage * | WriteString (const char *p_data) |
Writes a length-prefixed string to storage. More... | |
LegoStorage * | WriteU8 (LegoU8 p_data) |
Writes an 8-bit unsigned value to storage. More... | |
LegoStorage * | WriteS16 (LegoS16 p_data) |
Writes a 16-bit signed value to storage. More... | |
LegoStorage * | WriteU16 (LegoU16 p_data) |
Writes a 16-bit unsigned value to storage. More... | |
LegoStorage * | WriteS32 (MxS32 p_data) |
Writes a 32-bit signed value to storage. More... | |
LegoStorage * | WriteU32 (MxU32 p_data) |
Writes a 32-bit unsigned value to storage. More... | |
LegoStorage * | WriteFloat (LegoFloat p_data) |
Writes a floating-point (single-precision) value to storage. More... | |
LegoStorage * | WriteVector (Mx3DPointFloat p_data) |
Writes a 3D vector (three floats) to storage. More... | |
LegoStorage * | WriteMxString (MxString p_data) |
Writes a length-prefixed MxString to storage. More... | |
LegoStorage * | ReadString (char *p_data) |
Reads a length-prefixed string from storage. More... | |
LegoStorage * | ReadU8 (LegoU8 &p_data) |
Reads an 8-bit unsigned value from storage. More... | |
LegoStorage * | ReadS16 (LegoS16 &p_data) |
Reads a 16-bit signed value from storage. More... | |
LegoStorage * | ReadU16 (LegoU16 &p_data) |
Reads a 16-bit unsigned value from storage. More... | |
LegoStorage * | ReadS32 (MxS32 &p_data) |
Reads a 32-bit signed value from storage. More... | |
LegoStorage * | ReadU32 (MxU32 &p_data) |
Reads a 32-bit unsigned value from storage. More... | |
LegoStorage * | ReadFloat (LegoFloat &p_data) |
Reads a floating-point (single-precision) value from storage. More... | |
LegoStorage * | ReadVector (Mx3DPointFloat &p_data) |
Reads a 3D vector (three floats) from storage. More... | |
LegoStorage * | ReadMxString (MxString &p_data) |
Reads a length-prefixed string and stores it in an MxString object. More... | |
Protected Attributes | |
LegoU8 | m_mode |
File open/access mode. More... | |
Abstract base class providing an interface for file-like storage with binary and text read/write operations.
[AI]
Used as a polymorphic abstraction over file-backed and memory-backed streams for reading and writing primary built-in data types (strings, numbers, vectors) in LEGO Island. [AI]
Definition at line 16 of file legostorage.h.
File open mode flags for storage operations.
[AI]
c_read = Open for reading, c_write = Open for writing, c_text = Open as text file (else binary). [AI]
Enumerator | |
---|---|
c_read | Open for read operations. [AI]. |
c_write | Open for write operations. [AI]. |
c_text | Open in text mode, otherwise binary. [AI]. |
Definition at line 22 of file legostorage.h.
|
inline |
|
inlinevirtual |
Virtual destructor for safe polymorphic destruction.
[AI]
Definition at line 36 of file legostorage.h.
|
pure virtual |
Get current read/write position in stream.
[AI]
p_position | Reference to receive current position [AI] |
Implemented in LegoMemory, and LegoFile.
|
inlinevirtual |
Returns TRUE if object was opened in read mode.
[AI]
Definition at line 78 of file legostorage.h.
|
inlinevirtual |
Returns TRUE if object was opened in write mode.
[AI]
Definition at line 72 of file legostorage.h.
|
pure virtual |
Read bytes from storage into buffer.
[AI]
p_buffer | Destination buffer [AI] |
p_size | Number of bytes to read [AI] |
Implemented in LegoMemory, and LegoFile.
|
inline |
Reads a floating-point (single-precision) value from storage.
[AI]
p_data | Output variable to receive value [AI] |
Definition at line 263 of file legostorage.h.
|
inline |
Reads a length-prefixed string and stores it in an MxString object.
[AI]
p_data | Output MxString to hold the read text [AI] |
Definition at line 287 of file legostorage.h.
|
inline |
Reads a 16-bit signed value from storage.
[AI]
p_data | Output variable to receive value [AI] |
Definition at line 217 of file legostorage.h.
|
inline |
Reads a 32-bit signed value from storage.
[AI]
p_data | Output variable to receive value [AI] |
[AI] Note: Parameter type may be incompatible with LegoS32.
Definition at line 240 of file legostorage.h.
|
inline |
Reads a length-prefixed string from storage.
[AI]
Reads string length, then chars (not null terminated), then writes '\0' at end. [AI]
p_data | Output character buffer (must be large enough for string + null terminator). [AI] |
Definition at line 192 of file legostorage.h.
|
inline |
Reads a 16-bit unsigned value from storage.
[AI]
p_data | Output variable to receive value [AI] |
Definition at line 228 of file legostorage.h.
|
inline |
Reads a 32-bit unsigned value from storage.
[AI]
p_data | Output variable to receive value [AI] |
[AI] Note: Parameter type may be incompatible with LegoU32.
Definition at line 252 of file legostorage.h.
|
inline |
Reads an 8-bit unsigned value from storage.
[AI]
p_data | Output variable to receive value [AI] |
Definition at line 206 of file legostorage.h.
|
inline |
Reads a 3D vector (three floats) from storage.
[AI]
p_data | Output variable to receive vector [AI] |
Definition at line 274 of file legostorage.h.
|
pure virtual |
Set current read/write position in stream.
[AI]
p_position | New position to set [AI] |
Implemented in LegoMemory, and LegoFile.
|
pure virtual |
Write bytes from buffer into storage.
[AI]
p_buffer | Source buffer [AI] |
p_size | Number of bytes to write [AI] |
Implemented in LegoMemory, and LegoFile.
|
inline |
Writes a floating-point (single-precision) value to storage.
[AI]
p_data | Floating-point value to write [AI] |
Definition at line 156 of file legostorage.h.
|
inline |
Writes a length-prefixed MxString to storage.
[AI]
p_data | String to write [AI] |
Definition at line 180 of file legostorage.h.
|
inline |
Writes a 16-bit signed value to storage.
[AI]
p_data | Value to write [AI] |
Definition at line 110 of file legostorage.h.
|
inline |
Writes a 32-bit signed value to storage.
[AI]
p_data | Value to write [AI] |
[AI] Note: Parameter type may be incompatible with LegoS32.
Definition at line 133 of file legostorage.h.
|
inline |
Writes a length-prefixed string to storage.
[AI]
String is prefixed by a 16-bit length, then content without null terminator. [AI]
p_data | Null-terminated string to write [AI] |
Definition at line 86 of file legostorage.h.
|
inline |
Writes a 16-bit unsigned value to storage.
[AI]
p_data | Value to write [AI] |
Definition at line 121 of file legostorage.h.
|
inline |
Writes a 32-bit unsigned value to storage.
[AI]
p_data | Value to write [AI] |
[AI] Note: Parameter type may be incompatible with LegoU32.
Definition at line 145 of file legostorage.h.
|
inline |
Writes an 8-bit unsigned value to storage.
[AI]
p_data | Value to write [AI] |
Definition at line 99 of file legostorage.h.
|
inline |
Writes a 3D vector (three floats) to storage.
[AI]
p_data | Vector to write [AI] |
Definition at line 167 of file legostorage.h.
|
protected |