All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Fields | Private Attributes | Related Functions
as_list Struct Reference

Detailed Description

as_list is an interface for List based data types.

Implementations:

Definition at line 59 of file as_list.h.

#include "as_list.h"

+ Inheritance diagram for as_list:
+ Collaboration diagram for as_list:

Data Fields

void * data
 
struct as_list_hooks_s * hooks
 
- Data Fields inherited from as_val
cf_atomic32 count
 
bool free
 
enum as_val_t type
 

Private Attributes

as_val _
 

Related Functions

(Note that these are not member functions.)

static int as_list_append (as_list *list, as_val *value)
 
static int as_list_append_bytes (as_list *list, as_bytes *value)
 
static int as_list_append_int64 (as_list *list, int64_t value)
 
static int as_list_append_integer (as_list *list, as_integer *value)
 
static int as_list_append_list (as_list *list, as_list *value)
 
static int as_list_append_map (as_list *list, struct as_map_s *value)
 
static int as_list_append_str (as_list *list, const char *value)
 
static int as_list_append_string (as_list *list, as_string *value)
 
as_listas_list_cons (as_list *list, bool free, void *data, const as_list_hooks *hooks)
 
static void as_list_destroy (as_list *list)
 
static as_listas_list_drop (const as_list *list, uint32_t n)
 
static bool as_list_foreach (const as_list *list, as_list_foreach_callback callback, void *udata)
 
static as_listas_list_fromval (as_val *v)
 
static as_valas_list_get (const as_list *list, const uint32_t i)
 
static as_bytesas_list_get_bytes (const as_list *list, const uint32_t i)
 
static int64_t as_list_get_int64 (const as_list *list, const uint32_t i)
 
static as_integeras_list_get_integer (const as_list *list, const uint32_t i)
 
static as_listas_list_get_list (const as_list *list, const uint32_t i)
 
static struct as_map_s * as_list_get_map (const as_list *list, const uint32_t i)
 
static char * as_list_get_str (const as_list *list, const uint32_t i)
 
static as_stringas_list_get_string (const as_list *list, const uint32_t i)
 
static uint32_t as_list_hashcode (as_list *list)
 
static as_valas_list_head (const as_list *list)
 
as_listas_list_init (as_list *list, void *data, const as_list_hooks *hooks)
 
static union as_list_iterator_u * as_list_iterator_init (union as_list_iterator_u *it, const as_list *list)
 
static union as_list_iterator_u * as_list_iterator_new (const as_list *list)
 
as_listas_list_new (void *data, const as_list_hooks *hooks)
 
static int as_list_prepend (as_list *list, as_val *value)
 
static int as_list_prepend_bytes (as_list *list, as_bytes *value)
 
static int as_list_prepend_int64 (as_list *list, int64_t value)
 
static int as_list_prepend_integer (as_list *list, as_integer *value)
 
static int as_list_prepend_list (as_list *list, as_list *value)
 
static int as_list_prepend_map (as_list *list, struct as_map_s *value)
 
static int as_list_prepend_str (as_list *list, const char *value)
 
static int as_list_prepend_string (as_list *list, as_string *value)
 
static int as_list_set (as_list *list, const uint32_t i, as_val *value)
 
static int as_list_set_bytes (as_list *list, const uint32_t i, as_bytes *value)
 
static int as_list_set_int64 (as_list *list, const uint32_t i, int64_t value)
 
static int as_list_set_integer (as_list *list, const uint32_t i, as_integer *value)
 
static int as_list_set_list (as_list *list, const uint32_t i, as_list *value)
 
static int as_list_set_map (as_list *list, const uint32_t i, struct as_map_s *value)
 
static int as_list_set_str (as_list *list, const uint32_t i, const char *value)
 
static int as_list_set_string (as_list *list, const uint32_t i, as_string *value)
 
static uint32_t as_list_size (as_list *list)
 
static as_listas_list_tail (const as_list *list)
 
static as_listas_list_take (const as_list *list, uint32_t n)
 
static as_valas_list_toval (as_list *list)
 

Friends And Related Function Documentation

static int as_list_append ( as_list list,
as_val value 
)
related

Append a value to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 733 of file as_list.h.

static int as_list_append_bytes ( as_list list,
as_bytes value 
)
related

Append an as_bytes to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 803 of file as_list.h.

static int as_list_append_int64 ( as_list list,
int64_t  value 
)
related

Append an int64_t to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 747 of file as_list.h.

static int as_list_append_integer ( as_list list,
as_integer value 
)
related

Append an as_integer to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 775 of file as_list.h.

static int as_list_append_list ( as_list list,
as_list value 
)
related

Append an as_list to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 817 of file as_list.h.

static int as_list_append_map ( as_list list,
struct as_map_s *  value 
)
related

Append an as_map to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 831 of file as_list.h.

static int as_list_append_str ( as_list list,
const char *  value 
)
related

Append a NULL-terminated string to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 761 of file as_list.h.

static int as_list_append_string ( as_list list,
as_string value 
)
related

Append an as_string to the list.

Parameters
listThe list.
valueThe value to append to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 789 of file as_list.h.

as_list * as_list_cons ( as_list list,
bool  free,
void *  data,
const as_list_hooks hooks 
)
related

Utilized by subtypes of as_list to initialize the parent.

Parameters
listThe list to initialize.
freeIf true, then as_list_destroy() will free the list.
dataData for the list.
hooksImplementaton for the list interface.
Returns
On success, the initialized list. Otherwise NULL.
static void as_list_destroy ( as_list list)
related

Destroy the list and associated resources.

Parameters
listThe list to destroy.

Definition at line 384 of file as_list.h.

static as_list * as_list_drop ( const as_list list,
uint32_t  n 
)
related

Create a new list containing all elements, except the first n elements, of the list.

Parameters
listThe list to drop elements from.
nThe number of elements to drop.
Returns
On success, a new list containing the remaining elements. Otherwise NULL.

Definition at line 458 of file as_list.h.

static bool as_list_foreach ( const as_list list,
as_list_foreach_callback  callback,
void *  udata 
)
related

Call the callback function for each element in the list..

Parameters
listThe list to iterate over.
callbackThe callback function call for each element.
udataUser-data to send to the callback.
Returns
true if iteration completes fully. false if iteration was aborted.

Definition at line 967 of file as_list.h.

static as_list * as_list_fromval ( as_val v)
related

Convert from an as_val.

Definition at line 1017 of file as_list.h.

static as_val * as_list_get ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_val.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 490 of file as_list.h.

static as_bytes * as_list_get_bytes ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_val.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 560 of file as_list.h.

static int64_t as_list_get_int64 ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an int64_t.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 504 of file as_list.h.

static as_integer * as_list_get_integer ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_integer.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 532 of file as_list.h.

static as_list * as_list_get_list ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_val.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 574 of file as_list.h.

static struct as_map_s * as_list_get_map ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_val.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 589 of file as_list.h.

static char * as_list_get_str ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an NULL terminated string.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 518 of file as_list.h.

static as_string * as_list_get_string ( const as_list list,
const uint32_t  i 
)
related

Get the value at specified index as an as_val.

Parameters
listThe list to get the value from.
iThe index of the value to get from the list.
Returns
On success, the value at the given index. Otherwise NULL.

Definition at line 546 of file as_list.h.

static uint32_t as_list_hashcode ( as_list list)
related

Get the hashcode value for the list.

Parameters
listThe list.
Returns
The hashcode of the list.

Definition at line 401 of file as_list.h.

static as_val * as_list_head ( const as_list list)
related

The first element in the list.

Parameters
listThe list to get the head value from.
Returns
The first value of the list on success. Otherwise NULL.

Definition at line 431 of file as_list.h.

as_list * as_list_init ( as_list list,
void *  data,
const as_list_hooks hooks 
)
related

Initialize a stack allocated list.

Parameters
listStack allocated list to initialize.
dataData for the list.
hooksImplementaton for the list interface.
Returns
On succes, the initialized list. Otherwise NULL.
static union as_list_iterator_u * as_list_iterator_init ( union as_list_iterator_u *  it,
const as_list list 
)
related

Initializes a stack allocated iterator over the given list.

Parameters
listThe list to iterate.
itThe iterator to initialize.
Returns
On success, the initializes as_iterator. Otherwise NULL.

Definition at line 995 of file as_list.h.

static union as_list_iterator_u * as_list_iterator_new ( const as_list list)
related

Creates and initializes a new heap allocated iterator over the given list.

Parameters
listThe list to iterate.
Returns
On success, a new as_iterator. Otherwise NULL.

Definition at line 980 of file as_list.h.

as_list * as_list_new ( void *  data,
const as_list_hooks hooks 
)
related

Create and initialize a new heap allocated list.

Parameters
dataData for the list.
hooksImplementaton for the list interface.
Returns
On succes, a new list. Otherwise NULL.
static int as_list_prepend ( as_list list,
as_val value 
)
related

Prepend a value to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 849 of file as_list.h.

static int as_list_prepend_bytes ( as_list list,
as_bytes value 
)
related

Prepend an as_bytes to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 919 of file as_list.h.

static int as_list_prepend_int64 ( as_list list,
int64_t  value 
)
related

Prepend an int64_t value to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 863 of file as_list.h.

static int as_list_prepend_integer ( as_list list,
as_integer value 
)
related

Prepend an as_integer to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 891 of file as_list.h.

static int as_list_prepend_list ( as_list list,
as_list value 
)
related

Prepend an as_list to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 933 of file as_list.h.

static int as_list_prepend_map ( as_list list,
struct as_map_s *  value 
)
related

Prepend an as_map to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 947 of file as_list.h.

static int as_list_prepend_str ( as_list list,
const char *  value 
)
related

Prepend a NULL-terminated string to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 877 of file as_list.h.

static int as_list_prepend_string ( as_list list,
as_string value 
)
related

Prepend an as_string to the list.

Parameters
listThe list.
valueThe value to prepend to the list.
Returns
0 on success. Otherwise an error occurred.

Definition at line 905 of file as_list.h.

static int as_list_set ( as_list list,
const uint32_t  i,
as_val value 
)
related

Set the value at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 610 of file as_list.h.

static int as_list_set_bytes ( as_list list,
const uint32_t  i,
as_bytes value 
)
related

Set an as_bytes at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 685 of file as_list.h.

static int as_list_set_int64 ( as_list list,
const uint32_t  i,
int64_t  value 
)
related

Set an int64_t at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 625 of file as_list.h.

static int as_list_set_integer ( as_list list,
const uint32_t  i,
as_integer value 
)
related

Set an as_integer at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error ocucrred.

Definition at line 655 of file as_list.h.

static int as_list_set_list ( as_list list,
const uint32_t  i,
as_list value 
)
related

Set an as_list at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 700 of file as_list.h.

static int as_list_set_map ( as_list list,
const uint32_t  i,
struct as_map_s *  value 
)
related

Set an as_map at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 715 of file as_list.h.

static int as_list_set_str ( as_list list,
const uint32_t  i,
const char *  value 
)
related

Set a NULL-terminated string at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 640 of file as_list.h.

static int as_list_set_string ( as_list list,
const uint32_t  i,
as_string value 
)
related

Set an as_string at specified index as an as_val.

Parameters
listThe list.
iThe index of the value to set in the list.
valueThe value to set at the given index.
Returns
0 on success. Otherwise an error occurred.

Definition at line 670 of file as_list.h.

static uint32_t as_list_size ( as_list list)
related

Number of elements in the list.

Parameters
listThe list.
Returns
The size of the list.

Definition at line 414 of file as_list.h.

static as_list * as_list_tail ( const as_list list)
related

All elements after the first element in the list.

Parameters
listThe list to get the tail from.
Returns
On success, the tail of the list. Otherwise NULL.

Definition at line 444 of file as_list.h.

static as_list * as_list_take ( const as_list list,
uint32_t  n 
)
related

Creates a new list containing the first n elements of the list.

Parameters
listThe list to drop elements from.
nThe number of elements to take.
Returns
On success, a new list containing the selected elements. Otherwise NULL.

Definition at line 472 of file as_list.h.

static as_val * as_list_toval ( as_list list)
related

Convert to an as_val.

Definition at line 1008 of file as_list.h.

Field Documentation

as_val as_list::_
private

as_list is a subtype of as_val. You can cast as_list to as_val.

Definition at line 66 of file as_list.h.

void* as_list::data

Pointer to the data for this list.

Definition at line 71 of file as_list.h.

struct as_list_hooks_s* as_list::hooks

Hooks for subtypes of as_list to implement.

Definition at line 76 of file as_list.h.


The documentation for this struct was generated from the following file: