class hiro::Exportable
Overview
Object whose state can be written to and read from stream. More…
#include <Exportable.h> class Exportable { public: // methods static bool ReadVersion(std::istream& str, uint32_t expected_version); static void WriteVersion(std::ostream& str, uint32_t version); virtual bool ReadFromStream(std::istream& str); virtual void WriteToStream(std::ostream& str) const; hiro::Exportable& operator>>(std::istream& str); hiro::Exportable& operator<<(std::ostream& str); };
Detailed Documentation
Object whose state can be written to and read from stream.
Methods
static bool ReadVersion(std::istream& str, uint32_t expected_version)
Helper function for reading version number from input stream.
Parameters:
str |
Stream to read version number from. |
expected_version |
Version number to compare stream version number to. |
Returns:
Whether the version in file is equal to the expected_version.
static void WriteVersion(std::ostream& str, uint32_t version)
Helper function for writing version number to output stream.
Parameters:
str |
Stream to write version number to. |
version |
Version number to write to stream. |
virtual bool ReadFromStream(std::istream& str)
Override this method to specify custom data to be loaded.
virtual void WriteToStream(std::ostream& str) const
Override this method to specify custom data to be stored.