Blame docs/reference/gobject/html/gtype-non-instantiable.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Non-instantiable non-classed fundamental types: GObject Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GObject Reference Manual">
Packit ae235b
<link rel="up" href="chapter-gtype.html" title="The GLib Dynamic Type System">
Packit ae235b
<link rel="prev" href="gtype-conventions.html" title="Conventions">
Packit ae235b
<link rel="next" href="gtype-instantiable-classed.html" title="Instantiable classed types: objects">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Non-instantiable non-classed fundamental types
Packit ae235b

Packit ae235b
          A lot of types are not instantiable by the type system and do not have
Packit ae235b
          a class. Most of these types are fundamental trivial types such as gchar, 
Packit ae235b
          and are already registered by GLib.
Packit ae235b
        

Packit ae235b

Packit ae235b
          In the rare case of needing to register such a type in the type
Packit ae235b
          system, fill a
Packit ae235b
          GTypeInfo structure with zeros since these types are also most of the time
Packit ae235b
          fundamental:
Packit ae235b
          

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
3
Packit ae235b
4
Packit ae235b
5
Packit ae235b
6
Packit ae235b
7
Packit ae235b
8
Packit ae235b
9
Packit ae235b
10
Packit ae235b
11
Packit ae235b
12
Packit ae235b
13
Packit ae235b
14
Packit ae235b
15
Packit ae235b
16
Packit ae235b
17
Packit ae235b
18
Packit ae235b
19
Packit ae235b
20
Packit ae235b
21
Packit ae235b
22
Packit ae235b
23
Packit ae235b
24
Packit ae235b
        
GTypeInfo info = {
Packit ae235b
  0,                                /* class_size */
Packit ae235b
  NULL,                        /* base_init */
Packit ae235b
  NULL,                        /* base_destroy */
Packit ae235b
  NULL,                        /* class_init */
Packit ae235b
  NULL,                        /* class_destroy */
Packit ae235b
  NULL,                        /* class_data */
Packit ae235b
  0,                                /* instance_size */
Packit ae235b
  0,                                /* n_preallocs */
Packit ae235b
  NULL,                        /* instance_init */
Packit ae235b
  NULL,                        /* value_table */
Packit ae235b
};
Packit ae235b
static const GTypeValueTable value_table = {
Packit ae235b
  value_init_long0,                /* value_init */
Packit ae235b
  NULL,                        /* value_free */
Packit ae235b
  value_copy_long0,                /* value_copy */
Packit ae235b
  NULL,                        /* value_peek_pointer */
Packit ae235b
  "i",                        /* collect_format */
Packit ae235b
  value_collect_int,        /* collect_value */
Packit ae235b
  "p",                        /* lcopy_format */
Packit ae235b
  value_lcopy_char,                /* lcopy_value */
Packit ae235b
};
Packit ae235b
info.value_table = &value_table;
Packit ae235b
type = g_type_register_fundamental (G_TYPE_CHAR, "gchar", &info, &finfo, 0);
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
        

Packit ae235b

Packit ae235b
          Having non-instantiable types might seem a bit useless: what good is a type
Packit ae235b
          if you cannot instantiate an instance of that type ? Most of these types
Packit ae235b
          are used in conjunction with GValues: a GValue is initialized
Packit ae235b
          with an integer or a string and it is passed around by using the registered 
Packit ae235b
          type's value_table. GValues (and by extension these trivial fundamental
Packit ae235b
          types) are most useful when used in conjunction with object properties and signals.
Packit ae235b
        

Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>