diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-04-13 18:38:39 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-04-13 18:38:39 +0200 |
commit | 1066504008ab9d779fcc007d3956d5966b7892e8 (patch) | |
tree | 103ac0d1c4f4c3704335aeff31ffc2188170fc92 /platform/default | |
parent | 352ff64e06982bf215f0b818fa57c2fc0a7a8cd8 (diff) | |
download | qtlocation-mapboxgl-1066504008ab9d779fcc007d3956d5966b7892e8.tar.gz |
separate SQLiteCache::Impl header from implementation file
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/sqlite_cache.cpp | 29 | ||||
-rw-r--r-- | platform/default/sqlite_cache_impl.hpp | 44 |
2 files changed, 45 insertions, 28 deletions
diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp index 8060c73bd8..958cdc1ac1 100644 --- a/platform/default/sqlite_cache.cpp +++ b/platform/default/sqlite_cache.cpp @@ -1,4 +1,4 @@ -#include <mbgl/storage/sqlite_cache.hpp> +#include "sqlite_cache_impl.hpp" #include <mbgl/storage/request.hpp> #include <mbgl/storage/response.hpp> @@ -13,33 +13,6 @@ namespace mbgl { -class SQLiteCache::Impl : public util::RunLoop { - friend class util::Thread<SQLiteCache::Impl>; - -public: - Impl(const std::string &path = ":memory:"); - ~Impl(); - -public: - void processGet(const Resource& resource, Callback callback); - void processPut(const Resource& resource, std::shared_ptr<const Response> response); - void processRefresh(const Resource& resource, int64_t expires); - -private: - void createDatabase(); - void createSchema(); - -private: - const std::string path; - std::unique_ptr<::mapbox::sqlite::Database> db; - std::unique_ptr<::mapbox::sqlite::Statement> getStmt; - std::unique_ptr<::mapbox::sqlite::Statement> putStmt; - std::unique_ptr<::mapbox::sqlite::Statement> refreshStmt; - bool schema = false; -}; - - - std::string removeAccessTokenFromURL(const std::string &url) { const size_t token_start = url.find("access_token="); // Ensure that token exists, isn't at the front and is preceded by either & or ?. diff --git a/platform/default/sqlite_cache_impl.hpp b/platform/default/sqlite_cache_impl.hpp new file mode 100644 index 0000000000..a194f9e782 --- /dev/null +++ b/platform/default/sqlite_cache_impl.hpp @@ -0,0 +1,44 @@ +#ifndef MBGL_STORAGE_DEFAULT_SQLITE_CACHE_IMPL +#define MBGL_STORAGE_DEFAULT_SQLITE_CACHE_IMPL + +#include <mbgl/storage/sqlite_cache.hpp> +#include <mbgl/util/run_loop.hpp> + +namespace mapbox { +namespace sqlite { +class Database; +class Statement; +} +} + +namespace mbgl { + +class SQLiteCache::Impl : public util::RunLoop { + friend class util::Thread<SQLiteCache::Impl>; + +public: + Impl(const std::string &path = ":memory:"); + ~Impl(); + +public: + void processGet(const Resource& resource, Callback callback); + void processPut(const Resource& resource, std::shared_ptr<const Response> response); + void processRefresh(const Resource& resource, int64_t expires); + +private: + void createDatabase(); + void createSchema(); + +private: + const std::string path; + std::unique_ptr<::mapbox::sqlite::Database> db; + std::unique_ptr<::mapbox::sqlite::Statement> getStmt; + std::unique_ptr<::mapbox::sqlite::Statement> putStmt; + std::unique_ptr<::mapbox::sqlite::Statement> refreshStmt; + bool schema = false; +}; + + +} + +#endif |