From 6127552b8abf9fe0fd184f19d7d62f9ca6b42cd3 Mon Sep 17 00:00:00 2001 From: "marek.piotrowski" Date: Thu, 20 Jul 2023 00:19:21 +0200 Subject: [PATCH] Added static annotations --- example/main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/example/main.cpp b/example/main.cpp index 8de05924b..166107f85 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -19,11 +19,30 @@ public: property3, "comment3"); }; +class AnotherExampleClass { +private: + int property1{1}; + double property2{2.5}; + std::string property3{"test"}; + std::map property4{{"x", 1}, {"y", 2}}; + std::vector property5{1.5, 5.4, 3.2}; +public: + AnotherExampleClass() = default; + + NLOHMANN_DEFINE_TYPE_INTRUSIVE_ANNOTATED(AnotherExampleClass, property1, "comment11", + property2, "comment22", + property3, "comment33"); +}; + int main() { std::cout << "Hello, world!" << std::endl; ExampleClass ec; + AnotherExampleClass aec; nlohmann::json j = ec; std::cout << j.dump_annotated() << std::endl; + + nlohmann::json j2 = aec; + std::cout << j2.dump_annotated() << std::endl; return 0; } \ No newline at end of file