Vector
-
struct CowlVector : public CowlObject
Vector of CowlObject elements.
Public Functions
-
CowlVector *cowl_vector(UVec_CowlObjectPtr *vec)
Returns a retained vector.
The equality and hash functions of the vector do not account for the order of its elements.
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.
-
CowlVector *cowl_vector_ordered(UVec_CowlObjectPtr *vec)
Returns a retained vector.
The equality and hash functions of the vector account for the order of its elements.
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.
-
void cowl_vector_release(CowlVector *vec)
Releases the specified vector.
- Parameters
vec – The vector.
-
UVec_CowlObjectPtr const *cowl_vector_get_data(CowlVector *vec)
Returns the underlying raw vector.
- Parameters
vec – The vector.
- Returns
Underlying raw vector.
-
bool cowl_vector_equals(CowlVector *lhs, CowlVector *rhs)
Equality function.
- Parameters
lhs – LHS of the equality relation.
rhs – RHS of the equality relation.
- Returns
True if the equality relation holds, false otherwise.
-
ulib_uint cowl_vector_hash(CowlVector *vec)
Hash function.
- Parameters
vec – The vector.
- Returns
The hash value.
-
bool cowl_vector_iterate_primitives(CowlVector *vec, CowlPrimitiveFlags flags, CowlIterator *iter)
Iterates over the primitives referenced by the specified vector.
- Parameters
vec – The vector.
flags – Iteration flags.
iter – The iterator.
- Returns
True if the iteration was completed, false if it was stopped.
Public Static Functions
-
static inline CowlString *cowl_table_to_string(CowlTable *table)
Returns the string representation of the specified hash table.
Note
The returned string is retained, so you are responsible for releasing it.
- Parameters
table – The hash table.
- Returns
String representation, or NULL on error.
-
static inline CowlVector *cowl_vector_retain(CowlVector *vec)
Retains the specified vector.
- Parameters
vec – The vector.
- Returns
Retained vector.
-
static inline CowlString *cowl_vector_to_string(CowlVector *vec)
Returns the string representation of the specified vector.
Note
The returned string is retained, so you are responsible for releasing it.
- Parameters
vec – The vector.
- Returns
String representation, or NULL on error.
-
cowl_vector_empty()
Returns a retained vector with no elements.
- Returns
[CowlVector*] Retained vector, or NULL on error.
-
cowl_vector_ordered_empty()
Returns a retained vector with no elements.
The equality and hash functions of the vector account for the order of its elements.
- Returns
[CowlVector*] Retained vector, or NULL on error.
-
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.
-
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)