mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 20:42:49 +00:00
Fix for bug 101890 (break linkage from transformiix to layout). r=Pike, sr=jst.
This commit is contained in:
parent
5890af485a
commit
07e2d4c47a
@ -35,7 +35,6 @@ endif
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
necko \
|
||||
@ -142,7 +141,6 @@ LOBJS =../source/base/ArrayList.$(OBJ_SUFFIX) \
|
||||
../source/xslt/functions/SystemPropertyFunctionCall.$(OBJ_SUFFIX) \
|
||||
../source/xslt/functions/txFormatNumberFunctionCall.$(OBJ_SUFFIX) \
|
||||
../source/xslt/functions/txKeyFunctionCall.$(OBJ_SUFFIX) \
|
||||
../source/xslt/util/NodeStack.$(OBJ_SUFFIX) \
|
||||
../source/xslt/util/txNodeSorter.$(OBJ_SUFFIX) \
|
||||
../source/xslt/util/txXPathResultComparator.$(OBJ_SUFFIX) \
|
||||
$(NULL)
|
||||
@ -150,7 +148,6 @@ LOBJS =../source/base/ArrayList.$(OBJ_SUFFIX) \
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -105,16 +105,6 @@
|
||||
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
|
||||
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
|
||||
</SETTING>
|
||||
<SETTING>
|
||||
<SETTING><NAME>SearchPath</NAME>
|
||||
<SETTING><NAME>Path</NAME><VALUE>::::intl:unicharutil:macbuild:</VALUE></SETTING>
|
||||
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
|
||||
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
|
||||
</SETTING>
|
||||
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
|
||||
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
|
||||
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
|
||||
</SETTING>
|
||||
</SETTING>
|
||||
<SETTING><NAME>SystemSearchPaths</NAME>
|
||||
<SETTING>
|
||||
@ -1198,13 +1188,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NodeStack.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>MozillaProcInstruction.cpp</PATH>
|
||||
@ -1506,13 +1489,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScriptDebug.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Library</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>Map.cpp</PATH>
|
||||
@ -1819,11 +1795,6 @@
|
||||
<PATH>Numbering.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NodeStack.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>AdditiveExpr.cpp</PATH>
|
||||
@ -2059,11 +2030,6 @@
|
||||
<PATH>FunctionAvailableFnCall.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScriptDebug.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>Map.cpp</PATH>
|
||||
@ -2223,16 +2189,6 @@
|
||||
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
|
||||
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
|
||||
</SETTING>
|
||||
<SETTING>
|
||||
<SETTING><NAME>SearchPath</NAME>
|
||||
<SETTING><NAME>Path</NAME><VALUE>::::intl:unicharutil:macbuild:</VALUE></SETTING>
|
||||
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
|
||||
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
|
||||
</SETTING>
|
||||
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
|
||||
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
|
||||
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
|
||||
</SETTING>
|
||||
</SETTING>
|
||||
<SETTING><NAME>SystemSearchPaths</NAME>
|
||||
<SETTING>
|
||||
@ -3260,13 +3216,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NodeStack.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>MozillaProcInstruction.cpp</PATH>
|
||||
@ -3596,13 +3545,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScript.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Library</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>Map.cpp</PATH>
|
||||
@ -3897,11 +3839,6 @@
|
||||
<PATH>Numbering.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NodeStack.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>AdditiveExpr.cpp</PATH>
|
||||
@ -4157,11 +4094,6 @@
|
||||
<PATH>FunctionAvailableFnCall.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScript.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>Map.cpp</PATH>
|
||||
@ -4840,12 +4772,6 @@
|
||||
</FILEREF>
|
||||
</GROUP>
|
||||
<GROUP><NAME>util</NAME>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiixDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NodeStack.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiixDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
@ -4907,12 +4833,6 @@
|
||||
<PATH>xpcom.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiix.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScript.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
</GROUP>
|
||||
<GROUP><NAME>Debug</NAME>
|
||||
<FILEREF>
|
||||
@ -4939,12 +4859,6 @@
|
||||
<PATH>xpcomDebug.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiixDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>JavaScriptDebug.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
</GROUP>
|
||||
</GROUP>
|
||||
<GROUP><NAME>System Libraries</NAME>
|
||||
|
@ -116,7 +116,6 @@ OBJS =../base/ArrayList.$(OBJ_SUFFIX) \
|
||||
../xslt/functions/SystemPropertyFunctionCall.$(OBJ_SUFFIX) \
|
||||
../xslt/functions/txFormatNumberFunctionCall.$(OBJ_SUFFIX) \
|
||||
../xslt/functions/txKeyFunctionCall.$(OBJ_SUFFIX) \
|
||||
../xslt/util/NodeStack.$(OBJ_SUFFIX) \
|
||||
../xslt/util/txNodeSorter.$(OBJ_SUFFIX) \
|
||||
../xslt/util/txXPathResultComparator.$(OBJ_SUFFIX) \
|
||||
transformiix.$(OBJ_SUFFIX)
|
||||
|
@ -31,9 +31,7 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
endif
|
||||
|
@ -30,7 +30,6 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
necko \
|
||||
|
@ -28,7 +28,8 @@
|
||||
*/
|
||||
|
||||
#include "mozilladom.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
static NS_DEFINE_CID(kIDOMDOMImplementationCID, NS_DOM_IMPLEMENTATION_CID);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "txAtoms.h"
|
||||
#include "mozilladom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(Node)
|
||||
|
@ -52,8 +52,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMCDATASection.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
|
@ -35,7 +35,6 @@ REQUIRES = string \
|
||||
content \
|
||||
widget \
|
||||
js \
|
||||
appshell \
|
||||
xpconnect \
|
||||
caps \
|
||||
unicharutil \
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "XMLParser.h"
|
||||
#include "txURIUtils.h"
|
||||
#ifndef TX_EXE
|
||||
#include "nsIDocument.h"
|
||||
#include "nsSyncLoader.h"
|
||||
#include "nsNetUtil.h"
|
||||
#else
|
||||
|
@ -31,7 +31,6 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
xpconnect \
|
||||
@ -82,8 +81,6 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir) -I$(srcdir)/../base \
|
||||
-I$(srcdir)/../xml -I$(srcdir)/../xml/dom \
|
||||
-I$(srcdir)/../xslt -I$(srcdir)/../xslt/util \
|
||||
-I$(srcdir)/../xslt/functions \
|
||||
-I$(srcdir)
|
||||
-I$(srcdir)/../xslt
|
||||
|
||||
libs:: $(OBJS)
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "nsXPathExpression.h"
|
||||
#include "nsXPathNSResolver.h"
|
||||
#include "nsXPathResult.h"
|
||||
#include "ProcessorState.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "ExprParser.h"
|
||||
#include "nsDOMError.h"
|
||||
|
@ -33,7 +33,6 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
necko \
|
||||
|
@ -29,7 +29,6 @@
|
||||
#define TRANSFRMX_PROCESSORSTATE_H
|
||||
|
||||
#include "NodeSet.h"
|
||||
#include "NodeStack.h"
|
||||
#include "Stack.h"
|
||||
#include "ErrorObserver.h"
|
||||
#include "NamedMap.h"
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "txNodeSetContext.h"
|
||||
#include "txSingleNodeContext.h"
|
||||
#ifndef TX_EXE
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -31,9 +31,7 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
endif
|
||||
|
@ -31,20 +31,18 @@ MODULE = transformiix
|
||||
REQUIRES = string \
|
||||
xpcom \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
locale \
|
||||
unicharutil \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CPPSRCS = NodeStack.cpp txNodeSorter.cpp txXPathResultComparator.cpp
|
||||
CPPSRCS = txNodeSorter.cpp txXPathResultComparator.cpp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += -I$(srcdir) -I$(srcdir)/../../base -I$(srcdir)/../../xpath \
|
||||
-I$(srcdir)/../../xml -I$(srcdir)/../../xml/dom \
|
||||
-I$(srcdir)/../../xslt -I$(srcdir)/../../xslt/functions
|
||||
-I$(srcdir)/.. -I$(srcdir)/../functions
|
||||
|
||||
libs:: $(OBJS)
|
||||
|
@ -1,269 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The MITRE Corporation.
|
||||
* Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation.
|
||||
*
|
||||
* Portions created by Keith Visco as a Non MITRE employee,
|
||||
* (C) 1999 Keith Visco. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* Larry Fitzpatrick, OpenText, lef@opentext.com
|
||||
* -- moved initialization of DEFAULT_SIZE from NodeStack.h to here
|
||||
*
|
||||
*/
|
||||
|
||||
#include "NodeStack.h"
|
||||
|
||||
//-------------/
|
||||
//- Constants -/
|
||||
//-------------/
|
||||
const int NodeStack::DEFAULT_SIZE = 25;
|
||||
|
||||
//----------------/
|
||||
//- Constructors -/
|
||||
//----------------/
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the default Size
|
||||
**/
|
||||
NodeStack::NodeStack() {
|
||||
initialize(DEFAULT_SIZE);
|
||||
} //-- NodeStack
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the specified size
|
||||
**/
|
||||
NodeStack::NodeStack(int size) {
|
||||
initialize(size);
|
||||
} //-- NodeStack
|
||||
|
||||
/**
|
||||
* Helper method for Constructors
|
||||
**/
|
||||
void NodeStack::initialize(int size) {
|
||||
elements = new Node*[size];
|
||||
elementCount = 0;
|
||||
bufferSize = size;
|
||||
initialSize = size;
|
||||
} //-- initialize
|
||||
|
||||
/**
|
||||
* Destructor for NodeSet
|
||||
**/
|
||||
NodeStack::~NodeStack() {
|
||||
delete [] elements;
|
||||
} //-- ~NodeStack
|
||||
|
||||
/**
|
||||
* Returns the specified Node from the top of this Stack,
|
||||
* without removing it from the stack.
|
||||
* @param node the Node to add to the top of the Stack
|
||||
* @return a pointer to the Node that is the top of this Stack
|
||||
**/
|
||||
Node* NodeStack::peek() {
|
||||
return get(size()-1);
|
||||
} //-- peek
|
||||
|
||||
/**
|
||||
* Removes the specified Node from the top of this Stack.
|
||||
* @param node the Node to add to the top of the Stack
|
||||
* @return a pointer to the Node that was the top of this Stack
|
||||
**/
|
||||
Node* NodeStack::pop() {
|
||||
return remove(size()-1);
|
||||
} //-- pop
|
||||
|
||||
/**
|
||||
* Adds the specified Node to the top of this Stack.
|
||||
* @param node the Node to add to the top of the Stack
|
||||
**/
|
||||
void NodeStack::push(Node* node) {
|
||||
if (elementCount == bufferSize) increaseSize();
|
||||
elements[elementCount++] = node;
|
||||
} //-- push
|
||||
|
||||
|
||||
/**
|
||||
* Removes all elements from the Stack
|
||||
**/
|
||||
void NodeStack::clear() {
|
||||
for (int i = 0; i < elementCount; i++) {
|
||||
elements[i] = 0;
|
||||
}
|
||||
elementCount = 0;
|
||||
} //-- clear
|
||||
|
||||
/**
|
||||
* Returns true if the specified Node is contained in the Stack.
|
||||
* if the specfied Node is null, then if the NodeStack contains a null
|
||||
* value, true will be returned.
|
||||
* @param node the element to search the NodeStack for
|
||||
* @return true if specified Node is contained in the NodeStack
|
||||
**/
|
||||
MBool NodeStack::contains(Node* node) {
|
||||
#if 0
|
||||
// XXX DEBUG OUTPUT
|
||||
cout << "NodeStack#contains [enter]\n";
|
||||
#endif
|
||||
MBool retVal = (indexOf(node) >= 0) ? MB_TRUE : MB_FALSE;
|
||||
#if 0
|
||||
// XXX DEBUG OUTPUT
|
||||
cout << "NodeStack#contains [exit]\n";
|
||||
#endif
|
||||
return retVal;
|
||||
|
||||
} //-- contains
|
||||
|
||||
/**
|
||||
* Compares the specified NodeStack with this NodeStack for equality.
|
||||
* Returns true if and only if the specified NodeStack is the same
|
||||
* size as this NodeSet and all of its associated
|
||||
* Nodes are contained within this NodeStack in the same order.
|
||||
* @return true if and only if the specified NodeStack is the
|
||||
* same size as this NodeStack and all of its associated
|
||||
* Nodes are contained within this NodeStack in the same order.
|
||||
**/
|
||||
MBool NodeStack::equals(NodeStack* nodeStack) {
|
||||
if (!nodeStack) return MB_FALSE;
|
||||
if (nodeStack->size() != size()) return MB_FALSE;
|
||||
|
||||
for (int i = 0; i < size(); i++) {
|
||||
if (nodeStack->get(i) != get(i)) return MB_FALSE;
|
||||
}
|
||||
return MB_TRUE;
|
||||
} //-- equals
|
||||
|
||||
/**
|
||||
* Returns the Node at the specified position in this NodeStack.
|
||||
* @param index the position of the Node to return
|
||||
**/
|
||||
Node* NodeStack::get(int index) {
|
||||
if ((index < 0) || index >= elementCount) return 0;
|
||||
return elements[index];
|
||||
} //-- get
|
||||
|
||||
|
||||
/**
|
||||
* Returns the index of the specified Node,
|
||||
* or -1 if the Node is not contained in the NodeStack
|
||||
* @param node the Node to get the index for
|
||||
**/
|
||||
int NodeStack::indexOf(Node* node) {
|
||||
|
||||
for (int i = 0; i < elementCount; i++) {
|
||||
if (node == elements[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
} //-- indexOf
|
||||
|
||||
/**
|
||||
* Returns true if there are no Nodes in the NodeStack.
|
||||
* @return true if there are no Nodes in the NodeStack.
|
||||
**/
|
||||
MBool NodeStack::isEmpty() {
|
||||
return (elementCount == 0) ? MB_TRUE : MB_FALSE;
|
||||
} //-- isEmpty
|
||||
|
||||
/**
|
||||
* Removes the Node at the specified index from the NodeStack
|
||||
* @param index the position in the NodeStack to remove the Node from
|
||||
* @return the Node that was removed from the NodeStack
|
||||
**/
|
||||
Node* NodeStack::remove(int index) {
|
||||
|
||||
if ((index < 0) || (index > elementCount)) return 0;
|
||||
Node* node = elements[index];
|
||||
shiftDown(index+1);
|
||||
--elementCount;
|
||||
return node;
|
||||
} //-- remove
|
||||
|
||||
/**
|
||||
* Removes the the specified Node from the NodeStack
|
||||
* @param node the Node to remove from the NodeStack
|
||||
* @return true if the Node was removed from the list
|
||||
**/
|
||||
MBool NodeStack::remove(Node* node) {
|
||||
int index = indexOf(node);
|
||||
|
||||
if (index > -1) {
|
||||
remove(index);
|
||||
}
|
||||
else return MB_FALSE;
|
||||
|
||||
return MB_TRUE;
|
||||
} //-- remove
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the NodeStack
|
||||
* @return the number of elements in the NodeStack
|
||||
**/
|
||||
int NodeStack::size() {
|
||||
return elementCount;
|
||||
} //-- size
|
||||
|
||||
//-------------------/
|
||||
//- Private Methods -/
|
||||
//-------------------/
|
||||
|
||||
/**
|
||||
* increase the NodeStack capacity by a factor of its initial size
|
||||
**/
|
||||
void NodeStack::increaseSize() {
|
||||
|
||||
bufferSize += bufferSize;
|
||||
Node** tmpNodes = elements;
|
||||
elements = new Node*[bufferSize];
|
||||
for (int i=0;i < elementCount; i++) {
|
||||
elements[i] = tmpNodes[i];
|
||||
}
|
||||
delete [] tmpNodes;
|
||||
|
||||
} //-- increaseSize
|
||||
|
||||
/**
|
||||
* Shifts all elements at the specified index to down by 1
|
||||
**/
|
||||
void NodeStack::shiftDown(int index) {
|
||||
if ((index <= 0) || (index >= elementCount)) return;
|
||||
|
||||
//-- from Java
|
||||
//-- System.arraycopy(elements, index, elements, index - 1, elementCount - index);
|
||||
for (int i = index; i < elementCount; i++) {
|
||||
elements[index-1] = elements[index];
|
||||
}
|
||||
|
||||
elements[elementCount-1] = 0;
|
||||
} //-- shiftDown
|
||||
|
||||
/**
|
||||
* Shifts all elements at the specified index up by 1
|
||||
**/
|
||||
void NodeStack::shiftUp(int index) {
|
||||
if (index == elementCount) return;
|
||||
if (elementCount == bufferSize) increaseSize();
|
||||
|
||||
//-- from Java
|
||||
//-- System.arraycopy(elements, index, elements, index + 1, elementCount - index);
|
||||
for (int i = elementCount; i > index; i--) {
|
||||
elements[i] = elements[i-1];
|
||||
}
|
||||
} //-- shiftUp
|
||||
|
@ -1,193 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The MITRE Corporation.
|
||||
* Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation.
|
||||
*
|
||||
* Portions created by Keith Visco as a Non MITRE employee,
|
||||
* (C) 1999 Keith Visco. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* Larry Fitzpatrick, OpenText, lef@opentext.com
|
||||
* -- moved initialization of DEFAULT_SIZE to NodeStack.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NODESTACK_H
|
||||
#define NODESTACK_H
|
||||
|
||||
#include "dom.h"
|
||||
#include "baseutils.h"
|
||||
|
||||
class NodeStack {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//----------------/
|
||||
//- Constructors -/
|
||||
//----------------/
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the default Size
|
||||
**/
|
||||
NodeStack();
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the specified Size
|
||||
**/
|
||||
NodeStack(int size);
|
||||
|
||||
/**
|
||||
* Destructor for NodeStack, will not delete Node References
|
||||
**/
|
||||
~NodeStack();
|
||||
|
||||
/**
|
||||
* Returns the specified Node from the top of this Stack,
|
||||
* without removing it from the stack.
|
||||
* @param node the Node to add to the top of the Stack
|
||||
* @return a pointer to the Node that is the top of this Stack
|
||||
**/
|
||||
Node* peek();
|
||||
void push(Node* node);
|
||||
Node* pop();
|
||||
|
||||
/**
|
||||
* Adds the specified Node to the NodeSet at the specified index,
|
||||
* as long as the Node is not already contained within the set
|
||||
* @param node the Node to add to the NodeSet
|
||||
* @return true if the Node is added to the NodeSet
|
||||
* @exception IndexOutOfBoundsException
|
||||
**/
|
||||
MBool add(int index, Node* node);
|
||||
|
||||
/**
|
||||
* Removes all elements from the list
|
||||
**/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Returns true if the specified Node is contained in the set.
|
||||
* if the specfied Node is null, then if the NodeSet contains a null
|
||||
* value, true will be returned.
|
||||
* @param node the element to search the NodeSet for
|
||||
* @return true if specified Node is contained in the NodeSet
|
||||
**/
|
||||
MBool contains(Node* node);
|
||||
|
||||
/**
|
||||
* 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(NodeStack* nodeStack);
|
||||
|
||||
/**
|
||||
* Returns the Node at the specified position in this NodeSet.
|
||||
* @param index the position of the Node to return
|
||||
* @exception IndexOutOfBoundsException
|
||||
**/
|
||||
Node* get(int index);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the index of the specified Node,
|
||||
* or -1 if the Node is not contained in the NodeSet
|
||||
* @param node the Node to get the index for
|
||||
**/
|
||||
int indexOf(Node* node);
|
||||
|
||||
/**
|
||||
* Returns true if there are no Nodes in the NodeSet.
|
||||
* @return true if there are no Nodes in the NodeSet.
|
||||
**/
|
||||
MBool isEmpty();
|
||||
|
||||
/**
|
||||
* Removes the Node at the specified index from the NodeSet
|
||||
* @param index the position in the NodeSet to remove the Node from
|
||||
* @return the Node that was removed from the list
|
||||
**/
|
||||
Node* remove(int index);
|
||||
|
||||
/**
|
||||
* Removes the the specified Node from the NodeSet
|
||||
* @param node the Node to remove from the NodeSet
|
||||
* @return true if the Node was removed from the list
|
||||
**/
|
||||
MBool remove(Node* node);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the NodeSet
|
||||
* @return the number of elements in the NodeSet
|
||||
**/
|
||||
int size();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//-------------------/
|
||||
//- Private Members -/
|
||||
//-------------------/
|
||||
|
||||
static const int DEFAULT_SIZE;
|
||||
|
||||
Node** elements;
|
||||
|
||||
int initialSize;
|
||||
int bufferSize;
|
||||
|
||||
/**
|
||||
* The next available location in the elements array
|
||||
**/
|
||||
int elementCount;
|
||||
|
||||
//-------------------/
|
||||
//- Private Methods -/
|
||||
//-------------------/
|
||||
|
||||
/**
|
||||
* Helper method for constructors
|
||||
**/
|
||||
void initialize(int size);
|
||||
|
||||
/**
|
||||
* increase the NodeSet capacity by a factor of its initial size
|
||||
**/
|
||||
void increaseSize();
|
||||
|
||||
/**
|
||||
* Shifts all elements at the specified index to down by 1
|
||||
**/
|
||||
void shiftDown(int index);
|
||||
|
||||
/**
|
||||
* Shifts all elements at the specified index up by 1
|
||||
**/
|
||||
void shiftUp(int index);
|
||||
|
||||
}; //-- NodeSet
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user