#include "guid.h" #include "yaml/yaml.h" #include #include using namespace refl; using namespace std; void testGuid() { Guid guid = Guid::Make(); YAML::TextArchive::Register(); string text = YAML::Text_Serialize(guid); auto res = YAML::Text_Unserialize(text); Guid guid2 = res.value(); assert(guid == guid2); std::cout << guid << std::endl; } void testMeta() { MetaBundle mb1; mb1.metadatas.push_back({ Guid::Make() , "hello1" }); mb1.metadatas.push_back({ Guid::Make() , "hello2" }); mb1.metadatas.push_back({ Guid::Make() , "hello3" }); mb1.metadatas.push_back({ Guid::Make() , "hello4" }); string rmb1 = YAML::Text_Serialize(mb1); std::cout << rmb1 << std::endl; auto rmb2 = YAML::Text_Unserialize(rmb1); if (rmb2) { MetaBundle aa = rmb2.value(); std::cout << "success!" << std::endl; } } void testTuple() { std::map table; table.insert(std::make_pair(111,"hello")); table.insert(std::make_pair(222, "world")); using T = std::map; string rtable = YAML::Text_Serialize(table); std::cout << rtable << std::endl; auto table2 = YAML::Text_Unserialize>(rtable); if (table2) { std::map aa = table2.value(); std::cout << "success!" << std::endl; } } using size_impl = size_t(*)(const void*); int main() { constexpr bool m1 = refl::is_map_v>; constexpr bool m2 = refl::is_sequence_v>; auto cls = &TypeInfo::StaticClass; testGuid(); testMeta(); testTuple(); return 0; }