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