docs: Move boxed type documentation to Markdown

And add some additional new content and examples.

Helps: #3037
This commit is contained in:
Matthias Clasen
2023-10-09 23:16:13 +01:00
committed by Philip Withnall
parent 1a090564d2
commit 24e93078d3
4 changed files with 115 additions and 29 deletions

View File

@@ -33,35 +33,6 @@
#include "gvaluearray.h"
#include "gvaluecollector.h"
/**
* SECTION:gboxed
* @short_description: A mechanism to wrap opaque C structures registered
* by the type system
* @see_also: #GParamSpecBoxed, g_param_spec_boxed()
* @title: Boxed Types
*
* #GBoxed is a generic wrapper mechanism for arbitrary C structures.
*
* The only thing the type system needs to know about the structures is how to
* copy them (a #GBoxedCopyFunc) and how to free them (a #GBoxedFreeFunc);
* beyond that, they are treated as opaque chunks of memory.
*
* Boxed types are useful for simple value-holder structures like rectangles or
* points. They can also be used for wrapping structures defined in non-#GObject
* based libraries. They allow arbitrary structures to be handled in a uniform
* way, allowing uniform copying (or referencing) and freeing (or unreferencing)
* of them, and uniform representation of the type of the contained structure.
* In turn, this allows any type which can be boxed to be set as the data in a
* #GValue, which allows for polymorphic handling of a much wider range of data
* types, and hence usage of such types as #GObject property values.
*
* #GBoxed is designed so that reference counted types can be boxed. Use the
* types ref function as the #GBoxedCopyFunc, and its unref function as the
* #GBoxedFreeFunc. For example, for #GBytes, the #GBoxedCopyFunc is
* g_bytes_ref(), and the #GBoxedFreeFunc is g_bytes_unref().
*/
static inline void /* keep this function in sync with gvalue.c */
value_meminit (GValue *value,
GType value_type)