Go to the source code of this file.
Classes | |
| struct | Array |
Functions | |
| EXTERN_C_BEGIN LIBGIFT_EXPORT Array * | array_new (void *first,...) |
| LIBGIFT_EXPORT void | array_unset (Array **a) |
| LIBGIFT_EXPORT void * | array_push (Array **a, void *element) |
| LIBGIFT_EXPORT void * | array_pop (Array **a) |
| LIBGIFT_EXPORT void * | array_shift (Array **a) |
| LIBGIFT_EXPORT void * | array_unshift (Array **a, void *element) |
| LIBGIFT_EXPORT void * | array_index (Array **a, int index) |
| LIBGIFT_EXPORT size_t | array_count (Array **a) |
| LIBGIFT_EXPORT void * | array_splice (Array **a, int offset, int length, void *first,...) |
| LIBGIFT_EXPORT int | array_list (Array **a,...) |
This is the only libgift subsystem which doesn't prefix it's name for function namespacing. This is done to provide the absolute shortest possible function names.
Example:
Array *a = array ("foo", "bar", NULL); array_splice (&a, 0, 1, "FOO", NULL); array_splice (&a, 1, 1, "Bar", NULL); array_push (&a, "baz"); array_push (&a, "test"); array_push (&a, "ing"); str1 = pop (&a); str2 = pop (&a); printf ("the %s is work%s\n", str2, str1); array_unset (&a);
|
|
Return the number of elements in the array. This expensive can be considered inexpensive. |
|
||||||||||||
|
Access the array member at the supplied index. In effective this is the same as calling:
|
|
||||||||||||
|
Access the elements in the list sequentially with a single function call. This replaces the need to call splice multiple times in order to access incremental values in the list. Example:
|
|
||||||||||||
|
Construct an array a'la PHP. The parameter list is NULL terminated.
|
|
|
Pop an element off the array.
|
|
||||||||||||
|
Push a single element on to the end of the array.
|
|
|
Shift an element off the beginning of the array and return it.
|
|
||||||||||||||||||||||||
|
Splice an array. It's probably best to lookup perldoc -f splice in order to see what inspired this interface. The implementation details may make this interface more clear as well.
|
|
|
Clear all memory used by the array object and set the value at the object's reference to NULL.
|
|
||||||||||||
|
Add a new element to the beginning of the array.
|
1.3.7