Libical API Documentation 4.0
|
A guide to help developers port their code from libical v3.x to libical 4.0.
To continue supporting the 3.0 version you can use conditional compilation, like so:
you can handle code that no longer exists in 4.0 with:
icalrecurrencetype_from_string()
was replaced by icalrecurrencetype_new_from_string()
, which returns a struct icalrecurrencetype *
rather than a struct icalrecurrencetype
.struct icalrecurrencetype *
rather than struct icalrecurrencetype
:icalproperty_new_rrule()
icalproperty_get_rrule()
icalproperty_set_rrule()
icalproperty_vanew_rrule()
icalproperty_new_exrule()
icalproperty_set_exrule()
icalproperty_get_exrule()
icalproperty_vanew_exrule()
icalrecur_iterator_new()
icalvalue_new_recur()
icalvalue_set_recur()
icalvalue_get_recur()
struct icalrecurrencetype *
rather than struct icalrecurrencetype
:icalproperty_get_rrule()
icalproperty_get_exrule()
icalvalue_get_recur()
The following functions have been added:
icalrecurrencetype_new()
icalrecurrencetype_ref()
icalrecurrencetype_unref()
icalrecurrencetype_clone()
icalrecurrencetype_encode_day()
icalrecurrencetype_encode_month()
icaltzutil_set_zone_directory()
icalcomponent_clone()
icalproperty_clone()
icalparameter_clone()
icalvalue_clone()
icalcluster_clone()
icalrecur_iterator_prev()
icalrecur_resize_by()
icalrecurrencetype_new()
icalrecurrencetype_ref()
icalrecurrencetype_unref()
icalrecurrencetype_clone()
icalrecurrencetype_from_string()
icalcomponent_set_x_name()
icalcomponent_get_x_name()
icalcomponent_get_component_name()
icalcomponent_get_component_name_r()
ical_set_invalid_rrule_handling_setting()
ical_get_invalid_rrule_handling_setting()
icalparser_get_ctrl()
icalparser_set_ctrl()
icalrecurrencetype_clear()
has been removed.caldat()
juldat()
icalcomponent_new_clone()
icalparameter_new_clone()
icalproperty_new_clone()
icalvalue_new_clone()
icalcluster_new_clone()
icaltzutil_fetch_timezone()
icalrecurrencetype_clear()
A number of function signatures have been changed to use 'bool' rather than 'int' types.
This is implemented using the C99 standards compliant <stdbool.h> header.
Replace all ical*_new_clone()
function calls with ical*_clone()
. ie, use icalcomponent_clone()
rather then icalcomponent_new_clone()
.
icalrecurrencetype
now passed by referenceThe way struct icalrecurrencetype
is passed between functions has been changed. While it was usually passed by value in 3.0, it is now passed by reference. A reference counting mechanism is applied that takes care of de-allocating an instance as soon as the reference counter goes to 0.
Code like this in libical 3.0:
changes to this in libical 4.0:
icalgeotype
now uses character strings rather than doublesThe members of struct icalgeotype
for latitude ('lat) and longitude ('lon
) have been changed to use ICAL_GEO_LEN long character strings rather than the double type.
This means that simple assignments in 3.0 must be replaced by string copies.
becomes
and
becomes
icalvalue
and icalproperty
Code like this in libical 3.0:
changes to this in libical 4.0:
struct icalrecurrencetype *
rather than const struct icalrecurrencetype &
:ICalValue.set_recur()
ICalProperty.set_exrule()
ICalProperty.set_rrule()
struct icalrecurrencetype *
rather than struct icalrecurrencetype
:ICalValue.get_recur()
ICalProperty.get_exrule()
ICalProperty.get_rrule()
icalrecurrencetype.by_xxx
static arrays replaced by dynamically allocated onesI.e. memory short by_hour[ICAL_BY_DAY_SIZE]
etc. are replaced by
Memory is allocated in the required size using the new icalrecur_resize_by()
function. It is automatically freed together with the containing icalrecurrencetype
. As the size of the array is stored explicitly, no termination of the array with special value ICAL_RECURRENCE_ARRAY_MAX
is required anymore. The array is iterated by comparing the iterator to the size
member value.
icalrecurrencetype.by_xxx
static arrays usage from 3.0 to 4.0Code like this in libical 3.0:
changes to something like this in libical 4.0:
ICalGLib.Recurrence.*_by_*
methodsi_cal_recurrence_*_by_xxx*
methods have been replaced by more generic versions that take the 'by' type (day, month, ...) as a parameter.
ICalGLib.Recurrence.*_by_*
methods from 3.0 to 4.0Code like this in libical 3.0:
changes to something like this in libical 4.0: