GVariant: add internal tree-form locking helper
[platform/upstream/glib.git] / glib / gbytes.h
1 /*
2  * Copyright © 2009, 2010 Codethink Limited
3  * Copyright © 2011 Collabora Ltd.
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 of the licence, 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 Public
16  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author: Ryan Lortie <desrt@desrt.ca>
19  *         Stef Walter <stefw@collabora.co.uk>
20  */
21
22 #ifndef __G_BYTES_H__
23 #define __G_BYTES_H__
24
25 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
26 #error "Only <glib.h> can be included directly."
27 #endif
28
29 #include <glib/gtypes.h>
30 #include <glib/garray.h>
31
32 G_BEGIN_DECLS
33
34 GLIB_AVAILABLE_IN_ALL
35 GBytes *        g_bytes_new                     (gconstpointer   data,
36                                                  gsize           size);
37
38 GLIB_AVAILABLE_IN_ALL
39 GBytes *        g_bytes_new_take                (gpointer        data,
40                                                  gsize           size);
41
42 #ifdef G_OS_UNIX
43 GLIB_AVAILABLE_IN_2_44
44 GBytes *        g_bytes_new_take_zero_copy_fd   (gint            fd);
45 #endif
46
47 GLIB_AVAILABLE_IN_ALL
48 GBytes *        g_bytes_new_static              (gconstpointer   data,
49                                                  gsize           size);
50
51 GLIB_AVAILABLE_IN_ALL
52 GBytes *        g_bytes_new_with_free_func      (gconstpointer   data,
53                                                  gsize           size,
54                                                  GDestroyNotify  free_func,
55                                                  gpointer        user_data);
56
57 GLIB_AVAILABLE_IN_ALL
58 GBytes *        g_bytes_new_from_bytes          (GBytes         *bytes,
59                                                  gsize           offset,
60                                                  gsize           length);
61
62 GLIB_AVAILABLE_IN_ALL
63 gconstpointer   g_bytes_get_data                (GBytes         *bytes,
64                                                  gsize          *size);
65
66 GLIB_AVAILABLE_IN_ALL
67 gsize           g_bytes_get_size                (GBytes         *bytes);
68
69 GLIB_AVAILABLE_IN_2_44
70 gint            g_bytes_get_zero_copy_fd        (GBytes         *bytes);
71
72 GLIB_AVAILABLE_IN_ALL
73 GBytes *        g_bytes_ref                     (GBytes         *bytes);
74
75 GLIB_AVAILABLE_IN_ALL
76 void            g_bytes_unref                   (GBytes         *bytes);
77
78 GLIB_AVAILABLE_IN_ALL
79 gpointer        g_bytes_unref_to_data           (GBytes         *bytes,
80                                                  gsize          *size);
81
82 GLIB_AVAILABLE_IN_ALL
83 GByteArray *    g_bytes_unref_to_array          (GBytes         *bytes);
84
85 GLIB_AVAILABLE_IN_ALL
86 guint           g_bytes_hash                    (gconstpointer   bytes);
87
88 GLIB_AVAILABLE_IN_ALL
89 gboolean        g_bytes_equal                   (gconstpointer   bytes1,
90                                                  gconstpointer   bytes2);
91
92 GLIB_AVAILABLE_IN_ALL
93 gint            g_bytes_compare                 (gconstpointer   bytes1,
94                                                  gconstpointer   bytes2);
95
96 G_END_DECLS
97
98 #endif /* __G_BYTES_H__ */