@c -*-texinfo-*-
@c This is part of the GNU G-Golf Reference Manual.
@c Copyright (C) 2019 - 2022 Free Software Foundation, Inc.
@c See the file g-golf.texi for copying conditions.


@c @defindex ei


@node Struct Info
@subsection Struct Info

G-Golf Struct Info low level API.@*
GIStructInfo — Structs representing a C structure.


@subheading Procedures

@indentedblock
@table @code
@item @ref{gi-struct-import}
@item @ref{gi-struct-field-desc}
@item @ref{gi-struct-field-types}
@item @ref{g-struct-info-get-alignment}
@item @ref{g-struct-info-get-size}
@item @ref{g-struct-info-is-gtype-struct}
@item @ref{g-struct-info-is-foreign}
@item @ref{g-struct-info-get-n-fields}
@item @ref{g-struct-info-get-field}
@item @ref{g-struct-info-get-n-methods}
@item @ref{g-struct-info-get-method}
@end table
@end indentedblock


@c @subheading Types and Values

@c @indentedblock
@c @table @code
@c @item @ref{%g-arg-info-transfer}
@c @end table
@c @end indentedblock


@subheading Struct Hierarchy

@indentedblock
GIBaseInfo           	       		@*
@ @ +--- GIRegisteredTypeInfo  		@*
@ @ @ @ @ @ @ @ @ @ @  +--- GIStructInfo
@end indentedblock


@subheading Description

@code{GIStructInfo} represents a generic C strucuture type.

A structure has methods and fields.


@subheading Procedures

Note: in this section, unless otherwise specified, the @var{info}
argument is [must be] a pointer to a @code{GIStructInfo}.


@anchor{gi-struct-import}
@deffn Procedure gi-struct-import info

Returns a @code{<gi-struct>} instance.

Obtains the list of (field) types the C struct GI definition pointed by
@var{info} contains, then makes and returns a @code{<gi-struct>}
instance.
@end deffn


@anchor{gi-struct-field-desc}
@deffn Procedure gi-struct-field-desc info

Returns a list.

Obtains and returns the list of (field) descriptions for @var{info}. A
field description is a list: @code{(name type-tag offset flags)}.
@end deffn


@anchor{gi-struct-field-types}
@deffn Procedure gi-struct-field-types info

Returns a list.

Obtains and returns the list of (field) types the C struct GI definition
pointed by @var{info} contains.
@end deffn


@anchor{g-struct-info-get-alignment}
@deffn Procedure g-struct-info-get-alignment info

Returns an integer.

Obtains and returns the required alignment for @var{info}.
@end deffn


@anchor{g-struct-info-get-size}
@deffn Procedure g-struct-info-get-size info

Returns an integer.

Obtains and returns the total size of the structure specified
@var{info}.
@end deffn


@anchor{g-struct-info-is-gtype-struct}
@deffn Procedure g-struct-info-is-gtype-struct info

Returns #t or #f.

Return true if the structure specified by @var{info} represents the
"class structure" for some GObject or GInterface.
@end deffn


@anchor{g-struct-info-is-foreign}
@deffn Procedure g-struct-info-is-foreign info

Returns #t or #f.

FIXME. No upstream documentation, though the procedure works.
@end deffn


@anchor{g-struct-info-get-n-fields}
@deffn Procedure g-struct-info-get-n-fields info

Returns an integer.

Obtains the number of fields for @var{info}.
@end deffn


@anchor{g-struct-info-get-field}
@deffn Procedure g-struct-info-get-field info n

Returns a pointer.

Obtains and returns the @var{info} type information (a pointer to a
@code{GIFieldInfo}) for the field at the specified @var{n} index.

The @code{GIFieldInfo} must be freed by calling @ref{g-base-info-unref}
when done.
@end deffn


@anchor{g-struct-info-get-n-methods}
@deffn Procedure g-struct-info-get-n-methods info

Returns an integer.

Obtains the number of methods for @var{info}.
@end deffn


@anchor{g-struct-info-get-method}
@deffn Procedure g-struct-info-get-method info n

Returns a pointer.

Obtains and returns the @var{info} type information (a pointer to a
@code{GIFunctionInfo}) for the method at the specified @var{n} index.

The @code{GIFunctionInfo} must be freed by calling
@ref{g-base-info-unref} when done.
@end deffn
