-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbooking.cpp
58 lines (42 loc) · 1.74 KB
/
booking.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
#include "booking.h"
namespace cxxdoor {
std::ostream &operator<<(std::ostream &os, const Booking &c) {
return os << "Booking( usuario: " << *c.getUsuario() << ", " << c.getFrom()
<< ", " << c.getTo() << ")";
}
Booking::Booking() = default;
folly::dynamic Booking::get_json() const {
return folly::dynamic::object("id", getId())("usuario", usuario->get_json())(
"from", boost::gregorian::to_iso_extended_string(from))(
"to", boost::gregorian::to_iso_extended_string(to));
}
boost::gregorian::date Booking::getTo() const { return to; }
void Booking::setTo(const boost::gregorian::date &value) { to = value; }
boost::gregorian::date Booking::getFrom() const { return from; }
void Booking::setFrom(const boost::gregorian::date &value) { from = value; }
std::shared_ptr<Usuario> Booking::getUsuario() const { return usuario; }
void Booking::setUsuario(const std::shared_ptr<Usuario> &value) {
usuario = value;
}
bool Booking::operator<(const Booking &rhs) const {
return from < rhs.from;
}
bool Booking::operator>(const Booking &rhs) const {
return rhs < *this;
}
bool Booking::operator<=(const Booking &rhs) const {
return !(rhs < *this);
}
bool Booking::operator>=(const Booking &rhs) const {
return !(*this < rhs);
}
bool Booking::operator==(const Booking &rhs) const {
return static_cast<const RocksEntity &>(*this) == static_cast<const RocksEntity &>(rhs) &&
usuario == rhs.usuario &&
from == rhs.from &&
to == rhs.to;
}
bool Booking::operator!=(const Booking &rhs) const {
return !(rhs == *this);
}
}