[libchamplainmm] Wrap ChamplainFileCache
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplainmm] Wrap ChamplainFileCache
- Date: Fri, 1 Aug 2014 20:35:28 +0000 (UTC)
commit ed1b0cca5193342b5ac7c710bbb5631789ddda03
Author: Juan R. García Blanco <juanrgar gmail com>
Date: Fri Aug 1 22:34:02 2014 +0200
Wrap ChamplainFileCache
* champlain/champlainmm.h: Add file-cache.h.
* champlain/champlainmm/.gitignore: Ignore file-cache.*.
* champlain/src/champlain_signals.defs: Add ChamplainFileCache
"size-limit" and "cache-dir" properties.
* champlain/src/filelist.am: Add file-cache.hg.
* champlain/src/file-cache.[ccg|hg]: New files.
* tools/extradefs/generate_extra_defs_libchamplain.cc: Add
CHAMPLAIN_TYPE_FILE_CACHE.
champlain/champlainmm.h | 1 +
champlain/champlainmm/.gitignore | 1 +
champlain/src/champlain_signals.defs | 20 +++++++
champlain/src/file-cache.ccg | 23 ++++++++
champlain/src/file-cache.hg | 58 ++++++++++++++++++++
champlain/src/filelist.am | 1 +
.../extradefs/generate_extra_defs_libchamplain.cc | 1 +
7 files changed, 105 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index 531dcbd..e7430b0 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -27,6 +27,7 @@
#include <champlainmm/coordinate.h>
#include <champlainmm/debug.h>
#include <champlainmm/defines.h>
+#include <champlainmm/file-cache.h>
#include <champlainmm/layer.h>
#include <champlainmm/license.h>
#include <champlainmm/map-source-desc.h>
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index f943b70..d227eef 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -1,6 +1,7 @@
bounding-box.*
coordinate.*
defines.*
+file-cache.*
label.*
layer.*
license.*
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index f846083..159883d 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -2,6 +2,26 @@
;; From ChamplainCoordinate
+;; From ChamplainFileCache
+
+(define-property size-limit
+ (of-object "ChamplainFileCache")
+ (prop-type "GParamUInt")
+ (docs "The cache's size limit (Mb)")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property cache-dir
+ (of-object "ChamplainFileCache")
+ (prop-type "GParamString")
+ (docs "The directory of the cache")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
;; From ChamplainLabel
(define-property image
diff --git a/champlain/src/file-cache.ccg b/champlain/src/file-cache.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/file-cache.ccg
@@ -0,0 +1,23 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/file-cache.hg b/champlain/src/file-cache.hg
new file mode 100644
index 0000000..e2e0a92
--- /dev/null
+++ b/champlain/src/file-cache.hg
@@ -0,0 +1,58 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libchamplainmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlainmm/renderer.h>
+#include <champlainmm/tile-cache.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(champlainmm/private/tile-cache_p.h)
+
+namespace Champlain
+{
+
+/** Stores and loads cached tiles from the file system.
+ *
+ * FileCache is a cache that stores and retrieves tiles from the
+ * file system. Tiles most frequently loaded gain in "popularity". This popularity
+ * is taken into account when purging the cache.
+
+ * @newin{0,4}
+ */
+class FileCache : public TileCache
+{
+ _CLASS_GOBJECT(FileCache, ChamplainFileCache, CHAMPLAIN_FILE_CACHE, TileCache, ChamplainTileCache)
+
+protected:
+ _WRAP_CTOR(FileCache(guint size_limit, const std::string& cache_dir, const Glib::RefPtr<Renderer>&
renderer), champlain_file_cache_new_full)
+
+public:
+ _WRAP_CREATE(guint size_limit, const std::string& cache_dir, const Glib::RefPtr<Renderer>& renderer)
+
+ _WRAP_METHOD(guint get_size_limit() const, champlain_file_cache_get_size_limit)
+ _WRAP_METHOD(void set_size_limit(guint size_limit), champlain_file_cache_set_size_limit)
+
+ _WRAP_METHOD(std::string get_cache_dir() const, champlain_file_cache_get_cache_dir)
+
+ _WRAP_METHOD(void purge(), champlain_file_cache_purge)
+ _WRAP_METHOD(void purge_on_idle(), champlain_file_cache_purge_on_idle)
+
+ _WRAP_PROPERTY("size-limit", guint)
+ _WRAP_PROPERTY("cache-dir", std::string)
+};
+
+} // namespace Champlain
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index 06bbf7f..d2f21cf 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -14,6 +14,7 @@ files_hg = \
coordinate.hg \
marker.hg \
defines.hg \
+ file-cache.hg \
layer.hg \
license.hg \
location.hg \
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 355498d..86bb17f 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -28,6 +28,7 @@ main(int argc, char *argv[])
std::cout << get_defs(CHAMPLAIN_TYPE_BOUNDING_BOX)
<< get_defs(CHAMPLAIN_TYPE_COORDINATE)
+ << get_defs(CHAMPLAIN_TYPE_FILE_CACHE)
<< get_defs(CHAMPLAIN_TYPE_LABEL)
<< get_defs(CHAMPLAIN_TYPE_LAYER)
<< get_defs(CHAMPLAIN_TYPE_LICENSE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]