blob: 644d73d286da13b3724e1426d632f5c5b70ac118 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <mbgl/storage/response.hpp>
#include <mbgl/util/chrono.hpp>
#include <iostream>
#include <cassert>
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;
noContent = res.noContent;
notModified = res.notModified;
data = res.data;
modified = res.modified;
expires = res.expires;
etag = res.etag;
return *this;
}
Response::Error::Error(Reason reason_, const std::string& message_)
: reason(reason_), message(message_) {
}
std::ostream& operator<<(std::ostream& os, Response::Error::Reason r) {
switch (r) {
case Response::Error::Reason::Success:
return os << "Response::Error::Reason::NotFound";
case Response::Error::Reason::NotFound:
return os << "Response::Error::Reason::NotFound";
case Response::Error::Reason::Server:
return os << "Response::Error::Reason::Server";
case Response::Error::Reason::Connection:
return os << "Response::Error::Reason::Connection";
case Response::Error::Reason::Other:
return os << "Response::Error::Reason::Other";
}
// The above switch is exhaustive, but placate GCC nonetheless:
assert(false);
return os;
}
} // namespace mbgl
|