summaryrefslogtreecommitdiff
path: root/src/T2DLL/CTokenizer.h
blob: bcf22832eda9bacdf82c42b8414f0dbd646448de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef T2DLL_CTOKENIZER_H
#define T2DLL_CTOKENIZER_H
#include "../common.h"

class AFX_CLASS_EXPORT CTokenizer {
public:
	CTokenizer(char *str, const char *newLineChars = NULL, const char *spaceChars = NULL);
	virtual ~CTokenizer();
	CTokenizer& operator=(char *str);

	const char* Current() const {
		return mCurrent;
	}

	const char* NextString(const char *delim = NULL) {
		return NextToken(delim ? delim : mNewLineChars);
	}

	const char* NextWord(const char *delim = NULL) {
		return NextToken(delim ? delim : mSpaceChars);
	}

	int NextInteger(const char *delim = NULL) {
		return atoi(NextToken(delim ? delim : mSpaceChars));
	}

protected:
	const char* NextToken(const char *delim);

	char *mNext;
	char *mCurrent;
	const char *mNewLineChars;
	const char *mSpaceChars;
};
#endif