xoreos
0.0.5
|
Generic interface for a writable data stream. More...
#include <writestream.h>
Public Member Functions | |
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... | |
Generic interface for a writable data stream.
Definition at line 64 of file writestream.h.
Common::WriteStream::WriteStream | ( | ) |
Definition at line 59 of file writestream.cpp.
|
virtual |
Definition at line 62 of file writestream.cpp.
References flush().
|
virtual |
Commit any buffered data to the underlying channel or storage medium; unbuffered streams can use the default implementation.
When flushing fails, a kWriteError exception is thrown.
Reimplemented in Common::WriteFile.
Definition at line 69 of file writestream.cpp.
Referenced by Graphics::dumpTGA(), Common::FoxPro::save(), Common::ConfigFile::save(), Aurora::TwoDAFile::writeASCII(), Aurora::TwoDAFile::writeCSV(), and ~WriteStream().
|
pure virtual |
Write data into the stream.
Subclasses must implement this method; all other write methods are implemented using it.
dataPtr | pointer to the data to be written. |
dataSize | number of bytes to be written. |
Implemented in Common::MemoryWriteStreamDynamic, Common::MemoryWriteStream, and Common::WriteFile.
Referenced by Aurora::ERFWriter::add(), Aurora::compress10(), Common::FoxPro::saveFields(), Common::FoxPro::saveMemos(), Common::FoxPro::saveRecords(), Aurora::GFF3Writer::write(), writeByte(), writeBytes(), Aurora::LocString::writeLocString(), writeSByte(), writeStream(), writeString(), writeUint16BE(), writeUint16LE(), writeUint32BE(), writeUint32LE(), writeUint64BE(), and writeUint64LE().
|
inline |
Definition at line 88 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Aurora::decompress10(), Aurora::PEFile::getResource(), Graphics::openTGA(), Aurora::LanguageManager::preParseColorCodes(), Engines::ConsoleWindow::printLine(), Common::ConfigFile::save(), Common::FoxPro::saveFields(), Common::FoxPro::saveHeader(), Common::FoxPro::saveRecords(), Aurora::GFF3Writer::write(), Aurora::TwoDAFile::writeASCII(), Aurora::TwoDAFile::writeBinary(), Graphics::writeBMP(), Aurora::TwoDAFile::writeCSV(), Aurora::NSBTXFile::writeITEXHeader(), Aurora::LocString::writeLocString(), Aurora::SSFFile::writeNWN(), Graphics::writePixel(), Aurora::NSBTXFile::writePixel(), and Common::writeStringFixed().
|
inline |
Write n bytes of value to the stream.
Definition at line 135 of file writestream.h.
References Common::kWriteError, and write().
Referenced by writeZeros().
|
inline |
Definition at line 183 of file writestream.h.
References convertIEEEDouble(), and writeUint64BE().
|
inline |
Definition at line 179 of file writestream.h.
References convertIEEEDouble(), and writeUint64LE().
Referenced by Aurora::GFF3Writer::write().
|
inline |
Definition at line 175 of file writestream.h.
References convertIEEEFloat(), and writeUint32BE().
|
inline |
Definition at line 171 of file writestream.h.
References convertIEEEFloat(), and writeUint32LE().
Referenced by Aurora::GFF3Writer::write().
|
inline |
Definition at line 93 of file writestream.h.
References Common::kWriteError, and write().
|
inline |
Definition at line 159 of file writestream.h.
References writeUint16BE().
|
inline |
Definition at line 147 of file writestream.h.
References writeUint16LE().
|
inline |
Definition at line 163 of file writestream.h.
References writeUint32BE().
|
inline |
Definition at line 151 of file writestream.h.
References writeUint32LE().
Referenced by Aurora::GFF3Writer::write().
|
inline |
Definition at line 167 of file writestream.h.
References writeUint64BE().
|
inline |
Definition at line 155 of file writestream.h.
References writeUint64LE().
Referenced by Aurora::GFF3Writer::write().
size_t Common::WriteStream::writeStream | ( | ReadStream & | stream, |
size_t | n | ||
) |
Copy n bytes of the given stream into the stream.
Even if less bytes than requested could be written to the stream, all requested bytes will always be read from the input stream.
stream | The stream to read from. |
n | The number of bytes to read from the stream. |
Definition at line 72 of file writestream.cpp.
References Common::ReadStream::eos(), Common::ReadStream::read(), and write().
Referenced by Aurora::TheWitcherSaveWriter::add(), Aurora::ERFWriter::add(), Aurora::compress00(), Aurora::decompress00(), Engines::dumpStream(), Aurora::PEFile::getResource(), writeStream(), Common::writeString(), and Common::writeStringFixed().
size_t Common::WriteStream::writeStream | ( | ReadStream & | stream | ) |
Copy the complete contents of the given stream.
Even if less bytes than are available in the input stream can be written to this stream, the input stream will always be exhausted to completion.
stream | The stream to read from. |
Definition at line 90 of file writestream.cpp.
References writeStream().
void Common::WriteStream::writeString | ( | const UString & | str | ) |
Write the given string to the stream, encoded as UTF-8.
No terminating zero byte is written.
Definition at line 94 of file writestream.cpp.
References Common::UString::c_str(), Common::kWriteError, and write().
Referenced by Aurora::ResourceManager::dumpResourcesList(), Common::DebugManager::logString(), Aurora::LanguageManager::preParseColorCodes(), Engines::ConsoleWindow::printLine(), Common::ConfigFile::save(), Aurora::GFF3Writer::write(), Aurora::TwoDAFile::writeASCII(), Aurora::TwoDAFile::writeBinary(), Aurora::TwoDAFile::writeCSV(), Aurora::SSFFile::writeKotOR(), Aurora::SSFFile::writeNWN(), and Aurora::SSFFile::writeNWN2().
|
inline |
Definition at line 116 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Common::FoxPro::saveMemos(), and writeSint16BE().
|
inline |
Definition at line 98 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Aurora::ERFWriter::add(), Aurora::PEFile::getResource(), Graphics::openTGA(), Common::FoxPro::saveHeader(), Aurora::TwoDAFile::writeBinary(), Graphics::writeBMP(), and writeSint16LE().
|
inline |
Definition at line 122 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Aurora::ERFWriter::ERFWriter(), Common::FoxPro::saveMemos(), Aurora::TheWitcherSaveWriter::TheWitcherSaveWriter(), Aurora::GFF3Writer::write(), writeIEEEFloatBE(), Aurora::NSBTXFile::writeITEXHeader(), and writeSint32BE().
|
inline |
Definition at line 104 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Aurora::ERFWriter::add(), Aurora::ERFWriter::ERFWriter(), Aurora::TheWitcherSaveWriter::finish(), Aurora::PEFile::getResource(), Graphics::openTGA(), Common::FoxPro::saveFields(), Common::FoxPro::saveHeader(), Aurora::TheWitcherSaveWriter::TheWitcherSaveWriter(), Aurora::GFF3Writer::write(), Aurora::TwoDAFile::writeBinary(), Graphics::writeBMP(), writeIEEEFloatLE(), Aurora::NSBTXFile::writeITEXHeader(), Aurora::SSFFile::writeKotOR(), Aurora::LocString::writeLocString(), Aurora::SSFFile::writeNWN(), writeSint32LE(), and Aurora::writeSmallHeader().
|
inline |
Definition at line 128 of file writestream.h.
References Common::kWriteError, and write().
Referenced by writeIEEEDoubleBE(), and writeSint64BE().
|
inline |
Definition at line 110 of file writestream.h.
References Common::kWriteError, and write().
Referenced by Aurora::TheWitcherSaveWriter::TheWitcherSaveWriter(), Aurora::GFF3Writer::write(), writeIEEEDoubleLE(), and writeSint64LE().
|
inline |
Write n zeros to the stream.
Definition at line 143 of file writestream.h.
References writeBytes().
Referenced by Aurora::ERFWriter::add(), Aurora::ERFWriter::ERFWriter(), Aurora::TheWitcherSaveWriter::TheWitcherSaveWriter(), and Aurora::GFF3Writer::write().