## GITypeInfo

GITypeInfo — Struct representing a type

## Synopsis

    #define             GI_IS_TYPE_INFO                     (info)
    enum                GIArrayType;
    typedef             GITypeInfo;
    enum                GITypeTag;
    #define             G_TYPE_TAG_IS_BASIC                 (tag)
    const gchar *       g_type_tag_to_string                (GITypeTag type);
    gboolean            g_type_info_is_pointer              (GITypeInfo *info);
    GITypeTag           g_type_info_get_tag                 (GITypeInfo *info);
    GITypeInfo *        g_type_info_get_param_type          (GITypeInfo *info,
                                                             gint n);
    GIBaseInfo *        g_type_info_get_interface           (GITypeInfo *info);
    gint                g_type_info_get_array_length        (GITypeInfo *info);
    gint                g_type_info_get_array_fixed_size    (GITypeInfo *info);
    gboolean            g_type_info_is_zero_terminated      (GITypeInfo *info);
    GIArrayType         g_type_info_get_array_type          (GITypeInfo *info);

## Description

GITypeInfo represents a type. You can retrieve a type info from an argument (see GIArgInfo), a functions return value (see GIFunctionInfo), a field (see GIFieldInfo), a property (see GIPropertyInfo), a constant (see GIConstantInfo) or for a union discriminator (see GIUnionInfo).

A type can either be a of a basic type which is a standard C primitive type or an interface type. For interface types you need to call `g_type_info_get_interface()` to get a reference to the base info for that interface.

## Struct hierarchy

      GIBaseInfo
       +----GITypeInfo

## Details

### GI_IS_TYPE_INFO()

    #define             GI_IS_TYPE_INFO(info)

### enum GIArrayType

    typedef enum {
      GI_ARRAY_TYPE_C,
      GI_ARRAY_TYPE_ARRAY,
      GI_ARRAY_TYPE_PTR_ARRAY,
      GI_ARRAY_TYPE_BYTE_ARRAY
    } GIArrayType;

The type of array in a GITypeInfo.

`GI_ARRAY_TYPE_C` | a C array, char[] for instance
`GI_ARRAY_TYPE_ARRAY` | a `GArray` array
`GI_ARRAY_TYPE_PTR_ARRAY` | a GPtrArray array
`GI_ARRAY_TYPE_BYTE_ARRAY` | a GByteArray array

### GITypeInfo

    typedef GIBaseInfo GITypeInfo;

Represents type information, direction, transfer etc.

### enum GITypeTag

    typedef enum {
      /* Basic types */
      GI_TYPE_TAG_VOID      =  0,
      GI_TYPE_TAG_BOOLEAN   =  1,
      GI_TYPE_TAG_INT8      =  2,
      GI_TYPE_TAG_UINT8     =  3,
      GI_TYPE_TAG_INT16     =  4,
      GI_TYPE_TAG_UINT16    =  5,
      GI_TYPE_TAG_INT32     =  6,
      GI_TYPE_TAG_UINT32    =  7,
      GI_TYPE_TAG_INT64     =  8,
      GI_TYPE_TAG_UINT64    =  9,
      GI_TYPE_TAG_FLOAT     = 10,
      GI_TYPE_TAG_DOUBLE    = 11,
      GI_TYPE_TAG_GTYPE     = 12,
      GI_TYPE_TAG_UTF8      = 13,
      GI_TYPE_TAG_FILENAME  = 14,
      /* Non-basic types; compare with G_TYPE_TAG_IS_BASIC */
      GI_TYPE_TAG_ARRAY     = 15,
      GI_TYPE_TAG_INTERFACE = 16,
      GI_TYPE_TAG_GLIST     = 17,
      GI_TYPE_TAG_GSLIST    = 18,
      GI_TYPE_TAG_GHASH     = 19,
      GI_TYPE_TAG_ERROR     = 20,
      /* Another basic type */
      GI_TYPE_TAG_UNICHAR   = 21
      /* Note - there is only room currently for 32 tags.
       * See docs/typelib-format.txt SimpleTypeBlob definition */
    } GITypeTag;

The type tag of a GITypeInfo.

`GI_TYPE_TAG_VOID` | void
`GI_TYPE_TAG_BOOLEAN` | boolean
`GI_TYPE_TAG_INT8` | 8-bit signed integer
`GI_TYPE_TAG_UINT8` | 8-bit unsigned integer
`GI_TYPE_TAG_INT16` | 16-bit signed integer
`GI_TYPE_TAG_UINT16` | 16-bit unsigned integer
`GI_TYPE_TAG_INT32` | 32-bit signed integer
`GI_TYPE_TAG_UINT32` | 32-bit unsigned integer
`GI_TYPE_TAG_INT64` | 64-bit signed integer
`GI_TYPE_TAG_UINT64` | 64-bit unsigned integer
`GI_TYPE_TAG_FLOAT` | float
`GI_TYPE_TAG_DOUBLE` | double floating point
`GI_TYPE_TAG_GTYPE` | a GType
`GI_TYPE_TAG_UTF8` | a UTF-8 encoded string
`GI_TYPE_TAG_FILENAME` | a filename, encoded in the same encoding as the native filesystem is using.
`GI_TYPE_TAG_ARRAY` | an array
`GI_TYPE_TAG_INTERFACE` | an extended interface object
`GI_TYPE_TAG_GLIST` | a GList
`GI_TYPE_TAG_GSLIST` | a GSList
`GI_TYPE_TAG_GHASH` | a GHashTable
`GI_TYPE_TAG_ERROR` | a GError
`GI_TYPE_TAG_UNICHAR` | Unicode character

### G_TYPE_TAG_IS_BASIC()

    #define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY || tag == GI_TYPE_TAG_UNICHAR)

### g_type_tag_to_string ()

    const gchar *       g_type_tag_to_string                (GITypeTag type);

Obtain a string representation of `type`

`type` : | the type_tag
Returns : | the string

### g_type_info_is_pointer ()

    gboolean            g_type_info_is_pointer              (GITypeInfo *info);

Obtain if the type is passed as a reference.

`info` : | a GITypeInfo
Returns : | `TRUE` if it is a pointer

### g_type_info_get_tag ()

    GITypeTag           g_type_info_get_tag                 (GITypeInfo *info);

Obtain the type tag for the type. See GITypeTag for a list of type tags.

`info` : | a GITypeInfo
Returns : | the type tag

### g_type_info_get_param_type ()

    GITypeInfo *        g_type_info_get_param_type          (GITypeInfo *info,
                                                             gint n);

Obtain the parameter type `n`.

`info` : | a GITypeInfo
`n` : | index of the parameter
Returns : | the param type info. [transfer full]

### g_type_info_get_interface ()

    GIBaseInfo *        g_type_info_get_interface           (GITypeInfo *info);

For types which have GI_TYPE_TAG_INTERFACE such as GObjects and boxed values, this function returns full information about the referenced type. You can then inspect the type of the returned GIBaseInfo to further query whether it is a concrete GObject, a GInterface, a structure, etc. using `g_base_info_get_type()`.

`info` : | a GITypeInfo
Returns : | the GIBaseInfo, or `NULL`. Free it with `g_base_info_unref()` when done. [transfer full]

### g_type_info_get_array_length ()

    gint                g_type_info_get_array_length        (GITypeInfo *info);

Obtain the array length of the type. The type tag must be a GI_TYPE_TAG_ARRAY or -1 will returned.

`info` : | a GITypeInfo
Returns : | the array length, or -1 if the type is not an array

### g_type_info_get_array_fixed_size ()

    gint                g_type_info_get_array_fixed_size    (GITypeInfo *info);

Obtain the fixed array size of the type. The type tag must be a GI_TYPE_TAG_ARRAY or -1 will returned.

`info` : | a GITypeInfo
Returns : | the size or -1 if it's not an array

### g_type_info_is_zero_terminated ()

    gboolean            g_type_info_is_zero_terminated      (GITypeInfo *info);

Obtain if the last element of the array is `NULL`. The type tag must be a GI_TYPE_TAG_ARRAY or `FALSE` will returned.

`info` : | a GITypeInfo
Returns : | `TRUE` if zero terminated

### g_type_info_get_array_type ()

    GIArrayType         g_type_info_get_array_type          (GITypeInfo *info);

Obtain the array type for this type. See GIArrayType for a list of possible values. If the type tag of this type is not array, -1 will be returned.

`info` : | a GITypeInfo
Returns : | the array type or -1