1 | /* GIO - GLib Input, Output and Streaming Library |
2 | * |
3 | * Copyright (C) 2006-2007 Red Hat, Inc. |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General |
16 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
17 | * |
18 | * Author: Alexander Larsson <[email protected]> |
19 | */ |
20 | |
21 | #ifndef __G_RESOURCE_H__ |
22 | #define __G_RESOURCE_H__ |
23 | |
24 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
25 | #error "Only <gio/gio.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <gio/giotypes.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | /** |
33 | * G_TYPE_RESOURCE: |
34 | * |
35 | * The #GType for #GResource. |
36 | */ |
37 | #define G_TYPE_RESOURCE (g_resource_get_type ()) |
38 | |
39 | |
40 | /** |
41 | * G_RESOURCE_ERROR: |
42 | * |
43 | * Error domain for #GResource. Errors in this domain will be from the |
44 | * #GResourceError enumeration. See #GError for more information on |
45 | * error domains. |
46 | */ |
47 | #define G_RESOURCE_ERROR (g_resource_error_quark ()) |
48 | GLIB_AVAILABLE_IN_2_32 |
49 | GQuark g_resource_error_quark (void); |
50 | |
51 | typedef struct _GStaticResource GStaticResource; |
52 | |
53 | struct _GStaticResource { |
54 | /*< private >*/ |
55 | const guint8 *data; |
56 | gsize data_len; |
57 | GResource *resource; |
58 | GStaticResource *next; |
59 | gpointer padding; |
60 | }; |
61 | |
62 | GLIB_AVAILABLE_IN_2_32 |
63 | GType g_resource_get_type (void) G_GNUC_CONST; |
64 | GLIB_AVAILABLE_IN_2_32 |
65 | GResource * g_resource_new_from_data (GBytes *data, |
66 | GError **error); |
67 | GLIB_AVAILABLE_IN_2_32 |
68 | GResource * g_resource_ref (GResource *resource); |
69 | GLIB_AVAILABLE_IN_2_32 |
70 | void g_resource_unref (GResource *resource); |
71 | GLIB_AVAILABLE_IN_2_32 |
72 | GResource * g_resource_load (const gchar *filename, |
73 | GError **error); |
74 | GLIB_AVAILABLE_IN_2_32 |
75 | GInputStream *g_resource_open_stream (GResource *resource, |
76 | const char *path, |
77 | GResourceLookupFlags lookup_flags, |
78 | GError **error); |
79 | GLIB_AVAILABLE_IN_2_32 |
80 | GBytes * g_resource_lookup_data (GResource *resource, |
81 | const char *path, |
82 | GResourceLookupFlags lookup_flags, |
83 | GError **error); |
84 | GLIB_AVAILABLE_IN_2_32 |
85 | char ** g_resource_enumerate_children (GResource *resource, |
86 | const char *path, |
87 | GResourceLookupFlags lookup_flags, |
88 | GError **error); |
89 | GLIB_AVAILABLE_IN_2_32 |
90 | gboolean g_resource_get_info (GResource *resource, |
91 | const char *path, |
92 | GResourceLookupFlags lookup_flags, |
93 | gsize *size, |
94 | guint32 *flags, |
95 | GError **error); |
96 | |
97 | GLIB_AVAILABLE_IN_2_32 |
98 | void g_resources_register (GResource *resource); |
99 | GLIB_AVAILABLE_IN_2_32 |
100 | void g_resources_unregister (GResource *resource); |
101 | GLIB_AVAILABLE_IN_2_32 |
102 | GInputStream *g_resources_open_stream (const char *path, |
103 | GResourceLookupFlags lookup_flags, |
104 | GError **error); |
105 | GLIB_AVAILABLE_IN_2_32 |
106 | GBytes * g_resources_lookup_data (const char *path, |
107 | GResourceLookupFlags lookup_flags, |
108 | GError **error); |
109 | GLIB_AVAILABLE_IN_2_32 |
110 | char ** g_resources_enumerate_children (const char *path, |
111 | GResourceLookupFlags lookup_flags, |
112 | GError **error); |
113 | GLIB_AVAILABLE_IN_2_32 |
114 | gboolean g_resources_get_info (const char *path, |
115 | GResourceLookupFlags lookup_flags, |
116 | gsize *size, |
117 | guint32 *flags, |
118 | GError **error); |
119 | |
120 | |
121 | GLIB_AVAILABLE_IN_2_32 |
122 | void g_static_resource_init (GStaticResource *static_resource); |
123 | GLIB_AVAILABLE_IN_2_32 |
124 | void g_static_resource_fini (GStaticResource *static_resource); |
125 | GLIB_AVAILABLE_IN_2_32 |
126 | GResource *g_static_resource_get_resource (GStaticResource *static_resource); |
127 | |
128 | G_END_DECLS |
129 | |
130 | #endif /* __G_RESOURCE_H__ */ |
131 | |