cstringtokenizer.h

00001 //==========================================================================
00002 //  CSTRINGTOKENIZER.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-2008 Andras Varga
00014   Copyright (C) 2006-2008 OpenSim Ltd.
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __CSTRINGTOKENIZER_H
00021 #define __CSTRINGTOKENIZER_H
00022 
00023 #include <string>
00024 #include <vector>
00025 #include "simkerneldefs.h"
00026 
00027 NAMESPACE_BEGIN
00028 
00059 class SIM_API cStringTokenizer
00060 {
00061   private:
00062     char *str; // copy of full string
00063     char *rest; // rest of string (to be tokenized)
00064     std::string delimiter;
00065 
00066   private:
00067     void copy(const cStringTokenizer& other);
00068 
00069   public:
00075     cStringTokenizer(const char *str, const char *delimiters=NULL);
00076 
00081     cStringTokenizer(const cStringTokenizer& other);
00082 
00086     ~cStringTokenizer();
00087 
00092     cStringTokenizer& operator=(const cStringTokenizer& other);
00093 
00098     void setDelimiter(const char *s);
00099 
00104     bool hasMoreTokens();
00105 
00111     const char *nextToken();
00112 
00117     std::vector<std::string> asVector();
00118 
00123     std::vector<int> asIntVector();
00124 
00129     std::vector<double> asDoubleVector();
00130 };
00131 
00132 NAMESPACE_END
00133 
00134 
00135 #endif
00136 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3