Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skStringTokenizer.h

00001 /*
00002   Copyright 1996-2003
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019   $Id: skStringTokenizer_8h-source.html,v 1.17 2004/12/17 21:31:14 sdw Exp $
00020 */
00021 #ifndef skSTRINGTOKENIZER_H
00022 #define skSTRINGTOKENIZER_H
00023 
00024 #include "skString.h"
00025 
00026 
00031 class CLASSEXPORT skStringTokenizer 
00032 #ifdef __SYMBIAN32__
00033 : public CBase
00034 #endif
00035 {
00036 
00037 
00038  public:
00039 #ifndef __SYMBIAN32__
00040 
00047   skStringTokenizer(const skString& str, const skString& delim, bool returnDelims);
00048   
00059   skStringTokenizer(const skString& str, const skString& delim);
00071   skStringTokenizer(const skString& str);
00072 #endif
00073 
00076   inline skStringTokenizer();
00080   virtual inline ~skStringTokenizer();
00081 
00090   IMPORT_C void init(const skString& str, const skString& delim, bool returnDelims);
00091 #ifdef __SYMBIAN32__
00092 
00101   inline void init(const skString& str, const TDesC& delim, bool returnDelims);
00102 #endif
00103 
00112   IMPORT_C bool hasMoreTokens();
00113 
00120   IMPORT_C skString nextToken();
00134   IMPORT_C skString nextToken(const skString& delim);
00142   IMPORT_C int countTokens();
00143  private:
00144   int m_CurrentPosition;
00145   int m_NewPosition;
00146   int m_MaxPosition;
00147   skString m_Str;
00148   skString m_Delimiters;
00149   bool m_RetDelims;
00150   bool m_DelimsChanged;
00151 
00157   Char m_MaxDelimChar;
00158   
00162   void setMaxDelimChar();
00168   int skipDelimiters(int startPos);
00173   int scanToken(int startPos);
00174 };
00175 //------------------------------------------
00176 inline skStringTokenizer::skStringTokenizer()
00177 //------------------------------------------
00178   :  m_CurrentPosition(0),m_NewPosition(-1),m_MaxPosition(0),m_DelimsChanged(false)
00179 {
00180 }
00181 #ifdef __SYMBIAN32__
00182 //------------------------------------------
00183 inline void skStringTokenizer::init(const skString& str, const TDesC& delim, bool returnDelims)
00184 //------------------------------------------
00185 {
00186   skString s_delim;
00187   s_delim=delim;
00188   init(str,s_delim,returnDelims);
00189 }
00190 #endif
00191 //------------------------------------------
00192 inline skStringTokenizer::~skStringTokenizer() 
00193 //------------------------------------------
00194 {
00195 }
00196 #endif

Generated on Fri Dec 17 20:27:34 2004 for Simkin by doxygen1.3