2024-06-14 22:25:34 +08:00
|
|
|
#pragma once
|
|
|
|
|
#include "serialize/binary.inl"
|
|
|
|
|
#include "serialize/text.inl"
|
|
|
|
|
namespace YAML
|
|
|
|
|
{
|
|
|
|
|
string Text_Serialize(const Any& any) {
|
|
|
|
|
return Dump(TextArchive::Serialize(any));
|
|
|
|
|
}
|
|
|
|
|
template<typename T>
|
2024-06-16 22:52:45 +08:00
|
|
|
T Text_Unserialize(const string& text) {
|
2024-06-14 22:25:34 +08:00
|
|
|
char data[sizeof(T)];
|
|
|
|
|
Any any(&data, &TypeInfo<T>::StaticClass);
|
2024-06-16 22:52:45 +08:00
|
|
|
TextArchive::Unserialize(Load(text), any);
|
2024-06-14 22:25:34 +08:00
|
|
|
return *any.CastTo<T*>();
|
|
|
|
|
}
|
|
|
|
|
}
|