API for serializing data.
|
#define | VER(x) Common::Serializer::Version(x) |
|
#define | SYNC_AS(SUFFIX, TYPE, SIZE) |
|
#define | SYNC_PRIMITIVE(suffix) |
|
◆ SYNC_AS
#define SYNC_AS |
( |
|
SUFFIX, |
|
|
|
TYPE, |
|
|
|
SIZE |
|
) |
| |
Value:template<typename T> \
void syncAs ## SUFFIX(T &val, Version minVersion = 0, Version maxVersion = kLastVersion) { \
if (_version < minVersion || _version > maxVersion) \
return; \
if (_loadStream) \
val = static_cast<T>(_loadStream->read ## SUFFIX()); \
else { \
TYPE tmp = val; \
_saveStream->write ## SUFFIX(tmp); \
} \
_bytesSynced += SIZE; \
}
◆ SYNC_PRIMITIVE
#define SYNC_PRIMITIVE |
( |
|
suffix | ) |
|
Value:template <typename T> \
static inline void suffix(Serializer &s, T &value) { \
s.syncAs##suffix(value); \
}