27 #include <SimoxUtility/meta/type_name.h>
35 "std::map<std::string, " + FromAronType(*e.getAcceptedType())->getFullInstantiatedCppTypename() +
">",
36 "std::map<std::string, " + FromAronType(*e.getAcceptedType())->getFullInstantiatedCppTypename() +
">",
38 simox::meta::get_type_name<type::dto::
Dict>(), e)
46 return c->getRequiredIncludes();
51 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
52 block_if_data->addLine(cppAccessor +
nextEl() +
"clear();");
63 std::string nextVariantAccessor;
65 b->appendBlock(type_s->getWriteTypeBlock(type_s->getInstantiatedCppTypename(), cppAccessor +
nextEl() +
"accepted_type", nextPath, nextVariantAccessor));
67 b->addLine(
"auto " + variantAccessor +
" = " +
ARON_WRITER_ACCESSOR +
".writeDict(" + nextVariantAccessor +
", " +
76 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
80 const std::string elementsAccessor = variantAccessor +
"_dictElements";
81 block_if_data->addLine(
"std::map<std::string, _Aron_T> " + elementsAccessor +
";");
87 block_if_data->addLine(
"for (const auto& [" + accessor_iterator_key +
", " + accessor_iterator_val +
"] : " + resolved_accessor +
") ");
90 CppBlockPtr for_loop = std::make_shared<CppBlock>();
91 std::string nextVariantAccessor;
93 auto child_b = type_s->getWriteBlock(accessor_iterator_val, nextPath, nextVariantAccessor);
94 for_loop->addLine(
"auto " + nextVariantAccessor +
" = " +
ARON_WRITER_ACCESSOR +
".writeNull();");
95 for_loop->appendBlock(child_b);
96 for_loop->addLine(elementsAccessor +
".emplace(" + accessor_iterator_key +
", " + nextVariantAccessor +
");");
97 block_if_data->addBlock(for_loop);
101 ".writeDict(" + elementsAccessor +
", " +
110 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
112 std::string elements_accessor =
ARON_VARIABLE_PREFIX +
"_" + escaped_accessor +
"_dictElements";
113 std::string accessor_iterator_value =
ARON_VARIABLE_PREFIX +
"_" + escaped_accessor +
"_dictValue";
116 block_if_data->addLine(
"std::map<std::string, _Aron_TNonConst> " + elements_accessor +
";");
117 block_if_data->addLine(
"" +
ARON_READER_ACCESSOR +
".readDict(" + variantAccessor +
", " + elements_accessor +
");");
118 block_if_data->addLine(
"for (const auto& [" + accessor_iterator_key +
", " + accessor_iterator_value +
"] : " + elements_accessor +
")");
121 CppBlockPtr for_loop = std::make_shared<CppBlock>();
123 for_loop->addLine(type_s->getFullInstantiatedCppTypename() +
" " + accessor_iterator_tmp +
";");
124 for_loop->appendBlock(type_s->getReadBlock(accessor_iterator_tmp, accessor_iterator_value));
125 for_loop->addLine(cppAccessor +
nextEl() +
"insert({" + accessor_iterator_key +
", " + accessor_iterator_tmp +
"});");
126 block_if_data->addBlock(for_loop);