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.
-
Untyped pointer to the underlying
GParamSpec
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
param_spec_ptr
Default implementationTyped 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)
-
getBlurb()
Extension methodGet the short description of a
GParamSpec
.Declaration
Swift
@inlinable func getBlurb() -> String!
-
getDefaultValue()
Extension methodGets the default value of
pspec
as a pointer to aGValue
.The
GValue
will remain valid for the life ofpspec
.Declaration
Swift
@inlinable func getDefaultValue() -> GLibObject.ValueRef!
-
getName()
Extension methodGet 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 methodGets the GQuark for the name.
Declaration
Swift
@inlinable func getNameQuark() -> GQuark
-
getNick()
Extension methodGet 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 methodIf 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
. Seeg_object_class_override_property()
for an example of the use of this capability.Declaration
Swift
@inlinable func getRedirectTarget() -> GLibObject.ParamSpecRef!
-
ref()
Extension methodIncrements the reference count of
pspec
.Declaration
Swift
@discardableResult @inlinable func ref() -> GLibObject.ParamSpecRef!
-
refSink()
Extension methodConvenience function to ref and sink a
GParamSpec
.Declaration
Swift
@discardableResult @inlinable func refSink() -> GLibObject.ParamSpecRef!
-
setQdata(quark:
Extension methoddata: ) Sets an opaque, named pointer on a
GParamSpec
. The name is specified through aGQuark
(retrieved e.g. viag_quark_from_static_string()
), and the pointer can be gotten back from thepspec
withg_param_spec_get_qdata()
. Setting a previously set user data pointer, overrides (frees) the old pointer set, usingnil
as pointer essentially removes the data stored.Declaration
Swift
@inlinable func setQdata(quark: GQuark, data: gpointer? = nil)
-
setQdataFull(quark:
Extension methoddata: destroy: ) This function works like
g_param_spec_set_qdata()
, but in addition, avoid (*destroy) (gpointer)
function may be specified which is called withdata
as argument when thepspec
is finalized, or the data is being overwritten by a call tog_param_spec_set_qdata()
with the samequark
.Declaration
Swift
@inlinable func setQdataFull(quark: GQuark, data: gpointer? = nil, destroy: GDestroyNotify? = nil)
-
sink()
Extension methodThe initial reference count of a newly created
GParamSpec
is 1, even though no one has explicitly calledg_param_spec_ref()
on it yet. So the initial reference count is flagged as “floating”, until someone callsg_param_spec_ref (pspec); g_param_spec_sink (pspec);
in sequence on it, taking over the initial reference count (thus ending up with apspec
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 thedata
frompspec
without invoking itsdestroy()
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 methodDecrements 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!
-
paramSpecValueArray(name:
Extension methodnick: blurb: flags: ) Creates a new
GParamSpecValueArray
instance specifying aG_TYPE_VALUE_ARRAY
property.G_TYPE_VALUE_ARRAY
is aG_TYPE_BOXED
type, as such,GValue
structures for this property can be accessed withg_value_set_boxed()
andg_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!
-
paramValueConvert(srcValue:
Extension methoddestValue: strictValidation: ) Transforms
src_value
intodest_value
if possible, and then validatesdest_value
, in order for it to conform topspec
. Ifstrict_validation
istrue
this function will only succeed if the transformeddest_value
complied topspec
without modifications.See also
g_value_type_transformable()
,g_value_transform()
andg_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 inpspec
.Declaration
Swift
@inlinable func paramValueDefaults<ValueT>(value: ValueT) -> Bool where ValueT : ValueProtocol
-
paramValueSetDefault(value:
Extension method) Sets
value
to its default value as specified inpspec
.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 bypspec
. For example, aGParamSpecInt
might require that integers stored invalue
may not be smaller than -42 and not be greater than +42. Ifvalue
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
-
paramValuesCmp(value1:
Extension methodvalue2: ) Compares
value1
withvalue2
according topspec
, and return -1, 0 or +1, ifvalue1
is found to be less than, equal to or greater thanvalue2
, respectively.Declaration
Swift
@inlinable func paramValuesCmp<ValueT>(value1: ValueT, value2: ValueT) -> Int where ValueT : ValueProtocol
-
blurb
Extension methodGet the short description of a
GParamSpec
.Declaration
Swift
@inlinable var blurb: String! { get }
-
defaultValue
Extension methodGets the default value of
pspec
as a pointer to aGValue
.The
GValue
will remain valid for the life ofpspec
.Declaration
Swift
@inlinable var defaultValue: GLibObject.ValueRef! { get }
-
name
Extension methodGet 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 methodGets the GQuark for the name.
Declaration
Swift
@inlinable var nameQuark: GQuark { get }
-
nick
Extension methodGet the nickname of a
GParamSpec
.Declaration
Swift
@inlinable var nick: String! { get }
-
redirectTarget
Extension methodIf 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
. Seeg_object_class_override_property()
for an example of the use of this capability.Declaration
Swift
@inlinable var redirectTarget: GLibObject.ParamSpecRef! { get }
-
gTypeInstance
Extension methodprivate
GTypeInstance
portionDeclaration
Swift
@inlinable var gTypeInstance: GTypeInstance { get }
-
_name
Extension methodname of this parameter: always an interned string
Declaration
Swift
@inlinable var _name: UnsafePointer<gchar>! { get }
-
flags
Extension methodGParamFlags
flags for this parameterDeclaration
Swift
@inlinable var flags: GLibObject.ParamFlags { get }
-
valueType
Extension methodthe
GValue
type for this parameterDeclaration
Swift
@inlinable var valueType: GType { get }
-
ownerType
Extension methodGType
type that uses (introduces) this parameterDeclaration
Swift
@inlinable var ownerType: GType { get }