mbxmlutils  1.3.0
Multi-Body XML Utils
preprocess.h
1 #ifndef _MBXMLUTILS_PREPROCESS_H_
2 #define _MBXMLUTILS_PREPROCESS_H_
3 
4 #include <fmatvec/atom.h>
5 #include <mbxmlutilshelper/dom.h>
6 #include <mbxmlutils/eval.h>
7 
8 namespace MBXMLUtils {
9 
10 class Preprocess : virtual public fmatvec::Atom {
11  protected:
12  using PositionMap = std::map<FQN, int>;
13  public:
14  using ParamSet = std::map<std::string, Eval::Value>;
15  static void preprocess(const std::shared_ptr<MBXMLUtils::DOMParser>& parser, // in: parser used to parse XML documents
16  const std::shared_ptr<Eval> &eval, // in: evaluator used for evaluation
17  std::vector<boost::filesystem::path> &dependencies, // out: list of dependent files
18  xercesc::DOMElement *&e, // in: element to process; out: e changes only if e is itself a Embed element
19  // in: root level parameters to overwrite; out: root level parameters
20  const std::shared_ptr<ParamSet>& param=std::shared_ptr<ParamSet>(),
21 
22  // internal: XPath expression of parent element
23  const std::string &parentXPath="",
24  // internal: XPath expression of parent element
25  int embedXPathCount=1,
26  // internal: XPath position count of the element e
27  const std::shared_ptr<PositionMap>& position=std::make_shared<PositionMap>()
28  );
29 
30  // same as process but reads from mainXML and return preprocessed DOMDocument.
31  static std::shared_ptr<xercesc::DOMDocument> preprocessFile(
32  std::vector<boost::filesystem::path> &dependencies, const std::variant<boost::filesystem::path, xercesc::DOMElement*> &xmlCatalog,
33  const boost::filesystem::path &mainXML);
34 };
35 
36 }
37 
38 #endif
Definition: preprocess.h:10