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

SubstitutionRule Class Reference

Simple substitution rule. More...

#include <rtreesubstitutionrule.h>

Inheritance diagram for SubstitutionRule:

Rule

Public Member Functions

 SubstitutionRule (List *iphpInPattern, List *itplOutPattern, List *iphpOutPattern)
 Constructor.

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

virtual Rule * copy ()
 Copies the rule.

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

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


Private Attributes

List * phpInPattern
 php in pattern

List * tplOutPattern
 tpl out pattern

List * phpOutPattern
 php out pattern


Detailed Description

Simple substitution rule.

When phpInPattern matches the input, the out patterns are put to the out lists, with appropriate substitutions made.

Definition at line 11 of file rtreesubstitutionrule.h.


Constructor & Destructor Documentation

SubstitutionRule::SubstitutionRule (  List *  iphpInPattern,
List *  itplOutPattern,
List *  iphpOutPattern
) 
 

Constructor.

Definition at line 3 of file rtreesubstitutionrule.cpp.

Referenced by copy().


Member Function Documentation

Rule * SubstitutionRule::copy (   )  [virtual]
 

Copies the rule.

Implements Rule.

Definition at line 26 of file rtreesubstitutionrule.cpp.

References List::copyList(), phpInPattern, phpOutPattern, SubstitutionRule(), and tplOutPattern.

bool SubstitutionRule::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 6 of file rtreesubstitutionrule.cpp.

References List::append(), RuleContext::assignVariableNames(), List::copy(), List::getLength(), RuleContext::getNameSpace(), List::matchToBegining(), phpInPattern, phpOutPattern, List::substitute(), and tplOutPattern.

ostream & SubstitutionRule::print (  ostream &  os  )  const [virtual]
 

Writes the rule to the stream.

Implements Rule.

Definition at line 39 of file rtreesubstitutionrule.cpp.

References phpInPattern, and List::print().

Rule * SubstitutionRule::substitute (  const Node::Assignment &  assign  )  [virtual]
 

Substitutes variables used in the rule.

Implements Rule.

Definition at line 32 of file rtreesubstitutionrule.cpp.

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


Field Documentation

List* SubstitutionRule::phpInPattern [private]
 

php in pattern

Definition at line 13 of file rtreesubstitutionrule.h.

Referenced by copy(), execute(), print(), and substitute().

List* SubstitutionRule::phpOutPattern [private]
 

php out pattern

Definition at line 17 of file rtreesubstitutionrule.h.

Referenced by copy(), execute(), and substitute().

List* SubstitutionRule::tplOutPattern [private]
 

tpl out pattern

Definition at line 15 of file rtreesubstitutionrule.h.

Referenced by copy(), execute(), and substitute().


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