Merging whitespace changes/renames/cleanup from TX_WALKER_BRANCH to ease merging, no functional changes. Bug 151002. r=sicking.

This commit is contained in:
peter%propagandism.org 2005-11-02 07:41:38 +00:00
Родитель 1c7c4758a4
Коммит 5633788a04
39 изменённых файлов: 257 добавлений и 245 удалений

Просмотреть файл

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "txExpandedNameMap.h"
#include "string.h"
#include <string.h>
const int kTxExpandedNameMapAllocSize = 16;

Просмотреть файл

@ -89,6 +89,7 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
rv = NS_NewChannel(getter_AddRefs(channel), documentURI, nsnull,
loadGroup);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(channel);
if (http) {
nsCOMPtr<nsIURI> refUri;
@ -102,9 +103,11 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
}
nsCOMPtr<nsISyncLoadDOMService> loader =
do_GetService("@mozilla.org/content/syncload-dom-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = loader->LoadDocumentAsXML(channel, loaderUri, getter_AddRefs(theDocument));
if (NS_FAILED(rv) || !theDocument) {
aErrMsg.Append(NS_LITERAL_STRING("Document load of ") +
@ -116,6 +119,7 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
if (!*aResult) {
return NS_ERROR_FAILURE;
}
return NS_OK;
#else
istream* xslInput = URIUtils::getInputStream(aHref, aErrMsg);

Просмотреть файл

@ -300,7 +300,8 @@ MBool XMLUtils::getXMLSpacePreserve(Node* aNode)
}
parent = parent->getParentNode();
}
return MB_FALSE;
return PR_FALSE;
}
// macros for inclusion of char range headers

Просмотреть файл

@ -34,12 +34,12 @@ REQUIRES = string \
ifndef TX_EXE
REQUIRES += dom \
content \
necko \
widget \
xpconnect \
js \
unicharutil \
layout \
necko \
$(NULL)
endif
@ -54,7 +54,6 @@ CPPSRCS = AdditiveExpr.cpp \
FunctionCall.cpp \
LocationStep.cpp \
MultiplicativeExpr.cpp \
NodeSet.cpp \
NodeSetFunctionCall.cpp \
NumberFunctionCall.cpp \
NumberResult.cpp \
@ -66,6 +65,7 @@ CPPSRCS = AdditiveExpr.cpp \
StringResult.cpp \
txLiteralExpr.cpp \
txNameTest.cpp \
txNodeSet.cpp \
txNodeTypeTest.cpp \
txForwardContext.cpp \
txNodeSetContext.cpp \

Просмотреть файл

@ -200,7 +200,7 @@ void nsXPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
Node* nsXPathExpression::EvalContextImpl::getContextNode()
{
return mNode;
return mContextNode;
}
PRUint32 nsXPathExpression::EvalContextImpl::size()

Просмотреть файл

@ -71,7 +71,9 @@ private:
{
public:
EvalContextImpl(Node* aContextNode, txResultRecycler* aRecycler)
: mNode(aContextNode), mLastError(NS_OK), mRecycler(aRecycler)
: mContextNode(aContextNode),
mLastError(NS_OK),
mRecycler(aRecycler)
{
}
@ -85,8 +87,9 @@ private:
}
TX_DECL_EVAL_CONTEXT;
private:
Node* mNode;
Node* mContextNode;
nsresult mLastError;
nsRefPtr<txResultRecycler> mRecycler;
};

Просмотреть файл

@ -40,7 +40,7 @@
#include "nsXPathResult.h"
#include "dom.h"
#include "ExprResult.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "nsDOMError.h"
#include "nsIContent.h"
#include "nsIDOMClassInfo.h"
@ -48,16 +48,6 @@
#include "nsXPathException.h"
#include "nsIDOMDocument.h"
NS_IMPL_ADDREF(nsXPathResult)
NS_IMPL_RELEASE(nsXPathResult)
NS_INTERFACE_MAP_BEGIN(nsXPathResult)
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathResult)
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
NS_INTERFACE_MAP_ENTRY(nsIXPathResult)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathResult)
NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathResult)
NS_INTERFACE_MAP_END
nsXPathResult::nsXPathResult() : mNumberValue(0),
mDocument(0),
mCurrentPos(0),
@ -71,6 +61,16 @@ nsXPathResult::~nsXPathResult()
Reset();
}
NS_IMPL_ADDREF(nsXPathResult)
NS_IMPL_RELEASE(nsXPathResult)
NS_INTERFACE_MAP_BEGIN(nsXPathResult)
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathResult)
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
NS_INTERFACE_MAP_ENTRY(nsIXPathResult)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathResult)
NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(XPathResult)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsXPathResult::GetResultType(PRUint16 *aResultType)
{
@ -170,7 +170,7 @@ nsXPathResult::IterateNext(nsIDOMNode **aResult)
return NS_ERROR_DOM_INVALID_STATE_ERR;
NS_ENSURE_ARG(aResult);
if (mElements && mCurrentPos < mElements->Count()) {
if (mElements && mCurrentPos < (PRUint32)mElements->Count()) {
*aResult = mElements->ObjectAt(mCurrentPos++);
NS_ADDREF(*aResult);
return NS_OK;
@ -187,7 +187,7 @@ nsXPathResult::SnapshotItem(PRUint32 aIndex, nsIDOMNode **aResult)
return NS_ERROR_DOM_TYPE_ERR;
NS_ENSURE_ARG(aResult);
if (mElements && aIndex < mElements->Count()) {
if (mElements && aIndex < (PRUint32)mElements->Count()) {
*aResult = mElements->ObjectAt(aIndex);
NS_ADDREF(*aResult);
return NS_OK;
@ -288,7 +288,7 @@ nsXPathResult::SetExprResult(txAExprResult* aExprResult, PRUint16 aResultType)
if (aExprResult->getResultType() == txAExprResult::NODESET) {
nsresult rv = NS_OK;
NodeSet* nodeSet = (NodeSet*)aExprResult;
txNodeSet* nodeSet = NS_STATIC_CAST(txNodeSet*, aExprResult);
if (mResultType == FIRST_ORDERED_NODE_TYPE ||
mResultType == ANY_UNORDERED_NODE_TYPE) {
@ -302,7 +302,7 @@ nsXPathResult::SetExprResult(txAExprResult* aExprResult, PRUint16 aResultType)
mInvalidIteratorState = PR_FALSE;
}
int count = nodeSet->size();
PRInt32 count = nodeSet->size();
if (count == 0)
return NS_OK;
@ -310,7 +310,7 @@ nsXPathResult::SetExprResult(txAExprResult* aExprResult, PRUint16 aResultType)
NS_ENSURE_TRUE(mElements, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIDOMNode> node;
int i;
PRInt32 i;
for (i = 0; i < count; ++i) {
node = do_QueryInterface(nodeSet->get(i)->getNSObj());
NS_ASSERTION(node, "node isn't an nsIDOMNode");

Просмотреть файл

@ -29,9 +29,9 @@
#include "ExprResult.h"
#include "FunctionLib.h"
#include "nsReadableUtils.h"
#include "txAtoms.h"
#include "txIXPathContext.h"
#include "nsReadableUtils.h"
#include "txStringUtils.h"
/**

Просмотреть файл

@ -49,10 +49,10 @@
Much of this code was ported from XSL:P.
*/
class NodeSet;
class txIParseContext;
class txIMatchContext;
class txIEvalContext;
class txNodeSet;
/**
* A Base Class for all XSL Expressions
@ -167,7 +167,7 @@ protected:
* If the result is not a NodeSet an error is returned.
*/
nsresult evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext,
NodeSet** aResult);
txNodeSet** aResult);
/*
* Returns the name of the function as an atom.
@ -305,7 +305,7 @@ public:
*/
nsresult add(Expr* aExpr);
nsresult evaluatePredicates(NodeSet* aNodes, txIMatchContext* aContext);
nsresult evaluatePredicates(txNodeSet* aNodes, txIMatchContext* aContext);
/**
* returns true if this predicate list is empty
@ -327,12 +327,10 @@ protected:
List predicates;
}; //-- PredicateList
class LocationStep : public PredicateList, public Expr {
class LocationStep : public PredicateList,
public Expr
{
public:
// Axis Identifier Types
//-- LF changed from static const short to enum
enum LocationStepType {
ANCESTOR_AXIS = 0,
ANCESTOR_OR_SELF_AXIS,
@ -364,17 +362,14 @@ public:
TX_DECL_EXPR;
private:
void fromDescendants(Node* node, txIMatchContext* aContext,
txNodeSet* nodes);
void fromDescendantsRev(Node* node, txIMatchContext* aContext,
txNodeSet* nodes);
nsAutoPtr<txNodeTest> mNodeTest;
LocationStepType mAxisIdentifier;
void fromDescendants(Node* node, txIMatchContext* aContext,
NodeSet* nodes);
void fromDescendantsRev(Node* node, txIMatchContext* aContext,
NodeSet* nodes);
}; //-- LocationStep
};
class FilterExpr : public PredicateList, public Expr {
@ -626,9 +621,8 @@ private:
*/
nsresult evalDescendants(Expr* aStep, Node* aNode,
txIMatchContext* aContext,
NodeSet* resNodes);
}; //-- PathExpr
txNodeSet* resNodes);
};
/**
* This class represents a RootExpr, which only matches the Document node

Просмотреть файл

@ -26,7 +26,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txIXPathContext.h"
//-- Implementation of FilterExpr --/
@ -55,11 +55,12 @@ FilterExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
NS_ENSURE_TRUE(exprRes->getResultType() == txAExprResult::NODESET,
NS_ERROR_XSLT_NODESET_EXPECTED);
nsRefPtr<NodeSet> nodes =
NS_STATIC_CAST(NodeSet*, NS_STATIC_CAST(txAExprResult*, exprRes));
nsRefPtr<txNodeSet> nodes =
NS_STATIC_CAST(txNodeSet*, NS_STATIC_CAST(txAExprResult*, exprRes));
// null out exprRes so that we can test for shared-ness
exprRes = nsnull;
nsRefPtr<NodeSet> nonShared;
nsRefPtr<txNodeSet> nonShared;
rv = aContext->recycler()->getNonSharedNodeSet(nodes,
getter_AddRefs(nonShared));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -37,11 +37,11 @@
* ***** END LICENSE BLOCK ***** */
#include "txForwardContext.h"
#include "NodeSet.h"
#include "txNodeSet.h"
Node* txForwardContext::getContextNode()
{
return mContext;
return mContextNode;
}
PRUint32 txForwardContext::size()
@ -51,9 +51,9 @@ PRUint32 txForwardContext::size()
PRUint32 txForwardContext::position()
{
int pos = mContextSet->indexOf(mContext);
PRInt32 pos = mContextSet->indexOf(mContextNode);
NS_ASSERTION(pos >= 0, "Context is not member of context node list.");
return (PRUint32)(pos+1);
return (PRUint32)(pos + 1);
}
nsresult txForwardContext::getVariable(PRInt32 aNamespace, nsIAtom* aLName,

Просмотреть файл

@ -41,15 +41,16 @@
#include "txIXPathContext.h"
#include "nsAutoPtr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
class txForwardContext : public txIEvalContext
{
public:
txForwardContext(txIMatchContext* aContext, Node* aContextNode,
NodeSet* aContextNodeSet) : mContext(aContextNode),
mContextSet(aContextNodeSet),
mInner(aContext)
txNodeSet* aContextNodeSet)
: mInner(aContext),
mContextNode(aContextNode),
mContextSet(aContextNodeSet)
{}
~txForwardContext()
{}
@ -57,9 +58,9 @@ public:
TX_DECL_EVAL_CONTEXT;
private:
Node* mContext;
nsRefPtr<NodeSet> mContextSet;
txIMatchContext* mInner;
Node* mContextNode;
nsRefPtr<txNodeSet> mContextSet;
};
#endif // __TX_XPATH_CONTEXT

Просмотреть файл

@ -27,7 +27,7 @@
#include "ExprResult.h"
#include "nsIAtom.h"
#include "txIXPathContext.h"
#include "NodeSet.h"
#include "txNodeSet.h"
/**
* This class represents a FunctionCall as defined by the XSL Working Draft
@ -117,7 +117,7 @@ MBool FunctionCall::evaluateToBoolean(Expr* aExpr, txIEvalContext* aContext)
*/
nsresult
FunctionCall::evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext,
NodeSet** aResult)
txNodeSet** aResult)
{
NS_ASSERTION(aExpr, "Missing expression to evaluate");
*aResult = nsnull;
@ -132,7 +132,7 @@ FunctionCall::evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext,
}
*aResult =
NS_STATIC_CAST(NodeSet*, NS_STATIC_CAST(txAExprResult*, exprRes));
NS_STATIC_CAST(txNodeSet*, NS_STATIC_CAST(txAExprResult*, exprRes));
NS_ADDREF(*aResult);
return NS_OK;

Просмотреть файл

@ -28,8 +28,8 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txIXPathContext.h"
#include "txNodeSet.h"
//-----------------------------/
//- Virtual methods from Expr -/
@ -49,7 +49,7 @@ LocationStep::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
NS_ASSERTION(aContext, "internal error");
*aResult = nsnull;
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -187,14 +187,14 @@ LocationStep::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
if (reverse)
nodes->reverse();
*aResult = nodes;
NS_ADDREF(*aResult);
NS_ADDREF(*aResult = nodes);
return NS_OK;
}
void LocationStep::fromDescendants(Node* node, txIMatchContext* cs,
NodeSet* nodes)
void LocationStep::fromDescendants(Node* node,
txIMatchContext* cs,
txNodeSet* nodes)
{
if (!node)
return;
@ -209,11 +209,11 @@ void LocationStep::fromDescendants(Node* node, txIMatchContext* cs,
child = child->getNextSibling();
}
}
} //-- fromDescendants
void LocationStep::fromDescendantsRev(Node* node, txIMatchContext* cs,
NodeSet* nodes)
void LocationStep::fromDescendantsRev(Node* node,
txIMatchContext* cs,
txNodeSet* nodes)
{
if (!node)
return;
@ -229,8 +229,7 @@ void LocationStep::fromDescendantsRev(Node* node, txIMatchContext* cs,
child = child->getPreviousSibling();
}
} //-- fromDescendantsRev
}
/**
* Creates a String representation of this Expr

Просмотреть файл

@ -30,7 +30,7 @@
*
*/
#include "NodeSet.h"
#include "txNodeSet.h"
#include "dom.h"
#include "XMLDOMUtils.h"
#include <string.h>
@ -45,7 +45,7 @@ static const int kTxNodeSetGrowFactor = 2;
/*
* Creates a new empty NodeSet
*/
NodeSet::NodeSet(txResultRecycler* aRecycler)
txNodeSet::txNodeSet(txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(0),
mBufferSize(0),
@ -56,13 +56,13 @@ NodeSet::NodeSet(txResultRecycler* aRecycler)
/*
* Creates a new NodeSet containing the supplied Node
*/
NodeSet::NodeSet(Node* aNode, txResultRecycler* aRecycler)
txNodeSet::txNodeSet(Node* aNode, txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(new Node*[1]),
mBufferSize(1),
mElementCount(1)
{
NS_ASSERTION(aNode, "missing node to NodeSet::NodeSet");
NS_ASSERTION(aNode, "missing node to txNodeSet::txNodeSet");
if (!mElements) {
NS_ASSERTION(0, "out of memory");
mBufferSize = 0;
@ -77,7 +77,7 @@ NodeSet::NodeSet(Node* aNode, txResultRecycler* aRecycler)
* Creates a new NodeSet, copying the Node references from the source
* NodeSet
*/
NodeSet::NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler)
txNodeSet::txNodeSet(const txNodeSet& aSource, txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(0),
mBufferSize(0),
@ -92,9 +92,9 @@ NodeSet::NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler)
* @param aNode the Node to add to the NodeSet
* @return errorcode.
*/
nsresult NodeSet::add(Node* aNode)
nsresult txNodeSet::add(Node* aNode)
{
NS_ASSERTION(aNode, "missing node to NodeSet::add");
NS_ASSERTION(aNode, "missing node to txNodeSet::add");
if (!aNode)
return NS_ERROR_NULL_POINTER;
@ -154,9 +154,9 @@ nsresult NodeSet::add(Node* aNode)
* We might therefor end up with some blanks in the bigining of the resulting
* nodeset, which we simply fix by moving all the nodes one step down.
*/
nsresult NodeSet::add(const NodeSet* aNodes)
nsresult txNodeSet::add(const txNodeSet* aNodes)
{
NS_ASSERTION(aNodes, "missing nodeset to NodeSet::add");
NS_ASSERTION(aNodes, "missing nodeset to txNodeSet::add");
if (!aNodes)
return NS_ERROR_NULL_POINTER;
@ -269,9 +269,9 @@ nsresult NodeSet::add(const NodeSet* aNodes)
* @param aNode the Node to append to the NodeSet
* @return true on success. false on failure.
*/
nsresult NodeSet::append(Node* aNode)
nsresult txNodeSet::append(Node* aNode)
{
NS_ASSERTION(aNode, "missing node to NodeSet::append");
NS_ASSERTION(aNode, "missing node to txNodeSet::append");
if (!aNode)
return NS_ERROR_NULL_POINTER;
@ -288,9 +288,9 @@ nsresult NodeSet::append(Node* aNode)
* @param aNodes the NodeSet to append to the NodeSet
* @return true on success. false on failure.
*/
nsresult NodeSet::append(const NodeSet* aNodes)
nsresult txNodeSet::append(const txNodeSet* aNodes)
{
NS_ASSERTION(aNodes, "missing nodeset to NodeSet::append");
NS_ASSERTION(aNodes, "missing nodeset to txNodeSet::append");
if (!aNodes)
return NS_ERROR_NULL_POINTER;
@ -308,7 +308,7 @@ nsresult NodeSet::append(const NodeSet* aNodes)
/*
* Reverse the order of the nodes.
*/
void NodeSet::reverse()
void txNodeSet::reverse()
{
int i;
for (i = 0; i < mElementCount / 2; ++i) {
@ -325,7 +325,7 @@ void NodeSet::reverse()
* @param aNode the Node to get the index for
* @return index of specified node or -1 if the node does not exist
*/
int NodeSet::indexOf(Node* aNode) const
int txNodeSet::indexOf(Node* aNode) const
{
// XXX this doesn't fully work since attribute-nodes are broken
// and can't be pointer-compared. However it's the best we can
@ -343,10 +343,10 @@ int NodeSet::indexOf(Node* aNode) const
* @param aIndex the position of the Node to return
* @return Node at specified position
*/
Node* NodeSet::get(int aIndex) const
Node* txNodeSet::get(int aIndex) const
{
NS_ASSERTION(aIndex >= 0 && aIndex < mElementCount,
"invalid index in NodeSet::get");
"invalid index in txNodeSet::get");
if (aIndex < 0 || aIndex >= mElementCount)
return 0;
@ -357,7 +357,7 @@ Node* NodeSet::get(int aIndex) const
* Returns the type of ExprResult represented
* @return the type of ExprResult represented
*/
short NodeSet::getResultType()
short txNodeSet::getResultType()
{
return txAExprResult::NODESET;
}
@ -366,7 +366,7 @@ short NodeSet::getResultType()
* Converts this ExprResult to a Boolean (MBool) value
* @return the Boolean value
*/
MBool NodeSet::booleanValue()
MBool txNodeSet::booleanValue()
{
return mElementCount > 0;
}
@ -375,7 +375,7 @@ MBool NodeSet::booleanValue()
* Converts this ExprResult to a Number (double) value
* @return the Number value
*/
double NodeSet::numberValue()
double txNodeSet::numberValue()
{
nsAutoString str;
stringValue(str);
@ -386,14 +386,14 @@ double NodeSet::numberValue()
* Creates a String representation of this ExprResult
* @param aStr the destination string to append the String representation to.
*/
void NodeSet::stringValue(nsAString& aStr)
void txNodeSet::stringValue(nsAString& aStr)
{
if (mElementCount > 0)
XMLDOMUtils::getNodeValue(get(0), aStr);
}
nsAString*
NodeSet::stringValuePointer()
txNodeSet::stringValuePointer()
{
return nsnull;
}
@ -405,7 +405,7 @@ NodeSet::stringValuePointer()
* @param aSize requested number of elements
* @return true if allocation succeded, false on out of memory
*/
MBool NodeSet::ensureSize(int aSize)
MBool txNodeSet::ensureSize(int aSize)
{
if (aSize <= mBufferSize)
return MB_TRUE;
@ -445,12 +445,12 @@ MBool NodeSet::ensureSize(int aSize)
* always >= aFirst and <= aLast + 1. This value is always
* set, even if aNode already exists in the NodeSet
*/
int NodeSet::findPosition(Node* aNode, int aFirst,
int txNodeSet::findPosition(Node* aNode, int aFirst,
int aLast, MBool& aNonDup) const
{
NS_ASSERTION(aNode, "missing node in NodeSet::findPosition");
NS_ASSERTION(aNode, "missing node in txNodeSet::findPosition");
NS_ASSERTION(aFirst <= aLast+1 && aLast < mElementCount,
"bad position in NodeSet::findPosition");
"bad position in txNodeSet::findPosition");
if (aLast - aFirst <= 1) {
// If we search 2 nodes or less there is no point in further divides

Просмотреть файл

@ -39,33 +39,33 @@
class Node;
class NodeSet : public txAExprResult
class txNodeSet : public txAExprResult
{
public:
NodeSet(); // Not to be implemented
txNodeSet(); // Not to be implemented
/*
* Creates a new empty NodeSet
*/
NodeSet(txResultRecycler* aRecycler);
txNodeSet(txResultRecycler* aRecycler);
/*
* Creates a new NodeSet containing the supplied node
*/
NodeSet(Node* aNode, txResultRecycler* aRecycler);
txNodeSet(Node* aNode, txResultRecycler* aRecycler);
/*
* Creates a new NodeSet, copying the Node references from the source
* NodeSet
*/
NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler);
txNodeSet(const txNodeSet& aSource, txResultRecycler* aRecycler);
/*
* Destructor for NodeSet, will not delete referenced Nodes
*/
virtual ~NodeSet()
virtual ~txNodeSet()
{
delete [] mElements;
}
@ -85,7 +85,7 @@ public:
* @param aNodes the NodeSet to add, must be in document order.
* @return errorcode.
*/
nsresult add(const NodeSet* aNodes);
nsresult add(const txNodeSet* aNodes);
/*
* Append API
@ -109,7 +109,7 @@ public:
* @param aNodes the NodeSet to append to the NodeSet
* @return errorcode.
*/
nsresult append(const NodeSet* aNodes);
nsresult append(const txNodeSet* aNodes);
/*
* Reverse the order of the nodes.

Просмотреть файл

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "txNodeSetContext.h"
#include "NodeSet.h"
#include "txNodeSet.h"
Node* txNodeSetContext::getContextNode()
{

Просмотреть файл

@ -40,13 +40,13 @@
#define __TX_XPATH_SET_CONTEXT
#include "txIXPathContext.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "nsAutoPtr.h"
class txNodeSetContext : public txIEvalContext
{
public:
txNodeSetContext(NodeSet* aContextNodeSet, txIMatchContext* aContext)
txNodeSetContext(txNodeSet* aContextNodeSet, txIMatchContext* aContext)
: mContextSet(aContextNodeSet), mPosition(0), mInner(aContext)
{
}
@ -74,7 +74,7 @@ public:
TX_DECL_EVAL_CONTEXT;
protected:
nsRefPtr<NodeSet> mContextSet;
nsRefPtr<txNodeSet> mContextSet;
PRUint32 mPosition;
txIMatchContext* mInner;
};

Просмотреть файл

@ -33,7 +33,7 @@
*/
#include "FunctionLib.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txAtoms.h"
#include "txIXPathContext.h"
#include "txTokenizer.h"
@ -63,14 +63,14 @@ NodeSetFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
*aResult = nsnull;
nsresult rv = NS_OK;
txListIterator iter(&params);
switch (mType) {
case COUNT:
{
if (!requireParams(1, 1, aContext))
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
rv = evaluateToNodeSet((Expr*)iter.next(), aContext,
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -88,7 +88,7 @@ NodeSetFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
getter_AddRefs(exprResult));
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<NodeSet> resultSet;
nsRefPtr<txNodeSet> resultSet;
rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));
NS_ENSURE_SUCCESS(rv, rv);
@ -100,11 +100,11 @@ NodeSetFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
contextDoc = contextNode->getOwnerDocument();
if (exprResult->getResultType() == txAExprResult::NODESET) {
NodeSet* nodes = NS_STATIC_CAST(NodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult));
int i;
for (i = 0; i < nodes->size(); i++) {
txNodeSet* nodes = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult));
PRInt32 i;
for (i = 0; i < nodes->size(); ++i) {
nsAutoString idList;
XMLDOMUtils::getNodeValue(nodes->get(i), idList);
txTokenizer tokenizer(idList);
@ -145,13 +145,14 @@ NodeSetFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
case NAME:
case NAMESPACE_URI:
{
if (!requireParams(0, 1, aContext))
if (!requireParams(0, 1, aContext)) {
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
}
Node* node = 0;
// Check for optional arg
if (iter.hasNext()) {
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
rv = evaluateToNodeSet((Expr*)iter.next(), aContext,
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -35,7 +35,7 @@
#include "FunctionLib.h"
#include <math.h>
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txAtoms.h"
#include "txIXPathContext.h"
#include "XMLDOMUtils.h"
@ -112,14 +112,14 @@ NumberFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
}
case SUM:
{
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = evaluateToNodeSet((Expr*)iter.next(), aContext,
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
double res = 0;
int i;
for (i = 0; i < nodes->size(); i++) {
PRInt32 i;
for (i = 0; i < nodes->size(); ++i) {
nsAutoString resultStr;
XMLDOMUtils::getNodeValue(nodes->get(i), resultStr);
res += Double::toDouble(resultStr);

Просмотреть файл

@ -32,7 +32,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txNodeSetContext.h"
#include "txSingleNodeContext.h"
#include "XMLUtils.h"
@ -97,7 +97,7 @@ PathExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
{
*aResult = nsnull;
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(aContext->getContextNode(),
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -105,13 +105,13 @@ PathExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
txListIterator iter(&expressions);
PathExprItem* pxi;
while ((pxi = (PathExprItem*)iter.next())) {
nsRefPtr<NodeSet> tmpNodes;
nsRefPtr<txNodeSet> tmpNodes;
txNodeSetContext eContext(nodes, aContext);
while (eContext.hasNext()) {
eContext.next();
Node* node = eContext.getContextNode();
nsRefPtr<NodeSet> resNodes;
nsRefPtr<txNodeSet> resNodes;
if (pxi->pathOp == DESCENDANT_OP) {
rv = aContext->recycler()->getNodeSet(getter_AddRefs(resNodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -128,14 +128,14 @@ PathExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
//XXX ErrorReport: report nonnodeset error
return NS_ERROR_XSLT_NODESET_EXPECTED;
}
resNodes = NS_STATIC_CAST(NodeSet*,
resNodes = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
res));
}
if (tmpNodes) {
if (!resNodes->isEmpty()) {
nsRefPtr<NodeSet> oldSet;
nsRefPtr<txNodeSet> oldSet;
oldSet.swap(tmpNodes);
rv = aContext->recycler()->
getNonSharedNodeSet(oldSet, getter_AddRefs(tmpNodes));
@ -166,7 +166,7 @@ PathExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
**/
nsresult
PathExpr::evalDescendants(Expr* aStep, Node* aNode, txIMatchContext* aContext,
NodeSet* resNodes)
txNodeSet* resNodes)
{
txSingleNodeContext eContext(aNode, aContext);
nsRefPtr<txAExprResult> res;
@ -177,8 +177,8 @@ PathExpr::evalDescendants(Expr* aStep, Node* aNode, txIMatchContext* aContext,
//XXX ErrorReport: report nonnodeset error
return NS_ERROR_XSLT_NODESET_EXPECTED;
}
resNodes->add(NS_STATIC_CAST(NodeSet*, NS_STATIC_CAST(txAExprResult*,
res)));
resNodes->add(NS_STATIC_CAST(txNodeSet*, NS_STATIC_CAST(txAExprResult*,
res)));
MBool filterWS = aContext->isStripSpaceAllowed(aNode);

Просмотреть файл

@ -24,7 +24,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txNodeSetContext.h"
/*
@ -63,11 +63,11 @@ PredicateList::add(Expr* aExpr)
} // add
nsresult
PredicateList::evaluatePredicates(NodeSet* nodes,
PredicateList::evaluatePredicates(txNodeSet* nodes,
txIMatchContext* aContext)
{
NS_ASSERTION(nodes, "called evaluatePredicates with NULL NodeSet");
nsRefPtr<NodeSet> newNodes;
nsRefPtr<txNodeSet> newNodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -28,7 +28,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "XMLDOMUtils.h"
#include "txIXPathContext.h"
@ -50,16 +50,15 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
return compareResults(aContext, &leftBool, aRight);
}
NodeSet* nodeSet = NS_STATIC_CAST(NodeSet*, aLeft);
txNodeSet* nodeSet = NS_STATIC_CAST(txNodeSet*, aLeft);
nsRefPtr<StringResult> strResult;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
NS_ENSURE_SUCCESS(rv, rv);
int i;
PRInt32 i;
for (i = 0; i < nodeSet->size(); ++i) {
Node* node = nodeSet->get(i);
strResult->mValue.Truncate();
XMLDOMUtils::getNodeValue(node, strResult->mValue);
XMLDOMUtils::getNodeValue(nodeSet->get(i), strResult->mValue);
if (compareResults(aContext, strResult, aRight)) {
return PR_TRUE;
}
@ -75,16 +74,15 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
return compareResults(aContext, aLeft, &rightBool);
}
NodeSet* nodeSet = NS_STATIC_CAST(NodeSet*, aRight);
txNodeSet* nodeSet = NS_STATIC_CAST(txNodeSet*, aRight);
nsRefPtr<StringResult> strResult;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
NS_ENSURE_SUCCESS(rv, rv);
int i;
PRInt32 i;
for (i = 0; i < nodeSet->size(); ++i) {
Node* node = nodeSet->get(i);
strResult->mValue.Truncate();
XMLDOMUtils::getNodeValue(node, strResult->mValue);
XMLDOMUtils::getNodeValue(nodeSet->get(i), strResult->mValue);
if (compareResults(aContext, aLeft, strResult)) {
return PR_TRUE;
}
@ -167,7 +165,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
return leftDbl >= rightDbl;
}
NS_NOTREACHED("We should have cought all cases");
NS_NOTREACHED("We should have caught all cases");
return PR_FALSE;
}

Просмотреть файл

@ -38,7 +38,7 @@
#include "txResultRecycler.h"
#include "ExprResult.h"
#include "NodeSet.h"
#include "txNodeSet.h"
txResultRecycler::txResultRecycler()
: mEmptyStringResult(nsnull),
@ -55,7 +55,7 @@ txResultRecycler::~txResultRecycler()
}
txStackIterator nodesetIter(&mNodeSetResults);
while (nodesetIter.hasNext()) {
delete NS_STATIC_CAST(NodeSet*, nodesetIter.next());
delete NS_STATIC_CAST(txNodeSet*, nodesetIter.next());
}
txStackIterator numberIter(&mNumberResults);
while (numberIter.hasNext()) {
@ -111,7 +111,7 @@ txResultRecycler::recycle(txAExprResult* aResult)
}
case txAExprResult::NODESET:
{
rv = mNodeSetResults.push(NS_STATIC_CAST(NodeSet*, aResult));
rv = mNodeSetResults.push(NS_STATIC_CAST(txNodeSet*, aResult));
if (NS_FAILED(rv)) {
delete aResult;
}
@ -177,14 +177,14 @@ txResultRecycler::getEmptyStringResult(txAExprResult** aResult)
}
nsresult
txResultRecycler::getNodeSet(NodeSet** aResult)
txResultRecycler::getNodeSet(txNodeSet** aResult)
{
if (mNodeSetResults.isEmpty()) {
*aResult = new NodeSet(this);
*aResult = new txNodeSet(this);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
}
else {
*aResult = NS_STATIC_CAST(NodeSet*, mNodeSetResults.pop());
*aResult = NS_STATIC_CAST(txNodeSet*, mNodeSetResults.pop());
(*aResult)->clear();
(*aResult)->mRecycler = this;
}
@ -194,14 +194,14 @@ txResultRecycler::getNodeSet(NodeSet** aResult)
}
nsresult
txResultRecycler::getNodeSet(NodeSet* aNodeSet, NodeSet** aResult)
txResultRecycler::getNodeSet(txNodeSet* aNodeSet, txNodeSet** aResult)
{
if (mNodeSetResults.isEmpty()) {
*aResult = new NodeSet(*aNodeSet, this);
*aResult = new txNodeSet(*aNodeSet, this);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
}
else {
*aResult = NS_STATIC_CAST(NodeSet*, mNodeSetResults.pop());
*aResult = NS_STATIC_CAST(txNodeSet*, mNodeSetResults.pop());
(*aResult)->clear();
(*aResult)->append(aNodeSet);
(*aResult)->mRecycler = this;
@ -215,11 +215,11 @@ nsresult
txResultRecycler::getNodeSet(Node* aNode, txAExprResult** aResult)
{
if (mNodeSetResults.isEmpty()) {
*aResult = new NodeSet(aNode, this);
*aResult = new txNodeSet(aNode, this);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
}
else {
NodeSet* nodes = NS_STATIC_CAST(NodeSet*, mNodeSetResults.pop());
txNodeSet* nodes = NS_STATIC_CAST(txNodeSet*, mNodeSetResults.pop());
nodes->clear();
nodes->append(aNode);
nodes->mRecycler = this;
@ -231,14 +231,14 @@ txResultRecycler::getNodeSet(Node* aNode, txAExprResult** aResult)
}
nsresult
txResultRecycler::getNodeSet(Node* aNode, NodeSet** aResult)
txResultRecycler::getNodeSet(Node* aNode, txNodeSet** aResult)
{
if (mNodeSetResults.isEmpty()) {
*aResult = new NodeSet(aNode, this);
*aResult = new txNodeSet(aNode, this);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
}
else {
*aResult = NS_STATIC_CAST(NodeSet*, mNodeSetResults.pop());
*aResult = NS_STATIC_CAST(txNodeSet*, mNodeSetResults.pop());
(*aResult)->clear();
(*aResult)->append(aNode);
(*aResult)->mRecycler = this;
@ -275,7 +275,7 @@ txResultRecycler::getBoolResult(PRBool aValue, txAExprResult** aResult)
}
nsresult
txResultRecycler::getNonSharedNodeSet(NodeSet* aNodeSet, NodeSet** aResult)
txResultRecycler::getNonSharedNodeSet(txNodeSet* aNodeSet, txNodeSet** aResult)
{
if (aNodeSet->mRefCnt > 1) {
return getNodeSet(aNodeSet, aResult);

Просмотреть файл

@ -44,7 +44,7 @@
class txAExprResult;
class StringResult;
class NodeSet;
class txNodeSet;
class Node;
class NumberResult;
class BooleanResult;
@ -80,10 +80,10 @@ public:
*/
nsresult getStringResult(StringResult** aResult);
nsresult getStringResult(const nsAString& aValue, txAExprResult** aResult);
nsresult getNodeSet(NodeSet** aResult);
nsresult getNodeSet(NodeSet* aNodeSet, NodeSet** aResult);
nsresult getNodeSet(txNodeSet** aResult);
nsresult getNodeSet(txNodeSet* aNodeSet, txNodeSet** aResult);
nsresult getNodeSet(Node* aNode, txAExprResult** aResult);
nsresult getNodeSet(Node* aNode, NodeSet** aResult);
nsresult getNodeSet(Node* aNode, txNodeSet** aResult);
nsresult getNumberResult(double aValue, txAExprResult** aResult);
/**
@ -96,7 +96,7 @@ public:
/**
* Functions that return non-shared resultsobjects
*/
nsresult getNonSharedNodeSet(NodeSet* aNodeSet, NodeSet** aResult);
nsresult getNonSharedNodeSet(txNodeSet* aNodeSet, txNodeSet** aResult);
private:
nsAutoRefCnt mRefCnt;

Просмотреть файл

@ -24,7 +24,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txIXPathContext.h"
/**

Просмотреть файл

@ -45,7 +45,8 @@ class txSingleNodeContext : public txIEvalContext
{
public:
txSingleNodeContext(Node* aContextNode, txIMatchContext* aContext)
: mNode(aContextNode), mInner(aContext)
: mNode(aContextNode),
mInner(aContext)
{
NS_ASSERTION(aContextNode, "context node must be given");
NS_ASSERTION(aContext, "txIMatchContext must be given");

Просмотреть файл

@ -278,12 +278,13 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
if (!requireParams(3, 3, aContext))
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
nsAutoString src;
evaluateToString((Expr*)iter.next(), aContext, src);
nsRefPtr<StringResult> strRes;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString src;
evaluateToString((Expr*)iter.next(), aContext, src);
strRes->mValue.SetCapacity(src.Length());
nsAutoString oldChars, newChars;
evaluateToString((Expr*)iter.next(), aContext, oldChars);

Просмотреть файл

@ -24,7 +24,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txIXPathContext.h"
//-------------/
@ -78,7 +78,7 @@ nsresult
UnionExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
{
*aResult = nsnull;
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -93,8 +93,8 @@ UnionExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
//XXX ErrorReport: report nonnodeset error
return NS_ERROR_XSLT_NODESET_EXPECTED;
}
rv = nodes->add(NS_STATIC_CAST(NodeSet*, NS_STATIC_CAST(txAExprResult*,
exprResult)));
rv = nodes->add(NS_STATIC_CAST(txNodeSet*, NS_STATIC_CAST(txAExprResult*,
exprResult)));
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -24,7 +24,7 @@
*/
#include "Expr.h"
#include "NodeSet.h"
#include "txNodeSet.h"
#include "txAtoms.h"
#include "txIXPathContext.h"

Просмотреть файл

@ -65,7 +65,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
txExecutionState* es =
NS_STATIC_CAST(txExecutionState*, aContext->getPrivateContext());
nsRefPtr<NodeSet> nodeSet;
nsRefPtr<txNodeSet> nodeSet;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodeSet));
NS_ENSURE_SUCCESS(rv, rv);
@ -86,7 +86,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
if (iter.hasNext()) {
// We have 2 arguments, get baseURI from the first node
// in the resulting nodeset
nsRefPtr<NodeSet> nodeSet2;
nsRefPtr<txNodeSet> nodeSet2;
rv = evaluateToNodeSet(NS_STATIC_CAST(Expr*, iter.next()),
aContext, getter_AddRefs(nodeSet2));
NS_ENSURE_SUCCESS(rv, rv);
@ -103,11 +103,11 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
if (exprResult1->getResultType() == txAExprResult::NODESET) {
// The first argument is a NodeSet, iterate on its nodes
NodeSet* nodeSet1 = NS_STATIC_CAST(NodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult1));
int i;
for (i = 0; i < nodeSet1->size(); i++) {
txNodeSet* nodeSet1 = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult1));
PRInt32 i;
for (i = 0; i < nodeSet1->size(); ++i) {
Node* node = nodeSet1->get(i);
nsAutoString uriStr;
XMLDOMUtils::getNodeValue(node, uriStr);
@ -121,20 +121,22 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
nodeSet->add(loadNode);
}
}
}
else {
// The first argument is not a NodeSet
nsAutoString uriStr;
exprResult1->stringValue(uriStr);
nsAString* base = baseURISet ? &baseURI : &mBaseURI;
Node* loadNode = es->retrieveDocument(uriStr, *base);
if (loadNode) {
nodeSet->add(loadNode);
}
NS_ADDREF(*aResult = nodeSet);
return NS_OK;
}
*aResult = nodeSet;
NS_ADDREF(*aResult);
// The first argument is not a NodeSet
nsAutoString uriStr;
exprResult1->stringValue(uriStr);
nsAString* base = baseURISet ? &baseURI : &mBaseURI;
Node* loadNode = es->retrieveDocument(uriStr, *base);
if (loadNode) {
nodeSet->add(loadNode);
}
NS_ADDREF(*aResult = nodeSet);
return NS_OK;
}

Просмотреть файл

@ -75,8 +75,6 @@ ElementAvailableFunctionCall::evaluate(txIEvalContext* aContext,
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
}
txListIterator iter(&params);
Expr* param = (Expr*) iter.next();

Просмотреть файл

@ -521,15 +521,16 @@ txExecutionState::retrieveDocument(const nsAString& uri,
if (NS_FAILED(rv) || !xmlDoc) {
receiveError(NS_LITERAL_STRING("Couldn't load document '") +
docUrl + NS_LITERAL_STRING("': ") + errMsg, rv);
return NULL;
return nsnull;
}
// add to list of documents
mLoadedDocuments.Add(xmlDoc);
}
// return element with supplied id if supplied
if (!frag.IsEmpty())
if (!frag.IsEmpty()) {
return xmlDoc->getElementById(frag);
}
return xmlDoc;
}
@ -539,7 +540,7 @@ txExecutionState::getKeyNodes(const txExpandedName& aKeyName,
Document* aDocument,
const nsAString& aKeyValue,
PRBool aIndexIfNotFound,
NodeSet** aResult)
txNodeSet** aResult)
{
return mKeyHash.getKeyNodes(aKeyName, aDocument, aKeyValue,
aIndexIfNotFound, *this, aResult);

Просмотреть файл

@ -55,8 +55,8 @@ class txInstruction;
class txIOutputHandlerFactory;
class txExpandedNameMap;
class txLoadedDocumentEntry : public PLDHashStringEntry {
class txLoadedDocumentEntry : public PLDHashStringEntry
{
public:
txLoadedDocumentEntry(const void* aKey) : PLDHashStringEntry(aKey)
{
@ -126,7 +126,7 @@ public:
Node* retrieveDocument(const nsAString& uri, const nsAString& baseUri);
nsresult getKeyNodes(const txExpandedName& aKeyName, Document* aDocument,
const nsAString& aKeyValue, PRBool aIndexIfNotFound,
NodeSet** aResult);
txNodeSet** aResult);
TemplateRule* getCurrentTemplateRule();
// state-modification functions

Просмотреть файл

@ -434,13 +434,12 @@ txCopyOf::execute(txExecutionState& aEs)
switch (exprRes->getResultType()) {
case txAExprResult::NODESET:
{
NodeSet* nodes = NS_STATIC_CAST(NodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprRes));
int i;
txNodeSet* nodes = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprRes));
PRInt32 i;
for (i = 0; i < nodes->size(); ++i) {
Node* node = nodes->get(i);
rv = copyNode(node, aEs);
rv = copyNode(nodes->get(i), aEs);
NS_ENSURE_SUCCESS(rv, rv);
}
break;
@ -702,8 +701,9 @@ txPushNewContext::execute(txExecutionState& aEs)
return NS_ERROR_XSLT_NODESET_EXPECTED;
}
NodeSet* nodes =
NS_STATIC_CAST(NodeSet*, NS_STATIC_CAST(txAExprResult*, exprRes));
txNodeSet* nodes = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprRes));
if (nodes->isEmpty()) {
aEs.gotoInstruction(mBailTarget);
@ -721,7 +721,7 @@ txPushNewContext::execute(txExecutionState& aEs)
aEs.getEvalContext());
NS_ENSURE_SUCCESS(rv, rv);
}
nsRefPtr<NodeSet> sortedNodes;
nsRefPtr<txNodeSet> sortedNodes;
rv = sorter.sortNodeSet(nodes, &aEs, getter_AddRefs(sortedNodes));
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -77,20 +77,21 @@ txKeyFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
else
contextDoc = contextNode->getOwnerDocument();
nsRefPtr<NodeSet> res;
NodeSet* nodeSet;
nsRefPtr<txNodeSet> res;
txNodeSet* nodeSet;
if (exprResult->getResultType() == txAExprResult::NODESET &&
(nodeSet = NS_STATIC_CAST(NodeSet*,
(nodeSet = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult)))->size() > 1) {
rv = aContext->recycler()->getNodeSet(getter_AddRefs(res));
NS_ENSURE_SUCCESS(rv, rv);
int i;
PRInt32 i;
for (i = 0; i < nodeSet->size(); ++i) {
nsAutoString val;
XMLDOMUtils::getNodeValue(nodeSet->get(i), val);
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
rv = es->getKeyNodes(keyName, contextDoc, val, i == 0,
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -192,7 +193,7 @@ txKeyHash::getKeyNodes(const txExpandedName& aKeyName,
const nsAString& aKeyValue,
PRBool aIndexIfNotFound,
txExecutionState& aEs,
NodeSet** aResult)
txNodeSet** aResult)
{
NS_ENSURE_TRUE(mKeyValues.mHashTable.ops && mIndexedKeys.mHashTable.ops,
NS_ERROR_OUT_OF_MEMORY);
@ -203,6 +204,7 @@ txKeyHash::getKeyNodes(const txExpandedName& aKeyName,
if (valueEntry) {
*aResult = valueEntry->mNodeSet;
NS_ADDREF(*aResult);
return NS_OK;
}
@ -215,6 +217,7 @@ txKeyHash::getKeyNodes(const txExpandedName& aKeyName,
// indexed, so don't bother investigating.
*aResult = mEmptyNodeSet;
NS_ADDREF(*aResult);
return NS_OK;
}
@ -265,7 +268,7 @@ txKeyHash::init()
rv = mIndexedKeys.Init(1);
NS_ENSURE_SUCCESS(rv, rv);
mEmptyNodeSet = new NodeSet(nsnull);
mEmptyNodeSet = new txNodeSet(nsnull);
NS_ENSURE_TRUE(mEmptyNodeSet, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;
@ -366,18 +369,19 @@ nsresult txXSLKey::indexTree(Node* aNode, txKeyValueHashKey& aKey,
* @param aKeyValueHash Hash to add values to
* @param aEs txExecutionState to use for XPath evaluation
*/
nsresult txXSLKey::testNode(Node* aNode, txKeyValueHashKey& aKey,
txKeyValueHash& aKeyValueHash, txExecutionState& aEs)
nsresult txXSLKey::testNode(Node* aNode,
txKeyValueHashKey& aKey,
txKeyValueHash& aKeyValueHash,
txExecutionState& aEs)
{
nsresult rv = NS_OK;
nsAutoString val;
txListIterator iter(&mKeys);
while (iter.hasNext())
{
Key* key=(Key*)iter.next();
Key* key = (Key*)iter.next();
if (key->matchPattern->matches(aNode, &aEs)) {
txSingleNodeContext evalContext(aNode, &aEs);
rv = aEs.pushEvalContext(&evalContext);
nsresult rv = aEs.pushEvalContext(&evalContext);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<txAExprResult> exprResult;
@ -388,9 +392,9 @@ nsresult txXSLKey::testNode(Node* aNode, txKeyValueHashKey& aKey,
aEs.popEvalContext();
if (exprResult->getResultType() == txAExprResult::NODESET) {
NodeSet* res = NS_STATIC_CAST(NodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult));
txNodeSet* res = NS_STATIC_CAST(txNodeSet*,
NS_STATIC_CAST(txAExprResult*,
exprResult));
for (int i=0; i<res->size(); i++) {
val.Truncate();
XMLDOMUtils::getNodeValue(res->get(i), val);

Просмотреть файл

@ -191,11 +191,10 @@ txStylesheet::findTemplate(Node* aNode,
}
#ifdef PR_LOGGING
nsAutoString mode;
nsAutoString mode, nodeName;
if (aMode.mLocalName) {
aMode.mLocalName->ToString(mode);
}
nsAutoString nodeName;
aNode->getNodeName(nodeName);
if (matchTemplate) {
nsAutoString matchAttr;
@ -218,18 +217,22 @@ txStylesheet::findTemplate(Node* aNode,
switch(aNode->getNodeType()) {
case Node::ELEMENT_NODE :
case Node::DOCUMENT_NODE :
{
matchTemplate = mContainerTemplate;
break;
}
case Node::ATTRIBUTE_NODE :
case Node::TEXT_NODE :
case Node::CDATA_SECTION_NODE :
{
matchTemplate = mCharactersTemplate;
break;
}
default:
{
matchTemplate = mEmptyTemplate;
break;
}
}
}
@ -277,7 +280,7 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
{
PRInt32 frameCount = mStripSpaceTests.Count();
if (!aNode || frameCount == 0) {
return MB_FALSE;
return PR_FALSE;
}
switch (aNode->getNodeType()) {
@ -306,7 +309,8 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
return isStripSpaceAllowed(aNode->getParentNode(), aContext);
}
}
return MB_FALSE;
return PR_FALSE;
}
nsresult

Просмотреть файл

@ -272,6 +272,7 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
Node* node = currNode;
PRInt32 value = 0;
MBool matchedFrom = MB_FALSE;
while (node) {
if (aFromPattern && node != currNode &&
aFromPattern->matches(node, aContext)) {
@ -314,7 +315,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
{
aHead.Truncate();
aTail.Truncate();
nsresult rv = NS_OK;
nsAutoString groupSeparator;
@ -323,7 +324,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
nsRefPtr<txAExprResult> exprRes;
rv = aGroupSize->evaluate(aContext, getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString sizeStr;
exprRes->stringValue(sizeStr);
@ -332,7 +333,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
if ((double)groupSize != size) {
groupSize = 0;
}
rv = aGroupSeparator->evaluate(aContext, getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
@ -344,27 +345,27 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
nsRefPtr<txAExprResult> formatRes;
rv = aFormat->evaluate(aContext, getter_AddRefs(formatRes));
NS_ENSURE_SUCCESS(rv, rv);
formatRes->stringValue(format);
}
PRUint32 formatLen = format.Length();
PRUint32 formatPos = 0;
PRUnichar ch = 0;
// start with header
while (formatPos < formatLen &&
!isAlphaNumeric(ch = format.CharAt(formatPos))) {
aHead.Append(ch);
++formatPos;
}
// If there are no formatting tokens we need to create a default one.
if (formatPos == formatLen) {
txFormattedCounter* defaultCounter;
rv = txFormattedCounter::getCounterFor(NS_LITERAL_STRING("1"), groupSize,
groupSeparator, defaultCounter);
NS_ENSURE_SUCCESS(rv, rv);
defaultCounter->mSeparator = NS_LITERAL_STRING(".");
rv = aCounters.add(defaultCounter);
if (NS_FAILED(rv)) {
@ -453,7 +454,6 @@ txXSLTNumber::getSiblingCount(Node* aNode, txPattern* aCountPattern,
return value;
}
Node*
txXSLTNumber::getPrevInDocumentOrder(Node* aNode)
{
@ -469,7 +469,6 @@ txXSLTNumber::getPrevInDocumentOrder(Node* aNode)
return aNode->getXPathParent();
}
#define TX_CHAR_RANGE(ch, a, b) if (ch < a) return MB_FALSE; \
if (ch <= b) return MB_TRUE
#define TX_MATCH_CHAR(ch, a) if (ch < a) return MB_FALSE; \

Просмотреть файл

@ -413,7 +413,7 @@ MBool txKeyPattern::matches(Node* aNode, txIMatchContext* aContext)
contextDoc = (Document*)aNode;
else
contextDoc = aNode->getOwnerDocument();
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = es->getKeyNodes(mName, contextDoc, mValue, PR_TRUE,
getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
@ -493,7 +493,7 @@ MBool txStepPattern::matches(Node* aNode, txIMatchContext* aContext)
*/
// Create the context node set for evaluating the predicates
nsRefPtr<NodeSet> nodes;
nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv);
@ -520,7 +520,7 @@ MBool txStepPattern::matches(Node* aNode, txIMatchContext* aContext)
txListIterator iter(&predicates);
Expr* predicate = (Expr*)iter.next();
nsRefPtr<NodeSet> newNodes;
nsRefPtr<txNodeSet> newNodes;
rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
NS_ENSURE_SUCCESS(rv, rv);