forked from AuroraMiddleware/gtk
bitmask: Split bitmask code into two
This does nothing but turn all GtkBitmask functions into static inline functions that call the gtk_allocated_bitmask_*() equivalent. The implementation of the static functions has also been put into a private header, to not scare people who want to see how things are implemented.
This commit is contained in:
parent
904cf36a5d
commit
27eb83a410
@ -403,12 +403,14 @@ gtk_private_h_sources = \
|
|||||||
gtkapplicationprivate.h \
|
gtkapplicationprivate.h \
|
||||||
gtkaccelgroupprivate.h \
|
gtkaccelgroupprivate.h \
|
||||||
gtkaccelmapprivate.h \
|
gtkaccelmapprivate.h \
|
||||||
|
gtkallocatedbitmaskprivate.h \
|
||||||
gtkanimationdescription.h \
|
gtkanimationdescription.h \
|
||||||
gtkappchooserprivate.h \
|
gtkappchooserprivate.h \
|
||||||
gtkappchoosermodule.h \
|
gtkappchoosermodule.h \
|
||||||
gtkappchooseronline.h \
|
gtkappchooseronline.h \
|
||||||
gtkbindingsprivate.h \
|
gtkbindingsprivate.h \
|
||||||
gtkbitmaskprivate.h \
|
gtkbitmaskprivate.h \
|
||||||
|
gtkbitmaskprivateimpl.h \
|
||||||
gtkborderimageprivate.h \
|
gtkborderimageprivate.h \
|
||||||
gtkboxprivate.h \
|
gtkboxprivate.h \
|
||||||
gtkbuilderprivate.h \
|
gtkbuilderprivate.h \
|
||||||
@ -558,6 +560,7 @@ gtk_base_c_sources = \
|
|||||||
gtkactivatable.c \
|
gtkactivatable.c \
|
||||||
gtkadjustment.c \
|
gtkadjustment.c \
|
||||||
gtkalignment.c \
|
gtkalignment.c \
|
||||||
|
gtkallocatedbitmask.c \
|
||||||
gtkappchooser.c \
|
gtkappchooser.c \
|
||||||
gtkappchooserwidget.c \
|
gtkappchooserwidget.c \
|
||||||
gtkappchooserbutton.c \
|
gtkappchooserbutton.c \
|
||||||
@ -573,7 +576,6 @@ gtk_base_c_sources = \
|
|||||||
gtkbbox.c \
|
gtkbbox.c \
|
||||||
gtkbin.c \
|
gtkbin.c \
|
||||||
gtkbindings.c \
|
gtkbindings.c \
|
||||||
gtkbitmask.c \
|
|
||||||
gtkborder.c \
|
gtkborder.c \
|
||||||
gtkborderimage.c \
|
gtkborderimage.c \
|
||||||
gtkbox.c \
|
gtkbox.c \
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtk/gtkbitmaskprivate.h"
|
#include "gtk/gtkallocatedbitmaskprivate.h"
|
||||||
|
|
||||||
#define VALUE_TYPE gsize
|
#define VALUE_TYPE gsize
|
||||||
|
|
||||||
@ -32,10 +32,10 @@ struct _GtkBitmask {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static GtkBitmask *
|
static GtkBitmask *
|
||||||
gtk_bitmask_resize (GtkBitmask *mask,
|
gtk_allocated_bitmask_resize (GtkBitmask *mask,
|
||||||
gsize size) G_GNUC_WARN_UNUSED_RESULT;
|
gsize size) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
static GtkBitmask *
|
static GtkBitmask *
|
||||||
gtk_bitmask_resize (GtkBitmask *mask,
|
gtk_allocated_bitmask_resize (GtkBitmask *mask,
|
||||||
gsize size)
|
gsize size)
|
||||||
{
|
{
|
||||||
gsize i;
|
gsize i;
|
||||||
@ -51,25 +51,25 @@ gtk_bitmask_resize (GtkBitmask *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_new (void)
|
_gtk_allocated_bitmask_new (void)
|
||||||
{
|
{
|
||||||
return g_malloc0 (sizeof (GtkBitmask));
|
return g_malloc0 (sizeof (GtkBitmask));
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_copy (const GtkBitmask *mask)
|
_gtk_allocated_bitmask_copy (const GtkBitmask *mask)
|
||||||
{
|
{
|
||||||
GtkBitmask *copy;
|
GtkBitmask *copy;
|
||||||
|
|
||||||
g_return_val_if_fail (mask != NULL, NULL);
|
g_return_val_if_fail (mask != NULL, NULL);
|
||||||
|
|
||||||
copy = _gtk_bitmask_new ();
|
copy = _gtk_allocated_bitmask_new ();
|
||||||
|
|
||||||
return _gtk_bitmask_union (copy, mask);
|
return _gtk_allocated_bitmask_union (copy, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_bitmask_free (GtkBitmask *mask)
|
_gtk_allocated_bitmask_free (GtkBitmask *mask)
|
||||||
{
|
{
|
||||||
g_return_if_fail (mask != NULL);
|
g_return_if_fail (mask != NULL);
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ _gtk_bitmask_free (GtkBitmask *mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_bitmask_print (const GtkBitmask *mask,
|
_gtk_allocated_bitmask_print (const GtkBitmask *mask,
|
||||||
GString *string)
|
GString *string)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -87,7 +87,7 @@ _gtk_bitmask_print (const GtkBitmask *mask,
|
|||||||
|
|
||||||
for (i = mask->len * VALUE_SIZE_BITS - 1; i >= 0; i--)
|
for (i = mask->len * VALUE_SIZE_BITS - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (_gtk_bitmask_get (mask, i))
|
if (_gtk_allocated_bitmask_get (mask, i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,28 +99,28 @@ _gtk_bitmask_print (const GtkBitmask *mask,
|
|||||||
|
|
||||||
for (; i >= 0; i--)
|
for (; i >= 0; i--)
|
||||||
{
|
{
|
||||||
g_string_append_c (string, _gtk_bitmask_get (mask, i) ? '1' : '0');
|
g_string_append_c (string, _gtk_allocated_bitmask_get (mask, i) ? '1' : '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
_gtk_bitmask_to_string (const GtkBitmask *mask)
|
_gtk_allocated_bitmask_to_string (const GtkBitmask *mask)
|
||||||
{
|
{
|
||||||
GString *string;
|
GString *string;
|
||||||
|
|
||||||
string = g_string_new (NULL);
|
string = g_string_new (NULL);
|
||||||
_gtk_bitmask_print (mask, string);
|
_gtk_allocated_bitmask_print (mask, string);
|
||||||
return g_string_free (string, FALSE);
|
return g_string_free (string, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NB: Call this function whenever the
|
/* NB: Call this function whenever the
|
||||||
* array might have become too large.
|
* array might have become too large.
|
||||||
* _gtk_bitmask_is_empty() depends on this.
|
* _gtk_allocated_bitmask_is_empty() depends on this.
|
||||||
*/
|
*/
|
||||||
static GtkBitmask *
|
static GtkBitmask *
|
||||||
gtk_bitmask_shrink (GtkBitmask *mask) G_GNUC_WARN_UNUSED_RESULT;
|
gtk_allocated_bitmask_shrink (GtkBitmask *mask) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
static GtkBitmask *
|
static GtkBitmask *
|
||||||
gtk_bitmask_shrink (GtkBitmask *mask)
|
gtk_allocated_bitmask_shrink (GtkBitmask *mask)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
@ -130,11 +130,11 @@ gtk_bitmask_shrink (GtkBitmask *mask)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gtk_bitmask_resize (mask, i);
|
return gtk_allocated_bitmask_resize (mask, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_intersect (GtkBitmask *mask,
|
_gtk_allocated_bitmask_intersect (GtkBitmask *mask,
|
||||||
const GtkBitmask *other)
|
const GtkBitmask *other)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
@ -142,17 +142,17 @@ _gtk_bitmask_intersect (GtkBitmask *mask,
|
|||||||
g_return_val_if_fail (mask != NULL, NULL);
|
g_return_val_if_fail (mask != NULL, NULL);
|
||||||
g_return_val_if_fail (other != NULL, NULL);
|
g_return_val_if_fail (other != NULL, NULL);
|
||||||
|
|
||||||
mask = gtk_bitmask_resize (mask, MIN (mask->len, other->len));
|
mask = gtk_allocated_bitmask_resize (mask, MIN (mask->len, other->len));
|
||||||
for (i = 0; i < mask->len; i++)
|
for (i = 0; i < mask->len; i++)
|
||||||
{
|
{
|
||||||
mask->data[i] &= other->data[i];
|
mask->data[i] &= other->data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return gtk_bitmask_shrink (mask);
|
return gtk_allocated_bitmask_shrink (mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_union (GtkBitmask *mask,
|
_gtk_allocated_bitmask_union (GtkBitmask *mask,
|
||||||
const GtkBitmask *other)
|
const GtkBitmask *other)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
@ -160,7 +160,7 @@ _gtk_bitmask_union (GtkBitmask *mask,
|
|||||||
g_return_val_if_fail (mask != NULL, NULL);
|
g_return_val_if_fail (mask != NULL, NULL);
|
||||||
g_return_val_if_fail (other != NULL, NULL);
|
g_return_val_if_fail (other != NULL, NULL);
|
||||||
|
|
||||||
mask = gtk_bitmask_resize (mask, MAX (mask->len, other->len));
|
mask = gtk_allocated_bitmask_resize (mask, MAX (mask->len, other->len));
|
||||||
for (i = 0; i < other->len; i++)
|
for (i = 0; i < other->len; i++)
|
||||||
{
|
{
|
||||||
mask->data[i] |= other->data[i];
|
mask->data[i] |= other->data[i];
|
||||||
@ -170,7 +170,7 @@ _gtk_bitmask_union (GtkBitmask *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_subtract (GtkBitmask *mask,
|
_gtk_allocated_bitmask_subtract (GtkBitmask *mask,
|
||||||
const GtkBitmask *other)
|
const GtkBitmask *other)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
@ -183,11 +183,11 @@ _gtk_bitmask_subtract (GtkBitmask *mask,
|
|||||||
mask->data[i] |= ~other->data[i];
|
mask->data[i] |= ~other->data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return gtk_bitmask_shrink (mask);
|
return gtk_allocated_bitmask_shrink (mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_bitmask_indexes (guint index_,
|
gtk_allocated_bitmask_indexes (guint index_,
|
||||||
guint *array_index,
|
guint *array_index,
|
||||||
guint *bit_index)
|
guint *bit_index)
|
||||||
{
|
{
|
||||||
@ -196,14 +196,14 @@ gtk_bitmask_indexes (guint index_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_bitmask_get (const GtkBitmask *mask,
|
_gtk_allocated_bitmask_get (const GtkBitmask *mask,
|
||||||
guint index_)
|
guint index_)
|
||||||
{
|
{
|
||||||
guint array_index, bit_index;
|
guint array_index, bit_index;
|
||||||
|
|
||||||
g_return_val_if_fail (mask != NULL, FALSE);
|
g_return_val_if_fail (mask != NULL, FALSE);
|
||||||
|
|
||||||
gtk_bitmask_indexes (index_, &array_index, &bit_index);
|
gtk_allocated_bitmask_indexes (index_, &array_index, &bit_index);
|
||||||
|
|
||||||
if (array_index >= mask->len)
|
if (array_index >= mask->len)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -212,7 +212,7 @@ _gtk_bitmask_get (const GtkBitmask *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_set (GtkBitmask *mask,
|
_gtk_allocated_bitmask_set (GtkBitmask *mask,
|
||||||
guint index_,
|
guint index_,
|
||||||
gboolean value)
|
gboolean value)
|
||||||
{
|
{
|
||||||
@ -220,12 +220,12 @@ _gtk_bitmask_set (GtkBitmask *mask,
|
|||||||
|
|
||||||
g_return_val_if_fail (mask != NULL, NULL);
|
g_return_val_if_fail (mask != NULL, NULL);
|
||||||
|
|
||||||
gtk_bitmask_indexes (index_, &array_index, &bit_index);
|
gtk_allocated_bitmask_indexes (index_, &array_index, &bit_index);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
if (array_index >= mask->len)
|
if (array_index >= mask->len)
|
||||||
mask = gtk_bitmask_resize (mask, array_index + 1);
|
mask = gtk_allocated_bitmask_resize (mask, array_index + 1);
|
||||||
|
|
||||||
mask->data[array_index] |= VALUE_BIT (bit_index);
|
mask->data[array_index] |= VALUE_BIT (bit_index);
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ _gtk_bitmask_set (GtkBitmask *mask,
|
|||||||
if (array_index < mask->len)
|
if (array_index < mask->len)
|
||||||
{
|
{
|
||||||
mask->data[array_index] &= ~ VALUE_BIT (bit_index);
|
mask->data[array_index] &= ~ VALUE_BIT (bit_index);
|
||||||
mask = gtk_bitmask_shrink (mask);
|
mask = gtk_allocated_bitmask_shrink (mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ _gtk_bitmask_set (GtkBitmask *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkBitmask *
|
GtkBitmask *
|
||||||
_gtk_bitmask_invert_range (GtkBitmask *mask,
|
_gtk_allocated_bitmask_invert_range (GtkBitmask *mask,
|
||||||
guint start,
|
guint start,
|
||||||
guint end)
|
guint end)
|
||||||
{
|
{
|
||||||
@ -254,13 +254,13 @@ _gtk_bitmask_invert_range (GtkBitmask *mask,
|
|||||||
/* I CAN HAS SPEEDUP? */
|
/* I CAN HAS SPEEDUP? */
|
||||||
|
|
||||||
for (i = start; i < end; i++)
|
for (i = start; i < end; i++)
|
||||||
mask = _gtk_bitmask_set (mask, i, !_gtk_bitmask_get (mask, i));
|
mask = _gtk_allocated_bitmask_set (mask, i, !_gtk_allocated_bitmask_get (mask, i));
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_bitmask_is_empty (const GtkBitmask *mask)
|
_gtk_allocated_bitmask_is_empty (const GtkBitmask *mask)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (mask != NULL, FALSE);
|
g_return_val_if_fail (mask != NULL, FALSE);
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ _gtk_bitmask_is_empty (const GtkBitmask *mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_bitmask_equals (const GtkBitmask *mask,
|
_gtk_allocated_bitmask_equals (const GtkBitmask *mask,
|
||||||
const GtkBitmask *other)
|
const GtkBitmask *other)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
@ -289,7 +289,7 @@ _gtk_bitmask_equals (const GtkBitmask *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_bitmask_intersects (const GtkBitmask *mask,
|
_gtk_allocated_bitmask_intersects (const GtkBitmask *mask,
|
||||||
const GtkBitmask *other)
|
const GtkBitmask *other)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
64
gtk/gtkallocatedbitmaskprivate.h
Normal file
64
gtk/gtkallocatedbitmaskprivate.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Authors: Benjamin Otte <otte@gnome.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_ALLOCATED_BITMASK_PRIVATE_H__
|
||||||
|
#define __GTK_ALLOCATED_BITMASK_PRIVATE_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _GtkBitmask GtkBitmask;
|
||||||
|
|
||||||
|
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_new (void);
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_copy (const GtkBitmask *mask);
|
||||||
|
void _gtk_allocated_bitmask_free (GtkBitmask *mask);
|
||||||
|
|
||||||
|
char * _gtk_allocated_bitmask_to_string (const GtkBitmask *mask);
|
||||||
|
void _gtk_allocated_bitmask_print (const GtkBitmask *mask,
|
||||||
|
GString *string);
|
||||||
|
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_intersect (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_union (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_subtract (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
gboolean _gtk_allocated_bitmask_get (const GtkBitmask *mask,
|
||||||
|
guint index_);
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_set (GtkBitmask *mask,
|
||||||
|
guint index_,
|
||||||
|
gboolean value) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
GtkBitmask * _gtk_allocated_bitmask_invert_range (GtkBitmask *mask,
|
||||||
|
guint start,
|
||||||
|
guint end) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
gboolean _gtk_allocated_bitmask_is_empty (const GtkBitmask *mask);
|
||||||
|
gboolean _gtk_allocated_bitmask_equals (const GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other);
|
||||||
|
gboolean _gtk_allocated_bitmask_intersects (const GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GTK_ALLOCATED_BITMASK_PRIVATE_H__ */
|
@ -27,37 +27,45 @@ G_BEGIN_DECLS
|
|||||||
typedef struct _GtkBitmask GtkBitmask;
|
typedef struct _GtkBitmask GtkBitmask;
|
||||||
|
|
||||||
|
|
||||||
GtkBitmask * _gtk_bitmask_new (void);
|
static inline GtkBitmask * _gtk_bitmask_new (void);
|
||||||
GtkBitmask * _gtk_bitmask_copy (const GtkBitmask *mask);
|
static inline GtkBitmask * _gtk_bitmask_copy (const GtkBitmask *mask);
|
||||||
void _gtk_bitmask_free (GtkBitmask *mask);
|
static inline void _gtk_bitmask_free (GtkBitmask *mask);
|
||||||
|
|
||||||
char * _gtk_bitmask_to_string (const GtkBitmask *mask);
|
static inline char * _gtk_bitmask_to_string (const GtkBitmask *mask);
|
||||||
void _gtk_bitmask_print (const GtkBitmask *mask,
|
static inline void _gtk_bitmask_print (const GtkBitmask *mask,
|
||||||
GString *string);
|
GString *string);
|
||||||
|
|
||||||
GtkBitmask * _gtk_bitmask_intersect (GtkBitmask *mask,
|
static inline GtkBitmask * _gtk_bitmask_intersect (GtkBitmask *mask,
|
||||||
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
GtkBitmask * _gtk_bitmask_union (GtkBitmask *mask,
|
static inline GtkBitmask * _gtk_bitmask_union (GtkBitmask *mask,
|
||||||
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
GtkBitmask * _gtk_bitmask_subtract (GtkBitmask *mask,
|
static inline GtkBitmask * _gtk_bitmask_subtract (GtkBitmask *mask,
|
||||||
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
const GtkBitmask *other) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
gboolean _gtk_bitmask_get (const GtkBitmask *mask,
|
static inline gboolean _gtk_bitmask_get (const GtkBitmask *mask,
|
||||||
guint index_);
|
guint index_);
|
||||||
GtkBitmask * _gtk_bitmask_set (GtkBitmask *mask,
|
static inline GtkBitmask * _gtk_bitmask_set (GtkBitmask *mask,
|
||||||
guint index_,
|
guint index_,
|
||||||
gboolean value) G_GNUC_WARN_UNUSED_RESULT;
|
gboolean value) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
GtkBitmask * _gtk_bitmask_invert_range (GtkBitmask *mask,
|
static inline GtkBitmask * _gtk_bitmask_invert_range (GtkBitmask *mask,
|
||||||
guint start,
|
guint start,
|
||||||
guint end) G_GNUC_WARN_UNUSED_RESULT;
|
guint end) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
gboolean _gtk_bitmask_is_empty (const GtkBitmask *mask);
|
static inline gboolean _gtk_bitmask_is_empty (const GtkBitmask *mask);
|
||||||
gboolean _gtk_bitmask_equals (const GtkBitmask *mask,
|
static inline gboolean _gtk_bitmask_equals (const GtkBitmask *mask,
|
||||||
const GtkBitmask *other);
|
const GtkBitmask *other);
|
||||||
gboolean _gtk_bitmask_intersects (const GtkBitmask *mask,
|
static inline gboolean _gtk_bitmask_intersects (const GtkBitmask *mask,
|
||||||
const GtkBitmask *other);
|
const GtkBitmask *other);
|
||||||
|
|
||||||
|
|
||||||
|
/* This is the actual implementation of the functions declared above.
|
||||||
|
* We put it in a separate file so people don't get scared from looking at this
|
||||||
|
* file when reading source code.
|
||||||
|
*/
|
||||||
|
#include "gtkbitmaskprivateimpl.h"
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_BITMASK_PRIVATE_H__ */
|
#endif /* __GTK_BITMASK_PRIVATE_H__ */
|
||||||
|
116
gtk/gtkbitmaskprivateimpl.h
Normal file
116
gtk/gtkbitmaskprivateimpl.h
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Authors: Benjamin Otte <otte@gnome.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gtkallocatedbitmaskprivate.h"
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_new (void)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_new ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_copy (const GtkBitmask *mask)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_copy (mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_gtk_bitmask_free (GtkBitmask *mask)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_free (mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
_gtk_bitmask_to_string (const GtkBitmask *mask)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_to_string (mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_gtk_bitmask_print (const GtkBitmask *mask,
|
||||||
|
GString *string)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_print (mask, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_intersect (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_intersect (mask, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_union (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_union (mask, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_subtract (GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_subtract (mask, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gtk_bitmask_get (const GtkBitmask *mask,
|
||||||
|
guint index_)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_get (mask, index_);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_set (GtkBitmask *mask,
|
||||||
|
guint index_,
|
||||||
|
gboolean value)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_set (mask, index_, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline GtkBitmask *
|
||||||
|
_gtk_bitmask_invert_range (GtkBitmask *mask,
|
||||||
|
guint start,
|
||||||
|
guint end)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_invert_range (mask, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gtk_bitmask_is_empty (const GtkBitmask *mask)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_is_empty (mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gtk_bitmask_equals (const GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_equals (mask, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
_gtk_bitmask_intersects (const GtkBitmask *mask,
|
||||||
|
const GtkBitmask *other)
|
||||||
|
{
|
||||||
|
return _gtk_allocated_bitmask_intersects (mask, other);
|
||||||
|
}
|
@ -136,7 +136,10 @@ rbtree_LDADD = $(GTK_DEP_LIBS)
|
|||||||
|
|
||||||
TEST_PROGS += bitmask
|
TEST_PROGS += bitmask
|
||||||
bitmask_CFLAGS = -DGTK_COMPILATION -UG_ENABLE_DEBUG
|
bitmask_CFLAGS = -DGTK_COMPILATION -UG_ENABLE_DEBUG
|
||||||
bitmask_SOURCES = bitmask.c ../gtkbitmaskprivate.h ../gtkbitmask.c
|
bitmask_SOURCES = bitmask.c \
|
||||||
|
../gtkbitmaskprivate.h \
|
||||||
|
../gtkallocatedbitmaskprivate.h \
|
||||||
|
../gtkallocatedbitmask.c
|
||||||
bitmask_LDADD = $(GTK_DEP_LIBS)
|
bitmask_LDADD = $(GTK_DEP_LIBS)
|
||||||
|
|
||||||
TEST_PROGS += regression-tests
|
TEST_PROGS += regression-tests
|
||||||
|
Loading…
Reference in New Issue
Block a user