You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dm...@apache.org on 2004/11/08 20:20:06 UTC
cvs commit: xml-xalan/c/src/xalanc/XalanTransformer XalanCAPI.cpp XalanCAPI.h XalanCompiledStylesheetDefault.cpp XalanCompiledStylesheetDefault.hpp XalanDefaultDocumentBuilder.cpp XalanDefaultDocumentBuilder.hpp XalanDefaultParsedSource.cpp XalanDefaultParsedSource.hpp XalanDocumentBuilder.hpp XalanParsedSource.hpp XalanSourceTreeWrapperParsedSource.cpp XalanSourceTreeWrapperParsedSource.hpp XalanTransformer.cpp XalanTransformer.hpp XalanTransformerOutputStream.cpp XalanTransformerOutputStream.hpp XalanTransformerProblemListener.cpp XalanTransformerProblemListener.hpp XercesDOMParsedSource.cpp XercesDOMParsedSource.hpp XercesDOMWrapperParsedSource.cpp XercesDOMWrapperParsedSource.hpp
dmitryh 2004/11/08 11:20:06
Modified: c/src/xalanc/XalanTransformer XalanCAPI.cpp XalanCAPI.h
XalanCompiledStylesheetDefault.cpp
XalanCompiledStylesheetDefault.hpp
XalanDefaultDocumentBuilder.cpp
XalanDefaultDocumentBuilder.hpp
XalanDefaultParsedSource.cpp
XalanDefaultParsedSource.hpp
XalanDocumentBuilder.hpp XalanParsedSource.hpp
XalanSourceTreeWrapperParsedSource.cpp
XalanSourceTreeWrapperParsedSource.hpp
XalanTransformer.cpp XalanTransformer.hpp
XalanTransformerOutputStream.cpp
XalanTransformerOutputStream.hpp
XalanTransformerProblemListener.cpp
XalanTransformerProblemListener.hpp
XercesDOMParsedSource.cpp XercesDOMParsedSource.hpp
XercesDOMWrapperParsedSource.cpp
XercesDOMWrapperParsedSource.hpp
Log:
Initial implementation on the pluggable memory management
Revision Changes Path
1.5 +35 -12 xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.cpp
Index: XalanCAPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanCAPI.cpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanCAPI.cpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -33,6 +33,7 @@
#include "XalanCAPI.h"
#include "XalanTransformer.hpp"
+#include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
XALAN_USING_STD(istrstream)
@@ -42,8 +43,11 @@
XALAN_USING_XALAN(XalanParsedSource)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_XERCES(XMLPlatformUtils)
+XALAN_USING_XALAN(MemoryManagerType)
-
+XALAN_USING_XALAN(XalanMemMgrAutoPtr)
+XALAN_USING_XALAN(XalanMemMgrs)
+XALAN_USING_XALAN(XSLTResultTarget)
static bool fInitialized = false;
@@ -58,7 +62,7 @@
XMLPlatformUtils::Initialize();
// Initialize Xalan.
- XalanTransformer::initialize();
+ XalanTransformer::initialize(XalanMemMgrs::getDefaultXercesMemMgr());
fInitialized = true;
}
@@ -93,8 +97,20 @@
XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanHandle)
CreateXalanTransformer()
{
+ MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
// Create a XalanTransformer object.
- return new XalanTransformer();
+ typedef XalanTransformer ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(theManager);
+
+ theGuard.release();
+
+ return (XalanHandle)theResult;
+
}
@@ -145,7 +161,14 @@
DeleteXalanTransformer(XalanHandle theXalanHandle)
{
// Delete a XalanTransformer object.
- delete getTransformer(theXalanHandle);
+
+ XalanTransformer* transformer = getTransformer(theXalanHandle);
+
+ transformer->~XalanTransformer();
+
+ XalanMemMgrs::getDefaultXercesMemMgr().deallocate(transformer);
+
+
}
@@ -161,14 +184,14 @@
{
return getTransformer(theXalanHandle)->transform(
theXMLFileName,
- theOutFileName);
+ XSLTResultTarget(theOutFileName, XalanMemMgrs::getDefaultXercesMemMgr()));
}
else
{
return getTransformer(theXalanHandle)->transform(
theXMLFileName,
theXSLFileName,
- theOutFileName);
+ XSLTResultTarget(theOutFileName, XalanMemMgrs::getDefaultXercesMemMgr()));
}
}
@@ -185,7 +208,7 @@
return getTransformer(theXalanHandle)->transform(
*getParsedSource(theParsedSource),
getStylesheet(theCSSHandle),
- theOutFileName);
+ XSLTResultTarget(theOutFileName, XalanMemMgrs::getDefaultXercesMemMgr()));
}
@@ -207,14 +230,14 @@
{
status = getTransformer(theXalanHandle)->transform(
theXMLFileName,
- theOutputStream);
+ XSLTResultTarget(theOutputStream, XalanMemMgrs::getDefaultXercesMemMgr()));
}
else
{
status = getTransformer(theXalanHandle)->transform(
theXMLFileName,
theXSLFileName,
- theOutputStream);
+ XSLTResultTarget(theOutputStream, XalanMemMgrs::getDefaultXercesMemMgr()));
}
if (status == 0)
@@ -246,7 +269,7 @@
getTransformer(theXalanHandle)->transform(
*getParsedSource(theParsedSource),
getStylesheet(theCSSHandle),
- theOutputStream);
+ XSLTResultTarget(theOutputStream, XalanMemMgrs::getDefaultXercesMemMgr()));
if (status == 0)
{
@@ -448,8 +471,8 @@
XalanHandle theXalanHandle)
{
getTransformer(theXalanHandle)->setStylesheetParam(
- XalanDOMString(key),
- XalanDOMString(expression));
+ XalanDOMString(key, XalanMemMgrs::getDefaultXercesMemMgr()),
+ XalanDOMString(expression, XalanMemMgrs::getDefaultXercesMemMgr()));
}
1.5 +1 -4 xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.h
Index: XalanCAPI.h
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanCAPI.h 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanCAPI.h 8 Nov 2004 19:20:04 -0000 1.5
@@ -108,11 +108,8 @@
* @return the XalanTransformer handle
*/
XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanHandle)
-#if defined(__cplusplus)
CreateXalanTransformer();
-#else
- CreateXalanTransformer(void);
-#endif
+
/**
* Delete a XalanTransformer instance.
1.5 +27 -1 xml-xalan/c/src/xalanc/XalanTransformer/XalanCompiledStylesheetDefault.cpp
Index: XalanCompiledStylesheetDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanCompiledStylesheetDefault.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanCompiledStylesheetDefault.cpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanCompiledStylesheetDefault.cpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -86,13 +86,15 @@
XalanCompiledStylesheetDefault::XalanCompiledStylesheetDefault(
+ MemoryManagerType& theManager,
const XSLTInputSource& theStylesheetSource,
XSLTEngineImpl& theProcessor,
ErrorHandlerType* theErrorHandler,
EntityResolverType* theEntityResolver):
XalanCompiledStylesheet(),
- m_stylesheetXPathFactory(),
+ m_stylesheetXPathFactory(theManager),
m_stylesheetConstructionContext(
+ theManager,
theProcessor,
m_stylesheetXPathFactory),
m_stylesheetRoot(compileStylesheet(
@@ -104,7 +106,31 @@
{
}
+XalanCompiledStylesheetDefault*
+XalanCompiledStylesheetDefault::create(
+ MemoryManagerType& theManager,
+ const XSLTInputSource& theStylesheetSource,
+ XSLTEngineImpl& theProcessor,
+ ErrorHandlerType* theErrorHandler,
+ EntityResolverType* theEntityResolver)
+{
+ typedef XalanCompiledStylesheetDefault ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(
+ theManager,
+ theStylesheetSource,
+ theProcessor,
+ theErrorHandler,
+ theEntityResolver);
+
+ theGuard.release();
+
+ return theResult;
+}
XalanCompiledStylesheetDefault::~XalanCompiledStylesheetDefault()
{
1.5 +10 -0 xml-xalan/c/src/xalanc/XalanTransformer/XalanCompiledStylesheetDefault.hpp
Index: XalanCompiledStylesheetDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanCompiledStylesheetDefault.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanCompiledStylesheetDefault.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanCompiledStylesheetDefault.hpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -59,6 +59,16 @@
public:
XalanCompiledStylesheetDefault(
+ MemoryManagerType& theManager,
+ const XSLTInputSource& theStylesheetSource,
+ XSLTEngineImpl& theProcessor,
+ ErrorHandlerType* theErrorHandler = 0,
+ EntityResolverType* theEntityResolver = 0);
+
+
+ static XalanCompiledStylesheetDefault*
+ create(
+ MemoryManagerType& theManager,
const XSLTInputSource& theStylesheetSource,
XSLTEngineImpl& theProcessor,
ErrorHandlerType* theErrorHandler = 0,
1.6 +21 -6 xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultDocumentBuilder.cpp
Index: XalanDefaultDocumentBuilder.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultDocumentBuilder.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanDefaultDocumentBuilder.cpp 13 Mar 2004 00:44:55 -0000 1.5
+++ XalanDefaultDocumentBuilder.cpp 8 Nov 2004 19:20:04 -0000 1.6
@@ -30,16 +30,31 @@
-XalanDefaultDocumentBuilder::XalanDefaultDocumentBuilder(const XalanDOMString& theURI) :
+XalanDefaultDocumentBuilder::XalanDefaultDocumentBuilder(MemoryManagerType& theManager,
+ const XalanDOMString& theURI) :
m_domSupport(),
- m_parserLiaison(),
- m_contentHandler(m_parserLiaison.createXalanSourceTreeDocument()),
- m_uri(theURI)
+ m_parserLiaison(theManager),
+ m_contentHandler(theManager, m_parserLiaison.createXalanSourceTreeDocument()),
+ m_uri(theURI,theManager)
{
m_domSupport.setParserLiaison(&m_parserLiaison);
}
+XalanDefaultDocumentBuilder*
+XalanDefaultDocumentBuilder::create(MemoryManagerType& theManager, const XalanDOMString& theURI)
+{
+ typedef XalanDefaultDocumentBuilder ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(theManager, theURI);
+ theGuard.release();
+
+ return theResult;
+}
XalanDefaultDocumentBuilder::~XalanDefaultDocumentBuilder()
{
@@ -56,9 +71,9 @@
XalanParsedSourceHelper*
-XalanDefaultDocumentBuilder::createHelper() const
+XalanDefaultDocumentBuilder::createHelper(MemoryManagerType& theManager) const
{
- return new XalanDefaultParsedSourceHelper(m_domSupport);
+ return XalanDefaultParsedSourceHelper::create(m_domSupport, theManager);
}
1.5 +6 -2 xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultDocumentBuilder.hpp
Index: XalanDefaultDocumentBuilder.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultDocumentBuilder.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanDefaultDocumentBuilder.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanDefaultDocumentBuilder.hpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -43,6 +43,7 @@
*/
class XALAN_TRANSFORMER_EXPORT XalanDefaultDocumentBuilder : public XalanDocumentBuilder
{
+
public:
/**
@@ -50,7 +51,10 @@
*
* @param theURI An optional string to identify the document.
*/
- XalanDefaultDocumentBuilder(const XalanDOMString& theURI = XalanDOMString());
+ XalanDefaultDocumentBuilder(MemoryManagerType& theManager, const XalanDOMString& theURI);
+
+ static XalanDefaultDocumentBuilder*
+ create(MemoryManagerType& theManager, const XalanDOMString& theURI);
virtual
~XalanDefaultDocumentBuilder();
@@ -59,7 +63,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper() const;
+ createHelper(MemoryManagerType& theManager) const;
virtual const XalanDOMString&
getURI() const;
1.6 +122 -71 xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp
Index: XalanDefaultParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanDefaultParsedSource.cpp 28 Oct 2004 19:40:06 -0000 1.5
+++ XalanDefaultParsedSource.cpp 8 Nov 2004 19:20:04 -0000 1.6
@@ -66,49 +66,68 @@
const XalanDOMString&
XalanDefaultParsedSourceDOMSupport::getUnparsedEntityURI(
- const XalanDOMString& theName,
- const XalanDocument& theDocument) const
-{
- // Check the wrapped XalanSourceTreeDOMSupport instance...
- const XalanDOMString& theURI =
- m_domSupport.getUnparsedEntityURI(
- theName,
- theDocument);
-
- if (length(theURI) != 0)
- {
- return theURI;
- }
- else
- {
- // Chain up to our parent...
- return XalanSourceTreeDOMSupport::getUnparsedEntityURI(
- theName,
- theDocument);
- }
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument,
+ XalanDOMString& theResult ) const
+{
+ // Check the wrapped XalanSourceTreeDOMSupport instance...
+ const XalanDOMString& theURI =
+ m_domSupport.getUnparsedEntityURI(
+ theName,
+ theDocument,
+ theResult);
+
+ if (length(theURI) != 0)
+ {
+ return theURI;
+ }
+ else
+ {
+ // Chain up to our parent...
+ return XalanSourceTreeDOMSupport::getUnparsedEntityURI(
+ theName,
+ theDocument,
+ theResult);
+ }
}
bool
XalanDefaultParsedSourceDOMSupport::isNodeAfter(
- const XalanNode& node1,
- const XalanNode& node2) const
+ const XalanNode& node1,
+ const XalanNode& node2) const
{
- return m_domSupport.isNodeAfter(
- node1,
- node2);
+ return m_domSupport.isNodeAfter(
+ node1,
+ node2);
}
-XalanDefaultParsedSourceHelper::XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport& theSourceDOMSupport) :
- m_parserLiaison(),
- m_domSupport(m_parserLiaison, theSourceDOMSupport)
+XalanDefaultParsedSourceHelper::XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport& theSourceDOMSupport,
+ MemoryManagerType& theManager) :
+ m_parserLiaison(theManager),
+ m_domSupport(m_parserLiaison, theSourceDOMSupport)
{
}
+XalanDefaultParsedSourceHelper*
+XalanDefaultParsedSourceHelper::create(const XalanSourceTreeDOMSupport& theSourceDOMSupport,
+ MemoryManagerType& theManager)
+{
+ typedef XalanDefaultParsedSourceHelper ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+ new (theResult) ThisType(theSourceDOMSupport, theManager);
+
+ theGuard.release();
+
+ return theResult;
+}
XalanDefaultParsedSourceHelper::~XalanDefaultParsedSourceHelper()
{
@@ -119,7 +138,7 @@
DOMSupport&
XalanDefaultParsedSourceHelper::getDOMSupport()
{
- return m_domSupport;
+ return m_domSupport;
}
@@ -127,56 +146,88 @@
XMLParserLiaison&
XalanDefaultParsedSourceHelper::getParserLiaison()
{
- return m_parserLiaison;
+ return m_parserLiaison;
}
XalanDefaultParsedSource::XalanDefaultParsedSource(
- const InputSourceType& theInputSource,
- bool fValidate,
- ErrorHandlerType* theErrorHandler,
- EntityResolverType* theEntityResolver,
- const XalanDOMChar* theExternalSchemaLocation,
- const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
+ const InputSourceType& theInputSource,
+ MemoryManagerType& theManager,
+ bool fValidate,
+ ErrorHandlerType* theErrorHandler,
+ EntityResolverType* theEntityResolver,
+ const XalanDOMChar* theExternalSchemaLocation,
+ const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
bool fPoolAllTextNodes) :
- XalanParsedSource(),
- m_parserLiaison(),
- m_domSupport(m_parserLiaison),
- m_parsedSource(0)
-{
- m_parserLiaison.setUseValidation(fValidate);
- m_parserLiaison.setEntityResolver(theEntityResolver);
- m_parserLiaison.setErrorHandler(theErrorHandler);
- m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
- m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
+ XalanParsedSource(),
+ m_parserLiaison(theManager),
+ m_domSupport(m_parserLiaison),
+ m_parsedSource(0),
+ m_uri(theManager)
+{
+ m_parserLiaison.setUseValidation(fValidate);
+ m_parserLiaison.setEntityResolver(theEntityResolver);
+ m_parserLiaison.setErrorHandler(theErrorHandler);
+ m_parserLiaison.setExternalSchemaLocation(theExternalSchemaLocation);
+ m_parserLiaison.setExternalNoNamespaceSchemaLocation(theExternalNoNamespaceSchemaLocation);
m_parserLiaison.setPoolAllText(fPoolAllTextNodes);
- m_parsedSource = m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource));
- assert(m_parsedSource != 0);
+ m_parsedSource = m_parserLiaison.mapDocument(m_parserLiaison.parseXMLStream(theInputSource));
+ assert(m_parsedSource != 0);
- m_domSupport.setParserLiaison(&m_parserLiaison);
+ m_domSupport.setParserLiaison(&m_parserLiaison);
- const XalanDOMChar* const theSystemID = theInputSource.getSystemId();
+ const XalanDOMChar* const theSystemID = theInputSource.getSystemId();
- if (theSystemID != 0)
- {
- try
- {
- m_uri = URISupport::getURLStringFromString(theSystemID);
- }
- catch(const XERCES_CPP_NAMESPACE_QUALIFIER XMLException&)
- {
- // Assume that any exception here relates to get the url from
- // the system ID. We'll assume that it's just a fake base identifier
- // since the parser would have thrown an error if the system ID
- // wasn't resolved.
- m_uri = theSystemID;
- }
- }
-}
+ if (theSystemID != 0)
+ {
+ try
+ {
+ URISupport::getURLStringFromString(theSystemID, m_uri);
+ }
+ catch(const XERCES_CPP_NAMESPACE_QUALIFIER XMLException&)
+ {
+ // Assume that any exception here relates to get the url from
+ // the system ID. We'll assume that it's just a fake base identifier
+ // since the parser would have thrown an error if the system ID
+ // wasn't resolved.
+ m_uri = theSystemID;
+ }
+ }
+}
+
+XalanDefaultParsedSource*
+XalanDefaultParsedSource::create(
+ MemoryManagerType& theManager,
+ const InputSourceType& theInputSource,
+ bool fValidate,
+ ErrorHandlerType* theErrorHandler,
+ EntityResolverType* theEntityResolver,
+ const XalanDOMChar* theExternalSchemaLocation,
+ const XalanDOMChar* theExternalNoNamespaceSchemaLocation,
+ bool fPoolAllTextNodes)
+{
+ typedef XalanDefaultParsedSource ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(
+ theInputSource,
+ theManager,
+ fValidate,
+ theErrorHandler,
+ theEntityResolver,
+ theExternalSchemaLocation,
+ theExternalNoNamespaceSchemaLocation,
+ fPoolAllTextNodes);
+ theGuard.release();
+ return theResult;
+}
XalanDefaultParsedSource::~XalanDefaultParsedSource()
{
@@ -184,18 +235,18 @@
-XalanDocument*
+XalanDocument*
XalanDefaultParsedSource::getDocument() const
{
- return m_parsedSource;
+ return m_parsedSource;
}
XalanParsedSourceHelper*
-XalanDefaultParsedSource::createHelper() const
+XalanDefaultParsedSource::createHelper(MemoryManagerType& theManager) const
{
- return new XalanDefaultParsedSourceHelper(m_domSupport);
+ return XalanDefaultParsedSourceHelper::create(m_domSupport, theManager);
}
@@ -203,7 +254,7 @@
const XalanDOMString&
XalanDefaultParsedSource::getURI() const
{
- return m_uri;
+ return m_uri;
}
1.6 +82 -64 xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp
Index: XalanDefaultParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDefaultParsedSource.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanDefaultParsedSource.hpp 28 Oct 2004 19:40:06 -0000 1.5
+++ XalanDefaultParsedSource.hpp 8 Nov 2004 19:20:04 -0000 1.6
@@ -45,39 +45,40 @@
{
public:
- XalanDefaultParsedSourceDOMSupport(
- const XalanSourceTreeParserLiaison& theParserLiaison,
- const XalanSourceTreeDOMSupport& theDOMSupport);
-
- virtual
- ~XalanDefaultParsedSourceDOMSupport();
-
- virtual void
- reset();
-
- // These interfaces are inherited from DOMSupport...
-
- virtual const XalanDOMString&
- getUnparsedEntityURI(
- const XalanDOMString& theName,
- const XalanDocument& theDocument) const;
-
- virtual bool
- isNodeAfter(
- const XalanNode& node1,
- const XalanNode& node2) const;
+ XalanDefaultParsedSourceDOMSupport(
+ const XalanSourceTreeParserLiaison& theParserLiaison,
+ const XalanSourceTreeDOMSupport& theDOMSupport);
+
+ virtual
+ ~XalanDefaultParsedSourceDOMSupport();
+
+ virtual void
+ reset();
+
+ // These interfaces are inherited from DOMSupport...
+
+ virtual const XalanDOMString&
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument,
+ XalanDOMString& theResult) const;
+
+ virtual bool
+ isNodeAfter(
+ const XalanNode& node1,
+ const XalanNode& node2) const;
private:
- // Not implemented...
- XalanDefaultParsedSourceDOMSupport(const XalanDefaultParsedSourceDOMSupport&);
+ // Not implemented...
+ XalanDefaultParsedSourceDOMSupport(const XalanDefaultParsedSourceDOMSupport&);
- XalanDefaultParsedSourceDOMSupport&
- operator=(const XalanDefaultParsedSourceDOMSupport&);
+ XalanDefaultParsedSourceDOMSupport&
+ operator=(const XalanDefaultParsedSourceDOMSupport&);
- // Data members...
- const XalanSourceTreeDOMSupport& m_domSupport;
+ // Data members...
+ const XalanSourceTreeDOMSupport& m_domSupport;
};
@@ -86,29 +87,34 @@
{
public:
- XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport& theSourceDOMSupport);
+ XalanDefaultParsedSourceHelper(const XalanSourceTreeDOMSupport& theSourceDOMSupport,
+ MemoryManagerType& theManager);
- ~XalanDefaultParsedSourceHelper();
+ static XalanDefaultParsedSourceHelper*
+ create(const XalanSourceTreeDOMSupport& theSourceDOMSupport,
+ MemoryManagerType& theManager);
- virtual DOMSupport&
- getDOMSupport();
+ ~XalanDefaultParsedSourceHelper();
- virtual XMLParserLiaison&
- getParserLiaison();
+ virtual DOMSupport&
+ getDOMSupport();
+
+ virtual XMLParserLiaison&
+ getParserLiaison();
private:
- // Not implemented...
- XalanDefaultParsedSourceHelper(const XalanDefaultParsedSourceHelper&);
+ // Not implemented...
+ XalanDefaultParsedSourceHelper(const XalanDefaultParsedSourceHelper&);
- XalanDefaultParsedSourceHelper&
- operator=(const XalanDefaultParsedSourceHelper&);
+ XalanDefaultParsedSourceHelper&
+ operator=(const XalanDefaultParsedSourceHelper&);
- // Data members...
- XalanSourceTreeParserLiaison m_parserLiaison;
+ // Data members...
+ XalanSourceTreeParserLiaison m_parserLiaison;
- XalanDefaultParsedSourceDOMSupport m_domSupport;
+ XalanDefaultParsedSourceDOMSupport m_domSupport;
};
@@ -121,44 +127,56 @@
{
public:
- XalanDefaultParsedSource(
- const InputSourceType& theInputSource,
- bool fValidate = false,
- ErrorHandlerType* theErrorHandler = 0,
- EntityResolverType* theEntityResolver = 0,
- const XalanDOMChar* theExternalSchemaLocation = 0,
+ XalanDefaultParsedSource(
+ const InputSourceType& theInputSource,
+ MemoryManagerType& theManager,
+ bool fValidate = false,
+ ErrorHandlerType* theErrorHandler = 0,
+ EntityResolverType* theEntityResolver = 0,
+ const XalanDOMChar* theExternalSchemaLocation = 0,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0,
bool fPoolAllTextNodes = XalanSourceTreeDocument::getPoolAllTextNodes());
- virtual
- ~XalanDefaultParsedSource();
+ static XalanDefaultParsedSource*
+ create(
+ MemoryManagerType& theManager,
+ const InputSourceType& theInputSource,
+ bool fValidate = false,
+ ErrorHandlerType* theErrorHandler = 0,
+ EntityResolverType* theEntityResolver = 0,
+ const XalanDOMChar* theExternalSchemaLocation = 0,
+ const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0,
+ bool fPoolAllTextNodes = XalanSourceTreeDocument::getPoolAllTextNodes());
+
+ virtual
+ ~XalanDefaultParsedSource();
- virtual XalanDocument*
- getDocument() const;
+ virtual XalanDocument*
+ getDocument() const;
- virtual XalanParsedSourceHelper*
- createHelper() const;
+ virtual XalanParsedSourceHelper*
+ createHelper(MemoryManagerType& theManager) const;
- virtual const XalanDOMString&
- getURI() const;
+ virtual const XalanDOMString&
+ getURI() const;
private:
- // Not implemented...
- XalanDefaultParsedSource(const XalanDefaultParsedSource&);
+ // Not implemented...
+ XalanDefaultParsedSource(const XalanDefaultParsedSource&);
- XalanDefaultParsedSource&
- operator=(const XalanDefaultParsedSource&);
+ XalanDefaultParsedSource&
+ operator=(const XalanDefaultParsedSource&);
- // Data members...
- XalanSourceTreeParserLiaison m_parserLiaison;
+ // Data members...
+ XalanSourceTreeParserLiaison m_parserLiaison;
- XalanSourceTreeDOMSupport m_domSupport;
+ XalanSourceTreeDOMSupport m_domSupport;
- XalanSourceTreeDocument* m_parsedSource;
+ XalanSourceTreeDocument* m_parsedSource;
- XalanDOMString m_uri;
+ XalanDOMString m_uri;
};
@@ -167,7 +185,7 @@
-#endif // XALANDEFAULTPARSEDSOURCE_HEADER_GUARD
+#endif // XALANDEFAULTPARSEDSOURCE_HEADER_GUARD
1.5 +3 -1 xml-xalan/c/src/xalanc/XalanTransformer/XalanDocumentBuilder.hpp
Index: XalanDocumentBuilder.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanDocumentBuilder.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanDocumentBuilder.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanDocumentBuilder.hpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -22,6 +22,8 @@
#include <xalanc/XalanTransformer/XalanTransformerDefinitions.hpp>
+#include <xalanc/Include/XalanMemoryManagement.hpp>
+
// Base class include file.
#include <xalanc/XalanTransformer/XalanParsedSource.hpp>
@@ -67,7 +69,7 @@
getDocument() const = 0;
virtual XalanParsedSourceHelper*
- createHelper() const = 0;
+ createHelper(MemoryManagerType& theManager) const = 0;
virtual const XalanDOMString&
getURI() const = 0;
1.5 +3 -1 xml-xalan/c/src/xalanc/XalanTransformer/XalanParsedSource.hpp
Index: XalanParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanParsedSource.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanParsedSource.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanParsedSource.hpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -22,6 +22,8 @@
#include <xalanc/XalanTransformer/XalanTransformerDefinitions.hpp>
+#include <xalanc/Include/XalanMemoryManagement.hpp>
+
// We're bringing in XalanDocument so that its derivation from XalanNode
// is known...
@@ -97,7 +99,7 @@
* @return A pointer to a XalanParsedSourceHelper instance.
*/
virtual XalanParsedSourceHelper*
- createHelper() const = 0;
+ createHelper(MemoryManagerType& theManager) const = 0;
/**
* Get the URI for the parsed source, if any.
1.5 +8 -3 xml-xalan/c/src/xalanc/XalanTransformer/XalanSourceTreeWrapperParsedSource.cpp
Index: XalanSourceTreeWrapperParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanSourceTreeWrapperParsedSource.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanSourceTreeWrapperParsedSource.cpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanSourceTreeWrapperParsedSource.cpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -36,6 +36,7 @@
XalanSourceTreeWrapperParsedSource::XalanSourceTreeWrapperParsedSource(
+ MemoryManagerType& theManager,
XalanSourceTreeDocument* theDocument,
XalanSourceTreeParserLiaison& theParserLiaison,
XalanSourceTreeDOMSupport& theDOMSupport,
@@ -44,8 +45,12 @@
m_parserLiaison(theParserLiaison),
m_domSupport(theDOMSupport),
m_parsedSource(theDocument),
- m_uri(URISupport::NormalizeURIText(theURI))
+ m_uri(theURI, theManager)
{
+ XalanDOMString& refURI = const_cast<XalanDOMString&>(m_uri);
+
+ URISupport::NormalizeURIText(refURI);
+
assert(m_parsedSource != 0);
}
@@ -66,9 +71,9 @@
XalanParsedSourceHelper*
-XalanSourceTreeWrapperParsedSource::createHelper() const
+XalanSourceTreeWrapperParsedSource::createHelper(MemoryManagerType& theManager) const
{
- return new XalanDefaultParsedSourceHelper(m_domSupport);
+ return XalanDefaultParsedSourceHelper::create(m_domSupport, theManager);
}
1.5 +4 -2 xml-xalan/c/src/xalanc/XalanTransformer/XalanSourceTreeWrapperParsedSource.hpp
Index: XalanSourceTreeWrapperParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanSourceTreeWrapperParsedSource.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanSourceTreeWrapperParsedSource.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanSourceTreeWrapperParsedSource.hpp 8 Nov 2004 19:20:04 -0000 1.5
@@ -47,13 +47,15 @@
*/
class XALAN_TRANSFORMER_EXPORT XalanSourceTreeWrapperParsedSource : public XalanParsedSource
{
+
public:
XalanSourceTreeWrapperParsedSource(
+ MemoryManagerType& theManager,
XalanSourceTreeDocument* theDocument,
XalanSourceTreeParserLiaison& theParserLiaison,
XalanSourceTreeDOMSupport& theDOMSupport,
- const XalanDOMString& theURI = XalanDOMString());
+ const XalanDOMString& theURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
virtual
~XalanSourceTreeWrapperParsedSource();
@@ -62,7 +64,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper() const;
+ createHelper(MemoryManagerType& theManager) const;
virtual const XalanDOMString&
getURI() const;
1.18 +195 -108 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XalanTransformer.cpp 28 Oct 2004 19:40:06 -0000 1.17
+++ XalanTransformer.cpp 8 Nov 2004 19:20:04 -0000 1.18
@@ -29,6 +29,8 @@
#include <xercesc/sax/SAXParseException.hpp>
+#include <xalanc/Include/XalanMemMgrHelper.hpp>
+
#include <xalanc/XalanDOM/XalanDOMException.hpp>
@@ -99,44 +101,50 @@
const XSLTInit* XalanTransformer::s_xsltInit = 0;
+static MemoryManagerType* s_initMemoryManager = 0;
-XalanTransformer::XalanTransformer():
- m_compiledStylesheets(),
- m_parsedSources(),
- m_paramPairs(),
- m_functionPairs(),
- m_traceListeners(),
- m_errorMessage(1, '\0'),
+XalanTransformer::XalanTransformer(MemoryManagerType& theManager):
+ m_memoryManager(theManager),
+ m_compiledStylesheets(m_memoryManager),
+ m_parsedSources(m_memoryManager),
+ m_paramPairs(m_memoryManager),
+ m_functionPairs(m_memoryManager),
+ m_traceListeners(m_memoryManager),
+ m_errorMessage(1, '\0', m_memoryManager),
m_useValidation(false),
m_entityResolver(0),
m_errorHandler(0),
- m_externalSchemaLocation(),
- m_externalNoNamespaceSchemaLocation(),
+ m_externalSchemaLocation(m_memoryManager),
+ m_externalNoNamespaceSchemaLocation(m_memoryManager),
m_problemListener(0),
#if defined(XALAN_NO_STD_NAMESPACE)
m_warningStream(&cerr),
#else
m_warningStream(&std::cerr),
#endif
- m_outputEncoding(),
- m_poolAllTextNodes(XalanSourceTreeDocument::getPoolAllTextNodes()),
- m_stylesheetExecutionContext(new StylesheetExecutionContextDefault)
+ m_outputEncoding(m_memoryManager),
+ m_stylesheetExecutionContext(StylesheetExecutionContextDefault::create(m_memoryManager))
{
#if defined(XALAN_USE_ICU)
// Create a collation function for the ICU, and have it
// cache collators...
- XalanAutoPtr<ICUBridgeCollationCompareFunctor> theICUFunctor(new ICUBridgeCollationCompareFunctor(true));
+ XalanMemMgrAutoPtr<ICUBridgeCollationCompareFunctor, true> theICUFunctor(m_memoryManager, ICUBridgeCollationCompareFunctor::create(m_memoryManager, true));
m_stylesheetExecutionContext->installCollationCompareFunctor(theICUFunctor.get());
- XalanAutoPtr<ICUFormatNumberFunctor> theFormatNumberFunctor(new ICUFormatNumberFunctor());
+ XalanMemMgrAutoPtr<ICUFormatNumberFunctor, true> theFormatNumberFunctor(m_memoryManager, ICUFormatNumberFunctor::create(m_memoryManager));
m_stylesheetExecutionContext->installFormatNumberFunctor(theFormatNumberFunctor.get());
theICUFunctor.release();
theFormatNumberFunctor.release();
+
#endif
}
-
+MemoryManagerType&
+XalanTransformer::getMemoryManager()
+{
+ return m_memoryManager;
+}
XalanTransformer::~XalanTransformer()
{
@@ -145,41 +153,60 @@
// Clean up all entries in the compliledStylesheets vector.
for_each(m_compiledStylesheets.begin(),
m_compiledStylesheets.end(),
- DeleteFunctor<XalanCompiledStylesheet>());
+ DeleteFunctor<XalanCompiledStylesheet>(m_memoryManager));
// Clean up all entries in the compliledStylesheets vector.
for_each(m_parsedSources.begin(),
m_parsedSources.end(),
- DeleteFunctor<XalanParsedSource>());
+ DeleteFunctor<XalanParsedSource>(m_memoryManager));
for (FunctionParamPairVectorType::size_type i = 0; i < m_functionPairs.size(); ++i)
{
- delete m_functionPairs[i].second;
+ if(m_functionPairs[i].second!= 0)
+ {
+ m_functionPairs[i].second->~Function();
+
+ m_memoryManager.deallocate(m_functionPairs[i].second);
+ }
+ }
+
+ typedef ParamPairVectorType::iterator iterator;
+
+ for (iterator j = m_paramPairs.begin(); j != m_paramPairs.end(); ++j)
+ {
+
+ destroyObjWithMemMgr((*j).first, m_memoryManager);
+ destroyObjWithMemMgr((*j).second, m_memoryManager);
}
#if defined(XALAN_USE_ICU)
// Uninstall the ICU collation compare functor, and destroy it...
- delete m_stylesheetExecutionContext->uninstallCollationCompareFunctor();
- delete m_stylesheetExecutionContext->uninstallFormatNumberFunctor();
+
+ destroyObjWithMemMgr( m_stylesheetExecutionContext->uninstallCollationCompareFunctor(), m_memoryManager);
+ destroyObjWithMemMgr( m_stylesheetExecutionContext->uninstallFormatNumberFunctor(), m_memoryManager);
#endif
- delete m_stylesheetExecutionContext;
-}
+ m_stylesheetExecutionContext->~StylesheetExecutionContextDefault();
+ m_memoryManager.deallocate(m_stylesheetExecutionContext);
+}
void
-XalanTransformer::initialize()
+XalanTransformer::initialize(MemoryManagerType& theManager)
{
// Initialize Xalan.
- XalanAutoPtr<XSLTInit> initGuard(new XSLTInit);
- XalanAutoPtr<XSLTInputSource> inputSourceGuard(new XSLTInputSource);
- EnsureFunctionsInstallation installGuard;
- installGuard.install();
+ XalanMemMgrAutoPtr<XSLTInit, true> initGuard(theManager, XSLTInit::create(theManager));
+ XalanAutoPtr<XSLTInputSource> inputSourceGuard(new (&theManager) XSLTInputSource);
+ EnsureFunctionsInstallation instalGuard(theManager);
+
+ instalGuard.install();
- installGuard.release();
- s_xsltInit = initGuard.release();
+ instalGuard.release();
+ s_xsltInit = initGuard.releasePtr();
s_emptyInputSource = inputSourceGuard.release();
+
+ s_initMemoryManager = &theManager;
}
@@ -187,20 +214,19 @@
void
XalanTransformer::terminate()
{
+ assert( s_initMemoryManager!= 0 );
+
{
- EnsureFunctionsInstallation uninstalGuard;
+ EnsureFunctionsInstallation uninstalGuard(*s_initMemoryManager);
}
-#if defined(XALAN_CANNOT_DELETE_CONST)
- delete (XSLTInputSource*) s_emptyInputSource;
- delete (XSLTInit*) s_xsltInit;
-#else
delete s_emptyInputSource;
- delete s_xsltInit;
-#endif
+
+ destroyObjWithMemMgr(s_xsltInit, *s_initMemoryManager);
s_emptyInputSource = 0;
s_xsltInit = 0;
+ s_initMemoryManager = 0;
#if defined(XALAN_USE_ICU)
ICUBridgeCleanup::cleanup();
@@ -217,6 +243,17 @@
#endif
}
+#if defined(XALAN_USE_ICU)
+void
+ICUStartUp(MemoryManagerType& theManager)
+{
+ ICUBridgeCleanup::startup(theManager);
+}
+#else
+ICUStartUp(MemoryManagerType& /*theManager*/)
+{
+}
+#endif
static void
@@ -315,11 +352,11 @@
XalanFlushHandlerType theFlushHandler)
{
// Set to output target to the callback
- XalanTransformerOutputStream theOutputStream(theOutputHandle, theOutputHandler, theFlushHandler);
+ XalanTransformerOutputStream theOutputStream(m_memoryManager, theOutputHandle, theOutputHandler, theFlushHandler);
XalanOutputStreamPrintWriter thePrintWriter(theOutputStream);
- XSLTResultTarget theResultTarget(&thePrintWriter);
+ XSLTResultTarget theResultTarget(&thePrintWriter, m_memoryManager);
// Do the transformation...
return transform(
@@ -339,11 +376,11 @@
XalanFlushHandlerType theFlushHandler)
{
// Set to output target to the callback
- XalanTransformerOutputStream theOutputStream(theOutputHandle, theOutputHandler, theFlushHandler);
+ XalanTransformerOutputStream theOutputStream(m_memoryManager, theOutputHandle, theOutputHandler, theFlushHandler);
XalanOutputStreamPrintWriter thePrintWriter(theOutputStream);
- XSLTResultTarget theResultTarget(&thePrintWriter);
+ XSLTResultTarget theResultTarget(&thePrintWriter, m_memoryManager);
// Do the transformation...
return transform(
@@ -364,11 +401,11 @@
assert(s_emptyInputSource != 0);
// Set to output target to the callback
- XalanTransformerOutputStream theOutputStream(theOutputHandle, theOutputHandler, theFlushHandler);
+ XalanTransformerOutputStream theOutputStream(m_memoryManager, theOutputHandle, theOutputHandler, theFlushHandler);
XalanOutputStreamPrintWriter thePrintWriter(theOutputStream);
- XSLTResultTarget theResultTarget(&thePrintWriter);
+ XSLTResultTarget theResultTarget(&thePrintWriter, m_memoryManager);
// Do the transformation...
return transform(
@@ -412,7 +449,7 @@
const SAXParseException& theException,
CharVectorType& theErrorMessage)
{
- XalanDOMString theBuffer;
+ XalanDOMString theBuffer(theErrorMessage.getMemoryManager());
FormatSAXParseException(
theException,
@@ -428,12 +465,16 @@
const XalanDOMException& theException,
CharVectorType& theErrorMessage)
{
- XalanDOMString theBuffer;
+ XalanDOMString theBuffer(theErrorMessage.getMemoryManager()), theResult(theErrorMessage.getMemoryManager());
- append(theBuffer, LongToDOMString(long(theException.getExceptionCode())));
+ LongToDOMString(long(theException.getExceptionCode()), theResult);
+ append(theBuffer, theResult);
append(theBuffer, XalanDOMChar(XalanUnicode::charFullStop));
- XalanDOMString theMessage = XalanMessageLoader::getMessage(XalanMessages::XalanDOMExceptionCaught_1Param,theBuffer);
+
+ XalanDOMString theMessage (theErrorMessage.getMemoryManager());
+
+ XalanMessageLoader::getMessage(XalanMessages::XalanDOMExceptionCaught_1Param, theMessage, theBuffer);
TranscodeToLocalCodePage(theMessage, theErrorMessage, true);
}
@@ -449,7 +490,7 @@
m_errorMessage.resize(1, '\0');
// Store error messages from problem listener.
- XalanDOMString theErrorMessage;
+ XalanDOMString theErrorMessage(m_memoryManager);
int theResult = 0;
@@ -458,7 +499,7 @@
// Create some support objects that are necessary for running the processor...
XalanSourceTreeDOMSupport theDOMSupport;
- XalanSourceTreeParserLiaison theParserLiaison(theDOMSupport);
+ XalanSourceTreeParserLiaison theParserLiaison(m_memoryManager, theDOMSupport);
theParserLiaison.setEntityResolver(m_entityResolver);
theParserLiaison.setErrorHandler(m_errorHandler);
@@ -467,14 +508,15 @@
theDOMSupport.setParserLiaison(&theParserLiaison);
// Create some more support objects...
- XSLTProcessorEnvSupportDefault theXSLTProcessorEnvSupport;
+ XSLTProcessorEnvSupportDefault theXSLTProcessorEnvSupport(m_memoryManager);
- XObjectFactoryDefault theXObjectFactory;
+ XObjectFactoryDefault theXObjectFactory(m_memoryManager);
- XPathFactoryBlock theXPathFactory;
+ XPathFactoryBlock theXPathFactory(m_memoryManager);
// Create a processor...
XSLTEngineImpl theProcessor(
+ m_memoryManager,
theParserLiaison,
theXSLTProcessorEnvSupport,
theDOMSupport,
@@ -484,7 +526,7 @@
// Create a problem listener and send output to a XalanDOMString.
DOMStringPrintWriter thePrintWriter(theErrorMessage);
- XalanTransformerProblemListener theProblemListener(m_warningStream, &thePrintWriter);
+ XalanTransformerProblemListener theProblemListener( m_memoryManager, m_warningStream, &thePrintWriter);
if (m_problemListener == 0)
{
@@ -500,7 +542,8 @@
// Create a new XalanCompiledStylesheet.
theCompiledStylesheet =
- new XalanCompiledStylesheetDefault(
+ XalanCompiledStylesheetDefault::create(
+ m_memoryManager,
theStylesheetSource,
theProcessor,
m_errorHandler,
@@ -569,12 +612,17 @@
}
else
{
- XalanDOMString theBuffer;
- append(theBuffer, LongToDOMString(long(e.getExceptionCode())));
+ XalanDOMString theBuffer(m_memoryManager), longStr(m_memoryManager);
+
+ LongToDOMString(long(e.getExceptionCode()), longStr);
+
+ append(theBuffer, longStr);
append(theBuffer, XalanDOMChar(XalanUnicode::charFullStop));
- XalanDOMString theMessage = XalanMessageLoader::getMessage(XalanMessages::XalanDOMExceptionCaught_1Param,theBuffer);
+ XalanDOMString theMessage(m_memoryManager);
+
+ XalanMessageLoader::getMessage(XalanMessages::XalanDOMExceptionCaught_1Param, theMessage, theBuffer);
TranscodeToLocalCodePage(theMessage, m_errorMessage, true);
}
@@ -600,11 +648,13 @@
if (i == m_compiledStylesheets.end())
{
- XalanDOMString theStylesheetErrorMessage = XalanMessageLoader::getMessage(XalanMessages::InvalidCompiledStylesheetProvided);
+ XalanDOMString theStylesheetErrorMessage(m_memoryManager);
+
+ XalanMessageLoader::getMessage(XalanMessages::InvalidCompiledStylesheetProvided, theStylesheetErrorMessage);
try
{
- m_errorMessage = theStylesheetErrorMessage.transcode();
+ theStylesheetErrorMessage.transcode(m_errorMessage);
}
catch(...)
{
@@ -629,12 +679,9 @@
{
m_compiledStylesheets.erase(i);
-#if defined(XALAN_CANNOT_DELETE_CONST)
- delete (XalanCompiledStylesheet*) theStylesheet;
-#else
- delete theStylesheet;
-#endif
+ theStylesheet ->~XalanCompiledStylesheet() ;
+ m_memoryManager.deallocate((void*) theStylesheet);
return 0;
}
}
@@ -661,7 +708,8 @@
if(useXercesDOM == true)
{
theParsedSource =
- new XercesDOMParsedSource(
+ XercesDOMParsedSource::create(
+ m_memoryManager,
theInputSource,
m_useValidation,
m_errorHandler,
@@ -672,14 +720,14 @@
else
{
theParsedSource =
- new XalanDefaultParsedSource(
+ XalanDefaultParsedSource::create(
+ m_memoryManager,
theInputSource,
m_useValidation,
m_errorHandler,
m_entityResolver,
getExternalSchemaLocation(),
- getExternalNoNamespaceSchemaLocation(),
- m_poolAllTextNodes);
+ getExternalNoNamespaceSchemaLocation());
}
// Store it in a vector.
@@ -687,7 +735,11 @@
}
catch(const XSLException& e)
{
- TranscodeToLocalCodePage(e.defaultFormat(), m_errorMessage, true);
+ XalanDOMString theBuffer(m_memoryManager);
+
+ e.defaultFormat(theBuffer);
+
+ TranscodeToLocalCodePage(theBuffer, m_errorMessage, true);
theResult = -1;
}
@@ -734,11 +786,13 @@
if (i == m_parsedSources.end())
{
- XalanDOMString theParserErrorMessage = XalanMessageLoader::getMessage(XalanMessages::InvalidParsedSourceProvided);
+ XalanDOMString theParserErrorMessage(m_memoryManager);
+
+ XalanMessageLoader::getMessage(XalanMessages::InvalidParsedSourceProvided, theParserErrorMessage);
try
{
- m_errorMessage = theParserErrorMessage.transcode();
+ theParserErrorMessage.transcode(m_errorMessage);
}
catch(...)
{
@@ -762,12 +816,14 @@
{
m_parsedSources.erase(i);
-#if defined(XALAN_CANNOT_DELETE_CONST)
- delete (XalanParsedSource*) theParsedSource;
-#else
- delete theParsedSource;
-#endif
+ XalanParsedSource* sourceToDelete = const_cast<XalanParsedSource*>(theParsedSource);
+
+ if(sourceToDelete != 0)
+ {
+ sourceToDelete->~XalanParsedSource();
+ getMemoryManager().deallocate((void*)sourceToDelete);
+ }
return 0;
}
}
@@ -780,7 +836,9 @@
const XalanDOMString& expression)
{
// Store the stylesheet parameter in a vector.
- m_paramPairs.push_back(ParamPairType(key, expression));
+
+ m_paramPairs.push_back(ParamPairType(cloneObjWithMemMgr(key,m_memoryManager),
+ cloneObjWithMemMgr (expression, m_memoryManager)));
}
@@ -790,7 +848,8 @@
const char* key,
const char* expression)
{
- setStylesheetParam(XalanDOMString(key), XalanDOMString(expression));
+
+ setStylesheetParam(XalanDOMString(key, m_memoryManager), XalanDOMString(expression, m_memoryManager));
}
@@ -823,9 +882,10 @@
XalanDocumentBuilder*
XalanTransformer::createDocumentBuilder(const XalanDOMString& theURI)
{
+
m_parsedSources.reserve(m_parsedSources.size() + 1);
- XalanDocumentBuilder* const theNewBuilder = new XalanDefaultDocumentBuilder(theURI);
+ XalanDocumentBuilder* const theNewBuilder = XalanDefaultDocumentBuilder::create( m_memoryManager, theURI);
m_parsedSources.push_back(theNewBuilder);
@@ -848,7 +908,8 @@
const XalanDOMString& functionName,
const Function& function)
{
- m_functionPairs.push_back(FunctionPairType(XalanQNameByValue(theNamespace, functionName), function.clone()));
+ m_functionPairs.push_back(FunctionPairType(XalanQNameByValue::create(theNamespace, functionName, m_memoryManager),
+ function.clone(m_memoryManager)));
}
@@ -874,9 +935,12 @@
{
for (FunctionParamPairVectorType::size_type i = 0; i < m_functionPairs.size(); ++i)
{
- if(XalanQNameByReference(theNamespace, functionName).equals(m_functionPairs[i].first))
+ if(m_functionPairs[i].first != 0 &&
+ XalanQNameByReference(theNamespace, functionName).equals(* (m_functionPairs[i].first)))
{
- delete m_functionPairs[i].second;
+ destroyObjWithMemMgr( m_functionPairs[i].first, m_memoryManager);
+
+ destroyObjWithMemMgr( m_functionPairs[i].second, m_memoryManager);
m_functionPairs.erase(m_functionPairs.begin() + i);
}
@@ -1044,6 +1108,21 @@
m_stylesheetExecutionContext->reset();
// Clear the ParamPairVectorType.
+ XALAN_USING_STD(for_each)
+
+/* for_each(m_paramPairs.begin(),
+ m_paramPairs.end(),
+ DeleteParamPairFunctor<ParamPairType>(m_memoryManager));
+*/
+ typedef ParamPairVectorType::iterator iterator;
+
+ for (iterator j = m_paramPairs.begin(); j != m_paramPairs.end(); ++j)
+ {
+
+ destroyObjWithMemMgr((*j).first, m_memoryManager);
+ destroyObjWithMemMgr((*j).second, m_memoryManager);
+ }
+
m_paramPairs.clear();
}
catch(...)
@@ -1075,7 +1154,7 @@
m_errorMessage.resize(1, '\0');
// Store error messages from problem listener.
- XalanDOMString theErrorMessage;
+ XalanDOMString theErrorMessage(m_memoryManager);
try
{
@@ -1083,7 +1162,8 @@
assert(theSourceDocument != 0);
// Create the helper object that is necessary for running the processor...
- XalanAutoPtr<XalanParsedSourceHelper> theHelper(theParsedXML.createHelper());
+ XalanMemMgrAutoPtr<XalanParsedSourceHelper, true> theHelper(m_memoryManager, theParsedXML.createHelper(m_memoryManager));
+
assert(theHelper.get() != 0);
DOMSupport& theDOMSupport = theHelper->getDOMSupport();
@@ -1097,7 +1177,7 @@
theParserLiaison.setUseValidation(m_useValidation);
// Create some more support objects...
- XSLTProcessorEnvSupportDefault theXSLTProcessorEnvSupport;
+ XSLTProcessorEnvSupportDefault theXSLTProcessorEnvSupport(m_memoryManager);
const XalanDOMString& theSourceURI = theParsedXML.getURI();
@@ -1110,19 +1190,23 @@
{
for (FunctionParamPairVectorType::size_type i = 0; i < m_functionPairs.size(); ++i)
{
+ assert( m_functionPairs[i].first != 0);
+ assert( m_functionPairs[i].second != 0);
+
theXSLTProcessorEnvSupport.installExternalFunctionLocal(
- m_functionPairs[i].first.getNamespace(),
- m_functionPairs[i].first.getLocalPart(),
+ m_functionPairs[i].first->getNamespace(),
+ m_functionPairs[i].first->getLocalPart(),
*m_functionPairs[i].second);
}
}
- XObjectFactoryDefault theXObjectFactory;
+ XObjectFactoryDefault theXObjectFactory(m_memoryManager);
- XPathFactoryBlock theXPathFactory;
+ XPathFactoryBlock theXPathFactory(m_memoryManager);
// Create a processor...
XSLTEngineImpl theProcessor(
+ m_memoryManager,
theParserLiaison,
theXSLTProcessorEnvSupport,
theDOMSupport,
@@ -1146,7 +1230,7 @@
// pushing params, since there could be a problem resolving a QName.
DOMStringPrintWriter thePrintWriter(theErrorMessage);
- XalanTransformerProblemListener theProblemListener(m_warningStream, &thePrintWriter);
+ XalanTransformerProblemListener theProblemListener(m_memoryManager, m_warningStream, &thePrintWriter);
if (m_problemListener == 0)
{
@@ -1161,9 +1245,12 @@
// Set the parameters if any.
for (ParamPairVectorType::size_type i = 0; i < m_paramPairs.size(); ++i)
{
+ assert ( m_paramPairs[i].first != 0);
+ assert ( m_paramPairs[i].second != 0);
+
theProcessor.setStylesheetParam(
- m_paramPairs[i].first,
- m_paramPairs[i].second);
+ * (m_paramPairs[i].first),
+ * (m_paramPairs[i].second));
}
}
@@ -1177,7 +1264,7 @@
// We may need to change the output encoding, so
// we make a copy of the result target.
- XSLTResultTarget tempResultTarget(theResultTarget);
+ XSLTResultTarget tempResultTarget(theResultTarget, m_memoryManager);
if (tempResultTarget.getEncoding().length() == 0 && m_outputEncoding.length() != 0)
{
@@ -1204,6 +1291,7 @@
// Create a stylesheet construction context,
// using the stylesheet's factory support objects.
StylesheetConstructionContextDefault theStylesheetConstructionContext(
+ m_memoryManager,
theProcessor,
theXPathFactory);
@@ -1286,27 +1374,26 @@
void
XalanTransformer::EnsureFunctionsInstallation::install()
{
-
- XalanExtensionsInstaller::installGlobal();
- XalanEXSLTCommonFunctionsInstaller::installGlobal();
- XalanEXSLTDynamicFunctionsInstaller::installGlobal();
- XalanEXSLTMathFunctionsInstaller::installGlobal();
- XalanEXSLTSetFunctionsInstaller::installGlobal();
- XalanEXSLTStringFunctionsInstaller::installGlobal();
- XalanEXSLTDateTimeFunctionsInstaller::installGlobal();
+ XalanExtensionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTCommonFunctionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTDynamicFunctionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTMathFunctionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTSetFunctionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTStringFunctionsInstaller::installGlobal(m_memoryManagement);
+ XalanEXSLTDateTimeFunctionsInstaller::installGlobal(m_memoryManagement);
}
XalanTransformer::EnsureFunctionsInstallation::~EnsureFunctionsInstallation()
{
- if ( !m_release )
+ if ( !m_release)
{
- XalanExtensionsInstaller::uninstallGlobal();
- XalanEXSLTCommonFunctionsInstaller::uninstallGlobal();
- XalanEXSLTDynamicFunctionsInstaller::uninstallGlobal();
- XalanEXSLTMathFunctionsInstaller::uninstallGlobal();
- XalanEXSLTSetFunctionsInstaller::uninstallGlobal();
- XalanEXSLTStringFunctionsInstaller::uninstallGlobal();
- XalanEXSLTDateTimeFunctionsInstaller::uninstallGlobal();
+ XalanExtensionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTCommonFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTDynamicFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTMathFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTSetFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTStringFunctionsInstaller::uninstallGlobal(m_memoryManagement);
+ XalanEXSLTDateTimeFunctionsInstaller::uninstallGlobal(m_memoryManagement);
#if defined(XALAN_USE_ICU)
XPath::uninstallFunction(XPathFunctionTable::s_formatNumber);
1.12 +78 -8 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp
Index: XalanTransformer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XalanTransformer.hpp 28 Oct 2004 19:40:06 -0000 1.11
+++ XalanTransformer.hpp 8 Nov 2004 19:20:05 -0000 1.12
@@ -80,6 +80,7 @@
*/
class XALAN_TRANSFORMER_EXPORT XalanTransformer
{
+
public:
#if defined(XALAN_NO_STD_NAMESPACE)
@@ -88,11 +89,15 @@
typedef std::ostream StreamType;
#endif
- XalanTransformer();
+ XalanTransformer(MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr());
virtual
~XalanTransformer();
+ MemoryManagerType&
+ getMemoryManager();
+
+
/**
* Initialize Xalan.
*
@@ -102,7 +107,7 @@
* initialization state, so you do not call it more than once.
*/
static void
- initialize();
+ initialize(MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr());
/**
* Terminate Xalan.
@@ -141,6 +146,9 @@
ICUCleanUp();
+ static void
+ ICUStartUp(MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr());
+
/**
* Transform will apply the stylesheet source to the parsed xml source
* and write the transformation output to the target.
@@ -397,7 +405,7 @@
* @return a pointer to a XalanDocumentBuilder instance or 0 for failure.
*/
XalanDocumentBuilder*
- createDocumentBuilder(const XalanDOMString& theURI = XalanDOMString());
+ createDocumentBuilder(const XalanDOMString& theURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
/**
* Destroy a document builder created by a previous call to createDocumentBuilder().
@@ -828,9 +836,9 @@
typedef XalanVector<const XalanCompiledStylesheet*> CompiledStylesheetPtrVectorType;
typedef XalanVector<const XalanParsedSource*> ParsedSourcePtrVectorType;
- typedef XALAN_STD_QUALIFIER pair<XalanDOMString, XalanDOMString> ParamPairType;
+ typedef XALAN_STD_QUALIFIER pair<XalanDOMString*, XalanDOMString*> ParamPairType;
typedef XalanVector<ParamPairType> ParamPairVectorType;
- typedef XALAN_STD_QUALIFIER pair<XalanQNameByValue, Function*> FunctionPairType;
+ typedef XALAN_STD_QUALIFIER pair<XalanQNameByValue*, Function*> FunctionPairType;
typedef XalanVector<FunctionPairType> FunctionParamPairVectorType;
typedef XalanVector<TraceListener*> TraceListenerVectorType;
@@ -838,14 +846,15 @@
{
public:
- EnsureFunctionsInstallation() :
+ EnsureFunctionsInstallation(MemoryManagerType& theManager) :
+ m_memoryManagement(theManager),
m_release(false)
- {
+ {
}
~EnsureFunctionsInstallation();
- static void
+ void
install();
void
@@ -855,6 +864,7 @@
}
private:
+ MemoryManagerType& m_memoryManagement;
bool m_release;
};
@@ -926,7 +936,65 @@
XalanDocumentBuilder* const m_documentBuilder;
};
+ template <class T>
+#if defined(XALAN_NO_STD_NAMESPACE)
+ struct DeleteParamPairFunctor : public unary_function<const T&, void>
+#else
+ struct DeleteParamPairFunctor : public std::unary_function<const T&, void>
+#endif
+ {
+#if defined(XALAN_NO_STD_NAMESPACE)
+ typedef unary_function<const T&, void> BaseClassType;
+#else
+ typedef std::unary_function<const T&, void> BaseClassType;
+#endif
+
+ typedef typename BaseClassType::result_type result_type;
+ typedef typename BaseClassType::argument_type argument_type;
+
+ DeleteParamPairFunctor(MemoryManagerType& theManager) :
+ m_memoryManager(theManager)
+ {
+ }
+
+ template<class T>
+ deletePtr(T* ptr)const
+ {
+ ptr->~T();
+ }
+
+ /**
+ * Delete the object pointed to by argument.
+ *
+ * @param thePointer pointer to object to be deleted
+ */
+ result_type
+ operator()(argument_type thePair) const
+ {
+ T& tmpPair = const_cast<T&>(thePair);
+
+ if (tmpPair.first != 0)
+ {
+ deletePtr(tmpPair.first);
+
+ m_memoryManager.deallocate((void*)tmpPair.first);
+ }
+
+ if (tmpPair.second != 0)
+ {
+ deletePtr(tmpPair.second);
+
+ m_memoryManager.deallocate((void*)tmpPair.second);
+ }
+
+ }
+
+ private:
+
+ MemoryManagerType& m_memoryManager;
+
+ };
protected:
private:
@@ -961,6 +1029,8 @@
// Data members...
+ MemoryManagerType& m_memoryManager;
+
CompiledStylesheetPtrVectorType m_compiledStylesheets;
ParsedSourcePtrVectorType m_parsedSources;
1.7 +6 -1 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerOutputStream.cpp
Index: XalanTransformerOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerOutputStream.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanTransformerOutputStream.cpp 24 Aug 2004 14:03:16 -0000 1.6
+++ XalanTransformerOutputStream.cpp 8 Nov 2004 19:20:05 -0000 1.7
@@ -26,9 +26,11 @@
XalanTransformerOutputStream::XalanTransformerOutputStream(
+ MemoryManagerType& theManager,
void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler):
+ XalanOutputStream(theManager),
m_outputHandle(theOutputHandle),
m_outputHandler(theOutputHandler),
m_flushHandler(theFlushHandler)
@@ -66,8 +68,11 @@
// Thus the callback can alert us of memory allocation issues or buffer overflows.
if(theBytesWritten != theBufferLength)
{
+
+ XalanDOMString theBuffer(getMemoryManager());
+
throw XalanOutputStreamException(
- XalanMessageLoader::getMessage(XalanMessages::NumberBytesWrittenDoesNotEqual));
+ XalanMessageLoader::getMessage(XalanMessages::NumberBytesWrittenDoesNotEqual, theBuffer), getMemoryManager());
}
}
1.5 +3 -2 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerOutputStream.hpp
Index: XalanTransformerOutputStream.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerOutputStream.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanTransformerOutputStream.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanTransformerOutputStream.hpp 8 Nov 2004 19:20:05 -0000 1.5
@@ -46,6 +46,7 @@
* @param theFlushHandler a user defined (callback) function.
*/
XalanTransformerOutputStream(
+ MemoryManagerType& theManager,
void* theOutputHandle,
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler = 0);
@@ -58,8 +59,8 @@
virtual void
writeData(
- const char* theBuffer,
- size_type theBufferLength);
+ const char* theBuffer,
+ size_type theBufferLength);
virtual void
doFlush();
1.5 +7 -5 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp
Index: XalanTransformerProblemListener.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerProblemListener.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanTransformerProblemListener.cpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanTransformerProblemListener.cpp 8 Nov 2004 19:20:05 -0000 1.5
@@ -43,11 +43,13 @@
XalanTransformerProblemListener::XalanTransformerProblemListener(
+ MemoryManagerType& theManager,
StreamType* theWarningStream,
PrintWriter* thePrintWriter) :
ProblemListener(),
- m_problemListener(thePrintWriter),
- m_warningStream(theWarningStream)
+ m_problemListener(theManager, thePrintWriter),
+ m_warningStream(theWarningStream),
+ m_warningString(theManager)
{
}
@@ -92,9 +94,9 @@
}
else if (m_warningStream != 0)
{
- XalanDOMString theWarning;
+ m_warningString.erase();
- DOMStringPrintWriter thePrintWriter(theWarning);
+ DOMStringPrintWriter thePrintWriter(m_warningString);
ProblemListenerDefault::problem(
thePrintWriter,
@@ -107,7 +109,7 @@
lineNo,
charOffset);
- *m_warningStream << theWarning;
+ *m_warningStream << m_warningString;
}
}
1.5 +5 -2 xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp
Index: XalanTransformerProblemListener.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformerProblemListener.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanTransformerProblemListener.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XalanTransformerProblemListener.hpp 8 Nov 2004 19:20:05 -0000 1.5
@@ -52,8 +52,9 @@
#endif
XalanTransformerProblemListener(
- StreamType* theStream,
- PrintWriter* thePrintWriter);
+ MemoryManagerType& theManager,
+ StreamType* theStream,
+ PrintWriter* thePrintWriter);
virtual
~XalanTransformerProblemListener();
@@ -79,6 +80,8 @@
ProblemListenerDefault m_problemListener;
StreamType* m_warningStream;
+
+ XalanDOMString m_warningString;
};
1.5 +54 -8 xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp
Index: XercesDOMParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMParsedSource.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XercesDOMParsedSource.cpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XercesDOMParsedSource.cpp 8 Nov 2004 19:20:05 -0000 1.5
@@ -33,13 +33,27 @@
-XercesDOMParsedSourceHelper::XercesDOMParsedSourceHelper() :
- m_domSupport(),
- m_parserLiaison()
+XercesDOMParsedSourceHelper::XercesDOMParsedSourceHelper(MemoryManagerType& theManager) :
+ m_domSupport(theManager),
+ m_parserLiaison(theManager)
{
}
+XercesDOMParsedSourceHelper*
+XercesDOMParsedSourceHelper::create(MemoryManagerType& theManager)
+{
+ typedef XercesDOMParsedSourceHelper ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(theManager);
+ theGuard.release();
+
+ return theResult;
+}
XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()
{
@@ -64,6 +78,7 @@
XercesDOMParsedSource::XercesDOMParsedSource(
+ MemoryManagerType& theManager,
const InputSourceType& theInputSource,
bool fValidate,
ErrorHandlerType* theErrorHandler,
@@ -71,8 +86,9 @@
const XalanDOMChar* theExternalSchemaLocation,
const XalanDOMChar* theExternalNoNamespaceSchemaLocation) :
XalanParsedSource(),
- m_parserLiaison(),
- m_parsedSource(0)
+ m_parserLiaison(theManager),
+ m_parsedSource(0),
+ m_uri(theManager)
{
m_parserLiaison.setUseValidation(fValidate);
m_parserLiaison.setEntityResolver(theEntityResolver);
@@ -89,7 +105,7 @@
{
try
{
- m_uri = URISupport::getURLStringFromString(theSystemID);
+ URISupport::getURLStringFromString(theSystemID, m_uri);
}
catch(const XERCES_CPP_NAMESPACE_QUALIFIER XMLException&)
{
@@ -102,6 +118,36 @@
}
}
+XercesDOMParsedSource*
+XercesDOMParsedSource::create(
+ MemoryManagerType& theManager,
+ const InputSourceType& theInputSource,
+ bool fValidate,
+ ErrorHandlerType* theErrorHandler,
+ EntityResolverType* theEntityResolver,
+ const XalanDOMChar* theExternalSchemaLocation,
+ const XalanDOMChar* theExternalNoNamespaceSchemaLocation)
+{
+ typedef XercesDOMParsedSource ThisType;
+
+ XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
+
+ ThisType* theResult = theGuard.get();
+
+ new (theResult) ThisType(
+ theManager,
+ theInputSource,
+ fValidate,
+ theErrorHandler,
+ theEntityResolver,
+ theExternalSchemaLocation,
+ theExternalNoNamespaceSchemaLocation);
+
+
+ theGuard.release();
+
+ return theResult;
+}
XercesDOMParsedSource::~XercesDOMParsedSource()
@@ -119,9 +165,9 @@
XalanParsedSourceHelper*
-XercesDOMParsedSource::createHelper() const
+XercesDOMParsedSource::createHelper(MemoryManagerType& theManager) const
{
- return new XercesDOMParsedSourceHelper;
+ return XercesDOMParsedSourceHelper::create(theManager);
}
1.5 +16 -2 xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp
Index: XercesDOMParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMParsedSource.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XercesDOMParsedSource.hpp 26 Feb 2004 23:07:13 -0000 1.4
+++ XercesDOMParsedSource.hpp 8 Nov 2004 19:20:05 -0000 1.5
@@ -40,10 +40,13 @@
{
public:
- XercesDOMParsedSourceHelper();
+ XercesDOMParsedSourceHelper(MemoryManagerType& theManager);
~XercesDOMParsedSourceHelper();
+ static XercesDOMParsedSourceHelper*
+ create(MemoryManagerType& theManager);
+
virtual DOMSupport&
getDOMSupport();
@@ -68,6 +71,17 @@
public:
XercesDOMParsedSource(
+ MemoryManagerType& theManager,
+ const InputSourceType& theInputSource,
+ bool fValidate = false,
+ ErrorHandlerType* theErrorHandler = 0,
+ EntityResolverType* theEntityResolver = 0,
+ const XalanDOMChar* theExternalSchemaLocation = 0,
+ const XalanDOMChar* theExternalNoNamespaceSchemaLocation = 0);
+
+ static XercesDOMParsedSource*
+ create(
+ MemoryManagerType& theManager,
const InputSourceType& theInputSource,
bool fValidate = false,
ErrorHandlerType* theErrorHandler = 0,
@@ -82,7 +96,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper() const;
+ createHelper(MemoryManagerType& theManager) const;
virtual const XalanDOMString&
getURI() const;
1.7 +15 -5 xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMWrapperParsedSource.cpp
Index: XercesDOMWrapperParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMWrapperParsedSource.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XercesDOMWrapperParsedSource.cpp 13 Mar 2004 00:44:56 -0000 1.6
+++ XercesDOMWrapperParsedSource.cpp 8 Nov 2004 19:20:05 -0000 1.7
@@ -37,9 +37,9 @@
XALAN_CPP_NAMESPACE_BEGIN
-
#if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
XercesDOMWrapperParsedSource::XercesDOMWrapperParsedSource(
+ MemoryManagerType& theManager,
const DOM_Document_Type& theDocument,
XercesParserLiaison& theParserLiaison,
XercesDOMSupport& theDOMSupport,
@@ -48,8 +48,12 @@
m_parserLiaison(theParserLiaison),
m_domSupport(theDOMSupport),
m_parsedSource(theParserLiaison.createDocument(theDocument, true, true)),
- m_uri(URISupport::NormalizeURIText(theURI))
+ m_uri(theURI,theManager)
{
+ XalanDOMString& refURI = const_cast<XalanDOMString&>(m_uri);
+
+ URISupport::NormalizeURIText(refURI);
+
assert(m_parsedSource != 0);
}
#endif
@@ -57,6 +61,7 @@
XercesDOMWrapperParsedSource::XercesDOMWrapperParsedSource(
+ MemoryManagerType& theManager,
const DOMDocument_Type* theDocument,
XercesParserLiaison& theParserLiaison,
XercesDOMSupport& theDOMSupport,
@@ -65,8 +70,13 @@
m_parserLiaison(theParserLiaison),
m_domSupport(theDOMSupport),
m_parsedSource(theParserLiaison.createDocument(theDocument, true, true)),
- m_uri(URISupport::NormalizeURIText(theURI))
+ m_uri(theURI, theManager)
{
+ XalanDOMString& refURI = const_cast<XalanDOMString&>(m_uri);
+
+ URISupport::NormalizeURIText(refURI);
+
+
assert(m_parsedSource != 0);
}
@@ -88,9 +98,9 @@
XalanParsedSourceHelper*
-XercesDOMWrapperParsedSource::createHelper() const
+XercesDOMWrapperParsedSource::createHelper(MemoryManagerType& theManager) const
{
- return new XercesDOMParsedSourceHelper;
+ return XercesDOMParsedSourceHelper::create(theManager);
}
1.6 +6 -3 xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp
Index: XercesDOMWrapperParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XercesDOMWrapperParsedSource.hpp 13 Mar 2004 00:44:56 -0000 1.5
+++ XercesDOMWrapperParsedSource.hpp 8 Nov 2004 19:20:05 -0000 1.6
@@ -56,6 +56,7 @@
*/
class XALAN_TRANSFORMER_EXPORT XercesDOMWrapperParsedSource : public XalanParsedSource
{
+
public:
#if defined(XALAN_BUILD_DEPRECATED_DOM_BRIDGE)
@@ -70,10 +71,11 @@
* @deprecated This constructor is deprecated.
*/
XercesDOMWrapperParsedSource(
+ MemoryManagerType& theManager,
const DOM_Document_Type& theDocument,
XercesParserLiaison& theParserLiaison,
XercesDOMSupport& theDOMSupport,
- const XalanDOMString& theURI = XalanDOMString());
+ const XalanDOMString& theURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
#endif
/**
@@ -85,10 +87,11 @@
* @param theURI The URI of the document, if any.
*/
XercesDOMWrapperParsedSource(
+ MemoryManagerType& theManager,
const DOMDocument_Type* theDocument,
XercesParserLiaison& theParserLiaison,
XercesDOMSupport& theDOMSupport,
- const XalanDOMString& theURI = XalanDOMString());
+ const XalanDOMString& theURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
virtual
~XercesDOMWrapperParsedSource();
@@ -97,7 +100,7 @@
getDocument() const;
virtual XalanParsedSourceHelper*
- createHelper() const;
+ createHelper(MemoryManagerType& theManager) const;
virtual const XalanDOMString&
getURI() const;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org