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

Constant Class Reference

A string constant. More...

#include <streeconstant.h>

Inheritance diagram for Constant:

Node

Public Member Functions

 Constant (const string &ivalue, const string &icomment="", const int ilineno=0)
 Creates Constant from a string.

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

string getValue () const
 Returns the value of the constatnt.

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

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

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

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

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

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

virtual Nodecopy () const
 Copies the node.

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

int toInt () const
 Tries to convert the value to number.

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

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


Private Attributes

string value
 The value of the constant.


Detailed Description

A string constant.

Used for representing following php elements:

Definition at line 17 of file streeconstant.h.


Constructor & Destructor Documentation

Constant::Constant const string &  ivalue,
const string &  icomment = "",
const int  ilineno = 0
[inline]
 

Creates Constant from a string.

Definition at line 24 of file streeconstant.h.

References value.

Referenced by copy().


Member Function Documentation

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

Comares node p to the node.

Implements Node.

Definition at line 20 of file streeconstant.cpp.

References Node::getType(), getValue(), and SConstant.

Node * Constant::copy  )  const [virtual]
 

Copies the node.

Implements Node.

Definition at line 29 of file streeconstant.cpp.

References Constant(), and getValue().

string Constant::evaluate const NameSpace nameSpace  )  const [virtual]
 

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

Implements Node.

Definition at line 42 of file streeconstant.cpp.

References getValue().

virtual string Constant::getName  )  const [inline, virtual]
 

Returs string representing node type or name for List.

Implements Node.

Definition at line 31 of file streeconstant.h.

References value.

virtual SType Constant::getType  )  const [inline, virtual]
 

Returns type of the node.

Implements Node.

Definition at line 26 of file streeconstant.h.

References SConstant, and SType.

string Constant::getValue  )  const [inline]
 

Returns the value of the constatnt.

Definition at line 29 of file streeconstant.h.

References value.

Referenced by compare(), copy(), evaluate(), toInt(), and TPLConstantNormalizer::transform().

void Constant::getVariables VariableList vlist  )  const [virtual]
 

Returns list of variables used in the node.

Implements Node.

Definition at line 33 of file streeconstant.cpp.

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

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

Implements Node.

Definition at line 11 of file streeconstant.cpp.

References SConstant.

bool Constant::matchToBegining const List p,
Assignment &  assign,
const NameSpace nameSpace
const [virtual]
 

Matches the list to the begining of p.

Implements Node.

Definition at line 16 of file streeconstant.cpp.

ostream & Constant::php ostream &  os  )  const [virtual]
 

Writes node to the stream as php.

Implements Node.

Definition at line 7 of file streeconstant.cpp.

References value.

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

Writes node to the stream.

Implements Node.

Definition at line 3 of file streeconstant.cpp.

References value.

Node * Constant::substitute const Assignment &  assign  )  [virtual]
 

Substitutes variables in the node accordingly to the given assignment.

Implements Node.

Definition at line 25 of file streeconstant.cpp.

int Constant::toInt  )  const
 

Tries to convert the value to number.

Definition at line 35 of file streeconstant.cpp.

References getValue().


Field Documentation

string Constant::value [private]
 

The value of the constant.

Definition at line 20 of file streeconstant.h.

Referenced by Constant(), getName(), getValue(), php(), and print().


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