As implied by the title of the Q, I have a few entities and need to keep them as constant objects in a C++ project. Each entity contains very complex data structures (lists of enums, maps of maps, etc.). In addition, it is possible in future to have more entities for extending the project. For keeping the complex data of the entities, two approaches are proposed:
- Keep them as some external .xml files and load them when the project starts.
- This needs lots of convertors in the code to convert my C++ types into/from strings coming from xml file.
- I lose the type information in the .xml file. As a result, some changes in C++ code in future may require some changes in .xml files that cannot be easily detected.
- Keep them as some constant C++ object in some C++ files.
- For extending the project in future, I need to touch the code.
What do you recommend in this case? Keeping these complex constant data structures in the .xml files? or in C++ files?