PROP_ARRAY_UTIL(3)

PROP_ARRAY_UTIL(3) | Library Functions Manual | PROP_ARRAY_UTIL(3)

# NAME

`prop_array_util`, `prop_array_get_bool`, `prop_array_set_bool`, `prop_array_get_schar`, `prop_array_get_uchar`, `prop_array_set_schar`, `prop_array_set_uchar`, `prop_array_get_short`, `prop_array_get_ushort`, `prop_array_set_short`, `prop_array_set_ushort`, `prop_array_get_int`, `prop_array_get_uint`, `prop_array_set_int`, `prop_array_set_uint`, `prop_array_get_long`, `prop_array_get_ulong`, `prop_array_set_long`, `prop_array_set_ulong`, `prop_array_get_longlong`, `prop_array_get_ulonglong`, `prop_array_set_longlong`, `prop_array_set_ulonglong`, `prop_array_get_intptr`, `prop_array_get_uintptr`, `prop_array_set_intptr`, `prop_array_set_uintptr`, `prop_array_get_int8`, `prop_array_get_uint8`, `prop_array_set_int8`, `prop_array_set_uint8`, `prop_array_get_int16`, `prop_array_get_uint16`, `prop_array_set_int16`, `prop_array_set_uint16`, `prop_array_get_int32`, `prop_array_get_uint32`, `prop_array_set_int32`, `prop_array_set_uint32`, `prop_array_get_int64`, `prop_array_get_uint64`, `prop_array_set_int64`, `prop_array_set_uint64`, `prop_array_get_data`, `prop_array_set_data`, `prop_array_set_data_nocopy`, `prop_array_get_string`, `prop_array_set_string`, `prop_array_set_string_nocopy`, `prop_array_add_schar`, `prop_array_add_uchar`, `prop_array_add_short`, `prop_array_add_ushort`, `prop_array_add_int`, `prop_array_add_uint`, `prop_array_add_long`, `prop_array_add_ulong`, `prop_array_add_longlong`, `prop_array_add_ulonglong`, `prop_array_add_intptr`, `prop_array_add_uintptr`, `prop_array_add_int8`, `prop_array_add_uint8`, `prop_array_add_int16`, `prop_array_add_uint16`, `prop_array_add_int32`, `prop_array_add_uint32`, `prop_array_add_int64`, `prop_array_add_uint64`, `prop_array_add_data`, `prop_array_add_data_nocopy`, `prop_array_add_string`, `prop_array_add_string_nocopy`, `prop_array_add_and_rel` —
array property collection object utility functions

# LIBRARY

Property Container Object Library (libprop, -lprop)

# SYNOPSIS

`#include <prop/proplib.h>`

bool
`prop_array_get_bool`(prop_array_t array, unsigned int indx, bool *valp);

bool
`prop_array_set_bool`(prop_array_t array, unsigned int indx, bool val);

bool
`prop_array_get_schar`(prop_array_t array, unsigned int indx, signed char *valp);

bool
`prop_array_get_uchar`(prop_array_t array, unsigned int indx, unsigned char *valp);

bool
`prop_array_set_schar`(prop_array_t array, unsigned int indx, signed char val);

bool
`prop_array_set_uchar`(prop_array_t array, unsigned int indx, unsigned char val);

bool
`prop_array_get_short`(prop_array_t array, unsigned int indx, short *valp);

bool
`prop_array_get_ushort`(prop_array_t array, unsigned int indx, unsigned short *valp);

bool
`prop_array_set_short`(prop_array_t array, unsigned int indx, short val);

bool
`prop_array_set_ushort`(prop_array_t array, unsigned int indx, unsigned short val);

bool
`prop_array_get_int`(prop_array_t array, unsigned int indx, int *valp);

bool
`prop_array_get_uint`(prop_array_t array, unsigned int indx, unsigned int *valp);

bool
`prop_array_set_int`(prop_array_t array, unsigned int indx, int val);

bool
`prop_array_set_uint`(prop_array_t array, unsigned int indx, unsigned int val);

bool
`prop_array_get_long`(prop_array_t array, unsigned int indx, long *valp);

bool
`prop_array_get_ulong`(prop_array_t array, unsigned int indx, unsigned long *valp);

bool
`prop_array_set_long`(prop_array_t array, unsigned int indx, long val);

bool
`prop_array_set_ulong`(prop_array_t array, unsigned int indx, unsigned long val);

bool
`prop_array_get_longlong`(prop_array_t array, unsigned int indx, long long *valp);

bool
`prop_array_get_ulonglong`(prop_array_t array, unsigned int indx, unsigned long long *valp);

bool
`prop_array_set_longlong`(prop_array_t array, unsigned int indx, long long val);

bool
`prop_array_set_ulonglong`(prop_array_t array, unsigned int indx, unsigned long long val);

bool
`prop_array_get_intptr`(prop_array_t array, unsigned int indx, intptr_t *valp);

bool
`prop_array_get_uintptr`(prop_array_t array, unsigned int indx, uintptr_t *valp);

bool
`prop_array_set_intptr`(prop_array_t array, unsigned int indx, intptr_t val);

bool
`prop_array_set_uintptr`(prop_array_t array, unsigned int indx, uintptr_t val);

bool
`prop_array_get_int8`(prop_array_t array, unsigned int indx, int8_t *valp);

bool
`prop_array_get_uint8`(prop_array_t array, unsigned int indx, uint8_t *valp);

bool
`prop_array_set_int8`(prop_array_t array, unsigned int indx, int8_t val);

bool
`prop_array_set_uint8`(prop_array_t array, unsigned int indx, uint8_t val);

bool
`prop_array_get_int16`(prop_array_t array, unsigned int indx, int16_t *valp);

bool
`prop_array_get_uint16`(prop_array_t array, unsigned int indx, uint16_t *valp);

bool
`prop_array_set_int16`(prop_array_t array, unsigned int indx, int16_t val);

bool
`prop_array_set_uint16`(prop_array_t array, unsigned int indx, uint16_t val);

bool
`prop_array_get_int32`(prop_array_t array, unsigned int indx, int32_t *valp);

bool
`prop_array_get_uint32`(prop_array_t array, unsigned int indx, uint32_t *valp);

bool
`prop_array_set_int32`(prop_array_t array, unsigned int indx, int32_t val);

bool
`prop_array_set_uint32`(prop_array_t array, unsigned int indx, uint32_t val);

bool
`prop_array_get_int64`(prop_array_t array, unsigned int indx, int64_t *valp);

bool
`prop_array_get_uint64`(prop_array_t array, unsigned int indx, uint64_t *valp);

bool
`prop_array_set_int64`(prop_array_t array, unsigned int indx, int64_t val);

bool
`prop_array_set_uint64`(prop_array_t array, unsigned int indx, uint64_t val);

bool
`prop_array_get_data`(prop_array_t array, unsigned int indx, const void **datap, size_t *sizep);

bool
`prop_array_set_data`(prop_array_t array, unsigned int indx, const void *data, size_t len);

bool
`prop_array_set_data_nocopy`(prop_array_t array, unsigned int indx, const void *data, size_t len);

bool
`prop_array_get_string`(prop_array_t array, unsigned int indx, const char **strp);

bool
`prop_array_set_string`(prop_array_t array, unsigned int indx, const char *str);

bool
`prop_array_set_string_nocopy`(prop_array_t array, unsigned int indx, const char *str);

bool
`prop_array_set_and_rel`(prop_array_t array, unsigned int indx, prop_object_t obj);

bool
`prop_array_add_bool`(prop_array_t array, bool val);

bool
`prop_array_add_schar`(prop_array_t array, signed char val);

bool
`prop_array_add_uchar`(prop_array_t array, unsigned char val);

bool
`prop_array_add_short`(prop_array_t array, short val);

bool
`prop_array_add_ushort`(prop_array_t array, unsigned short val);

bool
`prop_array_add_int`(prop_array_t array, int val);

bool
`prop_array_add_uint`(prop_array_t array, unsigned int val);

bool
`prop_array_add_long`(prop_array_t array, long val);

bool
`prop_array_add_ulong`(prop_array_t array, unsigned long val);

bool
`prop_array_add_longlong`(prop_array_t array, long long val);

bool
`prop_array_add_ulonglong`(prop_array_t array, unsigned long long val);

bool
`prop_array_add_intptr`(prop_array_t array, intptr_t val);

bool
`prop_array_add_uintptr`(prop_array_t array, uintptr_t val);

bool
`prop_array_add_int8`(prop_array_t array, int8_t val);

bool
`prop_array_add_uint8`(prop_array_t array, uint8_t val);

bool
`prop_array_add_int16`(prop_array_t array, int16_t val);

bool
`prop_array_add_uint16`(prop_array_t array, uint16_t val);

bool
`prop_array_add_int32`(prop_array_t array, int32_t val);

bool
`prop_array_add_uint32`(prop_array_t array, uint32_t val);

bool
`prop_array_add_int64`(prop_array_t array, int64_t val);

bool
`prop_array_add_uint64`(prop_array_t array, uint64_t val);

bool
`prop_array_add_data`(prop_array_t array, const void *data, size_t len);

bool
`prop_array_add_data_nocopy`(prop_array_t array, const char *data, size_t len);

bool
`prop_array_add_string`(prop_array_t array, const char *str);

bool
`prop_array_add_string_nocopy`(prop_array_t array, const char *str);

bool
`prop_array_add_and_rel`(prop_array_t array, prop_object_t obj);

# DESCRIPTION

The `prop_array_util` family of functions are provided to make getting and setting values in arrays more convenient in some applications.

The getters check the type of the returned object and, in some cases, also ensure that the returned value is within the range implied by the getter's value type.

The setters and addders handle object creation and release for the caller.

If the sizep argument to `prop_array_get_data`() is not `NULL`, then it will be set to the size of the returned data.

The `prop_array_get_data`(), `prop_array_set_data_nocopy`(), and `prop_array_add_data_nocopy`() do not copy the data that is set or returned. See prop_data(3) for more informtaion.

The `prop_array_get_string`(), `prop_array_set_string_nocopy`(), and `prop_array_add_string_nocopy`() do not copy the string that is set or returned. See prop_string(3) for more information. The `prop_array_set_and_rel`() and `prop_array_add_and_rel`() functions add the object to the array and release it. The object is always released, even if adding it to the array fails.

# RETURN VALUES

The `prop_array_util` getter functions return `true` if the object exists in the array and the value is in-range, or `false` otherwise.

The `prop_array_util` setter and adder functions return `true` if creating the object and storing it in the array is successful, or `false` otherwise.

# SEE ALSO

prop_array(3), prop_bool(3), prop_data(3), prop_number(3), prop_string(3), proplib(3)

# HISTORY

The proplib(3) property container object library first appeared in NetBSD 4.0.

June 2, 2020 | NetBSD 10.0