NAME
src/pmc/resizablestringarray.pmc - ResizableStringArray PMC
DESCRIPTION
ResizableStringArray implements a resizeable array which stores Parrot strings only.
Any ints or floats assigned to elements of the array will first be converted to String PMCs and then to native Parrot strings.
PMCs assigned to to elements of the array will be stringified by having their get_string
method called.
Functions
void init_int(INTVAL size)
Initializes the array.
STRING *get_string_keyed_int(INTVAL key)
Returns the Parrot string value of the element at index void set_string_keyed_int(INTVAL key, STRING *value)
Sets the Parrot string value of the element at index void push_string(STRING *value)
Extends the array by adding an element of value STRING *pop_string()
Removes and returns the last element in the array.
PMC *pop_pmc()
Removes and returns the last element in the array.
INTVAL pop_integer()
Removes and returns the last element in the array.
FLOATVAL pop_float()
Removes and returns the last element in the array.
void set_integer_native(INTVAL size)
Resizes the array to PMC *clone()
Creates and returns a copy of the array.
STRING *shift_string()
Removes and returns an item from the start of the array.
INTVAL shift_integer()
Removes and returns the first element in the array.
FLOATVAL shift_float()
Removes and returns the first element in the array.
void push_pmc(PMC *value)
Extends the array by adding an element of value void push_integer(INTVAL value)
Extends the array by adding an element of value void push_float(FLOAT value)
Extends the array by adding an element of value PMC *shift_pmc()
Removes and returns a String PMC from the start of the array.
void unshift_string(STRING *value)
Extends the array by adding an element of value void unshift_pmc(PMC *value)
Extends the array by adding an element of value void unshift_integer(INTVAL value)
Extends the array by adding an element of value void unshift_float(FLOAT value)
Extends the array by adding an element of value void delete_keyed_int(INTVAL key)
Converts void delete_keyed(PMC *key)
Removes the element at void splice(PMC *value, INTVAL offset, INTVAL count)
Replaces - METHOD PMC* shift()
- METHOD PMC* pop() Method forms to remove and return a PMC from the beginning or end of the array.
- METHOD unshift(PMC* value)
- METHOD push(PMC* value) Method forms to add a PMC to the beginning or end of the array.
key
.
key
to value
.
*value
to the end of the array.
size
elements.
*value
to the end of the array.
*value
to the end of the array.
*value
to the end of the array.
*value
to the start of the array.
*value
to the front of the array.
*value
to the front of the array.
*value
to the front of the array.
key
to a PMC key and calls delete_keyed()
with it.
*key
.
count
elements starting at offset
with the elements in value
.Note that the value
PMC can be of any of the various array types.Note that this implementation can be *VERY *inefficient as it manipulates everything via the VTABLE api.
SEE ALSO
docs/pdds/pdd17_basic_types.pod.