Skip to content
  • Emmanuele Bassi's avatar
    Add copy and free function annotations for POD types · e9e38661
    Emmanuele Bassi authored
    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: ...
         *
         *...
    e9e38661