]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
doclets/gtkdoc: Add gtk-doc headers for property accessor ‘result_length’ parameters
authorPhilip Withnall <philip@tecnocode.co.uk>
Thu, 16 Aug 2012 18:19:07 +0000 (20:19 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Thu, 16 Aug 2012 18:19:07 +0000 (20:19 +0200)
When getting or setting arrays, Vala generates input or output
result length parameters, which need to have some (boilerplate)
documentation.

src/doclets/gtkdoc/generator.vala

index 985d660e2997f43256aab0c9eb09139d26fbf5b6..e904d77eef133c90d7b2e28daf6c838d11a91db1 100644 (file)
@@ -621,6 +621,13 @@ It is important that your <link linkend=\"GValue\"><type>GValue</type></link> ho
                        getter_gcomment.returns = "the value of the %s property".printf (get_docbook_link (prop));
                        getter_gcomment.brief_comment = "Get and return the current value of the %s property.".printf (get_docbook_link (prop));
 
+                       if (prop.property_type != null && prop.property_type.data_type is Api.Array) {
+                               var array_type = prop.property_type.data_type;
+                               for (uint dim = 1; array_type != null && array_type is Api.Array; dim++, array_type = ((Api.Array) array_type).data_type) {
+                                       gcomment.headers.add (new Header ("result_length%u".printf (dim), "return location for the length of the property's value"));
+                               }
+                       }
+
                        /* Copy versioning headers such as deprecation and since lines. */
                        getter_gcomment.versioning = gcomment.versioning;
                }
@@ -631,6 +638,13 @@ It is important that your <link linkend=\"GValue\"><type>GValue</type></link> ho
                        setter_gcomment.headers.add (new Header ("value", "the new value of the %s property".printf (get_docbook_link (prop)), 2));
                        setter_gcomment.brief_comment = "Set the value of the %s property to @value.".printf (get_docbook_link (prop));
 
+                       if (prop.property_type != null && prop.property_type.data_type is Api.Array) {
+                               var array_type = prop.property_type.data_type;
+                               for (uint dim = 1; array_type != null && array_type is Api.Array; dim++, array_type = ((Api.Array) array_type).data_type) {
+                                       gcomment.headers.add (new Header ("value_length%u".printf (dim), "length of the property's new value"));
+                               }
+                       }
+
                        /* Copy versioning headers such as deprecation and since lines. */
                        setter_gcomment.versioning = gcomment.versioning;
                }