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;
47 std::shared_ptr<xercesc::DOMDocument> document;
48 std::vector<boost::filesystem::path> dependencies;
49 std::shared_ptr<Eval> eval;
50 std::shared_ptr<ParamSet> param;
51 std::shared_ptr<DOMParser> noneValidatingParser;
52 static const FQN embedFileNotFound;
54 bool preprocessed {
false };
56 std::map<boost::filesystem::path, std::shared_ptr<xercesc::DOMDocument>> parsedFiles;
57 std::shared_ptr<xercesc::DOMDocument> parseCached(
const std::shared_ptr<DOMParser> &parser,
58 const boost::filesystem::path &inputFile,
59 std::vector<boost::filesystem::path> &dependencies,
60 const std::string &msg,
bool allowUnknownRootElement=
false);
62 void extractEvaluator();
64 using PositionMap = std::map<FQN, int>;
66 xercesc::DOMElement *&e,
68 int &nrElementsEmbeded,
70 const std::shared_ptr<ParamSet>& param=std::shared_ptr<ParamSet>(),
std::shared_ptr< ParamSet > getParam() const
Get available top level parameters after processAndGetDocument is called.
Definition: preprocess.cc:61
std::shared_ptr< Eval > getEvaluator() const
Get the evaluator.
Definition: preprocess.cc:53
void setParam(const std::shared_ptr< ParamSet > ¶m_)
Set top level parameters to overwrite before processAndGetDocument is called.
Definition: preprocess.cc:57
const std::vector< boost::filesystem::path > & getDependencies() const
Get all dependencies found during processAndGetDocument.
Definition: preprocess.cc:47
Preprocess(const boost::filesystem::path &inputFile, std::variant< std::shared_ptr< MBXMLUtils::DOMParser >, xercesc::DOMElement *, boost::filesystem::path > parserVariant)
std::shared_ptr< xercesc::DOMDocument > getDOMDocument()
Definition: preprocess.h:44
Definition: preprocess.h:10
std::shared_ptr< xercesc::DOMDocument > processAndGetDocument()
Start preprocessing and return the preprocessed DOMDocument.
Definition: preprocess.cc:90