19 #define impl_afw_list_get_entry_meta afw_list_impl_get_entry_meta
20 #define impl_afw_list_get_next_entry_meta afw_list_impl_get_next_entry_meta
23 #define AFW_IMPLEMENTATION_ID "memory"
33 typedef struct afw_memory_internal_list_ring_s
34 afw_memory_internal_list_ring_t;
41 APR_RING_HEAD(afw_memory_internal_list_ring_s,
49 afw_memory_internal_list_ring_t *ring;
64 afw_memory_internal_list_ring_t *ring;
73 self->pub.inf = &impl_afw_list_inf;
75 self->data_type = data_type;
76 self->generic = data_type == NULL;
79 self->setter.inf = &impl_afw_list_setter_inf;
144 return self->data_type;
157 const void * *
internal,
199 if (index < 0 || i != index) {
228 const void * *
internal,
236 ep = APR_RING_FIRST(self->ring);
240 ep = APR_RING_NEXT(ep, link);
246 if (ep == APR_RING_SENTINEL(self->ring,
283 ep = APR_RING_FIRST(self->ring);
287 ep = APR_RING_NEXT(ep, link);
291 if (ep == APR_RING_SENTINEL(self->ring,
315 return (self->immutable) ? NULL : &
self->setter;
324 impl_afw_list_setter_set_immutable(
331 self->immutable =
true;
341 impl_afw_list_setter_determine_data_type_and_set_immutable(
350 if (self->immutable) {
351 AFW_LIST_ERROR_OBJECT_IMMUTABLE;
353 self->immutable =
true;
356 if (!self->data_type) {
357 for (ep = APR_RING_FIRST(self->ring);
358 ep != APR_RING_SENTINEL(self->ring,
360 ep = APR_RING_NEXT(ep, link))
362 if (!self->data_type) {
367 if (self->data_type !=
370 self->data_type = NULL;
378 return self->data_type;
387 impl_afw_list_setter_add_internal(
390 const void *
internal,
398 impl_afw_list_setter_add_value(instance, value, xctx);
406 impl_afw_list_setter_add_value(
431 self->data_type = NULL;
436 else if (self->data_type && self->data_type !=
440 "Value data_type is not list's data type.", xctx);
455 impl_afw_list_setter_insert_internal(
458 const void *
internal,
467 impl_afw_list_setter_insert_value(instance, value, index, xctx);
476 impl_afw_list_setter_insert_value(
505 self->data_type = NULL;
510 else if (self->data_type && self->data_type !=
514 "Value data_type is not list's data type.", xctx);
528 if (index == count) {
529 APR_RING_INSERT_BEFORE(lep, nep, link);
545 impl_afw_list_setter_remove_all_values(
558 self->data_type = NULL;
568 impl_afw_list_setter_remove_internal(
571 const void *
internal,
585 internal, data_type->c_type_size) == 0)
587 APR_RING_REMOVE(ep, link);
601 impl_afw_list_setter_remove_value(
615 APR_RING_REMOVE(ep, link);
618 APR_RING_EMPTY(self->ring,
621 self->data_type = NULL;
660 self->data_type = NULL;
665 else if (self->data_type && self->data_type !=
669 "Value data_type is not list's data type.", xctx);
677 if (index == count) {
703 use_data_type = data_type;
706 if (data_type && use_data_type && data_type != use_data_type)
712 if (list)
for (iterator = NULL;;)
747 if (value_data_type != data_type) {
748 old_list = value_list;
750 for (iterator = NULL;;) {
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
Interface afw_interface implementation declares.
Interface afw_interface implementation declares.
afw_data_type_list
Data type struct for list.
struct afw_iterator_s afw_iterator_t
apr_size_t afw_size_t
size_t.
apr_int64_t afw_integer_t
typedef for big signed int.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
impl_afw_list_get_next_value(const afw_list_t *instance, const afw_iterator_t **iterator, const afw_pool_t *p, afw_xctx_t *xctx)
impl_afw_list_get_entry_internal(const afw_list_t *instance, afw_integer_t index, const afw_data_type_t **data_type, const void **internal, afw_xctx_t *xctx)
impl_afw_list_get_data_type(const afw_list_t *instance, afw_xctx_t *xctx)
impl_afw_list_release(const afw_list_t *instance, afw_xctx_t *xctx)
impl_afw_list_get_next_internal(const afw_list_t *instance, const afw_iterator_t **iterator, const afw_data_type_t **data_type, const void **internal, afw_xctx_t *xctx)
impl_afw_list_get_setter(const afw_list_t *instance, afw_xctx_t *xctx)
impl_afw_list_get_count(const afw_list_t *instance, afw_xctx_t *xctx)
impl_afw_list_get_entry_value(const afw_list_t *instance, afw_integer_t index, const afw_pool_t *p, afw_xctx_t *xctx)
#define afw_list_get_next_value(instance, iterator, p, xctx)
Call method get_next_value of interface afw_list.
#define afw_list_get_data_type(instance, xctx)
Call method get_data_type of interface afw_list.
void impl_afw_list_setter_set_value_by_index(const afw_list_setter_t *instance, afw_size_t index, const afw_value_t *value, afw_xctx_t *xctx)
afw_list_create_wrapper_for_array(const void *array, afw_boolean_t indirect, const afw_data_type_t *data_type, afw_size_t count, const afw_pool_t *p, afw_xctx_t *xctx)
Create a immutable list wrapper for an array.
afw_list_create_or_clone(const afw_list_t *list, const afw_data_type_t *data_type, afw_boolean_t clone_values, const afw_pool_t *p, afw_xctx_t *xctx)
Create a clone of a list in memory.
afw_list_of_create_from_value(const afw_data_type_t *data_type, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Create a typed list from a value.
afw_list_add_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method add_value of interface afw_list_setter.
afw_list_create_with_options(int options, const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx)
Create an list in memory with options.
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.
afw_value_equal(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Test whether two values are equal.
afw_value_clone(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Clone a value to specified pool.
const afw_value_t * afw_value_evaluated_create(const void *value, const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for an evaluated data type value.
afw_value_convert(const afw_value_t *value, const afw_data_type_t *to_data_type, afw_boolean_t required, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a value to a value/data type.
#define AFW_VALUE_INTERNAL(_VALUE_)
Macro to get const void * of the internal of a value.
Interface afw_data_type public struct.
Interface afw_list public struct.
Interface afw_list_setter public struct.
Interface afw_pool public struct.
Struct to access internal of all evaluated values.
struct for data type list values.
Interface afw_value public struct.
Interface afw_xctx public struct.