14 #ifndef smtk_io_XmlDocV1Parser_h
15 #define smtk_io_XmlDocV1Parser_h
17 #include "smtk/CoreExports.h"
24 #include "smtk/io/TemplateInfo.h"
26 #include "smtk/attribute/Categories.h"
27 #include "smtk/attribute/Resource.h"
29 #include "smtk/model/EntityTypeBits.h"
47 class XmlDocV1ParserInternals;
72 virtual void process(pugi::xml_document& doc);
73 virtual void process(pugi::xml_node& rootNode);
75 pugi::xml_node& rootNode,
76 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>>& globalTemplateMap);
79 static void convertStringToXML(std::string& str);
81 void setReportDuplicateDefinitionsAsErrors(
bool mode) { m_reportAsError = mode; }
83 static bool canParse(pugi::xml_document& doc);
84 static bool canParse(pugi::xml_node& node);
85 static pugi::xml_node getRootNode(pugi::xml_document& doc);
86 static void getCategories(
87 pugi::xml_node& rootNode,
88 std::set<std::string>& categories,
89 std::string& defaultCategory);
90 void setIncludeFileIndex(std::size_t index) { m_includeIndex = index; }
91 static bool getCategoryComboMode(
92 pugi::xml_attribute& xmlAtt,
96 void processAttributeInformation(pugi::xml_node& root);
97 virtual void processViews(pugi::xml_node& root);
100 virtual void processAssociationRules(pugi::xml_node&) {}
103 virtual void processConfigurations(pugi::xml_node&) {}
105 virtual void processCategoryAtts(
106 pugi::xml_node& node,
109 void processOldStyleCategoryNode(
110 pugi::xml_node& node,
112 void processItemDefCategoryInfoNode(
113 pugi::xml_node& node,
115 virtual void processCategoryInfoNode(
116 pugi::xml_node& node,
120 virtual void processDefinitionInformation(pugi::xml_node& defNode);
121 void processDefinitionInformationChildren(pugi::xml_node& node);
122 void createDefinition(pugi::xml_node& defNode);
124 void processAnalysisInformationChildren(pugi::xml_node& node);
125 void createAnalysis(pugi::xml_node& analysisNode);
129 virtual void processDefinitionContents(
130 pugi::xml_node& defNode,
132 virtual void processDefinitionChildNode(
133 pugi::xml_node& node,
137 virtual void processAttribute(pugi::xml_node& attNode);
143 virtual void processItemDefAtts(
144 pugi::xml_node& node,
146 virtual void processItemDefContents(
147 pugi::xml_node& node,
149 virtual void processItemDefChildNode(
150 pugi::xml_node& node,
158 void processDoubleDefContents(
159 pugi::xml_node& node,
161 virtual void processDoubleDefChildNode(
162 pugi::xml_node& node,
166 virtual void processDirectoryDef(
167 pugi::xml_node& node,
176 void processIntDefContents(
177 pugi::xml_node& node,
179 virtual void processIntDefChildNode(
180 pugi::xml_node& node,
186 virtual void processStringDefAtts(
187 pugi::xml_node& node,
189 void processStringDefContents(
190 pugi::xml_node& node,
192 virtual void processStringDefChildNode(
193 pugi::xml_node& node,
197 void processModelEntityDef(
198 pugi::xml_node& node,
201 virtual void processMeshEntityDef(
202 pugi::xml_node& node,
205 virtual void processDateTimeDef(
206 pugi::xml_node& node,
209 virtual void processReferenceDef(
210 pugi::xml_node& node,
212 const std::string& labelsElement =
"ReferenceLabels");
214 virtual void processResourceDef(
215 pugi::xml_node& node,
218 virtual void processComponentDef(
219 pugi::xml_node& node,
223 void processValueDefAtts(
224 pugi::xml_node& node,
226 void processValueDefChildNode(
227 pugi::xml_node& node,
242 bool getColor(pugi::xml_node& node,
double color[3],
const std::string& colorName);
247 void processItemDefinitionBlocks(
248 pugi::xml_node& rootNode,
249 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>>& globalTemplateMap);
252 void processTemplatesDefinitions(
253 pugi::xml_node& rootNode,
254 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>>& globalTemplateMap);
259 virtual void processHints(pugi::xml_node& root);
262 static int decodeColorInfo(
const std::string& s,
double* color);
267 bool createXmlFromTemplate(pugi::xml_node& instanceInfo, pugi::xml_node& instancedNode);
269 void releaseXmlTemplate(pugi::xml_node& instancedNode);
271 bool m_reportAsError{
true };
273 std::vector<ItemExpressionInfo> m_itemExpressionInfo;
274 std::vector<AttRefInfo> m_attRefInfo;
275 std::string m_defaultCategory;
277 std::size_t m_includeIndex{ 0 };
278 std::map<std::string, std::set<std::string>> m_activeTemplates;
279 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>> m_localTemplateMap;