diff options
Diffstat (limited to 'Source/cmGeneratorExpression.h')
-rw-r--r-- | Source/cmGeneratorExpression.h | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index a023eb0..b8467c2 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -19,6 +19,10 @@ class cmTarget; class cmMakefile; class cmListFileBacktrace; +struct cmGeneratorExpressionEvaluator; + +class cmCompiledGeneratorExpression; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -31,29 +35,48 @@ class cmListFileBacktrace; class cmGeneratorExpression { public: - /** Construct with an evaluation context and configuration. */ - cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, - bool quiet = false); + /** Construct. */ + cmGeneratorExpression(cmListFileBacktrace const& backtrace); + ~cmGeneratorExpression(); + + const cmCompiledGeneratorExpression& Parse(std::string const& input); + const cmCompiledGeneratorExpression& Parse(const char* input); + +private: + cmGeneratorExpression(const cmGeneratorExpression &); + void operator=(const cmGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; + cmCompiledGeneratorExpression *CompiledExpression; +}; - /** Evaluate generator expressions in a string. */ - const char* Process(std::string const& input); - const char* Process(const char* input); +class cmCompiledGeneratorExpression +{ +public: + const char* Evaluate(cmMakefile* mf, const char* config, + bool quiet = false) const; /** Get set of targets found during evaluations. */ std::set<cmTarget*> const& GetTargets() const { return this->Targets; } + + ~cmCompiledGeneratorExpression(); + private: - cmMakefile* Makefile; - const char* Config; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, + const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, + const char *input, bool needsParsing); + + friend class cmGeneratorExpression; + + cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); + void operator=(const cmCompiledGeneratorExpression &); + cmListFileBacktrace const& Backtrace; - bool Quiet; - std::vector<char> Data; - std::stack<size_t> Barriers; - cmsys::RegularExpression TargetInfo; - cmsys::RegularExpression TestConfig; - std::set<cmTarget*> Targets; - bool Evaluate(); - bool Evaluate(const char* expr, std::string& result); - bool EvaluateTargetInfo(std::string& result); + const std::vector<cmGeneratorExpressionEvaluator*> Evaluators; + const char* const Input; + const bool NeedsParsing; + + mutable std::set<cmTarget*> Targets; + mutable std::string Output; }; |