query


Description:

public void query (out TypeQuery query)

Queries the type system for information about a specific type.

This function will fill in a user-provided structure to hold type-specific information. If an invalid Type is passed in, the type member of the TypeQuery is 0. All members filled into the TypeQuery structure should be considered constant and have to be left untouched.

Since GLib 2.78, this function allows queries on dynamic types. Previously it only supported static types.

Example: Query the type system for type-information:

public abstract class AbstractGObject : Object {
}

public static int main (string[] args) {
Type type = typeof (AbstractGObject);
TypeQuery query;

// Output:
// ``type: 156018024``
// ``name: AbstractGObject``
// ``class-size: 68``
// ``instance-size: 16``
type.query (out query);
print ("type: %s\n", query.type.to_string ());
print ("name: %s\n", query.type_name);
print ("class-size: %u\n", query.class_size);
print ("instance-size: %u\n", query.instance_size);

return 0;
}

valac --pkg gobject-2.0 GLib.Type.query.vala

Parameters:

query

a user provided structure that is filled in with constant values upon success

type

Type of a static, classed type