## SwfdecAsArray

SwfdecAsArray — the array object

## Synopsis

    #include <swfdec/swfdec.h>

                        SwfdecAsArray;
    SwfdecAsObject*     swfdec_as_array_new                 (SwfdecAsContext *context);
    #define             swfdec_as_array_append              (array,n,values)
    void                swfdec_as_array_append_with_flags   (SwfdecAsArray *array,
                                                             guint n,
                                                             const SwfdecAsValue *values,
                                                             SwfdecAsVariableFlag flags);
    void                swfdec_as_array_insert              (SwfdecAsArray *array,
                                                             gint32 idx,
                                                             SwfdecAsValue *value);
    void                swfdec_as_array_insert_with_flags   (SwfdecAsArray *array,
                                                             gint32 idx,
                                                             const SwfdecAsValue *value,
                                                             SwfdecAsVariableFlag flags);
    #define             swfdec_as_array_push                (array,value)
    #define             swfdec_as_array_push_with_flags     (array,value,flags)
    gint32              swfdec_as_array_get_length          (SwfdecAsArray *array);
    void                swfdec_as_array_set_length          (SwfdecAsArray *array,
                                                             gint32 length);
    void                swfdec_as_array_get_value           (SwfdecAsArray *array,
                                                             gint32 idx,
                                                             SwfdecAsValue *value);
    void                swfdec_as_array_set_value           (SwfdecAsArray *array,
                                                             gint32 idx,
                                                             SwfdecAsValue *value);
    void                swfdec_as_array_remove              (SwfdecAsArray *array,
                                                             gint32 idx);

## Object Hierarchy

      GObject
       +----SwfdecGcObject
             +----SwfdecAsObject
                   +----SwfdecAsArray

## Description

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

## Details

### SwfdecAsArray

    typedef struct _SwfdecAsArray SwfdecAsArray;

This is the type of the array object.

### swfdec_as_array_new ()

    SwfdecAsObject*     swfdec_as_array_new                 (SwfdecAsContext *context);

Creates a new SwfdecAsArray.

`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()`.

`array` : | a SwfdecAsArray
`n` : | number of values to add
`values` : | the values to add

### swfdec_as_array_append_with_flags ()

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

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

`array` : | a SwfdecAsArray
`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              (SwfdecAsArray *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()`.

`array` : | a SwfdecAsArray
`idx` : | index to insert the value to
`value` : | a SwfdecAsValue

### swfdec_as_array_insert_with_flags ()

    void                swfdec_as_array_insert_with_flags   (SwfdecAsArray *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.

`array` : | a SwfdecAsArray
`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()`.

`array` : | a SwfdecAsArray
`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()`.

`array` : | a SwfdecAsArray
`value` : | the value to add
`flags` : | the SwfdecAsVariableFlag flags to use

### swfdec_as_array_get_length ()

    gint32              swfdec_as_array_get_length          (SwfdecAsArray *array);

Gets the current length of the `array`.

`array` : | a SwfdecAsArray
Returns : | Current length of the `array`, always >= 0

### swfdec_as_array_set_length ()

    void                swfdec_as_array_set_length          (SwfdecAsArray *array,
                                                             gint32 length);

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

`array` : | a SwfdecAsArray
`length` : | the new length

### swfdec_as_array_get_value ()

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

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

`array` : | a SwfdecAsArray
`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           (SwfdecAsArray *array,
                                                             gint32 idx,
                                                             SwfdecAsValue *value);

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

`array` : | a SwfdecAsArray
`idx` : | index of the value to set
`value` : | a pointer to SwfdecAsValue

### swfdec_as_array_remove ()

    void                swfdec_as_array_remove              (SwfdecAsArray *array,
                                                             gint32 idx);

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

`array` : | a SwfdecAsArray
`idx` : | index of the value to remove