icinga2/lib/config/expression.hpp

745 lines
19 KiB
C++
Raw Normal View History

/******************************************************************************
* Icinga 2 *
* Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software Foundation *
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
2014-10-16 17:44:06 +02:00
#ifndef EXPRESSION_H
#define EXPRESSION_H
2014-05-25 16:23:35 +02:00
#include "config/i2-config.hpp"
#include "config/vmframe.hpp"
#include "base/debuginfo.hpp"
2014-05-25 16:23:35 +02:00
#include "base/array.hpp"
#include "base/dictionary.hpp"
#include "base/scriptfunction.hpp"
#include "base/configerror.hpp"
#include "base/convert.hpp"
2014-11-09 19:48:28 +01:00
#include <boost/foreach.hpp>
#include <map>
namespace icinga
{
struct DebugHint
{
2014-11-17 10:34:11 +01:00
public:
DebugHint(const Dictionary::Ptr& hints = Dictionary::Ptr())
: m_Hints(hints)
{ }
inline void AddMessage(const String& message, const DebugInfo& di)
{
2014-11-17 10:34:11 +01:00
if (!m_Hints)
m_Hints = new Dictionary();
if (!m_Messages) {
m_Messages = new Array();
m_Hints->Set("messages", m_Messages);
}
Array::Ptr amsg = new Array();
amsg->Add(message);
amsg->Add(di.Path);
amsg->Add(di.FirstLine);
amsg->Add(di.FirstColumn);
amsg->Add(di.LastLine);
amsg->Add(di.LastColumn);
m_Messages->Add(amsg);
}
inline DebugHint GetChild(const String& name)
{
if (!m_Hints)
m_Hints = new Dictionary();
if (!m_Children) {
m_Children = new Dictionary;
m_Hints->Set("properties", m_Children);
}
Dictionary::Ptr child = m_Children->Get(name);
if (!child) {
child = new Dictionary();
m_Children->Set(name, child);
}
return DebugHint(child);
}
2014-11-17 10:34:11 +01:00
Dictionary::Ptr ToDictionary(void) const
{
2014-11-17 10:34:11 +01:00
return m_Hints;
}
2014-11-17 10:34:11 +01:00
private:
Dictionary::Ptr m_Hints;
Array::Ptr m_Messages;
Dictionary::Ptr m_Children;
};
enum CombinedSetOp
{
OpSetLiteral,
OpSetAdd,
OpSetSubtract,
OpSetMultiply,
OpSetDivide
};
2014-11-24 00:04:26 +01:00
class InterruptExecutionError : virtual public std::exception, virtual public boost::exception
{
public:
InterruptExecutionError(const Value& result)
: m_Result(result)
{ }
~InterruptExecutionError(void) throw()
{ }
Value GetResult(void) const
{
return m_Result;
}
private:
Value m_Result;
};
typedef std::map<String, String> DefinitionMap;
/**
* @ingroup config
*/
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API Expression
{
public:
2014-11-09 19:48:28 +01:00
virtual ~Expression(void);
Value Evaluate(VMFrame& frame, DebugHint *dhint = NULL) const;
2014-11-09 19:48:28 +01:00
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const = 0;
2014-11-09 19:48:28 +01:00
virtual const DebugInfo& GetDebugInfo(void) const;
};
I2_CONFIG_API std::vector<Expression *> MakeIndexer(const String& index1);
class I2_CONFIG_API OwnedExpression : public Expression
{
public:
OwnedExpression(const boost::shared_ptr<Expression>& expression)
: m_Expression(expression)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const
2014-11-09 19:48:28 +01:00
{
return m_Expression->DoEvaluate(frame, dhint);
2014-11-09 19:48:28 +01:00
}
virtual const DebugInfo& GetDebugInfo(void) const
{
return m_Expression->GetDebugInfo();
}
private:
boost::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API LiteralExpression : public Expression
{
public:
LiteralExpression(const Value& value = Value());
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
Value m_Value;
};
inline LiteralExpression *MakeLiteral(const Value& literal = Value())
{
return new LiteralExpression(literal);
}
class I2_CONFIG_API DebuggableExpression : public Expression
{
public:
DebuggableExpression(const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: m_DebugInfo(debugInfo)
{ }
protected:
virtual const DebugInfo& GetDebugInfo(void) const;
DebugInfo m_DebugInfo;
};
class I2_CONFIG_API UnaryExpression : public DebuggableExpression
{
public:
UnaryExpression(Expression *operand, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Operand(operand)
{ }
~UnaryExpression(void)
{
delete m_Operand;
}
protected:
Expression *m_Operand;
};
class I2_CONFIG_API BinaryExpression : public DebuggableExpression
{
public:
BinaryExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Operand1(operand1), m_Operand2(operand2)
{ }
2014-11-09 19:48:28 +01:00
~BinaryExpression(void)
{
delete m_Operand1;
delete m_Operand2;
}
2014-11-09 19:48:28 +01:00
protected:
Expression *m_Operand1;
Expression *m_Operand2;
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API VariableExpression : public DebuggableExpression
{
public:
VariableExpression(const String& variable, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Variable(variable)
{ }
String GetVariable(void) const
{
return m_Variable;
}
2014-11-09 19:48:28 +01:00
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
String m_Variable;
};
class I2_CONFIG_API NegateExpression : public UnaryExpression
{
public:
NegateExpression(Expression *operand, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: UnaryExpression(operand, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API LogicalNegateExpression : public UnaryExpression
{
public:
LogicalNegateExpression(Expression *operand, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: UnaryExpression(operand, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API AddExpression : public BinaryExpression
{
public:
AddExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API SubtractExpression : public BinaryExpression
{
public:
SubtractExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API MultiplyExpression : public BinaryExpression
{
public:
MultiplyExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API DivideExpression : public BinaryExpression
{
public:
DivideExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API BinaryAndExpression : public BinaryExpression
{
public:
BinaryAndExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API BinaryOrExpression : public BinaryExpression
{
public:
BinaryOrExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API ShiftLeftExpression : public BinaryExpression
{
public:
ShiftLeftExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API ShiftRightExpression : public BinaryExpression
{
public:
ShiftRightExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API EqualExpression : public BinaryExpression
{
public:
EqualExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API NotEqualExpression : public BinaryExpression
{
public:
NotEqualExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API LessThanExpression : public BinaryExpression
{
public:
LessThanExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API GreaterThanExpression : public BinaryExpression
{
public:
GreaterThanExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API LessThanOrEqualExpression : public BinaryExpression
{
public:
LessThanOrEqualExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API GreaterThanOrEqualExpression : public BinaryExpression
{
public:
GreaterThanOrEqualExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API InExpression : public BinaryExpression
{
public:
InExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API NotInExpression : public BinaryExpression
{
public:
NotInExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API LogicalAndExpression : public BinaryExpression
{
public:
LogicalAndExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API LogicalOrExpression : public BinaryExpression
{
public:
LogicalOrExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: BinaryExpression(operand1, operand2, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API FunctionCallExpression : public DebuggableExpression
{
public:
FunctionCallExpression(Expression *fname, const std::vector<Expression *>& args, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_FName(fname), m_Args(args)
{ }
~FunctionCallExpression(void)
{
delete m_FName;
BOOST_FOREACH(Expression *expr, m_Args)
delete expr;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
public:
Expression *m_FName;
std::vector<Expression *> m_Args;
};
class I2_CONFIG_API ArrayExpression : public DebuggableExpression
{
public:
ArrayExpression(const std::vector<Expression *>& expressions, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Expressions(expressions)
{ }
~ArrayExpression(void)
{
BOOST_FOREACH(Expression *expr, m_Expressions)
delete expr;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
std::vector<Expression *> m_Expressions;
};
class I2_CONFIG_API DictExpression : public DebuggableExpression
{
public:
DictExpression(const std::vector<Expression *>& expressions, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Expressions(expressions), m_Inline(false)
{ }
~DictExpression(void)
{
BOOST_FOREACH(Expression *expr, m_Expressions)
delete expr;
}
void MakeInline(void);
2014-11-09 19:48:28 +01:00
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
std::vector<Expression *> m_Expressions;
bool m_Inline;
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API SetExpression : public DebuggableExpression
{
public:
SetExpression(const std::vector<Expression *>& indexer, CombinedSetOp op, Expression *operand2, bool local, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Op(op), m_Indexer(indexer), m_Operand2(operand2), m_Local(local)
2014-11-09 19:48:28 +01:00
{ }
~SetExpression(void)
{
BOOST_FOREACH(Expression *expr, m_Indexer)
delete expr;
delete m_Operand2;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
private:
2014-11-09 19:48:28 +01:00
CombinedSetOp m_Op;
std::vector<Expression *> m_Indexer;
Expression *m_Operand2;
bool m_Local;
2014-11-09 19:48:28 +01:00
};
class I2_CONFIG_API ConditionalExpression : public DebuggableExpression
{
public:
ConditionalExpression(Expression *condition, Expression *true_branch, Expression *false_branch, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Condition(condition), m_TrueBranch(true_branch), m_FalseBranch(false_branch)
{ }
~ConditionalExpression(void)
{
delete m_Condition;
delete m_TrueBranch;
delete m_FalseBranch;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
private:
Expression *m_Condition;
Expression *m_TrueBranch;
Expression *m_FalseBranch;
};
2014-11-24 00:04:26 +01:00
class I2_CONFIG_API ReturnExpression : public UnaryExpression
{
public:
ReturnExpression(Expression *expression, const DebugInfo& debugInfo = DebugInfo())
: UnaryExpression(expression, debugInfo)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API IndexerExpression : public DebuggableExpression
2014-11-09 19:48:28 +01:00
{
public:
IndexerExpression(const std::vector<Expression *>& indexer, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Indexer(indexer)
2014-11-09 19:48:28 +01:00
{ }
2014-11-09 19:48:28 +01:00
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
private:
std::vector<Expression *> m_Indexer;
2014-11-09 19:48:28 +01:00
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API ImportExpression : public DebuggableExpression
{
public:
ImportExpression(Expression *name, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Name(name)
2014-11-09 19:48:28 +01:00
{ }
2014-11-09 19:48:28 +01:00
~ImportExpression(void)
{
delete m_Name;
}
2014-11-09 19:48:28 +01:00
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-06 19:35:47 +01:00
2014-11-09 19:48:28 +01:00
private:
Expression *m_Name;
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API FunctionExpression : public DebuggableExpression
{
public:
FunctionExpression(const String& name, const std::vector<String>& args,
std::map<String, Expression *> *closedVars, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Name(name), m_Args(args), m_ClosedVars(closedVars), m_Expression(expression)
2014-11-09 19:48:28 +01:00
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
String m_Name;
std::vector<String> m_Args;
std::map<String, Expression *> *m_ClosedVars;
2014-11-09 19:48:28 +01:00
boost::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API SlotExpression : public DebuggableExpression
{
public:
SlotExpression(const String& signal, Expression *slot, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Signal(signal), m_Slot(slot)
{ }
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
private:
String m_Signal;
Expression *m_Slot;
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API ApplyExpression : public DebuggableExpression
{
public:
ApplyExpression(const String& type, const String& target, Expression *name,
Expression *filter, const String& fkvar, const String& fvvar,
Expression *fterm, std::map<String, Expression *> *closedVars,
Expression *expression, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_Type(type), m_Target(target),
m_Name(name), m_Filter(filter), m_FKVar(fkvar), m_FVVar(fvvar),
m_FTerm(fterm), m_ClosedVars(closedVars), m_Expression(expression)
2014-11-09 19:48:28 +01:00
{ }
~ApplyExpression(void)
{
delete m_Name;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
String m_Type;
String m_Target;
Expression *m_Name;
boost::shared_ptr<Expression> m_Filter;
String m_FKVar;
String m_FVVar;
boost::shared_ptr<Expression> m_FTerm;
std::map<String, Expression *> *m_ClosedVars;
2014-11-09 19:48:28 +01:00
boost::shared_ptr<Expression> m_Expression;
};
2014-11-09 19:48:28 +01:00
class I2_CONFIG_API ObjectExpression : public DebuggableExpression
{
public:
ObjectExpression(bool abstract, const String& type, Expression *name, Expression *filter,
const String& zone, std::map<String, Expression *> *closedVars,
Expression *expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Abstract(abstract), m_Type(type),
m_Name(name), m_Filter(filter), m_Zone(zone), m_ClosedVars(closedVars), m_Expression(expression)
2014-11-09 19:48:28 +01:00
{ }
~ObjectExpression(void)
{
delete m_Name;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
bool m_Abstract;
String m_Type;
Expression *m_Name;
boost::shared_ptr<Expression> m_Filter;
String m_Zone;
std::map<String, Expression *> *m_ClosedVars;
2014-11-09 19:48:28 +01:00
boost::shared_ptr<Expression> m_Expression;
};
class I2_CONFIG_API ForExpression : public DebuggableExpression
{
public:
ForExpression(const String& fkvar, const String& fvvar, Expression *value, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
2014-11-09 19:48:28 +01:00
: DebuggableExpression(debugInfo), m_FKVar(fkvar), m_FVVar(fvvar), m_Value(value), m_Expression(expression)
{ }
~ForExpression(void)
{
delete m_Value;
delete m_Expression;
}
protected:
virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
2014-11-09 19:48:28 +01:00
private:
String m_FKVar;
String m_FVVar;
Expression *m_Value;
Expression *m_Expression;
};
}
2014-10-16 17:44:06 +02:00
#endif /* EXPRESSION_H */