protobufclassgenerator.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>, Tatyana Borisova <tanusshhka@mail.ru>
  5. *
  6. * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy of this
  9. * software and associated documentation files (the "Software"), to deal in the Software
  10. * without restriction, including without limitation the rights to use, copy, modify,
  11. * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
  12. * to permit persons to whom the Software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in all copies
  16. * or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  19. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  20. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  21. * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. */
  25. #include "protobufclassgenerator.h"
  26. #include "utils.h"
  27. #include <iostream>
  28. #include <google/protobuf/descriptor.h>
  29. #include <google/protobuf/io/zero_copy_stream.h>
  30. using namespace ::qtprotobuf::generator;
  31. using namespace ::google::protobuf;
  32. using namespace ::google::protobuf::io;
  33. using namespace ::google::protobuf::compiler;
  34. namespace {
  35. const std::string VariantList("QVariantList");
  36. }
  37. ProtobufClassGenerator::ProtobufClassGenerator(const Descriptor *message, std::unique_ptr<::google::protobuf::io::ZeroCopyOutputStream> out)
  38. : ClassGeneratorBase(message->full_name(), std::move(out))
  39. , mMessage(message)
  40. {
  41. }
  42. void ProtobufClassGenerator::printCopyFunctionality()
  43. {
  44. assert(mMessage != nullptr);
  45. mPrinter.Print({{"classname", mClassName}},
  46. Templates::CopyConstructorTemplate);
  47. Indent();
  48. for (int i = 0; i < mMessage->field_count(); i++) {
  49. printField(mMessage->field(i), Templates::CopyFieldTemplate);
  50. }
  51. Outdent();
  52. mPrinter.Print(Templates::SimpleBlockEnclosureTemplate);
  53. mPrinter.Print({{"classname", mClassName}},
  54. Templates::AssignmentOperatorTemplate);
  55. Indent();
  56. for (int i = 0; i < mMessage->field_count(); i++) {
  57. printField(mMessage->field(i), Templates::CopyFieldTemplate);
  58. }
  59. mPrinter.Print(Templates::AssignmentOperatorReturnTemplate);
  60. Outdent();
  61. mPrinter.Print(Templates::SimpleBlockEnclosureTemplate);
  62. }
  63. void ProtobufClassGenerator::printMoveSemantic()
  64. {
  65. assert(mMessage != nullptr);
  66. mPrinter.Print({{"classname", mClassName}},
  67. Templates::MoveConstructorTemplate);
  68. Indent();
  69. for (int i = 0; i < mMessage->field_count(); i++) {
  70. const FieldDescriptor* field = mMessage->field(i);
  71. if (isComplexType(field) || field->is_repeated()) {
  72. printField(field, Templates::MoveComplexFieldTemplate);
  73. } else {
  74. if (field->type() != FieldDescriptor::TYPE_ENUM) {
  75. printField(field, Templates::MoveFieldTemplate);
  76. }
  77. else {
  78. printField(field, Templates::EnumMoveFieldTemplate);
  79. }
  80. }
  81. }
  82. Outdent();
  83. mPrinter.Print(Templates::SimpleBlockEnclosureTemplate);
  84. mPrinter.Print({{"classname", mClassName}},
  85. Templates::MoveAssignmentOperatorTemplate);
  86. Indent();
  87. for (int i = 0; i < mMessage->field_count(); i++) {
  88. const FieldDescriptor* field = mMessage->field(i);
  89. if (isComplexType(field) || field->is_repeated()) {
  90. printField(field, Templates::MoveComplexFieldTemplate);
  91. } else {
  92. if (field->type() != FieldDescriptor::TYPE_ENUM) {
  93. printField(field, Templates::MoveFieldTemplate);
  94. }
  95. else {
  96. printField(field, Templates::EnumMoveFieldTemplate);
  97. }
  98. }
  99. }
  100. mPrinter.Print(Templates::AssignmentOperatorReturnTemplate);
  101. Outdent();
  102. mPrinter.Print(Templates::SimpleBlockEnclosureTemplate);
  103. }
  104. void ProtobufClassGenerator::printComparisonOperators()
  105. {
  106. assert(mMessage != nullptr);
  107. bool isFirst = true;
  108. PropertyMap properties;
  109. mPrinter.Print({{"type", mClassName}}, Templates::EqualOperatorTemplate);
  110. for (int i = 0; i < mMessage->field_count(); i++) {
  111. const FieldDescriptor* field = mMessage->field(i);
  112. if (producePropertyMap(field, properties)) {
  113. if (!isFirst) {
  114. mPrinter.Print("\n&& ");
  115. } else {
  116. Indent();
  117. Indent();
  118. isFirst = false;
  119. }
  120. mPrinter.Print(properties, Templates::EqualOperatorPropertyTemplate);
  121. }
  122. }
  123. //Only if at least one field "copied"
  124. if (!isFirst) {
  125. Outdent();
  126. Outdent();
  127. }
  128. mPrinter.Print(";\n");
  129. mPrinter.Print(Templates::SimpleBlockEnclosureTemplate);
  130. mPrinter.Print({{"type", mClassName}}, Templates::NotEqualOperatorTemplate);
  131. }
  132. void ProtobufClassGenerator::printIncludes()
  133. {
  134. assert(mMessage != nullptr);
  135. mPrinter.Print(Templates::DefaultProtobufIncludesTemplate);
  136. std::set<std::string> existingIncludes;
  137. for (int i = 0; i < mMessage->field_count(); i++) {
  138. printInclude(mMessage->field(i), existingIncludes);
  139. }
  140. }
  141. void ProtobufClassGenerator::printInclude(const FieldDescriptor *field, std::set<std::string> &existingIncludes)
  142. {
  143. assert(field != nullptr);
  144. std::string newInclude;
  145. const char* includeTemplate;
  146. switch (field->type()) {
  147. case FieldDescriptor::TYPE_MESSAGE:
  148. if ( field->is_map() ) {
  149. newInclude = "QMap";
  150. assert(field->message_type() != nullptr);
  151. assert(field->message_type()->field_count() == 2);
  152. printInclude(field->message_type()->field(0), existingIncludes);
  153. printInclude(field->message_type()->field(1), existingIncludes);
  154. includeTemplate = Templates::ExternalIncludeTemplate;
  155. } else {
  156. std::string typeName = field->message_type()->name();
  157. utils::tolower(typeName);
  158. newInclude = typeName;
  159. includeTemplate = Templates::InternalIncludeTemplate;
  160. }
  161. break;
  162. case FieldDescriptor::TYPE_BYTES:
  163. newInclude = "QByteArray";
  164. includeTemplate = Templates::ExternalIncludeTemplate;
  165. break;
  166. case FieldDescriptor::TYPE_STRING:
  167. newInclude = "QString";
  168. includeTemplate = Templates::ExternalIncludeTemplate;
  169. break;
  170. case FieldDescriptor::TYPE_ENUM: {
  171. EnumVisibility enumVisibily = getEnumVisibility(field);
  172. if (enumVisibily == GLOBAL_ENUM) {
  173. includeTemplate = Templates::GlobalEnumIncludeTemplate;
  174. } else if (enumVisibily == NEIGHBOUR_ENUM){
  175. includeTemplate = Templates::InternalIncludeTemplate;
  176. std::string fullEnumName = field->enum_type()->full_name();
  177. std::vector<std::string> fullEnumNameParts;
  178. utils::split(fullEnumName, fullEnumNameParts, '.');
  179. std::string enumTypeOwner = fullEnumNameParts.at(fullEnumNameParts.size() - 2);
  180. utils::tolower(enumTypeOwner);
  181. newInclude = enumTypeOwner;
  182. } else {
  183. return;
  184. }
  185. }
  186. break;
  187. default:
  188. return;
  189. }
  190. if (existingIncludes.find(newInclude) == std::end(existingIncludes)) {
  191. mPrinter.Print({{"include", newInclude}}, includeTemplate);
  192. existingIncludes.insert(newInclude);
  193. }
  194. }
  195. void ProtobufClassGenerator::printField(const FieldDescriptor *field, const char *fieldTemplate)
  196. {
  197. assert(field != nullptr);
  198. std::map<std::string, std::string> propertyMap;
  199. if (producePropertyMap(field, propertyMap)) {
  200. mPrinter.Print(propertyMap, fieldTemplate);
  201. }
  202. }
  203. template<typename T>
  204. std::string ProtobufClassGenerator::getNamespacesList(const T *message, std::vector<std::string> &container)
  205. {
  206. std::string result;
  207. utils::split(std::string(message->full_name()), container, '.');
  208. if (container.size() > 1) {
  209. //delete type name -> only namespace stays
  210. container.pop_back();
  211. for (size_t i = 0; i < container.size(); i++) {
  212. if (i > 0) {
  213. result = result.append("::");
  214. }
  215. result = result.append(container[i]);
  216. }
  217. }
  218. if (container.size() > 0
  219. && mNamespacesColonDelimited != result) {
  220. result = result.append("::");
  221. } else {
  222. result.clear();
  223. }
  224. return result;
  225. }
  226. std::string ProtobufClassGenerator::getTypeName(const FieldDescriptor *field)
  227. {
  228. assert(field != nullptr);
  229. std::string typeName;
  230. std::string namespaceQtProtoDefinition("qtprotobuf::");
  231. std::string namespaceTypeName;
  232. std::vector<std::string> typeNamespace;
  233. if (field->type() == FieldDescriptor::TYPE_MESSAGE) {
  234. const Descriptor *msg = field->message_type();
  235. namespaceTypeName = getNamespacesList(msg, typeNamespace);
  236. typeName = namespaceTypeName.append(msg->name());
  237. if (field->is_map()) {
  238. return mClassName + "::" + field->message_type()->name();
  239. }
  240. if (field->is_repeated()) {
  241. return namespaceTypeName.append("List");
  242. }
  243. } else if (field->type() == FieldDescriptor::TYPE_ENUM) {
  244. const EnumDescriptor *enumType = field->enum_type();
  245. namespaceTypeName = getNamespacesList(enumType, typeNamespace);
  246. EnumVisibility visibility = getEnumVisibility(field);
  247. if (visibility == LOCAL_ENUM) {
  248. if(field->is_repeated()) {
  249. typeName = typeName.append(mClassName + "::" + enumType->name());
  250. } else {
  251. typeName = typeName.append(enumType->name());
  252. }
  253. } else if (visibility == GLOBAL_ENUM) {
  254. typeName = namespaceTypeName.append(Templates::GlobalEnumClassNameTemplate)
  255. .append("::").append(enumType->name());
  256. } else {
  257. typeName = namespaceTypeName.append(enumType->name());
  258. }
  259. if (field->is_repeated()) {
  260. return typeName.append("List");
  261. }
  262. } else {
  263. auto it = Templates::TypeReflection.find(field->type());
  264. if (it != std::end(Templates::TypeReflection)) {
  265. if (field->type() != FieldDescriptor::TYPE_STRING
  266. && field->type() != FieldDescriptor::TYPE_BYTES
  267. && field->type() != FieldDescriptor::TYPE_BOOL
  268. && field->type() != FieldDescriptor::TYPE_FLOAT
  269. && field->type() != FieldDescriptor::TYPE_DOUBLE) {
  270. typeName = typeName.append(namespaceQtProtoDefinition.append(it->second));
  271. } else {
  272. typeName = typeName.append(it->second);
  273. }
  274. if (field->is_repeated()) {
  275. if (field->type() == FieldDescriptor::TYPE_FLOAT
  276. || field->type() == FieldDescriptor::TYPE_DOUBLE) {
  277. typeName[0] = ::toupper(typeName[0]);
  278. typeName = namespaceQtProtoDefinition.append(typeName);
  279. }
  280. typeName.append("List");
  281. }
  282. }
  283. }
  284. return typeName;
  285. }
  286. bool ProtobufClassGenerator::producePropertyMap(const FieldDescriptor *field, PropertyMap &propertyMap)
  287. {
  288. assert(field != nullptr);
  289. std::string typeName = getTypeName(field);
  290. if (typeName.size() <= 0) {
  291. std::cerr << "Type "
  292. << field->type_name()
  293. << " is not supported by Qt Generator"
  294. " please look at https://doc.qt.io/qt-5/qtqml-typesystem-basictypes.html"
  295. " for details" << std::endl;
  296. return false;
  297. }
  298. std::string typeNameLower(typeName);
  299. utils::tolower(typeNameLower);
  300. std::string capProperty = field->camelcase_name();
  301. capProperty[0] = ::toupper(capProperty[0]);
  302. propertyMap = {{"type", typeName},
  303. {"type_lower", typeNameLower},
  304. {"property_name", field->camelcase_name()},
  305. {"property_name_cap", capProperty}};
  306. return true;
  307. }
  308. bool ProtobufClassGenerator::isListType(const FieldDescriptor *field)
  309. {
  310. assert(field != nullptr);
  311. return field && field->is_repeated()
  312. && field->type() == FieldDescriptor::TYPE_MESSAGE;
  313. }
  314. bool ProtobufClassGenerator::isComplexType(const FieldDescriptor *field)
  315. {
  316. assert(field != nullptr);
  317. return field->type() == FieldDescriptor::TYPE_MESSAGE
  318. || field->type() == FieldDescriptor::TYPE_STRING
  319. || field->type() == FieldDescriptor::TYPE_BYTES;
  320. }
  321. void ProtobufClassGenerator::printConstructor()
  322. {
  323. std::string parameterList;
  324. for (int i = 0; i < mMessage->field_count(); i++) {
  325. const FieldDescriptor* field = mMessage->field(i);
  326. std::string fieldTypeName = getTypeName(field);
  327. std::string fieldName = field->name();
  328. fieldName[0] = ::tolower(fieldName[0]);
  329. if (field->is_repeated() || field->is_map()) {
  330. parameterList += "const " + fieldTypeName + " &" + fieldName + " = {}";
  331. } else {
  332. switch (field->type()) {
  333. case FieldDescriptor::TYPE_DOUBLE:
  334. case FieldDescriptor::TYPE_FLOAT:
  335. parameterList += fieldTypeName + " " + fieldName + " = " + "0.0";
  336. break;
  337. case FieldDescriptor::TYPE_FIXED32:
  338. case FieldDescriptor::TYPE_FIXED64:
  339. case FieldDescriptor::TYPE_INT32:
  340. case FieldDescriptor::TYPE_INT64:
  341. case FieldDescriptor::TYPE_SINT32:
  342. case FieldDescriptor::TYPE_SINT64:
  343. case FieldDescriptor::TYPE_UINT32:
  344. case FieldDescriptor::TYPE_UINT64:
  345. parameterList += fieldTypeName + " " + fieldName + " = " + "0";
  346. break;
  347. case FieldDescriptor::TYPE_BOOL:
  348. parameterList += fieldTypeName + " " + fieldName + " = " + "false";
  349. break;
  350. case FieldDescriptor::TYPE_BYTES:
  351. case FieldDescriptor::TYPE_STRING:
  352. case FieldDescriptor::TYPE_MESSAGE:
  353. parameterList += "const " + fieldTypeName + " &" + fieldName + " = {}";
  354. break;
  355. default:
  356. parameterList += fieldTypeName + " " + fieldName + " = " + "{}";
  357. break;
  358. }
  359. }
  360. parameterList += ", ";
  361. }
  362. mPrinter.Print({{"classname", mClassName},
  363. {"parameter_list", parameterList}}, Templates::ProtoConstructorTemplate);
  364. for (int i = 0; i < mMessage->field_count(); i++) {
  365. const FieldDescriptor* field = mMessage->field(i);
  366. std::string fieldName = field->name();
  367. fieldName[0] = ::tolower(fieldName[0]);
  368. mPrinter.Print({{"property_name", fieldName}}, Templates::PropertyInitializerTemplate);
  369. }
  370. mPrinter.Print(Templates::ConstructorContentTemplate);
  371. }
  372. void ProtobufClassGenerator::printMaps()
  373. {
  374. Indent();
  375. for (int i = 0; i < mMessage->field_count(); i++) {
  376. const FieldDescriptor* field = mMessage->field(i);
  377. if (field->is_map()) {
  378. std::string keyType = getTypeName(field->message_type()->field(0));
  379. std::string valueType = getTypeName(field->message_type()->field(1));
  380. mPrinter.Print({{"classname",field->message_type()->name()},
  381. {"key", keyType},
  382. {"value", valueType}}, Templates::MapTypeUsingTemplate);
  383. }
  384. }
  385. Outdent();
  386. }
  387. void ProtobufClassGenerator::printLocalEmumsMetaTypesDeclaration()
  388. {
  389. for (int i = 0; i < mMessage->field_count(); i++) {
  390. const FieldDescriptor* field = mMessage->field(i);
  391. if (field == nullptr || field->enum_type() == nullptr)
  392. continue;
  393. if (field->type() == FieldDescriptor::TYPE_ENUM
  394. && isLocalMessageEnum(mMessage, field)) {
  395. mPrinter.Print({{"classname", mClassName + "::" + field->enum_type()->name() + "List"},
  396. {"namespaces", mNamespacesColonDelimited}}, Templates::DeclareMetaTypeTemplate);
  397. }
  398. }
  399. }
  400. void ProtobufClassGenerator::printMapsMetaTypesDeclaration()
  401. {
  402. for (int i = 0; i < mMessage->field_count(); i++) {
  403. const FieldDescriptor* field = mMessage->field(i);
  404. if (field->is_map()) {
  405. mPrinter.Print({{"classname", field->message_type()->name()},
  406. {"namespaces", mNamespacesColonDelimited + "::" + mClassName}}, Templates::DeclareMetaTypeTemplate);
  407. }
  408. }
  409. }
  410. void ProtobufClassGenerator::printProperties()
  411. {
  412. assert(mMessage != nullptr);
  413. //private section
  414. Indent();
  415. for (int i = 0; i < mMessage->field_count(); i++) {
  416. const FieldDescriptor* field = mMessage->field(i);
  417. const char* propertyTemplate = field->type() == FieldDescriptor::TYPE_MESSAGE ? Templates::MessagePropertyTemplate :
  418. Templates::PropertyTemplate;
  419. printField(field, propertyTemplate);
  420. }
  421. Outdent();
  422. printQEnums(mMessage);
  423. //public section
  424. printPublic();
  425. printMaps();
  426. //Body
  427. Indent();
  428. printConstructor();
  429. printCopyFunctionality();
  430. printMoveSemantic();
  431. printComparisonOperators();
  432. for (int i = 0; i < mMessage->field_count(); i++) {
  433. printField(mMessage->field(i), Templates::GetterTemplate);
  434. }
  435. for (int i = 0; i < mMessage->field_count(); i++) {
  436. auto field = mMessage->field(i);
  437. if (field->type() == FieldDescriptor::TYPE_MESSAGE
  438. || field->type() == FieldDescriptor::TYPE_STRING) {
  439. printField(field, Templates::SetterTemplateComplexType);
  440. } else {
  441. printField(field, Templates::SetterTemplateSimpleType);
  442. }
  443. }
  444. Outdent();
  445. mPrinter.Print(Templates::SignalsBlockTemplate);
  446. Indent();
  447. for (int i = 0; i < mMessage->field_count(); i++) {
  448. printField(mMessage->field(i), Templates::SignalTemplate);
  449. }
  450. Outdent();
  451. }
  452. void ProtobufClassGenerator::printRegisterTypes()
  453. {
  454. Indent();
  455. mPrinter.Print(Templates::ComplexTypeRegistrationMethodTemplate);
  456. Outdent();
  457. }
  458. void ProtobufClassGenerator::printListType()
  459. {
  460. mPrinter.Print({{"classname", mClassName}}, Templates::ComplexListTypeUsingTemplate);
  461. }
  462. void ProtobufClassGenerator::printFieldsOrderingDefinition()
  463. {
  464. Indent();
  465. mPrinter.Print(Templates::FieldsOrderingDefinitionContainerTemplate);
  466. Outdent();
  467. }
  468. ProtobufClassGenerator::EnumVisibility ProtobufClassGenerator::getEnumVisibility(const FieldDescriptor *field)
  469. {
  470. assert(field->enum_type() != nullptr);
  471. if (isLocalMessageEnum(mMessage, field)) {
  472. return LOCAL_ENUM;
  473. }
  474. const EnumDescriptor *enumType = field->enum_type();
  475. const FileDescriptor *enumFile = field->enum_type()->file();
  476. for (int i = 0; i < enumFile->message_type_count(); i++) {
  477. const Descriptor* msg = enumFile->message_type(i);
  478. for (int j = 0; j < msg->enum_type_count(); j++) {
  479. if (enumType->full_name() == msg->enum_type(j)->full_name()) {
  480. return NEIGHBOUR_ENUM;
  481. }
  482. }
  483. }
  484. return GLOBAL_ENUM;
  485. }
  486. void ProtobufClassGenerator::printClassMembers()
  487. {
  488. Indent();
  489. for (int i = 0; i < mMessage->field_count(); i++) {
  490. printField(mMessage->field(i), Templates::MemberTemplate);
  491. }
  492. Outdent();
  493. }
  494. std::set<std::string> ProtobufClassGenerator::extractModels() const
  495. {
  496. std::set<std::string> extractedModels;
  497. for (int i = 0; i < mMessage->field_count(); i++) {
  498. const FieldDescriptor* field = mMessage->field(i);
  499. if (field->is_repeated()
  500. && field->type() == FieldDescriptor::TYPE_MESSAGE) {
  501. std::string typeName = field->message_type()->name();
  502. extractedModels.insert(typeName);
  503. }
  504. }
  505. return std::move(extractedModels);
  506. }
  507. void ProtobufClassGenerator::printSerializers()
  508. {
  509. Indent();
  510. mPrinter.Print({{"classname", mClassName}}, Templates::SerializersTemplate);
  511. Outdent();
  512. }
  513. void ProtobufClassGenerator::run()
  514. {
  515. printPreamble();
  516. printIncludes();
  517. printNamespaces();
  518. printClassDeclaration();
  519. printProperties();
  520. printPublic();
  521. printRegisterTypes();
  522. printFieldsOrderingDefinition();
  523. printSerializers();
  524. printPrivate();
  525. printClassMembers();
  526. encloseClass();
  527. printListType();
  528. encloseNamespaces();
  529. printMetaTypeDeclaration();
  530. printMapsMetaTypesDeclaration();
  531. printLocalEmumsMetaTypesDeclaration();
  532. }