Seed Reference Manual | ||||
---|---|---|---|---|
Top | Description |
Working with JavaScript objectsWorking with JavaScript objects — Using properties, constructing objects, etc. |
Synopsis
#include <seed/seed.h> typedef SeedObject; SeedObject seed_make_object (SeedContext ctx
,SeedClass klass
,gpointer private_object
); SeedObject seed_make_array (SeedContext ctx
,const SeedValue elements
,gsize num_elements
,SeedException *exception
); SeedValue seed_object_call (SeedContext ctx
,SeedObject object
,SeedObject this_object
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
); void seed_object_set_property_at_index (SeedContext ctx
,SeedObject object
,gint index
,SeedValue value
,SeedException *exception
); SeedValue seed_object_get_property_at_index (SeedContext ctx
,SeedObject object
,gint index
,SeedException *exception
); gboolean seed_object_is_of_class (SeedContext ctx
,SeedObject obj
,SeedClass klass
); gpointer seed_object_get_private (SeedObject object
); void seed_object_set_private (SeedObject object
,gpointer value
); SeedValue seed_object_get_property (SeedContext ctx
,SeedObject object
,const gchar *name
); gboolean seed_object_set_property (SeedContext ctx
,SeedObject object
,const gchar *name
,SeedValue value
); SeedObject seed_object_get_prototype (SeedContext ctx
,SeedObject obj
); gchar ** seed_object_copy_property_names (SeedContext ctx
,SeedObject object
); void (*SeedObjectInitializeCallback) (SeedContext ctx
,SeedObject object
); void (*SeedObjectFinalizeCallback) (SeedObject object
); gboolean (*SeedObjectHasPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString string
); SeedValue (*SeedObjectGetPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedException *e
); gboolean (*SeedObjectSetPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedValue value
,SeedException *e
); gboolean (*SeedObjectDeletePropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedException *e
); void (*SeedObjectGetPropertyNamesCallback) (void
); SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx
,SeedObject function
,SeedObject this_object
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
); gboolean (*SeedObjectHasInstanceCallback) (SeedContext ctx
,SeedObject constructor
,SeedObject instance_p
,SeedException *exception
); SeedValue (*SeedObjectConvertToTypeCallback) (SeedContext ctx
,SeedObject object
,SeedType type
,SeedException *exception
); SeedValue (*SeedObjectCallAsConstructorCallback) (SeedContext ctx
,SeedObject constructor
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
);
Details
seed_make_object ()
SeedObject seed_make_object (SeedContext ctx
,SeedClass klass
,gpointer private_object
);
|
The SeedContext in which to create the new object. |
Returns : |
A new SeedObject. |
seed_make_array ()
SeedObject seed_make_array (SeedContext ctx
,const SeedValue elements
,gsize num_elements
,SeedException *exception
);
Creates a JavaScript Array object from elements
, a C-style array of
SeedValues.
|
A valid SeedContext |
|
An array of SeedValue's with which to populate the array. |
|
The number of values, in elements
|
|
A SeedException in which to store an exception.
Pass NULL to ignore exceptions. |
Returns : |
A new array object, populated with elements . |
seed_object_call ()
SeedValue seed_object_call (SeedContext ctx
,SeedObject object
,SeedObject this_object
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
);
Calls object
as a function.
|
A SeedContext. |
|
A SeedObject to call. |
|
The number of arguments in the arguments array. |
|
An array (argument_count long) of SeedValues to pass in as the
function's arguments. |
|
A reference to a SeedValue in which to store any exceptions.
Pass NULL to ignore exceptions. |
Returns : |
The SeedValue returned by the called function, or NULL if an
exception occurs or the object is not a function. |
seed_object_set_property_at_index ()
void seed_object_set_property_at_index (SeedContext ctx
,SeedObject object
,gint index
,SeedValue value
,SeedException *exception
);
Sets the property index
on object
to value
.
|
A SeedContext. |
|
A SeedObject on which to set the property. |
|
The index of the property to set. |
|
The SeedValue to use as the property's value. |
|
A reference to a SeedValue in which to store any exceptions.
Pass NULL to ignore exceptions. |
seed_object_get_property_at_index ()
SeedValue seed_object_get_property_at_index (SeedContext ctx
,SeedObject object
,gint index
,SeedException *exception
);
seed_object_is_of_class ()
gboolean seed_object_is_of_class (SeedContext ctx
,SeedObject obj
,SeedClass klass
);
seed_object_get_private ()
gpointer seed_object_get_private (SeedObject object
);
Retrieves the private data of object
.
|
A SeedObject. |
Returns : |
A pointer to the private data of object . |
seed_object_set_private ()
void seed_object_set_private (SeedObject object
,gpointer value
);
Sets the private data of object
to value
.
|
A SeedObject. |
|
A gpointer to set the private data of object to. |
seed_object_get_property ()
SeedValue seed_object_get_property (SeedContext ctx
,SeedObject object
,const gchar *name
);
|
A SeedContext |
|
A SeedObject |
|
The property to get, should be a valid JavaScript identifier |
Returns : |
The value of the property or the undefined value |
seed_object_set_property ()
gboolean seed_object_set_property (SeedContext ctx
,SeedObject object
,const gchar *name
,SeedValue value
);
|
A SeedContext |
|
A SeedObject |
|
The property to set, should be a valid JavaScript identifier |
|
The value to set the property to. |
Returns : |
TRUE on success, FALSE otherwise. |
seed_object_get_prototype ()
SeedObject seed_object_get_prototype (SeedContext ctx
,SeedObject obj
);
|
A valid SeedContext |
|
A SeedObject |
Returns : |
The prototype of obj . |
seed_object_copy_property_names ()
gchar ** seed_object_copy_property_names (SeedContext ctx
,SeedObject object
);
|
A valid SeedContext |
|
An object from which to copy property names. |
Returns : |
A NULL terminated array containing the property names of object
|
SeedObjectInitializeCallback ()
void (*SeedObjectInitializeCallback) (SeedContext ctx
,SeedObject object
);
SeedObjectHasPropertyCallback ()
gboolean (*SeedObjectHasPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString string
);
SeedObjectGetPropertyCallback ()
SeedValue (*SeedObjectGetPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedException *e
);
SeedObjectSetPropertyCallback ()
gboolean (*SeedObjectSetPropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedValue value
,SeedException *e
);
SeedObjectDeletePropertyCallback ()
gboolean (*SeedObjectDeletePropertyCallback) (SeedContext ctx
,SeedObject object
,SeedString property_name
,SeedException *e
);
SeedObjectCallAsFunctionCallback ()
SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx
,SeedObject function
,SeedObject this_object
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
);
SeedObjectHasInstanceCallback ()
gboolean (*SeedObjectHasInstanceCallback) (SeedContext ctx
,SeedObject constructor
,SeedObject instance_p
,SeedException *exception
);
SeedObjectConvertToTypeCallback ()
SeedValue (*SeedObjectConvertToTypeCallback) (SeedContext ctx
,SeedObject object
,SeedType type
,SeedException *exception
);
SeedObjectCallAsConstructorCallback ()
SeedValue (*SeedObjectCallAsConstructorCallback) (SeedContext ctx
,SeedObject constructor
,gsize argument_count
,const SeedValue arguments[]
,SeedException *exception
);