1 #ifndef _MBXMLUTILS_PREPROCESS_H_ 2 #define _MBXMLUTILS_PREPROCESS_H_ 4 #include <fmatvec/atom.h> 5 #include <mbxmlutilshelper/dom.h> 6 #include <mbxmlutils/eval.h> 12 using ParamSet = std::map<std::string, Eval::Value>;
16 Preprocess(
const boost::filesystem::path &inputFile,
18 std::shared_ptr<MBXMLUtils::DOMParser>,
20 boost::filesystem::path
25 Preprocess(
const std::shared_ptr<xercesc::DOMDocument> &inputDoc);
28 void setParam(
const std::shared_ptr<ParamSet>& param_);
30 std::shared_ptr<ParamSet>
getParam()
const;
42 std::shared_ptr<xercesc::DOMDocument> document;
43 std::vector<boost::filesystem::path> dependencies;
44 std::shared_ptr<Eval> eval;
45 std::shared_ptr<ParamSet> param;
47 bool preprocessed {
false };
49 std::map<boost::filesystem::path, std::shared_ptr<xercesc::DOMDocument>> parsedFiles;
50 std::shared_ptr<xercesc::DOMDocument> parseCached(
const std::shared_ptr<DOMParser> &parser,
51 const boost::filesystem::path &inputFile,
52 std::vector<boost::filesystem::path> &dependencies,
53 const std::string &msg);
55 void extractEvaluator();
57 using PositionMap = std::map<FQN, int>;
58 void preprocess(xercesc::DOMElement *&e,
60 const std::shared_ptr<ParamSet>& param=std::shared_ptr<ParamSet>(),
63 const std::string &parentXPath=
"",
65 int embedXPathCount=1,
67 const std::shared_ptr<PositionMap>& position=std::make_shared<PositionMap>()
std::shared_ptr< Eval > getEvaluator() const
Get the evaluator.
Definition: preprocess.cc:47
void setParam(const std::shared_ptr< ParamSet > ¶m_)
Set top level parameters to overwrite before processAndGetDocument is called.
Definition: preprocess.cc:51
Preprocess(const boost::filesystem::path &inputFile, std::variant< std::shared_ptr< MBXMLUtils::DOMParser >, xercesc::DOMElement *, boost::filesystem::path > parserVariant)
const std::vector< boost::filesystem::path > & getDependencies() const
Get all dependencies found during processAndGetDocument.
Definition: preprocess.cc:41
Definition: preprocess.h:10
std::shared_ptr< xercesc::DOMDocument > processAndGetDocument()
Start preprocessing and return the preprocessed DOMDocument.
Definition: preprocess.cc:84
std::shared_ptr< ParamSet > getParam() const
Get available top level parameters after processAndGetDocument is called.
Definition: preprocess.cc:55