Documentation

Generated on Thu Aug 31 00:02:30 2006

 

StringTokenizer.h

Go to the documentation of this file.
00001 
00002 // $Id: StringTokenizer.h,v 1.13 2005/04/12 21:18:06 klas Exp $
00003 //
00004 // Usage: Used to chop up a string in "tokens"
00005 //
00006 //  A part of babyftpd, licensed under the GNU GPL, see the file
00007 //    LICENSE for complete information.
00009 
00010 #ifndef STRINGTOKENIZER_H
00011 #define STRINGTOKENIZER_H
00012 
00013 #ifdef STRINGTOKENIZER_CPP
00014 #include "generic.h"
00015 #include "Log.h"
00016 #endif
00017 
00018 class StringTokenizer
00019 {
00020   public:
00021     StringTokenizer(string, string, bool);
00022     bool hasMoreTokens(void) const;
00023     string nextToken();
00024     int countTokens(void) const;
00025     string restTokens(void) const;
00026 
00027   private:
00028     string::const_iterator skipDelimiters(string::const_iterator) const;
00029     string::const_iterator scanToken(string::const_iterator) const;
00030     bool isDelimiter(char c) const
00031     { return(delimiters.find(c) == string::npos ? false : true ); }
00032 
00033     string::const_iterator currentPosition;
00034     string text;
00035     string delimiters;
00036     bool retDelims;
00037 };
00038 
00039 #endif