ParamSpec


Object Hierarchy:

GLib.ParamSpec GLib.ParamSpec GLib.ParamSpec

Description:

[ CCode ( get_value_function = "g_value_get_param" , param_spec_function = "g_param_spec_param" , ref_function = "g_param_spec_ref" , set_value_function = "g_value_set_param" , take_value_function = "g_value_take_param" , type_id = "G_TYPE_PARAM" , unref_function = "g_param_spec_unref" ) ]
public class ParamSpec

`GParamSpec` encapsulates the metadata required to specify parameters, such as `GObject` properties.

Parameter names

A property name consists of one or more segments consisting of ASCII letters and digits, separated by either the `-` or `_` character. The first character of a property name must be a letter. These are the same rules as for signal naming (see [func@GObject.signal_new]).

When creating and looking up a `GParamSpec`, either separator can be used, but they cannot be mixed. Using `-` is considerably more efficient, and is the ‘canonical form’. Using `_` is discouraged.

Example: Object-introspection:

public class MyObject : Object {
public int myprop1 { get; set; }
public int myprop2 { get; set; }
public int myprop3 { get; set; }
}

public static int main (string[] args) {
// Output:
// ``myprop1``
// ``myprop2``
// ``myprop3``
Type type = typeof (MyObject);
ObjectClass ocl = (ObjectClass) type.class_ref ();
foreach (ParamSpec spec in ocl.list_properties ()) {
print ("%s\n", spec.get_name ());
}

// Output: ``nick: myprop1``
unowned ParamSpec? spec = ocl.find_property ("myprop1");
print ("nick: %s\n", spec.get_nick ());

return 0;
}

valac --pkg gobject-2.0 GLib.ObjectClass.vala


Namespace: GLib
Package: gobject-2.0

Content:

Static methods:

Creation methods:

Methods:

Fields: