You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/12/21 05:43:50 UTC

cvs commit: xml-xalan/c/src/XPath XObject.cpp XObject.hpp XObjectFactory.hpp XObjectFactoryDefault.cpp XObjectFactoryDefault.hpp

dbertoni    00/12/20 20:43:49

  Modified:    c/src/XPath XObject.cpp XObject.hpp XObjectFactory.hpp
                        XObjectFactoryDefault.cpp XObjectFactoryDefault.hpp
  Log:
  Changes for new XString subclasses.
  
  Revision  Changes    Path
  1.17      +9 -1      xml-xalan/c/src/XPath/XObject.cpp
  
  Index: XObject.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XObject.cpp	2000/11/30 21:57:56	1.16
  +++ XObject.cpp	2000/12/21 04:43:48	1.17
  @@ -59,7 +59,7 @@
   
   
   
  -#include <stdexcept>
  +//#include <stdexcept>
   
   
   
  @@ -102,6 +102,14 @@
   
   XObject::~XObject()
   {
  +}
  +
  +
  +
  +XObject::eObjectType
  +XObject::getRealType() const
  +{
  +	return m_objectType;
   }
   
   
  
  
  
  1.14      +13 -0     xml-xalan/c/src/XPath/XObject.hpp
  
  Index: XObject.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XObject.hpp	2000/11/30 17:06:34	1.13
  +++ XObject.hpp	2000/12/21 04:43:49	1.14
  @@ -105,6 +105,11 @@
   						  eTypeNodeSet = 5,
   						  eTypeResultTreeFrag = 6,
   						  eTypeUserDefined = 7,
  +						  // These next types are implementation-specific, and
  +						  // are never returned by getType().
  +						  eTypeStringReference = 8,
  +						  eTypeStringAdapter = 9,
  +						  eTypeStringCached = 10,
   						  eUnknown
   						};
   
  @@ -320,6 +325,14 @@
   	};
   
   protected:
  +
  +	/**
  +	 * Tell what kind of class this is.
  +	 *
  +	 * @return numeric type value
  +	 */
  +	virtual eObjectType
  +	getRealType() const;
   
   	virtual void 
   	referenced();
  
  
  
  1.16      +88 -51    xml-xalan/c/src/XPath/XObjectFactory.hpp
  
  Index: XObjectFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactory.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XObjectFactory.hpp	2000/11/21 21:08:25	1.15
  +++ XObjectFactory.hpp	2000/12/21 04:43:49	1.16
  @@ -10,33 +10,33 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *	  notice, this list of conditions and the following disclaimer. 
    *
    * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  + *	  notice, this list of conditions and the following disclaimer in
  + *	  the documentation and/or other materials provided with the
  + *	  distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  + *	  if any, must include the following acknowledgment:  
  + *		 "This product includes software developed by the
  + *		  Apache Software Foundation (http://www.apache.org/)."
  + *	  Alternately, this acknowledgment may appear in the software itself,
  + *	  if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  - *    permission, please contact apache@apache.org.
  + *	  not be used to endorse or promote products derived from this
  + *	  software without prior written permission. For written 
  + *	  permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  + *	  nor may "Apache" appear in their name, without prior written
  + *	  permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * DISCLAIMED.	IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  @@ -92,7 +92,9 @@
   public:
   
   	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
  +	typedef XPathExecutionContext::GetAndReleaseCachedString		GetAndReleaseCachedString;
   
  +
   	XObjectFactory();
   
   	virtual
  @@ -106,13 +108,13 @@
   	 * @return true if the object belongs to the factory, false if not.
   	 */
   	bool
  -	returnObject(const XObject*		theXObject)
  +	returnObject(XObject* 	theXObject)
   	{
   		return doReturnObject(theXObject);
   	}
   
   	/**
  -	 * Reset the instance.  This invalidates all existing instances created
  +	 * Reset the instance.	This invalidates all existing instances created
   	 * with this XObjectFactory.
   	 */
   	virtual void
  @@ -121,27 +123,25 @@
   	/**
   	 * Create a boolean XObject from a boolean value.
   	 * 
  -	 * @param theValue  value used to create object	 
  +	 * @param theValue	value used to create object  
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createBoolean(
  -			bool	theValue) = 0;
  +	createBoolean(bool	theValue) = 0;
   
   	/**
   	 * Create a node set XObject from a node list.
   	 * 
  -	 * @param theValue  value used to create object.  theValue will be owned by the new XObject.
  +	 * @param theValue	value used to create object.  theValue will be owned by the new XObject.
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createNodeSet(
  -			BorrowReturnMutableNodeRefList&		theValue) = 0;
  +	createNodeSet(BorrowReturnMutableNodeRefList& 	theValue) = 0;
   
   	/**
   	 * Create a null XObject.
   	 * 
  -	 * @param theValue  value used to create object	
  +	 * @param theValue	value used to create object 
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  @@ -150,74 +150,100 @@
   	/**
   	 * Create a numeric XObject from a number.
   	 * 
  -	 * @param theValue  value used to create object	
  +	 * @param theValue	value used to create object 
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createNumber(
  -			double	theValue) = 0;
  +	createNumber(double 	theValue) = 0;
   
   	/**
   	 * Create a string XObject from a string.
   	 * 
  -	 * @param theValue  value used to create object	 
  +	 * @param theValue	value used to create object  
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createString(
  -			const XalanDOMString&	theValue) = 0;
  +	createString(const XalanDOMString&	theValue) = 0;
   
   	/**
   	 * Create a string XObject from a null-terminated array of characters.
   	 * 
  -	 * @param theValue  a pointer to the array
  +	 * @param theValue	a pointer to the array
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createString(
  -			const XalanDOMChar*		theValue) = 0;
  +	createString(const XalanDOMChar*	theValue) = 0;
   
   	/**
   	 * Create a string XObject from an array of characters.
   	 * 
  -	 * @param theValue  a pointer to the array
  +	 * @param theValue	a pointer to the array
   	 * @paran theLength the length of the array
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
   	createString(
  -			const XalanDOMChar*		theValue,
  +			const XalanDOMChar* 	theValue,
   			unsigned int			theLength) = 0;
   
   	/**
  +	 * Create a string XObject from a string.  The XObject
  +	 * will hold a reference to the supplied string, so
  +	 * the string must be in scope for the lifetime of
  +	 * the instance
  +	 *
  +	 * @param theValue	value used to create object  
  +	 * @return pointer to new object
  +	 */
  +	virtual const XObjectPtr
  +	createStringReference(const XalanDOMString&		theValue) = 0;
  +
  +	/**
  +	 * Create a string XObject that will adapt another XObject to
  +	 * behave like a string.  The XObject holds a reference to the
  +	 * other XObject.
  +	 *
  +	 * @param theValue	value used to create object  
  +	 * @return pointer to new object
  +	 */
  +	virtual const XObjectPtr
  +	createStringAdapter(const XObjectPtr&	theValue) = 0;
  +
  +	/**
  +	 * Create a string XObject from a cached XalanDOMString,
  +	 *
  +	 * @param theValue	value used to create object  
  +	 * @return pointer to new object
  +	 */
  +	virtual const XObjectPtr
  +	createString(GetAndReleaseCachedString&		theValue) = 0;
  +
  +	/**
   	 * Create an "unknown" XObject from a string.
   	 * 
  -	 * @param theValue  value used to create object	 
  +	 * @param theValue	value used to create object  
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createUnknown(
  -			const XalanDOMString&	theValue) = 0;
  +	createUnknown(const XalanDOMString& 	theValue) = 0;
   
   	/**
   	 * Create a result tree fragment XObject from a result tree fragment.
   	 * 
  -	 * @param theValue  value used to create object.  theValue will be owned by the new XObject.	
  +	 * @param theValue	value used to create object.  theValue will be owned by the new XObject.	
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createResultTreeFrag(
  -			ResultTreeFragBase*		theValue) = 0;
  +	createResultTreeFrag(ResultTreeFragBase*	theValue) = 0;
   
   	/**
   	 * Create a span XObject from a node list.
   	 * 
  -	 * @param theValue  value used to create object.  The new object will own the pointer.
  +	 * @param theValue	value used to create object.  The new object will own the pointer.
   	 * @return pointer to new object
   	 */
   	virtual const XObjectPtr
  -	createSpan(
  -			BorrowReturnMutableNodeRefList&		theValue) = 0;
  +	createSpan(BorrowReturnMutableNodeRefList& 	theValue) = 0;
   
   	/**
   	 *
  @@ -225,15 +251,15 @@
   	 *
   	 */
   #if defined(XALAN_NO_NAMESPACES)
  -	struct DeleteXObjectFunctor : public unary_function<const XObject*, void>
  +	struct DeleteXObjectFunctor : public unary_function<XObject*, void>
   #else
  -	struct DeleteXObjectFunctor : public std::unary_function<const XObject*, void>
  +	struct DeleteXObjectFunctor : public std::unary_function<XObject*, void>
   #endif
   	{
   	public:
   
   		DeleteXObjectFunctor(
  -			XObjectFactory&		theFactoryInstance,
  +			XObjectFactory& 	theFactoryInstance,
   			bool				fInReset = false) :
   			m_factoryInstance(theFactoryInstance),
   			m_fInReset(fInReset)
  @@ -257,7 +283,7 @@
   
   	private:
   
  -		XObjectFactory&		m_factoryInstance;
  +		XObjectFactory& 	m_factoryInstance;
   
   		const bool			m_fInReset;
   	};
  @@ -267,12 +293,23 @@
   protected:
   
   	/**
  +	 * Return the actual implementation type of an XObject.
  +	 *
  +	 * @param theXObject the XObject
  +	 */
  +	XObject::eObjectType
  +	getRealType(const XObject&	theXObject) const
  +	{
  +		return theXObject.getRealType();
  +	}
  +
  +	/**
   	 * Delete a FactoryObject instance.
   	 *
   	 * @param theXObject the XObject instance to delete.
   	 */
   	void
  -	deleteObject(const XObject*		theXObject) const
  +	deleteObject(const XObject* 	theXObject) const
   	{
   #if defined(XALAN_CANNOT_DELETE_CONST)
   		delete (XObject*)theXObject;
  @@ -290,8 +327,8 @@
   
   	virtual bool
   	doReturnObject(
  -			const XObject*	theXObject,
  -			bool			fInReset = false) = 0;
  +			XObject*	theXObject,
  +			bool		fInReset = false) = 0;
   
   private:
   
  
  
  
  1.18      +111 -111  xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp
  
  Index: XObjectFactoryDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XObjectFactoryDefault.cpp	2000/11/21 21:08:27	1.17
  +++ XObjectFactoryDefault.cpp	2000/12/21 04:43:49	1.18
  @@ -71,6 +71,9 @@
   #include "XResultTreeFrag.hpp"
   #include "XSpan.hpp"
   #include "XString.hpp"
  +#include "XStringAdapter.hpp"
  +#include "XStringCached.hpp"
  +#include "XStringReference.hpp"
   #include "XUnknown.hpp"
   
   
  @@ -81,17 +84,20 @@
   
   
   XObjectFactoryDefault::XObjectFactoryDefault(
  -			unsigned int		theXStringBlockSize,
  -			unsigned int		theXNumberBlockSize,
  -			unsigned int		theXNodeSetBlockSize,
  -			unsigned int		theXResultTreeFragBlockSize) :  
  +			unsigned int	theXStringBlockSize,
  +			unsigned int	theXNumberBlockSize,
  +			unsigned int	theXNodeSetBlockSize,
  +			unsigned int	theXResultTreeFragBlockSize) :  
   	XObjectFactory(),
  -	m_xobjects(),
  -	m_XNull(new XNull),
  +	m_xstringAdapterAllocator(theXStringBlockSize),
   	m_xstringAllocator(theXStringBlockSize),
  +	m_xstringCachedAllocator(theXStringBlockSize),
  +	m_xstringReferenceAllocator(theXStringBlockSize),
   	m_xnumberAllocator(theXNumberBlockSize),
   	m_xnodesetAllocator(theXNodeSetBlockSize),
  -	m_xresultTreeFragAllocator(theXResultTreeFragBlockSize)
  +	m_xresultTreeFragAllocator(theXResultTreeFragBlockSize),
  +	m_xobjects(),
  +	m_XNull(new XNull)
   {
   }
   
  @@ -106,14 +112,14 @@
   
   bool
   XObjectFactoryDefault::doReturnObject(
  -			const XObject*	theXObject,
  -			bool			fInReset)
  +			XObject*	theXObject,
  +			bool		fInReset)
   {
   	assert(theXObject != 0);
   
   	bool bStatus = false;	
   
  -	const XObject::eObjectType	theType = theXObject->getType();
  +	const XObject::eObjectType	theType = getRealType(*theXObject);
   
   	switch(theType)
   	{
  @@ -123,26 +129,65 @@
   			bStatus = true;
   		}
   
  +	case XObject::eTypeStringAdapter:
  +		{
  +			XStringAdapter* const		theXStringAdapter =
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +				(XStringAdapter*)theXObject;
  +#else
  +				static_cast<XStringAdapter*>(theXObject);
  +#endif
  +
  +			bStatus = m_xstringAdapterAllocator.destroy(theXStringAdapter);
  +		}
  +		break;
  +
   	case XObject::eTypeString:
   		{
   			XString* const	theXString =
   #if defined(XALAN_OLD_STYLE_CASTS)
   				(XString*)theXObject;
   #else
  -				static_cast<XString*>(const_cast<XObject*>(theXObject));
  +				static_cast<XString*>(theXObject);
   #endif
   
   			bStatus = m_xstringAllocator.destroy(theXString);
   		}
   		break;
   
  +	case XObject::eTypeStringCached:
  +		{
  +			XStringCached* const	theXStringCached =
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +				(XStringCached*)theXObject;
  +#else
  +				static_cast<XStringCached*>(theXObject);
  +#endif
  +
  +			bStatus = m_xstringCachedAllocator.destroy(theXStringCached);
  +		}
  +		break;
  +
  +	case XObject::eTypeStringReference:
  +		{
  +			XStringReference* const		theXStringReference =
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +				(XStringReference*)theXObject;
  +#else
  +				static_cast<XStringReference*>(theXObject);
  +#endif
  +
  +			bStatus = m_xstringReferenceAllocator.destroy(theXStringReference);
  +		}
  +		break;
  +
   	case  XObject::eTypeNumber:
   		{
   			XNumber* const	theXNumber =
   #if defined(XALAN_OLD_STYLE_CASTS)
   				(XNumber*)theXObject;
   #else
  -				static_cast<XNumber*>(const_cast<XObject*>(theXObject));
  +				static_cast<XNumber*>(theXObject);
   #endif
   
   			bStatus = m_xnumberAllocator.destroy(theXNumber);
  @@ -155,7 +200,7 @@
   #if defined(XALAN_OLD_STYLE_CASTS)
   				(XNodeSet*)theXObject;
   #else
  -				static_cast<XNodeSet*>(const_cast<XObject*>(theXObject));
  +				static_cast<XNodeSet*>(theXObject);
   #endif
   
   			bStatus = m_xnodesetAllocator.destroy(theXNodeSet);
  @@ -164,11 +209,11 @@
   
   	case XObject::eTypeResultTreeFrag:	
   		{
  -			XResultTreeFrag* const	theXResultTreeFrag =	
  +			XResultTreeFrag* const	theXResultTreeFrag =
   #if defined(XALAN_OLD_STYLE_CASTS)
   				(XResultTreeFrag*)theXObject;
   #else
  -				static_cast<XResultTreeFrag*>(const_cast<XObject*>(theXObject));	
  +				static_cast<XResultTreeFrag*>(theXObject);
   #endif
   
   			bStatus = m_xresultTreeFragAllocator.destroy(theXResultTreeFrag);
  @@ -201,84 +246,6 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::clone(const XObject&		theXObject)
  -{
  -	XObject*	theClone = 0;
  -
  -	if (&theXObject == &theTrueBoolean)
  -	{
  -		theClone = &theTrueBoolean;
  -	}
  -	else if (&theXObject == &theFalseBoolean)
  -	{
  -		theClone = &theFalseBoolean;
  -	}
  -	else if (&theXObject == m_XNull.get())
  -	{
  -		theClone = m_XNull.get();
  -	}
  -	else
  -	{
  -		const XObject::eObjectType	theType = theXObject.getType();		
  -
  -		switch(theType)
  -		{	
  -		case XObject::eTypeString:
  -			theClone = m_xstringAllocator.clone(
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -			(const XString&)theXObject);
  -#else			
  -			static_cast<const XString&>(theXObject));
  -#endif
  -
  -			break;
  -
  -		case  XObject::eTypeNumber:
  -			theClone = m_xnumberAllocator.clone(
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -			(const XNumber&)theXObject);
  -#else			
  -			static_cast<const XNumber&>(theXObject));
  -#endif
  -
  -			break;
  -
  -		case XObject::eTypeNodeSet:
  -			theClone = m_xnodesetAllocator.clone(
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -			(const XNodeSet&)theXObject);
  -#else			
  -			static_cast<const XNodeSet&>(theXObject));
  -#endif
  -
  -			break;
  -
  -		case XObject::eTypeResultTreeFrag:
  -			theClone = m_xresultTreeFragAllocator.clone(
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -			(const XResultTreeFrag&)theXObject);
  -#else			
  -			static_cast<const XResultTreeFrag&>(theXObject));
  -#endif
  -
  -			break;
  -
  -		default:
  -			theClone = theXObject.clone();
  -
  -			m_xobjects.insert(theClone);
  -			break;
  -		}
  -	}
  -
  -	theClone->setFactory(this);
  -
  -	return XObjectPtr(theClone);
  -}
  -
  -
  -
  -const XObjectPtr
   XObjectFactoryDefault::createBoolean(
   			bool	theValue)
   {
  @@ -296,8 +263,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createUnknown(
  -			const XalanDOMString&	theValue)
  +XObjectFactoryDefault::createUnknown(const XalanDOMString&	theValue)
   {
   	XUnknown* const	theXUnknown = new XUnknown(theValue);
   
  @@ -311,8 +277,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createSpan(
  -			BorrowReturnMutableNodeRefList&		theValue)
  +XObjectFactoryDefault::createSpan(BorrowReturnMutableNodeRefList&	theValue)
   {
   	XSpan* const	theXSpan = new XSpan(theValue);
   
  @@ -326,8 +291,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createNumber(
  -			double	theValue)
  +XObjectFactoryDefault::createNumber(double	theValue)
   {
   	XNumber*	theXNumber = m_xnumberAllocator.createNumber(theValue);
   
  @@ -339,8 +303,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createNodeSet(
  -			BorrowReturnMutableNodeRefList&		theValue)
  +XObjectFactoryDefault::createNodeSet(BorrowReturnMutableNodeRefList&	theValue)
   {
   	XNodeSet* const		theXNodeSet = m_xnodesetAllocator.createNodeSet(theValue);
   
  @@ -352,8 +315,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createString(
  -			const XalanDOMString&	theValue)
  +XObjectFactoryDefault::createString(const XalanDOMString&	theValue)
   {
   	XString* const	theXString = m_xstringAllocator.createString(theValue);
   
  @@ -365,8 +327,7 @@
   
   
   const XObjectPtr
  -XObjectFactoryDefault::createString(
  -			const XalanDOMChar*		theValue)
  +XObjectFactoryDefault::createString(const XalanDOMChar*		theValue)
   {
   	XString* const	theXString = m_xstringAllocator.createString(theValue);
   
  @@ -391,9 +352,44 @@
   
   
   
  +const XObjectPtr
  +XObjectFactoryDefault::createStringReference(const XalanDOMString&	theValue)
  +{
  +	XStringReference* const	theXStringReference = m_xstringReferenceAllocator.createString(theValue);
  +
  +	theXStringReference->setFactory(this);
  +
  +	return XObjectPtr(theXStringReference);
  +}
  +
  +
  +
  +const XObjectPtr
  +XObjectFactoryDefault::createStringAdapter(const XObjectPtr&	theValue)
  +{
  +	XStringAdapter* const	theXStringAdapter = m_xstringAdapterAllocator.createString(theValue);
  +
  +	theXStringAdapter->setFactory(this);
  +
  +	return XObjectPtr(theXStringAdapter);
  +}
  +
  +
  +
  +const XObjectPtr
  +XObjectFactoryDefault::createString(GetAndReleaseCachedString&	theValue)
  +{
  +	XStringCached* const	theXStringCached = m_xstringCachedAllocator.createString(theValue);
  +
  +	theXStringCached->setFactory(this);
  +
  +	return XObjectPtr(theXStringCached);
  +}
  +
  +
  +
   const XObjectPtr
  -XObjectFactoryDefault::createResultTreeFrag(
  -			ResultTreeFragBase*		theValue)
  +XObjectFactoryDefault::createResultTreeFrag(ResultTreeFragBase*		theValue)
   {
   	XResultTreeFrag* const	theResultTreeFrag =  m_xresultTreeFragAllocator.create(theValue);
   
  @@ -407,17 +403,21 @@
   void
   XObjectFactoryDefault::reset()
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -	using std::for_each;
  -#endif
  +	m_xstringAdapterAllocator.reset();
   
   	m_xstringAllocator.reset();
  -	    
  +
  +	m_xstringReferenceAllocator.reset();
  +
   	m_xnumberAllocator.reset();
   
   	m_xnodesetAllocator.reset();
   
   	m_xresultTreeFragAllocator.reset();
  +
  +#if !defined(XALAN_NO_NAMESPACES)
  +	using std::for_each;
  +#endif
   
   	for_each(m_xobjects.begin(),
   			 m_xobjects.end(),
  
  
  
  1.17      +37 -26    xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp
  
  Index: XObjectFactoryDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XObjectFactoryDefault.hpp	2000/11/21 21:08:27	1.16
  +++ XObjectFactoryDefault.hpp	2000/12/21 04:43:49	1.17
  @@ -73,9 +73,12 @@
   
   
   
  -#include <XPath/XStringAllocator.hpp>
  -#include <XPath/XNumberAllocator.hpp>
   #include <XPath/XNodeSetAllocator.hpp>
  +#include <XPath/XNumberAllocator.hpp>
  +#include <XPath/XStringAllocator.hpp>
  +#include <XPath/XStringAdapterAllocator.hpp>
  +#include <XPath/XStringCachedAllocator.hpp>
  +#include <XPath/XStringReferenceAllocator.hpp>
   #include <XPath/XResultTreeFragAllocator.hpp>
   
   
  @@ -132,31 +135,23 @@
   	virtual void
   	reset();
   
  -	virtual const XObjectPtr
  -	clone(const XObject&	theXObject);
  -
   	virtual const XObjectPtr
  -	createBoolean(
  -			bool	theValue);
  +	createBoolean(bool	theValue);
   
   	virtual const XObjectPtr
  -	createNodeSet(
  -			BorrowReturnMutableNodeRefList&		theValue);
  +	createNodeSet(BorrowReturnMutableNodeRefList&	theValue);
   
   	virtual const XObjectPtr
   	createNull();
   
   	virtual const XObjectPtr
  -	createNumber(
  -			double	theValue);
  +	createNumber(double		theValue);
   
   	virtual const XObjectPtr
  -	createString(
  -			const XalanDOMString&	theValue);
  +	createString(const XalanDOMString&	theValue);
   
   	virtual const XObjectPtr
  -	createString(
  -			const XalanDOMChar*		theValue);
  +	createString(const XalanDOMChar*	theValue);
   
   	virtual const XObjectPtr
   	createString(
  @@ -164,29 +159,36 @@
   			unsigned int			theLength);
   
   	virtual const XObjectPtr
  +	createStringReference(const XalanDOMString&		theValue);
  +
  +	virtual const XObjectPtr
  +	createStringAdapter(const XObjectPtr&	theValue);
  +
  +	virtual const XObjectPtr
  +	createString(GetAndReleaseCachedString&		theValue);
  +
  +	virtual const XObjectPtr
   	createUnknown(
   			const XalanDOMString&	theValue);
   
   	virtual const XObjectPtr
  -	createResultTreeFrag(
  -			ResultTreeFragBase*		theValue);
  +	createResultTreeFrag(ResultTreeFragBase*	theValue);
   
   	virtual const XObjectPtr
  -	createSpan(
  -			BorrowReturnMutableNodeRefList&		theValue);
  +	createSpan(BorrowReturnMutableNodeRefList&	theValue);
   
   #if defined(XALAN_NO_NAMESPACES)
  -	typedef set<const XObject*, less<const XObject*> >	CollectionType;
  +	typedef set<XObject*, less<XObject*> >	CollectionType;
   #else
  -	typedef std::set<const XObject*>	CollectionType;
  +	typedef std::set<XObject*>				CollectionType;
   #endif
   
   protected:
   
   	virtual bool
   	doReturnObject(
  -			const XObject*	theXObject,
  -			bool			fInReset = false);
  +			XObject*	theXObject,
  +			bool		fInReset = false);
   
   private:
   
  @@ -201,17 +203,26 @@
   
   
   	// Data members...
  -	CollectionType				m_xobjects;
   
  -	const XalanAutoPtr<XNull>	m_XNull;
  +	// This one's first, since it may be be holding references
  +	// to objects in other allocators.
  +	XStringAdapterAllocator		m_xstringAdapterAllocator;
   
   	XStringAllocator			m_xstringAllocator;
  -	    
  +
  +	XStringCachedAllocator		m_xstringCachedAllocator;
  +
  +	XStringReferenceAllocator	m_xstringReferenceAllocator;
  +
   	XNumberAllocator			m_xnumberAllocator;
   
   	XNodeSetAllocator			m_xnodesetAllocator;
   
   	XResultTreeFragAllocator	m_xresultTreeFragAllocator;
  +
  +	CollectionType				m_xobjects;
  +
  +	const XalanAutoPtr<XNull>	m_XNull;
   };