diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-08-25 16:56:56 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-09-24 16:12:03 +0200 |
commit | b94635f70430c3659cd57596e49649d376284473 (patch) | |
tree | 8d3957bf7c26c8fffeb7f961e0826ab625d5052a /include | |
parent | 28446bed24689b2bac7c8bfbd37741a7fa4fa6be (diff) | |
download | qtlocation-mapboxgl-b94635f70430c3659cd57596e49649d376284473.tar.gz |
parse cache-control and last-modified headers
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/platform/platform.hpp | 11 | ||||
-rw-r--r-- | include/mbgl/platform/response.hpp | 29 |
2 files changed, 31 insertions, 9 deletions
diff --git a/include/mbgl/platform/platform.hpp b/include/mbgl/platform/platform.hpp index 22405a4cfd..e08cac5312 100644 --- a/include/mbgl/platform/platform.hpp +++ b/include/mbgl/platform/platform.hpp @@ -1,10 +1,11 @@ #ifndef MBGL_PLATFORM_PLATFORM #define MBGL_PLATFORM_PLATFORM +#include <mbgl/platform/response.hpp> + #include <mbgl/util/uv.hpp> #include <memory> -#include <functional> #include <string> namespace mbgl { @@ -12,14 +13,6 @@ namespace platform { class Request; -struct Response { - Response(std::function<void(Response *)> callback) : callback(callback) {} - int16_t code = -1; - std::string body; - std::string error_message; - std::function<void(Response *)> callback; -}; - // Makes an HTTP request of a URL, preferrably on a background thread, and calls a function with the // results in the original thread (which runs the libuv loop). // If the loop pointer is NULL, the callback function will be called on an arbitrary thread. diff --git a/include/mbgl/platform/response.hpp b/include/mbgl/platform/response.hpp new file mode 100644 index 0000000000..345a2ee3df --- /dev/null +++ b/include/mbgl/platform/response.hpp @@ -0,0 +1,29 @@ +#ifndef MBGL_PLATFORM_RESPONSE +#define MBGL_PLATFORM_RESPONSE + +#include <string> +#include <functional> +#include <ctime> + +#include <mbgl/util/noncopyable.hpp> + +namespace mbgl { +namespace platform { + +struct Response : private util::noncopyable { + Response(std::function<void(Response *)> callback) : callback(callback) {} + int16_t code = -1; + std::string body; + std::string error_message; + std::time_t modified; + std::time_t expires; + std::function<void(Response *)> callback; + + void setCacheControl(const char *value); + void setLastModified(const char *value); +}; + +} +} + +#endif |