ScummVM API documentation
parse_object.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef BAGEL_BAGLIB_PARSE_OBJECT_H
24#define BAGEL_BAGLIB_PARSE_OBJECT_H
25
26#include "bagel/spacebar/baglib/ifstream.h"
27#include "bagel/boflib/error.h"
28#include "bagel/boflib/rect.h"
29#include "bagel/boflib/string.h"
30
31namespace Bagel {
32namespace SpaceBar {
33
34#define RECT_START_DELIM '['
35#define RECT_END_DELIM ']'
36#define RECT_VAR_DELIM ','
37
38#define SDEV_START_DELIM '{'
39#define SDEV_END_DELIM '}'
40
41#define OBJ_START_DELIM '='
42#define OBJ_END_DELIM ';'
43
44enum ParseCodes {
45 PARSING_DONE = 0, UPDATED_OBJECT, UNKNOWN_TOKEN
46};
47
49public:
50 enum KEYWORDS {
51 UNKNOWN = 0,
52 STORAGEDEV,
53 START_WLD,
54 VARIABLE,
55 REMARK,
56 DISKID,
57 CURSOR,
58 SHAREDPAL,
59 DISKAUDIO,
60 PDASTATE,
61 SYSSCREEN,
62 WIELDCURSOR
63 };
64
65private:
66 bool _bAttached;
67
68public:
70 virtual ~CBagParseObject() {
71 }
72 static void initialize();
73
74 virtual ErrorCode attach() {
75 _bAttached = true;
76 return ERR_NONE;
77 }
78 virtual ErrorCode detach() {
79 _bAttached = false;
80 return ERR_NONE;
81 }
82 virtual bool isAttached() {
83 return _bAttached;
84 }
85
86 virtual ParseCodes setInfo(CBagIfstream &) {
87 return PARSING_DONE;
88 }
89
90 int getStringFromStream(CBagIfstream &istr, CBofString &sStr, const CBofString &sEndChars, bool bPutBack = false);
91 int getAlphaNumFromStream(CBagIfstream &istr, CBofString &sStr);
92 int getOperStrFromStream(CBagIfstream &istr, CBofString &sStr);
93 int getIntFromStream(CBagIfstream &istr, int &nNum);
94 int getRectFromStream(CBagIfstream &istr, CBofRect &rect);
95 int getKeywordFromStream(CBagIfstream &istr, KEYWORDS &keyword);
96 int putbackStringOnStream(CBagIfstream &istr, const CBofString &sStr);
97
98 int parseAlertBox(CBagIfstream &istr, const char *sTitle, const char *sFile, int nLine);
99};
100
101} // namespace SpaceBar
102} // namespace Bagel
103
104#endif
Definition: rect.h:35
Definition: string.h:38
Definition: ifstream.h:32
Definition: parse_object.h:48