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

ContextRule Class Reference

Rule that creates a new context for processing inner statement lists. More...

#include <rtreecontextrule.h>

Inheritance diagram for ContextRule:

Rule MultiContextRule SingleContextRule

Public Member Functions

 ContextRule (List *iphpInPattern, List *itplOutPattern, List *iphpOutPattern)
 constructor

virtual ~ContextRule ()
 destructor

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

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

virtual RuleContextgenerateSubcontext (RuleContext *context, const Node::Assignment &assign) const=0
 Generates a new subcontext.


Protected Attributes

ListphpInPattern
 php in pattern

ListtplOutPattern
 tpl in pattern

ListphpOutPattern
 php out pattern


Detailed Description

Rule that creates a new context for processing inner statement lists.

Definition at line 7 of file rtreecontextrule.h.


Constructor & Destructor Documentation

ContextRule::ContextRule List iphpInPattern,
List itplOutPattern,
List iphpOutPattern
 

constructor

Definition at line 4 of file rtreecontextrule.cpp.

ContextRule::~ContextRule  )  [virtual]
 

destructor

Definition at line 7 of file rtreecontextrule.cpp.

References phpInPattern, phpOutPattern, and tplOutPattern.


Member Function Documentation

bool ContextRule::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 21 of file rtreecontextrule.cpp.

References RuleContext::assignVariableNames(), StatementList::copy(), CTemplate, CVariable, RuleContext::execute(), RuleContext::processTemplate(), List::push_back(), List::substitute(), and substituteNode().

virtual RuleContext* ContextRule::generateSubcontext RuleContext context,
const Node::Assignment assign
const [pure virtual]
 

Generates a new subcontext.

Implemented in MultiContextRule, and SingleContextRule.

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

Substitutes variables used in the rule.

Implements Rule.

Definition at line 13 of file rtreecontextrule.cpp.

References phpInPattern, phpOutPattern, List::substitute(), and tplOutPattern.


Field Documentation

List* ContextRule::phpInPattern [protected]
 

php in pattern

Definition at line 10 of file rtreecontextrule.h.

Referenced by SingleContextRule::copy(), MultiContextRule::copy(), SingleContextRule::print(), MultiContextRule::print(), substitute(), and ~ContextRule().

List* ContextRule::phpOutPattern [protected]
 

php out pattern

Definition at line 20 of file rtreecontextrule.h.

Referenced by SingleContextRule::copy(), MultiContextRule::copy(), substitute(), and ~ContextRule().

List* ContextRule::tplOutPattern [protected]
 

tpl in pattern

Folowing items may appear in this list:

  • Template -- only substitutions are made,
  • Variable -- a subcontext is created and statements matched to his variable are refactored in this context.

Definition at line 18 of file rtreecontextrule.h.

Referenced by SingleContextRule::copy(), MultiContextRule::copy(), substitute(), and ~ContextRule().


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