使用yalantinglibs reflection 库可以很方便的将对象序列化到自定义格式,比如将一个对象序列化成一个简单的 json5 格式,json5 的 key 是没有引号的。 只需要通过反射 API for_each 拿到对象的字段值和字段名就够了。 structpoint{intx;inty;};voidtest_json5() {pointpt{2,4};std::stringjson5;json5.ap...
yaLanTingLibs is a collection of C++20 libraries, now it contains struct_pack, struct_json, struct_xml, struct_pb, easylog, coro_rpc, coro_http and async_simple, more and more cool libraries will be added into yaLanTingLibs(such as http.) in the future....
A collection of modern C++ libraries, include coro_rpc, struct_pack, struct_json, struct_xml, struct_pb, easylog, async_simple - yalantinglibs/website/package.json at 9a7b36ac0a4fcdf948d61cb8fd19b4078ebb18dd · alibaba/yalantinglibs
void test_json5() { point pt{2, 4}; std::string json5; json5.append("{"); ylt::reflection::for_each(pt, [&](auto& field, auto name) { json5.append(name).append(":").append(std::to_string(field)).append(","); }); json5.back() = '}'; CHECK(json5 == "{x:2,y...
因为proto 的自定义 message生成 struct_pb 时为 unique_ptr, 会导致对象复制时需要额外的深拷贝函数, 是否可以配置插件直接生成 T() address_book3是struct_pb的对象, struct_json::from_json(address_book3, str2); unique_ptr 字段为null, 不确定是不是bug proto文件
A collection of modern C++ libraries, include coro_rpc, struct_pack, struct_json, struct_xml, struct_pb, easylog, async_simple - yalantinglibs/src at main · alibaba/yalantinglibs
@@ -10,7 +10,7 @@ [中文版](./website/docs/zh/guide/what_is_yalantinglibs.md) -yaLanTingLibs is a collection of C++20 libraries, now it contains struct_pack, struct_json, struct_pb, easylog, coro_rpc, coro_http and [async_simple](https://github.com/alibaba/async_simple), ...
(BUILD_STRUCT_JSON ON) Set(BUILD_STRUCT_XML ON) Set(BUILD_STRUCT_YAML ON) endif() foreach(child ${children}) get_filename_component(subdir_name ${child} NAME) string(TOUPPER ${subdir_name} subdir_name) if((${subdir_name} STREQUAL "STRUCT_PACK" OR ${subdir_name} STREQUAL ...
A collection of modern C++ libraries, include coro_rpc, struct_pack, struct_json, struct_xml, struct_pb, easylog, async_simple - Issues · alibaba/yalantinglibs
A collection of modern C++ libraries, include coro_http, coro_rpc, compile-time reflection, struct_pack, struct_json, struct_xml, struct_pb, easylog, async_simple etc. - Release Release lts1.0.2 · alibaba/yalantinglibs