File Handle
// File handle.
class RVAPI File
{
public:
// Get size.
ulong GetSize() const;
// Get current file position.
ulong GetOffset() const;
// Read integer [value].
void ReadInt(int &value);
// Read float [value].
void ReadFloat(float &value);
// Read [value].
void ReadString(String &value);
// Write integer [value].
void WriteInt(int value);
// Write float [value].
void WriteFloat(float value);
// Write string [value].
void WriteString(wcstr value);
// Truncate file.
void Truncate();
// Set file position to [offset] bytes from start of file.
void SeekFromStart(slong offset);
// Set file position to [offset] bytes from current file postion.
void SeekFromCur(slong offset);
// Set file position to [offset] bytes from end of file.
void SeekFromEnd(slong offset);
// Open file at [path]. [mode] is stdio file mode string. Only binary supported.
void Open(wcstr path, wcstr mode);
// Close file.
void Close();
// Internal.
void *operator () () const { return (void *)wobj; }
// Construct and open file at [path]. [mode] is stdio file mode string. Only binary supported.
File(wcstr path, wcstr mode) : File() { Open(path, mode); }
// Constructor.
File();
// Destructor.
~File();
private:
byte wobj[64];
};