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/10/31 08:09:32 UTC

cvs commit: xml-xalan/c/src/PlatformSupport StringTokenizer.cpp StringTokenizer.hpp

dbertoni    2002/10/30 23:09:32

  Modified:    c/src/PlatformSupport StringTokenizer.cpp
                        StringTokenizer.hpp
  Log:
  Update default separators.
  
  Revision  Changes    Path
  1.10      +54 -55    xml-xalan/c/src/PlatformSupport/StringTokenizer.cpp
  
  Index: StringTokenizer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/StringTokenizer.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StringTokenizer.cpp	6 May 2002 05:18:45 -0000	1.9
  +++ StringTokenizer.cpp	31 Oct 2002 07:09:32 -0000	1.10
  @@ -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
  @@ -74,7 +74,6 @@
   	XalanUnicode::charHTab,
   	XalanUnicode::charLF,
   	XalanUnicode::charCR,
  -	XalanUnicode::charFF,
   	0,
   };
   
  @@ -84,11 +83,11 @@
   			const XalanDOMString&	theString,
   			const XalanDOMString&	theTokens,
   			bool					fReturnTokens) :
  -	m_String(theString),
  -	m_Tokens(theTokens),
  -	m_fReturnTokens(fReturnTokens),
  -	m_CurrentIndex(0),
  -	m_StringLength(length(theString)),
  +	m_string(theString),
  +	m_tokens(theTokens),
  +	m_returnTokens(fReturnTokens),
  +	m_currentIndex(0),
  +	m_stringLength(length(theString)),
   	m_tokensLength(length(theTokens))
   {
   }
  @@ -99,11 +98,11 @@
   			const XalanDOMString&	theString,
   			const XalanDOMChar*		theTokens,
   			bool					fReturnTokens) :
  -	m_String(theString),
  -	m_Tokens(XalanDOMString(theTokens)),
  -	m_fReturnTokens(fReturnTokens),
  -	m_CurrentIndex(0),
  -	m_StringLength(length(theString)),
  +	m_string(theString),
  +	m_tokens(XalanDOMString(theTokens)),
  +	m_returnTokens(fReturnTokens),
  +	m_currentIndex(0),
  +	m_stringLength(length(theString)),
   	m_tokensLength(length(theTokens))
   {
   }
  @@ -114,11 +113,11 @@
   			const XalanDOMChar*		theString,
   			const XalanDOMChar*		theTokens,
   			bool					fReturnTokens) :
  -	m_String(XalanDOMString(theString)),
  -	m_Tokens(XalanDOMString(theTokens)),
  -	m_fReturnTokens(fReturnTokens),
  -	m_CurrentIndex(0),
  -	m_StringLength(length(theString)),
  +	m_string(XalanDOMString(theString)),
  +	m_tokens(XalanDOMString(theTokens)),
  +	m_returnTokens(fReturnTokens),
  +	m_currentIndex(0),
  +	m_stringLength(length(theString)),
   	m_tokensLength(length(theTokens))
   {
   }
  @@ -129,11 +128,11 @@
   			const XalanDOMChar*		theString,
   			const XalanDOMString&	theTokens,
   			bool					fReturnTokens) :
  -	m_String(XalanDOMString(theString)),
  -	m_Tokens(theTokens),
  -	m_fReturnTokens(fReturnTokens),
  -	m_CurrentIndex(0),
  -	m_StringLength(length(theString)),
  +	m_string(XalanDOMString(theString)),
  +	m_tokens(theTokens),
  +	m_returnTokens(fReturnTokens),
  +	m_currentIndex(0),
  +	m_stringLength(length(theString)),
   	m_tokensLength(length(theTokens))
   {
   }
  @@ -157,48 +156,48 @@
   XalanDOMString
   StringTokenizer::nextToken()
   {
  -	assert(m_CurrentIndex < m_StringLength);
  +	assert(m_currentIndex < m_stringLength);
   
   	XalanDOMString	theToken;
   
   	// Find the index of the next delimiter.
  -	XalanDOMString::size_type	theIndex = FindNextDelimiterIndex(m_CurrentIndex);
  +	XalanDOMString::size_type	theIndex = FindNextDelimiterIndex(m_currentIndex);
   
  -	if (theIndex == m_CurrentIndex)
  +	if (theIndex == m_currentIndex)
   	{
  -		m_CurrentIndex = theIndex + 1;
  +		m_currentIndex = theIndex + 1;
   
  -		if (m_fReturnTokens == true)
  +		if (m_returnTokens == true)
   		{
   			// The next delimiter is at the current index.  If we're
   			// returning delimiters as tokens, then make that the
   			// return value.  Otherwise, return an empty string.
   			substring(
  -				m_String,
  +				m_string,
   				theToken,
   				theIndex,
   				theIndex + 1);
   		}
  -		else if (m_CurrentIndex < m_StringLength)
  +		else if (m_currentIndex < m_stringLength)
   		{
   			theToken = nextToken();
   		}
   	}
   	else
   	{
  -		if (theIndex == m_CurrentIndex)
  +		if (theIndex == m_currentIndex)
   		{
  -			theIndex = FindNextDelimiterIndex(m_CurrentIndex + 1);
  +			theIndex = FindNextDelimiterIndex(m_currentIndex + 1);
   		}
  -		assert(theIndex > m_CurrentIndex);
  +		assert(theIndex > m_currentIndex);
   
   		substring(
  -			m_String,
  +			m_string,
   			theToken,
  -			m_CurrentIndex,
  +			m_currentIndex,
   			theIndex);
   
  -		m_CurrentIndex = theIndex;
  +		m_currentIndex = theIndex;
   	}
   
   	return theToken;
  @@ -209,46 +208,46 @@
   void
   StringTokenizer::nextToken(XalanDOMString&	theToken)
   {
  -	assert(m_CurrentIndex < m_StringLength);
  +	assert(m_currentIndex < m_stringLength);
   
   	// Find the index of the next delimiter.
  -	XalanDOMString::size_type	theIndex = FindNextDelimiterIndex(m_CurrentIndex);
  +	XalanDOMString::size_type	theIndex = FindNextDelimiterIndex(m_currentIndex);
   
  -	if (theIndex == m_CurrentIndex)
  +	if (theIndex == m_currentIndex)
   	{
  -		m_CurrentIndex = theIndex + 1;
  +		m_currentIndex = theIndex + 1;
   
  -		if (m_fReturnTokens == true)
  +		if (m_returnTokens == true)
   		{
   			// The next delimiter is at the current index.  If we're
   			// returning delimiters as tokens, then make that the
   			// return value.  Otherwise, return an empty string.
   			substring(
  -				m_String,
  +				m_string,
   				theToken,
   				theIndex,
   				theIndex + 1);
   		}
  -		else if (m_CurrentIndex < m_StringLength)
  +		else if (m_currentIndex < m_stringLength)
   		{
   			theToken = nextToken();
   		}
   	}
   	else
   	{
  -		if (theIndex == m_CurrentIndex)
  +		if (theIndex == m_currentIndex)
   		{
  -			theIndex = FindNextDelimiterIndex(m_CurrentIndex + 1);
  +			theIndex = FindNextDelimiterIndex(m_currentIndex + 1);
   		}
  -		assert(theIndex > m_CurrentIndex);
  +		assert(theIndex > m_currentIndex);
   
   		substring(
  -				m_String,
  +				m_string,
   				theToken,
  -				m_CurrentIndex,
  +				m_currentIndex,
   				theIndex);
   
  -		m_CurrentIndex = theIndex;
  +		m_currentIndex = theIndex;
   	}
   }
   
  @@ -259,11 +258,11 @@
   {
   	size_t						theCount = 0;
   
  -	XalanDOMString::size_type	theCurrentIndex = m_CurrentIndex;
  +	XalanDOMString::size_type	theCurrentIndex = m_currentIndex;
   
  -	if (theCurrentIndex < m_StringLength)
  +	if (theCurrentIndex < m_stringLength)
   	{
  -		while(theCurrentIndex < m_StringLength)
  +		while(theCurrentIndex < m_stringLength)
   		{
   			const XalanDOMString::size_type		theNextIndex =
   				FindNextDelimiterIndex(theCurrentIndex);
  @@ -272,7 +271,7 @@
   			{
   				theCurrentIndex = theNextIndex + 1;
   
  -				if (m_fReturnTokens == true)
  +				if (m_returnTokens == true)
   				{
   					theCount++;
   				}
  @@ -298,14 +297,14 @@
   
   	XalanDOMString::size_type	theIndex = theStartIndex;
   
  -	while(theIndex < m_StringLength &&
  +	while(theIndex < m_stringLength &&
   		  fTokenFound == false)
   	{
   		const XalanDOMChar	theCurrentChar =
  -			charAt(m_String,
  +			charAt(m_string,
   				   theIndex);
   
  -		if (indexOf(m_Tokens,
  +		if (indexOf(m_tokens,
   					theCurrentChar) < m_tokensLength)
   		{
   			fTokenFound = true;
  
  
  
  1.11      +14 -8     xml-xalan/c/src/PlatformSupport/StringTokenizer.hpp
  
  Index: StringTokenizer.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/StringTokenizer.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StringTokenizer.hpp	26 Sep 2001 14:10:31 -0000	1.10
  +++ StringTokenizer.hpp	31 Oct 2002 07:09:32 -0000	1.11
  @@ -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
  @@ -85,7 +85,7 @@
   	 * 
   	 * @param theString     string to tokenize
   	 * @param theTokens     string of delimiters used to parse target, default
  -	 *                      is "\t\n\r\f"
  +	 *                      is "\t\n\r"
   	 * @param fReturnTokens if true, delimiter characters are also returned
   	 *                      as tokens, default is false
   	 */
  @@ -98,7 +98,7 @@
   	 * 
   	 * @param theString     string to tokenize
   	 * @param theTokens     string of delimiters used to parse target, default
  -	 *                      is "\t\n\r\f"
  +	 *                      is "\t\n\r"
   	 * @param fReturnTokens if true, delimiter characters are also returned
   	 *                      as tokens, default is false
   	 */
  @@ -168,6 +168,12 @@
   	size_type
   	countTokens() const;
   
  +	void
  +	reset()
  +	{
  +		m_currentIndex = 0;
  +	}
  +
   protected:
   
   	XalanDOMString::size_type
  @@ -175,15 +181,15 @@
   
   private:
   
  -	const XalanDOMString				m_String;
  +	const XalanDOMString				m_string;
   
  -	const XalanDOMString				m_Tokens;
  +	const XalanDOMString				m_tokens;
   
  -	const bool							m_fReturnTokens;
  +	const bool							m_returnTokens;
   
  -	XalanDOMString::size_type			m_CurrentIndex;
  +	XalanDOMString::size_type			m_currentIndex;
   
  -	const XalanDOMString::size_type		m_StringLength;
  +	const XalanDOMString::size_type		m_stringLength;
   
   	const XalanDOMString::size_type		m_tokensLength;
   };
  
  
  

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