.Core: docs and cosmetics

This commit is contained in:
Mirek Fidler 2025-02-22 11:47:30 +01:00
parent 410f01a024
commit 4329f0ed63
3 changed files with 144 additions and 196 deletions

View file

@ -385,36 +385,24 @@ bool Store(Event<Stream&> serialize, Stream& stream, int version = Null);
bool LoadFromFile(Event<Stream&> serialize, const char *file = NULL, int version = Null);
bool StoreToFile(Event<Stream&> serialize, const char *file = NULL, int version = Null);
template <class T>
void SerializeTFn(Stream &s, T *x)
{
s % *x;
}
template <class T>
Event<Stream&> SerializeCb(T& x)
{
return callback1(SerializeTFn<T>, &x);
}
template <class T>
bool Load(T& x, Stream& s, int version = Null) {
return Load(SerializeCb(x), s, version);
return Load([&](Stream& s) { s % x; }, s, version);
}
template <class T>
bool Store(T& x, Stream& s, int version = Null) {
return Store(SerializeCb(x), s, version);
return Store([&](Stream& s) { s % x; }, s, version);
}
template <class T>
bool LoadFromFile(T& x, const char *name = NULL, int version = Null) {
return LoadFromFile(SerializeCb(x), name, version);
return LoadFromFile([&](Stream& s) { s % x; }, name, version);
}
template <class T>
bool StoreToFile(T& x, const char *name = NULL, int version = Null) {
return StoreToFile(SerializeCb(x), name, version);
return StoreToFile([&](Stream& s) { s % x; }, name, version);
}
template <class T>
@ -457,10 +445,6 @@ void StoreToGlobal(Event<Stream&> serialize, const char *name);
void SerializeGlobalConfigs(Stream& s);
#ifdef PLATFORM_WINCE
inline void abort() { TerminateProcess(NULL, -1); }
#endif
template <class T>
hash_t HashBySerialize(const T& cont)
{