libcollection 0.6.2
Loading...
Searching...
No Matches
Add property functions

Topics

 Add properties with reference
 

Functions

int col_add_str_property (struct collection_item *ci, const char *subcollection, const char *property, const char *string, int length)
 Add a string property to a collection.
 
int col_add_binary_property (struct collection_item *ci, const char *subcollection, const char *property, void *binary_data, int length)
 Add a binary property to a collection.
 
int col_add_int_property (struct collection_item *ci, const char *subcollection, const char *property, int32_t number)
 Add an integer property to a collection.
 
int col_add_unsigned_property (struct collection_item *ci, const char *subcollection, const char *property, uint32_t number)
 Add an unsigned integer property to a collection.
 
int col_add_long_property (struct collection_item *ci, const char *subcollection, const char *property, int64_t number)
 Add an long property to a collection.
 
int col_add_ulong_property (struct collection_item *ci, const char *subcollection, const char *property, uint64_t number)
 Add an unsigned long property to a collection.
 
int col_add_double_property (struct collection_item *ci, const char *subcollection, const char *property, double number)
 Add a property of type double to a collection.
 
int col_add_bool_property (struct collection_item *ci, const char *subcollection, const char *property, unsigned char logical)
 Add a Boolean property to a collection.
 
int col_add_any_property (struct collection_item *ci, const char *subcollection, const char *property, int type, void *data, int length)
 Add a property of a specified type to a collection.
 

Detailed Description

Functions in this section add properties to a collection.

All the functions in this section add a property of the specified type to the collection object. They are convenience wrappers around the col_insert_xxx_property functions. They always append property to the end of the collection.

Common parameters for these functions are:

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.
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.

Function Documentation

◆ col_add_str_property()

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

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.
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.

◆ col_add_binary_property()

int col_add_binary_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
void * binary_data,
int length )

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.
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.

◆ col_add_int_property()

int col_add_int_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
int32_t number )

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.
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.

◆ col_add_unsigned_property()

int col_add_unsigned_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
uint32_t number )

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.
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.

◆ col_add_long_property()

int col_add_long_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
int64_t number )

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.
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.

◆ col_add_ulong_property()

int col_add_ulong_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
uint64_t number )

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.
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.

◆ col_add_double_property()

int col_add_double_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
double number )

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.
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.

◆ col_add_bool_property()

int col_add_bool_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
unsigned char logical )

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.
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.

◆ col_add_any_property()

int col_add_any_property ( struct collection_item * ci,
const char * subcollection,
const char * property,
int type,
void * data,
int length )

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.
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.