xoreos
0.0.5
|
#include <writestream.h>
Public Types | |
enum | Origin { kOriginBegin = 0, kOriginCurrent = 1, kOriginEnd = 2, kOriginMAX } |
The position a seeking offset takes as a base. More... | |
Public Member Functions | |
SeekableWriteStream () | |
~SeekableWriteStream () | |
virtual size_t | pos () const =0 |
Obtains the current value of the stream position indicator of the stream. More... | |
virtual size_t | size () const =0 |
Obtains the total size of the stream, measured in bytes. More... | |
virtual size_t | seek (ptrdiff_t offset, Origin whence=kOriginBegin)=0 |
Sets the stream position indicator for the stream. More... | |
virtual size_t | skip (ptrdiff_t offset) |
Skip the specified number of bytes, adding that offset to the current position in the stream. More... | |
Public Member Functions inherited from Common::WriteStream | |
WriteStream () | |
virtual | ~WriteStream () |
virtual size_t | write (const void *dataPtr, size_t dataSize)=0 |
Write data into the stream. More... | |
virtual void | flush () |
Commit any buffered data to the underlying channel or storage medium; unbuffered streams can use the default implementation. More... | |
void | writeByte (byte value) |
void | writeSByte (int8 value) |
void | writeUint16LE (uint16 value) |
void | writeUint32LE (uint32 value) |
void | writeUint64LE (uint64 value) |
void | writeUint16BE (uint16 value) |
void | writeUint32BE (uint32 value) |
void | writeUint64BE (uint64 value) |
void | writeBytes (byte value, size_t n) |
Write n bytes of value to the stream. More... | |
FORCEINLINE void | writeZeros (size_t n) |
Write n zeros to the stream. More... | |
FORCEINLINE void | writeSint16LE (int16 value) |
FORCEINLINE void | writeSint32LE (int32 value) |
FORCEINLINE void | writeSint64LE (int64 value) |
FORCEINLINE void | writeSint16BE (int16 value) |
FORCEINLINE void | writeSint32BE (int32 value) |
FORCEINLINE void | writeSint64BE (int64 value) |
FORCEINLINE void | writeIEEEFloatLE (float value) |
FORCEINLINE void | writeIEEEFloatBE (float value) |
FORCEINLINE void | writeIEEEDoubleLE (double value) |
FORCEINLINE void | writeIEEEDoubleBE (double value) |
size_t | writeStream (ReadStream &stream, size_t n) |
Copy n bytes of the given stream into the stream. More... | |
size_t | writeStream (ReadStream &stream) |
Copy the complete contents of the given stream. More... | |
void | writeString (const UString &str) |
Write the given string to the stream, encoded as UTF-8. More... | |
Static Public Member Functions | |
static size_t | evalSeek (ptrdiff_t offset, Origin whence, size_t pos, size_t begin, size_t size) |
Evaluate the seek offset relative to whence into a position from the beginning. More... | |
Definition at line 215 of file writestream.h.
The position a seeking offset takes as a base.
Enumerator | |
---|---|
kOriginBegin | Seek from the begin of the stream. |
kOriginCurrent | Seek from the current position of the stream. |
kOriginEnd | Seek from the end of the stream. |
kOriginMAX | For range checks. |
Definition at line 218 of file writestream.h.
Common::SeekableWriteStream::SeekableWriteStream | ( | ) |
Definition at line 99 of file writestream.cpp.
Common::SeekableWriteStream::~SeekableWriteStream | ( | ) |
Definition at line 103 of file writestream.cpp.
|
static |
Evaluate the seek offset relative to whence into a position from the beginning.
Definition at line 107 of file writestream.cpp.
References kOriginBegin, kOriginCurrent, kOriginEnd, pos(), size(), and XOREOS_FALLTHROUGH.
Referenced by Common::WriteFile::seek(), Common::MemoryWriteStream::seek(), and Common::MemoryWriteStreamDynamic::seek().
|
pure virtual |
Obtains the current value of the stream position indicator of the stream.
Implemented in Common::MemoryWriteStreamDynamic, Common::MemoryWriteStream, and Common::WriteFile.
Referenced by Aurora::TheWitcherSaveWriter::add(), evalSeek(), and Aurora::TheWitcherSaveWriter::finish().
|
pure virtual |
Sets the stream position indicator for the stream.
The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to kOriginBegin, kOriginCurrent, or kOriginEnd, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively.
On error, or when trying to seek outside the stream, a kSeekError exception is thrown.
offset | the relative offset in bytes. |
whence | the seek reference: kOriginBegin, kOriginCurrent or kOriginEnd. |
Implemented in Common::MemoryWriteStreamDynamic, Common::MemoryWriteStream, and Common::WriteFile.
Referenced by Aurora::ERFWriter::add(), and skip().
|
pure virtual |
Obtains the total size of the stream, measured in bytes.
If this value is unknown or can not be computed, kSizeInvalid is returned.
Implemented in Common::MemoryWriteStreamDynamic, Common::MemoryWriteStream, and Common::WriteFile.
Referenced by evalSeek().
|
inlinevirtual |
Skip the specified number of bytes, adding that offset to the current position in the stream.
On error, or when trying to skip outside the stream, a kSeekError exception is thrown.
offset | the number of bytes to skip. |
Definition at line 265 of file writestream.h.
References kOriginCurrent, and seek().