40 lines
998 B
C++
Executable File
40 lines
998 B
C++
Executable File
#ifndef EXPRESSIONEVALUATOR_H_
|
|
#define EXPRESSIONEVALUATOR_H_
|
|
|
|
#include "Value.h"
|
|
#include "RecursionGuard.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <utility>
|
|
#include <memory>
|
|
|
|
namespace bts {
|
|
namespace expression {
|
|
|
|
class IPropertyEvaluator;
|
|
class ExpressionEvaluatorImpl;
|
|
|
|
class ExpressionEvaluator
|
|
{
|
|
public:
|
|
ExpressionEvaluator(std::shared_ptr<IPropertyEvaluator> property_eval);
|
|
~ExpressionEvaluator();
|
|
|
|
bool eval(const std::string& expression) const;
|
|
Value eval_to_value(const std::string& expression) const;
|
|
|
|
bool check_valid(const std::string& expression, std::string* failed_property) const;
|
|
|
|
void pre_parse(const std::string& expression, boost::spirit::utree& ast) const;
|
|
void pre_parse(const std::vector<std::string>& expressions, std::vector<boost::spirit::utree>& asts) const;
|
|
bool eval_ast(const boost::spirit::utree& ast) const;
|
|
|
|
private:
|
|
BTS_NO_COPY(ExpressionEvaluator);
|
|
std::unique_ptr<ExpressionEvaluatorImpl> _impl;
|
|
};
|
|
|
|
}}//namespace
|
|
#endif
|