1 | // SuperTux |
2 | // Copyright (C) 2015 Ingo Ruhnke <grumbel@gmail.com> |
3 | // |
4 | // This program is free software: you can redistribute it and/or modify |
5 | // it under the terms of the GNU General Public License as published by |
6 | // the Free Software Foundation, either version 3 of the License, or |
7 | // (at your option) any later version. |
8 | // |
9 | // This program is distributed in the hope that it will be useful, |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | // GNU General Public License for more details. |
13 | // |
14 | // You should have received a copy of the GNU General Public License |
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | |
17 | #ifndef HEADER_SUPERTUX_SUPERTUX_SECTOR_PARSER_HPP |
18 | #define |
19 | |
20 | #include <memory> |
21 | #include <string> |
22 | |
23 | class GameObject; |
24 | class Level; |
25 | class ReaderMapping; |
26 | class Sector; |
27 | |
28 | class SectorParser final |
29 | { |
30 | public: |
31 | static std::unique_ptr<Sector> from_reader(Level& level, const ReaderMapping& sector, bool editable); |
32 | static std::unique_ptr<Sector> from_reader_old_format(Level& level, const ReaderMapping& sector, bool editable); |
33 | static std::unique_ptr<Sector> from_nothing(Level& level); |
34 | |
35 | private: |
36 | SectorParser(Sector& sector, bool editable); |
37 | |
38 | void parse_old_format(const ReaderMapping& reader); |
39 | void parse(const ReaderMapping& sector); |
40 | void create_sector(); |
41 | std::unique_ptr<GameObject> parse_object(const std::string& name_, const ReaderMapping& reader); |
42 | |
43 | private: |
44 | Sector& m_sector; |
45 | bool m_editable; |
46 | |
47 | private: |
48 | SectorParser(const SectorParser&) = delete; |
49 | SectorParser& operator=(const SectorParser&) = delete; |
50 | }; |
51 | |
52 | #endif |
53 | |
54 | /* EOF */ |
55 | |