gi-javascriptcore-4.0.17: JavaScriptCore bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.JavaScriptCore.Objects.Value

Contents

Description

No description available in the introspection data.

Synopsis

Exported types

newtype Value Source #

Memory-managed wrapper type.

Constructors

Value (ManagedPtr Value) 
Instances
GObject Value Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Value

Methods

gobjectType :: IO GType #

HasParentTypes Value Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Value

type ParentTypes Value Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Value

type ParentTypes Value = Object ': ([] :: [Type])

class (GObject o, IsDescendantOf Value o) => IsValue o Source #

Type class for types which can be safely cast to Value, for instance with toValue.

Instances
(GObject o, IsDescendantOf Value o) => IsValue o Source # 
Instance details

Defined in GI.JavaScriptCore.Objects.Value

toValue :: (MonadIO m, IsValue o) => o -> m Value Source #

Cast to Value, for types for which this is known to be safe. For general casts, use castTo.

noValue :: Maybe Value Source #

A convenience alias for Nothing :: Maybe Value.

Methods

constructorCall

valueConstructorCall Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Maybe [Value]

parameters: the Value<!-- -->s to pass as parameters to the constructor, or Nothing

-> m Value

Returns: a Value referencing the newly created object instance.

Invoke <function>new</function> with constructor referenced by value. If nParameters is 0 no parameters will be passed to the constructor.

functionCall

valueFunctionCall Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Maybe [Value]

parameters: the Value<!-- -->s to pass as parameters to the function, or Nothing

-> m Value

Returns: a Value with the return value of the function.

Call function referenced by value, passing the given parameters. If nParameters is 0 no parameters will be passed to the function.

This function always returns a Value, in case of void functions a Value referencing <function>undefined</function> is returned

getContext

valueGetContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Context

Returns: the Value context.

Get the Context in which value was created.

isArray

valueIsArray Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is an array.

Get whether the value referenced by value is an array.

isBoolean

valueIsBoolean Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is a boolean.

Get whether the value referenced by value is a boolean.

isConstructor

valueIsConstructor Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is a constructor.

Get whether the value referenced by value is a constructor.

isFunction

valueIsFunction Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is a function.

Get whether the value referenced by value is a function

isNull

valueIsNull Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is null.

Get whether the value referenced by value is <function>null</function>.

isNumber

valueIsNumber Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is a number.

Get whether the value referenced by value is a number.

isObject

valueIsObject Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is an object.

Get whether the value referenced by value is an object.

isString

valueIsString Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is a string

Get whether the value referenced by value is a string

isUndefined

valueIsUndefined Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: whether the value is undefined.

Get whether the value referenced by value is <function>undefined</function>.

newArrayFromGarray

valueNewArrayFromGarray Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> Maybe [Value]

array: a PtrArray

-> m Value

Returns: a Value.

Create a new Value referencing an array with the items from array. If array is Nothing or empty a new empty array will be created. Elements of array should be pointers to a Value.

newArrayFromStrv

valueNewArrayFromStrv Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> [Text]

strv: a Nothing-terminated array of strings

-> m Value

Returns: a Value.

Create a new Value referencing an array of strings with the items from strv. If array is Nothing or empty a new empty array will be created.

newBoolean

valueNewBoolean Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> Bool

value: a Bool

-> m Value

Returns: a Value.

Create a new Value from value

newFunction

valueNewFunction Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> Maybe Text

name: the function name or Nothing

-> Callback

callback: a Callback.

-> GType

returnType: the GType of the function return value, or G_TYPE_NONE if the function is void.

-> Maybe [GType]

parameterTypes: a list of GType<!-- -->s, one for each parameter, or Nothing

-> m Value

Returns: a Value.

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

context: a Context

-> Maybe Text

name: the function name or Nothing

-> Callback

callback: a Callback.

-> GType

returnType: the GType of the function return value, or G_TYPE_NONE if the function is void.

-> m Value

Returns: a Value.

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

valueNewNull Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> m Value

Returns: a Value.

Create a new Value referencing <function>null</function> in context.

newNumber

valueNewNumber Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> Double

number: a number

-> m Value

Returns: a Value.

Create a new Value from number.

newObject

valueNewObject Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a, IsClass b) 
=> a

context: a Context

-> Ptr ()

instance: an object instance or Nothing

-> Maybe b

jscClass: the Class of instance

-> m Value

Returns: a Value.

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

valueNewString Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> Maybe Text

string: a null-terminated string

-> m Value

Returns: a Value.

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

context: a Context

-> Maybe Bytes

bytes: a Bytes

-> m Value

Returns: a Value.

Create a new Value from bytes.

newUndefined

valueNewUndefined Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a Context

-> m Value

Returns: a Value.

Create a new Value referencing <function>undefined</function> in context.

objectDefinePropertyAccessor

valueObjectDefinePropertyAccessor Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Text

propertyName: the name of the property to define

-> [ValuePropertyFlags]

flags: ValuePropertyFlags

-> GType

propertyType: the GType of the property

-> Maybe Callback

getter: a Callback to be called to get the property value

-> Maybe Callback

setter: a Callback to be called to set the property value

-> 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

value: a Value

-> Text

propertyName: the name of the property to define

-> [ValuePropertyFlags]

flags: ValuePropertyFlags

-> Maybe b

propertyValue: the default property value

-> 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

value: a Value

-> Text

name: the property name

-> m Bool

Returns: True if the property was deleted, or False otherwise.

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

value: a Value

-> m (Maybe [Text])

Returns: a Nothing-terminated array of strings containing the property names, or Nothing if value doesn't have enumerable properties. Use strfreev to free.

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

value: a Value

-> Text

name: the property name

-> m Value

Returns: the property Value.

Get property with name from value.

objectGetPropertyAtIndex

valueObjectGetPropertyAtIndex Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Word32

index: the property index

-> m Value

Returns: the property Value.

Get property at index from value.

objectHasProperty

valueObjectHasProperty Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Text

name: the property name

-> m Bool

Returns: True if value has a property with name, or False otherwise

Get whether value has property with name.

objectInvokeMethod

valueObjectInvokeMethod Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> Text

name: the method name

-> Maybe [Value]

parameters: the Value<!-- -->s to pass as parameters to the method, or Nothing

-> m Value

Returns: a Value with the return value of the method.

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

value: a Value

-> Text

name: a class name

-> m Bool

Returns: whether the value is an object instance of class name.

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

value: a Value

-> Text

name: the property name

-> b

property: the Value to set

-> m () 

Set property with name on value.

objectSetPropertyAtIndex

valueObjectSetPropertyAtIndex Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a, IsValue b) 
=> a

value: a Value

-> Word32

index: the property index

-> b

property: the Value to set

-> m () 

Set property at index on value.

toBoolean

valueToBoolean Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bool

Returns: a Bool result of the conversion.

Convert value to a boolean.

toDouble

valueToDouble Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Double

Returns: a gdouble result of the conversion.

Convert value to a double.

toInt32

valueToInt32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Int32

Returns: a gint32 result of the conversion.

Convert value to a gint32.

toString

valueToString Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> 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

valueToStringAsBytes Source #

Arguments

:: (HasCallStack, MonadIO m, IsValue a) 
=> a

value: a Value

-> m Bytes

Returns: a Bytes with the result of the conversion.

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