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
Content:
Static methods:
Creation methods:
Methods:
public unowned ParamSpec @ref ()
Increments the reference count of this .
public virtual void finalize ()
The instance finalization function (optional), should chain up to the
finalize method of the parent class.
public unowned string get_blurb ()
Get the short description of a ParamSpec .
public unowned Value ? get_default_value ()
Gets the default value of this as a
pointer to a Value .
public unowned string get_name ()
Get the name of a ParamSpec .
public Quark get_name_quark ()
Gets the GQuark for the name.
public unowned string get_nick ()
Get the nickname of a ParamSpec .
public void * get_qdata (Quark quark)
Gets back user data pointers stored via
set_qdata .
public unowned ParamSpec get_redirect_target ()
If the paramspec redirects operations to another paramspec, returns that
paramspec.
public unowned ParamSpec ref_sink ()
Convenience function to ref and sink a ParamSpec .
public void set_qdata (Quark quark, void * data)
Sets an opaque, named pointer on a ParamSpec .
public void set_qdata_full (Quark quark, void * data, DestroyNotify destroy)
This function works like
set_qdata , but in addition, a `void (*destroy) (gpointer)` function
may be specified which is called with data
as argument when the this is finalized, or the
data is being overwritten by a call to set_qdata with the same
quark
.
public void set_value_default (ref Value value)
Sets value
to its default value as specified in pspec
.
public void sink ()
The initial reference count of a newly created ParamSpec
is 1, even though no one has explicitly called @ref on it yet.
public void * steal_qdata (Quark quark)
Gets back user data pointers stored via
set_qdata and removes the data
from
this without invoking its destroy
function (if any was set).
public void unref ()
Decrements the reference count of a this .
public bool value_convert (Value src_value, ref Value dest_value, bool strict_validation)
Transforms src_value
into dest_value
if possible,
and then validates dest_value
, in order for it to conform to pspec
.
public virtual bool value_defaults (Value value)
Checks whether value
contains the default value as specified in
pspec
.
public bool value_is_valid (Value value)
Return whether the contents of value
comply with the
specifications set out by pspec
.
public virtual bool value_validate (Value value)
Ensures that the contents of value
comply with the
specifications set out by pspec
.
public virtual int values_cmp (Value value1, Value value2)
Compares value1
with value2
according to
pspec
, and return -1, 0 or +1, if value1
is found to be less than, equal to or greater than value2
,
respectively.
Fields: