1 /*
2  * Copyright (C) 2010-2013 Jiri Techet <techet@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #if !defined (__CHAMPLAIN_CHAMPLAIN_H_INSIDE__) && !defined (CHAMPLAIN_COMPILATION)
20 #error "Only <champlain/champlain.h> can be included directly."
21 #endif
22 
23 #ifndef _CHAMPLAIN_TILE_CACHE_H_
24 #define _CHAMPLAIN_TILE_CACHE_H_
25 
26 #include <champlain/champlain-defines.h>
27 #include <champlain/champlain-map-source.h>
28 
29 G_BEGIN_DECLS
30 
31 #define CHAMPLAIN_TYPE_TILE_CACHE champlain_tile_cache_get_type ()
32 
33 #define CHAMPLAIN_TILE_CACHE(obj) \
34   (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCache))
35 
36 #define CHAMPLAIN_TILE_CACHE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCacheClass))
38 
39 #define CHAMPLAIN_IS_TILE_CACHE(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_TILE_CACHE))
41 
42 #define CHAMPLAIN_IS_TILE_CACHE_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_TILE_CACHE))
44 
45 #define CHAMPLAIN_TILE_CACHE_GET_CLASS(obj) \
46   (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCacheClass))
47 
48 typedef struct _ChamplainTileCachePrivate ChamplainTileCachePrivate;
49 
50 typedef struct _ChamplainTileCache ChamplainTileCache;
51 typedef struct _ChamplainTileCacheClass ChamplainTileCacheClass;
52 
53 /**
54  * ChamplainTileCache:
55  *
56  * The #ChamplainTileCache structure contains only private data
57  * and should be accessed using the provided API
58  *
59  * Since: 0.6
60  */
61 struct _ChamplainTileCache
62 {
63   ChamplainMapSource parent_instance;
64 
65   ChamplainTileCachePrivate *priv;
66 };
67 
68 struct _ChamplainTileCacheClass
69 {
70   ChamplainMapSourceClass parent_class;
71 
72   void (*store_tile)(ChamplainTileCache *tile_cache,
73       ChamplainTile *tile,
74       const gchar *contents,
75       gsize size);
76   void (*refresh_tile_time)(ChamplainTileCache *tile_cache,
77       ChamplainTile *tile);
78   void (*on_tile_filled)(ChamplainTileCache *tile_cache,
79       ChamplainTile *tile);
80 };
81 
82 GType champlain_tile_cache_get_type (void);
83 
84 void champlain_tile_cache_store_tile (ChamplainTileCache *tile_cache,
85     ChamplainTile *tile,
86     const gchar *contents,
87     gsize size);
88 void champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache,
89     ChamplainTile *tile);
90 void champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache,
91     ChamplainTile *tile);
92 
93 G_END_DECLS
94 
95 #endif /* _CHAMPLAIN_TILE_CACHE_H_ */
96