Removing obsolete code. r=sicking.
git-svn-id: svn://10.0.0.236/trunk@138944 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5a37647ff6
commit
4869edd950
@ -56,7 +56,6 @@ CPPSRCS = XSLTProcessorModule.cpp
|
||||
LOBJS = ../source/base/Double.$(OBJ_SUFFIX) \
|
||||
../source/base/List.$(OBJ_SUFFIX) \
|
||||
../source/base/Map.$(OBJ_SUFFIX) \
|
||||
../source/base/NamedMap.$(OBJ_SUFFIX) \
|
||||
../source/base/SimpleErrorObserver.$(OBJ_SUFFIX) \
|
||||
../source/base/txAtoms.$(OBJ_SUFFIX) \
|
||||
../source/base/txExpandedNameMap.$(OBJ_SUFFIX) \
|
||||
|
||||
@ -1062,13 +1062,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NamedMap.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>MozillaElement.cpp</PATH>
|
||||
@ -1610,11 +1603,6 @@
|
||||
<PATH>NodeSet.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NamedMap.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>ProcessorState.cpp</PATH>
|
||||
@ -2910,13 +2898,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NamedMap.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>MozillaElement.cpp</PATH>
|
||||
@ -3474,11 +3455,6 @@
|
||||
<PATH>NodeSet.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NamedMap.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>ProcessorState.cpp</PATH>
|
||||
@ -3889,12 +3865,6 @@
|
||||
<PATH>Map.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiixDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NamedMap.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>transformiixDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
||||
@ -45,7 +45,6 @@ endif
|
||||
CPPSRCS = Double.cpp \
|
||||
List.cpp \
|
||||
Map.cpp \
|
||||
NamedMap.cpp \
|
||||
SimpleErrorObserver.cpp \
|
||||
txAtoms.cpp \
|
||||
txExpandedNameMap.cpp \
|
||||
|
||||
@ -163,6 +163,6 @@ private:
|
||||
**/
|
||||
void initialize(int size);
|
||||
|
||||
}; //-- NamedMap
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,286 +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.
|
||||
*
|
||||
* Bob Miller, Oblix Inc., kbob@oblix.com
|
||||
* -- fixed memory leak in NamedMap::hashKey method by deleting
|
||||
* up char[] chars;
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Named Map for TxObjects
|
||||
**/
|
||||
|
||||
#include "NamedMap.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
//-------------/
|
||||
//- Constants -/
|
||||
//-------------/
|
||||
|
||||
const int NamedMap::DEFAULT_SIZE = 17;
|
||||
|
||||
//----------------/
|
||||
//- Constructors -/
|
||||
//----------------/
|
||||
|
||||
/**
|
||||
* Creates a new NamedMap with the default Size
|
||||
**/
|
||||
NamedMap::NamedMap() {
|
||||
initialize(DEFAULT_SIZE);
|
||||
} //-- NamedMap
|
||||
|
||||
/**
|
||||
* Creates a new NamedMap with the specified number of buckets
|
||||
**/
|
||||
NamedMap::NamedMap(int size) {
|
||||
initialize(size);
|
||||
} //-- NamedMap
|
||||
|
||||
/**
|
||||
* Helper method for Constructors
|
||||
**/
|
||||
void NamedMap::initialize(PRInt32 size) {
|
||||
|
||||
//-- by default the NamedMap will not delete it's
|
||||
//-- object references
|
||||
doObjectDeletion = MB_FALSE;
|
||||
|
||||
//-- create a new array of bucket pointers
|
||||
elements = new BucketItem*[size];
|
||||
|
||||
//-- initialize all elements to 0;
|
||||
for ( PRInt32 i = 0; i < size; i++ ) elements[i] = 0;
|
||||
|
||||
numberOfBuckets = size;
|
||||
numberOfElements = 0;
|
||||
} //-- initialize
|
||||
|
||||
/**
|
||||
* Destructor for NamedMap
|
||||
**/
|
||||
NamedMap::~NamedMap() {
|
||||
clear();
|
||||
delete [] elements;
|
||||
} //-- ~NamedMap
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Removes all elements from the NamedMap. If the object deletion flag
|
||||
* has been set to true (by a call to setObjectDeletion) objects
|
||||
* will also be deleted as they are removed from the map
|
||||
**/
|
||||
void NamedMap::clear() {
|
||||
clear(doObjectDeletion);
|
||||
} //-- clear
|
||||
|
||||
/**
|
||||
* Removes all elements from the NamedMap
|
||||
**/
|
||||
void NamedMap::clear(MBool deleteObjects) {
|
||||
|
||||
for (int i = 0; i < numberOfBuckets; i++) {
|
||||
|
||||
BucketItem* bktItem = elements[i];
|
||||
while (bktItem) {
|
||||
BucketItem* tItem = bktItem;
|
||||
bktItem = bktItem->next;
|
||||
//-- repoint item to 0 to prevent deletion
|
||||
if ( ! deleteObjects ) tItem->item = 0;
|
||||
else {
|
||||
delete tItem->item;
|
||||
}
|
||||
//--delete tItem;
|
||||
delete tItem;
|
||||
}
|
||||
}
|
||||
numberOfElements = 0;
|
||||
} //-- clear
|
||||
|
||||
void NamedMap::dumpMap() {
|
||||
#if 0
|
||||
// XXX DEBUG OUTPUT
|
||||
cout << "#NamedMap -------- { "<<endl;
|
||||
|
||||
for (int i = 0; i < numberOfBuckets; i++) {
|
||||
|
||||
cout << "[";
|
||||
if (i < 10 ) cout << '0';
|
||||
cout << i << "]->{";
|
||||
|
||||
BucketItem* item = elements[i];
|
||||
MBool hasPrevItem = MB_FALSE;
|
||||
while (item) {
|
||||
if (hasPrevItem) cout << ", ";
|
||||
cout << item->key;
|
||||
hasPrevItem = MB_TRUE;
|
||||
item = item->next;
|
||||
}
|
||||
cout << "}"<<endl;
|
||||
}
|
||||
cout <<"} #NamedMap"<<endl;
|
||||
#endif
|
||||
} //-- dumpMap
|
||||
|
||||
/**
|
||||
* Returns the object reference in this Map associated with the given name
|
||||
* @return the object reference in this Map associated with the given name
|
||||
**/
|
||||
TxObject* NamedMap::get(const nsAString& key) {
|
||||
BucketItem* item = getBucketItem(key);
|
||||
if ( item ) return item->item;
|
||||
return 0;
|
||||
} //-- get
|
||||
|
||||
/**
|
||||
* Returns true if there are no objects in this map.
|
||||
* @return true if there are no objects in this map.
|
||||
**/
|
||||
MBool NamedMap::isEmpty() {
|
||||
return (numberOfElements == 0) ? MB_TRUE : MB_FALSE;
|
||||
} //-- isEmpty
|
||||
|
||||
|
||||
/**
|
||||
* Adds the specified Node to the top of this Stack.
|
||||
* @param node the Node to add to the top of the Stack
|
||||
**/
|
||||
void NamedMap::put(const nsAString& key, TxObject* obj) {
|
||||
int idx = HashString(key) % numberOfBuckets;
|
||||
|
||||
//-- fetch first item in bucket
|
||||
BucketItem* bktItem = elements[idx];
|
||||
|
||||
//-- if bktItem is 0 then there are no items is this Bucket,
|
||||
//-- add to front of list
|
||||
if ( !bktItem ) {
|
||||
elements[idx] = createBucketItem(key, obj);
|
||||
++numberOfElements;
|
||||
}
|
||||
//-- find current item, or add to end of list
|
||||
else {
|
||||
BucketItem* prevItem = bktItem;
|
||||
//-- advance to next spot
|
||||
while ( bktItem ) {
|
||||
//-- if current key equals desired key, break
|
||||
if ( bktItem->key.Equals(key) ) {
|
||||
break;
|
||||
}
|
||||
prevItem = bktItem;
|
||||
bktItem = bktItem->next;
|
||||
}
|
||||
//-- if we did not find a bucket Item create a new one
|
||||
if ( !bktItem) {
|
||||
bktItem = createBucketItem(key, obj);
|
||||
prevItem->next = bktItem;
|
||||
bktItem->prev = prevItem;
|
||||
++numberOfElements;
|
||||
}
|
||||
//-- we found bucket item, just set value
|
||||
else {
|
||||
if (doObjectDeletion)
|
||||
delete bktItem->item;
|
||||
bktItem->item = obj;
|
||||
}
|
||||
}
|
||||
} //-- put
|
||||
|
||||
/**
|
||||
* Removes the the specified Object from the NamedMap
|
||||
* @param key the key of the Object to remove from the NamedMap
|
||||
* @return the Object being removed
|
||||
**/
|
||||
TxObject* NamedMap::remove(const nsAString& key) {
|
||||
int idx = HashString(key) % numberOfBuckets;
|
||||
|
||||
BucketItem* bktItem = elements[idx];
|
||||
|
||||
while ( bktItem && !(key.Equals(bktItem->key))) {
|
||||
bktItem = bktItem->next;
|
||||
}
|
||||
|
||||
if ( bktItem ) {
|
||||
if (bktItem == elements[idx]) elements[idx] = bktItem->next;
|
||||
else {
|
||||
bktItem->prev->next = bktItem->next;
|
||||
if (bktItem->next)
|
||||
bktItem->next->prev = bktItem->prev;
|
||||
};
|
||||
numberOfElements--;
|
||||
TxObject* txObject = bktItem->item;
|
||||
bktItem->item = 0;
|
||||
delete bktItem;
|
||||
return txObject;
|
||||
}
|
||||
return 0;
|
||||
|
||||
} //-- remove
|
||||
|
||||
/**
|
||||
* Sets the object deletion flag. If set to true, objects in
|
||||
* the NamedMap will be deleted upon calling the clear() method, or
|
||||
* upon destruction. By default this is false.
|
||||
**/
|
||||
void NamedMap::setObjectDeletion(MBool deleteObjects) {
|
||||
doObjectDeletion = deleteObjects;
|
||||
} //-- setObjectDeletion
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the NodeStack
|
||||
* @return the number of elements in the NodeStack
|
||||
**/
|
||||
int NamedMap::size() {
|
||||
return numberOfElements;
|
||||
} //-- size
|
||||
|
||||
//-------------------/
|
||||
//- Private Methods -/
|
||||
//-------------------/
|
||||
|
||||
NamedMap::BucketItem* NamedMap::createBucketItem(const nsAString& key, TxObject* objPtr)
|
||||
{
|
||||
BucketItem* bktItem = new BucketItem;
|
||||
if (bktItem) {
|
||||
bktItem->next = 0;
|
||||
bktItem->prev = 0;
|
||||
bktItem->key = key;
|
||||
bktItem->item = objPtr;
|
||||
}
|
||||
return bktItem;
|
||||
} //-- createBucketItem
|
||||
|
||||
NamedMap::BucketItem* NamedMap::getBucketItem(const nsAString& key) {
|
||||
int idx = HashString(key) % numberOfBuckets;
|
||||
|
||||
BucketItem* bktItem = elements[idx];
|
||||
|
||||
while ( bktItem ) {
|
||||
if ( bktItem->key.Equals(key) ) return bktItem;
|
||||
bktItem = bktItem->next;
|
||||
}
|
||||
|
||||
return bktItem;
|
||||
|
||||
} //-- getBucketItem
|
||||
@ -1,150 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Named Map for TxObjects
|
||||
**/
|
||||
|
||||
#ifndef TRANSFRMX_NAMEDMAP_H
|
||||
#define TRANSFRMX_NAMEDMAP_H
|
||||
|
||||
#include "baseutils.h"
|
||||
#include "TxObject.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class NamedMap : public TxObject {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//----------------/
|
||||
//- Constructors -/
|
||||
//----------------/
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the default Size
|
||||
**/
|
||||
NamedMap();
|
||||
|
||||
/**
|
||||
* Creates a new NodeStack with the specified number of buckets
|
||||
**/
|
||||
NamedMap(int size);
|
||||
|
||||
/**
|
||||
* Destructor for a NamedMap table, will not delete references unless
|
||||
* The setObjectDeletion flag has been set to MB_TRUE
|
||||
**/
|
||||
virtual ~NamedMap();
|
||||
|
||||
/**
|
||||
* Returns the object reference in this Map associated with the given name
|
||||
* @return the object reference in this Map associated with the given name
|
||||
**/
|
||||
TxObject* get(const nsAString& name);
|
||||
|
||||
/**
|
||||
* Adds the Object reference to the map and associates it with the given name
|
||||
**/
|
||||
void put(const nsAString& name, TxObject* obj);
|
||||
|
||||
/**
|
||||
* Removes all elements from the Map table
|
||||
**/
|
||||
void clear();
|
||||
|
||||
void clear(MBool doObjectDeletion);
|
||||
|
||||
/**
|
||||
* 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
|
||||
**/
|
||||
TxObject* remove(const nsAString& key);
|
||||
|
||||
/**
|
||||
* Sets the object deletion flag. If set to true, objects in
|
||||
* the NamedMap will be deleted upon calling the clear() method, or
|
||||
* upon destruction. By default this is false.
|
||||
**/
|
||||
void setObjectDeletion(MBool deleteObjects);
|
||||
|
||||
/**
|
||||
* Returns the number of key-element pairs in the NamedMap
|
||||
* @return the number of key-element in the NamedMap
|
||||
**/
|
||||
int size();
|
||||
|
||||
void dumpMap();
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------/
|
||||
//- Private Members -/
|
||||
//-------------------/
|
||||
|
||||
|
||||
private:
|
||||
|
||||
struct BucketItem {
|
||||
nsString key;
|
||||
TxObject* item;
|
||||
BucketItem* next;
|
||||
BucketItem* prev;
|
||||
};
|
||||
|
||||
static const int DEFAULT_SIZE;
|
||||
|
||||
// map table
|
||||
BucketItem** elements;
|
||||
|
||||
PRInt32 numberOfBuckets;
|
||||
PRInt32 numberOfElements;
|
||||
MBool doObjectDeletion;
|
||||
|
||||
//-------------------/
|
||||
//- Private Methods -/
|
||||
//-------------------/
|
||||
|
||||
BucketItem* createBucketItem(const nsAString& key, TxObject* objPtr);
|
||||
|
||||
BucketItem* getBucketItem(const nsAString& key);
|
||||
|
||||
/**
|
||||
* Helper method for constructors
|
||||
**/
|
||||
void initialize(int size);
|
||||
|
||||
}; //-- NamedMap
|
||||
|
||||
#endif
|
||||
|
||||
@ -37,7 +37,6 @@ REQUIRES = string \
|
||||
OBJS = ../base/Double.$(OBJ_SUFFIX) \
|
||||
../base/List.$(OBJ_SUFFIX) \
|
||||
../base/Map.$(OBJ_SUFFIX) \
|
||||
../base/NamedMap.$(OBJ_SUFFIX) \
|
||||
../base/SimpleErrorObserver.$(OBJ_SUFFIX) \
|
||||
../base/txAtoms.$(OBJ_SUFFIX) \
|
||||
../base/txExpandedNameMap.$(OBJ_SUFFIX) \
|
||||
|
||||
@ -149,7 +149,7 @@ ProcessorState::ProcessorState(Node* aSourceNode, Document* aXslDocument)
|
||||
}
|
||||
mLoadedDocuments.init(sourceDoc, aXslDocument);
|
||||
|
||||
/* turn object deletion on for some of the Maps (NamedMap) */
|
||||
/* turn object deletion on for some of the Maps */
|
||||
mExprHashes[SelectAttr].setOwnership(Map::eOwnsItems);
|
||||
mExprHashes[TestAttr].setOwnership(Map::eOwnsItems);
|
||||
mExprHashes[ValueAttr].setOwnership(Map::eOwnsItems);
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "ProcessorState.h"
|
||||
#include "NamedMap.h"
|
||||
#include "txAtoms.h"
|
||||
#include "txSingleNodeContext.h"
|
||||
#include "XMLDOMUtils.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user