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,
110 void processItemDefCategoryInfoNode(
111 pugi::xml_node& node,
113 virtual void processCategoryInfoNode(
114 pugi::xml_node& node,
118 virtual void processDefinitionInformation(pugi::xml_node& defNode);
119 void processDefinitionInformationChildren(pugi::xml_node& node);
120 void createDefinition(pugi::xml_node& defNode);
124 virtual void processDefinitionContents(
125 pugi::xml_node& defNode,
127 virtual void processDefinitionChildNode(
128 pugi::xml_node& node,
132 virtual void processAttribute(pugi::xml_node& attNode);
138 virtual void processItemDefAtts(
139 pugi::xml_node& node,
141 virtual void processItemDefContents(
142 pugi::xml_node& node,
144 virtual void processItemDefChildNode(
145 pugi::xml_node& node,
153 void processDoubleDefContents(
154 pugi::xml_node& node,
156 virtual void processDoubleDefChildNode(
157 pugi::xml_node& node,
161 virtual void processDirectoryDef(
162 pugi::xml_node& node,
171 void processIntDefContents(
172 pugi::xml_node& node,
174 virtual void processIntDefChildNode(
175 pugi::xml_node& node,
181 virtual void processStringDefAtts(
182 pugi::xml_node& node,
184 void processStringDefContents(
185 pugi::xml_node& node,
187 virtual void processStringDefChildNode(
188 pugi::xml_node& node,
192 void processModelEntityDef(
193 pugi::xml_node& node,
196 virtual void processMeshEntityDef(
197 pugi::xml_node& node,
200 virtual void processDateTimeDef(
201 pugi::xml_node& node,
204 virtual void processReferenceDef(
205 pugi::xml_node& node,
207 const std::string& labelsElement =
"ReferenceLabels");
209 virtual void processResourceDef(
210 pugi::xml_node& node,
213 virtual void processComponentDef(
214 pugi::xml_node& node,
218 void processValueDefAtts(
219 pugi::xml_node& node,
221 void processValueDefChildNode(
222 pugi::xml_node& node,
237 bool getColor(pugi::xml_node& node,
double color[3],
const std::string& colorName);
242 void processItemDefinitionBlocks(
243 pugi::xml_node& rootNode,
244 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>>& globalTemplateMap);
247 void processTemplatesDefinitions(
248 pugi::xml_node& rootNode,
249 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>>& globalTemplateMap);
254 virtual void processHints(pugi::xml_node& root);
257 static int decodeColorInfo(
const std::string& s,
double* color);
262 bool createXmlFromTemplate(pugi::xml_node& instanceInfo, pugi::xml_node& instancedNode);
264 void releaseXmlTemplate(pugi::xml_node& instancedNode);
266 bool m_reportAsError{
true };
268 std::vector<ItemExpressionInfo> m_itemExpressionInfo;
269 std::vector<AttRefInfo> m_attRefInfo;
270 std::string m_defaultCategory;
272 std::size_t m_includeIndex{ 0 };
273 std::map<std::string, std::set<std::string>> m_activeTemplates;
274 std::map<std::string, std::map<std::string, smtk::io::TemplateInfo>> m_localTemplateMap;