[go: up one dir, main page]

Menu

[r19]: / trunk / TokenFile.h  Maximize  Restore  History

Download this file

68 lines (53 with data), 1.6 kB

 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyleft 2013 Chris Korda
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or any later version.
/*
chris korda
revision history:
rev date comments
00 18nov13 initial version
read tokens from a file
*/
#ifndef CTOKENFILE_INCLUDED
#define CTOKENFILE_INCLUDED
class CTokenFile : public CStdioFile {
public:
// Construction
CTokenFile();
CTokenFile(LPCTSTR lpszFileName, UINT nOpenFlags);
CTokenFile(FILE *pOpenStream);
// Attributes
int GetLinesRead() const;
CString GetCommentDelimiter() const;
void SetCommentDelimiter(CString Delimiter);
CString GetComments() const;
// Operations
CString ReadToken(LPCTSTR Delimiters);
protected:
// Data members
CString m_Line; // current line
int m_LinesRead; // number of lines read
int m_LinePos; // position within line
CString m_CommentDelimiter; // single-line comment delimiter
CString m_Comments; // one or more newline-terminated comments
// Helpers
void InitTokenData();
};
inline int CTokenFile::GetLinesRead() const
{
return(m_LinesRead);
}
inline CString CTokenFile::GetCommentDelimiter() const
{
return(m_CommentDelimiter);
}
inline void CTokenFile::SetCommentDelimiter(CString Delimiter)
{
m_CommentDelimiter = Delimiter;
}
inline CString CTokenFile::GetComments() const
{
return(m_Comments);
}
#endif