mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
gobject: Standardise on the term ‘instantiatable’
Rather than using a mixture of ‘instantiable’ and ‘instantiatable’ everywhere, standardise on the term which is already in the public API. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
86b910e6b1
commit
4f2b1e250d
@ -90,7 +90,7 @@
|
|||||||
When generating C code, a
|
When generating C code, a
|
||||||
#GInterface<!-- -->-derived type is generated for each D-Bus
|
#GInterface<!-- -->-derived type is generated for each D-Bus
|
||||||
interface. Additionally, for every generated type,
|
interface. Additionally, for every generated type,
|
||||||
<type>FooBar</type>, two concrete instantiable types,
|
<type>FooBar</type>, two concrete instantiatable types,
|
||||||
<type>FooBarProxy</type> and <type>FooBarSkeleton</type>, implementing
|
<type>FooBarProxy</type> and <type>FooBarSkeleton</type>, implementing
|
||||||
said interface are also generated. The former is derived from
|
said interface are also generated. The former is derived from
|
||||||
#GDBusProxy and intended for use on the client side
|
#GDBusProxy and intended for use on the client side
|
||||||
@ -771,7 +771,7 @@ gdbus-codegen --generate-c-code myapp-generated \
|
|||||||
<filename>myapp-generated.[ch]</filename> are
|
<filename>myapp-generated.[ch]</filename> are
|
||||||
generated. The files provide an abstract
|
generated. The files provide an abstract
|
||||||
#GTypeInterface<!-- -->-derived type called
|
#GTypeInterface<!-- -->-derived type called
|
||||||
<type>MyAppFrobber</type> as well as two instantiable types with
|
<type>MyAppFrobber</type> as well as two instantiatable types with
|
||||||
the same name but suffixed with <type>Proxy</type> and
|
the same name but suffixed with <type>Proxy</type> and
|
||||||
<type>Skeleton</type>. The generated file, roughly, contains the
|
<type>Skeleton</type>. The generated file, roughly, contains the
|
||||||
following facilities:
|
following facilities:
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<link linkend="GObject"><type>GObject</type></link> is a fundamental classed instantiable type. It implements:
|
<link linkend="GObject"><type>GObject</type></link> is a fundamental classed instantiatable type. It implements:
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>Memory management with reference counting</para></listitem>
|
<listitem><para>Memory management with reference counting</para></listitem>
|
||||||
<listitem><para>Construction/Destruction of instances</para></listitem>
|
<listitem><para>Construction/Destruction of instances</para></listitem>
|
||||||
@ -293,8 +293,8 @@ ViewerFile *file = g_object_new (VIEWER_TYPE_FILE, NULL);
|
|||||||
one of the <function>g_type_register_*</function> functions), the object's instance
|
one of the <function>g_type_register_*</function> functions), the object's instance
|
||||||
memory will be freed or returned to the object pool for this type.
|
memory will be freed or returned to the object pool for this type.
|
||||||
Once the object has been freed, if it was the last instance of the type, the type's class
|
Once the object has been freed, if it was the last instance of the type, the type's class
|
||||||
will be destroyed as described in <xref linkend="gtype-instantiable-classed"/> and
|
will be destroyed as described in <xref linkend="gtype-instantiatable-classed"/> and
|
||||||
<xref linkend="gtype-non-instantiable-classed"/>.
|
<xref linkend="gtype-non-instantiatable-classed"/>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -108,7 +108,7 @@ GType g_type_register_fundamental (GType type_id,
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The major common point between <emphasis>all</emphasis> GLib types (fundamental and
|
The major common point between <emphasis>all</emphasis> GLib types (fundamental and
|
||||||
non-fundamental, classed and non-classed, instantiable and non-instantiable) is that
|
non-fundamental, classed and non-classed, instantiatable and non-instantiatable) is that
|
||||||
they can all be manipulated through a single API to copy/assign them.
|
they can all be manipulated through a single API to copy/assign them.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@ -300,11 +300,11 @@ GType viewer_file_get_type (void)
|
|||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="gtype-non-instantiable">
|
<sect1 id="gtype-non-instantiatable">
|
||||||
<title>Non-instantiable non-classed fundamental types</title>
|
<title>Non-instantiatable non-classed fundamental types</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
A lot of types are not instantiable by the type system and do not have
|
A lot of types are not instantiatable by the type system and do not have
|
||||||
a class. Most of these types are fundamental trivial types such as <emphasis>gchar</emphasis>,
|
a class. Most of these types are fundamental trivial types such as <emphasis>gchar</emphasis>,
|
||||||
and are already registered by GLib.
|
and are already registered by GLib.
|
||||||
</para>
|
</para>
|
||||||
@ -344,7 +344,7 @@ GType viewer_file_get_type (void)
|
|||||||
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Having non-instantiable types might seem a bit useless: what good is a type
|
Having non-instantiatable types might seem a bit useless: what good is a type
|
||||||
if you cannot instantiate an instance of that type ? Most of these types
|
if you cannot instantiate an instance of that type ? Most of these types
|
||||||
are used in conjunction with <link linkend="GValue"><type>GValue</type></link>s: a GValue is initialized
|
are used in conjunction with <link linkend="GValue"><type>GValue</type></link>s: a GValue is initialized
|
||||||
with an integer or a string and it is passed around by using the registered
|
with an integer or a string and it is passed around by using the registered
|
||||||
@ -354,8 +354,8 @@ GType viewer_file_get_type (void)
|
|||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="gtype-instantiable-classed">
|
<sect1 id="gtype-instantiatable-classed">
|
||||||
<title>Instantiable classed types: objects</title>
|
<title>Instantiatable classed types: objects</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This section covers the theory behind objects. See
|
This section covers the theory behind objects. See
|
||||||
@ -364,10 +364,10 @@ GType viewer_file_get_type (void)
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Types which are registered with a class and are declared instantiable are
|
Types which are registered with a class and are declared instantiatable are
|
||||||
what most closely resembles an <emphasis>object</emphasis>.
|
what most closely resembles an <emphasis>object</emphasis>.
|
||||||
Although <link linkend="GObject"><type>GObject</type></link>s (detailed in <xref linkend="chapter-gobject"/>)
|
Although <link linkend="GObject"><type>GObject</type></link>s (detailed in <xref linkend="chapter-gobject"/>)
|
||||||
are the most well known type of instantiable
|
are the most well known type of instantiatable
|
||||||
classed types, other kinds of similar objects used as the base of an inheritance
|
classed types, other kinds of similar objects used as the base of an inheritance
|
||||||
hierarchy have been externally developed and they are all built on the fundamental
|
hierarchy have been externally developed and they are all built on the fundamental
|
||||||
features described below.
|
features described below.
|
||||||
@ -498,7 +498,7 @@ B *b;
|
|||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="gtype-instantiable-classed-init-done">
|
<sect2 id="gtype-instantiatable-classed-init-done">
|
||||||
<title>Initialization and Destruction</title>
|
<title>Initialization and Destruction</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -599,7 +599,7 @@ B *b;
|
|||||||
<row>
|
<row>
|
||||||
<!--entry>First call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry-->
|
<!--entry>First call to <function><link linkend="g-type-create-instance">g_type_create_instance</link></function> for target type</entry-->
|
||||||
<entry>interface initialization, see
|
<entry>interface initialization, see
|
||||||
<xref linkend="gtype-non-instantiable-classed-init"/></entry>
|
<xref linkend="gtype-non-instantiatable-classed-init"/></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -610,7 +610,7 @@ B *b;
|
|||||||
<row>
|
<row>
|
||||||
<entry morerows="2">Last call to <function><link linkend="g-type-free-instance">g_type_free_instance</link></function> for target type</entry>
|
<entry morerows="2">Last call to <function><link linkend="g-type-free-instance">g_type_free_instance</link></function> for target type</entry>
|
||||||
<entry>interface destruction, see
|
<entry>interface destruction, see
|
||||||
<xref linkend="gtype-non-instantiable-classed-dest"/></entry>
|
<xref linkend="gtype-non-instantiatable-classed-dest"/></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -633,8 +633,8 @@ B *b;
|
|||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="gtype-non-instantiable-classed">
|
<sect1 id="gtype-non-instantiatable-classed">
|
||||||
<title>Non-instantiable classed types: interfaces</title>
|
<title>Non-instantiatable classed types: interfaces</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This section covers the theory behind interfaces. See
|
This section covers the theory behind interfaces. See
|
||||||
@ -648,7 +648,7 @@ B *b;
|
|||||||
Imagine the play, pause and stop buttons on hi-fi equipment — those can
|
Imagine the play, pause and stop buttons on hi-fi equipment — those can
|
||||||
be seen as a playback interface. Once you know what they do, you can
|
be seen as a playback interface. Once you know what they do, you can
|
||||||
control your CD player, MP3 player or anything that uses these symbols.
|
control your CD player, MP3 player or anything that uses these symbols.
|
||||||
To declare an interface you have to register a non-instantiable
|
To declare an interface you have to register a non-instantiatable
|
||||||
classed type which derives from
|
classed type which derives from
|
||||||
<link linkend="GTypeInterface"><type>GTypeInterface</type></link>. The following piece of code declares such an interface.
|
<link linkend="GTypeInterface"><type>GTypeInterface</type></link>. The following piece of code declares such an interface.
|
||||||
<informalexample><programlisting>
|
<informalexample><programlisting>
|
||||||
@ -792,14 +792,14 @@ struct _GInterfaceInfo
|
|||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="gtype-non-instantiable-classed-init">
|
<sect2 id="gtype-non-instantiatable-classed-init">
|
||||||
<title>Interface Initialization</title>
|
<title>Interface Initialization</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
When an instantiable classed type which implements an interface
|
When an instantiatable classed type which implements an interface
|
||||||
(either directly or by inheriting an implementation from a superclass)
|
(either directly or by inheriting an implementation from a superclass)
|
||||||
is created for the first time, its class structure is initialized
|
is created for the first time, its class structure is initialized
|
||||||
following the process described in <xref linkend="gtype-instantiable-classed"/>.
|
following the process described in <xref linkend="gtype-instantiatable-classed"/>.
|
||||||
After that, the interface implementations associated with
|
After that, the interface implementations associated with
|
||||||
the type are initialized.
|
the type are initialized.
|
||||||
</para>
|
</para>
|
||||||
@ -937,11 +937,11 @@ viewer_editable_default_init (ViewerEditableInterface *iface)
|
|||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="gtype-non-instantiable-classed-dest">
|
<sect2 id="gtype-non-instantiatable-classed-dest">
|
||||||
<title>Interface Destruction</title>
|
<title>Interface Destruction</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
When the last instance of an instantiable type which registered
|
When the last instance of an instantiatable type which registered
|
||||||
an interface implementation is destroyed, the interface's
|
an interface implementation is destroyed, the interface's
|
||||||
implementations associated to the type are destroyed.
|
implementations associated to the type are destroyed.
|
||||||
</para>
|
</para>
|
||||||
@ -955,7 +955,7 @@ viewer_editable_default_init (ViewerEditableInterface *iface)
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
Again, it is important to understand, as in
|
Again, it is important to understand, as in
|
||||||
<xref linkend="gtype-non-instantiable-classed-init"/>,
|
<xref linkend="gtype-non-instantiatable-classed-init"/>,
|
||||||
that both <function>interface_finalize</function> and <function>base_finalize</function>
|
that both <function>interface_finalize</function> and <function>base_finalize</function>
|
||||||
are invoked exactly once for the destruction of each implementation of an interface. Thus,
|
are invoked exactly once for the destruction of each implementation of an interface. Thus,
|
||||||
if you were to use one of these functions, you would need to use a static integer variable
|
if you were to use one of these functions, you would need to use a static integer variable
|
||||||
|
@ -854,7 +854,7 @@ b_method_to_call (B *obj, gint some_param)
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The theory behind how GObject interfaces work is given in
|
The theory behind how GObject interfaces work is given in
|
||||||
<xref linkend="gtype-non-instantiable-classed"/>; this section covers how to
|
<xref linkend="gtype-non-instantiatable-classed"/>; this section covers how to
|
||||||
define and implement an interface.
|
define and implement an interface.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
* For a tutorial on implementing a new GObject class, see [How to define and
|
* For a tutorial on implementing a new GObject class, see [How to define and
|
||||||
* implement a new GObject][howto-gobject]. For a list of naming conventions for
|
* implement a new GObject][howto-gobject]. For a list of naming conventions for
|
||||||
* GObjects and their methods, see the [GType conventions][gtype-conventions].
|
* GObjects and their methods, see the [GType conventions][gtype-conventions].
|
||||||
* For the high-level concepts behind GObject, read [Instantiable classed types:
|
* For the high-level concepts behind GObject, read [Instantiatable classed types:
|
||||||
* Objects][gtype-instantiable-classed].
|
* Objects][gtype-instantiatable-classed].
|
||||||
*
|
*
|
||||||
* ## Floating references # {#floating-ref}
|
* ## Floating references # {#floating-ref}
|
||||||
*
|
*
|
||||||
|
@ -2121,7 +2121,7 @@ type_class_init_Wm (TypeNode *node,
|
|||||||
TypeNode *bnode, *pnode;
|
TypeNode *bnode, *pnode;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
/* Accessing data->class will work for instantiable types
|
/* Accessing data->class will work for instantiatable types
|
||||||
* too because ClassData is a subset of InstanceData
|
* too because ClassData is a subset of InstanceData
|
||||||
*/
|
*/
|
||||||
g_assert (node->is_classed && node->data &&
|
g_assert (node->is_classed && node->data &&
|
||||||
@ -2820,12 +2820,12 @@ g_type_register_dynamic (GType parent_type,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* g_type_add_interface_static:
|
* g_type_add_interface_static:
|
||||||
* @instance_type: #GType value of an instantiable type
|
* @instance_type: #GType value of an instantiatable type
|
||||||
* @interface_type: #GType value of an interface type
|
* @interface_type: #GType value of an interface type
|
||||||
* @info: #GInterfaceInfo structure for this
|
* @info: #GInterfaceInfo structure for this
|
||||||
* (@instance_type, @interface_type) combination
|
* (@instance_type, @interface_type) combination
|
||||||
*
|
*
|
||||||
* Adds @interface_type to the static @instantiable_type.
|
* Adds @interface_type to the static @instance_type.
|
||||||
* The information contained in the #GInterfaceInfo structure
|
* The information contained in the #GInterfaceInfo structure
|
||||||
* pointed to by @info is used to manage the relationship.
|
* pointed to by @info is used to manage the relationship.
|
||||||
*/
|
*/
|
||||||
@ -2857,11 +2857,11 @@ g_type_add_interface_static (GType instance_type,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* g_type_add_interface_dynamic:
|
* g_type_add_interface_dynamic:
|
||||||
* @instance_type: #GType value of an instantiable type
|
* @instance_type: #GType value of an instantiatable type
|
||||||
* @interface_type: #GType value of an interface type
|
* @interface_type: #GType value of an interface type
|
||||||
* @plugin: #GTypePlugin structure to retrieve the #GInterfaceInfo from
|
* @plugin: #GTypePlugin structure to retrieve the #GInterfaceInfo from
|
||||||
*
|
*
|
||||||
* Adds @interface_type to the dynamic @instantiable_type. The information
|
* Adds @interface_type to the dynamic @instance_type. The information
|
||||||
* contained in the #GTypePlugin structure pointed to by @plugin
|
* contained in the #GTypePlugin structure pointed to by @plugin
|
||||||
* is used to manage the relationship.
|
* is used to manage the relationship.
|
||||||
*/
|
*/
|
||||||
|
@ -981,7 +981,7 @@ typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data,
|
|||||||
/**
|
/**
|
||||||
* GTypeFundamentalFlags:
|
* GTypeFundamentalFlags:
|
||||||
* @G_TYPE_FLAG_CLASSED: Indicates a classed type
|
* @G_TYPE_FLAG_CLASSED: Indicates a classed type
|
||||||
* @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiable type (implies classed)
|
* @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiatable type (implies classed)
|
||||||
* @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type
|
* @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type
|
||||||
* @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable)
|
* @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable)
|
||||||
*
|
*
|
||||||
|
@ -167,7 +167,7 @@ g_type_plugin_complete_type_info (GTypePlugin *plugin,
|
|||||||
/**
|
/**
|
||||||
* g_type_plugin_complete_interface_info:
|
* g_type_plugin_complete_interface_info:
|
||||||
* @plugin: the #GTypePlugin
|
* @plugin: the #GTypePlugin
|
||||||
* @instance_type: the #GType of an instantiable type to which the interface
|
* @instance_type: the #GType of an instantiatable type to which the interface
|
||||||
* is added
|
* is added
|
||||||
* @interface_type: the #GType of the interface whose info is completed
|
* @interface_type: the #GType of the interface whose info is completed
|
||||||
* @info: the #GInterfaceInfo to fill in
|
* @info: the #GInterfaceInfo to fill in
|
||||||
|
@ -67,7 +67,7 @@ typedef void (*GTypePluginCompleteTypeInfo) (GTypePlugin *plugin,
|
|||||||
/**
|
/**
|
||||||
* GTypePluginCompleteInterfaceInfo:
|
* GTypePluginCompleteInterfaceInfo:
|
||||||
* @plugin: the #GTypePlugin
|
* @plugin: the #GTypePlugin
|
||||||
* @instance_type: the #GType of an instantiable type to which the interface
|
* @instance_type: the #GType of an instantiatable type to which the interface
|
||||||
* is added
|
* is added
|
||||||
* @interface_type: the #GType of the interface whose info is completed
|
* @interface_type: the #GType of the interface whose info is completed
|
||||||
* @info: the #GInterfaceInfo to fill in
|
* @info: the #GInterfaceInfo to fill in
|
||||||
|
Loading…
Reference in New Issue
Block a user