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 00074 const char *nextToken(); 00075 00080 std::vector<std::string> asVector(); 00081 }; 00082 00083 #endif 00084
1.3.9.1