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 2002/06/27 07:44:45 UTC

cvs commit: xml-xalan/c/src/XPath MutableNodeRefList.cpp MutableNodeRefList.hpp NodeRefList.hpp

dbertoni    2002/06/26 22:44:44

  Modified:    c/src/XPath MutableNodeRefList.cpp MutableNodeRefList.hpp
                        NodeRefList.hpp
  Log:
  New functionality.
  
  Revision  Changes    Path
  1.23      +56 -3     xml-xalan/c/src/XPath/MutableNodeRefList.cpp
  
  Index: MutableNodeRefList.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MutableNodeRefList.cpp	26 Sep 2001 20:58:46 -0000	1.22
  +++ MutableNodeRefList.cpp	27 Jun 2002 05:44:44 -0000	1.23
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -123,7 +123,7 @@
   
   
   MutableNodeRefList&
  -MutableNodeRefList::operator=(const NodeRefList&		theRHS)
  +MutableNodeRefList::operator=(const NodeRefList&	theRHS)
   {
   	if (this != &theRHS)
   	{
  @@ -230,7 +230,7 @@
   {
   	m_nodeList.clear();
   
  -	m_order = eUnknownOrder;
  +	m_order = eDocumentOrder;
   }
   
   
  @@ -710,4 +710,57 @@
   #endif
   		m_nodeList.begin(),
   		m_nodeList.end());
  +
  +	if (m_order == eDocumentOrder)
  +	{
  +		m_order = eReverseDocumentOrder;
  +	}
  +	else if (m_order == eReverseDocumentOrder)
  +	{
  +		m_order = eDocumentOrder;
  +	}
  +}
  +
  +
  +
  +void
  +MutableNodeRefList::reverseAssign(MutableNodeRefList&	nodelist) const
  +{
  +	if (&nodelist == this)
  +	{
  +		nodelist.reverse();
  +	}
  +	else
  +	{
  +#if defined(XALAN_MODERN_STL)
  +		nodelist.m_nodeList.assign(m_nodeList.rbegin(), m_nodeList.rend());
  +#else
  +		nodelist.reserve(m_nodeList.size());
  +
  +		typedef NodeListVectorType::const_reverse_iterator	const_reverse_iterator;
  +
  +		const const_reverse_iterator	theEnd = m_nodeList.rend();
  +		const_reverse_iterator			theCurrent = m_nodeList.rbegin();
  +
  +		while(theCurrent != theEnd)
  +		{
  +			nodelist.m_nodeList.push_back(*theCurrent);
  +
  +			++theCurrent;
  +		}
  +#endif
  +
  +		if (m_order == eDocumentOrder)
  +		{
  +			nodelist.m_order = eReverseDocumentOrder;
  +		}
  +		else if (m_order == eReverseDocumentOrder)
  +		{
  +			nodelist.m_order = eDocumentOrder;
  +		}
  +		else
  +		{
  +			nodelist.m_order = eUnknownOrder;
  +		}
  +	}
   }
  
  
  
  1.17      +9 -1      xml-xalan/c/src/XPath/MutableNodeRefList.hpp
  
  Index: MutableNodeRefList.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.hpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MutableNodeRefList.hpp	30 Nov 2001 21:54:21 -0000	1.16
  +++ MutableNodeRefList.hpp	27 Jun 2002 05:44:44 -0000	1.17
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -243,6 +243,14 @@
   	 */
   	void
   	reverse();
  +
  +	/**
  +	 * Assign the nodes in reverse order into the supplied instance.
  +	 *
  +	 * @param nodelist The target node list.
  +	 */
  +	void
  +	reverseAssign(MutableNodeRefList&	nodelist) const;
   
   	/**
   	 * Reserve space for the supplied number of nodes.
  
  
  
  1.16      +7 -0      xml-xalan/c/src/XPath/NodeRefList.hpp
  
  Index: NodeRefList.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefList.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- NodeRefList.hpp	26 Sep 2001 20:58:46 -0000	1.15
  +++ NodeRefList.hpp	27 Jun 2002 05:44:44 -0000	1.16
  @@ -106,6 +106,13 @@
   	NodeRefList&
   	operator=(const NodeRefList&	theRHS);
   
  +	bool
  +	empty() const
  +	{
  +		return m_nodeList.empty();
  +	}
  +
  +
   	// These methods are inherited from NodeRefListBase ...
   
   	virtual XalanNode*
  
  
  

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