| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria ([email protected]) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.JavaScriptCore.Objects.Value
Contents
- Exported types
- Methods
- constructorCall
- functionCall
- getContext
- isArray
- isBoolean
- isConstructor
- isFunction
- isNull
- isNumber
- isObject
- isString
- isUndefined
- newArrayFromGarray
- newArrayFromStrv
- newBoolean
- newFunction
- newFunctionVariadic
- newNull
- newNumber
- newObject
- newString
- newStringFromBytes
- newUndefined
- objectDefinePropertyAccessor
- objectDefinePropertyData
- objectDeleteProperty
- objectEnumerateProperties
- objectGetProperty
- objectGetPropertyAtIndex
- objectHasProperty
- objectInvokeMethod
- objectIsInstanceOf
- objectSetProperty
- objectSetPropertyAtIndex
- toBoolean
- toDouble
- toInt32
- toString
- toStringAsBytes
- Properties
Description
No description available in the introspection data.
Synopsis
- newtype Value = Value (ManagedPtr Value)
- class (GObject o, IsDescendantOf Value o) => IsValue o
- toValue :: (MonadIO m, IsValue o) => o -> m Value
- noValue :: Maybe Value
- valueConstructorCall :: (HasCallStack, MonadIO m, IsValue a) => a -> Maybe [Value] -> m Value
- valueFunctionCall :: (HasCallStack, MonadIO m, IsValue a) => a -> Maybe [Value] -> m Value
- valueGetContext :: (HasCallStack, MonadIO m, IsValue a) => a -> m Context
- valueIsArray :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsBoolean :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsConstructor :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsFunction :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsNull :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsNumber :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsObject :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsString :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueIsUndefined :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueNewArrayFromGarray :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe [Value] -> m Value
- valueNewArrayFromStrv :: (HasCallStack, MonadIO m, IsContext a) => a -> [Text] -> m Value
- valueNewBoolean :: (HasCallStack, MonadIO m, IsContext a) => a -> Bool -> m Value
- valueNewFunction :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Text -> Callback -> GType -> Maybe [GType] -> m Value
- valueNewFunctionVariadic :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Text -> Callback -> GType -> m Value
- valueNewNull :: (HasCallStack, MonadIO m, IsContext a) => a -> m Value
- valueNewNumber :: (HasCallStack, MonadIO m, IsContext a) => a -> Double -> m Value
- valueNewObject :: (HasCallStack, MonadIO m, IsContext a, IsClass b) => a -> Ptr () -> Maybe b -> m Value
- valueNewString :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Text -> m Value
- valueNewStringFromBytes :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Bytes -> m Value
- valueNewUndefined :: (HasCallStack, MonadIO m, IsContext a) => a -> m Value
- valueObjectDefinePropertyAccessor :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> [ValuePropertyFlags] -> GType -> Maybe Callback -> Maybe Callback -> m ()
- valueObjectDefinePropertyData :: (HasCallStack, MonadIO m, IsValue a, IsValue b) => a -> Text -> [ValuePropertyFlags] -> Maybe b -> m ()
- valueObjectDeleteProperty :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> m Bool
- valueObjectEnumerateProperties :: (HasCallStack, MonadIO m, IsValue a) => a -> m (Maybe [Text])
- valueObjectGetProperty :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> m Value
- valueObjectGetPropertyAtIndex :: (HasCallStack, MonadIO m, IsValue a) => a -> Word32 -> m Value
- valueObjectHasProperty :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> m Bool
- valueObjectInvokeMethod :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> Maybe [Value] -> m Value
- valueObjectIsInstanceOf :: (HasCallStack, MonadIO m, IsValue a) => a -> Text -> m Bool
- valueObjectSetProperty :: (HasCallStack, MonadIO m, IsValue a, IsValue b) => a -> Text -> b -> m ()
- valueObjectSetPropertyAtIndex :: (HasCallStack, MonadIO m, IsValue a, IsValue b) => a -> Word32 -> b -> m ()
- valueToBoolean :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bool
- valueToDouble :: (HasCallStack, MonadIO m, IsValue a) => a -> m Double
- valueToInt32 :: (HasCallStack, MonadIO m, IsValue a) => a -> m Int32
- valueToString :: (HasCallStack, MonadIO m, IsValue a) => a -> m Text
- valueToStringAsBytes :: (HasCallStack, MonadIO m, IsValue a) => a -> m Bytes
- constructValueContext :: (IsValue o, IsContext a) => a -> IO (GValueConstruct o)
- getValueContext :: (MonadIO m, IsValue o) => o -> m Context
Exported types
Memory-managed wrapper type.
Instances
| GObject Value Source # | |
Defined in GI.JavaScriptCore.Objects.Value Methods gobjectType :: IO GType | |
| HasParentTypes Value Source # | |
Defined in GI.JavaScriptCore.Objects.Value | |
| type ParentTypes Value Source # | |
Defined in GI.JavaScriptCore.Objects.Value | |
class (GObject o, IsDescendantOf Value o) => IsValue o Source #
Instances
| (GObject o, IsDescendantOf Value o) => IsValue o Source # | |
Defined in GI.JavaScriptCore.Objects.Value | |
Methods
constructorCall
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Maybe [Value] |
|
| -> m Value | Returns: a |
Invoke <function>new</function> with constructor referenced by value. If nParameters
is 0 no parameters will be passed to the constructor.
functionCall
getContext
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Context | Returns: the |
Get the Context in which value was created.
isArray
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is an array. |
Get whether the value referenced by value is an array.
isBoolean
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is a boolean. |
Get whether the value referenced by value is a boolean.
isConstructor
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is a constructor. |
Get whether the value referenced by value is a constructor.
isFunction
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is a function. |
Get whether the value referenced by value is a function
isNull
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is null. |
Get whether the value referenced by value is <function>null</function>.
isNumber
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is a number. |
Get whether the value referenced by value is a number.
isObject
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is an object. |
Get whether the value referenced by value is an object.
isString
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is a string |
Get whether the value referenced by value is a string
isUndefined
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: whether the value is undefined. |
Get whether the value referenced by value is <function>undefined</function>.
newArrayFromGarray
newArrayFromStrv
newBoolean
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Bool |
|
| -> m Value | Returns: a |
Create a new Value from value
newFunction
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Maybe Text |
|
| -> Callback |
|
| -> GType |
|
| -> Maybe [GType] |
|
| -> m Value | Returns: a |
Create a function in context. If name is Nothing an anonymous function will be created.
When the function is called by JavaScript or jsc_value_function_call(), callback is called
receiving the function parameters and then userData as last parameter. When the function is
cleared in context, destroyNotify is called with userData as parameter.
Note that the value returned by callback must be fully transferred. In case of boxed types, you could use
G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created
with valueNewObject that receives the copy as instance parameter.
newFunctionVariadic
valueNewFunctionVariadic Source #
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Maybe Text |
|
| -> Callback |
|
| -> GType |
|
| -> m Value | Returns: a |
Create a function in context. If name is Nothing an anonymous function will be created.
When the function is called by JavaScript or jsc_value_function_call(), callback is called
receiving an PtrArray of Value<!-- -->s with the arguments and then userData as last parameter.
When the function is cleared in context, destroyNotify is called with userData as parameter.
Note that the value returned by callback must be fully transferred. In case of boxed types, you could use
G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created
with valueNewObject that receives the copy as instance parameter.
newNull
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> m Value | Returns: a |
Create a new Value referencing <function>null</function> in context.
newNumber
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Double |
|
| -> m Value | Returns: a |
Create a new Value from number.
newObject
Arguments
| :: (HasCallStack, MonadIO m, IsContext a, IsClass b) | |
| => a |
|
| -> Ptr () |
|
| -> Maybe b |
|
| -> m Value | Returns: a |
Create a new Value from instance. If instance is Nothing a new empty object is created.
When instance is provided, jscClass must be provided too. jscClass takes ownership of
instance that will be freed by the DestroyNotify passed to contextRegisterClass.
newString
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Maybe Text |
|
| -> m Value | Returns: a |
Create a new Value from string. If you need to create a Value from a
string containing null characters, use valueNewStringFromBytes instead.
newStringFromBytes
valueNewStringFromBytes Source #
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> Maybe Bytes |
|
| -> m Value | Returns: a |
Create a new Value from bytes.
newUndefined
Arguments
| :: (HasCallStack, MonadIO m, IsContext a) | |
| => a |
|
| -> m Value | Returns: a |
Create a new Value referencing <function>undefined</function> in context.
objectDefinePropertyAccessor
valueObjectDefinePropertyAccessor Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> [ValuePropertyFlags] |
|
| -> GType |
|
| -> Maybe Callback |
|
| -> Maybe Callback |
|
| -> m () |
Define or modify a property with propertyName in object referenced by value. When the
property value needs to be getted or set, getter and setter callbacks will be called.
When the property is cleared in the Class context, destroyNotify is called with
userData as parameter. This is equivalent to JavaScript <function>Object.defineProperty()</function>
when used with an accessor descriptor.
Note that the value returned by getter must be fully transferred. In case of boxed types, you could use
G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by Class is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created
with valueNewObject that receives the copy as instance parameter.
objectDefinePropertyData
valueObjectDefinePropertyData Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a, IsValue b) | |
| => a |
|
| -> Text |
|
| -> [ValuePropertyFlags] |
|
| -> Maybe b |
|
| -> m () |
Define or modify a property with propertyName in object referenced by value. This is equivalent to
JavaScript <function>Object.defineProperty()</function> when used with a data descriptor.
objectDeleteProperty
valueObjectDeleteProperty Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> m Bool | Returns: |
Try to delete property with name from value. This function will return False if
the property was defined without ValuePropertyFlagsConfigurable flag.
objectEnumerateProperties
valueObjectEnumerateProperties Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m (Maybe [Text]) | Returns: a |
Get the list of property names of value. Only properties defined with ValuePropertyFlagsEnumerable
flag will be collected.
objectGetProperty
valueObjectGetProperty Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> m Value | Returns: the property |
Get property with name from value.
objectGetPropertyAtIndex
valueObjectGetPropertyAtIndex Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Word32 |
|
| -> m Value | Returns: the property |
Get property at index from value.
objectHasProperty
valueObjectHasProperty Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> m Bool | Returns: |
Get whether value has property with name.
objectInvokeMethod
valueObjectInvokeMethod Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> Maybe [Value] |
|
| -> m Value | Returns: a |
Invoke method with name on object referenced by value, passing the given parameters. If
nParameters is 0 no parameters will be passed to the method.
The object instance will be handled automatically even when the method is a custom one
registered with jsc_class_add_method(), so it should never be passed explicitly as parameter
of this function.
This function always returns a Value, in case of void methods a Value referencing
<function>undefined</function> is returned.
objectIsInstanceOf
valueObjectIsInstanceOf Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> Text |
|
| -> m Bool | Returns: whether the value is an object instance of class |
Get whether the value referenced by value is an instance of class name.
objectSetProperty
valueObjectSetProperty Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a, IsValue b) | |
| => a |
|
| -> Text |
|
| -> b |
|
| -> m () |
Set property with name on value.
objectSetPropertyAtIndex
valueObjectSetPropertyAtIndex Source #
Arguments
| :: (HasCallStack, MonadIO m, IsValue a, IsValue b) | |
| => a |
|
| -> Word32 |
|
| -> b |
|
| -> m () |
Set property at index on value.
toBoolean
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bool | Returns: a |
Convert value to a boolean.
toDouble
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Double | Returns: a |
Convert value to a double.
toInt32
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Int32 | Returns: a |
Convert value to a gint32.
toString
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Text | Returns: a null-terminated string result of the conversion. |
Convert value to a string. Use valueToStringAsBytes instead, if you need to
handle strings containing null characters.
toStringAsBytes
Arguments
| :: (HasCallStack, MonadIO m, IsValue a) | |
| => a |
|
| -> m Bytes | Returns: a |
Convert value to a string and return the results as Bytes. This is needed
to handle strings with null characters.
Properties
context
The Context in which the value was created.
constructValueContext :: (IsValue o, IsContext a) => a -> IO (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “context” property. This is rarely needed directly, but it is used by new.
getValueContext :: (MonadIO m, IsValue o) => o -> m Context Source #
Get the value of the “context” property.
When overloading is enabled, this is equivalent to
get value #context