You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/05/15 21:07:48 UTC
cvs commit: xml-xerces/c/src/xercesc/util RefStackOf.hpp RefVectorOf.c RefVectorOf.hpp StringPool.cpp StringPool.hpp TransENameMap.c TransENameMap.hpp TransService.cpp TransService.hpp ValueArrayOf.c ValueArrayOf.hpp ValueHashTableOf.c ValueHashTableOf.hpp ValueStackOf.hpp ValueVectorOf.c ValueVectorOf.hpp XMLAbstractDoubleFloat.cpp XMLAbstractDoubleFloat.hpp XMLBigDecimal.cpp XMLBigDecimal.hpp XMLBigInteger.cpp XMLBigInteger.hpp XMLDateTime.cpp XMLDateTime.hpp XMLException.cpp XMLException.hpp XMLInteger.hpp XMLMsgLoader.cpp XMLMsgLoader.hpp XMLNetAccessor.hpp XMLNumber.hpp XMLString.cpp XMLString.hpp XMLURL.cpp XMLURL.hpp XMLUri.cpp XMLUri.hpp
knoaman 2003/05/15 12:07:48
Modified: c/src/xercesc/util RefStackOf.hpp RefVectorOf.c
RefVectorOf.hpp StringPool.cpp StringPool.hpp
TransENameMap.c TransENameMap.hpp TransService.cpp
TransService.hpp ValueArrayOf.c ValueArrayOf.hpp
ValueHashTableOf.c ValueHashTableOf.hpp
ValueStackOf.hpp ValueVectorOf.c ValueVectorOf.hpp
XMLAbstractDoubleFloat.cpp
XMLAbstractDoubleFloat.hpp XMLBigDecimal.cpp
XMLBigDecimal.hpp XMLBigInteger.cpp
XMLBigInteger.hpp XMLDateTime.cpp XMLDateTime.hpp
XMLException.cpp XMLException.hpp XMLInteger.hpp
XMLMsgLoader.cpp XMLMsgLoader.hpp
XMLNetAccessor.hpp XMLNumber.hpp XMLString.cpp
XMLString.hpp XMLURL.cpp XMLURL.hpp XMLUri.cpp
XMLUri.hpp
Log:
Partial implementation of the configurable memory manager.
Revision Changes Path
1.4 +6 -7 xml-xerces/c/src/xercesc/util/RefStackOf.hpp
Index: RefStackOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefStackOf.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RefStackOf.hpp 4 Nov 2002 15:22:04 -0000 1.3
+++ RefStackOf.hpp 15 May 2003 19:07:45 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2002/11/04 15:22:04 tng
* C++ Namespace Support.
*
@@ -87,12 +90,8 @@
#if !defined(REFSTACKOF_HPP)
#define REFSTACKOF_HPP
-
-#include <xercesc/util/XercesDefs.hpp>
-#include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
-#include <xercesc/util/EmptyStackException.hpp>
#include <xercesc/util/RefVectorOf.hpp>
-#include <xercesc/util/XMLEnumerator.hpp>
+#include <xercesc/util/EmptyStackException.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -103,7 +102,7 @@
template <class TElem> class RefStackEnumerator;
-template <class TElem> class RefStackOf
+template <class TElem> class RefStackOf : public XMemory
{
public :
// -----------------------------------------------------------------------
1.8 +5 -1 xml-xerces/c/src/xercesc/util/RefVectorOf.c
Index: RefVectorOf.c
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefVectorOf.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RefVectorOf.c 6 Feb 2003 16:11:30 -0000 1.7
+++ RefVectorOf.c 15 May 2003 19:07:45 -0000 1.8
@@ -56,6 +56,9 @@
/**
* $Log$
+ * Revision 1.8 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.7 2003/02/06 16:11:30 peiyongz
* Bug#16826: RefVectorOf.c has errors in strict ANSI mode, patch from
* David Bertoni (David_N_Bertoni@lotus.com )
@@ -126,7 +129,7 @@
for (unsigned int index = 0; index < this->fCurCount; index++)
delete this->fElemList[index];
}
- delete [] this->fElemList;
+ fMemoryManager->deallocate(this->fElemList);//delete [] this->fElemList;
}
1.7 +5 -3 xml-xerces/c/src/xercesc/util/RefVectorOf.hpp
Index: RefVectorOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefVectorOf.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RefVectorOf.hpp 17 Dec 2002 17:17:58 -0000 1.6
+++ RefVectorOf.hpp 15 May 2003 19:07:45 -0000 1.7
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.7 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.6 2002/12/17 17:17:58 gareth
* added abstract base class BaseRefVectorOf from which both RefVectorOf and RefArrayVectorOf inherit
* the new RefArrayVectorOf has proper destructor for array deletion
@@ -101,8 +104,6 @@
#if !defined(REFVECTOROF_HPP)
#define REFVECTOROF_HPP
-#include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
-#include <xercesc/util/XMLEnumerator.hpp>
#include <xercesc/util/BaseRefVectorOf.hpp>
XERCES_CPP_NAMESPACE_BEGIN
1.3 +26 -18 xml-xerces/c/src/xercesc/util/StringPool.cpp
Index: StringPool.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/StringPool.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StringPool.cpp 4 Nov 2002 15:22:04 -0000 1.2
+++ StringPool.cpp 15 May 2003 19:07:45 -0000 1.3
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.3 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.2 2002/11/04 15:22:04 tng
* C++ Namespace Support.
*
@@ -91,28 +94,26 @@
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
-#include <xercesc/util/IllegalArgumentException.hpp>
#include <xercesc/util/StringPool.hpp>
-#include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <string.h>
+
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// StringPool::PoolElem: Constructors and Destructor
// ---------------------------------------------------------------------------
-XMLStringPool::PoolElem::PoolElem( const XMLCh* const string
- , const unsigned int id) :
+XMLStringPool::PoolElem::PoolElem( const XMLCh* const string
+ , const unsigned int id) :
fId(id)
, fString(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fString = XMLString::replicate(string);
+ fString = XMLString::replicate(string, fMemoryManager);
}
XMLStringPool::PoolElem::~PoolElem()
{
- delete [] fString;
+ fMemoryManager->deallocate(fString); //delete [] fString;
}
// ---------------------------------------------------------------------------
@@ -123,8 +124,8 @@
XMLStringPool::PoolElem::reset(const XMLCh* const string, const unsigned int id)
{
fId = id;
- delete [] fString;
- fString = XMLString::replicate(string);
+ fMemoryManager->deallocate(fString);//delete [] fString;
+ fString = XMLString::replicate(string, fMemoryManager);
}
@@ -134,23 +135,27 @@
// ---------------------------------------------------------------------------
XMLStringPool::XMLStringPool(const unsigned int modulus) :
- fIdMap(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fIdMap(0)
, fHashTable(0)
, fMapCapacity(64)
, fCurId(1)
{
// Create the hash table, passing it the modulus
- fHashTable = new RefHashTableOf<PoolElem>(modulus);
+ fHashTable = new (fMemoryManager) RefHashTableOf<PoolElem>(modulus);
// Do an initial allocation of the id map and zero it all out
- fIdMap = new PoolElem*[fMapCapacity];
+ fIdMap = (PoolElem**) fMemoryManager->allocate
+ (
+ fMapCapacity * sizeof(PoolElem*)
+ ); //new PoolElem*[fMapCapacity];
memset(fIdMap, 0, sizeof(PoolElem*) * fMapCapacity);
}
XMLStringPool::~XMLStringPool()
{
delete fHashTable;
- delete [] fIdMap;
+ fMemoryManager->deallocate(fIdMap); //delete [] fIdMap;
}
@@ -218,7 +223,10 @@
{
// Calculate the new capacity, create a temp new map, and zero it
const unsigned int newCap = (unsigned int)(fMapCapacity * 1.5);
- PoolElem** newMap = new PoolElem*[newCap];
+ PoolElem** newMap = (PoolElem**) fMemoryManager->allocate
+ (
+ newCap * sizeof(PoolElem*)
+ ); //new PoolElem*[newCap];
memset(newMap, 0, sizeof(PoolElem*) * newCap);
//
@@ -228,7 +236,7 @@
memcpy(newMap, fIdMap, sizeof(PoolElem*) * fMapCapacity);
// Clean up the old map and store the new info
- delete [] fIdMap;
+ fMemoryManager->deallocate(fIdMap); //delete [] fIdMap;
fIdMap = newMap;
fMapCapacity = newCap;
}
@@ -238,7 +246,7 @@
// this new element in the id map at the current id index, then bump the
// id index.
//
- PoolElem* newElem = new PoolElem(newString, fCurId);
+ PoolElem* newElem = new (fMemoryManager) PoolElem(newString, fCurId);
fHashTable->put((void*)(newElem->getKey()), newElem);
fIdMap[fCurId] = newElem;
1.4 +8 -4 xml-xerces/c/src/xercesc/util/StringPool.hpp
Index: StringPool.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/StringPool.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StringPool.hpp 7 Mar 2003 18:11:54 -0000 1.3
+++ StringPool.hpp 15 May 2003 19:07:45 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2003/03/07 18:11:54 tng
* Return a reference instead of void for operator=
*
@@ -105,7 +108,7 @@
// other than flushing it completely, and because ids are assigned
// sequentially from 1.
//
-class XMLUTIL_EXPORT XMLStringPool
+class XMLUTIL_EXPORT XMLStringPool : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -133,7 +136,7 @@
// -----------------------------------------------------------------------
// Private data types
// -----------------------------------------------------------------------
- class PoolElem
+ class PoolElem : public XMemory
{
public :
PoolElem(const XMLCh* const string, const unsigned int id);
@@ -144,7 +147,7 @@
unsigned int fId;
XMLCh* fString;
-
+ MemoryManager* fMemoryManager;
};
@@ -181,6 +184,7 @@
// This is the counter used to assign unique ids. It is just bumped
// up one for each new string added.
// -----------------------------------------------------------------------
+ MemoryManager* fMemoryManager;
PoolElem** fIdMap;
RefHashTableOf<PoolElem>* fHashTable;
unsigned int fMapCapacity;
1.3 +6 -4 xml-xerces/c/src/xercesc/util/TransENameMap.c
Index: TransENameMap.c
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/TransENameMap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TransENameMap.c 4 Nov 2002 15:22:04 -0000 1.2
+++ TransENameMap.c 15 May 2003 19:07:45 -0000 1.3
@@ -83,9 +83,10 @@
// ENameMapFor: Implementation of virtual factory method
// ---------------------------------------------------------------------------
template <class TType> XMLTranscoder*
-ENameMapFor<TType>::makeNew(const unsigned int blockSize) const
+ENameMapFor<TType>::makeNew(const unsigned int blockSize,
+ MemoryManager* const manager) const
{
- return new TType(getKey(), blockSize);
+ return new (manager) TType(getKey(), blockSize);
}
@@ -110,9 +111,10 @@
// ENameMapFor: Implementation of virtual factory method
// ---------------------------------------------------------------------------
template <class TType> XMLTranscoder*
-EEndianNameMapFor<TType>::makeNew(const unsigned int blockSize) const
+EEndianNameMapFor<TType>::makeNew(const unsigned int blockSize,
+ MemoryManager* const manager) const
{
- return new TType(getKey(), blockSize, fSwapped);
+ return new (manager) TType(getKey(), blockSize, fSwapped);
}
XERCES_CPP_NAMESPACE_END
1.6 +7 -4 xml-xerces/c/src/xercesc/util/TransENameMap.hpp
Index: TransENameMap.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/TransENameMap.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TransENameMap.hpp 10 Mar 2003 13:57:56 -0000 1.5
+++ TransENameMap.hpp 15 May 2003 19:07:45 -0000 1.6
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@
// compilers are too dumb to allow us to hide this class there in the Cpp
// file that uses it.
//
-class ENameMap
+class ENameMap : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -87,6 +87,7 @@
virtual XMLTranscoder* makeNew
(
const unsigned int blockSize
+ , MemoryManager* const manager
) const = 0;
@@ -143,7 +144,8 @@
// -----------------------------------------------------------------------
// Implementation of virtual factory method
// -----------------------------------------------------------------------
- virtual XMLTranscoder* makeNew(const unsigned int blockSize) const;
+ virtual XMLTranscoder* makeNew(const unsigned int blockSize,
+ MemoryManager* const manager) const;
private :
@@ -169,7 +171,8 @@
// -----------------------------------------------------------------------
// Implementation of virtual factory method
// -----------------------------------------------------------------------
- virtual XMLTranscoder* makeNew(const unsigned int blockSize) const;
+ virtual XMLTranscoder* makeNew(const unsigned int blockSize,
+ MemoryManager* const manager) const;
private :
1.12 +19 -14 xml-xerces/c/src/xercesc/util/TransService.cpp
Index: TransService.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/TransService.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TransService.cpp 24 Jan 2003 22:05:35 -0000 1.11
+++ TransService.cpp 15 May 2003 19:07:45 -0000 1.12
@@ -169,18 +169,20 @@
XMLTranscoder*
XMLTransService::makeNewTranscoderFor( const char* const encodingName
, XMLTransService::Codes& resValue
- , const unsigned int blockSize)
+ , const unsigned int blockSize
+ , MemoryManager* const manager)
{
- XMLCh* tmpName = XMLString::transcode(encodingName);
- ArrayJanitor<XMLCh> janName(tmpName);
+ XMLCh* tmpName = XMLString::transcode(encodingName, manager);
+ ArrayJanitor<XMLCh> janName(tmpName, manager);
- return makeNewTranscoderFor(tmpName, resValue, blockSize);
+ return makeNewTranscoderFor(tmpName, resValue, blockSize, manager);
}
XMLTranscoder*
XMLTransService::makeNewTranscoderFor( const XMLCh* const encodingName
, XMLTransService::Codes& resValue
- , const unsigned int blockSize)
+ , const unsigned int blockSize
+ , MemoryManager* const manager)
{
//
// If strict IANA encoding flag is set, validate encoding name
@@ -213,7 +215,7 @@
// If we found it, then call the factory method for it
if (ourMapping)
{
- XMLTranscoder* temp = ourMapping->makeNew(blockSize);
+ XMLTranscoder* temp = ourMapping->makeNew(blockSize, manager);
resValue = temp ? XMLTransService::Ok : XMLTransService::InternalFailure;
return temp;
}
@@ -223,7 +225,7 @@
// to the trans service to see if he can make anything of it.
//
- XMLTranscoder* temp = makeNewXMLTranscoder(encodingName, resValue, blockSize);
+ XMLTranscoder* temp = makeNewXMLTranscoder(encodingName, resValue, blockSize, manager);
// if successful, set resValue to OK
// if failed, the makeNewXMLTranscoder has already set the proper failing resValue
@@ -237,7 +239,8 @@
XMLTranscoder*
XMLTransService::makeNewTranscoderFor( XMLRecognizer::Encodings encodingEnum
, XMLTransService::Codes& resValue
- , const unsigned int blockSize)
+ , const unsigned int blockSize
+ , MemoryManager* const manager)
{
//
// We can only make transcoder if the passed encodingEnum is under this range
@@ -251,12 +254,12 @@
// If we found it, then call the factory method for it
if (ourMapping) {
- XMLTranscoder* temp = ourMapping->makeNew(blockSize);
+ XMLTranscoder* temp = ourMapping->makeNew(blockSize, manager);
resValue = temp ? XMLTransService::Ok : XMLTransService::InternalFailure;
return temp;
}
else {
- XMLTranscoder* temp = makeNewXMLTranscoder(XMLRecognizer::nameForEncoding(encodingEnum), resValue, blockSize);
+ XMLTranscoder* temp = makeNewXMLTranscoder(XMLRecognizer::nameForEncoding(encodingEnum), resValue, blockSize, manager);
// if successful, set resValue to OK
// if failed, the makeNewXMLTranscoder has already set the proper failing resValue
@@ -532,7 +535,7 @@
// ---------------------------------------------------------------------------
XMLTranscoder::~XMLTranscoder()
{
- delete [] fEncodingName;
+ fMemoryManager->deallocate(fEncodingName);//delete [] fEncodingName;
}
@@ -540,11 +543,13 @@
// XMLTranscoder: Hidden Constructors
// ---------------------------------------------------------------------------
XMLTranscoder::XMLTranscoder(const XMLCh* const encodingName
- , const unsigned int blockSize) :
+ , const unsigned int blockSize
+ , MemoryManager* const manager) :
fEncodingName(0)
, fBlockSize(blockSize)
+ , fMemoryManager(manager)
{
- fEncodingName = XMLString::replicate(encodingName);
+ fEncodingName = XMLString::replicate(encodingName, fMemoryManager);
}
1.8 +41 -5 xml-xerces/c/src/xercesc/util/TransService.hpp
Index: TransService.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/TransService.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TransService.hpp 7 Mar 2003 18:11:55 -0000 1.7
+++ TransService.hpp 15 May 2003 19:07:45 -0000 1.8
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/05/15 19:07:45 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.7 2003/03/07 18:11:55 tng
* Return a reference instead of void for operator=
*
@@ -139,13 +142,14 @@
#ifndef TRANSSERVICE_HPP
#define TRANSSERVICE_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/framework/XMLRecognizer.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// Forward references
-class XMLPlatformUtils;
+//class XMLPlatformUtils;
class XMLLCPTranscoder;
class XMLTranscoder;
class ENameMap;
@@ -162,7 +166,7 @@
// of transcoder objects. There are two types of transcoders, which are
// discussed below in the XMLTranscoder class' description.
//
-class XMLUTIL_EXPORT XMLTransService
+class XMLUTIL_EXPORT XMLTransService : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -197,6 +201,7 @@
const XMLCh* const encodingName
, XMLTransService::Codes& resValue
, const unsigned int blockSize
+ , MemoryManager* const manager
);
XMLTranscoder* makeNewTranscoderFor
@@ -204,6 +209,7 @@
const char* const encodingName
, XMLTransService::Codes& resValue
, const unsigned int blockSize
+ , MemoryManager* const manager
);
XMLTranscoder* makeNewTranscoderFor
@@ -211,6 +217,7 @@
XMLRecognizer::Encodings encodingEnum
, XMLTransService::Codes& resValue
, const unsigned int blockSize
+ , MemoryManager* const manager
);
@@ -268,6 +275,7 @@
const XMLCh* const encodingName
, XMLTransService::Codes& resValue
, const unsigned int blockSize
+ , MemoryManager* const manager
) = 0;
@@ -310,7 +318,7 @@
* format (which comes out of the parser) back out to a format that
* the receiving client code wants to use.
*/
-class XMLUTIL_EXPORT XMLTranscoder
+class XMLUTIL_EXPORT XMLTranscoder : public XMemory
{
public :
@@ -424,6 +432,20 @@
const XMLCh* getEncodingName() const;
//@}
+ /** @name Getter methods*/
+ //@{
+
+ /** Get the plugged-in memory manager
+ *
+ * This method returns the plugged-in memory manager user for dynamic
+ * memory allocation/deallocation.
+ *
+ * @return the plugged-in memory manager
+ */
+ MemoryManager* getMemoryManager() const;
+
+ //@}
+
protected :
// -----------------------------------------------------------------------
// Hidden constructors
@@ -432,6 +454,7 @@
(
const XMLCh* const encodingName
, const unsigned int blockSize
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
@@ -461,6 +484,7 @@
// -----------------------------------------------------------------------
unsigned int fBlockSize;
XMLCh* fEncodingName;
+ MemoryManager* fMemoryManager;
};
@@ -470,7 +494,7 @@
// for the very common job of translating data from the client app's
// native code page to the internal format and vice versa.
//
-class XMLUTIL_EXPORT XMLLCPTranscoder
+class XMLUTIL_EXPORT XMLLCPTranscoder : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -494,8 +518,12 @@
virtual unsigned int calcRequiredSize(const XMLCh* const srcText) = 0;
virtual char* transcode(const XMLCh* const toTranscode) = 0;
+ virtual char* transcode(const XMLCh* const toTranscode,
+ MemoryManager* const manager) = 0;
virtual XMLCh* transcode(const char* const toTranscode) = 0;
+ virtual XMLCh* transcode(const char* const toTranscode,
+ MemoryManager* const manager) = 0;
virtual bool transcode
(
@@ -527,6 +555,14 @@
XMLLCPTranscoder& operator=(const XMLLCPTranscoder&);
};
+
+// ---------------------------------------------------------------------------
+// XMLTranscoder: Getter methods
+// ---------------------------------------------------------------------------
+inline MemoryManager* XMLTranscoder::getMemoryManager() const
+{
+ return fMemoryManager;
+}
// ---------------------------------------------------------------------------
// XMLTranscoder: Protected helper methods
1.3 +22 -12 xml-xerces/c/src/xercesc/util/ValueArrayOf.c
Index: ValueArrayOf.c
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueArrayOf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ValueArrayOf.c 4 Nov 2002 15:22:05 -0000 1.2
+++ ValueArrayOf.c 15 May 2003 19:07:46 -0000 1.3
@@ -56,6 +56,9 @@
/**
* $Log$
+ * Revision 1.3 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.2 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -97,35 +100,39 @@
fSize(size)
, fArray(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fArray = new TElem[fSize];
+ fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize];
}
-template <class TElem> ValueArrayOf<TElem>::
-ValueArrayOf(const TElem* values, const unsigned int size) :
+template <class TElem>
+ValueArrayOf<TElem>::ValueArrayOf( const TElem* values
+ , const unsigned int size) :
fSize(size)
, fArray(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fArray = new TElem[fSize];
+ fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize];
for (unsigned int index = 0; index < fSize; index++)
fArray[index] = values[index];
}
-template <class TElem> ValueArrayOf<TElem>::
-ValueArrayOf(const ValueArrayOf<TElem>& source) :
+template <class TElem>
+ValueArrayOf<TElem>::ValueArrayOf(const ValueArrayOf<TElem>& source) :
fSize(source.fSize)
, fArray(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fArray = new TElem[fSize];
+ fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize];
for (unsigned int index = 0; index < fSize; index++)
fArray[index] = source.fArray[index];
}
template <class TElem> ValueArrayOf<TElem>::~ValueArrayOf()
{
- delete [] fArray;
+ fMemoryManager->deallocate(fArray); //delete [] fArray;
}
@@ -157,9 +164,9 @@
// Reallocate if not the same size
if (toAssign.fSize != fSize)
{
- delete [] fArray;
+ fMemoryManager->deallocate(fArray); //delete [] fArray;
fSize = toAssign.fSize;
- fArray = new TElem[fSize];
+ fArray = (TElem*) fMemoryManager->allocate(fSize * sizeof(TElem)); //new TElem[fSize];
}
// Copy over the source elements
@@ -243,7 +250,10 @@
ThrowXML(IllegalArgumentException, XMLExcepts::Array_BadNewSize);
// Allocate the new array
- TElem* newArray = new TElem[newSize];
+ TElem* newArray = (TElem*) fMemoryManager->allocate
+ (
+ newSize * sizeof(TElem)
+ ); //new TElem[newSize];
// Copy the existing values
unsigned int index = 0;
@@ -254,7 +264,7 @@
newArray[index] = TElem(0);
// Delete the old array and udpate our members
- delete [] fArray;
+ fMemoryManager->deallocate(fArray); //delete [] fArray;
fArray = newArray;
fSize = newSize;
}
1.4 +7 -2 xml-xerces/c/src/xercesc/util/ValueArrayOf.hpp
Index: ValueArrayOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueArrayOf.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValueArrayOf.hpp 4 Nov 2002 15:22:05 -0000 1.3
+++ ValueArrayOf.hpp 15 May 2003 19:07:46 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -88,14 +91,15 @@
#if !defined(VALUEARRAY_HPP)
#define VALUEARRAY_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLEnumerator.hpp>
#include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
#include <xercesc/util/IllegalArgumentException.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/framework/MemoryManager.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-template <class TElem> class ValueArrayOf
+template <class TElem> class ValueArrayOf : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -142,6 +146,7 @@
// -----------------------------------------------------------------------
unsigned int fSize;
TElem* fArray;
+ MemoryManager* fMemoryManager;
};
1.5 +23 -8 xml-xerces/c/src/xercesc/util/ValueHashTableOf.c
Index: ValueHashTableOf.c
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueHashTableOf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ValueHashTableOf.c 4 Nov 2002 15:22:05 -0000 1.4
+++ ValueHashTableOf.c 15 May 2003 19:07:46 -0000 1.5
@@ -56,6 +56,9 @@
/**
* $Log$
+ * Revision 1.5 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.4 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -79,21 +82,30 @@
// ---------------------------------------------------------------------------
// ValueHashTableOf: Constructors and Destructor
// ---------------------------------------------------------------------------
-template <class TVal> ValueHashTableOf<TVal>::ValueHashTableOf(const unsigned int modulus, HashBase* hashBase)
- : fBucketList(0), fHashModulus(modulus)
+template <class TVal>
+ValueHashTableOf<TVal>::ValueHashTableOf( const unsigned int modulus
+ , HashBase* hashBase)
+ : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fHash(0)
{
initialize(modulus);
// set hasher
fHash = hashBase;
}
-template <class TVal> ValueHashTableOf<TVal>::ValueHashTableOf(const unsigned int modulus)
- : fBucketList(0), fHashModulus(modulus)
+template <class TVal>
+ValueHashTableOf<TVal>::ValueHashTableOf(const unsigned int modulus)
+ : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fHash(0)
{
initialize(modulus);
// create default hasher
- fHash = new HashXMLCh();
+ fHash = new (fMemoryManager) HashXMLCh();
}
template <class TVal> void ValueHashTableOf<TVal>::initialize(const unsigned int modulus)
@@ -102,7 +114,10 @@
ThrowXML(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus);
// Allocate the bucket list and zero them
- fBucketList = new ValueHashTableBucketElem<TVal>*[fHashModulus];
+ fBucketList = (ValueHashTableBucketElem<TVal>**) fMemoryManager->allocate
+ (
+ fHashModulus * sizeof(ValueHashTableBucketElem<TVal>*)
+ ); //new ValueHashTableBucketElem<TVal>*[fHashModulus];
for (unsigned int index = 0; index < fHashModulus; index++)
fBucketList[index] = 0;
}
@@ -112,7 +127,7 @@
removeAll();
// Then delete the bucket list & hasher
- delete [] fBucketList;
+ fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
delete fHash;
}
@@ -215,7 +230,7 @@
}
else
{
- newBucket = new ValueHashTableBucketElem<TVal>(key, valueToAdopt, fBucketList[hashVal]);
+ newBucket = new (fMemoryManager) ValueHashTableBucketElem<TVal>(key, valueToAdopt, fBucketList[hashVal]);
fBucketList[hashVal] = newBucket;
}
}
1.7 +7 -9 xml-xerces/c/src/xercesc/util/ValueHashTableOf.hpp
Index: ValueHashTableOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueHashTableOf.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ValueHashTableOf.hpp 4 Nov 2002 15:22:05 -0000 1.6
+++ ValueHashTableOf.hpp 15 May 2003 19:07:46 -0000 1.7
@@ -63,15 +63,12 @@
#define VALUEHASHTABLEOF_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/HashBase.hpp>
#include <xercesc/util/IllegalArgumentException.hpp>
#include <xercesc/util/NoSuchElementException.hpp>
#include <xercesc/util/RuntimeException.hpp>
-#include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/XMLEnumerator.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/HashBase.hpp>
#include <xercesc/util/HashXMLCh.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -88,7 +85,7 @@
// This should really be a nested class, but some of the compilers we
// have to support cannot deal with that!
//
-template <class TVal> struct ValueHashTableBucketElem
+template <class TVal> struct ValueHashTableBucketElem : public XMemory
{
ValueHashTableBucketElem(void* key, const TVal& value, ValueHashTableBucketElem<TVal>* next)
: fData(value), fNext(next), fKey(key)
@@ -101,7 +98,7 @@
};
-template <class TVal> class ValueHashTableOf
+template <class TVal> class ValueHashTableOf : public XMemory
{
public:
// -----------------------------------------------------------------------
@@ -169,9 +166,10 @@
// fHash
// The hasher for the key data type.
// -----------------------------------------------------------------------
+ MemoryManager* fMemoryManager;
ValueHashTableBucketElem<TVal>** fBucketList;
- unsigned int fHashModulus;
- HashBase* fHash;
+ unsigned int fHashModulus;
+ HashBase* fHash;
};
1.4 +5 -4 xml-xerces/c/src/xercesc/util/ValueStackOf.hpp
Index: ValueStackOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueStackOf.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValueStackOf.hpp 4 Nov 2002 15:22:05 -0000 1.3
+++ ValueStackOf.hpp 15 May 2003 19:07:46 -0000 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -87,8 +90,6 @@
#if !defined(VALUESTACKOF_HPP)
#define VALUESTACKOF_HPP
-#include <xercesc/util/XercesDefs.hpp>
-#include <xercesc/util/XMLEnumerator.hpp>
#include <xercesc/util/EmptyStackException.hpp>
#include <xercesc/util/ValueVectorOf.hpp>
@@ -101,7 +102,7 @@
template <class TElem> class ValueStackEnumerator;
-template <class TElem> class ValueStackOf
+template <class TElem> class ValueStackOf : public XMemory
{
public :
// -----------------------------------------------------------------------
1.3 +28 -11 xml-xerces/c/src/xercesc/util/ValueVectorOf.c
Index: ValueVectorOf.c
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueVectorOf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ValueVectorOf.c 4 Nov 2002 15:22:05 -0000 1.2
+++ ValueVectorOf.c 15 May 2003 19:07:46 -0000 1.3
@@ -56,6 +56,9 @@
/**
* $Log$
+ * Revision 1.3 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.2 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -97,31 +100,39 @@
// ---------------------------------------------------------------------------
// ValueVectorOf: Constructors and Destructor
// ---------------------------------------------------------------------------
-template <class TElem> ValueVectorOf<TElem>::
-ValueVectorOf(const unsigned int maxElems) :
+template <class TElem>
+ValueVectorOf<TElem>::ValueVectorOf(const unsigned int maxElems) :
fCurCount(0)
, fMaxCount(maxElems)
, fElemList(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fElemList = new TElem[fMaxCount];
+ fElemList = (TElem*) fMemoryManager->allocate
+ (
+ fMaxCount * sizeof(TElem)
+ ); //new TElem[fMaxCount];
}
-template <class TElem> ValueVectorOf<TElem>::
-ValueVectorOf(const ValueVectorOf<TElem>& toCopy) :
+template <class TElem>
+ValueVectorOf<TElem>::ValueVectorOf(const ValueVectorOf<TElem>& toCopy) :
fCurCount(toCopy.fCurCount)
, fMaxCount(toCopy.fMaxCount)
, fElemList(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fElemList = new TElem[fMaxCount];
+ fElemList = (TElem*) fMemoryManager->allocate
+ (
+ fMaxCount * sizeof(TElem)
+ ); //new TElem[fMaxCount];
for (unsigned int index = 0; index < fCurCount; index++)
fElemList[index] = toCopy.fElemList[index];
}
template <class TElem> ValueVectorOf<TElem>::~ValueVectorOf()
{
- delete [] fElemList;
+ fMemoryManager->deallocate(fElemList); //delete [] fElemList;
}
@@ -138,8 +149,11 @@
// Reallocate if required
if (fMaxCount < toAssign.fCurCount)
{
- delete [] fElemList;
- fElemList = new TElem[toAssign.fMaxCount];
+ fMemoryManager->deallocate(fElemList); //delete [] fElemList;
+ fElemList = (TElem*) fMemoryManager->allocate
+ (
+ toAssign.fMaxCount * sizeof(TElem)
+ ); //new TElem[toAssign.fMaxCount];
fMaxCount = toAssign.fMaxCount;
}
@@ -276,11 +290,14 @@
if (newMax < minNewMax)
newMax = minNewMax;
- TElem* newList = new TElem[newMax];
+ TElem* newList = (TElem*) fMemoryManager->allocate
+ (
+ newMax * sizeof(TElem)
+ ); //new TElem[newMax];
for (unsigned int index = 0; index < fCurCount; index++)
newList[index] = fElemList[index];
- delete [] fElemList;
+ fMemoryManager->deallocate(fElemList); //delete [] fElemList;
fElemList = newList;
fMaxCount = newMax;
}
1.4 +7 -2 xml-xerces/c/src/xercesc/util/ValueVectorOf.hpp
Index: ValueVectorOf.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/ValueVectorOf.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValueVectorOf.hpp 4 Nov 2002 15:22:05 -0000 1.3
+++ ValueVectorOf.hpp 15 May 2003 19:07:46 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -94,13 +97,14 @@
#if !defined(VALUEVECTOROF_HPP)
#define VALUEVECTOROF_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
#include <xercesc/util/XMLEnumerator.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/framework/MemoryManager.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-template <class TElem> class ValueVectorOf
+template <class TElem> class ValueVectorOf : public XMemory
{
public :
// -----------------------------------------------------------------------
@@ -162,6 +166,7 @@
unsigned int fCurCount;
unsigned int fMaxCount;
TElem* fElemList;
+ MemoryManager* fMemoryManager;
};
1.12 +21 -13 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp
Index: XMLAbstractDoubleFloat.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XMLAbstractDoubleFloat.cpp 12 Mar 2003 20:45:46 -0000 1.11
+++ XMLAbstractDoubleFloat.cpp 15 May 2003 19:07:46 -0000 1.12
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.12 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.11 2003/03/12 20:45:46 peiyongz
* format string for value converted to Zero.
*
@@ -121,19 +124,20 @@
// ctor/dtor
// ---------------------------------------------------------------------------
XMLAbstractDoubleFloat::XMLAbstractDoubleFloat()
-:fValue(0)
-,fType(Normal)
-,fDataConverted(false)
-,fSign(0)
-,fRawData(0)
-,fFormattedString(0)
+: fValue(0)
+, fType(Normal)
+, fDataConverted(false)
+, fSign(0)
+, fRawData(0)
+, fFormattedString(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
}
XMLAbstractDoubleFloat::~XMLAbstractDoubleFloat()
{
- delete [] fRawData;
- delete [] fFormattedString;
+ fMemoryManager->deallocate(fRawData);//delete [] fRawData;
+ fMemoryManager->deallocate(fFormattedString);//delete [] fFormattedString;
}
void XMLAbstractDoubleFloat::init(const XMLCh* const strValue)
@@ -141,10 +145,10 @@
if ((!strValue) || (!*strValue))
ThrowXML(NumberFormatException, XMLExcepts::XMLNUM_emptyString);
- fRawData = XMLString::replicate(strValue); // preserve the raw data form
+ fRawData = XMLString::replicate(strValue, fMemoryManager); // preserve the raw data form
- XMLCh* tmpStrValue = XMLString::replicate(strValue);
- ArrayJanitor<XMLCh> janTmpName(tmpStrValue);
+ XMLCh* tmpStrValue = XMLString::replicate(strValue, fMemoryManager);
+ ArrayJanitor<XMLCh> janTmpName(tmpStrValue, fMemoryManager);
XMLString::trim(tmpStrValue);
normalizeZero(tmpStrValue);
@@ -179,6 +183,7 @@
//
XMLCh* XMLAbstractDoubleFloat::toString() const
{
+ // Return data using global operator new
return XMLString::replicate(fRawData);
}
@@ -210,7 +215,10 @@
{
unsigned int rawDataLen = XMLString::stringLen(fRawData);
- fFormattedString = new XMLCh [ rawDataLen + 8];
+ fFormattedString = (XMLCh*) fMemoryManager->allocate
+ (
+ (rawDataLen + 8) * sizeof(XMLCh)
+ );//new XMLCh [ rawDataLen + 8];
for (unsigned int i = 0; i < rawDataLen + 8; i++)
fFormattedString[i] = chNull;
1.11 +13 -2 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp
Index: XMLAbstractDoubleFloat.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLAbstractDoubleFloat.hpp 9 May 2003 15:13:46 -0000 1.10
+++ XMLAbstractDoubleFloat.hpp 15 May 2003 19:07:46 -0000 1.11
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.11 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.10 2003/05/09 15:13:46 peiyongz
* Deprecated toString() in XMLNumber family
*
@@ -106,6 +109,7 @@
#define XML_ABSTRACT_DOUBLE_FLOAT_HPP
#include <xercesc/util/XMLNumber.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -167,6 +171,8 @@
virtual int getSign() const;
+ MemoryManager* getMemoryManager() const;
+
protected:
//
@@ -233,12 +239,17 @@
// otherwise it is empty.
//
XMLCh* fFormattedString;
-
+ MemoryManager* fMemoryManager;
};
inline bool XMLAbstractDoubleFloat::isSpecialValue() const
{
return (fType < SpecialTypeNum);
+}
+
+inline MemoryManager* XMLAbstractDoubleFloat::getMemoryManager() const
+{
+ return fMemoryManager;
}
XERCES_CPP_NAMESPACE_END
1.8 +21 -16 xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp
Index: XMLBigDecimal.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLBigDecimal.cpp 29 Apr 2003 18:13:36 -0000 1.7
+++ XMLBigDecimal.cpp 15 May 2003 19:07:46 -0000 1.8
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.7 2003/04/29 18:13:36 peiyongz
* cut link to XMLBigInteger, patch from Khaled Noaman
*
@@ -108,11 +111,10 @@
// ---------------------------------------------------------------------------
#include <xercesc/util/XMLBigDecimal.hpp>
#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/NumberFormatException.hpp>
#include <xercesc/util/TransService.hpp>
-#include <xercesc/util/Janitor.hpp>
+#include <xercesc/util/NumberFormatException.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
@@ -133,11 +135,12 @@
**/
XMLBigDecimal::XMLBigDecimal(const XMLCh* const strValue)
-:fSign(0)
-,fTotalDigits(0)
-,fScale(0)
-,fIntVal(0)
-,fRawData(0)
+: fSign(0)
+, fTotalDigits(0)
+, fScale(0)
+, fIntVal(0)
+, fRawData(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
if ((!strValue) || (!*strValue))
ThrowXML(NumberFormatException, XMLExcepts::XMLNUM_emptyString);
@@ -145,7 +148,7 @@
try
{
parseBigDecimal(strValue);
- fRawData = XMLString::replicate(strValue);
+ fRawData = XMLString::replicate(strValue, fMemoryManager);
}
catch(...)
{
@@ -162,15 +165,14 @@
void XMLBigDecimal::cleanUp()
{
if (fIntVal)
- delete [] fIntVal;
+ fMemoryManager->deallocate(fIntVal); //delete [] fIntVal;
if (fRawData)
- XMLString::release(&fRawData);
+ fMemoryManager->deallocate(fRawData); //XMLString::release(&fRawData);
}
void XMLBigDecimal::parseBigDecimal(const XMLCh* const toConvert)
{
-
// Scan past any whitespace. If we hit the end, then return failure
const XMLCh* startPtr = toConvert;
while (XMLPlatformUtils::fgTransService->isSpace(*startPtr))
@@ -205,12 +207,15 @@
if (!*startPtr)
{
fSign = 0;
- fIntVal = new XMLCh[1];
+ fIntVal = (XMLCh*) fMemoryManager->allocate(sizeof(XMLCh)); //new XMLCh[1];
fIntVal[0] = chNull;
return;
}
- fIntVal = new XMLCh[endPtr - startPtr + 1];
+ fIntVal = (XMLCh*) fMemoryManager->allocate
+ (
+ (endPtr - startPtr + 1) * sizeof(XMLCh)
+ ); //new XMLCh[endPtr - startPtr + 1];
XMLCh* retPtr = fIntVal;
// Scan data
1.9 +11 -11 xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp
Index: XMLBigDecimal.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLBigDecimal.hpp 9 May 2003 15:13:46 -0000 1.8
+++ XMLBigDecimal.hpp 15 May 2003 19:07:46 -0000 1.9
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -61,9 +61,9 @@
#ifndef XML_BIGDECIMAL_HPP
#define XML_BIGDECIMAL_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLNumber.hpp>
-#include <xercesc/util/XMLBigInteger.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -150,13 +150,12 @@
// needed for pattern matching.
//
// -----------------------------------------------------------------------
-
- int fSign;
- unsigned int fTotalDigits;
- unsigned int fScale;
-
- XMLCh* fIntVal;
- XMLCh* fRawData;
+ int fSign;
+ unsigned int fTotalDigits;
+ unsigned int fScale;
+ XMLCh* fIntVal;
+ XMLCh* fRawData;
+ MemoryManager* fMemoryManager;
};
inline int XMLBigDecimal::getSign() const
@@ -194,6 +193,7 @@
//
inline XMLCh* XMLBigDecimal::toString() const
{
+ // Return data using global operator new
return XMLString::replicate(fRawData);
}
1.4 +34 -20 xml-xerces/c/src/xercesc/util/XMLBigInteger.cpp
Index: XMLBigInteger.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigInteger.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLBigInteger.cpp 4 Nov 2002 15:22:05 -0000 1.3
+++ XMLBigInteger.cpp 15 May 2003 19:07:46 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.3 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -202,6 +205,7 @@
return;
}
+
/**
* Translates a string containing an optional minus sign followed by a
* sequence of one or more digits into a BigInteger.
@@ -210,41 +214,45 @@
*/
XMLBigInteger::XMLBigInteger(const XMLCh* const strValue)
-:fSign(0)
-,fMagnitude(0)
-,fRawData(0)
+: fSign(0)
+, fMagnitude(0)
+, fRawData(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
if (!strValue)
ThrowXML(NumberFormatException, XMLExcepts::XMLNUM_emptyString);
- XMLCh* ret_value = new XMLCh[XMLString::stringLen(strValue)+1];
- ArrayJanitor<XMLCh> janName(ret_value);
+ XMLCh* ret_value = (XMLCh*) fMemoryManager->allocate
+ (
+ (XMLString::stringLen(strValue) + 1) * sizeof(XMLCh)
+ );//new XMLCh[XMLString::stringLen(strValue)+1];
+ ArrayJanitor<XMLCh> janName(ret_value, fMemoryManager);
parseBigInteger(strValue, ret_value, fSign);
if (fSign == 0)
- fMagnitude = XMLString::replicate(XMLUni::fgZeroLenString);
+ fMagnitude = XMLString::replicate(XMLUni::fgZeroLenString, fMemoryManager);
else
- fMagnitude = XMLString::replicate(ret_value);
-
- fRawData = XMLString::replicate(strValue);
+ fMagnitude = XMLString::replicate(ret_value, fMemoryManager);
+ fRawData = XMLString::replicate(strValue, fMemoryManager);
}
XMLBigInteger::~XMLBigInteger()
{
- delete[] fMagnitude;
+ fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
if (fRawData)
- delete[] fRawData;
+ fMemoryManager->deallocate(fRawData);//delete[] fRawData;
}
XMLBigInteger::XMLBigInteger(const XMLBigInteger& toCopy)
-:fSign(toCopy.fSign)
-,fMagnitude(0)
-,fRawData(0)
+: fSign(toCopy.fSign)
+, fMagnitude(0)
+, fRawData(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
- fMagnitude = XMLString::replicate(toCopy.fMagnitude);
- fRawData = XMLString::replicate(toCopy.fRawData);
+ fMagnitude = XMLString::replicate(toCopy.fMagnitude, fMemoryManager);
+ fRawData = XMLString::replicate(toCopy.fRawData, fMemoryManager);
}
/**
@@ -313,7 +321,10 @@
return;
int strLen = XMLString::stringLen(fMagnitude);
- XMLCh* tmp = new XMLCh[strLen+byteToShift+1];
+ XMLCh* tmp = (XMLCh*) fMemoryManager->allocate
+ (
+ (strLen + byteToShift + 1) * sizeof(XMLCh)
+ );//new XMLCh[strLen+byteToShift+1];
XMLString::moveChars(tmp, fMagnitude, strLen);
unsigned int i = 0;
@@ -322,7 +333,7 @@
tmp[strLen+i] = chNull;
- delete[] fMagnitude;
+ fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
fMagnitude = tmp;
}
@@ -336,12 +347,15 @@
return;
int strLen = XMLString::stringLen(fMagnitude);
- XMLCh* tmp = new XMLCh[strLen-byteToShift+1];
+ XMLCh* tmp = (XMLCh*) fMemoryManager->allocate
+ (
+ (strLen - byteToShift + 1) * sizeof(XMLCh)
+ );//new XMLCh[strLen-byteToShift+1];
XMLString::moveChars(tmp, fMagnitude, strLen-byteToShift);
tmp[strLen-byteToShift] = chNull;
- delete[] fMagnitude;
+ fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
fMagnitude = tmp;
}
1.7 +5 -4 xml-xerces/c/src/xercesc/util/XMLBigInteger.hpp
Index: XMLBigInteger.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigInteger.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLBigInteger.hpp 9 May 2003 15:13:46 -0000 1.6
+++ XMLBigInteger.hpp 15 May 2003 19:07:46 -0000 1.7
@@ -61,12 +61,12 @@
#ifndef XML_BIGINTEGER_HPP
#define XML_BIGINTEGER_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
#include <xercesc/util/XMLString.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-class XMLUTIL_EXPORT XMLBigInteger
+class XMLUTIL_EXPORT XMLBigInteger : public XMemory
{
public:
@@ -166,7 +166,7 @@
int fSign;
XMLCh* fMagnitude; //null terminated
XMLCh* fRawData;
-
+ MemoryManager* fMemoryManager;
};
inline int XMLBigInteger::getSign() const
@@ -199,6 +199,7 @@
//
inline XMLCh* XMLBigInteger::toString() const
{
+ // Return data using global operator new
return XMLString::replicate(fRawData);
}
1.10 +17 -7 xml-xerces/c/src/xercesc/util/XMLDateTime.cpp
Index: XMLDateTime.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLDateTime.cpp 15 May 2003 16:32:19 -0000 1.9
+++ XMLDateTime.cpp 15 May 2003 19:07:46 -0000 1.10
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.10 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.9 2003/05/15 16:32:19 gareth
* We did not allow dateTimes with a timezone due to the last seconds fix.
*
@@ -467,17 +470,19 @@
XMLDateTime::~XMLDateTime()
{
if (fBuffer)
- delete[] fBuffer;
+ fMemoryManager->deallocate(fBuffer);//delete[] fBuffer;
}
XMLDateTime::XMLDateTime()
-:fBuffer(0)
+: fBuffer(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
reset();
}
XMLDateTime::XMLDateTime(const XMLCh* const aString)
-:fBuffer(0)
+: fBuffer(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
setBuffer(aString);
}
@@ -487,7 +492,8 @@
// -----------------------------------------------------------------------
XMLDateTime::XMLDateTime(const XMLDateTime &toCopy)
-:fBuffer(0)
+: fBuffer(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
copy(toCopy);
}
@@ -515,6 +521,7 @@
{
assertBuffer();
+ // Return data using global operator new
XMLCh* retBuf = XMLString::replicate(fBuffer);
return retBuf;
}
@@ -1361,8 +1368,11 @@
int XMLDateTime::parseInt(const int start, const int end) const
{
- XMLCh* strToScan = new XMLCh[end - start + 1];
- ArrayJanitor<XMLCh> jname(strToScan);
+ XMLCh* strToScan = (XMLCh*) fMemoryManager->allocate
+ (
+ (end - start + 1) * sizeof(XMLCh)
+ );//new XMLCh[end - start + 1];
+ ArrayJanitor<XMLCh> jname(strToScan, fMemoryManager);
XMLString::subString(strToScan, fBuffer, start, end);
unsigned int retVal;
1.7 +10 -11 xml-xerces/c/src/xercesc/util/XMLDateTime.hpp
Index: XMLDateTime.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLDateTime.hpp 9 May 2003 15:13:46 -0000 1.6
+++ XMLDateTime.hpp 15 May 2003 19:07:46 -0000 1.7
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.7 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.6 2003/05/09 15:13:46 peiyongz
* Deprecated toString() in XMLNumber family
*
@@ -92,8 +95,8 @@
#ifndef XML_DATETIME_HPP
#define XML_DATETIME_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLNumber.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/util/SchemaDateTimeException.hpp>
@@ -154,7 +157,6 @@
* Deprecated: please use getRawData
*
*/
-
virtual XMLCh* toString() const;
virtual XMLCh* getRawData() const;
@@ -309,17 +311,15 @@
int fTimeZone[TIMEZONE_ARRAYSIZE];
int fStart;
int fEnd;
-
XMLCh* fBuffer;
-
+ MemoryManager* fMemoryManager;
};
inline void XMLDateTime::setBuffer(const XMLCh* const aString)
{
reset();
- fBuffer = XMLString::replicate(aString);
+ fBuffer = XMLString::replicate(aString, fMemoryManager);
fEnd = XMLString::stringLen(fBuffer);
-
}
inline void XMLDateTime::reset()
@@ -332,7 +332,7 @@
if (fBuffer)
{
- delete[] fBuffer;
+ fMemoryManager->deallocate(fBuffer);//delete[] fBuffer;
fBuffer = 0;
}
@@ -350,13 +350,12 @@
if (fBuffer)
{
- delete[] fBuffer;
+ fMemoryManager->deallocate(fBuffer);//delete[] fBuffer;
fBuffer = 0;
}
if (rhs.fBuffer)
- fBuffer = XMLString::replicate(rhs.fBuffer);
-
+ fBuffer = XMLString::replicate(rhs.fBuffer, fMemoryManager);
}
inline void XMLDateTime::assertBuffer() const
1.6 +50 -23 xml-xerces/c/src/xercesc/util/XMLException.cpp
Index: XMLException.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLException.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLException.cpp 9 Mar 2003 16:40:47 -0000 1.5
+++ XMLException.cpp 15 May 2003 19:07:46 -0000 1.6
@@ -62,14 +62,14 @@
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
+#include <xercesc/util/XMLException.hpp>
#include <xercesc/util/Mutexes.hpp>
#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLException.hpp>
#include <xercesc/util/XMLMsgLoader.hpp>
#include <xercesc/util/XMLRegisterCleanup.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/XMLUni.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
@@ -161,8 +161,8 @@
// ---------------------------------------------------------------------------
XMLException::~XMLException()
{
- delete [] fMsg;
- delete [] fSrcFile;
+ XMLPlatformUtils::fgMemoryManager->deallocate(fMsg);
+ XMLPlatformUtils::fgMemoryManager->deallocate(fSrcFile);
}
@@ -172,8 +172,8 @@
void XMLException::setPosition(const char* const file, const unsigned int line)
{
fSrcLine = line;
- delete [] fSrcFile;
- fSrcFile = XMLString::replicate(file);
+ XMLPlatformUtils::fgMemoryManager->deallocate(fSrcFile);
+ fSrcFile = XMLString::replicate(file, XMLPlatformUtils::fgMemoryManager);
}
@@ -198,7 +198,7 @@
, fSrcLine(srcLine)
, fMsg(0)
{
- fSrcFile = XMLString::replicate(srcFile);
+ fSrcFile = XMLString::replicate(srcFile, XMLPlatformUtils::fgMemoryManager);
}
@@ -207,10 +207,15 @@
fCode(toCopy.fCode)
, fSrcFile(0)
, fSrcLine(toCopy.fSrcLine)
- , fMsg(XMLString::replicate(toCopy.fMsg))
+ , fMsg(XMLString::replicate(toCopy.fMsg, XMLPlatformUtils::fgMemoryManager))
{
- if (toCopy.fSrcFile)
- fSrcFile = XMLString::replicate(toCopy.fSrcFile);
+ if (toCopy.fSrcFile) {
+ fSrcFile = XMLString::replicate
+ (
+ toCopy.fSrcFile
+ , XMLPlatformUtils::fgMemoryManager
+ );
+ }
}
@@ -218,19 +223,29 @@
{
if (this != &toAssign)
{
- delete [] fSrcFile;
+ XMLPlatformUtils::fgMemoryManager->deallocate(fSrcFile);
fSrcFile = 0;
- delete [] fMsg;
+ XMLPlatformUtils::fgMemoryManager->deallocate(fMsg);
fMsg = 0;
fSrcLine = toAssign.fSrcLine;
fCode = toAssign.fCode;
- if (toAssign.fMsg)
- fMsg = XMLString::replicate(toAssign.fMsg);
+ if (toAssign.fMsg) {
+ fMsg = XMLString::replicate
+ (
+ toAssign.fMsg
+ , XMLPlatformUtils::fgMemoryManager
+ );
+ }
- if (toAssign.fSrcFile)
- fSrcFile = XMLString::replicate(toAssign.fSrcFile);
+ if (toAssign.fSrcFile) {
+ fSrcFile = XMLString::replicate
+ (
+ toAssign.fSrcFile
+ , XMLPlatformUtils::fgMemoryManager
+ );
+ }
}
return *this;
}
@@ -252,12 +267,16 @@
// load the text
if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize))
{
- fMsg = XMLString::replicate(gDefErrMsg);
+ fMsg = XMLString::replicate
+ (
+ gDefErrMsg
+ , XMLPlatformUtils::fgMemoryManager
+ );
return;
}
// We got the text so replicate it into the message member
- fMsg = XMLString::replicate(errText);
+ fMsg = XMLString::replicate(errText, XMLPlatformUtils::fgMemoryManager);
}
@@ -278,12 +297,16 @@
// load the text
if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4))
{
- fMsg = XMLString::replicate(gDefErrMsg);
+ fMsg = XMLString::replicate
+ (
+ gDefErrMsg
+ , XMLPlatformUtils::fgMemoryManager
+ );
return;
}
// We got the text so replicate it into the message member
- fMsg = XMLString::replicate(errText);
+ fMsg = XMLString::replicate(errText, XMLPlatformUtils::fgMemoryManager);
}
@@ -304,12 +327,16 @@
// load the text
if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4))
{
- fMsg = XMLString::replicate(gDefErrMsg);
+ fMsg = XMLString::replicate
+ (
+ gDefErrMsg
+ , XMLPlatformUtils::fgMemoryManager
+ );
return;
}
// We got the text so replicate it into the message member
- fMsg = XMLString::replicate(errText);
+ fMsg = XMLString::replicate(errText, XMLPlatformUtils::fgMemoryManager);
}
// -----------------------------------------------------------------------
1.5 +3 -2 xml-xerces/c/src/xercesc/util/XMLException.hpp
Index: XMLException.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLException.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLException.hpp 7 Mar 2003 18:11:55 -0000 1.4
+++ XMLException.hpp 15 May 2003 19:07:46 -0000 1.5
@@ -61,6 +61,7 @@
#if !defined(EXCEPTION_HPP)
#define EXCEPTION_HPP
+#include <xercesc/util/XMemory.hpp>
#include <xercesc/util/XMLExceptMsgs.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/framework/XMLErrorReporter.hpp>
@@ -76,7 +77,7 @@
// string that is used to hold the name of the class, a macro is provided
// below via which they are all created.
// ---------------------------------------------------------------------------
-class XMLUTIL_EXPORT XMLException
+class XMLUTIL_EXPORT XMLException : public XMemory
{
public:
// -----------------------------------------------------------------------
1.3 +6 -3 xml-xerces/c/src/xercesc/util/XMLInteger.hpp
Index: XMLInteger.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLInteger.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLInteger.hpp 4 Nov 2002 15:22:05 -0000 1.2
+++ XMLInteger.hpp 15 May 2003 19:07:46 -0000 1.3
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.3 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.2 2002/11/04 15:22:05 tng
* C++ Namespace Support.
*
@@ -71,11 +74,11 @@
#ifndef XML_INTEGER_HPP
#define XML_INTEGER_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-class XMLUTIL_EXPORT XMLInteger
+class XMLUTIL_EXPORT XMLInteger : public XMemory
{
public:
1.3 +9 -5 xml-xerces/c/src/xercesc/util/XMLMsgLoader.cpp
Index: XMLMsgLoader.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLMsgLoader.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLMsgLoader.cpp 17 Feb 2003 19:54:47 -0000 1.2
+++ XMLMsgLoader.cpp 15 May 2003 19:07:46 -0000 1.3
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.3 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.2 2003/02/17 19:54:47 peiyongz
* Allow set user specified error message file location in PlatformUtils::Initialize().
*
@@ -70,6 +73,7 @@
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/util/XMLMsgLoader.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
@@ -98,7 +102,7 @@
***/
if (fLocale)
{
- delete [] fLocale;
+ XMLPlatformUtils::fgMemoryManager->deallocate(fLocale);//delete [] fLocale;
fLocale = 0;
}
@@ -111,7 +115,7 @@
*/
if (localeToAdopt)
{
- fLocale = XMLString::replicate(localeToAdopt);
+ fLocale = XMLString::replicate(localeToAdopt, XMLPlatformUtils::fgMemoryManager);
XMLString::transcode(fLocale, fLanguage, 2);
fLanguage[2] = 0;
}
@@ -135,13 +139,13 @@
***/
if (fPath)
{
- delete [] fPath;
+ XMLPlatformUtils::fgMemoryManager->deallocate(fPath);//delete [] fPath;
fPath = 0;
}
if (nlsHomeToAdopt)
{
- fPath = XMLString::replicate(nlsHomeToAdopt);
+ fPath = XMLString::replicate(nlsHomeToAdopt, XMLPlatformUtils::fgMemoryManager);
}
}
1.6 +5 -2 xml-xerces/c/src/xercesc/util/XMLMsgLoader.hpp
Index: XMLMsgLoader.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLMsgLoader.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLMsgLoader.hpp 7 Mar 2003 18:11:55 -0000 1.5
+++ XMLMsgLoader.hpp 15 May 2003 19:07:46 -0000 1.6
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.6 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.5 2003/03/07 18:11:55 tng
* Return a reference instead of void for operator=
*
@@ -98,7 +101,7 @@
#if !defined(XMLMSGLOADER_HPP)
#define XMLMSGLOADER_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -119,7 +122,7 @@
// Msg loader derivatives are not required to be thread safe. The parser will
// never use a single instance in more than one thread.
//
-class XMLUTIL_EXPORT XMLMsgLoader
+class XMLUTIL_EXPORT XMLMsgLoader : public XMemory
{
public :
// -----------------------------------------------------------------------
1.5 +2 -3 xml-xerces/c/src/xercesc/util/XMLNetAccessor.hpp
Index: XMLNetAccessor.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLNetAccessor.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLNetAccessor.hpp 7 Mar 2003 18:11:55 -0000 1.4
+++ XMLNetAccessor.hpp 15 May 2003 19:07:46 -0000 1.5
@@ -61,7 +61,6 @@
#if !defined(XMLNETACCESSOR_HPP)
#define XMLNETACCESSOR_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLURL.hpp>
#include <xercesc/util/XMLException.hpp>
@@ -84,7 +83,7 @@
// code so each platform can decide what actual implementation it wants to
// use.
//
-class XMLUTIL_EXPORT XMLNetAccessor
+class XMLUTIL_EXPORT XMLNetAccessor : public XMemory
{
public :
// -----------------------------------------------------------------------
1.7 +9 -6 xml-xerces/c/src/xercesc/util/XMLNumber.hpp
Index: XMLNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLNumber.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLNumber.hpp 9 May 2003 15:13:46 -0000 1.6
+++ XMLNumber.hpp 15 May 2003 19:07:46 -0000 1.7
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.7 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.6 2003/05/09 15:13:46 peiyongz
* Deprecated toString() in XMLNumber family
*
@@ -86,11 +89,11 @@
#ifndef XMLNUMBER_HPP
#define XMLNUMBER_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-class XMLUTIL_EXPORT XMLNumber
+class XMLUTIL_EXPORT XMLNumber : public XMemory
{
public:
@@ -107,11 +110,11 @@
/**
* Deprecated: please use getRawData
*
- * Return string representation of the decimal value.
+ * Return string representation of the decimal value.
* A decimal point will be included as necessary,
* the caller of this method is responsible for the
* de-allocation of the memory.
- */
+ */
virtual XMLCh* toString() const = 0;
/**
1.22 +32 -1 xml-xerces/c/src/xercesc/util/XMLString.cpp
Index: XMLString.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLString.cpp 5 Feb 2003 18:50:56 -0000 1.21
+++ XMLString.cpp 15 May 2003 19:07:46 -0000 1.22
@@ -508,6 +508,25 @@
return ret;
}
+char* XMLString::replicate( const char* const toRep
+ , MemoryManager* const manager)
+{
+ // If a null string, return a null string
+ if (!toRep)
+ return 0;
+
+ //
+ // Get the len of the source and allocate a new buffer. Make sure to
+ // account for the nul terminator.
+ //
+ const unsigned int srcLen = strlen(toRep);
+ char* ret = (char*) manager->allocate((srcLen+1) * sizeof(char)); //new char[srcLen+1];
+
+ // Copy over the text, adjusting for the size of a char
+ memcpy(ret, toRep, (srcLen+1) * sizeof(char));
+ return ret;
+}
+
bool XMLString::startsWith(const char* const toTest, const char* const prefix)
{
@@ -533,6 +552,12 @@
return gTranscoder->transcode(toTranscode);
}
+char* XMLString::transcode(const XMLCh* const toTranscode,
+ MemoryManager* const manager)
+{
+ return gTranscoder->transcode(toTranscode, manager);
+}
+
bool XMLString::transcode( const XMLCh* const toTranscode
, char* const toFill
, const unsigned int maxChars)
@@ -545,6 +570,12 @@
XMLCh* XMLString::transcode(const char* const toTranscode)
{
return gTranscoder->transcode(toTranscode);
+}
+
+XMLCh* XMLString::transcode(const char* const toTranscode,
+ MemoryManager* const manager)
+{
+ return gTranscoder->transcode(toTranscode, manager);
}
bool XMLString::transcode( const char* const toTranscode
1.16 +32 -0 xml-xerces/c/src/xercesc/util/XMLString.hpp
Index: XMLString.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XMLString.hpp 21 Apr 2003 20:07:05 -0000 1.15
+++ XMLString.hpp 15 May 2003 19:07:46 -0000 1.16
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.16 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.15 2003/04/21 20:07:05 knoaman
* Performance: use memcpy in moveChars and replicate.
*
@@ -229,6 +232,7 @@
#define XMLSTRING_HPP
#include <xercesc/util/BaseRefVectorOf.hpp>
+#include <xercesc/framework/MemoryManager.hpp>
#include <string.h>
XERCES_CPP_NAMESPACE_BEGIN
@@ -810,6 +814,8 @@
* @see XMLString::release(char**)
*/
static char* replicate(const char* const toRep);
+ static char* replicate(const char* const toRep,
+ MemoryManager* const manager);
/** Replicates a string
* NOTE: The returned buffer is dynamically allocated and is the
@@ -821,6 +827,8 @@
* @see XMLString::release(XMLCh**)
*/
static XMLCh* replicate(const XMLCh* const toRep);
+ static XMLCh* replicate(const XMLCh* const toRep,
+ MemoryManager* const manager);
//@}
@@ -1226,6 +1234,11 @@
(
const XMLCh* const toTranscode
);
+ static char* transcode
+ (
+ const XMLCh* const toTranscode
+ , MemoryManager* const manager
+ );
/** Transcodes a string to native code-page
*
@@ -1262,6 +1275,11 @@
(
const char* const toTranscode
);
+ static XMLCh* transcode
+ (
+ const char* const toTranscode
+ , MemoryManager* const manager
+ );
/** Transcodes a string to native code-page
* @param toTranscode The string tobe transcoded
@@ -1511,6 +1529,20 @@
{
const unsigned int len = stringLen(toRep);
ret = new XMLCh[len + 1];
+ memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
+ }
+ return ret;
+}
+
+inline XMLCh* XMLString::replicate(const XMLCh* const toRep,
+ MemoryManager* const manager)
+{
+ // If a null string, return a null string!
+ XMLCh* ret = 0;
+ if (toRep)
+ {
+ const unsigned int len = stringLen(toRep);
+ ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1];
memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
}
return ret;
1.6 +107 -76 xml-xerces/c/src/xercesc/util/XMLURL.cpp
Index: XMLURL.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLURL.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLURL.cpp 6 Jan 2003 19:43:18 -0000 1.5
+++ XMLURL.cpp 15 May 2003 19:07:46 -0000 1.6
@@ -183,7 +183,8 @@
// ---------------------------------------------------------------------------
XMLURL::XMLURL() :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -199,7 +200,8 @@
XMLURL::XMLURL(const XMLCh* const baseURL
, const XMLCh* const relativeURL) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -224,7 +226,8 @@
XMLURL::XMLURL(const XMLCh* const baseURL
, const char* const relativeURL) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -235,8 +238,8 @@
, fURLText(0)
, fHasInvalidChar(false)
{
- XMLCh* tmpRel = XMLString::transcode(relativeURL);
- ArrayJanitor<XMLCh> janRel(tmpRel);
+ XMLCh* tmpRel = XMLString::transcode(relativeURL, fMemoryManager);
+ ArrayJanitor<XMLCh> janRel(tmpRel, fMemoryManager);
try
{
setURL(baseURL, tmpRel);
@@ -251,7 +254,8 @@
XMLURL::XMLURL(const XMLURL& baseURL
, const XMLCh* const relativeURL) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -276,7 +280,8 @@
XMLURL::XMLURL(const XMLURL& baseURL
, const char* const relativeURL) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -287,8 +292,8 @@
, fURLText(0)
, fHasInvalidChar(false)
{
- XMLCh* tmpRel = XMLString::transcode(relativeURL);
- ArrayJanitor<XMLCh> janRel(tmpRel);
+ XMLCh* tmpRel = XMLString::transcode(relativeURL, fMemoryManager);
+ ArrayJanitor<XMLCh> janRel(tmpRel, fMemoryManager);
try
{
setURL(baseURL, tmpRel);
@@ -303,7 +308,8 @@
XMLURL::XMLURL(const XMLCh* const urlText) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -327,7 +333,8 @@
XMLURL::XMLURL(const char* const urlText) :
- fFragment(0)
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
, fHost(0)
, fPassword(0)
, fPath(0)
@@ -338,8 +345,8 @@
, fURLText(0)
, fHasInvalidChar(false)
{
- XMLCh* tmpText = XMLString::transcode(urlText);
- ArrayJanitor<XMLCh> janRel(tmpText);
+ XMLCh* tmpText = XMLString::transcode(urlText, fMemoryManager);
+ ArrayJanitor<XMLCh> janRel(tmpText, fMemoryManager);
try
{
setURL(tmpText);
@@ -353,17 +360,32 @@
XMLURL::XMLURL(const XMLURL& toCopy) :
- fFragment(XMLString::replicate(toCopy.fFragment))
- , fHost(XMLString::replicate(toCopy.fHost))
- , fPassword(XMLString::replicate(toCopy.fPassword))
- , fPath(XMLString::replicate(toCopy.fPath))
+ fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fFragment(0)
+ , fHost(0)
+ , fPassword(0)
+ , fPath(0)
, fPortNum(toCopy.fPortNum)
, fProtocol(toCopy.fProtocol)
- , fQuery(XMLString::replicate(toCopy.fQuery))
- , fUser(XMLString::replicate(toCopy.fUser))
- , fURLText(XMLString::replicate(toCopy.fURLText))
+ , fQuery(0)
+ , fUser(0)
+ , fURLText(0)
, fHasInvalidChar(toCopy.fHasInvalidChar)
{
+ try
+ {
+ fFragment = XMLString::replicate(toCopy.fFragment, fMemoryManager);
+ fHost = XMLString::replicate(toCopy.fHost, fMemoryManager);
+ fPassword = XMLString::replicate(toCopy.fPassword, fMemoryManager);
+ fPath = XMLString::replicate(toCopy.fPath, fMemoryManager);
+ fQuery = XMLString::replicate(toCopy.fQuery, fMemoryManager);
+ fUser = XMLString::replicate(toCopy.fUser, fMemoryManager);
+ fURLText = XMLString::replicate(toCopy.fURLText, fMemoryManager);
+ }
+ catch(...)
+ {
+ cleanup();
+ }
}
XMLURL::~XMLURL()
@@ -384,14 +406,14 @@
cleanup();
// And copy his stuff
- fFragment = XMLString::replicate(toAssign.fFragment);
- fHost = XMLString::replicate(toAssign.fHost);
- fPassword = XMLString::replicate(toAssign.fPassword);
- fPath = XMLString::replicate(toAssign.fPath);
+ fFragment = XMLString::replicate(toAssign.fFragment, fMemoryManager);
+ fHost = XMLString::replicate(toAssign.fHost, fMemoryManager);
+ fPassword = XMLString::replicate(toAssign.fPassword, fMemoryManager);
+ fPath = XMLString::replicate(toAssign.fPath, fMemoryManager);
fProtocol = toAssign.fProtocol;
- fQuery = XMLString::replicate(toAssign.fQuery);
- fUser = XMLString::replicate(toAssign.fUser);
- fURLText = XMLString::replicate(toAssign.fURLText);
+ fQuery = XMLString::replicate(toAssign.fQuery, fMemoryManager);
+ fUser = XMLString::replicate(toAssign.fUser, fMemoryManager);
+ fURLText = XMLString::replicate(toAssign.fURLText, fMemoryManager);
return *this;
}
@@ -529,8 +551,8 @@
if (!fHost || !XMLString::compareIString(fHost, XMLUni::fgLocalHostString))
{
- XMLCh* realPath = XMLString::replicate(fPath);
- ArrayJanitor<XMLCh> basePathName(realPath);
+ XMLCh* realPath = XMLString::replicate(fPath, fMemoryManager);
+ ArrayJanitor<XMLCh> basePathName(realPath, fMemoryManager);
//
// Need to manually replace any character reference %xx first
@@ -568,7 +590,7 @@
}
- BinFileInputStream* retStrm = new BinFileInputStream(realPath);
+ BinFileInputStream* retStrm = new (fMemoryManager) BinFileInputStream(realPath);
if (!retStrm->getIsOpen())
{
delete retStrm;
@@ -632,8 +654,8 @@
+ 32;
// Clean up the existing buffer and allocate another
- delete [] fURLText;
- fURLText = new XMLCh[bufSize];
+ fMemoryManager->deallocate(fURLText);//delete [] fURLText;
+ fURLText = (XMLCh*) fMemoryManager->allocate((bufSize) * sizeof(XMLCh));//new XMLCh[bufSize];
*fURLText = 0;
XMLCh* outPtr = fURLText;
@@ -712,13 +734,13 @@
//
void XMLURL::cleanup()
{
- delete [] fFragment;
- delete [] fHost;
- delete [] fPassword;
- delete [] fPath;
- delete [] fQuery;
- delete [] fUser;
- delete [] fURLText;
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
+ fMemoryManager->deallocate(fPassword);//delete [] fPassword;
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
+ fMemoryManager->deallocate(fQuery);//delete [] fQuery;
+ fMemoryManager->deallocate(fUser);//delete [] fUser;
+ fMemoryManager->deallocate(fURLText);//delete [] fURLText;
fFragment = 0;
fHost = 0;
@@ -758,9 +780,9 @@
&& fFragment)
{
// Just in case, make sure we don't leak the user or password values
- delete [] fUser;
+ fMemoryManager->deallocate(fUser);//delete [] fUser;
fUser = 0;
- delete [] fPassword;
+ fMemoryManager->deallocate(fPassword);//delete [] fPassword;
fPassword = 0;
// Copy over the protocol and port number as is
@@ -768,10 +790,10 @@
fPortNum = baseURL.fPortNum;
// Replicate the base fields that are provided
- fHost = XMLString::replicate(baseURL.fHost);
- fUser = XMLString::replicate(baseURL.fUser);
- fPassword = XMLString::replicate(baseURL.fPassword);
- fPath = XMLString::replicate(baseURL.fPath);
+ fHost = XMLString::replicate(baseURL.fHost, fMemoryManager);
+ fUser = XMLString::replicate(baseURL.fUser, fMemoryManager);
+ fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager);
+ fPath = XMLString::replicate(baseURL.fPath, fMemoryManager);
return true;
}
@@ -798,16 +820,16 @@
if (baseURL.fHost)
{
// Just in case, make sure we don't leak a user or password field
- delete [] fUser;
+ fMemoryManager->deallocate(fUser);//delete [] fUser;
fUser = 0;
- delete [] fPassword;
+ fMemoryManager->deallocate(fPassword);//delete [] fPassword;
fPassword = 0;
- delete [] fHost;
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
fHost = 0;
- fHost = XMLString::replicate(baseURL.fHost);
- fUser = XMLString::replicate(baseURL.fUser);
- fPassword = XMLString::replicate(baseURL.fPassword);
+ fHost = XMLString::replicate(baseURL.fHost, fMemoryManager);
+ fUser = XMLString::replicate(baseURL.fUser, fMemoryManager);
+ fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager);
fPortNum = baseURL.fPortNum;
}
@@ -823,7 +845,7 @@
// Its a relative path, so weave them together.
if (baseURL.fPath) {
XMLCh* temp = XMLPlatformUtils::weavePaths(baseURL.fPath, fPath);
- delete [] fPath;
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
fPath = temp;
}
@@ -834,11 +856,11 @@
// We had no original path, so go on to deal with the query/fragment parts
if (fQuery || !baseURL.fQuery)
return true;
- fQuery = XMLString::replicate(baseURL.fQuery);
+ fQuery = XMLString::replicate(baseURL.fQuery, fMemoryManager);
if (fFragment || !baseURL.fFragment)
return true;
- fFragment = XMLString::replicate(baseURL.fFragment);
+ fFragment = XMLString::replicate(baseURL.fFragment, fMemoryManager);
return true;
}
@@ -874,8 +896,8 @@
}
// Get a copy of the URL that we can modify
- XMLCh* srcCpy = XMLString::replicate(urlText);
- ArrayJanitor<XMLCh> janSrcCopy(srcCpy);
+ XMLCh* srcCpy = XMLString::replicate(urlText, fMemoryManager);
+ ArrayJanitor<XMLCh> janSrcCopy(srcCpy, fMemoryManager);
//
// Get a pointer now that we can run up thrown the source as we parse
@@ -963,8 +985,11 @@
{
if (ptr1 != srcPtr)
{
- delete [] fHost;
- fHost = new XMLCh[(ptr1 - srcPtr) + 1];
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
+ fHost = (XMLCh*) fMemoryManager->allocate
+ (
+ (ptr1 - srcPtr + 1) * sizeof(XMLCh)
+ );//new XMLCh[(ptr1 - srcPtr) + 1];
ptr2 = fHost;
while (srcPtr < ptr1)
*ptr2++ = *srcPtr++;
@@ -973,8 +998,8 @@
}
else
{
- delete [] fHost;
- fHost = XMLString::replicate(srcPtr);
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
+ fHost = XMLString::replicate(srcPtr, fMemoryManager);
// Update source pointer to the end
srcPtr += XMLString::stringLen(fHost);
@@ -1012,8 +1037,8 @@
{
// Get this info out as the user name
*ptr1 = 0;
- delete [] fUser;
- fUser = XMLString::replicate(fHost);
+ fMemoryManager->deallocate(fUser);//delete [] fUser;
+ fUser = XMLString::replicate(fHost, fMemoryManager);
ptr1++;
// And now cut these chars from the host string
@@ -1028,8 +1053,8 @@
// And copy out the remainder to the password field
ptr2++;
- delete [] fPassword;
- fPassword = XMLString::replicate(ptr2);
+ fMemoryManager->deallocate(fPassword);//delete [] fPassword;
+ fPassword = XMLString::replicate(ptr2, fMemoryManager);
}
}
@@ -1072,16 +1097,19 @@
ptr1 = XMLString::findAny(srcPtr, listFive);
if (!ptr1)
{
- delete [] fPath;
- fPath = XMLString::replicate(srcPtr);
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
+ fPath = XMLString::replicate(srcPtr, fMemoryManager);
return;
}
// Everything from where we are to what we found is the path
if (ptr1 > srcPtr)
{
- delete [] fPath;
- fPath = new XMLCh[(ptr1 - srcPtr) + 1];
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
+ fPath = (XMLCh*) fMemoryManager->allocate
+ (
+ (ptr1 - srcPtr + 1) * sizeof(XMLCh)
+ );//new XMLCh[(ptr1 - srcPtr) + 1];
ptr2 = fPath;
while (srcPtr < ptr1)
*ptr2++ = *srcPtr++;
@@ -1095,8 +1123,8 @@
if (*srcPtr == chPound)
{
srcPtr++;
- delete [] fFragment;
- fFragment = XMLString::replicate(srcPtr);
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
+ fFragment = XMLString::replicate(srcPtr, fMemoryManager);
return;
}
@@ -1106,15 +1134,18 @@
//
srcPtr++;
ptr1 = XMLString::findAny(srcPtr, listSix);
- delete [] fQuery;
+ fMemoryManager->deallocate(fQuery);//delete [] fQuery;
if (!ptr1)
{
- fQuery = XMLString::replicate(srcPtr);
+ fQuery = XMLString::replicate(srcPtr, fMemoryManager);
return;
}
else
{
- fQuery = new XMLCh[(ptr1 - srcPtr) + 1];
+ fQuery = (XMLCh*) fMemoryManager->allocate
+ (
+ (ptr1 - srcPtr + 1) * sizeof(XMLCh)
+ );//new XMLCh[(ptr1 - srcPtr) + 1];
ptr2 = fQuery;
while (srcPtr < ptr1)
*ptr2++ = *srcPtr++;
@@ -1125,8 +1156,8 @@
if (*srcPtr == chPound)
{
srcPtr++;
- delete [] fFragment;
- fFragment = XMLString::replicate(srcPtr);
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
+ fFragment = XMLString::replicate(srcPtr, fMemoryManager);
}
}
1.6 +4 -4 xml-xerces/c/src/xercesc/util/XMLURL.hpp
Index: XMLURL.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLURL.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLURL.hpp 5 Feb 2003 22:22:54 -0000 1.5
+++ XMLURL.hpp 15 May 2003 19:07:46 -0000 1.6
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -61,7 +61,6 @@
#if !defined(XMLURL_HPP)
#define XMLURL_HPP
-#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLException.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -72,7 +71,7 @@
// This class supports file, http, and ftp style URLs. All others are
// rejected
//
-class XMLUTIL_EXPORT XMLURL
+class XMLUTIL_EXPORT XMLURL : public XMemory
{
public:
// -----------------------------------------------------------------------
@@ -236,6 +235,7 @@
// This indicates if the URL Text contains invalid characters as per
// RFC 2396 standard.
// -----------------------------------------------------------------------
+ MemoryManager* fMemoryManager;
XMLCh* fFragment;
XMLCh* fHost;
XMLCh* fPassword;
1.11 +138 -99 xml-xerces/c/src/xercesc/util/XMLUri.cpp
Index: XMLUri.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUri.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLUri.cpp 15 Apr 2003 15:58:19 -0000 1.10
+++ XMLUri.cpp 15 May 2003 19:07:46 -0000 1.11
@@ -242,14 +242,15 @@
// ---------------------------------------------------------------------------
// ctor# 2
XMLUri::XMLUri(const XMLCh* const uriSpec)
-:fScheme(0)
-,fUserInfo(0)
-,fHost(0)
-,fPort(-1)
-,fPath(0)
-,fQueryString(0)
-,fFragment(0)
-,fURIText(0)
+: fScheme(0)
+, fUserInfo(0)
+, fHost(0)
+, fPort(-1)
+, fPath(0)
+, fQueryString(0)
+, fFragment(0)
+, fURIText(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
try {
initialize((XMLUri *)0, uriSpec);
@@ -264,14 +265,15 @@
// ctor# 7 relative ctor
XMLUri::XMLUri(const XMLUri* const baseURI
, const XMLCh* const uriSpec)
-:fScheme(0)
-,fUserInfo(0)
-,fHost(0)
-,fPort(-1)
-,fPath(0)
-,fQueryString(0)
-,fFragment(0)
-,fURIText(0)
+: fScheme(0)
+, fUserInfo(0)
+, fHost(0)
+, fPort(-1)
+, fPath(0)
+, fQueryString(0)
+, fFragment(0)
+, fURIText(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
try {
initialize(baseURI, uriSpec);
@@ -285,6 +287,15 @@
//Copy constructor
XMLUri::XMLUri(const XMLUri& toCopy)
+: fScheme(0)
+, fUserInfo(0)
+, fHost(0)
+, fPort(-1)
+, fPath(0)
+, fQueryString(0)
+, fFragment(0)
+, fURIText(0)
+, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
try {
initialize(toCopy);
@@ -317,25 +328,25 @@
void XMLUri::cleanUp()
{
- if (getScheme())
- delete[] fScheme;
+ if (fScheme)
+ fMemoryManager->deallocate(fScheme);//delete[] fScheme;
- if (getUserInfo())
- delete[] fUserInfo;
+ if (fUserInfo)
+ fMemoryManager->deallocate(fUserInfo);//delete[] fUserInfo;
- if (getHost())
- delete[] fHost;
+ if (fHost)
+ fMemoryManager->deallocate(fHost);//delete[] fHost;
- if (getPath())
- delete[] fPath;
+ if (fPath)
+ fMemoryManager->deallocate(fPath);//delete[] fPath;
- if (getQueryString())
- delete[] fQueryString;
+ if (fQueryString)
+ fMemoryManager->deallocate(fQueryString);//delete[] fQueryString;
- if (getFragment())
- delete[] fFragment;
+ if (fFragment)
+ fMemoryManager->deallocate(fFragment);//delete[] fFragment;
- delete[] fURIText;
+ fMemoryManager->deallocate(fURIText);//delete[] fURIText;
}
void XMLUri::initialize(const XMLUri& toCopy)
@@ -344,14 +355,15 @@
// assuming that all fields from the toCopy are valid,
// therefore need NOT to go through various setXXX() methods
//
- fScheme = XMLString::replicate(toCopy.getScheme());
- fUserInfo = XMLString::replicate(toCopy.getUserInfo());
- fHost = XMLString::replicate(toCopy.getHost());
- fPort = toCopy.getPort();
- fPath = XMLString::replicate(toCopy.getPath());
- fQueryString = XMLString::replicate(toCopy.getQueryString());
- fFragment = XMLString::replicate(toCopy.getFragment());
- }
+ fMemoryManager = toCopy.fMemoryManager;
+ fScheme = XMLString::replicate(toCopy.fScheme, fMemoryManager);
+ fUserInfo = XMLString::replicate(toCopy.fUserInfo, fMemoryManager);
+ fHost = XMLString::replicate(toCopy.fHost, fMemoryManager);
+ fPort = toCopy.fPort;
+ fPath = XMLString::replicate(toCopy.fPath, fMemoryManager);
+ fQueryString = XMLString::replicate(toCopy.fQueryString, fMemoryManager);
+ fFragment = XMLString::replicate(toCopy.fFragment, fMemoryManager);
+}
void XMLUri::initialize(const XMLUri* const baseURI
, const XMLCh* const uriSpec)
@@ -360,9 +372,9 @@
// get a trimmed version of uriSpec
// uriSpec will NO LONGER be used in this function.
//
- XMLCh* trimedUriSpec = XMLString::replicate(uriSpec);
+ XMLCh* trimedUriSpec = XMLString::replicate(uriSpec, fMemoryManager);
XMLString::trim(trimedUriSpec);
- ArrayJanitor<XMLCh> janName(trimedUriSpec);
+ ArrayJanitor<XMLCh> janName(trimedUriSpec, fMemoryManager);
int trimedUriSpecLen = XMLString::stringLen(trimedUriSpec);
if ( !baseURI &&
@@ -412,8 +424,11 @@
}
// two slashes means generic URI syntax, so we get the authority
- XMLCh* authUriSpec = new XMLCh[trimedUriSpecLen+1];
- ArrayJanitor<XMLCh> authName(authUriSpec);
+ XMLCh* authUriSpec = (XMLCh*) fMemoryManager->allocate
+ (
+ (trimedUriSpecLen+1) * sizeof(XMLCh)
+ );//new XMLCh[trimedUriSpecLen+1];
+ ArrayJanitor<XMLCh> authName(authUriSpec, fMemoryManager);
XMLString::subString(authUriSpec, trimedUriSpec, index, trimedUriSpecLen);
if (((index+1) < trimedUriSpecLen) &&
@@ -455,8 +470,11 @@
if (index >= trimedUriSpecLen)
return;
- XMLCh* pathUriSpec = new XMLCh[trimedUriSpecLen+1];
- ArrayJanitor<XMLCh> pathUriSpecName(pathUriSpec);
+ XMLCh* pathUriSpec = (XMLCh*) fMemoryManager->allocate
+ (
+ (trimedUriSpecLen+1) * sizeof(XMLCh)
+ );//new XMLCh[trimedUriSpecLen+1];
+ ArrayJanitor<XMLCh> pathUriSpecName(pathUriSpec, fMemoryManager);
XMLString::subString(pathUriSpec, trimedUriSpec, index, trimedUriSpecLen);
initializePath(pathUriSpec);
@@ -479,17 +497,17 @@
fScheme == 0 &&
fHost == 0)
{
- fScheme = XMLString::replicate(baseURI->getScheme());
- delete [] fUserInfo;
- fUserInfo = XMLString::replicate(baseURI->getUserInfo());
- fHost = XMLString::replicate(baseURI->getHost());
+ fScheme = XMLString::replicate(baseURI->getScheme(), fMemoryManager);
+ fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo;
+ fUserInfo = XMLString::replicate(baseURI->getUserInfo(), fMemoryManager);
+ fHost = XMLString::replicate(baseURI->getHost(), fMemoryManager);
fPort = baseURI->getPort();
- delete [] fPath;
- fPath = XMLString::replicate(baseURI->getPath());
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
+ fPath = XMLString::replicate(baseURI->getPath(), fMemoryManager);
if ( !fQueryString )
{
- fQueryString = XMLString::replicate(baseURI->getQueryString());
+ fQueryString = XMLString::replicate(baseURI->getQueryString(), fMemoryManager);
}
return;
}
@@ -498,7 +516,7 @@
// if we found a scheme, it means absolute URI, so we're done
if (fScheme == 0)
{
- fScheme = XMLString::replicate(baseURI->getScheme());
+ fScheme = XMLString::replicate(baseURI->getScheme(), fMemoryManager);
}
else
{
@@ -509,9 +527,9 @@
// if we found a host, then we've got a network path, so we're done
if (fHost == 0)
{
- delete [] fUserInfo;
- fUserInfo = XMLString::replicate(baseURI->getUserInfo());
- fHost = XMLString::replicate(baseURI->getHost());
+ fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo;
+ fUserInfo = XMLString::replicate(baseURI->getUserInfo(), fMemoryManager);
+ fHost = XMLString::replicate(baseURI->getHost(), fMemoryManager);
fPort = baseURI->getPort();
}
else
@@ -529,18 +547,18 @@
// if we get to this point, we need to resolve relative path
// RFC 2396 5.2 #6
- XMLCh* basePath = XMLString::replicate(baseURI->getPath());
- ArrayJanitor<XMLCh> basePathName(basePath);
+ XMLCh* basePath = XMLString::replicate(baseURI->getPath(), fMemoryManager);
+ ArrayJanitor<XMLCh> basePathName(basePath, fMemoryManager);
int bufLen = trimedUriSpecLen+XMLString::stringLen(fPath)+XMLString::stringLen(basePath)+1;
- XMLCh* path = new XMLCh[bufLen];
- ArrayJanitor<XMLCh> pathName(path);
+ XMLCh* path = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen];
+ ArrayJanitor<XMLCh> pathName(path, fMemoryManager);
path[0] = 0;
- XMLCh* tmp1 = new XMLCh[bufLen];
- ArrayJanitor<XMLCh> tmp1Name(tmp1);
- XMLCh* tmp2 = new XMLCh[bufLen];
- ArrayJanitor<XMLCh> tmp2Name(tmp2);
+ XMLCh* tmp1 = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen];
+ ArrayJanitor<XMLCh> tmp1Name(tmp1, fMemoryManager);
+ XMLCh* tmp2 = (XMLCh*) fMemoryManager->allocate(bufLen * sizeof(XMLCh));//new XMLCh[bufLen];
+ ArrayJanitor<XMLCh> tmp2Name(tmp2, fMemoryManager);
// 6a - get all but the last segment of the base URI path
if (basePath)
@@ -629,9 +647,9 @@
}
if (getPath())
- delete [] fPath;
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
- fPath = XMLString::replicate(path);
+ fPath = XMLString::replicate(path, fMemoryManager);
}
}
@@ -663,8 +681,11 @@
// server = [ [ userinfo "@" ] hostport ]
// userinfo is everything up @,
//
- XMLCh* userinfo = new XMLCh[end+1];
- ArrayJanitor<XMLCh> userName(userinfo);
+ XMLCh* userinfo = (XMLCh*) fMemoryManager->allocate
+ (
+ (end+1) * sizeof(XMLCh)
+ );//new XMLCh[end+1];
+ ArrayJanitor<XMLCh> userName(userinfo, fMemoryManager);
index = XMLString::indexOf(&(uriSpec[start]), chAt);
if ( index != -1)
@@ -682,8 +703,11 @@
// hostport = host [ ":" port ]
// host is everything up to ':'
//
- XMLCh* host = new XMLCh[end+1];
- ArrayJanitor<XMLCh> hostName(host);
+ XMLCh* host = (XMLCh*) fMemoryManager->allocate
+ (
+ (end+1) * sizeof(XMLCh)
+ );//new XMLCh[end+1];
+ ArrayJanitor<XMLCh> hostName(host, fMemoryManager);
index = XMLString::indexOf(&(uriSpec[start]), chColon);
if ( index != -1)
@@ -700,8 +724,11 @@
// port is everything after ":"
- XMLCh* portStr = new XMLCh[end+1];
- ArrayJanitor<XMLCh> portName(portStr);
+ XMLCh* portStr = (XMLCh*) fMemoryManager->allocate
+ (
+ (end+1) * sizeof(XMLCh)
+ );//new XMLCh[end+1];
+ ArrayJanitor<XMLCh> portName(portStr, fMemoryManager);
int port = -1;
if ((host && *host) && // non empty host
@@ -741,8 +768,11 @@
}
else
{
- XMLCh* scheme = new XMLCh[XMLString::stringLen(uriSpec)+1];
- ArrayJanitor<XMLCh> tmpName(scheme);
+ XMLCh* scheme = (XMLCh*) fMemoryManager->allocate
+ (
+ (XMLString::stringLen(uriSpec) + 1) * sizeof(XMLCh)
+ );//new XMLCh[XMLString::stringLen(uriSpec)+1];
+ ArrayJanitor<XMLCh> tmpName(scheme, fMemoryManager);
XMLString::subString(scheme, uriSpec, 0, (tmpPtr - uriSpec));
setScheme(scheme);
}
@@ -803,10 +833,10 @@
if (getPath())
{
- delete [] fPath;
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
}
- fPath = new XMLCh[index+1];
+ fPath = (XMLCh*) fMemoryManager->allocate((index+1) * sizeof(XMLCh));//new XMLCh[index+1];
XMLString::subString(fPath, uriSpec, start, index);
// query - starts with ? and up to fragment or end
@@ -851,10 +881,13 @@
if (getQueryString())
{
- delete [] fQueryString;
+ fMemoryManager->deallocate(fQueryString);//delete [] fQueryString;
}
- fQueryString = new XMLCh[index - start + 1];
+ fQueryString = (XMLCh*) fMemoryManager->allocate
+ (
+ (index - start + 1) * sizeof(XMLCh)
+ );//new XMLCh[index - start + 1];
XMLString::subString(fQueryString, uriSpec, start, index);
}
@@ -897,12 +930,15 @@
}
if (getFragment())
- delete [] fFragment;
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
//make sure that there is something following the '#'
if (index > start)
{
- fFragment = new XMLCh[index - start + 1];
+ fFragment = (XMLCh*) fMemoryManager->allocate
+ (
+ (index - start + 1) * sizeof(XMLCh)
+ );//new XMLCh[index - start + 1];
XMLString::subString(fFragment, uriSpec, start, index);
}
else
@@ -942,10 +978,10 @@
if (getScheme())
{
- delete [] fScheme;
+ fMemoryManager->deallocate(fScheme);//delete [] fScheme;
}
- fScheme = XMLString::replicate(newScheme);
+ fScheme = XMLString::replicate(newScheme, fMemoryManager);
XMLString::lowerCase(fScheme);
}
@@ -981,13 +1017,13 @@
if (getUserInfo())
{
- delete [] fUserInfo;
+ fMemoryManager->deallocate(fUserInfo);//delete [] fUserInfo;
}
//sometimes we get passed a empty string rather than a null.
//Other procedures rely on it being null
if(newUserInfo && *newUserInfo) {
- fUserInfo = XMLString::replicate(newUserInfo);
+ fUserInfo = XMLString::replicate(newUserInfo, fMemoryManager);
}
}
@@ -998,7 +1034,7 @@
XMLString::isAllWhiteSpace(newHost))
{
if (getHost())
- delete [] fHost;
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
fHost = 0;
setUserInfo(0);
@@ -1017,10 +1053,10 @@
if (getHost())
{
- delete [] fHost;
+ fMemoryManager->deallocate(fHost);//delete [] fHost;
}
- fHost = XMLString::replicate(newHost);
+ fHost = XMLString::replicate(newHost, fMemoryManager);
}
void XMLUri::setPort(int newPort)
@@ -1057,7 +1093,7 @@
if (!newPath)
{
if (getPath())
- delete [] fPath;
+ fMemoryManager->deallocate(fPath);//delete [] fPath;
fPath = 0;
setQueryString(0);
@@ -1077,7 +1113,7 @@
if ( !newFragment )
{
if (getFragment())
- delete [] fFragment;
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
fFragment = 0;
}
@@ -1105,10 +1141,10 @@
{
if (getFragment())
{
- delete [] fFragment;
+ fMemoryManager->deallocate(fFragment);//delete [] fFragment;
}
- fFragment = XMLString::replicate(newFragment);
+ fFragment = XMLString::replicate(newFragment, fMemoryManager);
}
}
@@ -1120,7 +1156,7 @@
if ( !newQueryString )
{
if (getQueryString())
- delete [] fQueryString;
+ fMemoryManager->deallocate(fQueryString);//delete [] fQueryString;
fQueryString = 0;
}
@@ -1149,10 +1185,10 @@
{
if (getQueryString())
{
- delete [] fQueryString;
+ fMemoryManager->deallocate(fQueryString);//delete [] fQueryString;
}
- fQueryString = XMLString::replicate(newQueryString);
+ fQueryString = XMLString::replicate(newQueryString, fMemoryManager);
}
}
@@ -1293,8 +1329,8 @@
//
// check length
//
- XMLCh* tmpAddr = XMLString::replicate(addrString);
- ArrayJanitor<XMLCh> janName(tmpAddr);
+ XMLCh* tmpAddr = XMLString::replicate(addrString, XMLPlatformUtils::fgMemoryManager);
+ ArrayJanitor<XMLCh> janName(tmpAddr, XMLPlatformUtils::fgMemoryManager);
XMLString::trim(tmpAddr);
if ((!tmpAddr || !*tmpAddr) ||
(XMLString::stringLen(tmpAddr) > 255) )
@@ -1317,10 +1353,13 @@
// get the second last "."
if (lastPeriodPos + 1 == addrStrLen)
{
- XMLCh* tmp2 = new XMLCh[addrStrLen];
+ XMLCh* tmp2 = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
+ (
+ addrStrLen * sizeof(XMLCh)
+ );//new XMLCh[addrStrLen];
XMLString::subString(tmp2, addrString, 0, lastPeriodPos);
lastPeriodPos = XMLString::lastIndexOf(tmp2, chPeriod);
- delete [] tmp2;
+ XMLPlatformUtils::fgMemoryManager->deallocate(tmp2);//delete [] tmp2;
if ( XMLString::isDigit(addrString[lastPeriodPos + 1]))
return false;
@@ -1416,8 +1455,8 @@
+ 32;
// Clean up the existing buffer and allocate another
- delete [] fURIText;
- fURIText = new XMLCh[bufSize];
+ fMemoryManager->deallocate(fURIText);//delete [] fURIText;
+ fURIText = (XMLCh*) fMemoryManager->allocate(bufSize * sizeof(XMLCh));//new XMLCh[bufSize];
*fURIText = 0;
XMLCh* outPtr = fURIText;
1.8 +8 -8 xml-xerces/c/src/xercesc/util/XMLUri.hpp
Index: XMLUri.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUri.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLUri.hpp 6 Jan 2003 19:43:18 -0000 1.7
+++ XMLUri.hpp 15 May 2003 19:07:46 -0000 1.8
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.8 2003/05/15 19:07:46 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.7 2003/01/06 19:43:18 tng
* New feature StandardUriConformant to force strict standard uri conformance.
*
@@ -93,9 +96,7 @@
#if !defined(XMLURI_HPP)
#define XMLURI_HPP
-#include <xercesc/util/XercesDefs.hpp>
-#include <xercesc/util/XMLException.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
#include <xercesc/util/XMLString.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -109,7 +110,7 @@
*
*/
-class XMLUTIL_EXPORT XMLUri
+ class XMLUTIL_EXPORT XMLUri : public XMemory
{
public:
@@ -465,7 +466,6 @@
// the memory allocated.
//
// -----------------------------------------------------------------------
-
XMLCh* fScheme;
XMLCh* fUserInfo;
XMLCh* fHost;
@@ -474,7 +474,7 @@
XMLCh* fQueryString;
XMLCh* fFragment;
XMLCh* fURIText;
-
+ MemoryManager* fMemoryManager;
};
// ---------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org