tnstream Class Reference

The interface for all kinds of IO stream. More...

#include <basestreaminterface.h>

Inheritance diagram for tnstream:

Inheritance graph
[legend]
List of all members.

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 ()
 returns the name of the stream.
virtual ASCString getLocation ()
 returns the location of the stream.
virtual ASCString getArchive ()
 returns the archive name if the stream is located inside an archive; or "" if not.
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

Detailed Description

The interface for all kinds of IO stream.

Because ASC was originally written in Pascal, the streams don't have any relation to the C++ streams

Definition at line 34 of file basestreaminterface.h.


Member Enumeration Documentation

enum tnstream::IOMode

the modes in which a stream can operate

Enumerator:
uninitialized 
reading 
writing 
appending 

Definition at line 39 of file basestreaminterface.h.


Constructor & Destructor Documentation

tnstream::tnstream (  ) 

Definition at line 194 of file basestrm.cpp.

virtual tnstream::~tnstream (  )  [inline, virtual]

Definition at line 189 of file basestreaminterface.h.


Member Function Documentation

virtual void tnstream::writedata ( const void *  buf,
int  size 
) [pure virtual]

writes data to the stream

Parameters:
buf pointer to the buffer
size the number of bytes which are going to be written

Implemented in MemoryStreamCopy, MemoryStream, tn_lzw_file_buf_stream, tn_c_lzw_filestream, ASCIIEncodingStream, ASCIIDecodingStream, StreamCompressionFilter, StreamDecompressionFilter, and tnbufstream.

Referenced by Surface::write(), tpcxheader::write(), CompressionStreamAdapter::writecmpdata(), writeImage(), writepchar(), writeString(), and MemoryStreamStorage::writetostream().

virtual int tnstream::readdata ( void *  buf,
int  size,
bool  excpt = true 
) [pure virtual]

Reads data from the stream.

Parameters:
buf the buffer which the data is written to
size the number of bytes which should be read
excpt If true the operation will throw an exception if the desired number of bytes cannot be read.
Returns:
the number of bytes which were read.

Implemented in MemoryStreamCopy, MemoryStream, tn_lzw_file_buf_stream, tn_c_lzw_filestream, ASCIIEncodingStream, ASCIIDecodingStream, StreamCompressionFilter, StreamDecompressionFilter, and tnbufstream.

Referenced by loadfont(), MemoryStreamCopy::MemoryStreamCopy(), Surface::read(), toldfont::read(), tpcxheader::read(), GameMap::read(), CompressionStreamAdapter::readcmpdata(), MemoryStreamStorage::readfromstream(), readOldEvent(), readpchar(), readpnchar(), readrlepict(), and readTextString().

void tnstream::readpchar ( char **  pc,
int  maxlength = 0 
) [virtual]

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.

Parameters:
pc pointer to an uninitialized pointer which will contain the string. The memory will be allocated using new char[length of string] .
maxlength The maximum number of bytes that will be read. If zero, the maximum length is not limited.

Definition at line 378 of file basestrm.cpp.

References CharBuf::buf, and readdata().

Referenced by findNextCampaignMap(), tnetworkloaders::loadnwgame(), tncontainerstream::tncontainerstream(), validateemlfile(), validatemapfile(), and validatesavfile().

void tnstream::readpnchar ( char **  pc,
int  maxlength = 0 
) [virtual]

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.

Parameters:
pc pointer to an uninitialized pointer which will contain the string. The memory will be allocated using new char[length of string] .
maxlength The maximum number of bytes that will be read. If zero, the maximum length is not limited.

Definition at line 428 of file basestrm.cpp.

References CharBuf::buf, readdata(), and red.

bool tnstream::readTextString ( ASCString s,
bool  includeCR = false 
) [virtual]

Reads a string.

Carriage Return character will be filtered.

Parameters:
s The ASCString which will contain the data read.
includeCR if true, the reading will stop only a 0 Bytes or the end of stream, so all newline character will be part of the text string. Useful for binary files. If false reading will stop and 0 Bytes and newline characters. The newline character will not be part of the resulting string.
Returns:
true if there is remaining data after the string, false if the reading was ended because the end of the stream was reached.

Definition at line 499 of file basestrm.cpp.

References readdata(), and red.

Referenced by MailOptionsDialog::MailOptionsDialog(), SingleUnitSet::read(), Properties::read(), CampaignActionLogger::readData(), readString(), and readtextmessage().

ASCString tnstream::readString ( bool  includeCR = false  )  [virtual]

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.

Parameters:
includeCR if true, the reading will stop only at 0 Bytes or the end of stream, so all newline character will be part of the text string. Useful for binary files. If false reading will stop at 0 Bytes and newline characters. The newline character will not be part of the resulting string.

Definition at line 523 of file basestrm.cpp.

References getLocation(), and readTextString().

Referenced by tsavegameloaders::loadgame(), tsavegameloaders::loadMapimageFromFile(), loadsinglemessagefile(), VehicleType::read(), TerrainType::read(), TerrainType::Weather::read(), Technology::read(), TechAdapterDependency::read(), TechAdapter::read(), PackageData::read(), Package::PackageDependency::read(), Package::read(), ObjectType::read(), GameTransferMechanism::read(), MusicPlayList::read(), Bi3MapTranslationTable::read(), ItemFiltrationSystem::ItemFilter::read(), ItemRepositoryLoader< T >::read(), GameMap::read(), Event::read(), BuildingType::read(), tfindfile::FileInfo::read(), FileTransfer::readChildData(), RenameContainerCommand::readData(), DisplayImmediateMessage::readData(), readLegacyNetworkData(), TextFormatParser::readLine(), tspfldloaders::readmessages(), and LuaRunner::runFile().

void tnstream::writepchar ( const char *  pc  )  [virtual]

write the C-String pc to the stream

Definition at line 542 of file basestrm.cpp.

References writedata().

Referenced by tsavegameloaders::savegame(), tmaploaders::savemap(), tnetworkloaders::savenwgame(), and writeString().

void tnstream::writeString ( const string &  pc,
bool  binary = true 
) [virtual]

writes the C++ String pc to the stream.

Parameters:
binary If true, all bytes (including 0 bytes) of the string will be written to the stream. Note that a string containing one or more 0 bytes cannot be read with a single stream reading operation. If false, writing will stop at the first 0 character of the string (or its end of course)

Definition at line 533 of file basestrm.cpp.

References writedata(), and writepchar().

Referenced by PropertyWritingContainer::closeBracket(), generateTechTree(), PropertyWritingContainer::openBracket(), tsavegameloaders::savegame(), VehicleType::write(), Vehicle::write(), Properties::write(), TerrainType::write(), TerrainType::Weather::write(), Technology::write(), TechAdapterDependency::write(), TechAdapter::write(), PackageData::write(), Package::PackageDependency::write(), Package::write(), ObjectType::write(), GameTransferMechanism::write(), MusicPlayList::write(), Bi3MapTranslationTable::write(), ItemFiltrationSystem::ItemFilter::write(), ItemRepositoryLoader< T >::write(), GameMap::write(), Event::write(), BuildingType::write(), Building::write(), tfindfile::FileInfo::write(), FileTransfer::writeChildData(), RenameContainerCommand::writeData(), DisplayImmediateMessage::writeData(), CampaignActionLogger::writeData(), TechDependency::writeInvertTreeOutput(), writeMessageFile(), tspfldloaders::writemessages(), PropertyWritingContainer::writeProperty(), and TechDependency::writeTreeOutput().

int tnstream::readInt ( void   )  [virtual]

Reads a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is performed, if necessary.

Definition at line 284 of file basestrm.cpp.

References readdata2.

Referenced by AutoProgressBar::AutoProgressBar(), trunreplay::execnextreplaymove(), Reinforcements::execute(), FileCache::FileCache(), findNextCampaignMap(), getGraphicSetIdFromFilename(), tsavegameloaders::loadgame(), loadmapfromstream(), tsavegameloaders::loadMapimageFromFile(), tnetworkloaders::loadnwgame(), loadreplay(), Vehicle::newFromStream(), Building::newFromStream(), ClipBoardBase::pasteUnit(), ClipBoardBase::place(), WeatherSystem::read(), WeatherField::read(), WeatherArea::read(), VersionIdentifier::read(), VehicleType::HeightChangeMethod::read(), VehicleType::read(), Vehicle::read(), MapCoordinate3D::read(), MapCoordinate::read(), Properties::read(), IntRange::read(), Resources::read(), ResourceMatrix::read(), TerrainBits::read(), TerrainType::read(), TerrainType::Weather::read(), TerrainType::MoveMalus::read(), TerrainAccess::read(), TaskHibernatingContainer::read(), TaskContainer::read(), Surface::read(), Technology::read(), TechAdapterDependency::read(), TechAdapter::read(), TechDependency::read(), Player::read(), DiplomaticStateVector::read(), Password::read(), PackageRepository::read(), PackageData::read(), Package::PackageDependency::read(), Package::read(), ObjectType::read(), Object::read(), toldfont::read(), GameTransferMechanism::read(), MusicPlayList::read(), Poly_gon::read(), tpcxheader::read(), BI3TranslationTableLoader::read(), Bi3MapTranslationTable::read(), Bi3MapTranslationTable::Objecttranslataion::read(), Bi3MapTranslationTable::Terraincombixlat::read(), Bi3MapTranslationTable::Terrain2id::read(), ItemFiltrationSystem::DataLoader::read(), ItemFiltrationSystem::ItemFilter::read(), ItemRepositoryLoader< T >::read(), GameMap::ReplayInfo::read(), AiParameter::read(), AiValue::read(), AiThreat::read(), GameMap::ResourceTribute::read(), GameMap::read(), Event::read(), Mine::read(), DiscoverResources::ResourceViewState::read(), ContainerBaseType::TransportationIO::read(), ContainerBaseType::read(), ClipBoardBase::read(), BuildingType::read(), Building::read(), tfindfile::FileInfo::read(), AI::read(), AStar3D::PathPoint::read(), ActionContainer::read(), GameAction::read(), Research::read_struct(), Research::read_techs(), tgameloaders::readAI(), readBitset(), FileTransfer::readChildData(), readClassContainer(), readClassContainerStaticConstructor(), ViewRegistration::readData(), VehicleAttackAction::readData(), UnitFieldRegistration::readData(), UnitCommand::readData(), UnitAction::readData(), TransferControlCommand::readData(), TrainUnitCommand::readData(), SpawnUnit::readData(), SpawnObject::readData(), SpawnMine::readData(), SpawnBuilding::readData(), SetResourceProcessingRateCommand::readData(), ServiceCommand::readData(), RepairUnitCommand::readData(), RepairBuildingCommand::readData(), RenameContainerCommand::readData(), RemoveProductionLineCommand::readData(), RemoveObject::readData(), RemoveMine::readData(), RegisterUnitRFTarget::readData(), RecycleUnitCommand::readData(), ReactionFireSwitchCommand::readData(), PutObjectCommand::readData(), PutMineCommand::readData(), PowerGenerationSwitchCommand::readData(), MoveUnitCommand::readData(), MoveUnit::readData(), JumpDriveCommand::readData(), InternalAmmoTransferCommand::readData(), InflictDamage::readData(), GameMap::IDManager::readData(), AllEnemyBuildingsDestroyed::readData(), AllEnemyUnitsDestroyed::readData(), AllUnitsLost::readData(), AllBuildingsLost::readData(), Reinforcements::readData(), SetViewSharing::readData(), ChangePlayerState::readData(), ChangeDiplomaticStatus::readData(), AddProductionCapability::readData(), DisplayImmediateMessage::readData(), ChangeBuildingOwner::readData(), DisplayEllipse::readData(), NextMap::readData(), ChangeBuildingDamage::readData(), AddObject::readData(), MapChange::readData(), WeatherChange::readData(), DisplayMessage::readData(), ChangeGameParameter::readData(), WindChange::readData(), Action_Nothing::readData(), ResourceTribute::readData(), AnyUnitEntersPolygon::readData(), SpecificUnitEntersPolygon::readData(), EventTriggered::readData(), UnitTrigger::readData(), TurnPassed::readData(), DiscoverResources::readData(), DirectResearchCommand::readData(), DiplomacyCommand::readData(), DestructUnitCommand::readData(), DestructContainer::readData(), DestructBuildingCommand::readData(), ConvertContainer::readData(), ContainerCommand::readData(), ContainerAction::readData(), ConsumeResource::readData(), ConsumeAmmo::readData(), ConstructUnitCommand::readData(), ConstructBuildingCommand::readData(), Command::readData(), ChangeView::readData(), ChangeUnitProperty::readData(), ChangeUnitMovement::readData(), ChangeObjectProperty::readData(), ChangeDiplomaticState::readData(), ChangeContainerProperty::readData(), CargoMoveCommand::readData(), CancelResearchCommand::readData(), CampaignActionLogger::readData(), BuildProductionLineCommand::readData(), AttackCommand::readData(), tspfldloaders::readdissections(), tspfldloaders::readfields(), MemoryStreamStorage::readfromstream(), GameAction::readFromStream(), readLegacyNetworkData(), FieldAddressing::readMapModificationData(), tspfldloaders::readmessagelist(), tspfldloaders::readmessages(), readOldEvent(), readOldEventLists(), tspfldloaders::readoldevents(), readPointerContainer(), ClipBoardBase::readProperties(), readSDLPixelFormat(), AbstractTaskContainer::readStorage(), tncontainerstream::tncontainerstream(), RemoveObject::undoAction(), validateemlfile(), validatemapfile(), validatesavfile(), and versionTest().

int tnstream::readWord ( void   )  [virtual]

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 291 of file basestrm.cpp.

References readdata2.

Referenced by findNextCampaignMap(), loadfont(), tsavegameloaders::loadgame(), tsavegameloaders::loadMapimageFromFile(), tnetworkloaders::loadnwgame(), Vehicle::newFromStream(), Building::newFromStream(), VehicleType::read(), Vehicle::read(), TerrainType::Weather::read(), Surface::read(), toldfont::read(), tpcxheader::read(), GameMap::read(), Building::read(), Research::read_struct(), tspfldloaders::readfields(), readrlepict(), validateemlfile(), validatemapfile(), and validatesavfile().

char tnstream::readChar ( void   )  [virtual]

Reads a 8 bit unsigned Integer.

Definition at line 298 of file basestrm.cpp.

References readdata2.

Referenced by checkFileLoadability(), trunreplay::execnextreplaymove(), Vehicle::newFromStream(), Building::newFromStream(), VehicleType::read(), Vehicle::read(), TerrainType::Weather::read(), TerrainType::MoveMalus::read(), Surface::read(), toldfont::read(), tpcxheader::read(), GameMap::read(), BuildingType::read(), Building::read(), Research::read_struct(), readBitset(), tspfldloaders::readfields(), readLegacyNetworkData(), trunreplay::readnextaction(), readrlepict(), and trunreplay::run().

template<size_t N>
void tnstream::writeBitset ( const std::bitset< N > &  bs  )  [inline]

Definition at line 116 of file basestreaminterface.h.

References N, writeChar(), and writeInt().

Referenced by ContainerBaseType::TransportationIO::write().

template<size_t N>
void tnstream::readBitset ( std::bitset< N > &  bs  )  [inline]

Definition at line 124 of file basestreaminterface.h.

References N, readChar(), and readInt().

Referenced by ContainerBaseType::TransportationIO::read().

float tnstream::readFloat ( void   )  [virtual]

Reads a flaot variable.

Definition at line 321 of file basestrm.cpp.

References readdata2, and SwapFloat().

Referenced by WeatherSystem::read(), WeatherArea::read(), VehicleType::read(), ResourceMatrix::read(), ObjectType::read(), and AI::read().

void tnstream::writeInt ( int  i  )  [virtual]

Writes a 32 bit signed Integer. In the stream little-endian byte order is used and a translation is performed, if necessary.

Definition at line 356 of file basestrm.cpp.

References writedata2.

Referenced by ClipBoardBase::addBuilding(), ClipBoardBase::addUnit(), AutoProgressBar::close(), Event::read(), ObjectRemovalStrategy2::removeObject(), LogActionIntoReplayInfo::saveCommand(), tsavegameloaders::savegame(), tmaploaders::savemap(), savereplay(), WeatherSystem::write(), WeatherField::write(), WeatherArea::write(), VersionIdentifier::write(), VehicleType::HeightChangeMethod::write(), VehicleType::write(), Vehicle::write(), MapCoordinate3D::write(), MapCoordinate::write(), Properties::write(), IntRange::write(), Resources::write(), ResourceMatrix::write(), TerrainBits::write(), TerrainType::write(), TerrainType::Weather::write(), TerrainType::MoveMalus::write(), TerrainAccess::write(), TaskHibernatingContainer::write(), TaskContainer::write(), Surface::write(), Research::write(), Technology::write(), TechAdapterDependency::write(), TechAdapter::write(), TechDependency::write(), Player::write(), DiplomaticStateVector::write(), Password::write(), PackageRepository::write(), PackageData::write(), Package::PackageDependency::write(), Package::write(), ObjectType::write(), Object::write(), GameTransferMechanism::write(), MusicPlayList::write(), Poly_gon::write(), tpcxheader::write(), BI3TranslationTableLoader::write(), Bi3MapTranslationTable::write(), Bi3MapTranslationTable::Objecttranslataion::write(), Bi3MapTranslationTable::Terraincombixlat::write(), Bi3MapTranslationTable::Terrain2id::write(), ItemFiltrationSystem::DataLoader::write(), ItemFiltrationSystem::ItemFilter::write(), FileCache::write(), ItemRepositoryLoader< T >::write(), GameMap::ReplayInfo::write(), AiParameter::write(), AiValue::write(), AiThreat::write(), GameMap::ResourceTribute::write(), GameMap::write(), Event::write(), Mine::write(), DiscoverResources::ResourceViewState::write(), ContainerBaseType::TransportationIO::write(), ContainerBaseType::write(), ClipBoardBase::write(), BuildingType::write(), Building::write(), tfindfile::FileInfo::write(), AI::write(), AStar3D::PathPoint::write(), ActionContainer::write(), GameAction::write(), tgameloaders::writeAI(), writeBitset(), FileTransfer::writeChildData(), writeClassContainer(), ViewRegistration::writeData(), VehicleAttackAction::writeData(), UnitFieldRegistration::writeData(), UnitCommand::writeData(), UnitAction::writeData(), TransferControlCommand::writeData(), TrainUnitCommand::writeData(), SpawnUnit::writeData(), SpawnObject::writeData(), SpawnMine::writeData(), SpawnBuilding::writeData(), SetResourceProcessingRateCommand::writeData(), ServiceCommand::writeData(), RepairUnitCommand::writeData(), RepairBuildingCommand::writeData(), RenameContainerCommand::writeData(), RemoveProductionLineCommand::writeData(), RemoveObject::writeData(), RemoveMine::writeData(), RegisterUnitRFTarget::writeData(), RecycleUnitCommand::writeData(), ReactionFireSwitchCommand::writeData(), PutObjectCommand::writeData(), PutMineCommand::writeData(), PowerGenerationSwitchCommand::writeData(), MoveUnitCommand::writeData(), MoveUnit::writeData(), JumpDriveCommand::writeData(), InternalAmmoTransferCommand::writeData(), InflictDamage::writeData(), GameMap::IDManager::writeData(), AllEnemyBuildingsDestroyed::writeData(), AllEnemyUnitsDestroyed::writeData(), AllUnitsLost::writeData(), AllBuildingsLost::writeData(), Reinforcements::writeData(), AddResources::writeData(), SetViewSharing::writeData(), ChangePlayerState::writeData(), ChangeDiplomaticStatus::writeData(), AddProductionCapability::writeData(), DisplayImmediateMessage::writeData(), ChangeBuildingOwner::writeData(), DisplayEllipse::writeData(), NextMap::writeData(), ChangeBuildingDamage::writeData(), RemoveAllObjects::writeData(), AddObject::writeData(), MapChange::writeData(), WeatherChange::writeData(), DisplayMessage::writeData(), ChangeGameParameter::writeData(), WindChange::writeData(), Action_Nothing::writeData(), ResourceTribute::writeData(), AnyUnitEntersPolygon::writeData(), SpecificUnitEntersPolygon::writeData(), EventTriggered::writeData(), UnitTrigger::writeData(), PositionTrigger::writeData(), TurnPassed::writeData(), TriggerNothing::writeData(), DiscoverResources::writeData(), DirectResearchCommand::writeData(), DiplomacyCommand::writeData(), DestructUnitCommand::writeData(), DestructContainer::writeData(), DestructBuildingCommand::writeData(), ConvertContainer::writeData(), ContainerCommand::writeData(), ContainerAction::writeData(), ConsumeResource::writeData(), ConsumeAmmo::writeData(), ConstructUnitCommand::writeData(), ConstructBuildingCommand::writeData(), Command::writeData(), ChangeView::writeData(), ChangeUnitProperty::writeData(), ChangeUnitMovement::writeData(), ChangeObjectProperty::writeData(), ChangeDiplomaticState::writeData(), ChangeContainerProperty::writeData(), CargoMoveCommand::writeData(), CancelResearchCommand::writeData(), CampaignActionLogger::writeData(), BuildProductionLineCommand::writeData(), AttackCommand::writeData(), writeDefaultPixelFormat(), tspfldloaders::writedissections(), tspfldloaders::writefields(), FieldAddressing::writeMapModificationData(), writemaptostream(), tspfldloaders::writemessagelist(), tspfldloaders::writemessages(), writePointerContainer(), AbstractTaskContainer::writeStorage(), and MemoryStreamStorage::writetostream().

void tnstream::writeInt ( unsigned int  i  )  [virtual]

Definition at line 343 of file basestrm.cpp.

References writedata2.

void tnstream::writeInt ( bool  b  ) 

Definition at line 349 of file basestrm.cpp.

References writedata2.

void tnstream::writeWord ( int  w  )  [virtual]

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 362 of file basestrm.cpp.

References writedata2.

Referenced by tsavegameloaders::savegame(), tmaploaders::savemap(), VehicleType::write(), Vehicle::write(), Surface::write(), tpcxheader::write(), GameMap::write(), Building::write(), and writeImage().

void tnstream::writeChar ( char  c  )  [virtual]

Writes a 8 bit unsigned Integer.

Definition at line 368 of file basestrm.cpp.

References writedata2.

Referenced by LogActionIntoReplayInfo::saveCommand(), VehicleType::write(), Vehicle::write(), TerrainType::Weather::write(), Surface::write(), tpcxheader::write(), GameMap::write(), BuildingType::write(), Building::write(), writeBitset(), tspfldloaders::writefields(), writeImage(), and writepcx().

void tnstream::writeFloat ( float  f  )  [virtual]

Write a floating point variable.

Definition at line 373 of file basestrm.cpp.

References writedata2.

Referenced by WeatherSystem::write(), WeatherArea::write(), ResourceMatrix::write(), ObjectType::write(), and AI::write().

void tnstream::writerlepict ( const void *  buf  )  [virtual]

Writes an image to the stream and compresses it using RLE.

Definition at line 236 of file basestrm.cpp.

References writeImage().

void tnstream::writeImage ( const void *  buf,
bool  compress = true 
) [virtual]

Writes an image to the stream.

Definition at line 241 of file basestrm.cpp.

References compressrle(), trleheader::id, trleheader::rle, trleheader::size, writeChar(), writedata(), writeWord(), trleheader::x, and trleheader::y.

Referenced by writerlepict().

void tnstream::readrlepict ( void **  pnter,
bool  allocated,
int *  size 
) [virtual]

Writes an RLE compressed or uncompressed image from the stream.

Parameters:
pnter Pointer to a void* , which will contain the new image.
allocated If false, a sufficient amount of memory will be allocated for the image. If true it is assumed that a sufficiently large amount of memory has already been allocated.
size Will contain the size of the image. Must not be NULL.

Definition at line 202 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().

ASCString tnstream::getDeviceName (  )  [virtual]

returns the name of the stream.

Definition at line 269 of file basestrm.cpp.

References devicename.

Referenced by tn_file_buf_stream::get_time(), tn_c_lzw_filestream::getArchive(), PropertyWritingContainer::getFileName(), tn_file_buf_stream::getstreamsize(), tsavegameloaders::loadgame(), tsavegameloaders::loadMapimageFromFile(), MemoryStreamCopy::MemoryStreamCopy(), Building::newFromStream(), PropertyWritingContainer::PropertyWritingContainer(), VehicleType::read(), TerrainType::read(), Technology::read(), TechAdapterDependency::read(), TechAdapter::read(), TechDependency::read(), Bi3MapTranslationTable::Terrain2id::read(), ItemFiltrationSystem::ItemFilter::read(), tfindfile::FileInfo::read(), tn_file_buf_stream::readbuffer(), tnbufstream::readdata(), MemoryStreamCopy::readdata(), TextFormatParser::run(), tn_file_buf_stream::seek(), MemoryStreamCopy::seek(), seek(), tfindfile::tfindfile(), tn_c_lzw_filestream::tn_c_lzw_filestream(), tn_file_buf_stream::writebuffer(), tnbufstream::writedata(), MemoryStreamCopy::writedata(), and tn_file_buf_stream::~tn_file_buf_stream().

ASCString tnstream::getLocation (  )  [virtual]

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 274 of file basestrm.cpp.

References devicename.

Referenced by TextFormatParser::error(), PropertyWritingContainer::getLocation(), PropertyWritingContainer::PropertyWritingContainer(), VehicleType::read(), TaskHibernatingContainer::read(), Surface::read(), ObjectType::read(), Poly_gon::read(), ItemRepositoryLoader< T >::read(), ContainerBaseType::TransportationIO::read(), BuildingType::read(), Research::read_struct(), readClassContainer(), readClassContainerStaticConstructor(), readOldEventLists(), readSDLPixelFormat(), AbstractTaskContainer::readStorage(), readString(), TextFormatParser::run(), and versionTest().

ASCString tnstream::getArchive (  )  [virtual]

returns the archive name if the stream is located inside an archive; or "" if not.

Reimplemented in tn_c_lzw_filestream.

Definition at line 279 of file basestrm.cpp.

Referenced by PropertyWritingContainer::getArchive(), and TextFormatParser::run().

void tnstream::seek ( int  newpos  )  [virtual]

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 197 of file basestrm.cpp.

References getDeviceName().

virtual int tnstream::getSize ( void   )  [inline, virtual]

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 187 of file basestreaminterface.h.


Member Data Documentation

ASCString tnstream::devicename [protected]

Definition at line 189 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().


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:47:53 2012 for Advanced Strategic Command by  doxygen 1.5.1