You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by au...@locus.apache.org on 2000/11/06 20:28:59 UTC

cvs commit: xml-xalan/c/src/XPath FunctionConcat.hpp FunctionLang.hpp FunctionLocalName.hpp FunctionName.hpp FunctionNamespaceURI.hpp FunctionSubstring.hpp FunctionSubstringAfter.hpp FunctionSubstringBefore.hpp FunctionSum.hpp FunctionTranslate.hpp

auriemma    00/11/06 11:28:56

  Modified:    c/src/XPath FunctionConcat.hpp FunctionLang.hpp
                        FunctionLocalName.hpp FunctionName.hpp
                        FunctionNamespaceURI.hpp FunctionSubstring.hpp
                        FunctionSubstringAfter.hpp
                        FunctionSubstringBefore.hpp FunctionSum.hpp
                        FunctionTranslate.hpp
  Log:
  Modified XSLT Functions so they are called with a specific number of arguments.
  
  Revision  Changes    Path
  1.6       +26 -61    xml-xalan/c/src/XPath/FunctionConcat.hpp
  
  Index: FunctionConcat.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionConcat.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionConcat.hpp	2000/11/02 01:45:56	1.5
  +++ FunctionConcat.hpp	2000/11/06 19:27:48	1.6
  @@ -64,93 +64,58 @@
   
   
   
  -#include <vector>
  -
  -
  -
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "concat" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionConcat : public Function
   {
   public:
   
  +	FunctionConcat();
  +
  +	virtual
  +	~FunctionConcat();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		const XObjectArgVectorType::size_type	theArgCount = args.size();
  -
  -		if (theArgCount < 2)
  -		{
  -			executionContext.error("The concat() function takes at least two arguments!",
  -								   context);
  -		}
  -
  -		unsigned int	theCombinedLength = 0;
  -
  -		const XObjectArgVectorType::const_iterator	theEnd = args.end();
  -
  -		{
  -			XObjectArgVectorType::const_iterator	i = args.begin();
  -
  -			for(; i != theEnd; ++i)
  -			{
  -				theCombinedLength += length((*i)->str());
  -			}
  -		}
  -
  -		XalanDOMString	theResult;
  -
  -		reserve(theResult, theCombinedLength + 1);
  -
  -		{
  -			XObjectArgVectorType::const_iterator	i = args.begin();
  -
  -			for(; i != theEnd; ++i)
  -			{
  -				theResult += (*i)->str();
  -			}
  -		}
  +			XalanNode*						/* context */,			
  +			const XObject*					arg1,
  +			const XObject*					arg2);
   
  -		return executionContext.getXObjectFactory().createString(theResult);
  -	}
  +	virtual XObject*
  +	execute(
  +			XPathExecutionContext&			executionContext,
  +			XalanNode*						/* context */,			
  +			const XObject*					arg1,
  +			const XObject*					arg2,
  +			const XObject*					arg3);
   
  +	virtual XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						/* context */,
  +		int								/* opPos */,
  +		const XObjectArgVectorType&		args);
  +
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionConcat*
   #endif
  -	clone() const
  -	{
  -		return new FunctionConcat(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionConcat&
  
  
  
  1.10      +11 -75    xml-xalan/c/src/XPath/FunctionLang.hpp
  
  Index: FunctionLang.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLang.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- FunctionLang.hpp	2000/11/02 01:45:57	1.9
  +++ FunctionLang.hpp	2000/11/06 19:27:52	1.10
  @@ -64,111 +64,47 @@
   
   
   
  -#include <vector>
  -
  -
  -
   #include <XalanDOM/XalanElement.hpp>
   #include <XalanDOM/XalanNode.hpp>
   
   
   
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -#include <PlatformSupport/XalanUnicode.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "lang" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionLang : public Function
   {
   public:
   
  +	FunctionLang();
  +
  +	virtual
  +	~FunctionLang();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		if (args.size() != 1)
  -		{
  -			executionContext.error("The lang() function takes one argument!",
  -								   context);
  -		}
  -
  -		const XalanNode*		parent = context;
  -
  -		bool					fMatch = false;
  -
  -		const XalanDOMString&	lang = args[0]->str();
  -
  -		while(0 != parent)
  -		{
  -			if(XalanNode::ELEMENT_NODE == parent->getNodeType())
  -			{
  -				const XalanElement* const	theElementNode =
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -					(const XalanElement*)parent;
  -#else
  -					static_cast<const XalanElement*>(parent);
  -#endif
  -
  -				const XalanDOMString		langVal =
  -					theElementNode->getAttribute(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("xml:lang")));
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
  -				if(0 != length(langVal))
  -				{
  -					if(startsWith(toLowerCase(langVal), toLowerCase(lang)))
  -					{
  -						const unsigned int	valLen = length(lang);
  -
  -						if(length(langVal) == valLen ||
  -						   charAt(langVal, valLen) == XalanUnicode::charHyphenMinus)
  -						{
  -							fMatch = true;
  -
  -							break;
  -						}
  -					}
  -				}
  -			}
  -
  -			parent = executionContext.getParentOfNode(*parent);
  -		}
  -
  -		return executionContext.getXObjectFactory().createBoolean(fMatch);
  -	}
  -
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionLang*
   #endif
  -	clone() const
  -	{
  -		return new FunctionLang(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionLang&
  
  
  
  1.10      +17 -75    xml-xalan/c/src/XPath/FunctionLocalName.hpp
  
  Index: FunctionLocalName.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLocalName.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- FunctionLocalName.hpp	2000/11/02 01:45:57	1.9
  +++ FunctionLocalName.hpp	2000/11/06 19:27:54	1.10
  @@ -78,103 +78,45 @@
   
   
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
   /**
    * XPath implementation of "local-name" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionLocalName : public Function
   {
   public:
   
  +	FunctionLocalName();
  +
  +	virtual
  +	~FunctionLocalName();
  +
   	// These methods are inherited from Function ...
   
  -	virtual XObject*
  +	XObject*
   	execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		const XObjectArgVectorType::size_type	theSize =
  -			args.size();
  -
  -		if(theSize > 1)
  -		{
  -			executionContext.error("The local-name() function takes zero or one arguments!",
  -								   context);
  -		}
  -
  -		XObject*	theResult = 0;
  -
  -		if (theSize == 0)
  -		{
  -			if (context == 0)
  -			{
  -				executionContext.error("The local-name() function requires a non-null context node!");
  -			}
  -			else
  -			{
  -				theResult = getLocalName(executionContext, *context);
  -			}
  -		}
  -		else
  -		{
  -			assert(args[0] != 0);
  -
  -			const NodeRefListBase&	theNodeList = args[0]->nodeset();
  -
  -			if (theNodeList.getLength() == 0)
  -			{
  -				theResult = executionContext.getXObjectFactory().createString(XalanDOMString());
  -			}
  -			else
  -			{
  -				theResult = getLocalName(executionContext, *theNodeList.item(0));
  -			}
  -		}
  -
  -		return theResult;
  -	}
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1);
  +		
  +	XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionLocalName*
   #endif
  -	clone() const
  -	{
  -		return new FunctionLocalName(*this);
  -	}
  +	clone() const;
   
   private:
   
  -	XObject*
  -	getLocalName(
  -			XPathExecutionContext&	executionContext,
  -			const XalanNode&		node)
  -	{
  -		const XalanNode::NodeType	theType = node.getNodeType();
  -
  -		if(theType == XalanNode::ATTRIBUTE_NODE ||
  -			theType == XalanNode::ELEMENT_NODE ||
  -			theType == XalanNode::PROCESSING_INSTRUCTION_NODE)
  -		{
  -			return executionContext.getXObjectFactory().createString(executionContext.getLocalNameOfNode(node));
  -		}
  -		else
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString());
  -		}
  -	}
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionLocalName&
  
  
  
  1.8       +19 -86    xml-xalan/c/src/XPath/FunctionName.hpp
  
  Index: FunctionName.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionName.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionName.hpp	2000/11/02 01:45:57	1.7
  +++ FunctionName.hpp	2000/11/06 19:27:56	1.8
  @@ -79,115 +79,48 @@
   
   
   
  -#include <DOMSupport/DOMServices.hpp>
  -
  -
  -
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
   /**
    * XPath implementation of "name" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionName : public Function
   {
   public:
   
   	// These methods are inherited from Function ...
   
  -	virtual XObject*
  -	execute(
  -			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		const XObjectArgVectorType::size_type	theSize = args.size();
  -
  -		XObject*	theResult = 0;
  -
  -		if(theSize == 0)
  -		{
  -			if (context == 0)
  -			{
  -				executionContext.error("The name() function requires a non-null context node!",
  -									   context);
  -			}
  -			else
  -			{
  -				theResult = getName(executionContext, *context);
  -			}
  -		}
  -		else if (theSize == 1)
  -		{
  -			assert(args[0] != 0);
  -
  -			const NodeRefListBase&	theNodeList = args[0]->nodeset();
  -
  -			if (theNodeList.getLength() == 0)
  -			{
  -				theResult = executionContext.getXObjectFactory().createString(XalanDOMString());
  -			}
  -			else
  -			{
  -				assert(theNodeList.item(0) != 0);
  -
  -				theResult = getName(executionContext, *theNodeList.item(0));
  -			}
  -		}
  -		else
  -		{
  -			executionContext.error("The name() function takes either zero arguments or one argument!",
  -								   context);
  -		}
  +	FunctionName();
  +
  +	virtual
  +	~FunctionName();
   
  -		assert(theResult != 0);
  +	// These methods are inherited from Function ...
   
  -		return theResult;
  -	}
  +	XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context,			
  +		const XObject*					arg1);
  +		
  +	XObject*
  +	execute(
  +		XPathExecutionContext&			executionContext,
  +		XalanNode*						context);
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionName*
   #endif
  -	clone() const
  -	{
  -		return new FunctionName(*this);
  -	}
  -
  +	clone() const;
  +	
   private:
   
  -	XObject*
  -	getName(
  -			XPathExecutionContext&	executionContext,
  -			const XalanNode&		node)
  -	{
  -//		if (node.getNodeType() == XalanNode::ATTRIBUTE_NODE)
  -//		{
  -//			const XalanDOMString&	theName = executionContext.getNameOfNode(node);
  -
  -//			if (startsWith(theName, DOMServices::s_XMLNamespaceWithSeparator) == true)
  -//			{
  -//			}
  -//			else
  -//			{
  -//				return executionContext.getXObjectFactory().createString();
  -//			}
  -//		}
  -//		else
  -		{
  -			return executionContext.getXObjectFactory().createString(executionContext.getNameOfNode(node));
  -		}
  -	}
  +	const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionName&
  
  
  
  1.8       +18 -70    xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp
  
  Index: FunctionNamespaceURI.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionNamespaceURI.hpp	2000/11/02 01:45:57	1.7
  +++ FunctionNamespaceURI.hpp	2000/11/06 19:27:58	1.8
  @@ -74,97 +74,45 @@
   
   
   #include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
   /**
    * XPath implementation of "namespace-uri" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionNamespaceURI : public Function
   {
   public:
   
   	// These methods are inherited from Function ...
  +	FunctionNamespaceURI();
   
  -	virtual XObject*
  +	virtual
  +	~FunctionNamespaceURI();
  +
  +	XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		const XalanDOMString*	theNamespace = 0;
  -
  -		if (args.size() > 1)
  -		{
  -			executionContext.error("The namespace-uri() function takes zero arguments or one argument!",
  -								   context);
  -		}
  -		else if (args.size() == 1)
  -		{
  -			theNamespace = getNamespaceFromNodeSet(*args[0],
  -												   executionContext);
  -		}
  -		else if (context == 0)
  -		{
  -			executionContext.error("The namespace-uri() function requires a non-null context node!",
  -								   context);
  -		}
  -		else
  -		{
  -			// The XPath standard says that if there are no arguments,
  -			// the argument defaults to a node set with the context node
  -			// as the only member.
  -			// So we have to create an XObject with the context node as
  -			// the only member.
  -			// We shroud the temporary getNamespaceFromNodeSet( in a
  -			// FactoryObjectAutoPointer because it can be deleted once
  -			// we're done.
  -
  -			// An XObject that contains the context node.
  -			XObjectGuard	theXObject(executionContext.getXObjectFactory(),
  -									   executionContext.createNodeSet(*context));
  -
  -
  -			theNamespace = getNamespaceFromNodeSet(*theXObject.get(),
  -												   executionContext);
  -		}
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
  -		return executionContext.getXObjectFactory().createString(theNamespace == 0 ? XalanDOMString() : *theNamespace);
  -	}
  +	XObject*
  +	execute(
  +			XPathExecutionContext&			executionContext,
  +			XalanNode*						context);	
   
   	virtual Function*
  -	clone() const
  -	{
  -		return new FunctionNamespaceURI(*this);
  -	}
  +	clone() const;
   
   private:
   
  -	static const XalanDOMString*
  +	static XalanDOMString
   	getNamespaceFromNodeSet(const XObject&			theXObject,
  -							XPathExecutionContext&	theContext)
  -	{
  -		const NodeRefListBase&	theList = theXObject.nodeset();
  -
  -		if (theList.getLength() == 0)
  -		{
  -			return 0;
  -		}
  -		else
  -		{
  -			assert(theList.item(0) != 0);
  -
  -			return &theContext.getNamespaceOfNode(*theList.item(0));
  -		}
  -	}
  +							XPathExecutionContext&	theContext);
  +
  +	const XalanDOMString
  +	getError() const;
  +
   
   	// Not implemented...
   	FunctionNamespaceURI&
  
  
  
  1.8       +23 -97    xml-xalan/c/src/XPath/FunctionSubstring.hpp
  
  Index: FunctionSubstring.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstring.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionSubstring.hpp	2000/11/02 22:25:46	1.7
  +++ FunctionSubstring.hpp	2000/11/06 19:28:00	1.8
  @@ -68,134 +68,60 @@
   
   
   
  -#include <PlatformSupport/DoubleSupport.hpp>
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
   #include <XPath/FunctionRound.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
   
   
   
  +#include <PlatformSupport/DoubleSupport.hpp>
  +
  +
  +
   /**
    * XPath implementation of "substring" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionSubstring : public Function
   {
   public:
   
  +	FunctionSubstring();
  +
  +	virtual
  +	~FunctionSubstring();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		const XObjectArgVectorType::size_type	theArgCount =
  -				args.size();
  -
  -		if (theArgCount < 2 || theArgCount > 3)
  -		{
  -			executionContext.error("The substring() function takes two or three arguments!",
  -								   context);
  -		}
  -
  -		const XalanDOMString&	theSourceString = args[0]->str();
  -		const unsigned int		theSourceStringLength = length(theSourceString);
  -
  -#if defined(XALAN_NO_NAMESPACES)
  -		typedef vector<XalanDOMChar>		VectorType;
  -#else
  -		typedef std::vector<XalanDOMChar>	VectorType;
  -#endif
  +			XalanNode*						context,			
  +			const XObject*					arg1,
  +			const XObject*					arg2,
  +			const XObject*					arg3);
   
  -		// This buffer will hold the output characters.
  -		VectorType	theBuffer;
  +	virtual XObject*
  +	execute(
  +			XPathExecutionContext&			executionContext,
  +			XalanNode*						context,			
  +			const XObject*					arg1,
  +			const XObject*					arg2);
   
  -		if (theSourceStringLength > 0)
  -		{
  -			// The substring can only be as long as the source string,
  -			// so reserve enough space now.  Also reserve space for
  -			// the terminating 0.
  -			theBuffer.reserve(theSourceStringLength);
  -
  -			// $$$ ToDo: Add support for NaN.
  -
  -			// Get the value of the second argument...
  -			const double	theSecondArgValue =
  -				FunctionRound::getRoundedValue(args[1]->num());
  -
  -			// Now, total the second and third arguments.  If
  -			// the third argument is missing, make the total
  -			// DBL_MAX.
  -			const double	theTotal =
  -					theArgCount == 2 ? DBL_MAX :
  -									   FunctionRound::getRoundedValue(theSecondArgValue + args[2]->num());
  -
  -			if (DoubleSupport::isNaN(theSecondArgValue) == false &&
  -				DoubleSupport::isNaN(theTotal) == false &&
  -				DoubleSupport::isNegativeInfinity(theTotal) == false)
  -			{
  -				// Start with 1, since strings are index from 1 in the XPath spec,
  -				for (unsigned int i = 1; i <= theSourceStringLength; i++)
  -				{
  -					// Is the index greater than or equal to the second argument?
  -					if (i >= theSecondArgValue)
  -					{
  -						// Is it less than the sum of the second and
  -						// third arguments?
  -						if (i < theTotal)
  -						{
  -							// It is, so include the character.
  -							theBuffer.push_back(charAt(theSourceString, i - 1));
  -						}
  -						else
  -						{
  -							// It's not, so stop.
  -							break;
  -						}
  -					}
  -				}
  -			}
  -		}
  -
  -		const VectorType::size_type		theSize = theBuffer.size();
  -
  -		if (theSize == 0)
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString());
  -		}
  -		else
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(), theSize));
  -		}
  -	}
   
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionSubstring*
   #endif
  -	clone() const
  -	{
  -		return new FunctionSubstring(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionSubstring&
  
  
  
  1.7       +12 -71    xml-xalan/c/src/XPath/FunctionSubstringAfter.hpp
  
  Index: FunctionSubstringAfter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringAfter.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FunctionSubstringAfter.hpp	2000/11/02 22:25:47	1.6
  +++ FunctionSubstringAfter.hpp	2000/11/06 19:28:02	1.7
  @@ -64,102 +64,43 @@
   
   
   
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "substring-after" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionSubstringAfter : public Function
   {
   public:
   
  +	FunctionSubstringAfter();
  +
  +	virtual
  +	~FunctionSubstringAfter();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		if (args.size() != 2)
  -		{
  -			executionContext.error("The substring-after() function takes two arguments!",
  -								   context);
  -		}
  -
  -		const XalanDOMString&	theFirstString = args[0]->str();
  -		const XalanDOMString&	theSecondString = args[1]->str();
  +			XalanNode*						context,			
  +			const XObject*					arg1,
  +			const XObject*					arg2);
   
  -		const unsigned int		theIndex = indexOf(theFirstString,
  -												   theSecondString);
  -
  -		const unsigned int		theFirstStringLength = length(theFirstString);
  -
  -#if defined(XALAN_NO_NAMESPACES)
  -		typedef vector<XalanDOMChar>		VectorType;
  -#else
  -		typedef std::vector<XalanDOMChar>	VectorType;
  -#endif
  -
  -		// This buffer will hold the output characters.
  -		VectorType	theBuffer;
  -
  -		if (theIndex < theFirstStringLength)
  -		{
  -			unsigned int		theStartIndex = theIndex + length(theSecondString);
  -
  -			// The result string can only be as large as the source string, so
  -			// just reserve the space now.  Also reserve a space for the
  -			// terminating 0.
  -			theBuffer.reserve(theFirstStringLength - theStartIndex + 1);
  -
  -			for (; theStartIndex < theFirstStringLength; theStartIndex++)
  -			{
  -				theBuffer.push_back(charAt(theFirstString, theStartIndex));
  -			}
  -		}
  -
  -		const VectorType::size_type		theSize = theBuffer.size();
  -
  -		if (theSize == 0)
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString());
  -		}
  -		else
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(), theSize));
  -		}
  -	}
  -
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionSubstringAfter*
   #endif
  -	clone() const
  -	{
  -		return new FunctionSubstringAfter(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionSubstringAfter&
  
  
  
  1.7       +12 -69    xml-xalan/c/src/XPath/FunctionSubstringBefore.hpp
  
  Index: FunctionSubstringBefore.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringBefore.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FunctionSubstringBefore.hpp	2000/11/02 22:25:48	1.6
  +++ FunctionSubstringBefore.hpp	2000/11/06 19:28:04	1.7
  @@ -64,100 +64,43 @@
   
   
   
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
  -#include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "substring-before" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionSubstringBefore : public Function
   {
   public:
   
  +	FunctionSubstringBefore();
  +
  +	virtual
  +	~FunctionSubstringBefore();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		if (args.size() != 2)
  -		{
  -			executionContext.error("The substring-before() function takes two arguments!",
  -								   context);
  -		}
  +			XalanNode*						context,			
  +			const XObject*					arg1,
  +			const XObject*					arg2);
   
  -		const XalanDOMString&	theFirstString = args[0]->str();
  -		const XalanDOMString&	theSecondString = args[1]->str();
  -
  -		const unsigned int		theIndex = indexOf(theFirstString,
  -												   theSecondString);
  -
  -#if defined(XALAN_NO_NAMESPACES)
  -		typedef vector<XalanDOMChar>		VectorType;
  -#else
  -		typedef std::vector<XalanDOMChar>	VectorType;
  -#endif
  -
  -		// This buffer will hold the output characters.
  -		VectorType	theBuffer;
  -
  -		if (theIndex < length(theFirstString))
  -		{
  -			// The result string can only be as large as the source string, so
  -			// just reserve the space now.  Also reserve a space for the
  -			// terminating 0.
  -			theBuffer.reserve(theIndex + 2);
  -
  -			// Stop with the last character before the index.
  -			for (unsigned int i = 0; i < theIndex; i++)
  -			{
  -				theBuffer.push_back(charAt(theFirstString, i));
  -			}
  -		}
  -
  -		const VectorType::size_type		theSize = theBuffer.size();
  -
  -		if (theSize == 0)
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString());
  -		}
  -		else
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(), theSize));
  -		}
  -	}
  -
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionSubstringBefore*
   #endif
  -	clone() const
  -	{
  -		return new FunctionSubstringBefore(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionSubstringBefore&
  
  
  
  1.8       +11 -46    xml-xalan/c/src/XPath/FunctionSum.hpp
  
  Index: FunctionSum.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSum.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionSum.hpp	2000/11/02 01:45:58	1.7
  +++ FunctionSum.hpp	2000/11/06 19:28:06	1.8
  @@ -64,10 +64,6 @@
   
   
   
  -#include <vector>
  -
  -
  -
   #include <PlatformSupport/DOMStringHelper.hpp>
   #include <PlatformSupport/DoubleSupport.hpp>
   
  @@ -78,68 +74,37 @@
   
   
   
  -#include <XPath/NodeRefListBase.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "sum" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionSum : public Function
   {
   public:
   
  +	FunctionSum();
  +
  +	virtual
  +	~FunctionSum();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		if (args.size() != 1)
  -		{
  -			executionContext.error("The sum() function takes one argument!",
  -								   context);
  -		}
  +			XalanNode*						context,			
  +			const XObject*					arg1);
   
  -		const NodeRefListBase&	nl = args[0]->nodeset();
  -
  -		double					sum = 0.0;
  -
  -		const unsigned int		count = nl.getLength();
  -
  -		for (unsigned int i = 0; i < count; i++)
  -		{
  -			XalanDOMString	theData;
  -
  -			executionContext.getNodeData(*nl.item(i), theData);
  -
  -			sum += DoubleSupport::toDouble(theData);
  -		}
  -
  -		return executionContext.getXObjectFactory().createNumber(sum);
  -	}
  -
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionSum*
   #endif
  -	clone() const
  -	{
  -		return new FunctionSum(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionSum&
  
  
  
  1.8       +13 -94    xml-xalan/c/src/XPath/FunctionTranslate.hpp
  
  Index: FunctionTranslate.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionTranslate.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FunctionTranslate.hpp	2000/11/02 22:25:48	1.7
  +++ FunctionTranslate.hpp	2000/11/06 19:28:08	1.8
  @@ -64,125 +64,44 @@
   
   
   
  -#include <vector>
  -
  -
  -
  -#include <PlatformSupport/DOMStringHelper.hpp>
  -
  -
  -
   // Base class header file...
   #include <XPath/Function.hpp>
   
   
   
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
  -#include <XPath/XPathExecutionContext.hpp>
  -
  -
  -
   /**
    * XPath implementation of "translate" function.
    */
  -//
  -// These are all inline, even though
  -// there are virtual functions, because we expect that they will only be
  -// needed by the XPath class.
   class XALAN_XPATH_EXPORT FunctionTranslate : public Function
   {
   public:
   
  +	FunctionTranslate();
  +
  +	virtual
  +	~FunctionTranslate();
  +
   	// These methods are inherited from Function ...
   
   	virtual XObject*
   	execute(
   			XPathExecutionContext&			executionContext,
  -			XalanNode*						context,
  -			int								/* opPos */,
  -			const XObjectArgVectorType&		args)
  -	{
  -		if (args.size() != 3)
  -		{
  -			executionContext.error("The translate() function takes three arguments!",
  -								   context);
  -		}
  -
  -		const XalanDOMString&	theFirstString = args[0]->str();
  -		const XalanDOMString&	theSecondString = args[1]->str();
  -		const XalanDOMString&	theThirdString = args[2]->str();
  -
  -		const unsigned int		theFirstStringLength = length(theFirstString);
  -		const unsigned int		theSecondStringLength = length(theSecondString);
  -		const unsigned int		theThirdStringLength = length(theThirdString);
  -
  -#if defined(XALAN_NO_NAMESPACES)
  -		typedef vector<XalanDOMChar>		VectorType;
  -#else
  -		typedef std::vector<XalanDOMChar>	VectorType;
  -#endif
  +			XalanNode*						/* context */,			
  +			const XObject*					arg1,
  +			const XObject*					arg2,
  +			const XObject*					arg3);
   
  -		// A vector to contain the new characters.  We'll use it to construct
  -		// the result string.
  -		VectorType	theBuffer;
  -
  -		// The result string can only be as large as the first string, so
  -		// just reserve the space now.  Also reserve space for the
  -		// terminating 0.
  -		theBuffer.reserve(theFirstStringLength + 1);
  -
  -		for (unsigned int i = 0; i < theFirstStringLength; i++)
  -		{
  -			const XalanDOMChar		theCurrentChar = charAt(theFirstString, i);
  -
  -			const unsigned int		theIndex = indexOf(theSecondString, theCurrentChar);
  -
  -			if (theIndex >= theSecondStringLength)
  -			{
  -				// Didn't find the character in the second string, so it
  -				// is not translated.
  -				theBuffer.push_back(theCurrentChar);
  -			}
  -			else if (theIndex < theThirdStringLength)
  -			{
  -				// OK, there's a corresponding character in the
  -				// third string, so do the translation...
  -				theBuffer.push_back(charAt(theThirdString, theIndex));
  -			}
  -			else
  -			{
  -				// There's no corresponding character in the
  -				// third string, since it's shorter than the
  -				// second string.  In this case, the character
  -				// is removed from the output string, so don't
  -				// do anything.
  -			}
  -		}
  -
  -		const VectorType::size_type		theSize = theBuffer.size();
  -
  -		if (theSize == 0)
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString());
  -		}
  -		else
  -		{
  -			return executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(), theSize));
  -		}
  -	}
  -
   #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
   	virtual Function*
   #else
   	virtual FunctionTranslate*
   #endif
  -	clone() const
  -	{
  -		return new FunctionTranslate(*this);
  -	}
  +	clone() const;
   
   private:
  +
  +	virtual const XalanDOMString
  +	getError() const;
   
   	// Not implemented...
   	FunctionTranslate&