-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlace.cpp
74 lines (66 loc) · 1.18 KB
/
Place.cpp
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
#include "Place.h"
/**
* @brief Place default constructor
*/
Place::Place()
{
}
/**
* @brief Place constructor
* @param n name of the place
* @param coord place's coordinates
*/
Place::Place(string n,pair<int,int> coords)
{
name=n;
coordinates=coords;
}
/**
* @brief Place destructor
*/
Place::~Place()
{
}
/**
* @brief Sets the place's name
* @param n string with the place's name
*/
void Place::setName(string n)
{
name=n;
}
/**
* @brief Sets the place's coordinates
* @param int x coordinate in x axis
* @param int y coordinate in y axis
*/
void Place::setCoords(int x,int y)
{
coordinates=pair<int,int>(x,y);
}
/**
* @brief Returns the name of the place
* @return string with the place's name
*/
string Place::getName() const
{
return name;
}
/**
* @brief Returns the place's coordinates
* @return pair<int,int> with the place's coordinates
*/
pair<int,int> Place::getCoords() const
{
return coordinates;
}
/**
* @brief Writes all the information about a place to a string
* @return string with the place's information
*/
string Place::toString()
{
stringstream ss;
ss << name <<"(" << coordinates.first << "," << coordinates.second << ")";
return ss.str();
}