Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
vcardstructured.c File Reference

Implements the data structure representing vCard structured values. More...

Go to the source code of this file.

Functions

vcardstructuredtypevcardstructured_clone (const vcardstructuredtype *st)
 Clones a vcardstructuredtype.
vcardstrarray * vcardstructured_field_at (const vcardstructuredtype *st, size_t position)
 Returns the field at the given position in a vcardstructuredtype.
vcardstructuredtypevcardstructured_new (size_t num_fields)
 Creates a new instance of vcardstructuredtype.
vcardstructuredtypevcardstructured_new_from_string (const char *str)
 Creates a new instance of vcardstructuredtype from a string.
size_t vcardstructured_num_fields (const vcardstructuredtype *st)
 Returns the number of fields in a vcardstructuredtype.
void vcardstructured_ref (vcardstructuredtype *st)
 Increments the reference count of the vcardstructuredtype.
void vcardstructured_set_field_at (vcardstructuredtype *st, size_t position, vcardstrarray *field)
 Sets the field at the given position in a vcardstructuredtype.
void vcardstructured_set_num_fields (vcardstructuredtype *st, size_t num_fields)
 Sets the number of fields in a vcardstructuredtype.
void vcardstructured_unref (vcardstructuredtype *st)
 Decrements the reference count of the vcardstructuredtype.

Detailed Description

Implements the data structure representing vCard structured values.

Definition in file vcardstructured.c.

Function Documentation

◆ vcardstructured_clone()

vcardstructuredtype * vcardstructured_clone ( const vcardstructuredtype * st)

Clones a vcardstructuredtype.

Parameters
stThe object to clone.
See also
vcardstructuredtype_unref()
Error handling
If st is NULL it sets icalerrno to ICAL_BADARG_ERROR.
Ownership
The clone is a deep copy of st. The returned value has refcount 1. It is the caller's responsibility to call vcardstructuredtype_unref() after it's no longer used.

Definition at line 134 of file vcardstructured.c.

◆ vcardstructured_field_at()

vcardstrarray * vcardstructured_field_at ( const vcardstructuredtype * st,
size_t position )

Returns the field at the given position in a vcardstructuredtype.

Parameters
stThe structured type object.
positionThe zero-based index of the field to retrieve.
Returns
The vcardstrarray at position, or NULL on error.
Error handling
If st is NULL or position is out of bounds, it sets icalerrno to ICAL_BADARG_ERROR and returns NULL.

Definition at line 190 of file vcardstructured.c.

◆ vcardstructured_new()

vcardstructuredtype * vcardstructured_new ( size_t num_fields)

Creates a new instance of vcardstructuredtype.

Parameters
num_fieldsThe initial number of fields.
See also
vcardstructuredtype_unref()
Ownership
The returned value has refcount 1. It is the caller's responsibility to call vcardstructuredtype_unref() after it's no longer used.

Definition at line 65 of file vcardstructured.c.

◆ vcardstructured_new_from_string()

vcardstructuredtype * vcardstructured_new_from_string ( const char * s)

Creates a new instance of vcardstructuredtype from a string.

Parameters
sThe string containing a vCard representation of the structured value.
See also
vcardstructuredtype_unref()
Ownership
The returned value has refcount 1. It is the caller's responsibility to call vcardstructuredtype_unref() after it's no longer used.

Definition at line 77 of file vcardstructured.c.

◆ vcardstructured_num_fields()

size_t vcardstructured_num_fields ( const vcardstructuredtype * st)

Returns the number of fields in a vcardstructuredtype.

Parameters
stThe structured type object.
Returns
The number of fields
Error handling
If st is NULL, it sets icalerrno to ICAL_BADARG_ERROR and returns 0.

Definition at line 152 of file vcardstructured.c.

◆ vcardstructured_ref()

void vcardstructured_ref ( vcardstructuredtype * st)

Increments the reference count of the vcardstructuredtype.

Parameters
stThe object to increase the reference count of
See also
vcardstructuredtype_unref()
Error handling
If st is NULL, or the reference count is smaller than 0, it sets icalerrno to ICAL_BADARG_ERROR.
Ownership
By increasing the refcount of st, you are signaling that you are using it, and it is the owner's responsibility to call vcardstructuredtype_unref() after it's no longer used.

Definition at line 113 of file vcardstructured.c.

◆ vcardstructured_set_field_at()

void vcardstructured_set_field_at ( vcardstructuredtype * st,
size_t position,
vcardstrarray * field )

Sets the field at the given position in a vcardstructuredtype.

Parameters
stThe structured type object.
positionThe zero-based index of the field to set.
fieldThe vcardstrarray to store at position.

If position is beyond the current number of fields, the number of fields is extended to accommodate it. Any existing field at position is freed before being replaced.

Error handling
If st is NULL, it sets icalerrno to ICAL_BADARG_ERROR.

Definition at line 199 of file vcardstructured.c.

◆ vcardstructured_set_num_fields()

void vcardstructured_set_num_fields ( vcardstructuredtype * st,
size_t num_fields )

Sets the number of fields in a vcardstructuredtype.

Parameters
stThe structured type object.
num_fieldsThe new number of fields.

If num_fields is smaller than the current number of fields, the excess fields are freed.

Error handling
If st is NULL, it sets icalerrno to ICAL_BADARG_ERROR.

Definition at line 158 of file vcardstructured.c.

◆ vcardstructured_unref()

void vcardstructured_unref ( vcardstructuredtype * st)

Decrements the reference count of the vcardstructuredtype.

Parameters
stThe object to decrease the reference count of
See also
vcardstructuredtype_ref()

Decreases the reference count of st. If this was the last user of the object, it is freed.

Error handling
If s is NULL, or the reference count is smaller than 0, it sets icalerrno to ICAL_BADARG_ERROR.
Ownership
Calling this function releases the vcardstructuredtype back to the library, and it must not be used afterwards.

Definition at line 120 of file vcardstructured.c.