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/05/01 18:41:13 UTC

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

dbertoni    00/05/01 09:41:12

  Modified:    c/src/XSLT ElemNumber.cpp ElemNumber.hpp
  Log:
  Simplified some code, and added some const stuff.
  
  Revision  Changes    Path
  1.15      +15 -28    xml-xalan/c/src/XSLT/ElemNumber.cpp
  
  Index: ElemNumber.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemNumber.cpp	2000/05/01 15:13:10	1.14
  +++ ElemNumber.cpp	2000/05/01 16:41:11	1.15
  @@ -1024,40 +1024,28 @@
   	return count;
   }
   
  -/*
  - *					CountersTable Class Implementation
  - */
   
  +
   ElemNumber::CounterVectorType& ElemNumber::CountersTable::getCounters(const ElemNumber* numberElem)
   {
  -	const ElemToCounterVectorMapType::const_iterator	it =
  -		m_counterMap.find(numberElem);
  -
  -	return (m_counterMap.end() == it) ? putElemNumber(numberElem) : (*it).second;
  +	return m_counterMap[numberElem];
   }
   
  -ElemNumber::CounterVectorType& ElemNumber::CountersTable::putElemNumber(const ElemNumber*	numberElem)
  -{
  -	m_counterMap.insert(ElemToCounterVectorMapType::value_type(numberElem, CounterVectorType()));
   
  -	return m_counterMap.find(numberElem)->second;
  -}
   
  -void ElemNumber::CountersTable::appendBtoFList(MutableNodeRefList& flist, MutableNodeRefList& blist)
  +void
  +ElemNumber::CountersTable::appendBtoFList(MutableNodeRefList& flist, MutableNodeRefList& blist)
   {
  -	int n = blist.getLength();
  +	const int n = blist.getLength();
  +
   	for(int i = (n-1); i >= 0; i--)
   	{
   		flist.addNode(blist.item(i));
   	}
   }
   
  -/**
  - * Count forward until the given node is found, or until 
  - * we have looked to the given amount.
  - * @node The node to count.
  - * @return The node count, or 0 if not found.
  - */
  +
  +
   int
   ElemNumber::CountersTable::countNode(
   			StylesheetExecutionContext&		support,
  @@ -1070,7 +1058,7 @@
   
   	const CounterVectorType::size_type	nCounters = counters.size();
   
  -	XalanNode*	target = numberElem->getTargetNode(support, node);
  +	XalanNode* 	target = numberElem->getTargetNode(support, node);
   
   	if(0 != target)
   	{
  @@ -1129,16 +1117,15 @@
   
   	return count;
   }
  +
   
  -/*
  - *					Counters Class Implementation
  - */
  -    
  -int ElemNumber::Counter::getPreviouslyCounted(
  +
  +int
  +ElemNumber::Counter::getPreviouslyCounted(
   		StylesheetExecutionContext&		support,
   		const XalanNode*				node) const
   {
  -	int n = m_countNodes.getLength();
  +	const int n = m_countNodes.getLength();
   	int result = 0;
   
   	for(int i = n-1;i >= 0; i--)
  @@ -1163,6 +1150,6 @@
   
   XalanNode* ElemNumber::Counter::getLast()
   {
  -	int size = m_countNodes.getLength();
  +	const int size = m_countNodes.getLength();
   	return (size > 0) ? m_countNodes.item(size-1) : 0;
   }
  
  
  
  1.12      +1 -8      xml-xalan/c/src/XSLT/ElemNumber.hpp
  
  Index: ElemNumber.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ElemNumber.hpp	2000/05/01 15:13:10	1.11
  +++ ElemNumber.hpp	2000/05/01 16:41:11	1.12
  @@ -58,7 +58,7 @@
   #define XALAN_ELEMNUMBER_HEADER_GUARD 
   
   /**
  - * $Id: ElemNumber.hpp,v 1.11 2000/05/01 15:13:10 dbertoni Exp $
  + * $Id: ElemNumber.hpp,v 1.12 2000/05/01 16:41:11 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -467,13 +467,6 @@
   			 * the given ElemNumber object.
   			 */
   			CounterVectorType& getCounters(const ElemNumber*	numberElem);
  -
  -
  -			/**
  -			 * Put a counter into the table and create an empty 
  -			 * vector as it's value.
  -			 */
  -			CounterVectorType& putElemNumber(const ElemNumber*	numberElem);
   
   			/**
   			 * Add a list of counted nodes that were built in backwards document