diff --git a/src/xercesc/dom/deprecated/DOMParser.cpp b/src/xercesc/dom/deprecated/DOMParser.cpp index 58b4aaa6427ff7253dfb14cf22884bb56978cf29..629ca04953eee493b711d96d7997891a939fb2b2 100644 --- a/src/xercesc/dom/deprecated/DOMParser.cpp +++ b/src/xercesc/dom/deprecated/DOMParser.cpp @@ -552,6 +552,7 @@ void DOMParser::error( const unsigned int code , systemId , lineNum , colNum + , fMemoryManager ); // diff --git a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp index 342200739d32b1bd15baa2c55ebda99f9e632100..83f8ce4925ae5864bbdb9291548abd9e2a08ebb1 100644 --- a/src/xercesc/parsers/SAX2XMLReaderImpl.cpp +++ b/src/xercesc/parsers/SAX2XMLReaderImpl.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.26 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.25 2003/07/31 17:05:48 peiyongz * using getGrammar(URI) * @@ -1404,6 +1407,7 @@ void SAX2XMLReaderImpl::error( const unsigned int code , systemId , lineNum , colNum + , fMemoryManager ); if (!fErrorHandler) @@ -1431,7 +1435,7 @@ void SAX2XMLReaderImpl::setFeature(const XMLCh* const name, const bool value) { if (fParseInProgress) - throw SAXNotSupportedException("Feature modification is not supported during parse."); + throw SAXNotSupportedException("Feature modification is not supported during parse.", fMemoryManager); if (XMLString::compareIString(name, XMLUni::fgSAX2CoreNameSpaces) == 0) { @@ -1505,7 +1509,7 @@ void SAX2XMLReaderImpl::setFeature(const XMLCh* const name, const bool value) fScanner->setStandardUriConformant(value); } else - throw SAXNotRecognizedException("Unknown Feature"); + throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); } bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const @@ -1537,7 +1541,7 @@ bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const else if (XMLString::compareIString(name, XMLUni::fgXercesStandardUriConformant) == 0) return fScanner->getStandardUriConformant(); else - throw SAXNotRecognizedException("Unknown Feature"); + throw SAXNotRecognizedException("Unknown Feature", fMemoryManager); return false; } @@ -1545,7 +1549,7 @@ bool SAX2XMLReaderImpl::getFeature(const XMLCh* const name) const void SAX2XMLReaderImpl::setProperty(const XMLCh* const name, void* value) { if (fParseInProgress) - throw SAXNotSupportedException("Property modification is not supported during parse."); + throw SAXNotSupportedException("Property modification is not supported during parse.", fMemoryManager); if (XMLString::compareIString(name, XMLUni::fgXercesSchemaExternalSchemaLocation) == 0) { @@ -1578,7 +1582,7 @@ void SAX2XMLReaderImpl::setProperty(const XMLCh* const name, void* value) } } else - throw SAXNotRecognizedException("Unknown Property"); + throw SAXNotRecognizedException("Unknown Property", fMemoryManager); } @@ -1593,7 +1597,7 @@ void* SAX2XMLReaderImpl::getProperty(const XMLCh* const name) const else if (XMLString::equals(name, XMLUni::fgXercesScannerName)) return (void*)fScanner->getName(); else - throw SAXNotRecognizedException("Unknown Property"); + throw SAXNotRecognizedException("Unknown Property", fMemoryManager); return 0; } diff --git a/src/xercesc/parsers/SAXParser.cpp b/src/xercesc/parsers/SAXParser.cpp index 811bba6e10e908522a5f93a8d7b36467b7018b86..6466a8afe99bcc3a7126228bccc66d2e82d7e92f 100644 --- a/src/xercesc/parsers/SAXParser.cpp +++ b/src/xercesc/parsers/SAXParser.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.24 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.23 2003/07/31 17:05:48 peiyongz * using getGrammar(URI) * @@ -1276,6 +1279,7 @@ void SAXParser::error( const unsigned int code , systemId , lineNum , colNum + , fMemoryManager ); if (!fErrorHandler) diff --git a/src/xercesc/parsers/XercesDOMParser.cpp b/src/xercesc/parsers/XercesDOMParser.cpp index d1d020eb9943eb69c65d564593ef58fb0390593b..484b9c2f35dcdf489457fe10d38f782c0a3bfd28 100644 --- a/src/xercesc/parsers/XercesDOMParser.cpp +++ b/src/xercesc/parsers/XercesDOMParser.cpp @@ -206,6 +206,7 @@ void XercesDOMParser::error( const unsigned int code , systemId , lineNum , colNum + , getMemoryManager() ); // diff --git a/src/xercesc/sax/SAXException.cpp b/src/xercesc/sax/SAXException.cpp index 4c9a14be33be17dd2bb6a951db8138e7dfc0e28d..aa1dcdac0ad272d97c36aee18c17323c6ecf1e74 100644 --- a/src/xercesc/sax/SAXException.cpp +++ b/src/xercesc/sax/SAXException.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.3 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.2 2002/11/04 14:56:26 tng * C++ Namespace Support. * @@ -76,18 +79,20 @@ XERCES_CPP_NAMESPACE_BEGIN // SAXNotSupportedException Constructors -SAXNotSupportedException::SAXNotSupportedException() - : SAXException() +SAXNotSupportedException::SAXNotSupportedException(MemoryManager* const manager) + : SAXException(manager) { } -SAXNotSupportedException::SAXNotSupportedException(const XMLCh* const msg) - : SAXException(msg) +SAXNotSupportedException::SAXNotSupportedException(const XMLCh* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) { } -SAXNotSupportedException::SAXNotSupportedException(const char* const msg) - : SAXException(msg) +SAXNotSupportedException::SAXNotSupportedException(const char* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) { } @@ -97,18 +102,20 @@ SAXNotSupportedException::SAXNotSupportedException(const SAXException& toCopy) } // SAXNotRecognizedException Constructors -SAXNotRecognizedException::SAXNotRecognizedException() - : SAXException() +SAXNotRecognizedException::SAXNotRecognizedException(MemoryManager* const manager) + : SAXException(manager) { } -SAXNotRecognizedException::SAXNotRecognizedException(const XMLCh* const msg) - : SAXException(msg) +SAXNotRecognizedException::SAXNotRecognizedException(const XMLCh* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) { } -SAXNotRecognizedException::SAXNotRecognizedException(const char* const msg) - : SAXException(msg) +SAXNotRecognizedException::SAXNotRecognizedException(const char* const msg, + MemoryManager* const manager) + : SAXException(msg, manager) { } diff --git a/src/xercesc/sax/SAXException.hpp b/src/xercesc/sax/SAXException.hpp index b15472cacd707ec4d89704b20ede60abeeffc5a7..d0f4b96e40edd30579b426539381ee9d12c325f8 100644 --- a/src/xercesc/sax/SAXException.hpp +++ b/src/xercesc/sax/SAXException.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.4 2003/05/15 18:27:05 knoaman * Partial implementation of the configurable memory manager. * @@ -138,9 +141,10 @@ public: //@{ /** Default constructor */ - SAXException() : + SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : - fMsg(XMLString::replicate(XMLUni::fgZeroLenString)) + fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager)) + , fMemoryManager(manager) { } @@ -149,9 +153,11 @@ public: * * @param msg The error or warning message. */ - SAXException(const XMLCh* const msg) : + SAXException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : - fMsg(XMLString::replicate(msg)) + fMsg(XMLString::replicate(msg, manager)) + , fMemoryManager(manager) { } @@ -160,9 +166,11 @@ public: * * @param msg The error or warning message. */ - SAXException(const char* const msg) : + SAXException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) : - fMsg(XMLString::transcode(msg)) + fMsg(XMLString::transcode(msg, manager)) + , fMemoryManager(manager) { } @@ -173,14 +181,15 @@ public: */ SAXException(const SAXException& toCopy) : - fMsg(XMLString::replicate(toCopy.fMsg)) + fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager)) + , fMemoryManager(toCopy.fMemoryManager) { } /** Destructor */ virtual ~SAXException() { - delete [] fMsg; + fMemoryManager->deallocate(fMsg);//delete [] fMsg; } //@} @@ -198,8 +207,9 @@ public: if (this == &toCopy) return *this; - delete [] fMsg; - fMsg = XMLString::replicate(toCopy.fMsg); + fMemoryManager->deallocate(fMsg);//delete [] fMsg; + fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager); + fMemoryManager = toCopy.fMemoryManager; return *this; } //@} @@ -225,27 +235,30 @@ protected : // This is the text of the error that is being thrown. // ----------------------------------------------------------------------- XMLCh* fMsg; + MemoryManager* fMemoryManager; }; class SAX_EXPORT SAXNotSupportedException : public SAXException { public: - SAXNotSupportedException(); + SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Create a new SAXException. * * @param msg The error or warning message. */ - SAXNotSupportedException(const XMLCh* const msg); + SAXNotSupportedException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Create a new SAXException. * * @param msg The error or warning message. */ - SAXNotSupportedException(const char* const msg); + SAXNotSupportedException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Copy constructor @@ -258,21 +271,23 @@ public: class SAX_EXPORT SAXNotRecognizedException : public SAXException { public: - SAXNotRecognizedException(); + SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Create a new SAXException. * * @param msg The error or warning message. */ - SAXNotRecognizedException(const XMLCh* const msg); + SAXNotRecognizedException(const XMLCh* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Create a new SAXException. * * @param msg The error or warning message. */ - SAXNotRecognizedException(const char* const msg); + SAXNotRecognizedException(const char* const msg, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** * Copy constructor diff --git a/src/xercesc/sax/SAXParseException.cpp b/src/xercesc/sax/SAXParseException.cpp index 15ce775316050352aec76c7707266587f13f25c2..dcf9c24760fa15e5ac07d3f128b8fb1f5a682ec6 100644 --- a/src/xercesc/sax/SAXParseException.cpp +++ b/src/xercesc/sax/SAXParseException.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.4 2003/04/21 21:07:38 knoaman * Use XMLString::release to prepare for configurable memory manager. * @@ -102,12 +105,13 @@ XERCES_CPP_NAMESPACE_BEGIN // SAXParseException: Constructors and Destructor // --------------------------------------------------------------------------- SAXParseException::SAXParseException(const XMLCh* const message - , const Locator& locator) : - SAXException(message) + , const Locator& locator + , MemoryManager* const manager) : + SAXException(message, manager) , fColumnNumber(locator.getColumnNumber()) , fLineNumber(locator.getLineNumber()) - , fPublicId(XMLString::replicate(locator.getPublicId())) - , fSystemId(XMLString::replicate(locator.getSystemId())) + , fPublicId(XMLString::replicate(locator.getPublicId(), manager)) + , fSystemId(XMLString::replicate(locator.getSystemId(), manager)) { } @@ -115,12 +119,13 @@ SAXParseException::SAXParseException(const XMLCh* const message , const XMLCh* const publicId , const XMLCh* const systemId , const XMLSSize_t lineNumber - , const XMLSSize_t columnNumber) : - SAXException(message) + , const XMLSSize_t columnNumber + , MemoryManager* const manager) : + SAXException(message, manager) , fColumnNumber(columnNumber) , fLineNumber(lineNumber) - , fPublicId(XMLString::replicate(publicId)) - , fSystemId(XMLString::replicate(systemId)) + , fPublicId(XMLString::replicate(publicId, manager)) + , fSystemId(XMLString::replicate(systemId, manager)) { } @@ -132,14 +137,14 @@ SAXParseException::SAXParseException(const SAXParseException& toCopy) : , fPublicId(0) , fSystemId(0) { - fPublicId = XMLString::replicate(toCopy.fPublicId); - fSystemId = XMLString::replicate(toCopy.fSystemId); + fPublicId = XMLString::replicate(toCopy.fPublicId, toCopy.fMemoryManager); + fSystemId = XMLString::replicate(toCopy.fSystemId, toCopy.fMemoryManager); } SAXParseException::~SAXParseException() { - XMLString::release(&fPublicId); - XMLString::release(&fSystemId); + fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); + fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); } @@ -152,14 +157,15 @@ SAXParseException::operator=(const SAXParseException& toAssign) if (this == &toAssign) return *this; + fMemoryManager->deallocate(fPublicId);//XMLString::release(&fPublicId); + fMemoryManager->deallocate(fSystemId);//XMLString::release(&fSystemId); + this->SAXException::operator =(toAssign); fColumnNumber = toAssign.fColumnNumber; fLineNumber = toAssign.fLineNumber; - XMLString::release(&fPublicId); - XMLString::release(&fSystemId); - fPublicId = XMLString::replicate(toAssign.fPublicId); - fSystemId = XMLString::replicate(toAssign.fSystemId); + fPublicId = XMLString::replicate(toAssign.fPublicId, fMemoryManager); + fSystemId = XMLString::replicate(toAssign.fSystemId, fMemoryManager); return *this; } diff --git a/src/xercesc/sax/SAXParseException.hpp b/src/xercesc/sax/SAXParseException.hpp index 4f5b1f4c859e1edc2ecfa312d1f2f038362b9aec..c9fd2c6e2075b525e3a669d26968a2a5f10453ba 100644 --- a/src/xercesc/sax/SAXParseException.hpp +++ b/src/xercesc/sax/SAXParseException.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/08/13 15:43:24 knoaman + * Use memory manager when creating SAX exceptions. + * * Revision 1.4 2003/05/15 18:27:05 knoaman * Partial implementation of the configurable memory manager. * @@ -132,7 +135,8 @@ public: * @see Locator#Locator * @see Parser#setLocale */ - SAXParseException(const XMLCh* const message, const Locator& locator); + SAXParseException(const XMLCh* const message, const Locator& locator, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** @@ -161,6 +165,7 @@ public: , const XMLCh* const systemId , const XMLSSize_t lineNumber , const XMLSSize_t columnNumber + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /**