blob: 4b1125c110e3b2ada38690254955a05a57d03550 (
plain)
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
|
#include <mbgl/storage/response.hpp>
#include <mbgl/util/chrono.hpp>
namespace mbgl {
Response::Response(const Response& res) {
*this = res;
}
Response& Response::operator=(const Response& res) {
error = res.error ? std::make_unique<Error>(*res.error) : nullptr;
stale = res.stale;
data = res.data;
modified = res.modified;
expires = res.expires;
etag = res.etag;
return *this;
}
bool Response::isExpired() const {
// Note: expires == 0 also counts as expired!
return SystemTimePoint(expires) <= SystemClock::now();
}
Response::Error::Error(Reason reason_, const std::string& message_)
: reason(reason_), message(message_) {
}
} // namespace mbgl
|