Remove unused (and a few almost-unused) functions in the XPath classes.

Bug 88612. r=peterv, sr=jst


git-svn-id: svn://10.0.0.236/trunk@98462 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sicking%bigfoot.com
2001-07-02 20:11:05 +00:00
parent 1c0b5137b5
commit f003279337
33 changed files with 119 additions and 814 deletions

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: AdditiveExpr.cpp,v 1.1 2000-04-06 07:44:37 kvisco%ziplink.net Exp $
* $Id: AdditiveExpr.cpp,v 1.2 2001-07-02 20:10:48 sicking%bigfoot.com Exp $
*/
/**
@@ -30,20 +30,11 @@
* + : addition
* - : subtraction
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.1 $ $Date: 2000-04-06 07:44:37 $
* @version $Revision: 1.2 $ $Date: 2001-07-02 20:10:48 $
**/
#include "Expr.h"
/**
* Creates a new AdditiveExpr using the default operator (ADDITION)
**/
AdditiveExpr::AdditiveExpr() {
this->op = ADDITION;
this->leftExpr = 0;
this->rightExpr = 0;
} //-- AdditiveExpr
/**
* Creates a new AdditiveExpr using the given operator
**/
@@ -58,20 +49,6 @@ AdditiveExpr::~AdditiveExpr() {
delete rightExpr;
} //-- ~AdditiveExpr
/**
* Sets the left side of this AdditiveExpr
**/
void AdditiveExpr::setLeftExpr(Expr* leftExpr) {
this->leftExpr = leftExpr;
} //-- setLeftExpr
/**
* Sets the right side of this AdditiveExpr
**/
void AdditiveExpr::setRightExpr(Expr* rightExpr) {
this->rightExpr = rightExpr;
} //-- setRightExpr
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: AttributeExpr.cpp,v 1.5 2001-06-26 14:07:18 peterv%netscape.com Exp $
* $Id: AttributeExpr.cpp,v 1.6 2001-07-02 20:10:49 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -36,22 +36,26 @@ const String AttributeExpr::WILD_CARD = "*";
//- Constructors -/
AttributeExpr::AttributeExpr() {
this->isNameWild = MB_FALSE;
this->isNamespaceWild = MB_FALSE;
} //-- AttributeExpr
AttributeExpr::AttributeExpr(String& name)
{
if (name.isEqual(WILD_CARD)) {
isNameWild = MB_TRUE;
isNamespaceWild = MB_TRUE;
return;
}
AttributeExpr::AttributeExpr(String& name) {
this->isNameWild = MB_FALSE;
this->isNamespaceWild = MB_FALSE;
setName(name);
} //-- AttributeExpr
int idx = name.indexOf(':');
if (idx >= 0)
name.subString(0, idx, prefix);
else
idx = -1;
/**
* Destructor
**/
AttributeExpr::~AttributeExpr() {
} //-- ~AttributeExpr
name.subString(idx+1, this->name);
//-- set flags
isNamespaceWild = MB_FALSE;
isNameWild = this->name.isEqual(WILD_CARD);
} //-- AttributeExpr
//------------------/
//- Public Methods -/
@@ -98,52 +102,10 @@ double AttributeExpr::getDefaultPriority(Node* node, Node* context, ContextState
return 0.0;
} //-- getDefaultPriority
/**
* Returns the name of this ElementExpr
* @return the name of this ElementExpr
**/
const String& AttributeExpr::getName() {
return (const String&) this->name;
} //-- getName
void AttributeExpr::setName(const String& name) {
if (name.isEqual(WILD_CARD)) {
this->isNameWild = MB_TRUE;
this->isNamespaceWild = MB_TRUE;
return;
}
int idx = name.indexOf(':');
if ( idx >= 0 )
name.subString(0,idx, this->prefix);
else
idx = -1;
name.subString(idx+1, this->name);
//-- set flags
this->isNamespaceWild = MB_FALSE;
this->isNameWild = this->name.isEqual(WILD_CARD);
} //-- setName
void AttributeExpr::setWild(MBool isWild) {
this->isNameWild = isWild;
this->isNamespaceWild = isWild;
} //-- setWild
//-----------------------------/
//- Methods from NodeExpr.cpp -/
//-----------------------------/
/**
* Returns the type of this NodeExpr
* @return the type of this NodeExpr
**/
short AttributeExpr::getType() {
return NodeExpr::ATTRIBUTE_EXPR;
} //-- getType
/**
* Determines whether this NodeExpr matches the given node within
* the given context

View File

@@ -21,26 +21,18 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: BasicNodeExpr.cpp,v 1.5 2001-06-30 13:54:26 sicking%bigfoot.com Exp $
* $Id: BasicNodeExpr.cpp,v 1.6 2001-07-02 20:10:50 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
/**
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.5 $ $Date: 2001-06-30 13:54:26 $
* @version $Revision: 1.6 $ $Date: 2001-07-02 20:10:50 $
**/
//- Constructors -/
/**
* Creates a new BasicNodeExpr, which matchs any Node
**/
BasicNodeExpr::BasicNodeExpr() {
this->type = NodeExpr::NODE_EXPR;
nodeNameSet = MB_FALSE;
} //-- BasicNodeExpr
/**
* Creates a new BasicNodeExpr of the given type
**/
@@ -49,11 +41,6 @@ BasicNodeExpr::BasicNodeExpr(NodeExpr::NodeExprType nodeExprType) {
nodeNameSet = MB_FALSE;
} //-- BasicNodeExpr
/**
* Destroys this NodeExpr
**/
BasicNodeExpr::~BasicNodeExpr() {};
//------------------/
//- Public Methods -/
//------------------/
@@ -98,14 +85,6 @@ double BasicNodeExpr::getDefaultPriority(Node* node, Node* context,
return -0.5;
} //-- getDefaultPriority
/**
* Returns the type of this NodeExpr
* @return the type of this NodeExpr
**/
short BasicNodeExpr::getType() {
return type;
} //-- getType
/**
* Determines whether this NodeExpr matches the given node within
* the given context

View File

@@ -26,7 +26,7 @@
* - If the left hand was false, the right hand expression
* was not getting checked.
*
* $Id: BooleanExpr.cpp,v 1.2 2000-05-24 05:00:25 kvisco%ziplink.net Exp $
* $Id: BooleanExpr.cpp,v 1.3 2001-07-02 20:10:50 sicking%bigfoot.com Exp $
*/
@@ -34,20 +34,11 @@
* Represents a BooleanExpr, a binary expression that
* performs a boolean operation between it's lvalue and rvalue:<BR/>
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.2 $ $Date: 2000-05-24 05:00:25 $
* @version $Revision: 1.3 $ $Date: 2001-07-02 20:10:50 $
**/
#include "Expr.h"
/**
* Creates a new BooleanExpr using the default operator (AND)
**/
BooleanExpr::BooleanExpr() {
this->op = AND;
this->leftExpr = 0;
this->rightExpr = 0;
} //-- BooleanExpr
/**
* Creates a new BooleanExpr using the given operator
**/
@@ -62,20 +53,6 @@ BooleanExpr::~BooleanExpr() {
delete rightExpr;
} //-- ~BooleanExpr
/**
* Sets the left side of this AdditiveExpr
**/
void BooleanExpr::setLeftExpr(Expr* leftExpr) {
this->leftExpr = leftExpr;
} //-- setLeftExpr
/**
* Sets the right side of this AdditiveExpr
**/
void BooleanExpr::setRightExpr(Expr* rightExpr) {
this->rightExpr = rightExpr;
} //-- setRightExpr
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -24,7 +24,7 @@
* Marina Mechtcheriakova, mmarina@mindspring.com
* -- added lang() implementation
*
* $Id: BooleanFunctionCall.cpp,v 1.8 2001-07-02 09:23:49 peterv%netscape.com Exp $
* $Id: BooleanFunctionCall.cpp,v 1.9 2001-07-02 20:10:50 sicking%bigfoot.com Exp $
*/
#include "FunctionLib.h"
@@ -33,32 +33,25 @@
/**
* Creates a default BooleanFunctionCall, which always evaluates to False
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.8 $ $Date: 2001-07-02 09:23:49 $
**/
BooleanFunctionCall::BooleanFunctionCall() : FunctionCall(XPathNames::FALSE_FN) {
this->type = TX_FALSE;
} //-- BooleanFunctionCall
/**
* Creates a BooleanFunctionCall of the given type
* @version $Revision: 1.9 $ $Date: 2001-07-02 20:10:50 $
**/
BooleanFunctionCall::BooleanFunctionCall(short type) : FunctionCall()
{
switch ( type ) {
case TX_BOOLEAN :
FunctionCall::setName(XPathNames::BOOLEAN_FN);
name = XPathNames::BOOLEAN_FN;
break;
case TX_LANG:
FunctionCall::setName(XPathNames::LANG_FN);
name = XPathNames::LANG_FN;
break;
case TX_NOT :
FunctionCall::setName(XPathNames::NOT_FN);
name = XPathNames::NOT_FN;
break;
case TX_TRUE :
FunctionCall::setName(XPathNames::TRUE_FN);
name = XPathNames::TRUE_FN;
break;
default:
FunctionCall::setName(XPathNames::FALSE_FN);
name = XPathNames::FALSE_FN;
break;
}
this->type = type;

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: BooleanResult.cpp,v 1.6 2001-01-22 09:36:14 kvisco%ziplink.net Exp $
* $Id: BooleanResult.cpp,v 1.7 2001-07-02 20:10:51 sicking%bigfoot.com Exp $
*/
/*
@@ -37,10 +37,6 @@ BooleanResult::BooleanResult() {
value = MB_FALSE;
} //-- BooleanResult
BooleanResult::BooleanResult(const BooleanResult& boolResult) {
this->value = boolResult.getValue();
} //-- BooleanResult
/**
* Creates a new BooleanResult with the value of the given MBool parameter
* @param boolean the MBool to use for initialization of this BooleanResult's value
@@ -49,14 +45,6 @@ BooleanResult::BooleanResult(MBool boolean) {
this->value = boolean;
} //-- BooleanResult
/**
* Returns the value of this BooleanResult
* @return the value of this BooleanResult
**/
MBool BooleanResult::getValue() const {
return this->value;
} //-- getValue
/*
* Virtual Methods from ExprResult
*/

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: ElementExpr.cpp,v 1.6 2001-05-14 14:22:46 axel%pike.org Exp $
* $Id: ElementExpr.cpp,v 1.7 2001-07-02 20:10:51 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -37,19 +37,20 @@ const String ElementExpr::WILD_CARD = "*";
//- Constructors -/
ElementExpr::ElementExpr() {
//-- do nothing
} //-- ElementExpr
ElementExpr::ElementExpr(String& name)
{
int idx = name.indexOf(':');
if (idx >= 0)
name.subString(0, idx, prefix);
else
idx = -1;
ElementExpr::ElementExpr(String& name) {
setName(name);
} //-- ElementExpr
name.subString(idx+1, this->name);
/**
* Destructor
**/
ElementExpr::~ElementExpr() {
} //-- ~ElementExpr
//-- set flags
isNameWild = this->name.isEqual(WILD_CARD);
isNamespaceWild = (isNameWild && (prefix.length() == 0));
} //-- ElementExpr
//------------------/
//- Public Methods -/
@@ -88,40 +89,10 @@ double ElementExpr::getDefaultPriority(Node* node, Node* context, ContextState*
return 0.0;
} //-- getDefaultPriority
/**
* Returns the name of this ElementExpr
* @return the name of this ElementExpr
**/
const String& ElementExpr::getName() {
return (const String&) this->name;
} //-- getName
void ElementExpr::setName(const String& name) {
int idx = name.indexOf(':');
if ( idx >= 0 )
name.subString(0,idx, this->prefix);
else
idx = -1;
name.subString(idx+1, this->name);
//-- set flags
this->isNameWild = this->name.isEqual(WILD_CARD);
this->isNamespaceWild = (isNameWild && (this->prefix.length() == 0));
} //-- setName
//-----------------------------/
//- Methods from NodeExpr.cpp -/
//-----------------------------/
/**
* Returns the type of this NodeExpr
* @return the type of this NodeExpr
**/
short ElementExpr::getType() {
return NodeExpr::ELEMENT_EXPR;
} //-- getType
/**
* Determines whether this NodeExpr matches the given node within
* the given context

View File

@@ -28,7 +28,7 @@
* -- removal of Patterns and some restructuring
* in the class set
*
* $Id: Expr.h,v 1.14 2001-06-30 13:54:27 sicking%bigfoot.com Exp $
* $Id: Expr.h,v 1.15 2001-07-02 20:10:52 sicking%bigfoot.com Exp $
*/
@@ -49,7 +49,7 @@
/*
XPath class definitions.
Much of this code was ported from XSL:P.
@version $Revision: 1.14 $ $Date: 2001-06-30 13:54:27 $
@version $Revision: 1.15 $ $Date: 2001-07-02 20:10:52 $
*/
//necessary prototypes
@@ -179,32 +179,18 @@ public:
**/
void addParam(Expr* expr);
/**
* Returns the name of this FunctionCall
* @return the name of this FunctionCall
**/
const String& getName();
virtual MBool requireParams(int paramCountMin, ContextState* cs);
virtual MBool requireParams(int paramCountMin,
int paramCountMax,
ContextState* cs);
/**
* Sets the function name of this FunctionCall
* @param name the name of this Function
**/
void setName(const String& name);
protected:
List params;
FunctionCall();
FunctionCall(const String& name);
FunctionCall(const String& name, List* parameters);
/**
* Evaluates the given Expression and converts it's result to a String.
@@ -218,8 +204,6 @@ protected:
**/
double evaluateToNumber(Expr* expr, Node* context, ContextState* cs);
private:
String name;
}; //-- FunctionCall
@@ -267,9 +251,7 @@ public:
TEXT_EXPR,
COMMENT_EXPR,
PI_EXPR,
NODE_EXPR,
WILD_CARD,
ROOT_EXPR
NODE_EXPR
};
virtual ~NodeExpr() {};
@@ -278,12 +260,6 @@ public:
//- Public Methods -/
//------------------/
/**
* Returns the type of this NodeExpr
* @return the type of this NodeExpr
**/
virtual short getType() = 0;
/**
* Virtual methods from Expr
**/
@@ -305,29 +281,12 @@ public:
//- Public Methods -/
//------------------/
AttributeExpr();
AttributeExpr(String& name);
virtual ~AttributeExpr();
void setWild(MBool isWild);
/**
* Returns the name of this AttributeExpr
* @return the name of this AttributeExpr
**/
const String& getName();
/**
* Sets the name of this AttributeExpr
* @param name the name of the element that this AttributeExpr matches
**/
void setName(const String& name);
/**
* Virtual methods from NodeExpr
**/
virtual ExprResult* evaluate(Node* context, ContextState* cs);
short getType();
virtual MBool matches(Node* node, Node* context, ContextState* cs);
virtual double getDefaultPriority(Node* node, Node* context, ContextState* cs);
virtual void toString(String& dest);
@@ -354,22 +313,11 @@ public:
//- Public Methods -/
//------------------/
/**
* Creates a new BasicNodeExpr of type NodeExpr::NODE_EXPR, which matches
* any node
**/
BasicNodeExpr();
/**
* Creates a new BasicNodeExpr of the given type
**/
BasicNodeExpr(NodeExprType nodeExprType);
/**
* Destroys this BasicNodeExpr
**/
virtual ~BasicNodeExpr();
/**
* Sets the name of the node to match. Only availible for pi nodes
**/
@@ -379,7 +327,6 @@ public:
* Virtual methods from NodeExpr
**/
virtual ExprResult* evaluate(Node* context, ContextState* cs);
short getType();
virtual MBool matches(Node* node, Node* context, ContextState* cs);
virtual double getDefaultPriority(Node* node, Node* context, ContextState* cs);
virtual void toString(String& dest);
@@ -402,27 +349,12 @@ public:
//- Public Methods -/
//------------------/
ElementExpr();
ElementExpr(String& name);
virtual ~ElementExpr();
/**
* Returns the name of this ElementExpr
* @return the name of this ElementExpr
**/
const String& getName();
/**
* Sets the name of this ElementExpr
* @param name the name of the element that this ElementExpr matches
**/
void setName(const String& name);
/**
* Virtual methods from NodeExpr
**/
virtual ExprResult* evaluate(Node* context, ContextState* cs);
short getType();
virtual double getDefaultPriority(Node* node, Node* context, ContextState* cs);
virtual MBool matches(Node* node, Node* context, ContextState* cs);
virtual void toString(String& dest);
@@ -432,11 +364,8 @@ private:
static const String WILD_CARD;
String name;
MBool isNamespaceWild;
MBool isNameWild;
String prefix;
}; //-- ElementExpr
@@ -456,7 +385,6 @@ public:
* Virtual methods from NodeExpr
**/
virtual ExprResult* evaluate(Node* context, ContextState* cs);
virtual short getType();
virtual MBool matches(Node* node, Node* context, ContextState* cs);
virtual double getDefaultPriority(Node* node, Node* context, ContextState* cs);
virtual void toString(String& dest);
@@ -495,12 +423,6 @@ public:
**/
MBool isEmpty();
/**
* Removes the given Expr from the list
* @param expr the Expr to remove from the list
**/
Expr* remove(Expr* expr);
/**
* Returns the String representation of this PredicateList.
* @param dest the String to use when creating the String
@@ -538,19 +460,6 @@ public:
SELF_AXIS
};
/**
* Creates a new LocationStep using the default Axis Identifier and no
* NodeExpr (which matches nothing)
**/
LocationStep();
/**
* Creates a new LocationStep using the default Axis Identifier and
* the given NodeExpr
* @param nodeExpr the NodeExpr to use when matching Nodes
**/
LocationStep(NodeExpr* nodeExpr);
/**
* Creates a new LocationStep using the given NodeExpr and Axis Identifier
* @param nodeExpr the NodeExpr to use when matching Nodes
@@ -563,18 +472,6 @@ public:
**/
virtual ~LocationStep();
/**
* Sets the Axis Identifier for this LocationStep
* @param axisIdentifier the Axis in which to search for nodes
**/
void setAxisIdentifier(short axisIdentifier);
/**
* Sets the NodeExpr of this LocationStep for use when matching nodes
* @param nodeExpr the NodeExpr to use when matching nodes
**/
void setNodeExpr(NodeExpr* nodeExpr);
/**
* Virtual methods from Expr
**/
@@ -598,12 +495,6 @@ class FilterExpr : public PredicateList, public Expr {
public:
/**
* Creates a new FilterExpr using the default no default Expr
* (which evaluates to nothing)
**/
FilterExpr();
/**
* Creates a new FilterExpr using the given Expr
* @param expr the Expr to use for evaluation
@@ -615,12 +506,6 @@ public:
**/
virtual ~FilterExpr();
/**
* Sets the Expr of this FilterExpr for evaluation
* @param expr the Expr to use for evaluation
**/
void setExpr(Expr* expr);
/**
* Virtual methods from Expr
**/
@@ -630,7 +515,6 @@ public:
virtual void toString(String& dest);
private:
Expr* expr;
}; //-- FilterExpr
@@ -640,9 +524,7 @@ class NumberExpr : public Expr {
public:
NumberExpr();
NumberExpr(double dbl);
~NumberExpr();
/**
* Virtual methods from Expr
@@ -662,11 +544,7 @@ class StringExpr : public Expr {
public:
StringExpr();
StringExpr(String& value);
StringExpr(const String& value);
StringExpr(const char* value);
~StringExpr();
/**
* Virtual methods from Expr
@@ -694,21 +572,9 @@ public:
//-- LF, changed from static const short to enum
enum _AdditiveExprType { ADDITION = 1, SUBTRACTION };
AdditiveExpr();
AdditiveExpr(Expr* leftExpr, Expr* rightExpr, short op);
~AdditiveExpr();
/**
* Sets the left side of this AdditiveExpr
**/
void setLeftExpr(Expr* leftExpr);
/**
* Sets the right side of this AdditiveExpr
**/
void setRightExpr(Expr* rightExpr);
/**
* Virtual methods from Expr
**/
@@ -728,15 +594,9 @@ class UnaryExpr : public Expr {
public:
UnaryExpr();
UnaryExpr(Expr* expr);
~UnaryExpr();
/**
* Sets the expression to negate
**/
void setExpr(Expr* expr);
/**
* Virtual methods from Expr
**/
@@ -758,21 +618,9 @@ public:
//-- BooleanExpr Types
enum _BooleanExprType { AND = 1, OR };
BooleanExpr();
BooleanExpr(Expr* leftExpr, Expr* rightExpr, short op);
~BooleanExpr();
/**
* Sets the left side of this BooleanExpr
**/
void setLeftExpr(Expr* leftExpr);
/**
* Sets the right side of this BooleanExpr
**/
void setRightExpr(Expr* rightExpr);
/**
* Virtual methods from Expr
**/
@@ -801,20 +649,9 @@ public:
//-- LF, changed from static const short to enum
enum _MultiplicativeExprType { DIVIDE = 1, MULTIPLY, MODULUS };
MultiplicativeExpr();
MultiplicativeExpr(Expr* leftExpr, Expr* rightExpr, short op);
~MultiplicativeExpr();
/**
* Sets the left side of this MultiplicativeExpr
**/
void setLeftExpr(Expr* leftExpr);
/**
* Sets the right side of this MultiplicativeExpr
**/
void setRightExpr(Expr* rightExpr);
/**
* Virtual methods from Expr
**/
@@ -852,7 +689,6 @@ public:
GREATER_OR_EQUAL
};
RelationalExpr();
RelationalExpr(Expr* leftExpr, Expr* rightExpr, short op);
~RelationalExpr();
@@ -878,15 +714,7 @@ class VariableRefExpr : public Expr {
public:
VariableRefExpr();
VariableRefExpr(const String& name);
VariableRefExpr(String& name);
~VariableRefExpr();
/**
* Sets the name of the variable of reference
**/
void setName(const String& name);
/**
* Virtual methods from Expr
@@ -921,21 +749,12 @@ public:
**/
virtual ~PathExpr();
/**
* Adds the Expr to this PathExpr
* @param expr the Expr to add to this PathExpr
* @param index the index at which to add the given Expr
**/
void addExpr(int index, Expr* expr, short ancestryOp);
/**
* Adds the Expr to this PathExpr
* @param expr the Expr to add to this PathExpr
**/
void addExpr(Expr* expr, short ancestryOp);
virtual MBool isAbsolute();
/**
* Virtual methods from Expr
**/
@@ -946,6 +765,8 @@ public:
private:
virtual MBool isAbsolute();
struct PathExprItem {
Expr* expr;
short ancestryOp;
@@ -984,9 +805,6 @@ public:
virtual double getDefaultPriority(Node* node, Node* context, ContextState* cs);
virtual void toString(String& dest);
virtual MBool isAbsolute();
}; //-- RootExpr
/**
@@ -1012,12 +830,6 @@ public:
**/
void addExpr(Expr* expr);
/**
* Adds the PathExpr to this UnionExpr at the specified index
* @param expr the Expr to add to this UnionExpr
**/
void addExpr(int index, Expr* expr);
/**
* Virtual methods from Expr
**/

View File

@@ -30,7 +30,7 @@
* -- fixed bug in ::parsePredicates,
* made sure we continue looking for more predicates.
*
* $Id: ExprParser.cpp,v 1.15 2001-07-02 09:24:06 peterv%netscape.com Exp $
* $Id: ExprParser.cpp,v 1.16 2001-07-02 20:10:52 sicking%bigfoot.com Exp $
*/
/**
@@ -38,7 +38,7 @@
* This class is used to parse XSL Expressions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @see ExprLexer
* @version $Revision: 1.15 $ $Date: 2001-07-02 09:24:06 $
* @version $Revision: 1.16 $ $Date: 2001-07-02 20:10:52 $
**/
#include "ExprParser.h"
@@ -168,12 +168,6 @@ Expr* ExprParser::createPatternExpr(const String& pattern) {
return expr;
} //-- createPatternExpr
LocationStep* ExprParser::createLocationStep(const String& path) {
ExprLexer lexer(path);
LocationStep* lstep = createLocationStep(lexer);
return lstep;
} //-- createLocationPath
//--------------------/
//- Private Methods -/
//-------------------/
@@ -353,8 +347,7 @@ Expr* ExprParser::createFilterExpr(ExprLexer& lexer) {
if (lexer.peek()->type == Token::L_BRACKET) {
FilterExpr* filterExpr = new FilterExpr();
filterExpr->setExpr(expr);
FilterExpr* filterExpr = new FilterExpr(expr);
//-- handle predicates
if (!parsePredicates(filterExpr, lexer)) {
@@ -396,7 +389,7 @@ FunctionCall* ExprParser::createFunctionCall(ExprLexer& lexer) {
fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::COUNT);
}
else if (XPathNames::FALSE_FN.isEqual(tok->value)) {
fnCall = new BooleanFunctionCall();
fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_FALSE);
}
else if (XPathNames::ID_FN.isEqual(tok->value)) {
fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::ID);
@@ -480,8 +473,6 @@ FunctionCall* ExprParser::createFunctionCall(ExprLexer& lexer) {
LocationStep* ExprParser::createLocationStep(ExprLexer& lexer) {
LocationStep* lstep = new LocationStep();
//-- child axis is default
short axisIdentifier = LocationStep::CHILD_AXIS;
NodeExpr* nodeExpr = 0;
@@ -534,7 +525,6 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer) {
axisIdentifier = LocationStep::SELF_AXIS;
}
else {
delete lstep;
//XXX ErrorReport: unknow axis
return 0;
}
@@ -549,13 +539,13 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer) {
//-- eat token
lexer.nextToken();
axisIdentifier = LocationStep::PARENT_AXIS;
nodeExpr = new BasicNodeExpr();
nodeExpr = new BasicNodeExpr(NodeExpr::NODE_EXPR);
break;
case Token::SELF_NODE :
//-- eat token
lexer.nextToken();
axisIdentifier = LocationStep::SELF_AXIS;
nodeExpr = new BasicNodeExpr();
nodeExpr = new BasicNodeExpr(NodeExpr::NODE_EXPR);
break;
default:
break;
@@ -578,14 +568,12 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer) {
lexer.pushBack();
nodeExpr = createNodeExpr(lexer);
if (!nodeExpr) {
delete lstep;
return 0;
}
}
}
lstep->setAxisIdentifier(axisIdentifier);
lstep->setNodeExpr(nodeExpr);
LocationStep* lstep = new LocationStep(nodeExpr, axisIdentifier);
//-- handle predicates
if (!parsePredicates(lstep, lexer)) {
@@ -611,7 +599,7 @@ NodeExpr* ExprParser::createNodeExpr(ExprLexer& lexer) {
nodeExpr = new BasicNodeExpr(NodeExpr::COMMENT_EXPR);
break;
case Token::NODE :
nodeExpr = new BasicNodeExpr();
nodeExpr = new BasicNodeExpr(NodeExpr::NODE_EXPR);
break;
case Token::PROC_INST :
nodeExpr = new BasicNodeExpr(NodeExpr::PI_EXPR);

View File

@@ -21,14 +21,14 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: ExprParser.h,v 1.5 2001-06-30 13:54:30 sicking%bigfoot.com Exp $
* $Id: ExprParser.h,v 1.6 2001-07-02 20:10:54 sicking%bigfoot.com Exp $
*/
/**
* ExprParser
* This class is used to parse XSL Expressions
* @author <A href="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.5 $ $Date: 2001-06-30 13:54:30 $
* @version $Revision: 1.6 $ $Date: 2001-07-02 20:10:54 $
* @see ExprLexer
**/
@@ -56,7 +56,6 @@ public:
Expr* createExpr (const String& pattern);
Expr* createPatternExpr (const String& pattern);
LocationStep* createLocationStep(const String& path);
/**
* Creates an Attribute Value Template using the given value

View File

@@ -23,7 +23,7 @@
* Larry Fitzpatrick, OpenText, lef@opentext.com
* -- changed constant short result types to enum
*
* $Id: ExprResult.h,v 1.10 2001-05-12 09:54:15 nisheeth%netscape.com Exp $
* $Id: ExprResult.h,v 1.11 2001-07-02 20:10:55 sicking%bigfoot.com Exp $
*/
#ifndef TRANSFRMX_EXPRRESULT_H
@@ -88,9 +88,6 @@ public:
BooleanResult();
BooleanResult(MBool boolean);
BooleanResult(const BooleanResult& boolResult);
MBool getValue() const;
virtual short getResultType();
virtual void stringValue(String& str);
@@ -107,10 +104,6 @@ public:
NumberResult();
NumberResult(double dbl);
NumberResult(const NumberResult& nbrResult);
double getValue() const;
MBool isNaN() const;
virtual short getResultType();
virtual void stringValue(String& str);
@@ -128,13 +121,9 @@ class StringResult : public ExprResult {
public:
StringResult();
StringResult(String& str);
StringResult(const String& str);
StringResult(const StringResult& strResult);
StringResult(const char* str);
String& getValue();
virtual short getResultType();
virtual void stringValue(String& str);
virtual MBool booleanValue();

View File

@@ -23,7 +23,7 @@
* Bob Miller, kbob@oblix.com
* -- plugged core leak.
*
* $Id: FilterExpr.cpp,v 1.1 2000-04-06 07:45:30 kvisco%ziplink.net Exp $
* $Id: FilterExpr.cpp,v 1.2 2001-07-02 20:10:56 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -31,15 +31,11 @@
/**
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:30 $
* @version $Revision: 1.2 $ $Date: 2001-07-02 20:10:56 $
**/
//-- Implementation of FilterExpr --/
FilterExpr::FilterExpr() : PredicateList() {
expr = 0;
}
/**
* Creates a new FilterExpr using the given Expr
* @param expr the Expr to use for evaluation
@@ -55,15 +51,6 @@ FilterExpr::~FilterExpr() {
delete expr;
} //-- ~FilterExpr
/**
* Sets the Expr of this FilterExpr for use during evaluation
* @param expr the Expr to use for evaluation
**/
void FilterExpr::setExpr(Expr* expr) {
this->expr = expr;
} //-- setExpr
//------------------------------------/
//- Virtual methods from PatternExpr -/
//------------------------------------/

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: FunctionCall.cpp,v 1.3 2001-06-30 13:54:31 sicking%bigfoot.com Exp $
* $Id: FunctionCall.cpp,v 1.4 2001-07-02 20:10:56 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -29,7 +29,7 @@
/**
* This class represents a FunctionCall as defined by the XSL Working Draft
* @author <A HREF="mailto:kvisco@ziplink">Keith Visco</A>
* @version $Revision: 1.3 $ $Date: 2001-06-30 13:54:31 $
* @version $Revision: 1.4 $ $Date: 2001-07-02 20:10:56 $
**/
const String FunctionCall::INVALID_PARAM_COUNT =
@@ -55,27 +55,6 @@ FunctionCall::FunctionCall(const String& name)
this->name = name;
} //-- FunctionCall
/**
* Creates a new FunctionCall with the given function name and parameter list
* Note: The object references in parameters will be deleted when this
* FunctionCall gets destroyed.
**/
FunctionCall::FunctionCall(const String& name, List* parameters)
{
//-- copy name
this->name = name;
if (parameters) {
ListIterator* pIter = parameters->iterator();
while (pIter->hasNext()) {
params.add(pIter->next());
}
delete pIter;
}
} //-- FunctionCall
/**
* Destructor
**/
@@ -160,15 +139,6 @@ double FunctionCall::evaluateToNumber(Expr* expr, Node* context,
return result;
} //-- evaluateToNumber
/**
* Returns the name of this FunctionCall
* @return the name of this FunctionCall
**/
const String& FunctionCall::getName()
{
return (const String&)this->name;
} //-- getName
/**
* Called to check number of parameters
**/
@@ -201,16 +171,6 @@ MBool FunctionCall::requireParams(int paramCountMin, ContextState* cs)
return MB_TRUE;
} //-- requireParams
/**
* Sets the function name of this FunctionCall
* @param name the name of this Function
**/
void FunctionCall::setName(const String& name)
{
this->name.clear();
this->name.append(name);
} //-- setName
/**
* Returns the String representation of this NodeExpr.
* @param dest the String to use when creating the String

View File

@@ -27,7 +27,7 @@
* Marina Mechtcheriakova
* -- added support for lang function
*
* $Id: FunctionLib.h,v 1.10 2001-04-08 14:34:04 peterv%netscape.com Exp $
* $Id: FunctionLib.h,v 1.11 2001-07-02 20:10:57 sicking%bigfoot.com Exp $
*/
#ifndef TRANSFRMX_FUNCTIONLIB_H
@@ -115,11 +115,6 @@ public:
enum booleanFunctions { TX_BOOLEAN = 1, TX_FALSE, TX_LANG, TX_NOT, TX_TRUE };
/**
* Creates a default BooleanFunctionCall, which always evaluates to False
**/
BooleanFunctionCall();
/**
* Creates a BooleanFunctionCall of the given type
**/
@@ -265,11 +260,6 @@ public:
POSITION //-- position()
};
/**
* Creates a default NodeSetFunction call. Position function is the default.
**/
NodeSetFunctionCall();
/**
* Creates a NodeSetFunctionCall of the given type
**/
@@ -309,11 +299,6 @@ public:
TRANSLATE //-- translate()
};
/**
* Creates a default String function. String() function is the default.
**/
StringFunctionCall();
/**
* Creates a String function of the given type
**/
@@ -349,11 +334,6 @@ public:
SUM //-- sum()
};
/**
* Creates a default Number function. number() function is the default.
**/
NumberFunctionCall();
/**
* Creates a Number function of the given type
**/

View File

@@ -21,35 +21,16 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: LocationStep.cpp,v 1.8 2001-06-26 14:08:19 peterv%netscape.com Exp $
* $Id: LocationStep.cpp,v 1.9 2001-07-02 20:10:57 sicking%bigfoot.com Exp $
*/
/*
Implementation of an XPath LocationStep
@version $Revision: 1.8 $ $Date: 2001-06-26 14:08:19 $
@version $Revision: 1.9 $ $Date: 2001-07-02 20:10:57 $
*/
#include "Expr.h"
/**
* Creates a new LocationStep using the default Axis Identifier and no
* NodeExpr (which matches nothing)
**/
LocationStep::LocationStep() : PredicateList() {
nodeExpr = 0;
this->axisIdentifier = CHILD_AXIS;
} //-- LocationStep
/**
* Creates a new LocationStep using the default Axis Identifier and
* the given NodeExpr
* @param nodeExpr the NodeExpr to use when matching Nodes
**/
LocationStep::LocationStep(NodeExpr* nodeExpr) : PredicateList() {
this->nodeExpr = nodeExpr;
this->axisIdentifier = CHILD_AXIS;
} //-- LocationStep
/**
* Creates a new LocationStep using the given NodeExpr and Axis Identifier
* @param nodeExpr the NodeExpr to use when matching Nodes
@@ -69,26 +50,6 @@ LocationStep::~LocationStep() {
delete nodeExpr;
} //-- ~LocationStep
/**
* Sets the Axis Identifier for this LocationStep
* @param axisIdentifier the Axis in which to search for nodes
**/
void LocationStep::setAxisIdentifier(short axisIdentifier) {
this->axisIdentifier = axisIdentifier;
} //-- setAxisIdentifier
/**
* Sets the NodeExpr of this LocationStep for use when matching nodes
* @param nodeExpr the NodeExpr to use when matching nodes
**/
void LocationStep::setNodeExpr(NodeExpr* nodeExpr) {
// delete current NodeExpr
if (this->nodeExpr) delete this->nodeExpr;
this->nodeExpr = nodeExpr;
} //-- setNodeExpr
//------------------------------------/
//- Virtual methods from PatternExpr -/
//------------------------------------/

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: MultiplicativeExpr.cpp,v 1.2 2001-04-08 14:39:37 peterv%netscape.com Exp $
* $Id: MultiplicativeExpr.cpp,v 1.3 2001-07-02 20:10:57 sicking%bigfoot.com Exp $
*/
/**
@@ -31,21 +31,12 @@
* mod : modulus
* div : divide
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.2 $ $Date: 2001-04-08 14:39:37 $
* @version $Revision: 1.3 $ $Date: 2001-07-02 20:10:57 $
**/
#include "Expr.h"
#include <math.h>
/**
* Creates a new MultiplicativeExpr using the default operator (MULTIPLY)
**/
MultiplicativeExpr::MultiplicativeExpr() {
this->op = MULTIPLY;
this->leftExpr = 0;
this->rightExpr = 0;
} //-- RelationalExpr
/**
* Creates a new MultiplicativeExpr using the given operator
**/
@@ -60,20 +51,6 @@ MultiplicativeExpr::~MultiplicativeExpr() {
delete rightExpr;
} //-- ~MultiplicativeExpr
/**
* Sets the left side of this MultiplicativeExpr
**/
void MultiplicativeExpr::setLeftExpr(Expr* leftExpr) {
this->leftExpr = leftExpr;
} //-- setLeftExpr
/**
* Sets the right side of this MultiplicativeExpr
**/
void MultiplicativeExpr::setRightExpr(Expr* rightExpr) {
this->rightExpr = rightExpr;
} //-- setRightExpr
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -39,7 +39,7 @@
* NodeSet <BR />
* This class was ported from XSL:P. <BR />
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.9 $ $Date: 2001-06-10 16:44:10 $
* @version $Revision: 1.10 $ $Date: 2001-07-02 20:10:57 $
**/
@@ -167,25 +167,6 @@ void NodeSet::copyInto(NodeSet& dest) const {
for ( int i = 0; i < elementCount; i++ ) dest.add(elements[i]);
} //-- copyInto
/**
* Compares the specified object with this NodeSet for equality.
* Returns true if and only if the specified Object is a NodeSet
* that is the same size as this NodeSet and all of its associated
* Nodes are contained within this NodeSet.
* @return true if and only if the specified Object is a NodeSet
* that is the same size as this NodeSet and all of its associated
* Nodes are contained within this NodeSet.
**/
MBool NodeSet::equals(NodeSet* nodeSet) {
if (!nodeSet) return MB_FALSE;
if (nodeSet->size() != size()) return MB_FALSE;
for (int i = 0; i < size(); i++) {
if (!nodeSet->contains(get(i))) return MB_FALSE;
}
return MB_TRUE;
} //-- equals
/**
* Returns the Node at the specified position in this NodeSet.
* @param index the position of the Node to return
@@ -254,7 +235,6 @@ MBool NodeSet::remove(Node* node) {
return MB_TRUE;
} //-- remove
/**
* Enables or disables checking for duplicates. By default
* the #add method will check for duplicate nodes. This should

View File

@@ -24,13 +24,13 @@
* Larry Fitzpatrick, OpenText, lef@opentext.com
* -- moved initialization of DEFAULT_SIZE to NodeSet.cpp
*
* $Id: NodeSet.h,v 1.7 2001-04-08 14:36:12 peterv%netscape.com Exp $
* $Id: NodeSet.h,v 1.8 2001-07-02 20:10:58 sicking%bigfoot.com Exp $
*/
/**
* NodeSet
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.7 $ $Date: 2001-04-08 14:36:12 $
* @version $Revision: 1.8 $ $Date: 2001-07-02 20:10:58 $
**/
#ifndef TRANSFRMX_NODESET_H
@@ -104,17 +104,6 @@ public:
**/
void copyInto(NodeSet& dest) const;
/**
* Compares the specified object with this NodeSet for equality.
* Returns true if and only if the specified Object is a NodeSet
* that is the same size as this NodeSet and all of its associated
* Nodes are contained within this NodeSet.
* @return true if and only if the specified Object is a NodeSet
* that is the same size as this NodeSet and all of its associated
* Nodes are contained within this NodeSet.
**/
MBool equals(NodeSet* nodeSet);
/**
* Returns the Node at the specified position in this NodeSet.
* @param index the position of the Node to return
@@ -156,7 +145,6 @@ public:
**/
MBool remove(Node* node);
/**
* Enables or disables checking for duplicates. By default
* the #add method will check for duplicate nodes. This should

View File

@@ -24,14 +24,14 @@
* Marina Mechtcheriakova, mmarina@mindspring.com
* -- changed some behavoir to be more compliant with spec
*
* $Id: NodeSetFunctionCall.cpp,v 1.7 2001-06-26 14:09:10 peterv%netscape.com Exp $
* $Id: NodeSetFunctionCall.cpp,v 1.8 2001-07-02 20:10:59 sicking%bigfoot.com Exp $
*/
/**
* NodeSetFunctionCall
* A representation of the XPath NodeSet funtions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.7 $ $Date: 2001-06-26 14:09:10 $
* @version $Revision: 1.8 $ $Date: 2001-07-02 20:10:59 $
**/
#include "FunctionLib.h"
@@ -39,14 +39,6 @@
#include "XMLDOMUtils.h"
#include <math.h>
/**
* Creates a default NodeSetFunctionCall. The Position function
* is the default
**/
NodeSetFunctionCall::NodeSetFunctionCall() : FunctionCall(XPathNames::POSITION_FN) {
type = POSITION;
} //-- NodeSetFunctionCall
/**
* Creates a NodeSetFunctionCall of the given type
**/
@@ -54,25 +46,25 @@ NodeSetFunctionCall::NodeSetFunctionCall(short type) : FunctionCall() {
this->type = type;
switch ( type ) {
case COUNT :
FunctionCall::setName(XPathNames::COUNT_FN);
name = XPathNames::COUNT_FN;
break;
case ID :
FunctionCall::setName(XPathNames::ID_FN);
name = XPathNames::ID_FN;
break;
case LAST :
FunctionCall::setName(XPathNames::LAST_FN);
name = XPathNames::LAST_FN;
break;
case LOCAL_NAME:
FunctionCall::setName(XPathNames::LOCAL_NAME_FN);
name = XPathNames::LOCAL_NAME_FN;
break;
case NAME:
FunctionCall::setName(XPathNames::NAME_FN);
name = XPathNames::NAME_FN;
break;
case NAMESPACE_URI:
FunctionCall::setName(XPathNames::NAMESPACE_URI_FN);
name = XPathNames::NAMESPACE_URI_FN;
break;
default:
FunctionCall::setName(XPathNames::POSITION_FN);
name = XPathNames::POSITION_FN;
break;
}
} //-- NodeSetFunctionCall

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: NumberExpr.cpp,v 1.2 2001-01-22 09:36:18 kvisco%ziplink.net Exp $
* $Id: NumberExpr.cpp,v 1.3 2001-07-02 20:11:00 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -30,17 +30,10 @@
//- NumberExpr -/
//--------------/
NumberExpr::NumberExpr() {
_value = 0.0;
} //-- NumberExpr
NumberExpr::NumberExpr(double dbl) {
_value = dbl;
} //-- NumberExpr
NumberExpr::~NumberExpr() {
} //-- ~NumberExpr
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -25,7 +25,7 @@
* Nisheeth Ranjan, nisheeth@netscape.com
* -- implemented rint function, which was not available on Windows.
*
* $Id: NumberFunctionCall.cpp,v 1.13 2001-07-02 09:24:20 peterv%netscape.com Exp $
* $Id: NumberFunctionCall.cpp,v 1.14 2001-07-02 20:11:00 sicking%bigfoot.com Exp $
*/
/*
@@ -38,14 +38,6 @@
#include "XMLDOMUtils.h"
#include <math.h>
/**
* Creates a default NumberFunctionCall. The number() function
* is the default
**/
NumberFunctionCall::NumberFunctionCall() : FunctionCall(XPathNames::NUMBER_FN) {
type = NUMBER;
} //-- NumberFunctionCall
/**
* Creates a NumberFunctionCall of the given type
**/
@@ -53,20 +45,20 @@ NumberFunctionCall::NumberFunctionCall(short type) : FunctionCall() {
this->type = type;
switch ( type ) {
case ROUND :
FunctionCall::setName(XPathNames::ROUND_FN);
name = XPathNames::ROUND_FN;
break;
case CEILING :
FunctionCall::setName(XPathNames::CEILING_FN);
name = XPathNames::CEILING_FN;
break;
case FLOOR :
FunctionCall::setName(XPathNames::FLOOR_FN);
name = XPathNames::FLOOR_FN;
break;
case SUM :
FunctionCall::setName(XPathNames::SUM_FN);
name = XPathNames::SUM_FN;
break;
case NUMBER :
default :
FunctionCall::setName(XPathNames::NUMBER_FN);
name = XPathNames::NUMBER_FN;
break;
}
} //-- NumberFunctionCall

View File

@@ -21,14 +21,14 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: NumberResult.cpp,v 1.6 2001-01-22 09:36:18 kvisco%ziplink.net Exp $
* $Id: NumberResult.cpp,v 1.7 2001-07-02 20:11:00 sicking%bigfoot.com Exp $
*/
/**
* NumberResult
* Represents the a number as the result of evaluating an Expr
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.6 $ $Date: 2001-01-22 09:36:18 $
* @version $Revision: 1.7 $ $Date: 2001-07-02 20:11:00 $
**/
#include "ExprResult.h"
@@ -40,10 +40,6 @@ NumberResult::NumberResult() {
value = 0.0;
} //-- NumberResult
NumberResult::NumberResult(const NumberResult& nbrResult) {
this->value = nbrResult.getValue();
} //-- NumberResult
/**
* Creates a new NumberResult with the value of the given double parameter
* @param dbl the double to use for initialization of this NumberResult's value
@@ -52,21 +48,6 @@ NumberResult::NumberResult(double dbl) {
this->value = dbl;
} //-- NumberResult
/**
* Returns the value of this NumberResult
* @return the value of this NumberResult
**/
double NumberResult::getValue() const {
return this->value;
} //-- getValue
/**
*
**/
MBool NumberResult::isNaN() const {
return Double::isNaN(value);
} //-- isNaN
/*
* Virtual Methods from ExprResult
*/
@@ -87,7 +68,7 @@ MBool NumberResult::booleanValue() {
// OG+
// As per the XPath spec, the boolean value of a number is true if and only if
// it is neither positive 0 nor negative 0 nor NaN
return (MBool)(this->value != 0.0 && this->value != -0.0 && ! isNaN());
return (MBool)(value != 0.0 && !Double::isNaN(value));
// OG-
} //-- booleanValue

View File

@@ -29,7 +29,7 @@
* - foo//bar would not match properly if there was more than
* one node in the NodeSet (nodes) on the final iteration
*
* $Id: PathExpr.cpp,v 1.8 2001-07-02 09:24:32 peterv%netscape.com Exp $
* $Id: PathExpr.cpp,v 1.9 2001-07-02 20:11:01 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -63,21 +63,6 @@ PathExpr::~PathExpr()
delete iter;
} //-- ~PathExpr
/**
* Adds the Expr to this PathExpr
* @param expr the Expr to add to this PathExpr
* @param index the index at which to add the given Expr
**/
void PathExpr::addExpr(int index, Expr* expr, short ancestryOp)
{
if (expr) {
PathExprItem* pxi = new PathExprItem;
pxi->expr = expr;
pxi->ancestryOp = ancestryOp;
expressions.insert(index, pxi);
}
} //-- addPattenExpr
/**
* Adds the Expr to this PathExpr
* @param expr the Expr to add to this PathExpr

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: PredicateList.cpp,v 1.3 2001-06-20 06:00:33 margaret.chan%sun.com Exp $
* $Id: PredicateList.cpp,v 1.4 2001-07-02 20:11:01 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -30,7 +30,7 @@
* Represents an ordered list of Predicates,
* for use with Step and Filter Expressions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.3 $ $Date: 2001-06-20 06:00:33 $
* @version $Revision: 1.4 $ $Date: 2001-07-02 20:11:01 $
**/
//-- PredicateList Implementation --/
@@ -123,14 +123,6 @@ MBool PredicateList::isEmpty() {
return (MBool)(predicates.getLength() == 0);
} //-- isEmpty
/**
* Removes the given Expr from the list
* @param expr the Expr to remove from the list
**/
Expr* PredicateList::remove(Expr* expr) {
return (Expr*)predicates.remove(expr);
} //-- remove
void PredicateList::toString(String& dest) {
ListIterator* iter = predicates.iterator();

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: RelationalExpr.cpp,v 1.5 2001-04-03 12:36:03 peterv%netscape.com Exp $
* $Id: RelationalExpr.cpp,v 1.6 2001-07-02 20:11:02 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -31,12 +31,6 @@
//- RelationalExpr -/
//------------------/
RelationalExpr::RelationalExpr() {
this->op = EQUAL;
this->leftExpr = 0;
this->rightExpr = 0;
} //-- RelationalExpr
RelationalExpr::RelationalExpr(Expr* leftExpr, Expr* rightExpr, short op) {
this->op = op;
this->leftExpr = leftExpr;

View File

@@ -21,15 +21,11 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: RootExpr.cpp,v 1.1 2000-04-06 07:45:39 kvisco%ziplink.net Exp $
* $Id: RootExpr.cpp,v 1.2 2001-07-02 20:11:03 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
MBool RootExpr::isAbsolute() {
return MB_TRUE;
} //-- isAbsolute
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: StringExpr.cpp,v 1.3 2001-06-30 13:54:34 sicking%bigfoot.com Exp $
* $Id: StringExpr.cpp,v 1.4 2001-07-02 20:11:04 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -29,34 +29,17 @@
/**
* StringExpr
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.3 $ $Date: 2001-06-30 13:54:34 $
* @version $Revision: 1.4 $ $Date: 2001-07-02 20:11:04 $
**/
/**
* Creates a new StringExpr
**/
StringExpr::StringExpr() {};
StringExpr::StringExpr(String& value) {
//-- copy value
this->value = value;
} //-- StringExpr
StringExpr::StringExpr(const String& value) {
//-- copy value
this->value.append(value);
} //-- StringExpr
StringExpr::StringExpr(const char* value) {
//-- copy value
this->value.append(value);
} //-- StringExpr
/**
* Default Destructor
**/
StringExpr::~StringExpr() {};
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -21,14 +21,14 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: StringFunctionCall.cpp,v 1.11 2001-07-02 09:24:39 peterv%netscape.com Exp $
* $Id: StringFunctionCall.cpp,v 1.12 2001-07-02 20:11:05 sicking%bigfoot.com Exp $
*/
/**
* StringFunctionCall
* A representation of the XPath String funtions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.11 $ $Date: 2001-07-02 09:24:39 $
* @version $Revision: 1.12 $ $Date: 2001-07-02 20:11:05 $
**/
#include "FunctionLib.h"
@@ -36,14 +36,6 @@
#include "XMLDOMUtils.h"
#include <math.h>
/**
* Creates a default StringFunctionCall. The string() function
* is the default
**/
StringFunctionCall::StringFunctionCall() : FunctionCall(XPathNames::STRING_FN) {
type = STRING;
} //-- StringFunctionCall
/**
* Creates a StringFunctionCall of the given type
**/
@@ -51,31 +43,31 @@ StringFunctionCall::StringFunctionCall(short type) : FunctionCall() {
this->type = type;
switch ( type ) {
case CONCAT:
FunctionCall::setName(XPathNames::CONCAT_FN);
name = XPathNames::CONCAT_FN;
break;
case CONTAINS:
FunctionCall::setName(XPathNames::CONTAINS_FN);
name = XPathNames::CONTAINS_FN;
break;
case STARTS_WITH:
FunctionCall::setName(XPathNames::STARTS_WITH_FN);
name = XPathNames::STARTS_WITH_FN;
break;
case STRING_LENGTH:
FunctionCall::setName(XPathNames::STRING_LENGTH_FN);
name = XPathNames::STRING_LENGTH_FN;
break;
case SUBSTRING:
FunctionCall::setName(XPathNames::SUBSTRING_FN);
name = XPathNames::SUBSTRING_FN;
break;
case SUBSTRING_AFTER:
FunctionCall::setName(XPathNames::SUBSTRING_AFTER_FN);
name = XPathNames::SUBSTRING_AFTER_FN;
break;
case SUBSTRING_BEFORE:
FunctionCall::setName(XPathNames::SUBSTRING_BEFORE_FN);
name = XPathNames::SUBSTRING_BEFORE_FN;
break;
case TRANSLATE:
FunctionCall::setName(XPathNames::TRANSLATE_FN);
name = XPathNames::TRANSLATE_FN;
break;
default:
FunctionCall::setName(XPathNames::STRING_FN);
name = XPathNames::STRING_FN;
break;
}
} //-- StringFunctionCall

View File

@@ -21,33 +21,23 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: StringResult.cpp,v 1.7 2001-05-12 09:54:16 nisheeth%netscape.com Exp $
* $Id: StringResult.cpp,v 1.8 2001-07-02 20:11:05 sicking%bigfoot.com Exp $
*/
/**
* StringResult
* Represents a String as a Result of evaluating an Expr
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.7 $ $Date: 2001-05-12 09:54:16 $
* @version $Revision: 1.8 $ $Date: 2001-07-02 20:11:05 $
**/
#include "ExprResult.h"
/**
* Default Constructor
**/
StringResult::StringResult() {
} //-- StringResult
/**
* Creates a new StringResult with the value of the given String parameter
* @param str the String to use for initialization of this StringResult's value
**/
StringResult::StringResult(String& str) {
//-- copy str
this->value = str;
} //-- StringResult
/**
* Creates a new StringResult with the value of the given String parameter
* @param str the String to use for initialization of this StringResult's value
@@ -66,13 +56,6 @@ StringResult::StringResult(const char* str) {
this->value = str;
} //-- StringResult
/**
* Returns the value of this StringResult
**/
String& StringResult::getValue() {
return this->value;
} //-- getValue
/*
* Virtual Methods from ExprResult
*/

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: TextExpr.cpp,v 1.4 2001-05-14 14:22:47 axel%pike.org Exp $
* $Id: TextExpr.cpp,v 1.5 2001-07-02 20:11:05 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -59,14 +59,6 @@ double TextExpr::getDefaultPriority(Node* node, Node* context, ContextState* cs)
return -0.5;
} //-- getDefaultPriority
/**
* Returns the type of this NodeExpr
* @return the type of this NodeExpr
**/
short TextExpr::getType() {
return NodeExpr::TEXT_EXPR;
} //-- getType
/**
* Determines whether this NodeExpr matches the given node within
* the given context

View File

@@ -20,11 +20,6 @@
#include "Expr.h"
UnaryExpr::UnaryExpr()
{
expr = 0;
}
UnaryExpr::UnaryExpr(Expr* expr)
{
this->expr = expr;
@@ -35,12 +30,6 @@ UnaryExpr::~UnaryExpr()
delete expr;
}
void UnaryExpr::setExpr(Expr* expr)
{
delete this->expr;
this->expr = expr;
}
/*
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: UnionExpr.cpp,v 1.2 2001-06-30 13:54:35 sicking%bigfoot.com Exp $
* $Id: UnionExpr.cpp,v 1.3 2001-07-02 20:11:05 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -59,15 +59,6 @@ void UnionExpr::addExpr(Expr* expr) {
expressions.add(expr);
} //-- addExpr
/**
* Adds the Expr to this UnionExpr
* @param expr the Expr to add to this UnionExpr
**/
void UnionExpr::addExpr(int index, Expr* expr) {
if (expr)
expressions.insert(index, expr);
} //-- addExpr
//------------------------------------/
//- Virtual methods from Expr -/
//------------------------------------/

View File

@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: VariableRefExpr.cpp,v 1.1 2000-04-06 07:45:55 kvisco%ziplink.net Exp $
* $Id: VariableRefExpr.cpp,v 1.2 2001-07-02 20:11:05 sicking%bigfoot.com Exp $
*/
#include "Expr.h"
@@ -30,12 +30,6 @@
//- VariableRefExpr -/
//-------------------/
/**
* Default constructor
**/
VariableRefExpr::VariableRefExpr() {
} //-- VariableRefExpr
/**
* Creates a VariableRefExpr with the given variable name
**/
@@ -43,19 +37,6 @@ VariableRefExpr::VariableRefExpr(const String& name) {
this->name = name;
} //-- VariableRefExpr
/**
* Creates a VariableRefExpr with the given variable name
**/
VariableRefExpr::VariableRefExpr(String& name) {
this->name = name;
} //-- VariableRefExpr
/**
* Default destructor
**/
VariableRefExpr::~VariableRefExpr() {
} //-- ~VariableRefExpr
/**
* Evaluates this Expr based on the given context node and processor state
* @param context the context node for evaluation of this Expr
@@ -92,8 +73,9 @@ ExprResult* VariableRefExpr::evaluate(Node* context, ContextState* cs) {
break;
//-- StringResult
default:
StringResult* strResult = new StringResult();
exprResult->stringValue(strResult->getValue());
String tmp;
exprResult->stringValue(tmp);
StringResult* strResult = new StringResult(tmp);
copyOfResult = strResult;
break;
}