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

Implements the data structure representing iCalendar properties. More...

Go to the source code of this file.

Functions

void icalproperty_add_parameter (icalproperty *p, icalparameter *parameter)
void icalproperty_add_parameters (icalproperty *prop, va_list args)
const char * icalproperty_as_ical_string (icalproperty *prop)
char * icalproperty_as_ical_string_r (icalproperty *prop)
icalproperty * icalproperty_clone (const icalproperty *old)
int icalproperty_count_parameters (const icalproperty *prop)
void icalproperty_free (icalproperty *p)
bool icalproperty_get_allow_empty_properties (void)
struct icaltimetype icalproperty_get_datetime_with_component (icalproperty *prop, icalcomponent *comp)
icalparameter * icalproperty_get_first_parameter (icalproperty *p, icalparameter_kind kind)
const char * icalproperty_get_iana_name (const icalproperty *prop)
icalparameter * icalproperty_get_next_parameter (icalproperty *p, icalparameter_kind kind)
const char * icalproperty_get_parameter_as_string (icalproperty *prop, const char *name)
char * icalproperty_get_parameter_as_string_r (icalproperty *prop, const char *name)
icalcomponent * icalproperty_get_parent (const icalproperty *property)
const char * icalproperty_get_property_name (const icalproperty *prop)
char * icalproperty_get_property_name_r (const icalproperty *prop)
icalvalue * icalproperty_get_value (const icalproperty *prop)
const char * icalproperty_get_value_as_string (const icalproperty *prop)
char * icalproperty_get_value_as_string_r (const icalproperty *prop)
const char * icalproperty_get_x_name (const icalproperty *prop)
icalproperty_kind icalproperty_isa (const icalproperty *p)
bool icalproperty_isa_property (void *property)
icalproperty * icalproperty_new (icalproperty_kind kind)
icalproperty * icalproperty_new_from_string (const char *str)
void icalproperty_normalize (icalproperty *prop)
void icalproperty_remove_parameter_by_kind (icalproperty *prop, icalparameter_kind kind)
 Removes all parameters with the specified kind.
void icalproperty_remove_parameter_by_name (icalproperty *prop, const char *name)
 Removes all parameters with the specified name.
void icalproperty_remove_parameter_by_ref (icalproperty *prop, icalparameter *parameter)
 Removes the specified parameter reference from the property.
void icalproperty_set_allow_empty_properties (bool enable)
void icalproperty_set_iana_name (icalproperty *prop, const char *name)
void icalproperty_set_parameter (icalproperty *prop, icalparameter *parameter)
void icalproperty_set_parameter_from_string (icalproperty *prop, const char *name, const char *value)
void icalproperty_set_parent (icalproperty *property, icalcomponent *component)
void icalproperty_set_value (icalproperty *p, icalvalue *value)
void icalproperty_set_value_from_string (icalproperty *prop, const char *str, const char *type)
void icalproperty_set_x_name (icalproperty *prop, const char *name)

Detailed Description

Implements the data structure representing iCalendar properties.

Definition in file icalproperty.c.

Function Documentation

◆ icalproperty_add_parameter()

void icalproperty_add_parameter ( icalproperty * prop,
icalparameter * parameter )

Adds a parameter to the specified icalproperty.

No error checking is performed by this function.

Parameters
propa pointer to a valid icalproperty
parametera pointer to a presumably valid icalparameter

Definition at line 488 of file icalproperty.c.

◆ icalproperty_add_parameters()

void icalproperty_add_parameters ( icalproperty * prop,
va_list args )

Adds a list of parameter to the specified icalproperty.

Parameters
propa pointer to a valid icalproperty.
argsa va_list of pointers that presumably point to list of valid icalparameters.

If any item in va_list points to an illegal icalparameter the internal library icalerrno is set to ICAL_BADARG_ERROR.

Any item in va_list points to an icalvalue is ignored.

Definition at line 77 of file icalproperty.c.

◆ icalproperty_as_ical_string()

const char * icalproperty_as_ical_string ( icalproperty * prop)

Stringify an icalproperty.

Parameters
propa pointer to an icalproperty
Returns
a pointer to a char string containing the string representation of prop. NULL is returned is prop is invalid.
See also
icalproperty_as_ical_string_r

Definition at line 360 of file icalproperty.c.

◆ icalproperty_as_ical_string_r()

char * icalproperty_as_ical_string_r ( icalproperty * prop)

Stringify an icalproperty.

Parameters
propa pointer to an icalproperty
Returns
a pointer to a char string containing the string representation of prop. NULL is returned is prop is invalid.
See also
icalproperty_as_ical_string

Definition at line 369 of file icalproperty.c.

◆ icalproperty_clone()

icalproperty * icalproperty_clone ( const icalproperty * old)

Deeply clones an icalproperty.

Parameters
olda pointer to the icalproperty to clone
Returns
a pointer to the memory for the newly cloned icalproperty.
Since
4.0

Definition at line 100 of file icalproperty.c.

◆ icalproperty_count_parameters()

int icalproperty_count_parameters ( const icalproperty * prop)

Gets the number of parameter for a specified icalproperty.

Parameters
propa pointer to a valid icalproperty
Returns
the number of parameters attached to prop. Returns -1 if prop is NULL.

Definition at line 699 of file icalproperty.c.

◆ icalproperty_free()

void icalproperty_free ( icalproperty * prop)

Free the memory for an icalproperty.

Parameters
propa pointer to a valid icalproperty

Definition at line 184 of file icalproperty.c.

◆ icalproperty_get_allow_empty_properties()

bool icalproperty_get_allow_empty_properties ( void )

Returns if empty properties are allowed; else are replaced with X-LIC-ERROR properties.

Returns
true if empty properties are allowed; else returns false
Since
4.0

Definition at line 72 of file icalproperty.c.

◆ icalproperty_get_datetime_with_component()

struct icaltimetype icalproperty_get_datetime_with_component ( icalproperty * prop,
icalcomponent * comp )

Computes the datetime corresponding to the specified icalproperty and icalcomponent. If the property is a DATE-TIME with a TZID parameter and a corresponding VTIMEZONE is present in the component, the returned component will already be in the correct timezone; otherwise the caller is responsible for converting it.

Call icaltime_is_null_time() on the returned value to detect failures.

Parameters
propa pointer to a valid icalproperty
compa pointer to a valid icalcomponent
Returns
the DATE or DATE_TIME an icaltimetype of the specified icalcomponent.
Since
3.0.5

Definition at line 1072 of file icalproperty.c.

◆ icalproperty_get_first_parameter()

icalparameter * icalproperty_get_first_parameter ( icalproperty * prop,
icalparameter_kind kind )

From the head position, iterates the icalparameter list attached to the specified icalproperty until the first icalparameter_kind is found.

Parameters
propa pointer to a valid icalproperty
kindan icalparameter_kind to use for the search
Returns
a pointer to the first icalparameter found of icalparameter_kind kind ; NULL if no matches are found.

Definition at line 709 of file icalproperty.c.

◆ icalproperty_get_iana_name()

const char * icalproperty_get_iana_name ( const icalproperty * prop)

Gets the IANA name of the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
Returns
a pointer to a char string containing the comp IANA name; will be NULL if the name has yet to be specified.
Since
4.0

Definition at line 883 of file icalproperty.c.

◆ icalproperty_get_next_parameter()

icalparameter * icalproperty_get_next_parameter ( icalproperty * prop,
icalparameter_kind kind )

From the current position, iterates the icalparameter list attached to the specified icalproperty until the next icalparameter_kind is found.

Parameters
propa pointer to a valid icalproperty
kindan icalparameter_kind to use for the search
Returns
a pointer to the next icalparameter found of icalparamter_kind kind; NULL if no matches are found.

Definition at line 731 of file icalproperty.c.

◆ icalproperty_get_parameter_as_string()

const char * icalproperty_get_parameter_as_string ( icalproperty * prop,
const char * name )

Gets the parameter value for a specified icalproperty parameter.

Parameters
propa pointer to a valid icalproperty
namea a pointer to a char string containing the name of icalparameter to use
Returns
a pointer to a char string containing the value for the specified icalparameter name; NULL is returned is name refers to an invalid icalproperty_kind.
See also
icalproperty_get_parameter_as_string_r

Definition at line 548 of file icalproperty.c.

◆ icalproperty_get_parameter_as_string_r()

char * icalproperty_get_parameter_as_string_r ( icalproperty * prop,
const char * name )

Gets the parameter value for a specified icalproperty parameter.

Parameters
propa pointer to a valid icalproperty
namea pointer to a char string containing the name of icalparameter to use
Returns
a pointer to a char string containing the value for the specified icalparameter name; NULL is returned is name refers to an invalid icalproperty_kind.
See also
icalproperty_get_parameter_as_string

Definition at line 557 of file icalproperty.c.

◆ icalproperty_get_parent()

icalcomponent * icalproperty_get_parent ( const icalproperty * property)

Gets the parent icalcomponent for the specified icalproperty.

Parameters
propertya pointer to a valid icalproperty
Returns
a pointer to the parent icalcomponent of the specified icalproperty.

Definition at line 939 of file icalproperty.c.

◆ icalproperty_get_property_name()

const char * icalproperty_get_property_name ( const icalproperty * prop)

Gets the name of the specified icalproperty.

Returns the name of the property – the type name converted to a string, or the value of _get_x_name if the type is and X property.

Parameters
propa pointer to the icalproperty
Returns
a pointer to a string containing the icalproperty's name.
See also
icalproperty_get_property_name_r

Definition at line 891 of file icalproperty.c.

◆ icalproperty_get_property_name_r()

char * icalproperty_get_property_name_r ( const icalproperty * prop)

Gets the name of the specified icalproperty.

Returns the name of the property – the type name converted to a string, or the value of _get_x_name if the type is and X property.

Parameters
propa pointer to the icalproperty
Returns
a pointer to a string containing the icalproperty's name.
See also
icalproperty_get_property_name

Definition at line 900 of file icalproperty.c.

◆ icalproperty_get_value()

icalvalue * icalproperty_get_value ( const icalproperty * prop)

Gets the icalvalue for the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
Returns
a pointer the prop icalvalue; or NULL if prop does not have an attached icalvalue yet.

Definition at line 822 of file icalproperty.c.

◆ icalproperty_get_value_as_string()

const char * icalproperty_get_value_as_string ( const icalproperty * prop)

Gets the icalvalue for the specified icalproperty as a char string.

Parameters
propa pointer to a valid icalproperty
Returns
a pointer the string-converted prop icalvalue; or NULL if prop does not have an attached icalvalue yet.
See also
icalproperty_get_value_as_string_r

Definition at line 829 of file icalproperty.c.

◆ icalproperty_get_value_as_string_r()

char * icalproperty_get_value_as_string_r ( const icalproperty * prop)

Gets the icalvalue for the specified icalproperty as a char string.

Parameters
propa pointer to a valid icalproperty
Returns
a pointer the string-converted prop icalvalue; or NULL if prop does not have an attached icalvalue yet.
See also
icalproperty_get_value_as_string

Definition at line 838 of file icalproperty.c.

◆ icalproperty_get_x_name()

const char * icalproperty_get_x_name ( const icalproperty * prop)

Gets the X-NAME icalproperty of the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
Returns
a pointer to a char string containing the X-NAME property. Will be NULL if an X-NAME property has not been set yet.
Since
3.0

Definition at line 862 of file icalproperty.c.

◆ icalproperty_isa()

icalproperty_kind icalproperty_isa ( const icalproperty * property)

Determines the icalproperty_kind of the specified icalproperty.

Parameters
propertya pointer to valid icalproperty.
Returns
the icalproperty_kind of property; ICAL_NO_PROPERTY is returned if property is NULL.

Definition at line 467 of file icalproperty.c.

◆ icalproperty_isa_property()

bool icalproperty_isa_property ( void * property)

Determines if the specified pointer is an icalproperty pointer.

Just looks if the ::id member strncmps to "prop".

Parameters
propertya pointer, presumably to an icalproperty.
Returns
true if the pointer looks like an icalproperty; false otherwise.

Definition at line 476 of file icalproperty.c.

◆ icalproperty_new()

icalproperty * icalproperty_new ( icalproperty_kind kind)

Construct a new icalproperty of the specified icalproperty_kind.

Parameters
kindis the icalproperty_kind to use
Returns
a pointer to the newly allocated icalproperty. The data structure contains all null values and is essentially invalid. Free the resulting memory with icalproperty_free.

Definition at line 91 of file icalproperty.c.

◆ icalproperty_new_from_string()

icalproperty * icalproperty_new_from_string ( const char * str)

Construct and populate a new icalproperty from a char string.

Parameters
stra non-NULL pointer to the data used to populate the new icalproperty.
Returns
a pointer to the newly allocated icalproperty. Free the resulting memory with icalproperty_free.

Definition at line 138 of file icalproperty.c.

◆ icalproperty_normalize()

void icalproperty_normalize ( icalproperty * prop)

Normalizes (reorders and sorts the parameters) the specified icalproperty.

Parameters
propa pointer a valid icalproperty
Since
3.0

Definition at line 953 of file icalproperty.c.

◆ icalproperty_remove_parameter_by_kind()

void icalproperty_remove_parameter_by_kind ( icalproperty * prop,
icalparameter_kind kind )

Removes all parameters with the specified kind.

Parameters
propA valid icalproperty.
kindThe kind to remove (ex. ICAL_TZID_PARAMETER)

See icalproperty_remove_parameter_by_name() and icalproperty_remove_parameter_by_ref() for alternate ways of removing parameters

Definition at line 632 of file icalproperty.c.

◆ icalproperty_remove_parameter_by_name()

void icalproperty_remove_parameter_by_name ( icalproperty * prop,
const char * name )

Removes all parameters with the specified name.

Parameters
propA valid icalproperty.
nameThe name of the parameter to remove

This function removes parameters with the given name. The name corresponds to either a built-in name (TZID, etc.) or the name of an extended parameter (X-FOO)

See icalproperty_remove_parameter_by_kind() and icalproperty_remove_parameter_by_ref() for alternate ways of removing parameters

Definition at line 650 of file icalproperty.c.

◆ icalproperty_remove_parameter_by_ref()

void icalproperty_remove_parameter_by_ref ( icalproperty * prop,
icalparameter * param )

Removes the specified parameter reference from the property.

Parameters
propA valid icalproperty.
paramA reference to a specific icalparameter.

This function removes the specified parameter reference from the property.

Definition at line 681 of file icalproperty.c.

◆ icalproperty_set_allow_empty_properties()

void icalproperty_set_allow_empty_properties ( bool enable)

Sets if empty properties are permitted.

Determines the library behavior whenever an empty property is encountered. When not set (the default) empty properties are replaced with X-LIC-ERROR properties. Otherwise, processing proceeds normally and the property value will be empty.

Parameters
enableIf true, libical allows empty properties; otherwise empty properties are replaced by X-LIC-ERROR properties.

Note that if icalerror_get_errors_are_fatal is also true a SIGABRT will be raised whenever an empty property is encountered.

Since
4.0

Definition at line 67 of file icalproperty.c.

◆ icalproperty_set_iana_name()

void icalproperty_set_iana_name ( icalproperty * prop,
const char * name )

Sets the IANA name for an icalproperty.

Parameters
propa pointer to a valid icalproperty
namea pointer to char string containing the IANA name.
Since
4.0

Definition at line 869 of file icalproperty.c.

◆ icalproperty_set_parameter()

void icalproperty_set_parameter ( icalproperty * prop,
icalparameter * parameter )

Adds an icalparameter to an icalproperty.

No error checking is performed by this function.

Parameters
propa pointer to a valid icalproperty
parametera pointer to a presumably valid icalparameter

If parameter kind is already attached to prop then the old parameter is removed in favor of parameter.

Definition at line 496 of file icalproperty.c.

◆ icalproperty_set_parameter_from_string()

void icalproperty_set_parameter_from_string ( icalproperty * prop,
const char * name,
const char * value )

Sets a icalparameter from a string for the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
namea pointer to a char string containing the parameter name
valuea pointer to a char string containing the parameter value

If name refers to an invalid icalparameter_kind or value is illegal, then the internal library icalerrno is set to ICAL_BADARG_ERROR.

See also
icalproperty_get_parameter_as_string

Definition at line 515 of file icalproperty.c.

◆ icalproperty_set_parent()

void icalproperty_set_parent ( icalproperty * property,
icalcomponent * component )

Sets the parent icalcomponent for the specified icalproperty.

Parameters
propertya pointer to a valid icalproperty
componenta pointer to a valid icalcomponent to use as the parent
Since
3.0

Definition at line 932 of file icalproperty.c.

◆ icalproperty_set_value()

void icalproperty_set_value ( icalproperty * prop,
icalvalue * value )

Sets an icalvalue for the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
valuea pointer to a valid icalvalue to use

If prop already has an icalvalue it will be replaced.

Definition at line 751 of file icalproperty.c.

◆ icalproperty_set_value_from_string()

void icalproperty_set_value_from_string ( icalproperty * prop,
const char * str,
const char * type )

Sets an icalvalue for the specified icalproperty from a char string..

Parameters
propa pointer to a valid icalproperty
stra non-NULL pointer to char string to be converted to the icalvalue
typea non-NULL pointer to a char string to be converted to an icalvalue_kind

If type string matches "NO" then the icalvalue_kind will be taken from an existing icalvalue (if one exists) or will use the default icalvalue_kind for the icalproperty.

If prop already has an icalvalue it will be replaced.

Definition at line 781 of file icalproperty.c.

◆ icalproperty_set_x_name()

void icalproperty_set_x_name ( icalproperty * prop,
const char * name )

Sets the X-NAME property of the specified icalproperty.

Parameters
propa pointer to a valid icalproperty
namea pointer to a char string to use as the X-NAME

Definition at line 849 of file icalproperty.c.