Vector
-
struct CowlVector : public CowlObject
Vector of CowlObject elements.
Public Functions
-
CowlVector *cowl_vector(UVec_CowlObjectPtr *vec)
Returns a retained vector.
Note
You must not use the raw vector after passing it to this function.
- Parameters
vec – Underlying raw vector.
- Returns
Retained vector, or NULL on error.
-
UVec_CowlObjectPtr const *cowl_vector_get_data(CowlVector *vec)
Returns the underlying raw vector.
- Parameters
vec – The vector.
- Returns
Underlying raw vector.
Public Static Functions
-
static inline ulib_uint cowl_vector_count(CowlVector *vec)
Returns the number of elements in the vector.
- Parameters
vec – The vector.
- Returns
Number of elements in the vector.
-
static inline CowlAny *cowl_vector_get_item(CowlVector *vec, ulib_uint idx)
Returns the element at the specified index.
- Parameters
vec – The vector.
idx – The index.
- Returns
The element at the specified index.
-
static inline bool cowl_vector_contains(CowlVector *vec, CowlAny *object)
Checks whether the vector contains the specified element.
- Parameters
vec – The vector.
object – The object.
- Returns
True if the vector contains the specified element, false otherwise.
-
cowl_vector_empty()
Returns a retained vector with no elements.
- Returns
[CowlVector*] Retained vector, or NULL on error.
-
cowl_vector_foreach(vec, obj)
Iterates over the vector, executing the specified code block for each element.
- Parameters
vec – [CowlVector *] The vector.
obj – [symbol] Name of the variable holding the current item and its index.
-
CowlVector *cowl_vector(UVec_CowlObjectPtr *vec)