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

Node Class Reference

A basis class for PHP structure tree. More...

#include <streenode.h>

Inheritance diagram for Node:

AttributeValue Constant ContextMatch List Pin Variable Binary NamedList Nullary Quadary Ternary Unary ArrayOperator ArrayPair Case Const Declare Do MapOperator ObjectOperator PostUnaryOperator SmartyAssign Switch UnaryOperator While ArrayPairList AssignmentList CaseList DeclareList EncapsList ExpressionList InlineHTMLList StatementList TemplateList EmptyStatement For Foreach Function AskOperator BinaryOperator Class EncapsExpr FunctionCall If Parameter AList Array Break ClassVariable ConstantEncapsedString ConstantString Continue CurlyBraces DoubleQuote Echo EchoPHP Exit Expression Global InlineHTML Isset PHP PHPVariable Print Return SmartyBraces Static Template Unset Use

Public Types

typedef set< int > VariableList
 A list of variables.


Public Member Functions

 Node (const string &icomment, const int ilineno=0)
 Constructor.

 Node ()
 Constructor.

virtual ~Node ()
 Destrys the node and frees memory.

virtual SType getType () const=0
 Returns type of the node.

virtual string getName () const=0
 Returs string representing node type or name for List.

virtual ostream & print (ostream &os) const=0
 Writes node to the stream.

virtual ostream & php (ostream &os) const=0
 Writes node to the stream as php.

virtual bool match (const Node *p, Assignment &assign, const NameSpace &nameSpace) const=0
 Matches node p to the node. If node matches sets the assignment.

virtual bool matchToBegining (const List *p, Assignment &assign, const NameSpace &nameSpace) const=0
 Matches the list to the begining of p.

virtual bool compare (const Node *p) const=0
 Comares node p to the node.

virtual Nodecopy () const=0
 Copies the node.

virtual void getVariables (VariableList &vlist) const=0
 Returns list of variables used in the node.

string toString () const
 Returns the string representing the node.

virtual Nodepush_back (Node *statement)
 Correct only for lists.

virtual Nodetransform (const Transformer *transformer)
 Applies Transformer to every node in the tree.

virtual bool forall (const Tester *tester, const NameSpace &nameSpace) const
 Returns true is for all nodes in the.

virtual bool exists (const Tester *tester, const NameSpace &nameSpace) const
 Applies Transformer to every node in the tree.

virtual string evaluate (const NameSpace &nameSpace) const=0
 Computes the value of the expression (only basic atihmetic and string operations).

virtual int getLength () const
 Returns teh length of the list -- valid only for List and ContextMatch.


Protected Member Functions

virtual Nodesubstitute (const Assignment &assign)=0
 Substitutes variables in the node accordingly to the given assignment.


Protected Attributes

Location location
 The location of the node -- not used.


Friends

ostream & operator<< (ostream &os, const Assignment &data)
 Writes assignment to stream.

ostream & operator<< (ostream &os, const Node *data)
 Writes the node to the stream by using Node::php.

void substituteNode (Node *&node, const Assignment &assign)
 Substitutes variables in the node accordingly to the given assignment.


Detailed Description

A basis class for PHP structure tree.

Definition at line 28 of file streenode.h.


Member Typedef Documentation

typedef set<int> Node::VariableList
 

A list of variables.

Definition at line 64 of file streenode.h.

Referenced by RuleContext::assignVariableNames().


Constructor & Destructor Documentation

Node::Node const string &  icomment,
const int  ilineno = 0
[inline]
 

Constructor.

Definition at line 70 of file streenode.h.

References location.

Node::Node  )  [inline]
 

Constructor.

Definition at line 73 of file streenode.h.

References location.

virtual Node::~Node  )  [inline, virtual]
 

Destrys the node and frees memory.

Definition at line 76 of file streenode.h.


Member Function Documentation

virtual bool Node::compare const Node p  )  const [pure virtual]
 

Comares node p to the node.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by ContextMatch::compare().

virtual Node* Node::copy  )  const [pure virtual]
 

Copies the node.

Implemented in ContextMatch, AttributeValue, StatementList, InlineHTMLList, TemplateList, ExpressionList, ArrayPairList, DeclareList, CaseList, EncapsList, AssignmentList, PHP, EchoPHP, CurlyBraces, SmartyBraces, DoubleQuote, If, For, While, Do, Switch, Break, Continue, Return, Global, Static, Echo, Template, SmartyAssign, InlineHTML, Expression, Unset, Use, Foreach, Declare, EmptyStatement, Function, Class, Const, Case, Parameter, ClassVariable, UnaryOperator, PostUnaryOperator, BinaryOperator, AList, EncapsExpr, AskOperator, Exit, Print, Array, FunctionCall, ArrayPair, ObjectOperator, ArrayOperator, MapOperator, Isset, ConstantEncapsedString, ConstantString, PHPVariable, Constant, List, Nullary, Unary, Binary, Ternary, Quadary, Pin, and Variable.

Referenced by LocalAttributeIsequalTester::copy(), AttributeIsequalTester::copy(), TypeTester::copy(), NameTester::copy(), ActionSet::copy(), ActionWrite::copy(), AttributeValue::copy(), ContextMatch::copy(), Variable::match(), and Variable::substitute().

virtual string Node::evaluate const NameSpace nameSpace  )  const [pure virtual]
 

Computes the value of the expression (only basic atihmetic and string operations).

Implemented in ContextMatch, AttributeValue, EncapsList, DoubleQuote, UnaryOperator, PostUnaryOperator, BinaryOperator, EncapsExpr, AskOperator, ConstantEncapsedString, ConstantString, Constant, List, Pin, and Variable.

Referenced by ConstantString::evaluate(), ConstantEncapsedString::evaluate(), AskOperator::evaluate(), EncapsExpr::evaluate(), BinaryOperator::evaluate(), UnaryOperator::evaluate(), DoubleQuote::evaluate(), ContextMatch::evaluate(), ActionSet::execute(), and ActionWrite::execute().

bool Node::exists const Tester tester,
const NameSpace nameSpace
const [virtual]
 

Applies Transformer to every node in the tree.

Reimplemented in List.

Definition at line 37 of file streenode.cpp.

References Node::Tester::test().

Referenced by ExistsTester::test().

bool Node::forall const Tester tester,
const NameSpace nameSpace
const [virtual]
 

Returns true is for all nodes in the.

Reimplemented in List.

Definition at line 33 of file streenode.cpp.

References Node::Tester::test().

Referenced by ForallTester::test().

int Node::getLength  )  const [virtual]
 

Returns teh length of the list -- valid only for List and ContextMatch.

Reimplemented in ContextMatch, and List.

Definition at line 41 of file streenode.cpp.

Referenced by ContextMatch::getLength().

virtual string Node::getName  )  const [pure virtual]
 

Returs string representing node type or name for List.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by RuleContext::execute(), MultiContextRule::generateSubcontext(), ContextMatch::getName(), TypeTester::test(), TPLConstantNormalizer::transform(), HTMLBox::Replacer::transform(), and HTMLBox::Putter::transform().

virtual SType Node::getType  )  const [pure virtual]
 

Returns type of the node.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by Variable::compare(), Pin::compare(), List::compare(), Constant::compare(), ContextMatch::getType(), List::match(), ArrayPair::php(), FunctionCall::php(), Parameter::php(), Case::php(), Class::php(), Foreach::php(), and If::php().

virtual void Node::getVariables VariableList vlist  )  const [pure virtual]
 

Returns list of variables used in the node.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by ContextMatch::getVariables().

virtual bool Node::match const Node p,
Assignment assign,
const NameSpace nameSpace
const [pure virtual]
 

Matches node p to the node. If node matches sets the assignment.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by ContextMatch::match().

virtual bool Node::matchToBegining const List p,
Assignment assign,
const NameSpace nameSpace
const [pure virtual]
 

Matches the list to the begining of p.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by ContextMatch::matchToBegining().

virtual ostream& Node::php ostream &  os  )  const [pure virtual]
 

Writes node to the stream as php.

Implemented in ContextMatch, AttributeValue, StatementList, InlineHTMLList, TemplateList, ExpressionList, ArrayPairList, DeclareList, CaseList, EncapsList, AssignmentList, PHP, EchoPHP, CurlyBraces, SmartyBraces, DoubleQuote, If, For, While, Do, Switch, Break, Continue, Return, Global, Static, Echo, Template, SmartyAssign, InlineHTML, Expression, Unset, Use, Foreach, Declare, EmptyStatement, Function, Class, Const, Case, Parameter, ClassVariable, UnaryOperator, PostUnaryOperator, BinaryOperator, AList, EncapsExpr, AskOperator, Exit, Print, Array, FunctionCall, ArrayPair, ObjectOperator, ArrayOperator, MapOperator, Isset, ConstantEncapsedString, ConstantString, PHPVariable, Constant, List, Nullary, Unary, Binary, Ternary, Quadary, Pin, and Variable.

Referenced by operator<<(), and ContextMatch::php().

virtual ostream& Node::print ostream &  os  )  const [pure virtual]
 

Writes node to the stream.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by AttributeValue::print(), and ContextMatch::print().

Node * Node::push_back Node statement  )  [virtual]
 

Correct only for lists.

Reimplemented in List.

Definition at line 25 of file streenode.cpp.

virtual Node* Node::substitute const Assignment assign  )  [protected, pure virtual]
 

Substitutes variables in the node accordingly to the given assignment.

Implemented in ContextMatch, AttributeValue, Constant, List, Pin, and Variable.

Referenced by substituteNode().

string Node::toString  )  const
 

Returns the string representing the node.

Definition at line 18 of file streenode.cpp.

Referenced by EncapsList::evaluate(), AttributeValue::evaluate(), NamedContextRule::execute(), ActionSet::execute(), RuleContext::executeOnPHPList(), LocalAttributeIsequalTester::test(), AttributeIsequalTester::test(), AttributeIssetTester::test(), TypeTester::test(), and NameTester::test().

Node * Node::transform const Transformer transformer  )  [virtual]
 

Applies Transformer to every node in the tree.

Reimplemented in List.

Definition at line 29 of file streenode.cpp.

References Node::Transformer::transform().

Referenced by TransformerSet::apply(), and List::transform().


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const Node data
[friend]
 

Writes the node to the stream by using Node::php.

Definition at line 14 of file streenode.cpp.

ostream& operator<< ostream &  os,
const Assignment data
[friend]
 

Writes assignment to stream.

Definition at line 4 of file streenode.cpp.

void substituteNode Node *&  node,
const Assignment assign
[friend]
 

Substitutes variables in the node accordingly to the given assignment.

Definition at line 45 of file streenode.cpp.

Referenced by List::substitute(), AttributeValue::substitute(), and ContextMatch::substitute().


Field Documentation

Location Node::location [protected]
 

The location of the node -- not used.

Definition at line 32 of file streenode.h.

Referenced by Node().


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