summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-04-16 11:27:29 -0400
committerRyan Lortie <desrt@desrt.ca>2014-05-06 08:18:37 -0400
commit1459ff3eb242327fca8a2b5a696b14b7e46afdee (patch)
treef1ca2f63e93f3ab2a212b00701750b33a91961fc /giscanner/annotationparser.py
parent89d51bce0feb115a1b73f32b023bfabaeec9fde1 (diff)
downloadgobject-introspection-1459ff3eb242327fca8a2b5a696b14b7e46afdee.tar.gz
giscanner: add (nullable) and (optional) annotations
Add two new annotations, (nullable) and (optional). (nullable) always means "the type of this value can also contain null". (optional) always means "this out parameter can be ignored by passing NULL to the C function". https://bugzilla.gnome.org/show_bug.cgi?id=660879
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 5ded4193..a167ff94 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -201,6 +201,8 @@ ANN_GET_VALUE_FUNC = 'get-value-func'
ANN_IN = 'in'
ANN_INOUT = 'inout'
ANN_METHOD = 'method'
+ANN_NULLABLE = 'nullable'
+ANN_OPTIONAL = 'optional'
ANN_OUT = 'out'
ANN_REF_FUNC = 'ref-func'
ANN_RENAME_TO = 'rename-to'
@@ -788,6 +790,30 @@ class GtkDocAnnotatable(object):
self._validate_annotation(position, ann_name, options, exact_n_options=0)
+ def _do_validate_nullable(self, position, ann_name, options):
+ '''
+ Validate the ``(nullable)`` annotation.
+
+ :param position: :class:`giscanner.message.Position` of the line in the source file
+ containing the annotation to be validated
+ :param ann_name: name of the annotation holding the options to validate
+ :param options: annotation options held by the annotation
+ '''
+
+ self._validate_annotation(position, ann_name, options, exact_n_options=0)
+
+ def _do_validate_optional(self, position, ann_name, options):
+ '''
+ Validate the ``(optional)`` annotation.
+
+ :param position: :class:`giscanner.message.Position` of the line in the source file
+ containing the annotation to be validated
+ :param ann_name: name of the annotation holding the options to validate
+ :param options: annotation options held by the annotation
+ '''
+
+ self._validate_annotation(position, ann_name, options, exact_n_options=0)
+
def _do_validate_out(self, position, ann_name, options):
'''
Validate the ``(out)`` annotation.