VuoList interface.
Definition in file VuoList_VuoTree.h.
Go to the source code of this file.
Classes | |
struct | VuoList_VuoTree |
An ordered list of items, all of the same type. More... | |
Functions | |
VuoList_VuoTree | VuoListCreate_VuoTree (void) |
Creates a new list of VuoTree items. | |
VuoList_VuoTree | VuoListCreateWithCount_VuoTree (const unsigned long count, const VuoTree value) |
Creates a new list of count instances of value. | |
VuoList_VuoTree | VuoListCreateWithValueArray_VuoTree (const VuoTree *values, const unsigned long valueCount) |
Creates a new list containing the items in the C array values. | |
VuoList_VuoTree | VuoListCopy_VuoTree (const VuoList_VuoTree list) |
Makes a shallow copy of list — its items are retained (not copied) by the new list. | |
VuoTree | VuoListGetValue_VuoTree (const VuoList_VuoTree list, const unsigned long index) |
Returns the item at index. | |
VuoTree * | VuoListGetData_VuoTree (const VuoList_VuoTree list) |
Returns a pointer to a C array containing the list items. | |
void | VuoListForeach_VuoTree (const VuoList_VuoTree list, bool(^function)(const VuoTree value)) |
Applies function to each item in list, serially in order of index. | |
void | VuoListSetValue_VuoTree (const VuoList_VuoTree list, const VuoTree value, const unsigned long index, bool expandListIfNeeded) |
Changes the item at index. | |
void | VuoListInsertValue_VuoTree (const VuoList_VuoTree list, const VuoTree value, const unsigned long index) |
Inserts value immediately before index. | |
void | VuoListPrependValue_VuoTree (VuoList_VuoTree list, const VuoTree value) |
Prepends value to list. | |
void | VuoListAppendValue_VuoTree (VuoList_VuoTree list, const VuoTree value) |
Appends value to list. | |
void | VuoListExchangeValues_VuoTree (VuoList_VuoTree list, const unsigned long indexA, const unsigned long indexB) |
Swaps the value at indexA with the value at indexB. | |
void | VuoListShuffle_VuoTree (VuoList_VuoTree list, const double chaos) |
Generates a random permutation of list. | |
void | VuoListReverse_VuoTree (VuoList_VuoTree list) |
Reverses the order of the items in list. | |
VuoList_VuoTree | VuoListSubset_VuoTree (VuoList_VuoTree list, const signed long startIndex, const unsigned long itemCount) |
Returns a new list containing items from the original list in the range specified by startIndex and itemCount. | |
void | VuoListRemoveFirstValue_VuoTree (VuoList_VuoTree list) |
Removes the first item from list. | |
void | VuoListRemoveLastValue_VuoTree (VuoList_VuoTree list) |
Removes the last item from list. | |
void | VuoListRemoveAll_VuoTree (VuoList_VuoTree list) |
Removes all items from list. | |
void | VuoListRemoveValue_VuoTree (VuoList_VuoTree list, const unsigned long index) |
Removes the item at index. | |
unsigned long | VuoListGetCount_VuoTree (const VuoList_VuoTree list) |
Returns the number of items in list. | |
VuoList_VuoTree | VuoList_VuoTree_makeFromJson (struct json_object *js) |
Decodes the JSON object js to create a new list. | |
struct json_object * | VuoList_VuoTree_getJson (const VuoList_VuoTree list) |
Encodes list as a JSON object. | |
char * | VuoList_VuoTree_getSummary (const VuoList_VuoTree list) |
Produces a brief human-readable summary of list . | |
void | VuoList_VuoTree_retain (VuoList_VuoTree list) |
Retains the list. | |
void | VuoList_VuoTree_release (VuoList_VuoTree list) |
Releases the list. | |
char * | VuoList_VuoTree_getString (const VuoList_VuoTree list) |
Automatically generated function. | |
struct json_object * VuoList_VuoTree_getJson | ( | const VuoList_VuoTree | list | ) |
Encodes list as a JSON object.
char * VuoList_VuoTree_getString | ( | const VuoList_VuoTree | list | ) |
Automatically generated function.
char * VuoList_VuoTree_getSummary | ( | const VuoList_VuoTree | list | ) |
Produces a brief human-readable summary of list
.
VuoList_VuoTree VuoList_VuoTree_makeFromJson | ( | struct json_object * | js | ) |
Decodes the JSON object js to create a new list.
void VuoList_VuoTree_release | ( | VuoList_VuoTree | list | ) |
Releases the list.
This function is provided for use in polymorphism; it just calls VuoRelease()
.
void VuoList_VuoTree_retain | ( | VuoList_VuoTree | list | ) |
Retains the list.
This function is provided for use in polymorphism; it just calls VuoRetain()
.
void VuoListAppendValue_VuoTree | ( | VuoList_VuoTree | list, |
const VuoTree | value | ||
) |
Appends value to list.
VuoList_VuoTree VuoListCopy_VuoTree | ( | const VuoList_VuoTree | list | ) |
Makes a shallow copy of list — its items are retained (not copied) by the new list.
VuoList_VuoTree VuoListCreate_VuoTree | ( | void | ) |
Creates a new list of VuoTree
items.
VuoList_VuoTree VuoListCreateWithCount_VuoTree | ( | const unsigned long | count, |
const VuoTree | value | ||
) |
Creates a new list of count instances of value.
Use this in conjunction with VuoListGetData_VuoTree to quickly initialize a large list.
VuoList_VuoTree VuoListCreateWithValueArray_VuoTree | ( | const VuoTree * | values, |
const unsigned long | valueCount | ||
) |
Creates a new list containing the items in the C array values.
The list retains each item in values. The caller may discard values after this function returns.
void VuoListExchangeValues_VuoTree | ( | VuoList_VuoTree | list, |
const unsigned long | indexA, | ||
const unsigned long | indexB | ||
) |
Swaps the value at indexA with the value at indexB.
void VuoListForeach_VuoTree | ( | const VuoList_VuoTree | list, |
bool(^)(const VuoTree value) | function | ||
) |
Applies function to each item in list, serially in order of index.
If function returns false, visiting will stop immediately (possibly before all items have been visited).
unsigned long VuoListGetCount_VuoTree | ( | const VuoList_VuoTree | list | ) |
Returns the number of items in list.
VuoTree * VuoListGetData_VuoTree | ( | const VuoList_VuoTree | list | ) |
Returns a pointer to a C array containing the list items.
Use this if you need a fast way to get or change multiple list items.
You can modify values in the list by changing them in this array. Just don't attempt to access beyond the list size.
The pointer becomes invalid if you modify the list size using other functions (e.g., Insert, Prepend, Append, Cut, Remove); if you use those functions, just get a new pointer by calling this function again.
If the list has no items, returns NULL.
The pointer remains owned by the list; don't free it.
VuoTree VuoListGetValue_VuoTree | ( | const VuoList_VuoTree | list, |
const unsigned long | index | ||
) |
Returns the item at index.
Index values start at 1.
If the list has no items, returns a default value (an empty/zero value of VuoTree
).
Attempting to access an out-of-bounds index returns the first item in the list (if the index is 0), or last item in the list (if the index is greater than the list size).
If iterating over an entire list, consider using VuoListGetData_VuoTree or VuoListForeach_VuoTree.
void VuoListInsertValue_VuoTree | ( | const VuoList_VuoTree | list, |
const VuoTree | value, | ||
const unsigned long | index | ||
) |
Inserts value immediately before index.
Index values start at 1.
Inserting at index 0 prepends the value to the list. Inserting at an index beyond the last value in the list appends the value to the list.
void VuoListPrependValue_VuoTree | ( | VuoList_VuoTree | list, |
const VuoTree | value | ||
) |
Prepends value to list.
void VuoListRemoveAll_VuoTree | ( | VuoList_VuoTree | list | ) |
Removes all items from list.
void VuoListRemoveFirstValue_VuoTree | ( | VuoList_VuoTree | list | ) |
Removes the first item from list.
void VuoListRemoveLastValue_VuoTree | ( | VuoList_VuoTree | list | ) |
Removes the last item from list.
void VuoListRemoveValue_VuoTree | ( | VuoList_VuoTree | list, |
const unsigned long | index | ||
) |
Removes the item at index.
Index values start at 1.
Attempting to remove index 0 or an index beyond the last value in the list has no effect.
void VuoListReverse_VuoTree | ( | VuoList_VuoTree | list | ) |
Reverses the order of the items in list.
void VuoListSetValue_VuoTree | ( | const VuoList_VuoTree | list, |
const VuoTree | value, | ||
const unsigned long | index, | ||
bool | expandListIfNeeded | ||
) |
Changes the item at index.
Index values start at 1.
If expandListIfNeeded is false — If the list has no items, nothing is changed. Attempting to change an out-of-bounds index changes the first item in the list (if the index is 0), or last item in the list (if the index is greater than the list size).
If expandListIfNeeded is true — If the list has less than index items, it is expanded to accommodate the specified index. If index is 0, the list is resized to contain 1 item set to value.
void VuoListShuffle_VuoTree | ( | VuoList_VuoTree | list, |
const double | chaos | ||
) |
Generates a random permutation of list.
chaos ranges from 0 to 1. When chaos is 1, a full Fisher–Yates shuffle is performed. When less than 1, fewer iterations are performed.
VuoList_VuoTree VuoListSubset_VuoTree | ( | VuoList_VuoTree | list, |
const signed long | startIndex, | ||
const unsigned long | itemCount | ||
) |
Returns a new list containing items from the original list in the range specified by startIndex and itemCount.
Items in the new list are retained (not copied) from the original list.