![]() |
![]() |
![]() |
Seed Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Working with JavaScript objectsWorking with JavaScript objects — Using properties, constructing objects, etc. |
#include <seed/seed.h> typedef SeedObject; SeedObject seed_make_object (SeedContext ctx, SeedClass class, gpointer private); SeedObject seed_make_array (SeedContext ctx, const SeedValue elements, gsize num_elements, SeedException *exception); SeedValue seed_object_call (SeedContext ctx, SeedObject object, SeedObject this, 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 class); 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, SeedValue value, 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);
SeedObject seed_make_object (SeedContext ctx, SeedClass class, gpointer private);
|
The SeedContext in which to create the new object. |
|
The SeedClass to use to create the new object, or NULL to use the
default object class.
|
|
The initial private data of the new object. |
Returns : |
A new SeedObject. |
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 .
|
SeedValue seed_object_call (SeedContext ctx, SeedObject object, SeedObject this, gsize argument_count, const SeedValue arguments[], SeedException *exception);
Calls object
as a function.
|
A SeedContext. |
|
A SeedObject to call. |
|
The SeedObject to use as the 'this' object inside the called function. |
|
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.
|
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.
|
SeedValue seed_object_get_property_at_index (SeedContext ctx, SeedObject object, gint index, SeedException *exception);
|
|
|
|
|
|
|
|
Returns : |
gboolean seed_object_is_of_class (SeedContext ctx, SeedObject obj, SeedClass class);
|
|
|
|
|
|
Returns : |
gpointer seed_object_get_private (SeedObject object);
Retrieves the private data of object
.
|
A SeedObject. |
Returns : |
A pointer to the private data of object .
|
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.
|
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 NULL
|
gboolean seed_object_set_property (SeedContext ctx, SeedObject object, const gchar *name, SeedValue value);
SeedObject seed_object_get_prototype (SeedContext ctx, SeedObject obj);
|
A valid SeedContext |
|
A SeedObject |
Returns : |
The prototype of obj .
|
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
|
void (*SeedObjectInitializeCallback) (SeedContext ctx, SeedObject object);
|
|
|
gboolean (*SeedObjectHasPropertyCallback) (SeedContext ctx, SeedObject object, SeedString string);
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectGetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedException *e);
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectSetPropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e);
|
|
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectDeletePropertyCallback) (SeedContext ctx, SeedObject object, SeedString property_name, SeedValue value, SeedException *e);
|
|
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx, SeedObject function, SeedObject this_object, gsize argument_count, const SeedValue arguments[], SeedException *exception);
|
|
|
|
|
|
|
|
|
|
|
|
Returns : |
gboolean (*SeedObjectHasInstanceCallback) (SeedContext ctx, SeedObject constructor, SeedObject instance_p, SeedException *exception);
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectConvertToTypeCallback) (SeedContext ctx, SeedObject object, SeedType type, SeedException *exception);
|
|
|
|
|
|
|
|
Returns : |
SeedValue (*SeedObjectCallAsConstructorCallback) (SeedContext ctx, SeedObject constructor, gsize argument_count, const SeedValue arguments[], SeedException *exception);
|
|
|
|
|
|
|
|
|
|
Returns : |