1 | /* |
2 | * Copyright © 2011 Red Hat Inc. |
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 | * Authors: Benjamin Otte <otte@gnome.org> |
19 | */ |
20 | |
21 | #ifndef __GTK_ALLOCATED_BITMASK_PRIVATE_H__ |
22 | #define __GTK_ALLOCATED_BITMASK_PRIVATE_H__ |
23 | |
24 | #include <glib.h> |
25 | |
26 | G_BEGIN_DECLS |
27 | |
28 | typedef struct _GtkBitmask GtkBitmask; |
29 | |
30 | #define _gtk_bitmask_to_bits(mask) \ |
31 | (GPOINTER_TO_SIZE (mask) >> ((gsize) 1)) |
32 | |
33 | #define _gtk_bitmask_from_bits(bits) \ |
34 | GSIZE_TO_POINTER ((((gsize) (bits)) << 1) | 1) |
35 | |
36 | #define _gtk_bitmask_is_allocated(mask) \ |
37 | (!(GPOINTER_TO_SIZE (mask) & 1)) |
38 | |
39 | #define GTK_BITMASK_N_DIRECT_BITS (sizeof (gsize) * 8 - 1) |
40 | |
41 | |
42 | GtkBitmask * _gtk_allocated_bitmask_copy (const GtkBitmask *mask); |
43 | void _gtk_allocated_bitmask_free (GtkBitmask *mask); |
44 | |
45 | char * _gtk_allocated_bitmask_to_string (const GtkBitmask *mask); |
46 | void _gtk_allocated_bitmask_print (const GtkBitmask *mask, |
47 | GString *string); |
48 | |
49 | GtkBitmask * _gtk_allocated_bitmask_intersect (GtkBitmask *mask, |
50 | const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT; |
51 | GtkBitmask * _gtk_allocated_bitmask_union (GtkBitmask *mask, |
52 | const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT; |
53 | GtkBitmask * _gtk_allocated_bitmask_subtract (GtkBitmask *mask, |
54 | const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT; |
55 | |
56 | gboolean _gtk_allocated_bitmask_get (const GtkBitmask *mask, |
57 | guint index_); |
58 | GtkBitmask * _gtk_allocated_bitmask_set (GtkBitmask *mask, |
59 | guint index_, |
60 | gboolean value) G_GNUC_WARN_UNUSED_RESULT; |
61 | |
62 | GtkBitmask * _gtk_allocated_bitmask_invert_range (GtkBitmask *mask, |
63 | guint start, |
64 | guint end) G_GNUC_WARN_UNUSED_RESULT; |
65 | |
66 | gboolean _gtk_allocated_bitmask_equals (const GtkBitmask *mask, |
67 | const GtkBitmask *other); |
68 | gboolean _gtk_allocated_bitmask_intersects (const GtkBitmask *mask, |
69 | const GtkBitmask *other); |
70 | |
71 | G_END_DECLS |
72 | |
73 | #endif /* __GTK_ALLOCATED_BITMASK_PRIVATE_H__ */ |
74 | |