2010-05-06 00:08:41 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CL_INTERFACE_EXPR_NODE_H
|
|
|
|
#define CL_INTERFACE_EXPR_NODE_H
|
|
|
|
|
|
|
|
#include "interface_expr.h"
|
|
|
|
|
|
|
|
/** Base node of an interface expression parse tree
|
|
|
|
* \author Nicolas Vizerie
|
|
|
|
* \author Nevrax France
|
|
|
|
* \date 2003
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~CInterfaceExprNode() {}
|
|
|
|
// eval result of expression, and eventually get the nodes the epression depends on
|
|
|
|
virtual void eval(CInterfaceExprValue &result) = 0;
|
|
|
|
// The same, but get db nodes the expression depends on (appended to vector)
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes) = 0;
|
|
|
|
// Get dependencies of the node (appended to vector)
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-06-10 09:50:19 +00:00
|
|
|
// *******************************************************************************************************
|
2010-05-06 00:08:41 +00:00
|
|
|
/** A constant value already parsed by interface (in a interface expr parse tree)
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNodeValue : public CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CInterfaceExprValue Value;
|
|
|
|
public:
|
|
|
|
virtual void eval(CInterfaceExprValue &result);
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes);
|
|
|
|
};
|
|
|
|
|
2010-06-10 09:50:19 +00:00
|
|
|
// *******************************************************************************************************
|
2010-05-06 00:08:41 +00:00
|
|
|
/** A fct call (in a interface expr parse tree)
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNodeValueFnCall : public CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CInterfaceExpr::TUserFct Func;
|
|
|
|
// list of parameters
|
|
|
|
std::vector<CInterfaceExprNode *> Params;
|
|
|
|
public:
|
|
|
|
virtual void eval(CInterfaceExprValue &result);
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual ~CInterfaceExprNodeValueFnCall();
|
|
|
|
};
|
|
|
|
|
2010-06-10 09:50:19 +00:00
|
|
|
// *******************************************************************************************************
|
2010-05-06 00:08:41 +00:00
|
|
|
/** A db leaf read (in a interface expr parse tree)
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNodeDBLeaf : public CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CCDBNodeLeaf *Leaf;
|
|
|
|
public:
|
|
|
|
virtual void eval(CInterfaceExprValue &result);
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes);
|
|
|
|
};
|
|
|
|
|
2010-06-10 09:50:19 +00:00
|
|
|
// *******************************************************************************************************
|
2010-05-06 00:08:41 +00:00
|
|
|
/** A db branch read (in a interface expr parse tree)
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNodeDBBranch : public CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CCDBNodeBranch *Branch;
|
|
|
|
public:
|
|
|
|
virtual void eval(CInterfaceExprValue &result);
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes);
|
|
|
|
};
|
|
|
|
|
2010-06-10 09:50:19 +00:00
|
|
|
// *******************************************************************************************************
|
2010-05-06 00:08:41 +00:00
|
|
|
/** A dependant db read (in a interface expr parse tree)
|
|
|
|
* This is rarely used so no real optim there..
|
|
|
|
*/
|
|
|
|
class CInterfaceExprNodeDependantDBRead : public CInterfaceExprNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string Expr;
|
|
|
|
public:
|
|
|
|
virtual void eval(CInterfaceExprValue &result);
|
|
|
|
virtual void evalWithDepends(CInterfaceExprValue &result, std::vector<ICDBNode *> &nodes);
|
|
|
|
virtual void getDepends(std::vector<ICDBNode *> &nodes);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|