## GIFieldInfo GIFieldInfo — Struct representing a struct or union field |

## Functions

#define | GI_IS_FIELD_INFO()
gboolean | g_field_info_get_field ()
gboolean | g_field_info_set_field ()
GIFieldInfoFlags | g_field_info_get_flags ()
gint | g_field_info_get_offset ()
gint | g_field_info_get_size ()
GITypeInfo * | g_field_info_get_type ()

## Types and Values

typedef | GIFieldInfo
enum | GIFieldInfoFlags

## Description

A GIFieldInfo struct represents a field of a struct (see GIStructInfo), union (see GIUnionInfo) or an object (see GIObjectInfo). The GIFieldInfo is fetched by calling `g_struct_info_get_field()`, `g_union_info_get_field()` or `g_object_info_get_field()`. A field has a size, type and a struct offset asssociated and a set of flags, which is currently GI_FIELD_IS_READABLE or GI_FIELD_IS_WRITABLE.

## Struct hierarchy

      GIBaseInfo
       +----GIFieldInfo

## Functions

### GI_IS_FIELD_INFO()

    #define             GI_IS_FIELD_INFO(info)

Checks if `info` is a GIFieldInfo.

#### Parameters

info | an info structure |

### g_field_info_get_field ()

    gboolean
    g_field_info_get_field (GIFieldInfo *field_info,
                            gpointer mem,
                            GIArgument *value);

Reads a field identified by a GIFieldInfo from a C structure or union. This only handles fields of simple C types. It will fail for a field of a composite type like a nested structure or union even if that is actually readable.

[skip]

#### Parameters

field_info | a GIFieldInfo |
mem | pointer to a block of memory representing a C structure or union |
value | a GIArgument into which to store the value retrieved |

#### Returns

`TRUE` if reading the field succeeded, otherwise `FALSE`

### g_field_info_set_field ()

    gboolean
    g_field_info_set_field (GIFieldInfo *field_info,
                            gpointer mem,
                            const GIArgument *value);

Writes a field identified by a GIFieldInfo to a C structure or union. This only handles fields of simple C types. It will fail for a field of a composite type like a nested structure or union even if that is actually writable. Note also that that it will refuse to write fields where memory management would by required. A field with a type such as 'char *' must be set with a setter function.

[skip]

#### Parameters

field_info | a GIFieldInfo |
mem | pointer to a block of memory representing a C structure or union |
value | a GIArgument holding the value to store |

#### Returns

`TRUE` if writing the field succeeded, otherwise `FALSE`

### g_field_info_get_flags ()

    GIFieldInfoFlags
    g_field_info_get_flags (GIFieldInfo *info);

Obtain the flags for this GIFieldInfo. See GIFieldInfoFlags for possible flag values.

#### Parameters

info | a GIFieldInfo |

#### Returns

the flags

### g_field_info_get_offset ()

    gint
    g_field_info_get_offset (GIFieldInfo *info);

Obtain the offset in bits of the field member, this is relative to the beginning of the struct or union.

#### Parameters

info | a GIFieldInfo |

#### Returns

the field offset

### g_field_info_get_size ()

    gint
    g_field_info_get_size (GIFieldInfo *info);

Obtain the size in bits of the field member, this is how much space you need to allocate to store the field.

#### Parameters

info | a GIFieldInfo |

#### Returns

the field size

### g_field_info_get_type ()

    GITypeInfo *
    g_field_info_get_type (GIFieldInfo *info);

Obtain the type of a field as a GITypeInfo.

#### Parameters

info | a GIFieldInfo |

#### Returns

the GITypeInfo. Free the struct by calling `g_base_info_unref()` when done.

[transfer full]

## Types and Values

### GIFieldInfo

Represents a field of a GIStructInfo or a GIUnionInfo.

### enum GIFieldInfoFlags

Flags for a GIFieldInfo.

#### Members

GI_FIELD_IS_READABLE | field is readable. |
GI_FIELD_IS_WRITABLE | field is writable. |