Commit Graph

7 Commits

Author SHA1 Message Date
Emmanuele Bassi
605fdf7046 Add copy and free function annotations for POD types
Plain Old Data (POD) types with or without a representation in the GType
type system can still have a copy and/or a free function. We should
allow annotating these types with their corresponding functions for
copying their data into a new instance, and freeing their data.

From a language bindings perspective, POD types should have a boxed
GType wrapper around them, so they can use the generic GBoxed API to
copy and free instances; from a documentation perspective, though, it'd
be good to have a way to match a structured type, like a struct or a
union, with its copy and free functions.

In order to do that, we add two new header block annotations:

- (copy-func function_name)
- (free-func function_name)

These annotations work exactly like ref-func and unref-func for typed
instances:

    /**
     * GdkRGBA: (copy-func gdk_rgba_copy)
     *   (free-func gdk_rgba_free)
     * @red: ...
     * @green: ...
     * @blue: ...
     * @alpha: ...
     *
     * ...
     */

The function is stored in the GIR data as two new attributes for the
`<record>` and `<union>` elements:

    <record name="RGBA"
            c:type="GdkRGBA"
            copy-function="gdk_rgba_copy"
            free-function="gdk_rgba_free"
            glib:type-name="GdkRGBA"
            glib:get-type="gdk_rgba_get_type"
            c:symbol-prefix="gdk_rgba">

The annotations are not mandatory.

See: #14
2023-01-08 14:50:28 +00:00
Christoph Reiter
722518e5bc docs: fix gtk-doc warnings and update version infos
Move things around and rename things until gtk-doc is happy.

This also moves the "Since" annotations to the next stable releases and
adds version added info for g_callable_info_get_instance_ownership_transfer()
and g_struct_info_find_field().
2018-12-09 18:26:26 +01:00
Garrett Regier
6eaa308869 girepository: Add g_struct_info_find_field()
Add find_field utility function for finding a field info by name.
Beyond convenience, this should be faster than manually using
the get_n_fields and get_field functions because get_field does
an additional iteration for each field to calculate offsets O(n^2).
Thus find_field combines the offset and comparison
computations into a single loop O(n).

Based on a patch by Simon Feltman.
2015-06-21 13:01:25 -07:00
Chun-wei Fan
265ea792c1 girepository: Add Header for Version Macros
This adds a header to the girepository library, which is then included
either directly or indirectly by the other headers so that all the public
symbols (and the 2 symbols in gitypelib-internal.h used by the tools) are
decorated by a macro, that can later be used to export the symbols and also
to be used to display compile-time warnings for usage of deprecated APIs,
which is like what is now being done in GLib (and GTK+, Clutter, and so
on).

This marks the first step that we begin to stop depending on the .symbols/
.def files to export the symbols.

https://bugzilla.gnome.org/show_bug.cgi?id=732669
2014-08-15 09:45:41 +08:00
Dieter Verfaillie
bb7f8d57c2 docs: fix up reference docs a bit
- require GTK-Doc 1.19
      - remove sgml mode
      - automatically generate gi.types (needs GTK-Doc 1.19)
      - fix https://bugzilla.gnome.org/show_bug.cgi?id=700025
[WIP] - rearange sections a bit
[WIP] - add gi-building, gi-programming sections
[WIP] - mark missing docs with TODO, which is only marginaly
        better than nothing but at least can be grepped :)

https://bugzilla.gnome.org/show_bug.cgi?id=571648
2013-10-10 16:48:51 -04:00
Colin Walters
e865dcb7b4 Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
Johan Dahlin
c223abfa36 [girepository] Move the rest out of ginfo.ch 2010-06-06 19:54:53 -03:00