"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/config/expression.hpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

expression.hpp  (icinga2-2.11.5):expression.hpp  (icinga2-2.12.0)
skipping to change at line 13 skipping to change at line 13
#ifndef EXPRESSION_H #ifndef EXPRESSION_H
#define EXPRESSION_H #define EXPRESSION_H
#include "config/i2-config.hpp" #include "config/i2-config.hpp"
#include "base/debuginfo.hpp" #include "base/debuginfo.hpp"
#include "base/array.hpp" #include "base/array.hpp"
#include "base/dictionary.hpp" #include "base/dictionary.hpp"
#include "base/function.hpp" #include "base/function.hpp"
#include "base/exception.hpp" #include "base/exception.hpp"
#include "base/scriptframe.hpp" #include "base/scriptframe.hpp"
#include "base/shared-object.hpp"
#include "base/convert.hpp" #include "base/convert.hpp"
#include <map> #include <map>
namespace icinga namespace icinga
{ {
struct DebugHint struct DebugHint
{ {
public: public:
DebugHint(Dictionary::Ptr hints = nullptr) DebugHint(Dictionary::Ptr hints = nullptr)
skipping to change at line 181 skipping to change at line 182
if (res.GetCode() == ResultReturn) \ if (res.GetCode() == ResultReturn) \
return res; \ return res; \
if (res.GetCode() == ResultContinue) \ if (res.GetCode() == ResultContinue) \
continue; \ continue; \
if (res.GetCode() == ResultBreak) \ if (res.GetCode() == ResultBreak) \
break; \ break; \
/** /**
* @ingroup config * @ingroup config
*/ */
class Expression class Expression : public SharedObject
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Expression);
Expression() = default; Expression() = default;
Expression(const Expression&) = delete; Expression(const Expression&) = delete;
virtual ~Expression(); virtual ~Expression();
Expression& operator=(const Expression&) = delete; Expression& operator=(const Expression&) = delete;
ExpressionResult Evaluate(ScriptFrame& frame, DebugHint *dhint = nullptr) const; ExpressionResult Evaluate(ScriptFrame& frame, DebugHint *dhint = nullptr) const;
virtual bool GetReference(ScriptFrame& frame, bool init_dict, Value *pare nt, String *index, DebugHint **dhint = nullptr) const; virtual bool GetReference(ScriptFrame& frame, bool init_dict, Value *pare nt, String *index, DebugHint **dhint = nullptr) const;
virtual const DebugInfo& GetDebugInfo() const; virtual const DebugInfo& GetDebugInfo() const;
skipping to change at line 206 skipping to change at line 209
static boost::signals2::signal<void (ScriptFrame& frame, ScriptError *ex, const DebugInfo& di)> OnBreakpoint; static boost::signals2::signal<void (ScriptFrame& frame, ScriptError *ex, const DebugInfo& di)> OnBreakpoint;
static void ScriptBreakpoint(ScriptFrame& frame, ScriptError *ex, const D ebugInfo& di); static void ScriptBreakpoint(ScriptFrame& frame, ScriptError *ex, const D ebugInfo& di);
}; };
std::unique_ptr<Expression> MakeIndexer(ScopeSpecifier scopeSpec, const String& index); std::unique_ptr<Expression> MakeIndexer(ScopeSpecifier scopeSpec, const String& index);
class OwnedExpression final : public Expression class OwnedExpression final : public Expression
{ {
public: public:
OwnedExpression(std::shared_ptr<Expression> expression) OwnedExpression(Expression::Ptr expression)
: m_Expression(std::move(expression)) : m_Expression(std::move(expression))
{ } { }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride
{ {
return m_Expression->DoEvaluate(frame, dhint); return m_Expression->DoEvaluate(frame, dhint);
} }
const DebugInfo& GetDebugInfo() const override const DebugInfo& GetDebugInfo() const override
{ {
return m_Expression->GetDebugInfo(); return m_Expression->GetDebugInfo();
} }
private: private:
std::shared_ptr<Expression> m_Expression; Expression::Ptr m_Expression;
}; };
class LiteralExpression final : public Expression class LiteralExpression final : public Expression
{ {
public: public:
LiteralExpression(Value value = Value()); LiteralExpression(Value value = Value());
const Value& GetValue() const const Value& GetValue() const
{ {
return m_Value; return m_Value;
skipping to change at line 291 skipping to change at line 294
{ } { }
protected: protected:
std::unique_ptr<Expression> m_Operand1; std::unique_ptr<Expression> m_Operand1;
std::unique_ptr<Expression> m_Operand2; std::unique_ptr<Expression> m_Operand2;
}; };
class VariableExpression final : public DebuggableExpression class VariableExpression final : public DebuggableExpression
{ {
public: public:
VariableExpression(String variable, std::vector<std::shared_ptr<Expressio n> > imports, const DebugInfo& debugInfo = DebugInfo()); VariableExpression(String variable, std::vector<Expression::Ptr> imports, const DebugInfo& debugInfo = DebugInfo());
String GetVariable() const String GetVariable() const
{ {
return m_Variable; return m_Variable;
} }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
bool GetReference(ScriptFrame& frame, bool init_dict, Value *parent, Stri ng *index, DebugHint **dhint) const override; bool GetReference(ScriptFrame& frame, bool init_dict, Value *parent, Stri ng *index, DebugHint **dhint) const override;
private: private:
String m_Variable; String m_Variable;
std::vector<std::shared_ptr<Expression> > m_Imports; std::vector<Expression::Ptr> m_Imports;
friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec); friend void BindToScope(std::unique_ptr<Expression>& expr, ScopeSpecifier scopeSpec);
}; };
class DerefExpression final : public UnaryExpression class DerefExpression final : public UnaryExpression
{ {
public: public:
DerefExpression(std::unique_ptr<Expression> operand, const DebugInfo& deb ugInfo = DebugInfo()) DerefExpression(std::unique_ptr<Expression> operand, const DebugInfo& deb ugInfo = DebugInfo())
: UnaryExpression(std::move(operand), debugInfo) : UnaryExpression(std::move(operand), debugInfo)
{ } { }
skipping to change at line 797 skipping to change at line 800
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
}; };
class FunctionExpression final : public DebuggableExpression class FunctionExpression final : public DebuggableExpression
{ {
public: public:
FunctionExpression(String name, std::vector<String> args, FunctionExpression(String name, std::vector<String> args,
std::map<String, std::unique_ptr<Expression> >&& closedVars, std: :unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo()) std::map<String, std::unique_ptr<Expression> >&& closedVars, std: :unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Name(std::move(name)), m_Arg s(std::move(args)), m_ClosedVars(std::move(closedVars)), m_Expression(std::move( expression)) : DebuggableExpression(debugInfo), m_Name(std::move(name)), m_Arg s(std::move(args)), m_ClosedVars(std::move(closedVars)), m_Expression(expression .release())
{ } { }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
private: private:
String m_Name; String m_Name;
std::vector<String> m_Args; std::vector<String> m_Args;
std::map<String, std::unique_ptr<Expression> > m_ClosedVars; std::map<String, std::unique_ptr<Expression> > m_ClosedVars;
std::shared_ptr<Expression> m_Expression; Expression::Ptr m_Expression;
}; };
class ApplyExpression final : public DebuggableExpression class ApplyExpression final : public DebuggableExpression
{ {
public: public:
ApplyExpression(String type, String target, std::unique_ptr<Expression> n ame, ApplyExpression(String type, String target, std::unique_ptr<Expression> n ame,
std::unique_ptr<Expression> filter, String package, String fkvar, String fvvar, std::unique_ptr<Expression> filter, String package, String fkvar, String fvvar,
std::unique_ptr<Expression> fterm, std::map<String, std::unique_p tr<Expression> >&& closedVars, bool ignoreOnError, std::unique_ptr<Expression> fterm, std::map<String, std::unique_p tr<Expression> >&& closedVars, bool ignoreOnError,
std::unique_ptr<Expression> expression, const DebugInfo& debugInf o = DebugInfo()) std::unique_ptr<Expression> expression, const DebugInfo& debugInf o = DebugInfo())
: DebuggableExpression(debugInfo), m_Type(std::move(type)), m_Tar get(std::move(target)), : DebuggableExpression(debugInfo), m_Type(std::move(type)), m_Tar get(std::move(target)),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_P m_Name(std::move(name)), m_Filter(filter.release()), m_Pa
ackage(std::move(package)), m_FKVar(std::move(fkvar)), m_FVVar(std::move(fvvar)) ckage(std::move(package)), m_FKVar(std::move(fkvar)), m_FVVar(std::move(fvvar)),
, m_FTerm(fterm.release()), m_IgnoreOnError(ignoreOnError),
m_FTerm(std::move(fterm)), m_IgnoreOnError(ignoreOnError) m_ClosedVars(std::move(closedVars)),
, m_ClosedVars(std::move(closedVars)), m_Expression(expression.release())
m_Expression(std::move(expression))
{ } { }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
private: private:
String m_Type; String m_Type;
String m_Target; String m_Target;
std::unique_ptr<Expression> m_Name; std::unique_ptr<Expression> m_Name;
std::shared_ptr<Expression> m_Filter; Expression::Ptr m_Filter;
String m_Package; String m_Package;
String m_FKVar; String m_FKVar;
String m_FVVar; String m_FVVar;
std::shared_ptr<Expression> m_FTerm; Expression::Ptr m_FTerm;
bool m_IgnoreOnError; bool m_IgnoreOnError;
std::map<String, std::unique_ptr<Expression> > m_ClosedVars; std::map<String, std::unique_ptr<Expression> > m_ClosedVars;
std::shared_ptr<Expression> m_Expression; Expression::Ptr m_Expression;
}; };
class NamespaceExpression final : public DebuggableExpression class NamespaceExpression final : public DebuggableExpression
{ {
public: public:
NamespaceExpression(std::unique_ptr<Expression> expression, const DebugIn fo& debugInfo = DebugInfo()) NamespaceExpression(std::unique_ptr<Expression> expression, const DebugIn fo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Expression(std::move(express ion)) : DebuggableExpression(debugInfo), m_Expression(expression.releas e())
{ } { }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
private: private:
std::shared_ptr<Expression> m_Expression; Expression::Ptr m_Expression;
}; };
class ObjectExpression final : public DebuggableExpression class ObjectExpression final : public DebuggableExpression
{ {
public: public:
ObjectExpression(bool abstract, std::unique_ptr<Expression> type, std::un ique_ptr<Expression> name, std::unique_ptr<Expression> filter, ObjectExpression(bool abstract, std::unique_ptr<Expression> type, std::un ique_ptr<Expression> name, std::unique_ptr<Expression> filter,
String zone, String package, std::map<String, std::unique_ptr<Exp ression> >&& closedVars, String zone, String package, std::map<String, std::unique_ptr<Exp ression> >&& closedVars,
bool defaultTmpl, bool ignoreOnError, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo()) bool defaultTmpl, bool ignoreOnError, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Abstract(abstract), m_Type(s td::move(type)), : DebuggableExpression(debugInfo), m_Abstract(abstract), m_Type(s td::move(type)),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_Zone(std: m_Name(std::move(name)), m_Filter(filter.release()), m_Zone(std::
:move(zone)), m_Package(std::move(package)), m_DefaultTmpl(defaultTmpl), move(zone)), m_Package(std::move(package)), m_DefaultTmpl(defaultTmpl),
m_IgnoreOnError(ignoreOnError), m_ClosedVars(std::move(closedVars m_IgnoreOnError(ignoreOnError), m_ClosedVars(std::move(closedVars
)), m_Expression(std::move(expression)) )), m_Expression(expression.release())
{ } { }
protected: protected:
ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride; ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const o verride;
private: private:
bool m_Abstract; bool m_Abstract;
std::unique_ptr<Expression> m_Type; std::unique_ptr<Expression> m_Type;
std::unique_ptr<Expression> m_Name; std::unique_ptr<Expression> m_Name;
std::shared_ptr<Expression> m_Filter; Expression::Ptr m_Filter;
String m_Zone; String m_Zone;
String m_Package; String m_Package;
bool m_DefaultTmpl; bool m_DefaultTmpl;
bool m_IgnoreOnError; bool m_IgnoreOnError;
std::map<String, std::unique_ptr<Expression> > m_ClosedVars; std::map<String, std::unique_ptr<Expression> > m_ClosedVars;
std::shared_ptr<Expression> m_Expression; Expression::Ptr m_Expression;
}; };
class ForExpression final : public DebuggableExpression class ForExpression final : public DebuggableExpression
{ {
public: public:
ForExpression(String fkvar, String fvvar, std::unique_ptr<Expression> val ue, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugIn fo()) ForExpression(String fkvar, String fvvar, std::unique_ptr<Expression> val ue, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugIn fo())
: DebuggableExpression(debugInfo), m_FKVar(std::move(fkvar)), m_F VVar(std::move(fvvar)), m_Value(std::move(value)), m_Expression(std::move(expres sion)) : DebuggableExpression(debugInfo), m_FKVar(std::move(fkvar)), m_F VVar(std::move(fvvar)), m_Value(std::move(value)), m_Expression(std::move(expres sion))
{ } { }
protected: protected:
 End of changes. 18 change blocks. 
24 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)