-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.h
77 lines (70 loc) · 2.14 KB
/
map.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
#pragma once
#include <string>
#include <vector>
#include <iostream>
#include <stdexcept>
class Country {
private:
int* id;
std::string* name;
std::vector<Country>* neighbours;
int* contId;
int* countryArmies;
//Continent* continent;
public:
Country();
//Country(const Country &other);
//~Country();
Country(std::string n);
Country(int id,std::string name);
Country(int id, std::string name, int continentId);
bool addNeighbour(Country neighbour);
bool hasNeighbour(Country n);
void showNeighbours();
std::string getCountryName();
int getCountryId();
int getCountryContId();
//may delete :: searches list of countries for an id and if found, returns its index
//returns -1 if no country with the specified id is found
static int findCountryWithId(std::vector<Country> countries, int id);
void incrementArmies();
};
class Continent {
private:
int* id;
std::string* name;
std::vector<Country>* countryList;
//std::vector<Continent>* continentNeighbours;
int* armies;
public:
Continent();
//Continent(const Continent &cont);
//~Continent();
Continent(std::string name);
Continent(int id, std::string name, int numArmies);
bool addCountry(Country c);
bool hasCountry(Country c);
bool hasCountryByName(std::string cName);
std::string getContinentName();
int getContinentId();
int getContinentNumArmies();
std::vector<std::string> getCountryNames();
void showCountries();
};
class Map{
private:
std::string* name;
std::vector<Continent>* continentList;
//feeling dicey returning a pointer hmm
//watch out for the null pointer reference
Continent* findContinentById(int id);
public:
Map();
//~Map();
Map(std::string name);
int size();
bool addContinent(Continent c);
bool hasContinent(Continent c);
void showContinents();
void describeMap();
};