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...@apache.org on 2001/11/17 01:12:59 UTC

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

dbertoni    01/11/16 16:12:59

  Modified:    c/src/XPath XObject.cpp
  Log:
  More efficient comparisons of strings.  Make sure strings are compared properly.
  
  Revision  Changes    Path
  1.27      +213 -9    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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- XObject.cpp	2001/10/19 18:37:47	1.26
  +++ XObject.cpp	2001/11/17 00:12:59	1.27
  @@ -303,6 +303,210 @@
   
   
   
  +struct
  +equalsDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DOMStringEqualsFunction()(theLHS, theRHS);
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DOMStringEqualsFunction()(theLHS.str(), theRHS);
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DOMStringEqualsFunction()(theLHS, theRHS.str());
  +	}
  +};
  +
  +
  +
  +struct
  +notEqualsDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DOMStringNotEqualsFunction()(theLHS, theRHS);
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DOMStringNotEqualsFunction()(theLHS.str(), theRHS);
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DOMStringNotEqualsFunction()(theLHS, theRHS.str());
  +	}
  +};
  +
  +
  +
  +struct
  +lessThanDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::lessThan(
  +				DOMStringToDouble(theLHS),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::lessThan(
  +				theLHS.num(),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DoubleSupport::lessThan(
  +				DOMStringToDouble(theLHS),
  +				theRHS.num());
  +	}
  +};
  +
  +
  +
  +struct
  +lessThanOrEqualDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::lessThanOrEqual(
  +				DOMStringToDouble(theLHS),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::lessThanOrEqual(
  +				theLHS.num(),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DoubleSupport::lessThanOrEqual(
  +				DOMStringToDouble(theLHS),
  +				theRHS.num());
  +	}
  +};
  +
  +
  +
  +struct
  +greaterThanDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::greaterThan(
  +				DOMStringToDouble(theLHS),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::greaterThan(
  +				theLHS.num(),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DoubleSupport::greaterThan(
  +				DOMStringToDouble(theLHS),
  +				theRHS.num());
  +	}
  +};
  +
  +
  +
  +struct
  +greaterThanOrEqualDOMString
  +{
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::greaterThanOrEqual(
  +				DOMStringToDouble(theLHS),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XObject&			theLHS,
  +			const XalanDOMString&	theRHS) const
  +	{
  +		return DoubleSupport::greaterThanOrEqual(
  +				theLHS.num(),
  +				DOMStringToDouble(theRHS));
  +	}
  +
  +	bool
  +	operator()(
  +			const XalanDOMString&	theLHS,
  +			const XObject&			theRHS) const
  +	{
  +		return DoubleSupport::greaterThanOrEqual(
  +				DOMStringToDouble(theLHS),
  +				theRHS.num());
  +	}
  +};
  +
  +
  +
   template<class CompareFunction, class TypeFunction>
   bool
   doCompareNodeSets(
  @@ -375,7 +579,7 @@
   doCompareString(
   			const NodeRefListBase&	theLHSNodeSet,
   			const StringFunction&	theStringFunction,
  -			const XalanDOMString&	theRHS,
  +			const XObject&			theRHS,
   			const CompareFunction&	theCompareFunction,
   			XPathExecutionContext&	executionContext)
   {
  @@ -508,7 +712,7 @@
   			theResult = doCompareString(
   					theLHS.nodeset(),
   					getStringFromNodeFunction(executionContext),
  -					theRHS.str(),
  +					theRHS,
   					theStringCompareFunction,
   					executionContext);
   		}
  @@ -524,7 +728,7 @@
   		theResult = doCompareString(
   				theLHS.nodeset(),
   				getStringFromNodeFunction(executionContext),
  -				theRHS.str(),
  +				theRHS,
   				theStringCompareFunction,
   				executionContext);
   	}
  @@ -549,7 +753,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringEqualsFunction(),
  +				equalsDOMString(),
   				DoubleSupport::equalFunction(),
   				executionContext);
   }
  @@ -567,7 +771,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringNotEqualsFunction(),
  +				notEqualsDOMString(),
   				DoubleSupport::notEqualFunction(),
   				executionContext);
   }
  @@ -585,7 +789,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringLessThanFunction(),
  +				lessThanDOMString(),
   				DoubleSupport::lessThanFunction(),
   				executionContext);
   }
  @@ -603,7 +807,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringLessThanOrEqualFunction(),
  +				lessThanOrEqualDOMString(),
   				DoubleSupport::lessThanOrEqualFunction(),
   				executionContext);
   }
  @@ -621,7 +825,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringGreaterThanFunction(),
  +				greaterThanDOMString(),
   				DoubleSupport::greaterThanFunction(),
   				executionContext);
   }
  @@ -639,7 +843,7 @@
   				theLHS,
   				theRHS,
   				theRHSType,
  -				DOMStringGreaterThanOrEqualFunction(),
  +				greaterThanOrEqualDOMString(),
   				DoubleSupport::greaterThanOrEqualFunction(),
   				executionContext);
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org