arrays

arrays — utility functions for treating objects as arrays

Functions

Includes

#include <swfdec/swfdec.h>

Description

The array object provides some convenience functions for creating and modifying arrays.

Functions

swfdec_as_array_new ()

SwfdecAsObject *
swfdec_as_array_new (SwfdecAsContext *context);

Creates a new array.

Parameters

context

a SwfdecAsContext

 

Returns

the new array


swfdec_as_array_append()

#define             swfdec_as_array_append(array,n,values)

Appends the given values to the array . This is a macro that just calls swfdec_as_array_append_with_flags().

Parameters

array

the array

 

n

number of values to add

 

values

the values to add

 

swfdec_as_array_append_with_flags ()

void
swfdec_as_array_append_with_flags (SwfdecAsObject *array,
                                   guint n,
                                   const SwfdecAsValue *values,
                                   SwfdecAsVariableFlag flags);

Appends the given values to the array using the given flags .

Parameters

array

the array

 

n

number of values to add

 

values

the values to add

 

flags

the SwfdecAsVariableFlag flags to use

 

swfdec_as_array_insert ()

void
swfdec_as_array_insert (SwfdecAsObject *array,
                        gint32 idx,
                        SwfdecAsValue *value);

Inserts value to array at given index, making room for it by moving elements to bigger indexes if necessary. This is a macro that just calls swfdec_as_array_insert_with_flags().

Parameters

array

the array

 

idx

index to insert the value to

 

value

a SwfdecAsValue

 

swfdec_as_array_insert_with_flags ()

void
swfdec_as_array_insert_with_flags (SwfdecAsObject *array,
                                   gint32 idx,
                                   const SwfdecAsValue *value,
                                   SwfdecAsVariableFlag flags);

Inserts value to array at given index using given flags , making room for it by moving elements to bigger indexes if necessary.

Parameters

array

the array

 

idx

index to insert the value to

 

value

a SwfdecAsValue

 

flags

the SwfdecAsVariableFlag flags to use

 

swfdec_as_array_push()

#define             swfdec_as_array_push(array,value)

Adds the given value to the array . This is a macro that just calls swfdec_as_array_append_with_flags().

Parameters

array

the array

 

value

the value to add

 

swfdec_as_array_push_with_flags()

#define             swfdec_as_array_push_with_flags(array,value,flags)

Adds the given value to the array with the given flags . This is a macro that just calls swfdec_as_array_append_with_flags().

Parameters

array

the array

 

value

the value to add

 

flags

the SwfdecAsVariableFlag flags to use

 

swfdec_as_array_get_length ()

gint32
swfdec_as_array_get_length (SwfdecAsObject *array);

Gets the current length of the array .

Parameters

array

the array

 

Returns

Current length of the array , always >= 0


swfdec_as_array_set_length ()

void
swfdec_as_array_set_length (SwfdecAsObject *array,
                            gint32 length);

Sets the length of the array . Values outside the new length will be removed.

Parameters

array

the array

 

length

the new length

 

swfdec_as_array_get_value ()

void
swfdec_as_array_get_value (SwfdecAsObject *array,
                           gint32 idx,
                           SwfdecAsValue *value);

Gets a value from given index, if the value doesn't exists an undefined value is set.

Parameters

array

the array

 

idx

index of the value to get

 

value

a pointer to SwfdecAsValue that will be set

 

swfdec_as_array_set_value ()

void
swfdec_as_array_set_value (SwfdecAsObject *array,
                           gint32 idx,
                           SwfdecAsValue *value);

Sets a value to given index. The array 's length will be increased if necessary.

Parameters

array

the array

 

idx

index of the value to set

 

value

a pointer to SwfdecAsValue

 

swfdec_as_array_remove ()

void
swfdec_as_array_remove (SwfdecAsObject *array,
                        gint32 idx);

Removes value at given index from the array , elements with higher indexes will be moved towards the start of the array .

Parameters

array

the array

 

idx

index of the value to remove

 

Types and Values