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/baglib/ifstream.h"
27 #include "bagel/boflib/error.h"
28 #include "bagel/boflib/rect.h"
29 #include "bagel/boflib/string.h"
30 
31 namespace Bagel {
32 
33 #define RECT_START_DELIM '['
34 #define RECT_END_DELIM ']'
35 #define RECT_VAR_DELIM ','
36 
37 #define SDEV_START_DELIM '{'
38 #define SDEV_END_DELIM '}'
39 
40 #define OBJ_START_DELIM '='
41 #define OBJ_END_DELIM ';'
42 
43 enum ParseCodes { PARSING_DONE = 0, UPDATED_OBJECT, UNKNOWN_TOKEN };
44 
46 public:
47  enum KEYWORDS {
48  UNKNOWN = 0,
49  STORAGEDEV,
50  START_WLD,
51  VARIABLE,
52  REMARK,
53  DISKID,
54  CURSOR,
55  SHAREDPAL,
56  DISKAUDIO,
57  PDASTATE,
58  SYSSCREEN,
59  WIELDCURSOR
60  };
61 
62 private:
63  bool _bAttached;
64 
65 public:
67  virtual ~CBagParseObject() {}
68  static void initialize();
69 
70  virtual ErrorCode attach() {
71  _bAttached = true;
72  return ERR_NONE;
73  }
74  virtual ErrorCode detach() {
75  _bAttached = false;
76  return ERR_NONE;
77  }
78  virtual bool isAttached() {
79  return _bAttached;
80  }
81 
82  virtual ParseCodes setInfo(CBagIfstream &) {
83  return PARSING_DONE;
84  }
85 
86  int getStringFromStream(CBagIfstream &istr, CBofString &sStr, const CBofString &sEndChars, bool bPutBack = false);
87  int getAlphaNumFromStream(CBagIfstream &istr, CBofString &sStr);
88  int getOperStrFromStream(CBagIfstream &istr, CBofString &sStr);
89  int getIntFromStream(CBagIfstream &istr, int &nNum);
90  int getRectFromStream(CBagIfstream &istr, CBofRect &rect);
91  int getKeywordFromStream(CBagIfstream &istr, KEYWORDS &keyword);
92  int putbackStringOnStream(CBagIfstream &istr, const CBofString &sStr);
93 
94  int parseAlertBox(CBagIfstream &istr, const char *sTitle, const char *sFile, int nLine);
95 };
96 
97 } // namespace Bagel
98 
99 #endif
Definition: rect.h:36
Definition: ifstream.h:31
Definition: parse_object.h:45
Definition: string.h:38
Definition: bagel.h:31