cstrtokenizer.h

00001 //==========================================================================
00002 //  CSTRTOKENIZER.H - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Declaration of the following classes:
00008 //    cStringTokenizer  : string tokenizer utility class
00009 //
00010 //==========================================================================
00011 
00012 /*--------------------------------------------------------------*
00013   Copyright (C) 1992-2005 Andras Varga
00014 
00015   This file is distributed WITHOUT ANY WARRANTY. See the file
00016   `license' for details on this and other legal matters.
00017 *--------------------------------------------------------------*/
00018 
00019 #ifndef __STRINGTOKENIZER_H
00020 #define __STRINGTOKENIZER_H
00021 
00022 #include <string>
00023 #include <vector>
00024 #include "defs.h"
00025 
00043 class SIM_API cStringTokenizer
00044 {
00045   private:
00046     char *str; // copy of full string
00047     char *rest; // rest of string (to be tokenized)
00048     char *strend; // points to terminating zero of str
00049     std::string delimiter;
00050 
00051   public:
00056     cStringTokenizer(const char *str, const char *delimiters=" ");
00057 
00061     ~cStringTokenizer();
00062 
00067     void setDelimiter(const char *s);
00068 
00073     bool hasMoreTokens()  {return rest!=NULL;}
00074 
00080     const char *nextToken();
00081 
00086     std::vector<std::string> asVector();
00087 };
00088 
00089 #endif
00090 

Generated on Sat Oct 21 17:47:56 2006 for OMNeT++/OMNEST Simulation Library by  doxygen 1.4.6