ScummVM API documentation
MetadataParser.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 GUI_METADATA_PARSER_H
23 #define GUI_METADATA_PARSER_H
24 
25 #include "common/formats/xmlparser.h"
26 
27 namespace GUI {
28 
29 struct MetadataGame {
30  Common::String id;
31  Common::String name;
32  Common::String engine_id;
33  Common::String company_id;
34  Common::String moby_id;
35  Common::String zoom_id;
36  Common::String year;
37  Common::String datafiles;
38  Common::String series_id;
39 
40  MetadataGame() {}
41  MetadataGame(const Common::String i, const Common::String n, const Common::String eid, const Common::String cid,
42  const Common::String mid, const Common::String df, const Common::String sid, const Common::String zid, const Common::String yr)
43  : id(i), name(n), engine_id(eid), company_id(cid), year(yr), moby_id(mid), datafiles(df), zoom_id(zid), series_id(sid) {}
44 };
45 
47  Common::String id;
48  Common::String name;
49  Common::String alt_name;
50  bool enabled;
51 
52  MetadataEngine() : enabled(false) {}
53  MetadataEngine(const Common::String i, const Common::String n, const Common::String altn, bool e)
54  : id(i), name(n), alt_name(altn), enabled(e) {}
55 };
56 
58  Common::String id;
59  Common::String name;
60 
61  MetadataSeries() {}
62  MetadataSeries(const Common::String i, const Common::String n) : id(i), name(n) {}
63 };
64 
66  Common::String id;
67  Common::String name;
68  Common::String alt_name;
69 
70  MetadataCompany() {}
71  MetadataCompany(const Common::String i, const Common::String n, const Common::String altn)
72  : id(i), name(n), alt_name(altn) {}
73 };
74 
76 public:
78 
79  ~MetadataParser() override;
80 
85 
86 protected:
87 
88  CUSTOM_XML_PARSER(MetadataParser) {
89  XML_KEY(games)
90  XML_KEY(game)
91  XML_PROP(id, true)
92  XML_PROP(name, true)
93  XML_PROP(engine_id, true)
94  XML_PROP(company_id, true)
95  XML_PROP(moby_id, true)
96  XML_PROP(year, false)
97  XML_PROP(datafiles, true)
98  XML_PROP(wikipedia_page, true)
99  XML_PROP(series_id, true)
100  XML_PROP(steam_id, false)
101  XML_PROP(gog_id, false)
102  XML_PROP(zoom_id, false)
103  XML_PROP(additional_stores, false)
104  KEY_END() // game end
105  KEY_END() // games end
106 
107  XML_KEY(engines)
108  XML_KEY(engine)
109  XML_PROP(id, true)
110  XML_PROP(name, true)
111  XML_PROP(alt_name, true)
112  XML_PROP(enabled, true)
113  KEY_END() // engine end
114  KEY_END() // engines end
115 
116  XML_KEY(series)
117  XML_KEY(serie)
118  XML_PROP(id, true)
119  XML_PROP(name, true)
120  KEY_END() // serie end
121  KEY_END() // series end
122 
123  XML_KEY(companies)
124  XML_KEY(company)
125  XML_PROP(id, true)
126  XML_PROP(name, true)
127  XML_PROP(alt_name, true)
128  KEY_END() // company end
129  KEY_END() // companies end
130  } PARSER_END()
131 
132 
133  bool parserCallback_games(ParserNode *node);
134  bool parserCallback_game(ParserNode *node);
135  bool parserCallback_engines(ParserNode *node);
136  bool parserCallback_engine(ParserNode *node);
137  bool parserCallback_series(ParserNode *node);
138  bool parserCallback_serie(ParserNode *node);
139  bool parserCallback_companies(ParserNode *node);
140  bool parserCallback_company(ParserNode *node);
141 
142  bool closedKeyCallback(ParserNode *node) override;
143 
144  void cleanup() override;
145 };
146 
147 } // End of namespace GUI
148 
149 #endif
Definition: str.h:59
Definition: MetadataParser.h:29
Definition: xmlparser.h:145
Definition: system.h:46
Definition: xmlparser.h:98
Definition: MetadataParser.h:65
Definition: MetadataParser.h:75
Definition: hashmap.h:85
Definition: MetadataParser.h:46
Definition: MetadataParser.h:57