-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravelPack.h
83 lines (64 loc) · 1.92 KB
/
travelPack.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
#ifndef TRAVELPACK_H
#define TRAVELPACK_H
#include "date.h"
#include <vector>
#include <string>
static const int PACK_OUTPUT_ALIGNMENT = 20;
static const std::string PACK_OUTPUT_SEPARATOR = " ---------------//---------------";
class TravelPack
{
public:
TravelPack();
// GETTERS
int getId() const;
std::vector<std::string> getDestinations() const;
// Returns "" if pos is out of range
std::string getDestinationAt(const int index) const;
size_t getDestinationsSize() const;
Date getDeparture() const;
Date getReturn() const;
int getPrice() const;
int getMaxBookings() const;
int getCurrentBookings() const;
// SETTERS
/**
Use with caution, so that ID never overlap!
*/
bool setId(const int id);
bool setDestinations(const std::vector<std::string> & destinations);
bool setDeparture(const Date departureDate);
bool setReturn(const Date returnDate);
bool setPrice(const int price);
bool setMaxBookings(const int maxBookings);
bool setCurrentBookings(const int currentBookings);
// Other Methods
void printSummary() const;
/*
Only checks if the ID is positive or negative
*/
bool isAvailable() const;
void makeAvailable();
void makeUnavailable();
/**
Never sets packs to available, only to unavailable
Checks if the departureDate has already passed and if the capacity is full
*/
void updateAvailability();
/**
Please always provide s as lowerCase
This does not convert s to lowerCase in order to improve its efficiency
*/
bool containsDestination(const std::string & s) const;
// OUTPUT STREAM OPERATOR OVERRIDES
friend std::ostream& operator<<(std::ostream& stream, const TravelPack& pack);
friend std::ofstream& operator<<(std::ofstream& stream, const TravelPack& pack);
private:
int id;
std::vector<std::string> destinations;
Date departureDate, returnDate;
int price, maxBookings, currentBookings;
};
#endif // TRAVELPACK_H
// T1G02
// up201800170 Breno Accioly
// up201806516 Tiago Silva