summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/resource.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-01-13 14:32:21 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-22 18:42:53 -0800
commita877b9b192fb199b8ec6379551b3fb81e13d673d (patch)
tree8ad116b7966ece0c3e51da3fca9732ea266e2551 /include/mbgl/storage/resource.hpp
parent27134df2e40efa14928859bface3de0bc2819072 (diff)
downloadqtlocation-mapboxgl-a877b9b192fb199b8ec6379551b3fb81e13d673d.tar.gz
[core] Include prior values of caching headers in Resource
This allows the FileSource interface itself to support revalidation. We could (and probably should) now rewrite HTTPContextBase implementations as FileSource implementations.
Diffstat (limited to 'include/mbgl/storage/resource.hpp')
-rw-r--r--include/mbgl/storage/resource.hpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/include/mbgl/storage/resource.hpp b/include/mbgl/storage/resource.hpp
index 1bbd90ea37..8a61702183 100644
--- a/include/mbgl/storage/resource.hpp
+++ b/include/mbgl/storage/resource.hpp
@@ -1,12 +1,15 @@
#ifndef MBGL_STORAGE_RESOURCE
#define MBGL_STORAGE_RESOURCE
+#include <mbgl/storage/response.hpp>
+#include <mbgl/util/optional.hpp>
+
#include <string>
-#include <functional>
namespace mbgl {
-struct Resource {
+class Resource {
+public:
enum Kind : uint8_t {
Unknown = 0,
Style,
@@ -17,19 +20,17 @@ struct Resource {
SpriteJSON
};
- const Kind kind;
- const std::string url;
-
- inline bool operator==(const Resource &res) const {
- return kind == res.kind && url == res.url;
+ Resource(Kind kind_, const std::string& url_)
+ : kind(kind_),
+ url(url_) {
}
- struct Hash {
- std::size_t operator()(Resource const& r) const {
- return std::hash<std::string>()(r.url) ^ (std::hash<uint8_t>()(r.kind) << 1);
- }
- };
+ const Kind kind;
+ const std::string url;
+ optional<SystemTimePoint> priorModified;
+ optional<SystemTimePoint> priorExpires;
+ optional<std::string> priorEtag;
};
} // namespace mbgl