#include <basestreaminterface.h>
Inheritance diagram for tnstream:

Public Types | |
| enum | IOMode { uninitialized, reading, writing, appending } |
| the modes in which a stream can operate More... | |
Public Member Functions | |
| tnstream () | |
| virtual void | writedata (const void *buf, int size)=0 |
| writes data to the stream | |
| virtual int | readdata (void *buf, int size, bool excpt=true)=0 |
| Reads data from the stream. | |
| virtual void | readpchar (char **pc, int maxlength=0) |
| Reads a string. | |
| virtual void | readpnchar (char **pc, int maxlength=0) |
| Reads a string. | |
| virtual bool | readTextString (ASCString &s, bool includeCR=false) |
| Reads a string. | |
| virtual ASCString | readString (bool includeCR=false) |
| Reads and returns a string. | |
| virtual void | writepchar (const char *pc) |
| write the C-String pc to the stream | |
| virtual void | writeString (const string &pc, bool binary=true) |
| writes the C++ String pc to the stream. | |
| virtual int | readInt (void) |
| Reads a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is performed, if necessary. | |
| virtual int | readWord (void) |
| Reads a 16 bit unsigned Integer. In the stream little-endian byte order is used and a translation is performed, if necessary. | |
| virtual char | readChar (void) |
| Reads a 8 bit unsigned Integer. | |
| template<size_t N> | |
| void | writeBitset (const std::bitset< N > &bs) |
| template<size_t N> | |
| void | readBitset (std::bitset< N > &bs) |
| virtual float | readFloat (void) |
| Reads a flaot variable. | |
| virtual void | writeInt (int i) |
| Writes a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is performed, if necessary. | |
| virtual void | writeInt (unsigned int i) |
| void | writeInt (bool b) |
| virtual void | writeWord (int w) |
| Writes a 16 bit unsigned Integer. In the stream little-endian byte order is used and a translation is performed, if necessary. | |
| virtual void | writeChar (char c) |
| Writes a 8 bit unsigned Integer. | |
| virtual void | writeFloat (float f) |
| Write a floating point variable. | |
| virtual void | writerlepict (const void *buf) |
| Writes an image to the stream and compresses it using RLE. | |
| virtual void | writeImage (const void *buf, bool compress=true) |
| Writes an image to the stream. | |
| virtual void | readrlepict (void **pnter, bool allocated, int *size) |
| Writes an RLE compressed or uncompressed image from the stream. | |
| virtual ASCString | getDeviceName (void) |
| returns the name of the stream. | |
| virtual ASCString | getLocation (void) |
| returns the location of the stream. | |
| virtual void | seek (int newpos) |
| Sets the stream pointer to a new location. An exception is thrown if the stream does not support seeking. | |
| virtual int | getSize (void) |
| returns the size of the stream or -1 if the stream does not have a size | |
| virtual | ~tnstream () |
Protected Attributes | |
| ASCString | devicename |
Because ASC was originally written in Pascal, the streams don't have any relation to the C++ streams
Definition at line 36 of file basestreaminterface.h.
|
|
the modes in which a stream can operate
Definition at line 41 of file basestreaminterface.h. |
|
|
Definition at line 202 of file basestrm.cpp. |
|
|
Definition at line 188 of file basestreaminterface.h. |
|
|
|
returns the location of the stream. This may be a complete english sentence describing how the stream (usually a file) can be found. Should only be used for informing the user. Reimplemented in MemoryStreamCopy, and tn_c_lzw_filestream. Definition at line 282 of file basestrm.cpp. References devicename. Referenced by TextFormatParser::error(), PropertyWritingContainer::getLocation(), PropertyWritingContainer::PropertyWritingContainer(), Poly_gon::read(), ItemRepositoryLoader< T >::read(), BuildingType::read(), Research::read_struct(), readClassContainer(), readOldEventLists(), readSDLPixelFormat(), readString(), TextFormatParser::run(), and versionTest(). |
|
|
returns the size of the stream or -1 if the stream does not have a size
Reimplemented in MemoryStreamCopy, tn_c_lzw_filestream, and tn_file_buf_stream. Definition at line 186 of file basestreaminterface.h. |
|
||||||||||
|
Definition at line 126 of file basestreaminterface.h. References assert, N, readChar(), and readInt(). Referenced by ContainerBaseType::read(). |
|
|
Reads a 8 bit unsigned Integer.
Definition at line 301 of file basestrm.cpp. References readdata2. Referenced by checkFileLoadability(), Vehicle::newFromStream(), Building::newFromStream(), TerrainType::Weather::read(), TerrainType::MoveMalus::read(), tpcxheader::read(), GameMap::read(), BuildingType::read(), Research::read_struct(), readBitset(), tspfldloaders::readfields(), readLegacyNetworkData(), trunreplay::readnextaction(), readrlepict(), and trunreplay::run(). |
|
||||||||||||||||
|
Reads data from the stream.
Implemented in MemoryStreamCopy, tmemorystream, tn_lzw_file_buf_stream, tn_c_lzw_filestream, and tnbufstream. Referenced by MemoryStreamCopy::MemoryStreamCopy(), tpcxheader::read(), GameMap::read(), readOldEvent(), readpchar(), readpnchar(), readrlepict(), and readTextString(). |
|
|
Reads a flaot variable.
Definition at line 324 of file basestrm.cpp. References readdata2, and SwapFloat(). Referenced by WeatherSystem::read(). |
|
|
||||||||||||
|
Reads a string. All bytes of the files are stored in the allocated memory until either a 0 Byte is read or the maximum number of character have been reached. The string will always be 0 terminated in both cases.
Definition at line 381 of file basestrm.cpp. References CharBuf::buf, and readdata(). Referenced by findNextCampaignMap(), tnetworkloaders::loadnwgame(), tncontainerstream::tncontainerstream(), validateemlfile(), validatemapfile(), and validatesavfile(). |
|
||||||||||||
|
Reads a string. All bytes of the files are stored in the allocated memory until either a 0 Byte or a newline character is read or the maximum number of character have been reached. The string will always be 0 terminated. Carriage return bytes will be filtered out.
Definition at line 431 of file basestrm.cpp. References CharBuf::buf, readdata(), red, and strdup(). |
|
||||||||||||||||
|
Writes an RLE compressed or uncompressed image from the stream.
Definition at line 210 of file basestrm.cpp. References trleheader::id, readChar(), readdata(), readWord(), trleheader::rle, trleheader::size, trleheader::x, and trleheader::y. Referenced by UnitPropertyEditor::init(), and loadcursor(). |
|
|
Reads and returns a string. Carriage Return character will be filtered. If the very first read operation fails because the end of the stream was already reached, a readafterend exception will be thrown. If some data could be read before the end was reached, this data will be returned.
Definition at line 526 of file basestrm.cpp. References getLocation(), and readTextString(). Referenced by checkFileVersion(), tsavegameloaders::loadgame(), loadsinglemessagefile(), Technology::read(), TechAdapterDependency::read(), TechAdapter::read(), GameTransferMechanism::read(), MusicPlayList::read(), Bi3MapTranslationTable::read(), ItemRepositoryLoader< T >::read(), GameMap::read(), Event::read(), ContainerBaseType::read(), BuildingType::read(), tfindfile::FileInfo::read(), FileTransfer::readChildData(), DisplayImmediateMessage::readData(), readLegacyNetworkData(), TextFormatParser::readLine(), and tspfldloaders::readmessages(). |
|
||||||||||||
|
Reads a string. Carriage Return character will be filtered.
Definition at line 502 of file basestrm.cpp. References readdata(), and red. Referenced by MailOptionsDialog::MailOptionsDialog(), SingleUnitSet::read(), readString(), and readtextmessage(). |
|
|
Reads a 16 bit unsigned Integer. In the stream little-endian byte order is used and a translation is performed, if necessary.
Definition at line 294 of file basestrm.cpp. References readdata2. Referenced by findNextCampaignMap(), tsavegameloaders::loadgame(), tnetworkloaders::loadnwgame(), Vehicle::newFromStream(), Building::newFromStream(), TerrainType::Weather::read(), tpcxheader::read(), GameMap::read(), Research::read_struct(), tspfldloaders::readfields(), readrlepict(), validateemlfile(), validatemapfile(), and validatesavfile(). |
|
|
Sets the stream pointer to a new location. An exception is thrown if the stream does not support seeking.
Reimplemented in MemoryStreamCopy, and tn_file_buf_stream. Definition at line 205 of file basestrm.cpp. References getDeviceName(). |
|
||||||||||
|
Definition at line 118 of file basestreaminterface.h. References N, writeChar(), and writeInt(). Referenced by ContainerBaseType::TransportationIO::write(). |
|
|
Writes a 8 bit unsigned Integer.
Definition at line 371 of file basestrm.cpp. References writedata2. Referenced by logtoreplayinfo(), Vehicletype::write(), Vehicle::write(), Surface::write(), tpcxheader::write(), GameMap::write(), Building::write(), writeBitset(), tspfldloaders::writefields(), writeImage(), and writepcx(). |
|
||||||||||||
|
writes data to the stream
Implemented in MemoryStreamCopy, tmemorystream, tn_lzw_file_buf_stream, tn_c_lzw_filestream, and tnbufstream. Referenced by Surface::write(), tpcxheader::write(), writeImage(), writepchar(), and writeString(). |
|
|
Write a floating point variable.
Definition at line 376 of file basestrm.cpp. References writedata2. Referenced by WeatherSystem::write(), and ResourceMatrix::write(). |
|
||||||||||||
|
Writes an image to the stream.
Definition at line 249 of file basestrm.cpp. References compressrle(), trleheader::id, trleheader::rle, trleheader::size, writeChar(), writedata(), writeWord(), trleheader::x, and trleheader::y. Referenced by writerlepict(). |
|
|
Definition at line 352 of file basestrm.cpp. References writedata2. |
|
|
Definition at line 346 of file basestrm.cpp. References writedata2. |
|
|
|
write the C-String pc to the stream
Definition at line 545 of file basestrm.cpp. References writedata(). Referenced by tsavegameloaders::savegame(), tmaploaders::savemap(), tnetworkloaders::savenwgame(), and writeString(). |
|
|
Writes an image to the stream and compresses it using RLE.
Definition at line 244 of file basestrm.cpp. References writeImage(). |
|
||||||||||||
|
|
Writes a 16 bit unsigned Integer. In the stream little-endian byte order is used and a translation is performed, if necessary.
Definition at line 365 of file basestrm.cpp. References writedata2. Referenced by tsavegameloaders::savegame(), tmaploaders::savemap(), tnetworkloaders::savenwgame(), Vehicletype::write(), Vehicle::write(), Surface::write(), tpcxheader::write(), GameMap::write(), Building::write(), and writeImage(). |
|
|
Definition at line 188 of file basestreaminterface.h. Referenced by getDeviceName(), MemoryStreamCopy::getLocation(), getLocation(), MemoryStreamCopy::MemoryStreamCopy(), tn_c_lzw_filestream::tn_c_lzw_filestream(), and tn_file_buf_stream::tn_file_buf_stream(). |
1.4.2