iomap.h

main 76 lines · 1.9 KB Raw
Alex Alex Commit Map Editor 18/10/2026 23:40
1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor 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// Remere's Map Editor 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
18#ifndef RME_MAP_IO_H_
19#define RME_MAP_IO_H_
20
21#include "client_version.h"
22
23enum ImportType {
24 IMPORT_DONT,
25 IMPORT_MERGE,
26 IMPORT_SMART_MERGE,
27 IMPORT_INSERT,
28};
29
30class Map;
31
32class IOMap {
33protected:
34 wxArrayString warnings;
35 wxString errorstr;
36
37 bool queryUser(const wxString& title, const wxString& format);
38 void warning(const wxString format, ...);
39 void error(const wxString format, ...);
40
41public:
42 IOMap() {
43 version.otbm = MAP_OTBM_1;
44 version.client = CLIENT_VERSION_NONE;
45 }
46 virtual ~IOMap() { }
47
48 MapVersion version;
49
50 wxArrayString& getWarnings() {
51 return warnings;
52 }
53 wxString& getError() {
54 return errorstr;
55 }
56
57 virtual bool loadMap(Map& map, const FileName& identifier) = 0;
58 virtual bool saveMap(Map& map, const FileName& identifier) = 0;
59};
60
61class VirtualIOMap : public IOMap {
62public:
63 VirtualIOMap(MapVersion v) {
64 version = v;
65 }
66
67 virtual bool loadMap(Map& map, const FileName& identifier) {
68 return false;
69 }
70 virtual bool saveMap(Map& map, const FileName& identifier) {
71 return false;
72 }
73};
74
75#endif
76
Top