[gtk-doc] gtkdoc-mkdb: Add support for (not nullable) annotations
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] gtkdoc-mkdb: Add support for (not nullable) annotations
- Date: Thu, 19 Nov 2015 07:20:29 +0000 (UTC)
commit c567d9e28c355f43faeba61fb81fd16fc74cf062
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Nov 6 13:00:58 2015 +0100
gtkdoc-mkdb: Add support for (not nullable) annotations
In bug #729660, gobject-introspection gained support for a (not
nullable) annotation which is the exact opposite of (nullable).
Add support for that to gtkdoc-mkdb, and add some unit tests.
https://bugzilla.gnome.org/show_bug.cgi?id=756684
gtkdoc-mkdb.in | 1 +
tests/annotations/docs/tester-sections.txt | 3 ++
tests/annotations/src/tester.c | 52 ++++++++++++++++++++++++++-
tests/annotations/src/tester.h | 3 ++
4 files changed, 57 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 4cc9984..15825ba 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -157,6 +157,7 @@ my %AnnotationDefinition = (
# https://live.gnome.org/GObjectIntrospection/Annotations
'allow-none' => "NULL is OK, both for passing and for returning.",
'nullable' => "NULL may be passed as the value in, out, in-out; or as a return value.",
+ 'not nullable' => "NULL must not be passed as the value in, out, in-out; or as a return value.",
'optional' => "NULL may be passed instead of a pointer to a location.",
'array' => "Parameter points to an array of items.",
'attribute' => "Deprecated free-form custom annotation, replaced by (attributes) annotation.",
diff --git a/tests/annotations/docs/tester-sections.txt b/tests/annotations/docs/tester-sections.txt
index 81b3ccf..d3efd64 100644
--- a/tests/annotations/docs/tester-sections.txt
+++ b/tests/annotations/docs/tester-sections.txt
@@ -5,13 +5,16 @@ GtkdocAnnotation
annotation_array_length
annotation_allow_none
annotation_nullable
+annotation_not_nullable
annotation_elementtype
annotation_elementtype_transfer
annotation_elementtype_returns
annotation_outparams
annotation_outparams_nullable
+annotation_outparams_not_nullable
annotation_outparams_optional
annotation_outparams_optional_nullable
+annotation_outparams_optional_not_nullable
annotation_skip
annotation_skip_return
annotation_scope
diff --git a/tests/annotations/src/tester.c b/tests/annotations/src/tester.c
index cf193cf..4e05dc5 100644
--- a/tests/annotations/src/tester.c
+++ b/tests/annotations/src/tester.c
@@ -64,6 +64,24 @@ annotation_nullable (const gchar *uri,
}
/**
+ * annotation_not_nullable:
+ * @uri: a uri
+ * @label: (not nullable): a non-optional string, which is used in ways too
+ * complicated to describe in a single line, making it necessary to wrap it
+ *
+ * Document non-nullable parameters.
+ *
+ * Returns: (transfer full) (not nullable): Returns stuff which you have to
+ * free after use, whose description is also rather long
+ */
+gchar *
+annotation_not_nullable (const gchar *uri,
+ const gchar *label)
+{
+ return NULL;
+}
+
+/**
* annotation_elementtype:
* @list: (element-type GObject): list of #GObject instances to search
*
@@ -148,11 +166,26 @@ annotation_outparams_nullable (GList **list)
}
/**
+ * annotation_outparams_not_nullable:
+ * @list: (out) (transfer none) (not nullable): a pointer to take a list; %NULL
+ * must not be returned
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_outparams_not_nullable (GList **list)
+{
+ return TRUE;
+}
+
+/**
* annotation_outparams_optional_nullable:
* @list: (out) (transfer none) (optional) (nullable): a pointer to take a
* list, or %NULL; but %NULL may also be returned in @list — isn’t that cool?
*
- * Document optional parameters.
+ * Document non-optional parameters.
*
* Returns: %TRUE for success
*/
@@ -163,6 +196,21 @@ annotation_outparams_optional_nullable (GList **list)
}
/**
+ * annotation_outparams_optional_not_nullable:
+ * @list: (out) (transfer none) (optional) (not nullable): a pointer to take a
+ * list, not %NULL; and %NULL must not be returned in @list — isn’t that cool?
+ *
+ * Document non-optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_outparams_optional_not_nullable (GList **list)
+{
+ return TRUE;
+}
+
+/**
* annotation_skip: (skip)
* @list: a pointer to take a list
*
@@ -239,4 +287,4 @@ void annotation_multiline_on_function (void)
*/
void annotation_multiline_on_function2 (void)
{
-}
\ No newline at end of file
+}
diff --git a/tests/annotations/src/tester.h b/tests/annotations/src/tester.h
index 33437dc..3627e59 100644
--- a/tests/annotations/src/tester.h
+++ b/tests/annotations/src/tester.h
@@ -18,6 +18,7 @@ void annotation_array_length (GObject *list, gint n_columns, GType *types);
gchar * annotation_allow_none (const gchar *uri, const gchar *label);
gchar * annotation_nullable (const gchar *uri, const gchar *label);
+gchar * annotation_not_nullable (const gchar *uri, const gchar *label);
gboolean annotation_elementtype (const GList *list);
gboolean annotation_elementtype_transfer (const GList *list);
@@ -26,7 +27,9 @@ GList *annotation_elementtype_returns (void);
gboolean annotation_outparams (GList **list);
gboolean annotation_outparams_optional (GList **list);
gboolean annotation_outparams_nullable (GList **list);
+gboolean annotation_outparams_not_nullable (GList **list);
gboolean annotation_outparams_optional_nullable (GList **list);
+gboolean annotation_outparams_optional_not_nullable (GList **list);
void annotation_skip (GList *list);
gboolean annotation_skip_return (GList *list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]