From 1066504008ab9d779fcc007d3956d5966b7892e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 13 Apr 2015 18:38:39 +0200 Subject: [PATCH] separate SQLiteCache::Impl header from implementation file --- platform/default/sqlite_cache.cpp | 29 +---------------- platform/default/sqlite_cache_impl.hpp | 44 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 platform/default/sqlite_cache_impl.hpp diff --git a/platform/default/sqlite_cache.cpp b/platform/default/sqlite_cache.cpp index 8060c73bd..958cdc1ac 100644 --- a/platform/default/sqlite_cache.cpp +++ b/platform/default/sqlite_cache.cpp @@ -1,4 +1,4 @@ -#include +#include "sqlite_cache_impl.hpp" #include #include @@ -13,33 +13,6 @@ namespace mbgl { -class SQLiteCache::Impl : public util::RunLoop { - friend class util::Thread; - -public: - Impl(const std::string &path = ":memory:"); - ~Impl(); - -public: - void processGet(const Resource& resource, Callback callback); - void processPut(const Resource& resource, std::shared_ptr 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 000000000..a194f9e78 --- /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 +#include + +namespace mapbox { +namespace sqlite { +class Database; +class Statement; +} +} + +namespace mbgl { + +class SQLiteCache::Impl : public util::RunLoop { + friend class util::Thread; + +public: + Impl(const std::string &path = ":memory:"); + ~Impl(); + +public: + void processGet(const Resource& resource, Callback callback); + void processPut(const Resource& resource, std::shared_ptr 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