1 |
astrand |
930 |
///////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// Tokenizer.h |
3 |
|
|
// |
4 |
|
|
// Date: Monday, October 22, 2001 |
5 |
|
|
// Autor: Eduardo Velasquez |
6 |
|
|
// Description: Tokenizer class for CStrings. Works like strtok. |
7 |
|
|
/////////////// |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
#include "StdString.h" |
11 |
|
|
|
12 |
|
|
#if !defined(__TOKENIZER_H__) |
13 |
|
|
#define __TOKENIZER_H__ |
14 |
|
|
|
15 |
|
|
#if _MSC_VER >= 1000 |
16 |
|
|
#pragma once |
17 |
|
|
#endif // _MSC_VER >= 1000 |
18 |
|
|
|
19 |
|
|
#if !defined(_BITSET_) |
20 |
|
|
# include <bitset> |
21 |
|
|
#endif // !defined(_BITSET_) |
22 |
|
|
|
23 |
|
|
class CTokenizer |
24 |
|
|
{ |
25 |
astrand |
937 |
public: |
26 |
|
|
CTokenizer(const CStdString & cs, const CStdString & csDelim); |
27 |
|
|
void SetDelimiters(const CStdString & csDelim); |
28 |
astrand |
930 |
|
29 |
astrand |
937 |
bool Next(CStdString & cs); |
30 |
|
|
CStdString Tail() const; |
31 |
astrand |
930 |
|
32 |
astrand |
937 |
private: |
33 |
|
|
CStdString m_cs; |
34 |
|
|
std::bitset < 256 > m_delim; |
35 |
|
|
int m_nCurPos; |
36 |
astrand |
930 |
}; |
37 |
|
|
|
38 |
astrand |
933 |
#endif // !defined(__TOKENIZER_H__) |