ParamSpecProtocol

public protocol ParamSpecProtocol

GParamSpec is an object structure that encapsulates the metadata required to specify parameters, such as e.g. 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 g_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.

The ParamSpecProtocol protocol exposes the methods and properties of an underlying GParamSpec instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see ParamSpec. Alternatively, use ParamSpecRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GParamSpec instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • param_spec_ptr Default implementation

    Typed pointer to the underlying GParamSpec instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GParamSpec instance.

    Declaration

    Swift

    var param_spec_ptr: UnsafeMutablePointer<GParamSpec>! { get }
  • Required Initialiser for types conforming to ParamSpecProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

ParamSpec Class: ParamSpecProtocol extension (methods and fields)

  • getBlurb() Extension method

    Get the short description of a GParamSpec.

    Declaration

    Swift

    @inlinable
    func getBlurb() -> String!
  • getDefaultValue() Extension method

    Gets the default value of pspec as a pointer to a GValue.

    The GValue will remain valid for the life of pspec.

    Declaration

    Swift

    @inlinable
    func getDefaultValue() -> GLibObject.ValueRef!
  • getName() Extension method

    Get the name of a GParamSpec.

    The name is always an “interned” string (as per g_intern_string()). This allows for pointer-value comparisons.

    Declaration

    Swift

    @inlinable
    func getName() -> String!
  • getNameQuark() Extension method

    Gets the GQuark for the name.

    Declaration

    Swift

    @inlinable
    func getNameQuark() -> GQuark
  • getNick() Extension method

    Get the nickname of a GParamSpec.

    Declaration

    Swift

    @inlinable
    func getNick() -> String!
  • getQdata(quark:) Extension method

    Gets back user data pointers stored via g_param_spec_set_qdata().

    Declaration

    Swift

    @inlinable
    func getQdata(quark: GQuark) -> gpointer?
  • getRedirectTarget() Extension method

    If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of type GParamSpecOverride. See g_object_class_override_property() for an example of the use of this capability.

    Declaration

    Swift

    @inlinable
    func getRedirectTarget() -> GLibObject.ParamSpecRef!
  • ref() Extension method

    Increments the reference count of pspec.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func ref() -> GLibObject.ParamSpecRef!
  • refSink() Extension method

    Convenience function to ref and sink a GParamSpec.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func refSink() -> GLibObject.ParamSpecRef!
  • setQdata(quark:data:) Extension method

    Sets an opaque, named pointer on a GParamSpec. The name is specified through a GQuark (retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the pspec with g_param_spec_get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, using nil as pointer essentially removes the data stored.

    Declaration

    Swift

    @inlinable
    func setQdata(quark: GQuark, data: gpointer? = nil)
  • This function works like g_param_spec_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the pspec is finalized, or the data is being overwritten by a call to g_param_spec_set_qdata() with the same quark.

    Declaration

    Swift

    @inlinable
    func setQdataFull(quark: GQuark, data: gpointer? = nil, destroy: GDestroyNotify? = nil)
  • sink() Extension method

    The initial reference count of a newly created GParamSpec is 1, even though no one has explicitly called g_param_spec_ref() on it yet. So the initial reference count is flagged as “floating”, until someone calls g_param_spec_ref (pspec); g_param_spec_sink (pspec); in sequence on it, taking over the initial reference count (thus ending up with a pspec that has a reference count of 1 still, but is not flagged “floating” anymore).

    Declaration

    Swift

    @inlinable
    func sink()
  • stealQdata(quark:) Extension method

    Gets back user data pointers stored via g_param_spec_set_qdata() and removes the data from pspec without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier.

    Declaration

    Swift

    @inlinable
    func stealQdata(quark: GQuark) -> gpointer?
  • unref() Extension method

    Decrements the reference count of a pspec.

    Declaration

    Swift

    @inlinable
    func unref()
  • paramSpecOverride(name:) Extension method

    Creates a new property of type GParamSpecOverride. This is used to direct operations to another paramspec, and will not be directly useful unless you are implementing a new base type similar to GObject.

    Declaration

    Swift

    @inlinable
    func paramSpecOverride(name: UnsafePointer<gchar>!) -> GLibObject.ParamSpecRef!
  • Creates a new GParamSpecValueArray instance specifying a G_TYPE_VALUE_ARRAY property. G_TYPE_VALUE_ARRAY is a G_TYPE_BOXED type, as such, GValue structures for this property can be accessed with g_value_set_boxed() and g_value_get_boxed().

    See g_param_spec_internal() for details on property names.

    Declaration

    Swift

    @inlinable
    func paramSpecValueArray(name: UnsafePointer<gchar>!, nick: UnsafePointer<gchar>!, blurb: UnsafePointer<gchar>!, flags: ParamFlags) -> GLibObject.ParamSpecRef!
  • Transforms src_value into dest_value if possible, and then validates dest_value, in order for it to conform to pspec. If strict_validation is true this function will only succeed if the transformed dest_value complied to pspec without modifications.

    See also g_value_type_transformable(), g_value_transform() and g_param_value_validate().

    Declaration

    Swift

    @inlinable
    func paramValueConvert<ValueT>(srcValue: ValueT, destValue: ValueT, strictValidation: Bool) -> Bool where ValueT : ValueProtocol
  • paramValueDefaults(value:) Extension method

    Checks whether value contains the default value as specified in pspec.

    Declaration

    Swift

    @inlinable
    func paramValueDefaults<ValueT>(value: ValueT) -> Bool where ValueT : ValueProtocol
  • paramValueSetDefault(value:) Extension method

    Sets value to its default value as specified in pspec.

    Declaration

    Swift

    @inlinable
    func paramValueSetDefault<ValueT>(value: ValueT) where ValueT : ValueProtocol
  • paramValueValidate(value:) Extension method

    Ensures that the contents of value comply with the specifications set out by pspec. For example, a GParamSpecInt might require that integers stored in value may not be smaller than -42 and not be greater than +42. If value contains an integer outside of this range, it is modified accordingly, so the resulting value will fit into the range -42 .. +42.

    Declaration

    Swift

    @inlinable
    func paramValueValidate<ValueT>(value: ValueT) -> Bool where ValueT : ValueProtocol
  • 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.

    Declaration

    Swift

    @inlinable
    func paramValuesCmp<ValueT>(value1: ValueT, value2: ValueT) -> Int where ValueT : ValueProtocol
  • blurb Extension method

    Get the short description of a GParamSpec.

    Declaration

    Swift

    @inlinable
    var blurb: String! { get }
  • defaultValue Extension method

    Gets the default value of pspec as a pointer to a GValue.

    The GValue will remain valid for the life of pspec.

    Declaration

    Swift

    @inlinable
    var defaultValue: GLibObject.ValueRef! { get }
  • name Extension method

    Get the name of a GParamSpec.

    The name is always an “interned” string (as per g_intern_string()). This allows for pointer-value comparisons.

    Declaration

    Swift

    @inlinable
    var name: String! { get }
  • nameQuark Extension method

    Gets the GQuark for the name.

    Declaration

    Swift

    @inlinable
    var nameQuark: GQuark { get }
  • nick Extension method

    Get the nickname of a GParamSpec.

    Declaration

    Swift

    @inlinable
    var nick: String! { get }
  • redirectTarget Extension method

    If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of type GParamSpecOverride. See g_object_class_override_property() for an example of the use of this capability.

    Declaration

    Swift

    @inlinable
    var redirectTarget: GLibObject.ParamSpecRef! { get }
  • gTypeInstance Extension method

    private GTypeInstance portion

    Declaration

    Swift

    @inlinable
    var gTypeInstance: GTypeInstance { get }
  • _name Extension method

    name of this parameter: always an interned string

    Declaration

    Swift

    @inlinable
    var _name: UnsafePointer<gchar>! { get }
  • flags Extension method

    GParamFlags flags for this parameter

    Declaration

    Swift

    @inlinable
    var flags: GLibObject.ParamFlags { get }
  • valueType Extension method

    the GValue type for this parameter

    Declaration

    Swift

    @inlinable
    var valueType: GType { get }
  • ownerType Extension method

    GType type that uses (introduces) this parameter

    Declaration

    Swift

    @inlinable
    var ownerType: GType { get }