22 #ifndef FIFE_VFS_RAW_RAWDATA_H 23 #define FIFE_VFS_RAW_RAWDATA_H 96 readInto(reinterpret_cast<uint8_t*>(&val),
sizeof(T));
147 void read(std::string& outbuffer, int32_t size=-1);
154 bool getLine(std::string& buffer);
174 template <
typename T> T
revert(T value)
const {
176 for (
uint32_t i = 0; i <
sizeof(T); ++i)
177 reinterpret_cast<uint8_t*>(&retval)[i] =
reinterpret_cast<uint8_t*
>(&value)[
sizeof(T)-1-i];
194 m_rd->setIndex(m_index);
uint16_t read16Big()
reads a uint16_t bigEndian and converts them to the host-byteorder
bool getLine(std::string &buffer)
reads until a \n is encountered or no more data is available
void moveIndex(int32_t offset)
move the current index
std::vector< std::string > getDataInLines()
get the data in distinct lines
Abstract baseclass - provides data for RawData.
std::vector< uint8_t > getDataInBytes()
get the data as a vector of bytes This does not append a null terminator to the end ...
IndexSaver & operator=(const IndexSaver &)
RawDataSource * m_datasource
uint32_t getDataLength() const
get the complete datalength
uint8_t read8()
reads 1 byte
T readSingle()
helper-function
uint32_t read32Big()
reads a uint16_t bigEndian and converts them to the host-byteorder
RawData & operator=(const RawData &)
uint32_t getCurrentIndex() const
get the current index
T littleToHost(T value) const
std::string readString(size_t len)
read a string with len bytes, not assuming a terminating 0 Appends a null terminator character to the...
uint32_t read32Little()
reads a uint16_t littleEndian and converts them to the host-byteorder
void readInto(uint8_t *buffer, size_t len)
read len bytes into buffer
T bigToHost(T value) const
RawData(RawDataSource *datasource)
uint16_t read16Little()
reads a uint16_t littleEndian and converts them to the host-byteorder
void setIndex(uint32_t index)
set the current index
static bool littleEndian()
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 especiall...
std::shared_ptr< RawData > RawDataPtr
Used to access diffrent kinds of data.