Stream for serialization of data.
More...
#include <utilities/Stream.hpp>
|
| | Stream (StreamType type=Binary) |
| | Create new stream of type.
|
| |
| template<typename T> |
| | Stream (const T &data, StreamType type=Binary) |
| | Create new stream of type, with data already added.
|
| |
| template<typename T> |
| T | Read () |
| | Read data of specified type from stream.
|
| |
| template<typename T> |
| void | Write (const T &data) |
| | Write data of specified type to stream.
|
| |
| template<typename T> |
| Stream & | operator<< (const T &data) |
| | Write data of specified type to stream.
|
| |
| template<typename T> |
| Stream & | operator>> (T &out) |
| | Read data of specified type from stream.
|
| |
| void | WriteToFile (const char *path) const |
| | Write full stream content to a file.
|
| |
| bool | ReadFromFile (const Resources::Resource &file) |
| | Read content from a file to stream.
|
| |
| bool | ReadFromFile (std::ifstream &file) |
| | Read content from an input file stream to stream.
|
| |
| std::stringstream & | GetStream () |
| | Get underlying std::stringstream object.
|
| |
|
| operator std::stringstream & () |
| |
| const std::stringstream & | GetStream () const |
| | Get underlying std::stringstream object.
|
| |
|
| operator const std::stringstream & () const |
| |
| | Stream (const Stream &stream) |
| | make a copy of a stream
|
| |
|
template<> |
| void | Write (const Stream &data) |
| |
|
template<> |
| char | Read () |
| |
|
template<> |
| void | Write (const char &data) |
| |
|
template<> |
| bool | Read () |
| |
|
template<> |
| void | Write (const bool &data) |
| |
|
template<> |
| uint8_t | Read () |
| |
|
template<> |
| void | Write (const uint8_t &data) |
| |
|
template<> |
| uint16_t | Read () |
| |
|
template<> |
| void | Write (const uint16_t &data) |
| |
|
template<> |
| uint32_t | Read () |
| |
|
template<> |
| void | Write (const uint32_t &data) |
| |
|
template<> |
| int | Read () |
| |
|
template<> |
| void | Write (const int &data) |
| |
|
template<> |
| long | Read () |
| |
|
template<> |
| void | Write (const long &data) |
| |
|
template<> |
| uint64_t | Read () |
| |
|
template<> |
| void | Write (const uint64_t &data) |
| |
|
template<> |
| float | Read () |
| |
|
template<> |
| void | Write (const float &data) |
| |
|
template<> |
| double | Read () |
| |
|
template<> |
| void | Write (const double &data) |
| |
|
|
const StreamType | type |
| | Type of serialization used by stream.
|
| |
Stream for serialization of data.
Handles writing and reading basic data types, utility types, components, GameObjects etc. to a text or binary stream.
◆ Stream() [1/3]
| StevEngine::Utilities::Stream::Stream |
( |
StreamType | type = Binary | ) |
|
|
inline |
Create new stream of type.
- Parameters
-
| type | Type of stream to create |
◆ Stream() [2/3]
template<typename T>
| StevEngine::Utilities::Stream::Stream |
( |
const T & | data, |
|
|
StreamType | type = Binary ) |
|
inline |
Create new stream of type, with data already added.
- Parameters
-
| data | Data to add to stream |
| type | Type of stream to create |
◆ Stream() [3/3]
| StevEngine::Utilities::Stream::Stream |
( |
const Stream & | stream | ) |
|
|
inline |
make a copy of a stream
- Parameters
-
◆ GetStream() [1/2]
| std::stringstream & StevEngine::Utilities::Stream::GetStream |
( |
| ) |
|
|
inline |
Get underlying std::stringstream object.
- Returns
- Underlying std::stringstream
◆ GetStream() [2/2]
| const std::stringstream & StevEngine::Utilities::Stream::GetStream |
( |
| ) |
const |
|
inline |
Get underlying std::stringstream object.
- Returns
- Underlying std::stringstream
◆ operator<<()
template<typename T>
| Stream & StevEngine::Utilities::Stream::operator<< |
( |
const T & | data | ) |
|
|
inline |
Write data of specified type to stream.
- Template Parameters
-
- Parameters
-
◆ operator>>()
template<typename T>
| Stream & StevEngine::Utilities::Stream::operator>> |
( |
T & | out | ) |
|
|
inline |
Read data of specified type from stream.
- Template Parameters
-
- Returns
- Read value of type T
◆ Read()
template<typename T>
| T StevEngine::Utilities::Stream::Read |
( |
| ) |
|
Read data of specified type from stream.
- Template Parameters
-
- Returns
- Read value of type T
◆ ReadFromFile() [1/2]
Read content from a file to stream.
- Parameters
-
◆ ReadFromFile() [2/2]
| bool StevEngine::Utilities::Stream::ReadFromFile |
( |
std::ifstream & | file | ) |
|
Read content from an input file stream to stream.
- Parameters
-
| file | Input file stream to read from |
◆ Write()
template<typename T>
| void StevEngine::Utilities::Stream::Write |
( |
const T & | data | ) |
|
Write data of specified type to stream.
- Template Parameters
-
- Parameters
-
◆ WriteToFile()
| void StevEngine::Utilities::Stream::WriteToFile |
( |
const char * | path | ) |
const |
Write full stream content to a file.
- Parameters
-
| path | Path of the file to write to |
Writes the full stream content to a file with the specified path.
The documentation for this class was generated from the following files: