#include <rulecontext.h>
Inheritance diagram for RuleContext:
Public Member Functions | |
RuleContext (RuleList &irules, NameSpace &inameSpace) | |
Constructes a context with given rules. | |
virtual | ~RuleContext () |
Destroys the context. | |
void | insert (int priority, Rule *rule) |
Inserts a Rule with given priority in to the context. | |
void | insert (PriorityRulePair *rulePair) |
Inserts a Rule with given priority in to the context. | |
void | execute (Node *phpIn, List *phpOut, List *tplOut) |
Executes all rules of the context on php. | |
void | assignVariableNames (List *phpList, List *tplList) |
Assigns appropriate names to variables appearing in given lists. | |
virtual void | generateVariableNames (const Node::VariableList &vlist, Node::Assignment &phpAssign, Node::Assignment &tplAssign)=0 |
Generates appropriate names to variables and stores them in assignments. | |
virtual const string | generateVariableName ()=0 |
Generates one variable name. | |
virtual void | processSmartyAssign (SmartyAssign *smartyAssign)=0 |
Processes one SmartyAssign. | |
virtual void | enterContext (List *phpOut, List *tplOut) |
Run at the begining of RuleContext::execute. | |
virtual void | leaveContext (List *phpOut, List *tplOut) |
Run at the end of RuleContext::execute. | |
virtual void | registerSmartyVariable (const string &variable)=0 |
Registers smarty varaible in the context. | |
virtual const string | getVariableNameSufix (const bool stripControlVariableDollar)=0 |
Returns a sufix for of a varaible name. | |
virtual const string | getVariableNamePrefix ()=0 |
Returns a sufix for of a varaible name. | |
virtual void | processTemplate (Node *tpl) const=0 |
Processes template after refactoring. | |
NameSpace & | getNameSpace () const |
Returns nameContext. | |
Protected Attributes | |
RuleList & | rules |
List of rules. | |
NameSpace & | nameSpace |
A name space in which rules are executed. | |
Private Member Functions | |
bool | executeOnPHP (List *phpIn, List *phpOut, List *tplOut) |
Namespace Tries to execute rules on php. | |
void | executeOnPHPList (List *phpIn, List *phpOut, List *tplOut) |
Executes executeOnPHP unless the phpIn is empty. | |
void | processSmartyAssignInPhpList (List *phpList) |
Sets appropriate strings in appearing ::SmartyAssing classes. | |
Private Attributes | |
list< RuleList::iterator > | myRules |
List of rules belonging to the context. | |
Friends | |
class | MultiContext |
class | SingleContext |
Remembers the list of rules and executes tham on php. Takes care of assinging names to variables exported to template.
Definition at line 15 of file rulecontext.h.
|
Constructes a context with given rules.
Definition at line 37 of file rulecontext.cpp. |
|
Destroys the context.
Definition at line 39 of file rulecontext.cpp. |
|
Assigns appropriate names to variables appearing in given lists.
Definition at line 70 of file rulecontext.cpp. References generateVariableNames(), List::getVariables(), processSmartyAssignInPhpList(), List::substitute(), and Node::VariableList. Referenced by SubstitutionRule::execute(), and ContextRule::execute(). |
|
Run at the begining of RuleContext::execute.
Reimplemented in MultiContext. Definition at line 97 of file rulecontext.cpp. Referenced by execute(). |
|
Executes all rules of the context on php.
Definition at line 58 of file rulecontext.cpp. References CStatementList, enterContext(), executeOnPHPList(), Node::getName(), and leaveContext(). Referenced by ContextRule::execute(), and NamedContextRule::runRules(). |
|
Namespace Tries to execute rules on php.
Definition at line 5 of file rulecontext.cpp. References List::print(), and rules. Referenced by executeOnPHPList(). |
|
Executes executeOnPHP unless the phpIn is empty.
Definition at line 29 of file rulecontext.cpp. References executeOnPHP(), List::getLength(), and Node::toString(). Referenced by execute(). |
|
Generates one variable name.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by SingleContext::generateVariableName(). |
|
Generates appropriate names to variables and stores them in assignments.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by assignVariableNames(), and SingleContext::generateVariableNames(). |
|
Returns nameContext.
Definition at line 113 of file rulecontext.h. References nameSpace. Referenced by SubstitutionRule::execute(), NamedContextRule::execute(), RuleWithActionRule::execute(), and ActionRule::execute(). |
|
Returns a sufix for of a varaible name.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by SingleContext::getVariableNamePrefix(). |
|
Returns a sufix for of a varaible name. In case of control variables e.g. in for statement, a leading dollar may be skiped, when exporting control variable to template. Implemented in MultiContext, NamedContext, and SingleContext. Referenced by MultiContext::generateVariableNames(), SingleContext::getVariableNameSufix(), and MultiContext::getVariableNameSufix(). |
|
Inserts a Rule with given priority in to the context.
Definition at line 54 of file rulecontext.cpp. References PriorityList< Rule >::insert(), myRules, and rules. |
|
Inserts a Rule with given priority in to the context.
Definition at line 50 of file rulecontext.cpp. References PriorityList< Rule >::insert(), myRules, and rules. |
|
Run at the end of RuleContext::execute. When living the context all registerd smarty variables are exported. Reimplemented in NamedContext. Definition at line 98 of file rulecontext.cpp. Referenced by execute(). |
|
Processes one SmartyAssign.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by SingleContext::processSmartyAssign(), and processSmartyAssignInPhpList(). |
|
Sets appropriate strings in appearing ::SmartyAssing classes.
Definition at line 85 of file rulecontext.cpp. References CSmartyAssign, and processSmartyAssign(). Referenced by assignVariableNames(). |
|
Processes template after refactoring.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by ContextRule::execute(), and SingleContext::processTemplate(). |
|
Registers smarty varaible in the context.
Implemented in MultiContext, NamedContext, and SingleContext. Referenced by SingleContext::registerSmartyVariable(), and MultiContext::registerSmartyVariable(). |
|
Definition at line 115 of file rulecontext.h. |
|
Definition at line 116 of file rulecontext.h. |
|
List of rules belonging to the context. Every inserted rule is put to RuleContext::rules and an iterator is stored in myRules. When the context is destroyed the stored rules are removed from RuleContext::rules. Definition at line 28 of file rulecontext.h. Referenced by insert(), and ~RuleContext(). |
|
A name space in which rules are executed.
Definition at line 51 of file rulecontext.h. Referenced by getNameSpace(). |
|
List of rules.
Definition at line 18 of file rulecontext.h. Referenced by executeOnPHP(), insert(), and ~RuleContext(). |