shumate/shumate-file-cache.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (C) 2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | ||
| 3 | * Copyright (C) 2010-2013 Jiri Techet <techet@gmail.com> | ||
| 4 | * Copyright (C) 2019 Marcus Lundblad <ml@update.uu.se> | ||
| 5 | * | ||
| 6 | * This library is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This library is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with this library; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #if !defined (__SHUMATE_SHUMATE_H_INSIDE__) && !defined (SHUMATE_COMPILATION) | ||
| 22 | #error "Only <shumate/shumate.h> can be included directly." | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #ifndef _SHUMATE_FILE_CACHE_H_ | ||
| 26 | #define _SHUMATE_FILE_CACHE_H_ | ||
| 27 | |||
| 28 | #include <glib-object.h> | ||
| 29 | #include <gio/gio.h> | ||
| 30 | |||
| 31 | G_BEGIN_DECLS | ||
| 32 | |||
| 33 | /** | ||
| 34 | * SHUMATE_FILE_CACHE_ERROR: | ||
| 35 | * | ||
| 36 | * Error domain for errors that may occur while storing or retrieving tiles | ||
| 37 | * from a #ShumateFileCache. Errors in this domain will be from the | ||
| 38 | * #ShumateFileCacheError enum. | ||
| 39 | */ | ||
| 40 | #define SHUMATE_FILE_CACHE_ERROR shumate_file_cache_error_quark () | ||
| 41 | GQuark shumate_file_cache_error_quark (void); | ||
| 42 | |||
| 43 | /** | ||
| 44 | * ShumateFileCacheError: | ||
| 45 | * @SHUMATE_FILE_CACHE_ERROR_FAILED: An unspecified error occurred during the operation. | ||
| 46 | * | ||
| 47 | * Error codes in the #SHUMATE_FILE_CACHE_ERROR domain. | ||
| 48 | */ | ||
| 49 | typedef enum { | ||
| 50 | SHUMATE_FILE_CACHE_ERROR_FAILED, | ||
| 51 | } ShumateFileCacheError; | ||
| 52 | |||
| 53 | #define SHUMATE_TYPE_FILE_CACHE shumate_file_cache_get_type () | ||
| 54 |
5/10None:
✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 10 not taken.
✓ Branch 15 → 16 taken 1 time.
✗ Branch 15 → 17 not taken.
SHUMATE_IS_FILE_CACHE:
✓ Branch 3 → 4 taken 43 times.
✗ Branch 3 → 7 not taken.
✓ Branch 4 → 5 taken 43 times.
✗ Branch 4 → 6 not taken.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 43 times.
|
45 | G_DECLARE_FINAL_TYPE (ShumateFileCache, shumate_file_cache, SHUMATE, FILE_CACHE, GObject) |
| 55 | |||
| 56 | ShumateFileCache *shumate_file_cache_new_full (guint size_limit, | ||
| 57 | const char *cache_key, | ||
| 58 | const char *cache_dir); | ||
| 59 | |||
| 60 | guint shumate_file_cache_get_size_limit (ShumateFileCache *self); | ||
| 61 | void shumate_file_cache_set_size_limit (ShumateFileCache *self, | ||
| 62 | guint size_limit); | ||
| 63 | |||
| 64 | const char *shumate_file_cache_get_cache_dir (ShumateFileCache *self); | ||
| 65 | const char *shumate_file_cache_get_cache_key (ShumateFileCache *self); | ||
| 66 | |||
| 67 | void shumate_file_cache_purge_cache_async (ShumateFileCache *self, | ||
| 68 | GCancellable *cancellable, | ||
| 69 | GAsyncReadyCallback callback, | ||
| 70 | gpointer user_data); | ||
| 71 | gboolean shumate_file_cache_purge_cache_finish (ShumateFileCache *self, | ||
| 72 | GAsyncResult *result, | ||
| 73 | GError **error); | ||
| 74 | |||
| 75 | void shumate_file_cache_get_tile_async (ShumateFileCache *self, | ||
| 76 | int x, | ||
| 77 | int y, | ||
| 78 | int zoom_level, | ||
| 79 | GCancellable *cancellable, | ||
| 80 | GAsyncReadyCallback callback, | ||
| 81 | gpointer user_data); | ||
| 82 | GBytes *shumate_file_cache_get_tile_finish (ShumateFileCache *self, | ||
| 83 | char **etag, | ||
| 84 | GDateTime **modtime, | ||
| 85 | GAsyncResult *result, | ||
| 86 | GError **error); | ||
| 87 | |||
| 88 | void shumate_file_cache_store_tile_async (ShumateFileCache *self, | ||
| 89 | int x, | ||
| 90 | int y, | ||
| 91 | int zoom_level, | ||
| 92 | GBytes *bytes, | ||
| 93 | const char *etag, | ||
| 94 | GCancellable *cancellable, | ||
| 95 | GAsyncReadyCallback callback, | ||
| 96 | gpointer user_data); | ||
| 97 | gboolean shumate_file_cache_store_tile_finish (ShumateFileCache *self, | ||
| 98 | GAsyncResult *result, | ||
| 99 | GError **error); | ||
| 100 | |||
| 101 | void shumate_file_cache_mark_up_to_date (ShumateFileCache *self, | ||
| 102 | int x, | ||
| 103 | int y, | ||
| 104 | int zoom_level); | ||
| 105 | |||
| 106 | G_END_DECLS | ||
| 107 | |||
| 108 | #endif /* _SHUMATE_FILE_CACHE_H_ */ | ||
| 109 |