зеркало из https://github.com/mozilla/pjs.git
Backing out patch from bug 210528 to fix ports bustage
This commit is contained in:
Родитель
81fae7553f
Коммит
a7a7590020
|
@ -38,13 +38,16 @@
|
||||||
/**
|
/**
|
||||||
* Creates a new AdditiveExpr using the given operator
|
* Creates a new AdditiveExpr using the given operator
|
||||||
**/
|
**/
|
||||||
AdditiveExpr::AdditiveExpr(nsAutoPtr<Expr> aLeftExpr,
|
AdditiveExpr::AdditiveExpr(Expr* leftExpr, Expr* rightExpr, short op) {
|
||||||
nsAutoPtr<Expr> aRightExpr, short aOp)
|
this->op = op;
|
||||||
: op(aOp),
|
this->leftExpr = leftExpr;
|
||||||
leftExpr(aLeftExpr),
|
this->rightExpr = rightExpr;
|
||||||
rightExpr(aRightExpr)
|
} //-- AdditiveExpr
|
||||||
{
|
|
||||||
}
|
AdditiveExpr::~AdditiveExpr() {
|
||||||
|
delete leftExpr;
|
||||||
|
delete rightExpr;
|
||||||
|
} //-- ~AdditiveExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates this Expr based on the given context node and processor state
|
* Evaluates this Expr based on the given context node and processor state
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
#include "ExprResult.h"
|
#include "ExprResult.h"
|
||||||
#include "txIXPathContext.h"
|
#include "txIXPathContext.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new AttributeValueTemplate
|
||||||
|
**/
|
||||||
|
AttributeValueTemplate::AttributeValueTemplate() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default destructor
|
* Default destructor
|
||||||
**/
|
**/
|
||||||
|
@ -44,15 +49,8 @@ AttributeValueTemplate::~AttributeValueTemplate() {
|
||||||
/**
|
/**
|
||||||
* Adds the given Expr to this AttributeValueTemplate
|
* Adds the given Expr to this AttributeValueTemplate
|
||||||
**/
|
**/
|
||||||
nsresult
|
void AttributeValueTemplate::addExpr(Expr* expr) {
|
||||||
AttributeValueTemplate::addExpr(nsAutoPtr<Expr> aExpr)
|
if (expr) expressions.add(expr);
|
||||||
{
|
|
||||||
nsresult rv = expressions.add(aExpr);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
aExpr.forget();
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
} //-- addExpr
|
} //-- addExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,12 +41,15 @@
|
||||||
/**
|
/**
|
||||||
* Creates a new BooleanExpr using the given operator
|
* Creates a new BooleanExpr using the given operator
|
||||||
**/
|
**/
|
||||||
BooleanExpr::BooleanExpr(nsAutoPtr<Expr> aLeftExpr,
|
BooleanExpr::BooleanExpr(Expr* leftExpr, Expr* rightExpr, short op) {
|
||||||
nsAutoPtr<Expr> aRightExpr, short aOp)
|
this->op = op;
|
||||||
: op(aOp),
|
this->leftExpr = leftExpr;
|
||||||
leftExpr(aLeftExpr),
|
this->rightExpr = rightExpr;
|
||||||
rightExpr(aRightExpr)
|
} //-- BooleanExpr
|
||||||
{
|
|
||||||
|
BooleanExpr::~BooleanExpr() {
|
||||||
|
delete leftExpr;
|
||||||
|
delete rightExpr;
|
||||||
} //-- ~BooleanExpr
|
} //-- ~BooleanExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,7 +119,7 @@ public:
|
||||||
* Adds the given parameter to this FunctionCall's parameter list
|
* Adds the given parameter to this FunctionCall's parameter list
|
||||||
* @param expr the Expr to add to this FunctionCall's parameter list
|
* @param expr the Expr to add to this FunctionCall's parameter list
|
||||||
**/
|
**/
|
||||||
nsresult addParam(nsAutoPtr<Expr> aExpr);
|
nsresult addParam(Expr* aExpr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the number of parameters falls within a range.
|
* Check if the number of parameters falls within a range.
|
||||||
|
@ -140,6 +140,8 @@ protected:
|
||||||
|
|
||||||
txList params;
|
txList params;
|
||||||
|
|
||||||
|
FunctionCall();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Evaluates the given Expression and converts its result to a String.
|
* Evaluates the given Expression and converts its result to a String.
|
||||||
* The value is appended to the given destination String
|
* The value is appended to the given destination String
|
||||||
|
@ -177,12 +179,15 @@ protected:
|
||||||
class AttributeValueTemplate: public Expr {
|
class AttributeValueTemplate: public Expr {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
AttributeValueTemplate();
|
||||||
|
|
||||||
virtual ~AttributeValueTemplate();
|
virtual ~AttributeValueTemplate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the given Expr to this AttributeValueTemplate
|
* Adds the given Expr to this AttributeValueTemplate
|
||||||
**/
|
**/
|
||||||
nsresult addExpr(nsAutoPtr<Expr> expr);
|
void addExpr(Expr* expr);
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
|
@ -227,8 +232,11 @@ public:
|
||||||
txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID,
|
txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID,
|
||||||
Node::NodeType aNodeType);
|
Node::NodeType aNodeType);
|
||||||
|
|
||||||
|
~txNameTest();
|
||||||
|
|
||||||
TX_DECL_NODE_TEST;
|
TX_DECL_NODE_TEST;
|
||||||
|
|
||||||
|
private:
|
||||||
nsCOMPtr<nsIAtom> mPrefix;
|
nsCOMPtr<nsIAtom> mPrefix;
|
||||||
nsCOMPtr<nsIAtom> mLocalName;
|
nsCOMPtr<nsIAtom> mLocalName;
|
||||||
PRInt32 mNamespace;
|
PRInt32 mNamespace;
|
||||||
|
@ -253,6 +261,8 @@ public:
|
||||||
*/
|
*/
|
||||||
txNodeTypeTest(NodeType aNodeType);
|
txNodeTypeTest(NodeType aNodeType);
|
||||||
|
|
||||||
|
~txNodeTypeTest();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the name of the node to match. Only availible for pi nodes
|
* Sets the name of the node to match. Only availible for pi nodes
|
||||||
*/
|
*/
|
||||||
|
@ -272,6 +282,11 @@ private:
|
||||||
class PredicateList {
|
class PredicateList {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new PredicateList
|
||||||
|
**/
|
||||||
|
PredicateList();
|
||||||
/**
|
/**
|
||||||
* Destructor, will delete all Expressions in the list, so remove
|
* Destructor, will delete all Expressions in the list, so remove
|
||||||
* any you may need
|
* any you may need
|
||||||
|
@ -282,7 +297,7 @@ public:
|
||||||
* Adds the given Expr to the list
|
* Adds the given Expr to the list
|
||||||
* @param expr the Expr to add to the list
|
* @param expr the Expr to add to the list
|
||||||
**/
|
**/
|
||||||
nsresult add(nsAutoPtr<Expr> aExpr);
|
void add(Expr* expr);
|
||||||
|
|
||||||
nsresult evaluatePredicates(NodeSet* aNodes, txIMatchContext* aContext);
|
nsresult evaluatePredicates(NodeSet* aNodes, txIMatchContext* aContext);
|
||||||
|
|
||||||
|
@ -358,12 +373,17 @@ public:
|
||||||
* Creates a new FilterExpr using the given Expr
|
* Creates a new FilterExpr using the given Expr
|
||||||
* @param expr the Expr to use for evaluation
|
* @param expr the Expr to use for evaluation
|
||||||
**/
|
**/
|
||||||
FilterExpr(nsAutoPtr<Expr> aExpr);
|
FilterExpr(Expr* aExpr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor, will delete all predicates and the given Expr
|
||||||
|
**/
|
||||||
|
virtual ~FilterExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsAutoPtr<Expr> expr;
|
Expr* expr;
|
||||||
|
|
||||||
}; //-- FilterExpr
|
}; //-- FilterExpr
|
||||||
|
|
||||||
|
@ -393,15 +413,15 @@ public:
|
||||||
//-- LF, changed from static const short to enum
|
//-- LF, changed from static const short to enum
|
||||||
enum _AdditiveExprType { ADDITION = 1, SUBTRACTION };
|
enum _AdditiveExprType { ADDITION = 1, SUBTRACTION };
|
||||||
|
|
||||||
AdditiveExpr(nsAutoPtr<Expr> aLeftExpr, nsAutoPtr<Expr> aRightExpr,
|
AdditiveExpr(Expr* leftExpr, Expr* rightExpr, short op);
|
||||||
short aOp);
|
~AdditiveExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
short op;
|
short op;
|
||||||
nsAutoPtr<Expr> leftExpr;
|
Expr* leftExpr;
|
||||||
nsAutoPtr<Expr> rightExpr;
|
Expr* rightExpr;
|
||||||
}; //-- AdditiveExpr
|
}; //-- AdditiveExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,12 +431,13 @@ class UnaryExpr : public Expr {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UnaryExpr(nsAutoPtr<Expr> aExpr);
|
UnaryExpr(Expr* expr);
|
||||||
|
~UnaryExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsAutoPtr<Expr> expr;
|
Expr* expr;
|
||||||
}; //-- UnaryExpr
|
}; //-- UnaryExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,15 +451,15 @@ public:
|
||||||
//-- BooleanExpr Types
|
//-- BooleanExpr Types
|
||||||
enum _BooleanExprType { AND = 1, OR };
|
enum _BooleanExprType { AND = 1, OR };
|
||||||
|
|
||||||
BooleanExpr(nsAutoPtr<Expr> aLeftExpr, nsAutoPtr<Expr> aRightExpr,
|
BooleanExpr(Expr* leftExpr, Expr* rightExpr, short op);
|
||||||
short aOp);
|
~BooleanExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
short op;
|
short op;
|
||||||
nsAutoPtr<Expr> leftExpr;
|
Expr* leftExpr;
|
||||||
nsAutoPtr<Expr> rightExpr;
|
Expr* rightExpr;
|
||||||
}; //-- BooleanExpr
|
}; //-- BooleanExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,15 +478,15 @@ public:
|
||||||
//-- LF, changed from static const short to enum
|
//-- LF, changed from static const short to enum
|
||||||
enum _MultiplicativeExprType { DIVIDE = 1, MULTIPLY, MODULUS };
|
enum _MultiplicativeExprType { DIVIDE = 1, MULTIPLY, MODULUS };
|
||||||
|
|
||||||
MultiplicativeExpr(nsAutoPtr<Expr> aLeftExpr, nsAutoPtr<Expr> aRightExpr,
|
MultiplicativeExpr(Expr* leftExpr, Expr* rightExpr, short op);
|
||||||
short aOp);
|
~MultiplicativeExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
short op;
|
short op;
|
||||||
nsAutoPtr<Expr> leftExpr;
|
Expr* leftExpr;
|
||||||
nsAutoPtr<Expr> rightExpr;
|
Expr* rightExpr;
|
||||||
}; //-- MultiplicativeExpr
|
}; //-- MultiplicativeExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -490,8 +511,7 @@ public:
|
||||||
GREATER_OR_EQUAL
|
GREATER_OR_EQUAL
|
||||||
};
|
};
|
||||||
|
|
||||||
RelationalExpr(nsAutoPtr<Expr> aLeftExpr, nsAutoPtr<Expr> aRightExpr,
|
RelationalExpr(Expr* aLeftExpr, Expr* aRightExpr, RelationalExprType aOp);
|
||||||
RelationalExprType aOp);
|
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
|
@ -513,6 +533,7 @@ class VariableRefExpr : public Expr {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID);
|
VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID);
|
||||||
|
~VariableRefExpr();
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
|
@ -534,6 +555,11 @@ public:
|
||||||
//-- LF, changed from static const short to enum
|
//-- LF, changed from static const short to enum
|
||||||
enum PathOperator { RELATIVE_OP, DESCENDANT_OP };
|
enum PathOperator { RELATIVE_OP, DESCENDANT_OP };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new PathExpr
|
||||||
|
**/
|
||||||
|
PathExpr();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor, will delete all Expressions
|
* Destructor, will delete all Expressions
|
||||||
**/
|
**/
|
||||||
|
@ -543,13 +569,13 @@ public:
|
||||||
* Adds the Expr to this PathExpr
|
* Adds the Expr to this PathExpr
|
||||||
* @param expr the Expr to add to this PathExpr
|
* @param expr the Expr to add to this PathExpr
|
||||||
**/
|
**/
|
||||||
nsresult addExpr(nsAutoPtr<Expr> aExpr, PathOperator aPathOp);
|
void addExpr(Expr* expr, PathOperator pathOp);
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PathExprItem {
|
struct PathExprItem {
|
||||||
nsAutoPtr<Expr> expr;
|
Expr* expr;
|
||||||
PathOperator pathOp;
|
PathOperator pathOp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -593,6 +619,11 @@ class UnionExpr : public Expr {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new UnionExpr
|
||||||
|
**/
|
||||||
|
UnionExpr();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor, will delete all Path Expressions
|
* Destructor, will delete all Path Expressions
|
||||||
**/
|
**/
|
||||||
|
@ -602,7 +633,7 @@ public:
|
||||||
* Adds the PathExpr to this UnionExpr
|
* Adds the PathExpr to this UnionExpr
|
||||||
* @param expr the Expr to add to this UnionExpr
|
* @param expr the Expr to add to this UnionExpr
|
||||||
**/
|
**/
|
||||||
nsresult addExpr(nsAutoPtr<Expr> aExpr);
|
void addExpr(Expr* expr);
|
||||||
|
|
||||||
TX_DECL_EXPR;
|
TX_DECL_EXPR;
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,17 @@
|
||||||
* Creates a new FilterExpr using the given Expr
|
* Creates a new FilterExpr using the given Expr
|
||||||
* @param expr the Expr to use for evaluation
|
* @param expr the Expr to use for evaluation
|
||||||
**/
|
**/
|
||||||
FilterExpr::FilterExpr(nsAutoPtr<Expr> aExpr)
|
FilterExpr::FilterExpr(Expr* expr) : PredicateList() {
|
||||||
: expr(aExpr)
|
this->expr = expr;
|
||||||
{
|
|
||||||
} //-- FilterExpr
|
} //-- FilterExpr
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys this FilterExpr, all predicates and the expr will be deleted
|
||||||
|
**/
|
||||||
|
FilterExpr::~FilterExpr() {
|
||||||
|
delete expr;
|
||||||
|
} //-- ~FilterExpr
|
||||||
|
|
||||||
//-----------------------------/
|
//-----------------------------/
|
||||||
//- Virtual methods from Expr -/
|
//- Virtual methods from Expr -/
|
||||||
//-----------------------------/
|
//-----------------------------/
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
* This class represents a FunctionCall as defined by the XSL Working Draft
|
* This class represents a FunctionCall as defined by the XSL Working Draft
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
FunctionCall::FunctionCall()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
**/
|
**/
|
||||||
|
@ -52,14 +56,10 @@ FunctionCall::~FunctionCall()
|
||||||
* Adds the given parameter to this FunctionCall's parameter list
|
* Adds the given parameter to this FunctionCall's parameter list
|
||||||
* @param expr the Expr to add to this FunctionCall's parameter list
|
* @param expr the Expr to add to this FunctionCall's parameter list
|
||||||
**/
|
**/
|
||||||
nsresult
|
nsresult FunctionCall::addParam(Expr* aExpr)
|
||||||
FunctionCall::addParam(nsAutoPtr<Expr> aExpr)
|
|
||||||
{
|
{
|
||||||
nsresult rv = params.add(aExpr);
|
if (aExpr)
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
params.add(aExpr);
|
||||||
|
|
||||||
aExpr.forget();
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
} //-- addParam
|
} //-- addParam
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,16 @@
|
||||||
/**
|
/**
|
||||||
* Creates a new MultiplicativeExpr using the given operator
|
* Creates a new MultiplicativeExpr using the given operator
|
||||||
**/
|
**/
|
||||||
MultiplicativeExpr::MultiplicativeExpr(nsAutoPtr<Expr> aLeftExpr,
|
MultiplicativeExpr::MultiplicativeExpr(Expr* leftExpr, Expr* rightExpr, short op) {
|
||||||
nsAutoPtr<Expr> aRightExpr, short aOp)
|
this->op = op;
|
||||||
: op(aOp),
|
this->leftExpr = leftExpr;
|
||||||
leftExpr(aLeftExpr),
|
this->rightExpr = rightExpr;
|
||||||
rightExpr(aRightExpr)
|
} //-- MultiplicativeExpr
|
||||||
{
|
|
||||||
}
|
MultiplicativeExpr::~MultiplicativeExpr() {
|
||||||
|
delete leftExpr;
|
||||||
|
delete rightExpr;
|
||||||
|
} //-- ~MultiplicativeExpr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates this Expr based on the given context node and processor state
|
* Evaluates this Expr based on the given context node and processor state
|
||||||
|
|
|
@ -37,6 +37,10 @@ txNameTest::txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID,
|
||||||
NS_ASSERTION(aLocalName, "txNameTest without a local name?");
|
NS_ASSERTION(aLocalName, "txNameTest without a local name?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txNameTest::~txNameTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determines whether this txNodeTest matches the given node
|
* Determines whether this txNodeTest matches the given node
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,6 +35,10 @@ txNodeTypeTest::txNodeTypeTest(NodeType aNodeType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txNodeTypeTest::~txNodeTypeTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void txNodeTypeTest::setNodeName(const nsAString& aName)
|
void txNodeTypeTest::setNodeName(const nsAString& aName)
|
||||||
{
|
{
|
||||||
mNodeName = do_GetAtom(aName);
|
mNodeName = do_GetAtom(aName);
|
||||||
|
|
|
@ -41,6 +41,14 @@
|
||||||
//- PathExpr -/
|
//- PathExpr -/
|
||||||
//------------/
|
//------------/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new PathExpr
|
||||||
|
**/
|
||||||
|
PathExpr::PathExpr()
|
||||||
|
{
|
||||||
|
//-- do nothing
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor, will delete all Expressions
|
* Destructor, will delete all Expressions
|
||||||
**/
|
**/
|
||||||
|
@ -49,6 +57,7 @@ PathExpr::~PathExpr()
|
||||||
txListIterator iter(&expressions);
|
txListIterator iter(&expressions);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
PathExprItem* pxi = (PathExprItem*)iter.next();
|
PathExprItem* pxi = (PathExprItem*)iter.next();
|
||||||
|
delete pxi->expr;
|
||||||
delete pxi;
|
delete pxi;
|
||||||
}
|
}
|
||||||
} //-- ~PathExpr
|
} //-- ~PathExpr
|
||||||
|
@ -57,20 +66,21 @@ PathExpr::~PathExpr()
|
||||||
* Adds the Expr to this PathExpr
|
* Adds the Expr to this PathExpr
|
||||||
* @param expr the Expr to add to this PathExpr
|
* @param expr the Expr to add to this PathExpr
|
||||||
**/
|
**/
|
||||||
nsresult
|
void PathExpr::addExpr(Expr* expr, PathOperator pathOp)
|
||||||
PathExpr::addExpr(nsAutoPtr<Expr> aExpr, PathOperator aPathOp)
|
|
||||||
{
|
{
|
||||||
NS_ASSERTION(expressions.getLength() > 0 || aPathOp == RELATIVE_OP,
|
NS_ASSERTION(expressions.getLength() > 0 || pathOp == RELATIVE_OP,
|
||||||
"First step has to be relative in PathExpr");
|
"First step has to be relative in PathExpr");
|
||||||
nsAutoPtr<PathExprItem> pxi(new PathExprItem);
|
if (expr) {
|
||||||
NS_ENSURE_TRUE(pxi, NS_ERROR_OUT_OF_MEMORY);
|
PathExprItem* pxi = new PathExprItem;
|
||||||
|
if (!pxi) {
|
||||||
pxi->expr = aExpr;
|
// XXX ErrorReport: out of memory
|
||||||
pxi->pathOp = aPathOp;
|
NS_ASSERTION(0, "out of memory");
|
||||||
nsresult rv = expressions.add(pxi);
|
return;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
}
|
||||||
|
pxi->expr = expr;
|
||||||
return NS_OK;
|
pxi->pathOp = pathOp;
|
||||||
|
expressions.add(pxi);
|
||||||
|
}
|
||||||
} //-- addPattenExpr
|
} //-- addPattenExpr
|
||||||
|
|
||||||
//-----------------------------/
|
//-----------------------------/
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
* for use with Step and Filter Expressions
|
* for use with Step and Filter Expressions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
PredicateList::PredicateList()
|
||||||
|
{
|
||||||
|
} // PredicateList
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destructor, will delete all Expressions in the list
|
* Destructor, will delete all Expressions in the list
|
||||||
*/
|
*/
|
||||||
|
@ -47,15 +51,9 @@ PredicateList::~PredicateList()
|
||||||
* Adds the given Expr to the list
|
* Adds the given Expr to the list
|
||||||
* @param expr the Expr to add to the list
|
* @param expr the Expr to add to the list
|
||||||
*/
|
*/
|
||||||
nsresult
|
void PredicateList::add(Expr* expr)
|
||||||
PredicateList::add(nsAutoPtr<Expr> aExpr)
|
|
||||||
{
|
{
|
||||||
nsresult rv = predicates.add(aExpr);
|
predicates.add(expr);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
aExpr.forget();
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
} // add
|
} // add
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
#include "XMLDOMUtils.h"
|
#include "XMLDOMUtils.h"
|
||||||
#include "txIXPathContext.h"
|
#include "txIXPathContext.h"
|
||||||
|
|
||||||
RelationalExpr::RelationalExpr(nsAutoPtr<Expr> aLeftExpr,
|
RelationalExpr::RelationalExpr(Expr* aLeftExpr, Expr* aRightExpr,
|
||||||
nsAutoPtr<Expr> aRightExpr,
|
|
||||||
RelationalExprType aOp)
|
RelationalExprType aOp)
|
||||||
: mLeftExpr(aLeftExpr),
|
: mLeftExpr(aLeftExpr), mRightExpr(aRightExpr), mOp(aOp)
|
||||||
mRightExpr(aRightExpr),
|
|
||||||
mOp(aOp)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,14 @@
|
||||||
#include "ExprResult.h"
|
#include "ExprResult.h"
|
||||||
#include "txIXPathContext.h"
|
#include "txIXPathContext.h"
|
||||||
|
|
||||||
UnaryExpr::UnaryExpr(nsAutoPtr<Expr> aExpr)
|
UnaryExpr::UnaryExpr(Expr* expr)
|
||||||
: expr(aExpr)
|
|
||||||
{
|
{
|
||||||
|
this->expr = expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnaryExpr::~UnaryExpr()
|
||||||
|
{
|
||||||
|
delete expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,6 +32,13 @@
|
||||||
//-------------/
|
//-------------/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new UnionExpr
|
||||||
|
**/
|
||||||
|
UnionExpr::UnionExpr() {
|
||||||
|
//-- do nothing
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor, will delete all Path Expressions
|
* Destructor, will delete all Path Expressions
|
||||||
**/
|
**/
|
||||||
|
@ -46,15 +53,9 @@ UnionExpr::~UnionExpr() {
|
||||||
* Adds the Expr to this UnionExpr
|
* Adds the Expr to this UnionExpr
|
||||||
* @param expr the Expr to add to this UnionExpr
|
* @param expr the Expr to add to this UnionExpr
|
||||||
**/
|
**/
|
||||||
nsresult
|
void UnionExpr::addExpr(Expr* expr) {
|
||||||
UnionExpr::addExpr(nsAutoPtr<Expr> aExpr)
|
if (expr)
|
||||||
{
|
expressions.add(expr);
|
||||||
nsresult rv = expressions.add(aExpr);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
aExpr.forget();
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
} //-- addExpr
|
} //-- addExpr
|
||||||
|
|
||||||
//-----------------------------/
|
//-----------------------------/
|
||||||
|
|
|
@ -44,6 +44,13 @@ VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName,
|
||||||
mPrefix = 0;
|
mPrefix = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release the local name atom
|
||||||
|
*/
|
||||||
|
VariableRefExpr::~VariableRefExpr()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates this Expr based on the given context node and processor state
|
* Evaluates this Expr based on the given context node and processor state
|
||||||
* @param context the context node for evaluation of this Expr
|
* @param context the context node for evaluation of this Expr
|
||||||
|
|
|
@ -459,6 +459,11 @@ void txKeyPattern::toString(nsAString& aDest)
|
||||||
* a txPattern to hold the NodeTest and the Predicates of a StepPattern
|
* a txPattern to hold the NodeTest and the Predicates of a StepPattern
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
txStepPattern::~txStepPattern()
|
||||||
|
{
|
||||||
|
delete mNodeTest;
|
||||||
|
}
|
||||||
|
|
||||||
MBool txStepPattern::matches(Node* aNode, txIMatchContext* aContext)
|
MBool txStepPattern::matches(Node* aNode, txIMatchContext* aContext)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mNodeTest && aNode, "Internal error");
|
NS_ASSERTION(mNodeTest && aNode, "Internal error");
|
||||||
|
|
|
@ -131,7 +131,12 @@ private:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoPtr<txPattern> pattern;
|
~Step()
|
||||||
|
{
|
||||||
|
delete pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
txPattern* pattern;
|
||||||
MBool isChild;
|
MBool isChild;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,9 +198,12 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~txStepPattern();
|
||||||
|
|
||||||
TX_DECL_PATTERN;
|
TX_DECL_PATTERN;
|
||||||
|
|
||||||
nsAutoPtr<txNodeTest> mNodeTest;
|
private:
|
||||||
|
txNodeTest* mNodeTest;
|
||||||
MBool mIsAttr;
|
MBool mIsAttr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче