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/04/11 04:34:13 UTC

cvs commit: xml-xalan/c/src/XSLT NodeSorter.cpp NodeSorter.hpp

dbertoni    01/04/10 19:34:13

  Modified:    c/src/XSLT NodeSorter.cpp NodeSorter.hpp
  Log:
  Make caching of sort results a compile time option, which is not enabled by default.
  
  Revision  Changes    Path
  1.20      +17 -0     xml-xalan/c/src/XSLT/NodeSorter.cpp
  
  Index: NodeSorter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- NodeSorter.cpp	2001/03/29 22:22:38	1.19
  +++ NodeSorter.cpp	2001/04/11 02:34:12	1.20
  @@ -236,8 +236,13 @@
   
   		const int	theCompareResult = doCollationCompare(
   				m_executionContext,
  +#if defined(XALAN_SORT_CACHE_RESULTS)
   				getStringResult(theKey, theLHS),
   				getStringResult(theKey, theRHS),
  +#else
  +				getStringResult(theKey, theLHS)->str(),
  +				getStringResult(theKey, theRHS)->str(),
  +#endif
   				theKey.getLanguageString());
   
   		if(0 == theCompareResult)
  @@ -309,6 +314,9 @@
   	const XPath* const	xpath = theKey.getSelectPattern();
   	assert(xpath != 0);
   
  +#if !defined(XALAN_SORT_CACHE_RESULTS)
  +	return xpath->execute(node, *theKey.getPrefixResolver(), m_executionContext)->num();
  +#else
   	const NumberResultsCacheMapType::const_iterator		i =
   		m_numberResultsCache.find(xpath);
   
  @@ -336,11 +344,16 @@
   #endif
   
   	return theResult;
  +#endif
   }
   
   
   
  +#if !defined(XALAN_SORT_CACHE_RESULTS)
  +const XObjectPtr
  +#else
   const XalanDOMString&
  +#endif
   NodeSorter::NodeSortKeyCompare::getStringResult(
   				const NodeSortKey&	theKey,
   				XalanNode*			node) const
  @@ -350,6 +363,9 @@
   	const XPath* const	xpath = theKey.getSelectPattern();
   	assert(xpath != 0);
   
  +#if !defined(XALAN_SORT_CACHE_RESULTS)
  +	return xpath->execute(node, *theKey.getPrefixResolver(), m_executionContext);
  +#else
   	const StringResultsCacheMapType::const_iterator		i =
   		m_stringResultsCache.find(xpath);
   
  @@ -380,4 +396,5 @@
   	assign(theString, theResult);
   
   	return theString;
  +#endif
   }
  
  
  
  1.11      +11 -7     xml-xalan/c/src/XSLT/NodeSorter.hpp
  
  Index: NodeSorter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NodeSorter.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NodeSorter.hpp	2001/01/16 20:48:18	1.10
  +++ NodeSorter.hpp	2001/04/11 02:34:12	1.11
  @@ -82,6 +82,7 @@
   class MutableNodeRefList;
   class StylesheetExecutionContext;
   class XalanNode;
  +class XObjectPtr;
   class XPath;
   
   
  @@ -156,9 +157,12 @@
   			m_executionContext(executionContext),
   			m_list(theList),
   			m_nodes(theNodes),
  -			m_nodeSortKeys(theNodeSortKeys),
  +			m_nodeSortKeys(theNodeSortKeys)
  +#if defined(XALAN_SORT_CACHE_RESULTS)
  +			,
   			m_numberResultsCache(),
   			m_stringResultsCache()
  +#endif
   		{
   		}
   
  @@ -186,7 +190,11 @@
   				const NodeSortKey&	theKey,
   				XalanNode*			node) const;
   
  +#if !defined(XALAN_SORT_CACHE_RESULTS)
  +		const XObjectPtr
  +#else
   		const XalanDOMString&
  +#endif
   		getStringResult(
   				const NodeSortKey&	theKey,
   				XalanNode*			node) const;
  @@ -222,8 +230,10 @@
   		typedef	std::map<const XPath*, StringResultsNodeCacheMapType>	StringResultsCacheMapType;
   #endif
   
  +#if defined(XALAN_SORT_CACHE_RESULTS)
   		mutable NumberResultsCacheMapType	m_numberResultsCache;
   		mutable StringResultsCacheMapType	m_stringResultsCache;
  +#endif
   	};
   
   private:
  @@ -243,12 +253,6 @@
   			const MutableNodeRefList&		theList,
   			NodeVectorType&					v,
   			const NodeSortKeyVectorType&	keys) const;
  -
  -	/**
  -	 * @@ TODO: Adjust this for locale.
  -	 * JMD: java: not used yet, placeholder
  -     */
  -  // NumberFormat m_formatter = NumberFormat.getNumberInstance();  
   };
   
   
  
  
  

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