📄 strtokp.h
字号:
// strtokp.h// using strtok to parse an entire string at once// copyright SafeTP Development Group, Inc., 2000 Terms of use are as specified in license.txt#ifndef __STRTOKP_H#define __STRTOKP_H#include "str.h" // string#include <string.h> // strlenclass StrtokParse { string buf; // locally allocated storage int _tokc; // # of tokens found char **_tokv; // array of tokens themselvesprivate: void validate(int which) const; // throw an exception if which is invalid tokenpublic: StrtokParse(char const *str, char const *delim); // parse 'str' into tokens delimited by chars from 'delim' ~StrtokParse(); // clean up' int tokc() const { return _tokc; } operator int () const { return tokc(); } // simple count of available tokens char const *tokv(int which) const; // may throw xArrayBounds char const* operator[] (int which) const { return tokv(which); } // access to tokens; must make local copies to modify int offset(int which) const; // return a value that, when added to the original 'str' parameter, // yields a pointer to where tokv(which) is, as a substring, in that string int offsetAfter(int which) const { return offset(which) + strlen(tokv(which)); } // offset for character just beyond last one in tokv (should be either // a delimiter character, or 0) char **spawn_tokv_array() { return _tokv; } // this is defined because it makes it convenient to generate spawn // arguments, and should only be used for that purpose (because it exposes // internal representation which is in principle subject to change)};#endif // __STRTOKP_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -