We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实例代码大概是这样:
class TestXmlBase { public: int id; std::string name; }; class TestXmlDerived:public TestXmlBase { public: int version; std::string tag; }; REFLECTION(TestXmlBase, id, name); REFLECTION(TestXmlDerived, id, name, version, tag); class TestXmlClassContainer { public: std::vector<std::shared_ptr<TestXmlBase>> content; }; REFLECTION(TestXmlClassContainer, content); void TestDerived() { TestXmlClassContainer c; auto d = std::make_shared<TestXmlDerived>(); auto b = std::make_shared<TestXmlBase>(); c.content.push_back(b); c.content.push_back(d); std::string ss; iguana::to_xml<true>(c, ss); }
实际输出目前是这样:
<TestXmlClassContainer> <content> <id>0</id> <name></name> </content> <content> <id>0</id> <name></name> </content> </TestXmlClassContainer>
希望能输出这样:
<TestXmlClassContainer> <content> <TestXmlBase> <id>0</id> <name></name> </TestXmlBase> <TestXmlDerived> <TestXmlBase> <id>0</id> <name></name> </TestXmlBase> <version>0</version> <tag></tag> <TestXmlDerived> </content> </TestXmlClassContainer>
The text was updated successfully, but these errors were encountered:
用智能指针的时候,如果是反射的类型把类型名字也当成一个tag?是可以做到的,有趣但不知道是否具有应用场景呢。
Sorry, something went wrong.
主要还是使用容器时需要,这种情况下没有办法处理子类部分。
[coro_rpc]compatible with clang11 && libstdc++-8 (qicosmos#237)
ec60e1f
No branches or pull requests
实例代码大概是这样:
实际输出目前是这样:
希望能输出这样:
The text was updated successfully, but these errors were encountered: