Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

NamedContextRule Class Reference

Used for executing rules from other files on a statement list. More...

#include <rtreenamedcontextrule.h>

Inheritance diagram for NamedContextRule:

Rule

Public Member Functions

 NamedContextRule (Constant *iname, RunRuleList &irunRuleList, List *iphpInPattern, List *iphpOutPattern, Variable *inamePattern, Variable *iargumentsPattern, Variable *icontextPattern)
 Constructor.

virtual ~NamedContextRule ()
virtual bool execute (RuleContext *context, List *phpIn, List *phpOut, List *tplOut, Node::Assignment &assign) const
 Executer the rule on php.

void runRules (NameSpace &subNameSpace, Node *phpContextMatched, StatementList *phpContextOut, StatementList *tplContextOut, Node::Assignment &assign) const
 Executes rules on given statement list used in RuleSystem for main statement list.

virtual Rulecopy ()
 Copies the rule.

virtual Rulesubstitute (const Node::Assignment &assign)
 Substitutes variables used in the rule.

virtual ostream & print (ostream &os) const
 Writes the rule to the stream.


Private Attributes

const string name
 Name of rules to include.

RunRuleListrunRuleList
 Reference to rule list in RuleSystem.

ListphpInPattern
 Pattern to be matched.

ListphpOutPattern
 Output pattern.

VariablenamePattern
 The name of the context.

VariableargumentsPattern
 The list of arguments.

VariablecontextPattern
 The statements of the context.


Detailed Description

Used for executing rules from other files on a statement list.

Definition at line 8 of file rtreenamedcontextrule.h.


Constructor & Destructor Documentation

NamedContextRule::NamedContextRule Constant iname,
RunRuleList irunRuleList,
List iphpInPattern,
List iphpOutPattern,
Variable inamePattern,
Variable iargumentsPattern,
Variable icontextPattern
 

Constructor.

Definition at line 4 of file rtreenamedcontextrule.cpp.

NamedContextRule::~NamedContextRule  )  [virtual]
 

Definition at line 17 of file rtreenamedcontextrule.cpp.

References argumentsPattern, contextPattern, namePattern, and phpInPattern.


Member Function Documentation

Rule * NamedContextRule::copy  )  [virtual]
 

Copies the rule.

Implements Rule.

Definition at line 80 of file rtreenamedcontextrule.cpp.

bool NamedContextRule::execute RuleContext context,
List phpIn,
List phpOut,
List tplOut,
Node::Assignment assign
const [virtual]
 

Executer the rule on php.

Parameters:
context context in which rule is executed
phpIn input php
phpOut output php
tplOut output smarty template
assign the assignment used to match the rule
Returns:
true is rule was succefully executed
If rule was succefully executed refactored php is deleted from the begining of phpIn list.

Implements Rule.

Definition at line 38 of file rtreenamedcontextrule.cpp.

References List::append(), argumentsPattern, contextPattern, List::copy(), Variable::copy(), Variable::getId(), List::getLength(), RuleContext::getNameSpace(), NameSpace::importLocals(), List::matchToBegining(), namePattern, phpInPattern, phpOutPattern, NameSpace::processArguments(), runRules(), List::substitute(), substituteNode(), and Node::toString().

ostream & NamedContextRule::print ostream &  os  )  const [virtual]
 

Writes the rule to the stream.

Implements Rule.

Definition at line 73 of file rtreenamedcontextrule.cpp.

References phpInPattern, and List::print().

void NamedContextRule::runRules NameSpace subNameSpace,
Node phpContextMatched,
StatementList phpContextOut,
StatementList tplContextOut,
Node::Assignment assign
const
 

Executes rules on given statement list used in RuleSystem for main statement list.

Definition at line 24 of file rtreenamedcontextrule.cpp.

References RuleContext::execute(), List::getLength(), NameSpace::getRuleRunTime(), MAINCONTEXTNAME, name, and runRuleList.

Referenced by RuleSystem::execute(), and execute().

Rule * NamedContextRule::substitute const Node::Assignment assign  )  [virtual]
 

Substitutes variables used in the rule.

Implements Rule.

Definition at line 84 of file rtreenamedcontextrule.cpp.


Field Documentation

Variable* NamedContextRule::argumentsPattern [private]
 

The list of arguments.

Definition at line 23 of file rtreenamedcontextrule.h.

Referenced by execute(), and ~NamedContextRule().

Variable* NamedContextRule::contextPattern [private]
 

The statements of the context.

Definition at line 25 of file rtreenamedcontextrule.h.

Referenced by execute(), and ~NamedContextRule().

const string NamedContextRule::name [private]
 

Name of rules to include.

Definition at line 12 of file rtreenamedcontextrule.h.

Referenced by runRules().

Variable* NamedContextRule::namePattern [private]
 

The name of the context.

Definition at line 21 of file rtreenamedcontextrule.h.

Referenced by execute(), and ~NamedContextRule().

List* NamedContextRule::phpInPattern [private]
 

Pattern to be matched.

Definition at line 17 of file rtreenamedcontextrule.h.

Referenced by execute(), print(), and ~NamedContextRule().

List* NamedContextRule::phpOutPattern [private]
 

Output pattern.

Definition at line 19 of file rtreenamedcontextrule.h.

Referenced by execute().

RunRuleList& NamedContextRule::runRuleList [private]
 

Reference to rule list in RuleSystem.

Definition at line 14 of file rtreenamedcontextrule.h.

Referenced by runRules().


The documentation for this class was generated from the following files:
Generated on Fri Nov 21 17:54:08 2003 for PHPX by doxygen 1.3.3