|
FIFE
|
Used to access diffrent kinds of data. More...
#include <rawdata.h>
Collaboration diagram for FIFE::RawData:Public Member Functions | |
| RawData (RawDataSource *datasource) | |
| virtual | ~RawData () |
| std::vector< uint8_t > | getDataInBytes () |
| get the data as a vector of bytes This does not append a null terminator to the end More... | |
| std::vector< std::string > | getDataInLines () |
| get the data in distinct lines More... | |
| uint32_t | getDataLength () const |
| get the complete datalength More... | |
| uint32_t | getCurrentIndex () const |
| get the current index More... | |
| void | setIndex (uint32_t index) |
| set the current index More... | |
| void | moveIndex (int32_t offset) |
| move the current index More... | |
| template<typename T > | |
| T | readSingle () |
| helper-function More... | |
| void | readInto (uint8_t *buffer, size_t len) |
| read len bytes into buffer More... | |
| uint8_t | read8 () |
| reads 1 byte More... | |
| uint16_t | read16Little () |
| reads a uint16_t littleEndian and converts them to the host-byteorder More... | |
| uint32_t | read32Little () |
| reads a uint16_t littleEndian and converts them to the host-byteorder More... | |
| uint16_t | read16Big () |
| reads a uint16_t bigEndian and converts them to the host-byteorder More... | |
| uint32_t | read32Big () |
| reads a uint16_t bigEndian and converts them to the host-byteorder More... | |
| std::string | readString (size_t len) |
| read a string with len bytes, not assuming a terminating 0 Appends a null terminator character to the end More... | |
| void | read (std::string &outbuffer, int32_t size=-1) |
| Reads all data into the buffer This does not append a null terminator to the end Created to especially fulfill python file interface requirements. More... | |
| bool | getLine (std::string &buffer) |
| reads until a \n is encountered or no more data is available More... | |
Private Member Functions | |
| template<typename T > | |
| T | littleToHost (T value) const |
| template<typename T > | |
| T | bigToHost (T value) const |
| template<typename T > | |
| T | revert (T value) const |
| RawData (const RawData &) | |
| RawData & | operator= (const RawData &) |
Static Private Member Functions | |
| static bool | littleEndian () |
Private Attributes | |
| RawDataSource * | m_datasource |
| size_t | m_index_current |
Used to access diffrent kinds of data.
RawData uses RawDataSource to get the real data - that way the user doesn't have to know where the data comes from (real files, files inside archives etc.)
| FIFE::RawData::RawData | ( | RawDataSource * | datasource | ) |
Definition at line 41 of file rawdata.cpp.
|
virtual |
Definition at line 45 of file rawdata.cpp.
References m_datasource.
|
private |
|
inlineprivate |
Definition at line 167 of file rawdata.h.
References littleEndian(), and revert().
Referenced by read16Big(), and read32Big().
Here is the caller graph for this function:| uint32_t FIFE::RawData::getCurrentIndex | ( | ) | const |
get the current index
Definition at line 79 of file rawdata.cpp.
References m_index_current.
Referenced by getLine(), moveIndex(), FIFE::OGG_cb::read(), FIFE::ZipSource::readFileToIndex(), and FIFE::OGG_cb::tell().
Here is the caller graph for this function:| std::vector< uint8_t > FIFE::RawData::getDataInBytes | ( | ) |
get the data as a vector of bytes This does not append a null terminator to the end
Definition at line 49 of file rawdata.cpp.
References getDataLength(), and readInto().
| std::vector< std::string > FIFE::RawData::getDataInLines | ( | ) |
| uint32_t FIFE::RawData::getDataLength | ( | ) | const |
get the complete datalength
Definition at line 75 of file rawdata.cpp.
References FIFE::RawDataSource::getSize(), and m_datasource.
Referenced by getDataInBytes(), getLine(), FIFE::AnimationLoader::isLoadable(), FIFE::ObjectLoader::isLoadable(), FIFE::MapLoader::isLoadable(), FIFE::AtlasLoader::isLoadable(), FIFE::AnimationLoader::load(), FIFE::ObjectLoader::load(), FIFE::MapLoader::load(), FIFE::AtlasLoader::load(), FIFE::OGG_cb::read(), read(), readInto(), and setIndex().
Here is the caller graph for this function:| bool FIFE::RawData::getLine | ( | std::string & | buffer | ) |
reads until a \n is encountered or no more data is available
| buffer | if successfull the new string will be assigned to buffer |
Definition at line 154 of file rawdata.cpp.
References getCurrentIndex(), getDataLength(), and read8().
Referenced by getDataInLines().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 166 of file rawdata.cpp.
References FIFE::_log, and FL_LOG.
Referenced by bigToHost(), and littleToHost().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 160 of file rawdata.h.
References littleEndian(), and revert().
Referenced by read16Little(), and read32Little().
Here is the caller graph for this function:| void FIFE::RawData::moveIndex | ( | int32_t | offset | ) |
move the current index
| offset | the offset |
| IndexOverflow | if we move outside the datalength |
Definition at line 90 of file rawdata.cpp.
References getCurrentIndex(), and setIndex().
Referenced by FIFE::ZipSource::readFileToIndex().
Here is the caller graph for this function:| void FIFE::RawData::read | ( | std::string & | outbuffer, |
| int32_t | size = -1 |
||
| ) |
Reads all data into the buffer This does not append a null terminator to the end Created to especially fulfill python file interface requirements.
Definition at line 138 of file rawdata.cpp.
References getDataLength(), m_index_current, and readInto().
| uint16_t FIFE::RawData::read16Big | ( | ) |
reads a uint16_t bigEndian and converts them to the host-byteorder
| IndexOverflow |
Definition at line 118 of file rawdata.cpp.
References bigToHost().
Referenced by FIFE::LZSSDecoder::decode().
Here is the caller graph for this function:| uint16_t FIFE::RawData::read16Little | ( | ) |
reads a uint16_t littleEndian and converts them to the host-byteorder
| IndexOverflow |
Definition at line 108 of file rawdata.cpp.
References littleToHost().
Referenced by FIFE::ZipSource::readFileToIndex().
Here is the caller graph for this function:| uint32_t FIFE::RawData::read32Big | ( | ) |
reads a uint16_t bigEndian and converts them to the host-byteorder
| IndexOverflow |
Definition at line 123 of file rawdata.cpp.
References bigToHost().
| uint32_t FIFE::RawData::read32Little | ( | ) |
reads a uint16_t littleEndian and converts them to the host-byteorder
| IndexOverflow |
Definition at line 113 of file rawdata.cpp.
References littleToHost().
Referenced by FIFE::ZipSource::readFileToIndex().
Here is the caller graph for this function:| uint8_t FIFE::RawData::read8 | ( | ) |
reads 1 byte
Definition at line 104 of file rawdata.cpp.
Referenced by getLine().
Here is the caller graph for this function:| void FIFE::RawData::readInto | ( | uint8_t * | buffer, |
| size_t | len | ||
| ) |
read len bytes into buffer
| buffer | the data will be written into it |
| len | len bytes will be written |
| IndexOverflow | if currentindex + len > getCurrentIndex() |
Definition at line 94 of file rawdata.cpp.
References FIFE::_log, FL_LOG, getDataLength(), m_datasource, m_index_current, and FIFE::RawDataSource::readInto().
Referenced by FIFE::LZSSDecoder::decode(), getDataInBytes(), FIFE::ZipSource::open(), FIFE::OGG_cb::read(), read(), readSingle(), and readString().
Here is the caller graph for this function:
|
inline |
helper-function
reads sizeof(T) bytes - should be used with fixed-size datatypes like uint32_t, uint16_t, uint8_t etc.
Definition at line 94 of file rawdata.h.
References readInto().
| std::string FIFE::RawData::readString | ( | size_t | len | ) |
read a string with len bytes, not assuming a terminating 0 Appends a null terminator character to the end
| len | the stringlen |
| IndexOverflow |
Definition at line 128 of file rawdata.cpp.
References readInto().
Referenced by FIFE::AnimationLoader::isLoadable(), FIFE::ObjectLoader::isLoadable(), FIFE::MapLoader::isLoadable(), FIFE::AtlasLoader::isLoadable(), FIFE::AnimationLoader::load(), FIFE::ObjectLoader::load(), FIFE::MapLoader::load(), FIFE::AtlasLoader::load(), and FIFE::ZipSource::readFileToIndex().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 174 of file rawdata.h.
Referenced by bigToHost(), and littleToHost().
Here is the caller graph for this function:| void FIFE::RawData::setIndex | ( | uint32_t | index | ) |
set the current index
| index | the new index |
| IndexOverflow | if index is >= getDataLength() |
Definition at line 83 of file rawdata.cpp.
References getDataLength(), and m_index_current.
Referenced by moveIndex(), FIFE::ZipSource::open(), FIFE::ZipSource::readIndex(), FIFE::OGG_cb::seek(), and FIFE::IndexSaver::~IndexSaver().
Here is the caller graph for this function:
|
private |
Definition at line 157 of file rawdata.h.
Referenced by getDataLength(), readInto(), and ~RawData().
|
private |
Definition at line 158 of file rawdata.h.
Referenced by getCurrentIndex(), read(), readInto(), and setIndex().