libcollection  0.6.0
Functions
Add properties with reference

Functions

int col_add_str_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, char *string, int length, struct collection_item **ret_ref)
 Add a string property to a collection. More...
 
int col_add_binary_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, void *binary_data, int length, struct collection_item **ret_ref)
 Add a binary property to a collection. More...
 
int col_add_int_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, int32_t number, struct collection_item **ret_ref)
 Add an integer property to a collection. More...
 
int col_add_unsigned_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, uint32_t number, struct collection_item **ret_ref)
 Add an unsigned integer property to a collection. More...
 
int col_add_long_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, int64_t number, struct collection_item **ret_ref)
 Add an long property to a collection. More...
 
int col_add_ulong_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, uint64_t number, struct collection_item **ret_ref)
 Add an unsigned long property to a collection. More...
 
int col_add_double_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, double number, struct collection_item **ret_ref)
 Add a property of type double to a collection. More...
 
int col_add_bool_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, unsigned char logical, struct collection_item **ret_ref)
 Add a Boolean property to a collection. More...
 
int col_add_any_property_with_ref (struct collection_item *ci, const char *subcollection, const char *property, int type, void *data, int length, struct collection_item **ret_ref)
 Add a property of a specified type to a collection. More...
 

Detailed Description

Family of functions that add properties to a collection and return reference to an item that holds a newly created property.

All the functions in this section append a property of the specified type to the collection object.

Parameters for the functions and return values are the same as for the col_add_xxx_property functions. The only difference is that these functions have one additional argument:

Parameters
[out]ret_refReference to the newly added item that holds the property.

Function Documentation

int col_add_str_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
char *  string,
int  length,
struct collection_item **  ret_ref 
)

Add a string property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]stringNull terminated string to add.
[in]lengthLength of the string. Should include the length of the terminating 0. If the length is shorter than the full string the string will be truncated. If the length is longer than the actual string there might be garbage at end of the actual string. Library will always properly NULL terminate the string at the given position dictated by length but in no way will inspect the validity of the passed in data. This is left to the calling application.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_binary_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
void *  binary_data,
int  length,
struct collection_item **  ret_ref 
)

Add a binary property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]binary_dataData to add.
[in]lengthLength of the data.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_int_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
int32_t  number,
struct collection_item **  ret_ref 
)

Add an integer property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberInteger value to add. Value is signed.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_unsigned_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
uint32_t  number,
struct collection_item **  ret_ref 
)

Add an unsigned integer property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberUnsigned integer value to add.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_long_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
int64_t  number,
struct collection_item **  ret_ref 
)

Add an long property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberLong integer value to add. Value is signed.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_ulong_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
uint64_t  number,
struct collection_item **  ret_ref 
)

Add an unsigned long property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberUnsigned long integer value to add.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_double_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
double  number,
struct collection_item **  ret_ref 
)

Add a property of type double to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberFloating point value.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_bool_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
unsigned char  logical,
struct collection_item **  ret_ref 
)

Add a Boolean property to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]logicalBoolean value. 0 - false, nonzero - true.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.
int col_add_any_property_with_ref ( struct collection_item ci,
const char *  subcollection,
const char *  property,
int  type,
void *  data,
int  length,
struct collection_item **  ret_ref 
)

Add a property of a specified type to a collection.

Parameters
[in]ciRoot collection object.
[in]subcollectionName of the inner collection to add property to. If NULL the property is added to the root collection.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]typeSee type definitions here.
[in]dataData to add.
[in]lengthLength of the data.
[out]ret_refReference to the newly added item that holds the property.
Returns
0 - Property was added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
ENOENT - Sub collection is not found.