mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Add a boxed type for nul-terminated string arrays. (#110528)
Fri Jan 9 23:41:00 2004 Matthias Clasen <maclas@gmx.de> * gboxed.h: * gboxed.c (g_strv_get_type): Add a boxed type for nul-terminated string arrays. (#110528)
This commit is contained in:
parent
ba482c66c3
commit
b4f769efaf
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jan 9 23:40:23 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gobject/tmpl/gboxed.sgml:
|
||||||
|
* gobject/gobject-sections.txt: Add G_TYPE_STRV and GStrv.
|
||||||
|
|
||||||
Fri Dec 26 02:04:49 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 26 02:04:49 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/glib-sections.txt: Add g_ptr_array_foreach().
|
* glib/glib-sections.txt: Add g_ptr_array_foreach().
|
||||||
|
@ -291,12 +291,15 @@ g_pointer_type_register_static
|
|||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
G_TYPE_GSTRING
|
G_TYPE_GSTRING
|
||||||
|
G_TYPE_STRV
|
||||||
|
GStrv
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
G_TYPE_IS_BOXED
|
G_TYPE_IS_BOXED
|
||||||
|
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
g_gstring_get_type
|
g_gstring_get_type
|
||||||
|
g_strv_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -82,3 +82,39 @@ The #GType for #GString.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO G_TYPE_STRV ##### -->
|
||||||
|
<para>
|
||||||
|
The #GType for a boxed type holding a %NULL-terminated array of strings.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The code fragments in the following example show the use of a property of
|
||||||
|
type #G_TYPE_STRV with g_object_class_install_property(), g_object_set()
|
||||||
|
and g_object_get().
|
||||||
|
</para>
|
||||||
|
<informalexample><programlisting>
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_AUTHORS,
|
||||||
|
g_param_spec_boxed ("authors",
|
||||||
|
_("Authors"),
|
||||||
|
_("List of authors"),
|
||||||
|
G_TYPE_STRV,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
|
||||||
|
gchar *authors[] = { "Owen", "Tim", NULL };
|
||||||
|
g_object_set (obj, "authors", authors, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
gchar *writers[];
|
||||||
|
g_object_get (obj, "authors", &writers, NULL);
|
||||||
|
/* do something with writers */
|
||||||
|
g_strfreev (writers);
|
||||||
|
</programlisting></informalexample>
|
||||||
|
|
||||||
|
@Since: 2.4
|
||||||
|
|
||||||
|
<!-- ##### TYPEDEF GStrv ##### -->
|
||||||
|
<para>
|
||||||
|
A C representable type name for #G_TYPE_STRV.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jan 9 23:41:00 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gboxed.h:
|
||||||
|
* gboxed.c (g_strv_get_type): Add a boxed type for nul-terminated
|
||||||
|
string arrays. (#110528)
|
||||||
|
|
||||||
Fri Jan 9 15:34:15 2004 Tim Janik <timj@gtk.org>
|
Fri Jan 9 15:34:15 2004 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gtype.h: added convenience macros G_IMPLEMENT_INTERFACE() and
|
* gtype.h: added convenience macros G_IMPLEMENT_INTERFACE() and
|
||||||
|
@ -170,6 +170,18 @@ g_value_array_get_type (void)
|
|||||||
return type_id;
|
return type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
g_strv_get_type (void)
|
||||||
|
{
|
||||||
|
static GType type_id = 0;
|
||||||
|
|
||||||
|
if (!type_id)
|
||||||
|
type_id = g_boxed_type_register_static ("GStrv",
|
||||||
|
(GBoxedCopyFunc) g_strdupv,
|
||||||
|
(GBoxedFreeFunc) g_strfreev);
|
||||||
|
return type_id;
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
g_gstring_get_type (void)
|
g_gstring_get_type (void)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@ GType g_boxed_type_register_static (const gchar *name,
|
|||||||
#define G_TYPE_CLOSURE (g_closure_get_type ())
|
#define G_TYPE_CLOSURE (g_closure_get_type ())
|
||||||
#define G_TYPE_VALUE (g_value_get_type ())
|
#define G_TYPE_VALUE (g_value_get_type ())
|
||||||
#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
|
#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
|
||||||
|
#define G_TYPE_STRV (g_strv_get_type ())
|
||||||
#define G_TYPE_GSTRING (g_gstring_get_type ())
|
#define G_TYPE_GSTRING (g_gstring_get_type ())
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +73,10 @@ void g_value_set_boxed_take_ownership (GValue *value,
|
|||||||
GType g_closure_get_type (void) G_GNUC_CONST;
|
GType g_closure_get_type (void) G_GNUC_CONST;
|
||||||
GType g_value_get_type (void) G_GNUC_CONST;
|
GType g_value_get_type (void) G_GNUC_CONST;
|
||||||
GType g_value_array_get_type (void) G_GNUC_CONST;
|
GType g_value_array_get_type (void) G_GNUC_CONST;
|
||||||
GType g_gstring_get_type (void) G_GNUC_CONST;
|
GType g_strv_get_type (void) G_GNUC_CONST;
|
||||||
|
GType g_gstring_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
typedef gchar** GStrv;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user