[gtk/wip/otte/whatever: 79/83] bitset: Add gtk_bitset_new_range()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/whatever: 79/83] bitset: Add gtk_bitset_new_range()
- Date: Tue, 30 Jun 2020 02:24:50 +0000 (UTC)
commit 3beda682c868a3171a14a1305cb30961f46d7b9d
Author: Benjamin Otte <otte redhat com>
Date: Tue Jun 30 03:29:22 2020 +0200
bitset: Add gtk_bitset_new_range()
It's a common use.
docs/reference/gtk/gtk4-sections.txt | 1 +
gtk/gtkbitset.c | 24 +++++++++++++++++++++++-
gtk/gtkbitset.h | 3 +++
3 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index c2986441ca..49e2a92ca5 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -348,6 +348,7 @@ GtkBitset
gtk_bitset_ref
gtk_bitset_unref
gtk_bitset_new_empty
+gtk_bitset_new_range
gtk_bitset_copy
<SUBSECTION>
gtk_bitset_contains
diff --git a/gtk/gtkbitset.c b/gtk/gtkbitset.c
index c69efd0cf7..27cdf1ba63 100644
--- a/gtk/gtkbitset.c
+++ b/gtk/gtkbitset.c
@@ -268,7 +268,7 @@ gtk_bitset_get_nth (const GtkBitset *self,
*
* Creates a new empty bitset.
*
- * Returns: A new empty bitset.
+ * Returns: A new empty bitset
**/
GtkBitset *
gtk_bitset_new_empty (void)
@@ -284,6 +284,28 @@ gtk_bitset_new_empty (void)
return self;
}
+/**
+ * gtk_bitset_new_range:
+ * @start: first value to add
+ * @n_items: number of consecutive values to add
+ *
+ * Creates a bitset with the given range set.
+ *
+ * Returns: A new bitset
+ **/
+GtkBitset *
+gtk_bitset_new_range (guint start,
+ guint n_items)
+{
+ GtkBitset *self;
+
+ self = gtk_bitset_new_empty ();
+
+ gtk_bitset_add_range (self, start, n_items);
+
+ return self;
+}
+
/**
* gtk_bitset_copy:
* @self: a #GtkBitset
diff --git a/gtk/gtkbitset.h b/gtk/gtkbitset.h
index 1fcbf6faeb..be0ca58f3b 100644
--- a/gtk/gtkbitset.h
+++ b/gtk/gtkbitset.h
@@ -65,6 +65,9 @@ GDK_AVAILABLE_IN_ALL
GtkBitset * gtk_bitset_new_empty (void);
GDK_AVAILABLE_IN_ALL
GtkBitset * gtk_bitset_copy (const GtkBitset *self);
+GDK_AVAILABLE_IN_ALL
+GtkBitset * gtk_bitset_new_range (guint start,
+ guint n_items);
GDK_AVAILABLE_IN_ALL
void gtk_bitset_remove_all (GtkBitset *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]