-
Notifications
You must be signed in to change notification settings - Fork 2
/
MapLoader.h
113 lines (95 loc) · 2.69 KB
/
MapLoader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma once
#include "map.h"
#include <string>
#include <vector>
using namespace std;
class Territory;
class Continent;
//Class that reads Warzone game maps
class MapLoader
{
public:
//Constructor
MapLoader();
MapLoader(std::string);
//Copy constructor
MapLoader(const MapLoader&);
//Assignment operator
MapLoader& operator = (const MapLoader&);
//Stream insertion operator (toString method)
friend std::ostream& operator<<(std::ostream&, const MapLoader&);
//to load a map file
virtual void loadMap(string);
//to return a map object
Map* CreateMap(vector<string*>, vector<string*>, vector<string*>);
//Getters
Map* getMap();
bool getStatus();
//Destructor
~MapLoader();
//to print out a vector content
void printVector(vector<std::string*>);
void printTerritories(vector<Territory*>*);
void printContinents(vector<Continent*>*);
private:
//map file
string* map;
//map object
Map* validMap;
//map load status
bool isLoaded = false;
//to store the contents from the map file
vector<std::string*> continents;
vector<std::string*> countries;
vector<std::string*> borders;
};
//Class that reads Conquest game maps
class ConquestFileReader
{
public:
//Constructor
ConquestFileReader();
ConquestFileReader(std::string);
//Copy constructor
ConquestFileReader(const ConquestFileReader&);
//Assignment operator
ConquestFileReader& operator = (const ConquestFileReader&);
//Stream insertion operator (toString method)
friend std::ostream& operator<<(std::ostream&, const ConquestFileReader&);
//to load a map file
void loadMap(string);
//to return a map object
Map* CreateMap(vector<string*>, vector<string*>, vector<string*>);
//Getters
Map* getMap();
bool getStatus();
//Destructor
~ConquestFileReader();
//to print out a vector content
void printVector(vector<std::string*>);
void printTerritories(vector<Territory*>*);
void printContinents(vector<Continent*>*);
private:
//map file
string* conquest_map;
//map object
Map* validConquestMap;
//map load status
bool isLoaded = false;
//to store the contents from the conquest map file
vector<std::string*> continents;
vector<std::string*> countries;
vector<std::string*> borders;
};
//Class that is subclass of ConquestFileReader
class ConquestFileReaderAdapter : MapLoader
{
public:
//constructor
ConquestFileReaderAdapter(ConquestFileReader* conquest_map_reader);
//overriding the load map method from MapLoader class
void loadMap(string);
~ConquestFileReaderAdapter();
private:
ConquestFileReader* conquest_map;
};