ScummVM API documentation
textparser.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef VCRUISE_TEXTPARSER_H
23
#define VCRUISE_TEXTPARSER_H
24
25
#include "common/hashmap.h"
26
#include "common/hash-str.h"
27
#include "common/str.h"
28
#include "common/memstream.h"
29
30
namespace
Common
{
31
32
class
Path
;
33
class
ReadStream;
34
35
}
// End of namespace Common
36
37
namespace
VCruise
{
38
39
struct
TextParserState
{
40
TextParserState
();
41
42
uint _lineNum;
43
uint _col;
44
bool
_prevWasCR;
45
bool
_isParsingComment;
46
};
47
48
class
TextParser
{
49
public
:
50
explicit
TextParser
(
Common::ReadStream
*stream);
51
52
bool
parseToken(
Common::String
&outString,
TextParserState
&outState);
53
54
bool
readOneChar(
char
&outC,
TextParserState
&outState);
55
bool
skipWhitespaceAndComments(
char
&outC,
TextParserState
&outState);
56
57
void
requeue(
const
char
*chars, uint numChars,
const
TextParserState
&state);
58
void
requeue(
const
Common::String
&str,
const
TextParserState
&state);
59
60
void
expectToken(
Common::String
&outToken,
const
Common::Path
&blamePath);
61
void
expectShort(int16 &outInt,
const
Common::Path
&blamePath);
62
void
expectInt(
int
&outInt,
const
Common::Path
&blamePath);
63
void
expectUInt(uint &outUInt,
const
Common::Path
&blamePath);
64
void
expectLine(
Common::String
&outToken,
const
Common::Path
&blamePath,
bool
continueToNextLine);
65
66
void
expect(
const
char
*str,
const
Common::Path
&blamePath);
67
68
void
skipToEOL();
69
bool
checkEOL();
70
71
private
:
72
void
expectTokenInternal(
Common::String
&outToken,
const
Common::Path
&blamePath,
TextParserState
&outState);
73
74
static
bool
isDelimiter(
char
c);
75
static
bool
isCompoundDelimiter(
char
c1,
char
c2);
76
static
bool
isWhitespace(
char
c);
77
78
TextParserState
_state;
79
80
Common::ReadStream
*_stream;
81
82
static
const
uint kReturnedBufferSize = 8;
83
84
char
_returnedBuffer[kReturnedBufferSize];
85
uint _returnedBufferPos;
86
};
87
88
}
// End of namespace VCruise
89
90
#endif
Common::String
Definition:
str.h:59
Common::Path
Definition:
path.h:52
Hugo::Path
Path
Definition:
game.h:75
VCruise
Definition:
ad2044_items.h:27
VCruise::TextParser
Definition:
textparser.h:48
Common
Definition:
algorithm.h:29
VCruise::TextParserState
Definition:
textparser.h:39
Common::ReadStream
Definition:
stream.h:385
engines
vcruise
textparser.h
Generated on Sun Dec 22 2024 09:21:25 for ScummVM API documentation by
1.8.13