summaryrefslogtreecommitdiffabout
path: root/libical/src/libical
Side-by-side diff
Diffstat (limited to 'libical/src/libical') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/astime.h65
-rw-r--r--libical/src/libical/caldate.c176
-rw-r--r--libical/src/libical/ical.h2060
-rw-r--r--libical/src/libical/icalarray.c163
-rw-r--r--libical/src/libical/icalarray.h63
-rw-r--r--libical/src/libical/icalattach.c139
-rw-r--r--libical/src/libical/icalattach.h60
-rw-r--r--libical/src/libical/icalattachimpl.h59
-rw-r--r--libical/src/libical/icalcomponent.c1891
-rw-r--r--libical/src/libical/icalcomponent.h90
-rw-r--r--libical/src/libical/icalderivedparameter.c807
-rw-r--r--libical/src/libical/icalderivedparameter.h199
-rw-r--r--libical/src/libical/icalderivedproperty.c1062
-rw-r--r--libical/src/libical/icalderivedproperty.h214
-rw-r--r--libical/src/libical/icalderivedvalue.c892
-rw-r--r--libical/src/libical/icalderivedvalue.h249
-rw-r--r--libical/src/libical/icalduration.c89
-rw-r--r--libical/src/libical/icalduration.h4
-rw-r--r--libical/src/libical/icalenums.c39
-rw-r--r--libical/src/libical/icalenums.h10
-rw-r--r--libical/src/libical/icalerror.c54
-rw-r--r--libical/src/libical/icalerror.h23
-rw-r--r--libical/src/libical/icallangbind.c47
-rw-r--r--libical/src/libical/icallangbind.h5
-rw-r--r--libical/src/libical/icalmemory.c148
-rw-r--r--libical/src/libical/icalmemory.h19
-rw-r--r--libical/src/libical/icalmime.c6
-rw-r--r--libical/src/libical/icalparameter.c113
-rw-r--r--libical/src/libical/icalparameter.h2
-rw-r--r--libical/src/libical/icalparser.c365
-rw-r--r--libical/src/libical/icalparser.h29
-rw-r--r--libical/src/libical/icalperiod.c14
-rw-r--r--libical/src/libical/icalperiod.h6
-rw-r--r--libical/src/libical/icalproperty.c509
-rw-r--r--libical/src/libical/icalproperty.h42
-rw-r--r--libical/src/libical/icalrecur.c789
-rw-r--r--libical/src/libical/icalrecur.h71
-rw-r--r--libical/src/libical/icalrestriction.c116
-rw-r--r--libical/src/libical/icaltime.c1116
-rw-r--r--libical/src/libical/icaltime.h262
-rw-r--r--libical/src/libical/icaltimezone.c1672
-rw-r--r--libical/src/libical/icaltimezone.h167
-rw-r--r--libical/src/libical/icaltypes.c140
-rw-r--r--libical/src/libical/icaltypes.h35
-rw-r--r--libical/src/libical/icalvalue.c518
-rw-r--r--libical/src/libical/icalvalue.h27
-rw-r--r--libical/src/libical/icalvalueimpl.h6
-rw-r--r--libical/src/libical/icalversion.h2
-rw-r--r--libical/src/libical/libical.pro128
-rw-r--r--libical/src/libical/libicalE.pro122
-rw-r--r--libical/src/libical/pvl.c497
-rw-r--r--libical/src/libical/pvl.h37
-rw-r--r--libical/src/libical/sspm.c23
-rw-r--r--libical/src/libical/vsnprintf.c28
54 files changed, 10711 insertions, 4758 deletions
diff --git a/libical/src/libical/astime.h b/libical/src/libical/astime.h
new file mode 100644
index 0000000..6962c06
--- a/dev/null
+++ b/libical/src/libical/astime.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1986-2000, Hiram Clawson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the
+ * above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither name of The Museum of Hiram nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file astime.h
+ * @brief contains definitions of structures used for time calculations.
+ */
+
+#ifndef _astime_h_
+#define _astime_h_
+
+typedef struct ut_instant {
+ double j_date; /**< julian decimal date, 0 = 01 Jan 4713 BC 12 HR UT */
+ long year; /**< year, valid range [-4,713, +2,147,483,647] */
+ int month; /**< [1-12] */
+ int day; /**< [1-31] */
+ int i_hour; /**< [0-23] */
+ int i_minute; /**< [0-59] */
+ int i_second; /**< [0-59] */
+ double d_hour; /**< [0.0-23.9999] includes minute and second */
+ double d_minute; /**< [0.0-59.9999] includes second */
+ double d_second; /**< [0.0-59.9999] */
+ int weekday; /**< [0-6] */
+ int day_of_year; /**< [1-366] */
+} UTinstant, * UTinstantPtr;
+
+/* Functions in caldate.c */
+
+long caldat( UTinstantPtr ); /** converts julian date to year,mo,da */
+double juldat( UTinstantPtr ); /** returns julian day from year,mo,da */
+
+#endif /* _astime_h_ */
diff --git a/libical/src/libical/caldate.c b/libical/src/libical/caldate.c
new file mode 100644
index 0000000..f5554f6
--- a/dev/null
+++ b/libical/src/libical/caldate.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1986-2000, Hiram Clawson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the
+ * above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither name of The Museum of Hiram nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "astime.h" /* time structures */
+
+/**
+ * caldat computes the day of the week, the day of the year
+ * the gregorian (or julian) calendar date and the universal
+ * time from the julian decimal date.
+ * for astronomical purposes, The Gregorian calendar reform occurred
+ * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar.
+
+ * Input: a ut_instant structure pointer, where the j_date element
+ * has been set. ( = 0 for 01 Jan 4713 B.C. 12 HR UT )
+ *
+ * output: will set all the other elements of the structure.
+ * As a convienence, the function will also return the year.
+ *
+ * Reference: Astronomial formulae for calculators, meeus, p 23
+ * from fortran program by F. Espenak - April 1982 Page 277,
+ * 50 Year canon of solar eclipses: 1986-2035
+ *
+ */
+
+long caldat( date )
+struct ut_instant * date;
+{
+ double frac;
+ long jd;
+ long ka;
+ long kb;
+ long kc;
+ long kd;
+ long ke;
+ long ialp;
+
+ jd = (long) (date->j_date + 0.5); /* integer julian date */
+ frac = date->j_date + 0.5 - (double) jd + 1.0e-10; /* day fraction */
+ ka = (long) jd;
+ if ( jd >= 2299161L )
+ {
+ ialp = ( (double) jd - 1867216.25 ) / ( 36524.25 );
+ ka = jd + 1L + ialp - ( ialp >> 2 );
+ }
+ kb = ka + 1524L;
+ kc = ( (double) kb - 122.1 ) / 365.25;
+ kd = (double) kc * 365.25;
+ ke = (double) ( kb - kd ) / 30.6001;
+ date->day = kb - kd - ((long) ( (double) ke * 30.6001 ));
+ if ( ke > 13L )
+ date->month = ke - 13L;
+ else
+ date->month = ke - 1L;
+ if ( (date->month == 2) && (date->day > 28) )
+ date->day = 29;
+ if ( (date->month == 2) && (date->day == 29) && (ke == 3L) )
+ date->year = kc - 4716L;
+ else if ( date->month > 2 )
+ date->year = kc - 4716L;
+ else
+ date->year = kc - 4715L;
+ date->i_hour = date->d_hour = frac * 24.0; /* hour */
+ date->i_minute = date->d_minute =
+ ( date->d_hour - (double) date->i_hour ) * 60.0; /* minute */
+ date->i_second = date->d_second =
+ ( date->d_minute - (double) date->i_minute ) * 60.0;/* second */
+ date->weekday = (jd + 1L) % 7L; /* day of week */
+ if ( date->year == ((date->year >> 2) << 2) )
+ date->day_of_year =
+ ( ( 275 * date->month ) / 9)
+ - ((date->month + 9) / 12)
+ + date->day - 30;
+ else
+ date->day_of_year =
+ ( ( 275 * date->month ) / 9)
+ - (((date->month + 9) / 12) << 1)
+ + date->day - 30;
+ return( date->year );
+}
+
+/**
+ * juldat computes the julian decimal date (j_date) from
+ * the gregorian (or Julian) calendar date.
+ * for astronomical purposes, The Gregorian calendar reform occurred
+ * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar.
+ * Input: a ut_instant structure pointer where Day, Month, Year and
+ * i_hour, i_minute, d_second have been set for the date
+ * in question.
+ *
+ * Output: the j_date and weekday elements of the structure will be set.
+ * Also, the return value of the function will be the j_date too.
+ *
+ * Reference: Astronomial formulae for calculators, meeus, p 23
+ * from fortran program by F. Espenak - April 1982 Page 276,
+ * 50 Year canon of solar eclipses: 1986-2035
+ */
+
+double juldat( date )
+struct ut_instant * date;
+{
+ double frac, gyr;
+ long iy0, im0;
+ long ia, ib;
+ long jd;
+
+ /* decimal day fraction */
+ frac = (( double)date->i_hour/ 24.0)
+ + ((double) date->i_minute / 1440.0)
+ + (date->d_second / 86400.0);
+ /* convert date to format YYYY.MMDDdd */
+ gyr = (double) date->year
+ + (0.01 * (double) date->month)
+ + (0.0001 * (double) date->day)
+ + (0.0001 * frac) + 1.0e-9;
+ /* conversion factors */
+ if ( date->month <= 2 )
+ {
+ iy0 = date->year - 1L;
+ im0 = date->month + 12;
+ }
+ else
+ {
+ iy0 = date->year;
+ im0 = date->month;
+ }
+ ia = iy0 / 100L;
+ ib = 2L - ia + (ia >> 2);
+ /* calculate julian date */
+ if ( date->year < 0L )
+ jd = (long) ((365.25 * (double) iy0) - 0.75)
+ + (long) (30.6001 * (im0 + 1L) )
+ + (long) date->day + 1720994L;
+ else
+ jd = (long) (365.25 * (double) iy0)
+ + (long) (30.6001 * (double) (im0 + 1L))
+ + (long) date->day + 1720994L;
+ if ( gyr >= 1582.1015 ) /* on or after 15 October 1582 */
+ jd += ib;
+ date->j_date = (double) jd + frac + 0.5;
+ jd = (long) (date->j_date + 0.5);
+ date->weekday = (jd + 1L) % 7L;
+ return( date->j_date );
+} /* end of double juldat( date ) */
diff --git a/libical/src/libical/ical.h b/libical/src/libical/ical.h
index 69a2c3a..0ae2c15 100644
--- a/libical/src/libical/ical.h
+++ b/libical/src/libical/ical.h
@@ -1 +1,122 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ $Id$
+*/
+/* config.h. Generated by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if you have the <assert.h> header file. */
+#define HAVE_ASSERT_H 1
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#define HAVE_GMTIME_R 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `iswspace' function. */
+#define HAVE_ISWSPACE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if we have pthread. */
+#define HAVE_PTHREAD
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to make icalerror_* calls abort instead of internally signalling an
+ error */
+#define ICAL_ERRORS_ARE_FATAL 1
+
+/* Define if we want _REENTRANT */
+/* #undef ICAL_REENTRANT */
+
+/* Define to terminate lines with "
+" instead of "
+" */
+#define ICAL_UNIX_NEWLINE 1
+
+/* Define to 1 if you DO NOT WANT to see deprecated messages */
+#define NO_WARN_DEPRECATED 1
+
+/* Define to 1 if you DO NO WANT to see the warning messages related to
+ ICAL_MALFORMEDDATA_ERROR and parsing .ics zoneinfo files */
+#define NO_WARN_ICAL_MALFORMEDDATA_ERROR_HACK 1
+
+/* Name of package */
+#define PACKAGE "libical"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Version number of package */
+#define VERSION "0.24"
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+#define YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef mode_t */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
#ifndef ICAL_VERSION_H
@@ -4,3 +125,3 @@
#define ICAL_PACKAGE "libical"
-#define ICAL_VERSION "0.23"
+#define ICAL_VERSION "0.24"
@@ -13,4 +134,2 @@
- $Id$
- $Locker$
@@ -35,2 +154,66 @@
+/** @file icaltime.h
+ * @brief struct icaltimetype is a pseudo-object that abstracts time
+ * handling.
+ *
+ * It can represent either a DATE or a DATE-TIME (floating, UTC or in a
+ * given timezone), and it keeps track internally of its native timezone.
+ *
+ * The typical usage is to call the correct constructor specifying the
+ * desired timezone. If this is not known until a later time, the
+ * correct behavior is to specify a NULL timezone and call
+ * icaltime_convert_to_zone() at a later time.
+ *
+ * There are several ways to create a new icaltimetype:
+ *
+ * - icaltime_null_time()
+ * - icaltime_null_date()
+ * - icaltime_current_time_with_zone()
+ * - icaltime_today()
+ * - icaltime_from_timet_with_zone(time_t tm, int is_date,
+ * icaltimezone *zone)
+ * - icaltime_from_string_with_zone(const char* str, icaltimezone *zone)
+ * - icaltime_from_day_of_year(int doy, int year)
+ * - icaltime_from_week_number(int week_number, int year)
+ *
+ * italtimetype objects can be converted to different formats:
+ *
+ * - icaltime_as_timet(struct icaltimetype tt)
+ * - icaltime_as_timet_with_zone(struct icaltimetype tt,
+ * icaltimezone *zone)
+ * - icaltime_as_ical_string(struct icaltimetype tt)
+ *
+ * Accessor methods include:
+ *
+ * - icaltime_get_timezone(struct icaltimetype t)
+ * - icaltime_get_tzid(struct icaltimetype t)
+ * - icaltime_set_timezone(struct icaltimetype t, const icaltimezone *zone)
+ * - icaltime_day_of_year(struct icaltimetype t)
+ * - icaltime_day_of_week(struct icaltimetype t)
+ * - icaltime_start_doy_of_week(struct icaltimetype t)
+ * - icaltime_week_number(struct icaltimetype t)
+ *
+ * Query methods include:
+ *
+ * - icaltime_is_null_time(struct icaltimetype t)
+ * - icaltime_is_valid_time(struct icaltimetype t)
+ * - icaltime_is_date(struct icaltimetype t)
+ * - icaltime_is_utc(struct icaltimetype t)
+ * - icaltime_is_floating(struct icaltimetype t)
+ *
+ * Modify, compare and utility methods include:
+ *
+ * - icaltime_add(struct icaltimetype t, struct icaldurationtype d)
+ * - icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2)
+ * - icaltime_compare_with_zone(struct icaltimetype a,struct icaltimetype b)
+ * - icaltime_compare(struct icaltimetype a,struct icaltimetype b)
+ * - icaltime_compare_date_only(struct icaltimetype a,
+ * struct icaltimetype b)
+ * - icaltime_adjust(struct icaltimetype *tt, int days, int hours,
+ * int minutes, int seconds);
+ * - icaltime_normalize(struct icaltimetype t);
+ * - icaltime_convert_to_zone(const struct icaltimetype tt,
+ * icaltimezone *zone);
+ */
+
#ifndef ICALTIME_H
@@ -40,14 +223,28 @@
-/* icaltime_span is returned by icalcomponent_get_span() */
+/* An opaque struct representing a timezone. We declare this here to avoid
+ a circular dependancy. */
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+typedef struct _icaltimezone icaltimezone;
+#endif
+
+/** icaltime_span is returned by icalcomponent_get_span() */
struct icaltime_span {
- time_t start; /* in UTC */
- time_t end; /* in UTC */
- int is_busy; /* 1->busy time, 0-> free time */
+ time_t start; /**< in UTC */
+ time_t end; /**< in UTC */
+ int is_busy; /**< 1->busy time, 0-> free time */
};
+typedef struct icaltime_span icaltime_span;
+/*
+ * FIXME
+ *
+ * is_utc is redundant, and might be considered a minor optimization.
+ * It might be deprecated, so you should use icaltime_is_utc() instead.
+ */
struct icaltimetype
{
- int year;
- int month;
+ int year; /**< Actual year, e.g. 2001. */
+ int month; /**< 1 (Jan) to 12 (Dec). */
int day;
@@ -57,95 +254,145 @@ struct icaltimetype
- int is_utc; /* 1-> time is in UTC timezone */
+ int is_utc; /**< 1-> time is in UTC timezone */
- int is_date; /* 1 -> interpret this as date. */
+ int is_date; /**< 1 -> interpret this as date. */
- const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/
+ int is_daylight; /**< 1 -> time is in daylight savings time. */
+
+ const icaltimezone *zone; /**< timezone */
};
-/* Convert seconds past UNIX epoch to a timetype*/
-struct icaltimetype icaltime_from_timet(time_t v, int is_date);
+typedef struct icaltimetype icaltimetype;
-/* Return the time as seconds past the UNIX epoch */
-time_t icaltime_as_timet(struct icaltimetype);
+/** Return a null time, which indicates no time has been set.
+ This time represent the beginning of the epoch */
+struct icaltimetype icaltime_null_time(void);
-/* Return a string represention of the time, in RFC2445 format. The
- string is owned by libical */
-char* icaltime_as_ical_string(struct icaltimetype tt);
+/** Return a null date */
+struct icaltimetype icaltime_null_date(void);
-/* Like icaltime_from_timet(), except that the input may be in seconds
- past the epoch in floating time. This routine is deprecated */
-struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc);
+/** Returns the current time in the given timezone, as an icaltimetype. */
+struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone);
-/* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */
-int icaltime_as_int(struct icaltimetype);
+/** Returns the current day as an icaltimetype, with is_date set. */
+struct icaltimetype icaltime_today(void);
-/* create a time from an ISO format string */
+/** Convert seconds past UNIX epoch to a timetype*/
+struct icaltimetype icaltime_from_timet(const time_t v, const int is_date);
+
+/** Convert seconds past UNIX epoch to a timetype, using timezones. */
+struct icaltimetype icaltime_from_timet_with_zone(const time_t tm,
+ const int is_date, const icaltimezone *zone);
+
+/** create a time from an ISO format string */
struct icaltimetype icaltime_from_string(const char* str);
-/* Routines for handling timezones */
-/* Return the offset of the named zone as seconds. tt is a time
- indicating the date for which you want the offset */
-int icaltime_utc_offset(struct icaltimetype tt, const char* tzid);
+/** create a time from an ISO format string */
+struct icaltimetype icaltime_from_string_with_zone(const char* str,
+ const icaltimezone *zone);
-/* convert tt, of timezone tzid, into a utc time. Does nothing if the
- time is already UTC. */
-struct icaltimetype icaltime_as_utc(struct icaltimetype tt,
- const char* tzid);
+/** Create a new time, given a day of year and a year. */
+struct icaltimetype icaltime_from_day_of_year(const int doy,
+ const int year);
-/* convert tt, a time in UTC, into a time in timezone tzid */
-struct icaltimetype icaltime_as_zone(struct icaltimetype tt,
- const char* tzid);
+/** @brief Contructor (TODO).
+ * Create a new time from a weeknumber and a year. */
+struct icaltimetype icaltime_from_week_number(const int week_number,
+ const int year);
-/* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */
-struct icaltimetype icaltime_null_time(void);
+/** Return the time as seconds past the UNIX epoch */
+time_t icaltime_as_timet(const struct icaltimetype);
+
+/** Return the time as seconds past the UNIX epoch, using timezones. */
+time_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
+ const icaltimezone *zone);
+
+/** Return a string represention of the time, in RFC2445 format. The
+ string is owned by libical */
+const char* icaltime_as_ical_string(const struct icaltimetype tt);
+
+/** @brief Return the timezone */
+const icaltimezone *icaltime_get_timezone(const struct icaltimetype t);
+
+/** @brief Return the tzid, or NULL for a floating time */
+char *icaltime_get_tzid(const struct icaltimetype t);
+
+/** @brief Set the timezone */
+struct icaltimetype icaltime_set_timezone(struct icaltimetype *t,
+ const icaltimezone *zone);
-/* Return true of the time is null. */
-int icaltime_is_null_time(struct icaltimetype t);
+/** Return the day of the year of the given time */
+int icaltime_day_of_year(const struct icaltimetype t);
-/* Returns false if the time is clearly invalid, but is not null. This
+/** Return the day of the week of the given time. Sunday is 1 */
+int icaltime_day_of_week(const struct icaltimetype t);
+
+/** Return the day of the year for the Sunday of the week that the
+ given time is within. */
+int icaltime_start_doy_of_week(const struct icaltimetype t);
+
+/** Return the week number for the week the given time is within */
+int icaltime_week_number(const struct icaltimetype t);
+
+/** Return true of the time is null. */
+int icaltime_is_null_time(const struct icaltimetype t);
+
+/** Returns false if the time is clearly invalid, but is not null. This
is usually the result of creating a new time type buy not clearing
it, or setting one of the flags to an illegal value. */
-int icaltime_is_valid_time(struct icaltimetype t);
+int icaltime_is_valid_time(const struct icaltimetype t);
-/* Reset all of the time components to be in their normal ranges. For
- instance, given a time with minutes=70, the minutes will be reduces
- to 10, and the hour incremented. This allows the caller to do
- arithmetic on times without worrying about overflow or
- underflow. */
-struct icaltimetype icaltime_normalize(struct icaltimetype t);
+/** @brief Returns true if time is of DATE type, false if DATE-TIME */
+int icaltime_is_date(const struct icaltimetype t);
-/* Return the day of the year of the given time */
-short icaltime_day_of_year(struct icaltimetype t);
+/** @brief Returns true if time is relative to UTC zone */
+int icaltime_is_utc(const struct icaltimetype t);
-/* Create a new time, given a day of year and a year. */
-struct icaltimetype icaltime_from_day_of_year(short doy, short year);
+/** @brief Returns true if time is a floating time */
+int icaltime_is_floating(const struct icaltimetype t);
-/* Return the day of the week of the given time. Sunday is 1 */
-short icaltime_day_of_week(struct icaltimetype t);
+/** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
+int icaltime_compare_with_zone(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return the day of the year for the Sunday of the week that the
- given time is within. */
-short icaltime_start_doy_of_week(struct icaltimetype t);
+/** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
+int icaltime_compare(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */
-char* icaltime_as_ctime(struct icaltimetype);
+/** like icaltime_compare, but only use the date parts. */
+int icaltime_compare_date_only(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return the week number for the week the given time is within */
-short icaltime_week_number(struct icaltimetype t);
+/** Adds or subtracts a number of days, hours, minutes and seconds. */
+void icaltime_adjust(struct icaltimetype *tt, const int days,
+ const int hours, const int minutes, const int seconds);
-/* Create a new time from a weeknumber and a year. */
-struct icaltimetype icaltime_from_week_number(short week_number, short year);
+/** Normalize the icaltime, so that all fields are within the normal range. */
+struct icaltimetype icaltime_normalize(const struct icaltimetype t);
-/* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
-int icaltime_compare(struct icaltimetype a,struct icaltimetype b);
+/** convert tt, of timezone tzid, into a utc time. Does nothing if the
+ time is already UTC. */
+struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt,
+ icaltimezone *zone);
-/* like icaltime_compare, but only use the date parts. */
-int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b);
+/** Return the number of days in the given month */
+int icaltime_days_in_month(const int month, const int year);
-/* Return the number of days in the given month */
-short icaltime_days_in_month(short month,short year);
+/** @brief calculate an icaltimespan given a start and end time. */
+struct icaltime_span icaltime_span_new(struct icaltimetype dtstart,
+ struct icaltimetype dtend,
+ int is_busy);
-#endif /* !ICALTIME_H */
+/** @brief Returns true if the two spans overlap **/
+int icaltime_span_overlaps(icaltime_span *s1,
+ icaltime_span *s2);
+/** @brief Returns true if the span is totally within the containing
+ * span
+ */
+int icaltime_span_contains(icaltime_span *s,
+ icaltime_span *container);
+
+
+#endif /* !ICALTIME_H */
@@ -158,4 +405,2 @@ short icaltime_days_in_month(short month,short year);
- $Id$
- $Locker$
@@ -198,4 +443,6 @@ int icaldurationtype_as_int(struct icaldurationtype duration);
char* icaldurationtype_as_ical_string(struct icaldurationtype d);
-struct icaldurationtype icaldurationtype_null_duration();
+struct icaldurationtype icaldurationtype_null_duration(void);
+struct icaldurationtype icaldurationtype_bad_duration(void);
int icaldurationtype_is_null_duration(struct icaldurationtype d);
+int icaldurationtype_is_bad_duration(struct icaldurationtype d);
@@ -217,4 +464,2 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
- $Id$
- $Locker$
@@ -253,8 +498,8 @@ struct icalperiodtype icalperiodtype_from_string (const char* str);
const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
-struct icalperiodtype icalperiodtype_null_period();
-int icalperiodtype_is_null_period(struct icalperiodtype p);
-int icalperiodtype_is_valid_period(struct icalperiodtype p);
+struct icalperiodtype icalperiodtype_null_period(void);
+int icalperiodtype_is_null_period(struct icalperiodtype p);
+int icalperiodtype_is_valid_period(struct icalperiodtype p);
@@ -309,2 +554,3 @@ typedef enum icalcomponent_kind {
ICAL_VCALENDAR_COMPONENT,
+ ICAL_VAGENDA_COMPONENT,
ICAL_VFREEBUSY_COMPONENT,
@@ -364,3 +610,7 @@ typedef enum icalrequeststatus {
ICAL_3_14_NOCAP_STATUS,
+ ICAL_3_15_INVCOMMAND,
ICAL_4_0_BUSY_STATUS,
+ ICAL_4_1_STORE_ACCESS_DENIED,
+ ICAL_4_2_STORE_FAILED,
+ ICAL_4_3_STORE_NOT_FOUND,
ICAL_5_0_MAYBE_STATUS,
@@ -368,3 +618,5 @@ typedef enum icalrequeststatus {
ICAL_5_2_NOSERVICE_STATUS,
- ICAL_5_3_NOSCHED_STATUS
+ ICAL_5_3_NOSCHED_STATUS,
+ ICAL_6_1_CONTAINER_NOT_FOUND,
+ ICAL_9_0_UNRECOGNIZED_COMMAND
} icalrequeststatus;
@@ -376,2 +628,3 @@ short icalenum_reqstat_minor(icalrequeststatus stat);
icalrequeststatus icalenum_num_to_reqstat(short major, short minor);
+char* icalenum_reqstat_code(icalrequeststatus stat);
@@ -450,35 +703,2 @@ icalrequeststatus icalenum_num_to_reqstat(short major, short minor);
-/* This type type should probably be an opaque type... */
-struct icalattachtype
-{
- void* binary;
- int owns_binary;
-
- char* base64;
- int owns_base64;
-
- char* url;
-
- int refcount;
-
-};
-
-/* converts base64 to binary, fetches url and stores as binary, or
- just returns data */
-
-struct icalattachtype* icalattachtype_new(void);
-void icalattachtype_add_reference(struct icalattachtype* v);
-void icalattachtype_free(struct icalattachtype* v);
-
-void icalattachtype_set_url(struct icalattachtype* v, char* url);
-char* icalattachtype_get_url(struct icalattachtype* v);
-
-void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
- int owns);
-char* icalattachtype_get_base64(struct icalattachtype* v);
-
-void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
- int owns);
-void* icalattachtype_get_binary(struct icalattachtype* v);
-
struct icalgeotype
@@ -503,2 +723,3 @@ struct icaltriggertype
+struct icaltriggertype icaltriggertype_from_int(const int reltime);
struct icaltriggertype icaltriggertype_from_string(const char* str);
@@ -506,2 +727,3 @@ struct icaltriggertype icaltriggertype_from_string(const char* str);
int icaltriggertype_is_null_trigger(struct icaltriggertype tr);
+int icaltriggertype_is_bad_trigger(struct icaltriggertype tr);
@@ -573,2 +795,7 @@ void icaltimezonetype_free(struct icaltimezonetype tzt);
the License at http://www.mozilla.org/MPL/
+*/
+
+/**
+@file icalrecur.h
+@brief Routines for dealing with recurring time
@@ -577,2 +804,4 @@ How to use:
1) Get a rule and a start time from a component
+
+@code
icalproperty rrule;
@@ -584,12 +813,21 @@ How to use:
start = icalproperty_get_dtstart(dtstart);
+@endcode
Or, just make them up:
+
+@code
recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE");
dtstart = icaltime_from_string("19970101T123000")
+@endcode
2) Create an iterator
+
+@code
icalrecur_iterator* ritr;
ritr = icalrecur_iterator_new(recur,start);
+@endcode
3) Iterator over the occurrences
+
+@code
struct icaltimetype next;
@@ -599,2 +837,3 @@ Or, just make them up:
}
+@endcode
@@ -603,3 +842,3 @@ whatever timezone that dtstart is in.
-======================================================================*/
+*/
@@ -610,5 +849,5 @@ whatever timezone that dtstart is in.
-/***********************************************************************
+/*
* Recurrance enumerations
-**********************************************************************/
+ */
@@ -649,3 +888,5 @@ enum {
-/********************** Recurrence type routines **************/
+/**
+ * Recurrence type routines
+ */
@@ -664,3 +905,3 @@ enum {
-/* Main struct for holding digested recurrence rules */
+/** Main struct for holding digested recurrence rules */
struct icalrecurrencetype
@@ -701,19 +942,21 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *r);
-/* The 'day' element of the by_day array is encoded to allow
-representation of both the day of the week ( Monday, Tueday), but also
-the Nth day of the week ( First tuesday of the month, last thursday of
-the year) These routines decode the day values */
+/**
+ * Array Encoding
+ *
+ * The 'day' element of the by_day array is encoded to allow
+ * representation of both the day of the week ( Monday, Tueday), but also
+ * the Nth day of the week ( First tuesday of the month, last thursday of
+ * the year) These routines decode the day values
+ */
-/* 1 == Monday, etc. */
+/** 1 == Monday, etc. */
enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
-/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
-short icalrecurrencetype_day_position(short day);
+/** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
+int icalrecurrencetype_day_position(short day);
-/***********************************************************************
- * Recurrance rule parser
-**********************************************************************/
+/** Recurrance rule parser */
-/* Convert between strings ans recurrencetype structures. */
+/** Convert between strings and recurrencetype structures. */
struct icalrecurrencetype icalrecurrencetype_from_string(const char* str);
@@ -722,7 +965,7 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur);
-/********** recurrence iteration routines ********************/
+/** Recurrence iteration routines */
-typedef void icalrecur_iterator;
+typedef struct icalrecur_iterator_impl icalrecur_iterator;
-/* Create a new recurrence rule iterator */
+/** Create a new recurrence rule iterator */
icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
@@ -730,10 +973,14 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
-/* Get the next occurrence from an iterator */
+/** Get the next occurrence from an iterator */
struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*);
-/* Free the iterator */
+void icalrecur_iterator_decrement_count(icalrecur_iterator*);
+
+/** Free the iterator */
void icalrecur_iterator_free(icalrecur_iterator*);
-/* Fills array up with at most 'count' time_t values, each
- representing an occurrence time in seconds past the POSIX epoch */
+/**
+ * Fills array up with at most 'count' time_t values, each
+ * representing an occurrence time in seconds past the POSIX epoch
+ */
int icalrecur_expand_recurrence(char* rule, time_t start,
@@ -745,2 +992,62 @@ int icalrecur_expand_recurrence(char* rule, time_t start,
/*======================================================================
+ FILE: icalattach.h
+ CREATOR: acampi 28 May 02
+
+
+ (C) COPYRIGHT 2002, Andrea Campi
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalattach.h
+
+======================================================================*/
+
+#ifndef ICALATTACH_H
+#define ICALATTACH_H
+
+
+typedef struct icalattach_impl icalattach;
+
+typedef void (* icalattach_free_fn_t) (unsigned char *data, void *user_data);
+
+icalattach *icalattach_new_from_url (const char *url);
+icalattach *icalattach_new_from_data (unsigned char *data,
+ icalattach_free_fn_t free_fn, void *free_fn_data);
+
+void icalattach_ref (icalattach *attach);
+void icalattach_unref (icalattach *attach);
+
+int icalattach_get_is_url (icalattach *attach);
+const char *icalattach_get_url (icalattach *attach);
+unsigned char *icalattach_get_data (icalattach *attach);
+
+struct icalattachtype* icalattachtype_new(void);
+void icalattachtype_add_reference(struct icalattachtype* v);
+void icalattachtype_free(struct icalattachtype* v);
+
+void icalattachtype_set_url(struct icalattachtype* v, char* url);
+char* icalattachtype_get_url(struct icalattachtype* v);
+
+void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
+ int owns);
+char* icalattachtype_get_base64(struct icalattachtype* v);
+
+void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
+ int owns);
+void* icalattachtype_get_binary(struct icalattachtype* v);
+
+
+
+#endif /* !ICALATTACH_H */
+/* -*- Mode: C -*- */
+/*======================================================================
FILE: icalvalue.h
@@ -749,4 +1056,2 @@ int icalrecur_expand_recurrence(char* rule, time_t start,
- $Id$
- $Locker$
@@ -775,3 +1080,3 @@ int icalrecur_expand_recurrence(char* rule, time_t start,
-typedef void icalvalue;
+typedef struct icalvalue_impl icalvalue;
@@ -781,7 +1086,3 @@ void icalvalue_set_x(icalvalue* value, const char* v);
icalvalue* icalvalue_new_x(const char* v);
-const char* icalvalue_get_x(icalvalue* value);
-
-icalvalue* icalvalue_new_attach (struct icalattachtype* v);
-void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v);
-struct icalattachtype* icalvalue_get_attach(icalvalue* value);
+const char* icalvalue_get_x(const icalvalue* value);
@@ -789,3 +1090,3 @@ icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
-struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
+struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value);
@@ -793,3 +1094,3 @@ icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
-struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
+struct icaltriggertype icalvalue_get_trigger(const icalvalue* value);
@@ -797,3 +1098,7 @@ icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
+struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value);
+
+icalvalue *icalvalue_new_attach (icalattach *attach);
+void icalvalue_set_attach (icalvalue *value, icalattach *attach);
+icalattach *icalvalue_get_attach (const icalvalue *value);
@@ -801,3 +1106,2 @@ void icalvalue_reset_kind(icalvalue* value);
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalvalue_kind {
@@ -805,28 +1109,29 @@ typedef enum icalvalue_kind {
ICAL_QUERY_VALUE=5001,
- ICAL_TRIGGER_VALUE=5002,
- ICAL_STATUS_VALUE=5003,
- ICAL_TRANSP_VALUE=5004,
- ICAL_CLASS_VALUE=5005,
- ICAL_DATE_VALUE=5006,
+ ICAL_DATE_VALUE=5002,
+ ICAL_ATTACH_VALUE=5003,
+ ICAL_GEO_VALUE=5004,
+ ICAL_STATUS_VALUE=5005,
+ ICAL_TRANSP_VALUE=5006,
ICAL_STRING_VALUE=5007,
- ICAL_INTEGER_VALUE=5008,
- ICAL_PERIOD_VALUE=5009,
- ICAL_TEXT_VALUE=5010,
- ICAL_DURATION_VALUE=5011,
- ICAL_BOOLEAN_VALUE=5012,
- ICAL_URI_VALUE=5013,
- ICAL_DATETIMEPERIOD_VALUE=5014,
- ICAL_GEO_VALUE=5015,
- ICAL_DATETIME_VALUE=5016,
- ICAL_UTCOFFSET_VALUE=5017,
- ICAL_ATTACH_VALUE=5018,
- ICAL_ACTION_VALUE=5019,
+ ICAL_TEXT_VALUE=5008,
+ ICAL_REQUESTSTATUS_VALUE=5009,
+ ICAL_BINARY_VALUE=5010,
+ ICAL_PERIOD_VALUE=5011,
+ ICAL_FLOAT_VALUE=5012,
+ ICAL_DATETIMEPERIOD_VALUE=5013,
+ ICAL_INTEGER_VALUE=5014,
+ ICAL_CLASS_VALUE=5015,
+ ICAL_URI_VALUE=5016,
+ ICAL_DURATION_VALUE=5017,
+ ICAL_BOOLEAN_VALUE=5018,
+ ICAL_X_VALUE=5019,
ICAL_CALADDRESS_VALUE=5020,
- ICAL_X_VALUE=5021,
- ICAL_FLOAT_VALUE=5022,
- ICAL_REQUESTSTATUS_VALUE=5023,
- ICAL_METHOD_VALUE=5024,
- ICAL_BINARY_VALUE=5025,
- ICAL_RECUR_VALUE=5026,
- ICAL_NO_VALUE=5027
+ ICAL_TRIGGER_VALUE=5021,
+ ICAL_XLICCLASS_VALUE=5022,
+ ICAL_RECUR_VALUE=5023,
+ ICAL_ACTION_VALUE=5024,
+ ICAL_DATETIME_VALUE=5025,
+ ICAL_UTCOFFSET_VALUE=5026,
+ ICAL_METHOD_VALUE=5027,
+ ICAL_NO_VALUE=5028
} icalvalue_kind ;
@@ -888,7 +1193,41 @@ typedef enum icalproperty_transp {
ICAL_TRANSP_OPAQUE = 10039,
- ICAL_TRANSP_TRANSPARENT = 10040,
- ICAL_TRANSP_NONE = 10041
+ ICAL_TRANSP_OPAQUENOCONFLICT = 10040,
+ ICAL_TRANSP_TRANSPARENT = 10041,
+ ICAL_TRANSP_TRANSPARENTNOCONFLICT = 10042,
+ ICAL_TRANSP_NONE = 10043
} icalproperty_transp;
-#define ICALPROPERTY_LAST_ENUM 10042
+typedef enum icalproperty_xlicclass {
+ ICAL_XLICCLASS_X = 10044,
+ ICAL_XLICCLASS_PUBLISHNEW = 10045,
+ ICAL_XLICCLASS_PUBLISHUPDATE = 10046,
+ ICAL_XLICCLASS_PUBLISHFREEBUSY = 10047,
+ ICAL_XLICCLASS_REQUESTNEW = 10048,
+ ICAL_XLICCLASS_REQUESTUPDATE = 10049,
+ ICAL_XLICCLASS_REQUESTRESCHEDULE = 10050,
+ ICAL_XLICCLASS_REQUESTDELEGATE = 10051,
+ ICAL_XLICCLASS_REQUESTNEWORGANIZER = 10052,
+ ICAL_XLICCLASS_REQUESTFORWARD = 10053,
+ ICAL_XLICCLASS_REQUESTSTATUS = 10054,
+ ICAL_XLICCLASS_REQUESTFREEBUSY = 10055,
+ ICAL_XLICCLASS_REPLYACCEPT = 10056,
+ ICAL_XLICCLASS_REPLYDECLINE = 10057,
+ ICAL_XLICCLASS_REPLYDELEGATE = 10058,
+ ICAL_XLICCLASS_REPLYCRASHERACCEPT = 10059,
+ ICAL_XLICCLASS_REPLYCRASHERDECLINE = 10060,
+ ICAL_XLICCLASS_ADDINSTANCE = 10061,
+ ICAL_XLICCLASS_CANCELEVENT = 10062,
+ ICAL_XLICCLASS_CANCELINSTANCE = 10063,
+ ICAL_XLICCLASS_CANCELALL = 10064,
+ ICAL_XLICCLASS_REFRESH = 10065,
+ ICAL_XLICCLASS_COUNTER = 10066,
+ ICAL_XLICCLASS_DECLINECOUNTER = 10067,
+ ICAL_XLICCLASS_MALFORMED = 10068,
+ ICAL_XLICCLASS_OBSOLETE = 10069,
+ ICAL_XLICCLASS_MISSEQUENCED = 10070,
+ ICAL_XLICCLASS_UNKNOWN = 10071,
+ ICAL_XLICCLASS_NONE = 10072
+} icalproperty_xlicclass;
+
+#define ICALPROPERTY_LAST_ENUM 10073
@@ -897,3 +1236,3 @@ typedef enum icalproperty_transp {
icalvalue* icalvalue_new_query(const char* v);
-const char* icalvalue_get_query(icalvalue* value);
+const char* icalvalue_get_query(const icalvalue* value);
void icalvalue_set_query(icalvalue* value, const char* v);
@@ -901,5 +1240,17 @@ void icalvalue_set_query(icalvalue* value, const char* v);
+ /* DATE */
+icalvalue* icalvalue_new_date(struct icaltimetype v);
+struct icaltimetype icalvalue_get_date(const icalvalue* value);
+void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
+
+
+ /* GEO */
+icalvalue* icalvalue_new_geo(struct icalgeotype v);
+struct icalgeotype icalvalue_get_geo(const icalvalue* value);
+void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
+
+
/* STATUS */
icalvalue* icalvalue_new_status(enum icalproperty_status v);
-enum icalproperty_status icalvalue_get_status(icalvalue* value);
+enum icalproperty_status icalvalue_get_status(const icalvalue* value);
void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
@@ -909,3 +1260,3 @@ void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
icalvalue* icalvalue_new_transp(enum icalproperty_transp v);
-enum icalproperty_transp icalvalue_get_transp(icalvalue* value);
+enum icalproperty_transp icalvalue_get_transp(const icalvalue* value);
void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
@@ -913,24 +1264,24 @@ void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
- /* CLASS */
-icalvalue* icalvalue_new_class(enum icalproperty_class v);
-enum icalproperty_class icalvalue_get_class(icalvalue* value);
-void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
+ /* STRING */
+icalvalue* icalvalue_new_string(const char* v);
+const char* icalvalue_get_string(const icalvalue* value);
+void icalvalue_set_string(icalvalue* value, const char* v);
- /* DATE */
-icalvalue* icalvalue_new_date(struct icaltimetype v);
-struct icaltimetype icalvalue_get_date(icalvalue* value);
-void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
+ /* TEXT */
+icalvalue* icalvalue_new_text(const char* v);
+const char* icalvalue_get_text(const icalvalue* value);
+void icalvalue_set_text(icalvalue* value, const char* v);
- /* STRING */
-icalvalue* icalvalue_new_string(const char* v);
-const char* icalvalue_get_string(icalvalue* value);
-void icalvalue_set_string(icalvalue* value, const char* v);
+ /* REQUEST-STATUS */
+icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
+struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value);
+void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
- /* INTEGER */
-icalvalue* icalvalue_new_integer(int v);
-int icalvalue_get_integer(icalvalue* value);
-void icalvalue_set_integer(icalvalue* value, int v);
+ /* BINARY */
+icalvalue* icalvalue_new_binary(const char* v);
+const char* icalvalue_get_binary(const icalvalue* value);
+void icalvalue_set_binary(icalvalue* value, const char* v);
@@ -939,3 +1290,3 @@ void icalvalue_set_integer(icalvalue* value, int v);
icalvalue* icalvalue_new_period(struct icalperiodtype v);
-struct icalperiodtype icalvalue_get_period(icalvalue* value);
+struct icalperiodtype icalvalue_get_period(const icalvalue* value);
void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
@@ -943,18 +1294,18 @@ void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
- /* TEXT */
-icalvalue* icalvalue_new_text(const char* v);
-const char* icalvalue_get_text(icalvalue* value);
-void icalvalue_set_text(icalvalue* value, const char* v);
+ /* FLOAT */
+icalvalue* icalvalue_new_float(float v);
+float icalvalue_get_float(const icalvalue* value);
+void icalvalue_set_float(icalvalue* value, float v);
- /* DURATION */
-icalvalue* icalvalue_new_duration(struct icaldurationtype v);
-struct icaldurationtype icalvalue_get_duration(icalvalue* value);
-void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
+ /* INTEGER */
+icalvalue* icalvalue_new_integer(int v);
+int icalvalue_get_integer(const icalvalue* value);
+void icalvalue_set_integer(icalvalue* value, int v);
- /* BOOLEAN */
-icalvalue* icalvalue_new_boolean(int v);
-int icalvalue_get_boolean(icalvalue* value);
-void icalvalue_set_boolean(icalvalue* value, int v);
+ /* CLASS */
+icalvalue* icalvalue_new_class(enum icalproperty_class v);
+enum icalproperty_class icalvalue_get_class(const icalvalue* value);
+void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
@@ -963,3 +1314,3 @@ void icalvalue_set_boolean(icalvalue* value, int v);
icalvalue* icalvalue_new_uri(const char* v);
-const char* icalvalue_get_uri(icalvalue* value);
+const char* icalvalue_get_uri(const icalvalue* value);
void icalvalue_set_uri(icalvalue* value, const char* v);
@@ -967,18 +1318,24 @@ void icalvalue_set_uri(icalvalue* value, const char* v);
- /* GEO */
-icalvalue* icalvalue_new_geo(struct icalgeotype v);
-struct icalgeotype icalvalue_get_geo(icalvalue* value);
-void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
+ /* DURATION */
+icalvalue* icalvalue_new_duration(struct icaldurationtype v);
+struct icaldurationtype icalvalue_get_duration(const icalvalue* value);
+void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
- /* DATE-TIME */
-icalvalue* icalvalue_new_datetime(struct icaltimetype v);
-struct icaltimetype icalvalue_get_datetime(icalvalue* value);
-void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
+ /* BOOLEAN */
+icalvalue* icalvalue_new_boolean(int v);
+int icalvalue_get_boolean(const icalvalue* value);
+void icalvalue_set_boolean(icalvalue* value, int v);
- /* UTC-OFFSET */
-icalvalue* icalvalue_new_utcoffset(int v);
-int icalvalue_get_utcoffset(icalvalue* value);
-void icalvalue_set_utcoffset(icalvalue* value, int v);
+ /* CAL-ADDRESS */
+icalvalue* icalvalue_new_caladdress(const char* v);
+const char* icalvalue_get_caladdress(const icalvalue* value);
+void icalvalue_set_caladdress(icalvalue* value, const char* v);
+
+
+ /* X-LIC-CLASS */
+icalvalue* icalvalue_new_xlicclass(enum icalproperty_xlicclass v);
+enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value);
+void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v);
@@ -987,3 +1344,3 @@ void icalvalue_set_utcoffset(icalvalue* value, int v);
icalvalue* icalvalue_new_action(enum icalproperty_action v);
-enum icalproperty_action icalvalue_get_action(icalvalue* value);
+enum icalproperty_action icalvalue_get_action(const icalvalue* value);
void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
@@ -991,18 +1348,12 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
- /* CAL-ADDRESS */
-icalvalue* icalvalue_new_caladdress(const char* v);
-const char* icalvalue_get_caladdress(icalvalue* value);
-void icalvalue_set_caladdress(icalvalue* value, const char* v);
-
-
- /* FLOAT */
-icalvalue* icalvalue_new_float(float v);
-float icalvalue_get_float(icalvalue* value);
-void icalvalue_set_float(icalvalue* value, float v);
+ /* DATE-TIME */
+icalvalue* icalvalue_new_datetime(struct icaltimetype v);
+struct icaltimetype icalvalue_get_datetime(const icalvalue* value);
+void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
- /* REQUEST-STATUS */
-icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
-struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value);
-void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
+ /* UTC-OFFSET */
+icalvalue* icalvalue_new_utcoffset(int v);
+int icalvalue_get_utcoffset(const icalvalue* value);
+void icalvalue_set_utcoffset(icalvalue* value, int v);
@@ -1011,11 +1362,5 @@ void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
icalvalue* icalvalue_new_method(enum icalproperty_method v);
-enum icalproperty_method icalvalue_get_method(icalvalue* value);
+enum icalproperty_method icalvalue_get_method(const icalvalue* value);
void icalvalue_set_method(icalvalue* value, enum icalproperty_method v);
-
- /* BINARY */
-icalvalue* icalvalue_new_binary(const char* v);
-const char* icalvalue_get_binary(icalvalue* value);
-void icalvalue_set_binary(icalvalue* value, const char* v);
-
#endif /*ICALVALUE_H*/
@@ -1027,4 +1372,2 @@ void icalvalue_set_binary(icalvalue* value, const char* v);
- $Id$
- $Locker$
@@ -1053,3 +1396,3 @@ void icalvalue_set_binary(icalvalue* value, const char* v);
-typedef void icalparameter;
+typedef struct icalparameter_impl icalparameter;
@@ -1058,3 +1401,2 @@ int icalparameter_string_to_enum(const char* str);
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalparameter_kind {
@@ -1137,3 +1479,3 @@ typedef enum icalparameter_related {
ICAL_RELATED_START = 20031,
- ICAL_RELATED_END = 20032,
+ ICAL_RELATED_END = 20032,
ICAL_RELATED_NONE = 20033
@@ -1193,3 +1535,5 @@ typedef enum icalparameter_xliccomparetype {
ICAL_XLICCOMPARETYPE_REGEX = 20072,
- ICAL_XLICCOMPARETYPE_NONE = 20073
+ ICAL_XLICCOMPARETYPE_ISNULL = 20073,
+ ICAL_XLICCOMPARETYPE_ISNOTNULL = 20074,
+ ICAL_XLICCOMPARETYPE_NONE = 20075
} icalparameter_xliccomparetype;
@@ -1197,45 +1541,26 @@ typedef enum icalparameter_xliccomparetype {
typedef enum icalparameter_xlicerrortype {
- ICAL_XLICERRORTYPE_X = 20074,
- ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075,
- ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076,
- ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077,
- ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078,
- ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079,
- ICAL_XLICERRORTYPE_INVALIDITIP = 20080,
- ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081,
- ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082,
- ICAL_XLICERRORTYPE_NONE = 20083
+ ICAL_XLICERRORTYPE_X = 20076,
+ ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20077,
+ ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20078,
+ ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20079,
+ ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20080,
+ ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20081,
+ ICAL_XLICERRORTYPE_INVALIDITIP = 20082,
+ ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20083,
+ ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20084,
+ ICAL_XLICERRORTYPE_VCALPROPPARSEERROR = 20085,
+ ICAL_XLICERRORTYPE_NONE = 20086
} icalparameter_xlicerrortype;
-#define ICALPARAMETER_LAST_ENUM 20084
+#define ICALPARAMETER_LAST_ENUM 20087
-/* DELEGATED-FROM */
-icalparameter* icalparameter_new_delegatedfrom(const char* v);
-const char* icalparameter_get_delegatedfrom(icalparameter* value);
-void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
-
-/* DELEGATED-TO */
-icalparameter* icalparameter_new_delegatedto(const char* v);
-const char* icalparameter_get_delegatedto(icalparameter* value);
-void icalparameter_set_delegatedto(icalparameter* value, const char* v);
-
-/* RANGE */
-icalparameter* icalparameter_new_range(icalparameter_range v);
-icalparameter_range icalparameter_get_range(icalparameter* value);
-void icalparameter_set_range(icalparameter* value, icalparameter_range v);
-
-/* ENCODING */
-icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
-icalparameter_encoding icalparameter_get_encoding(icalparameter* value);
-void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
-
-/* RSVP */
-icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
-icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value);
-void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
+/* LANGUAGE */
+icalparameter* icalparameter_new_language(const char* v);
+const char* icalparameter_get_language(const icalparameter* value);
+void icalparameter_set_language(icalparameter* value, const char* v);
-/* PARTSTAT */
-icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
-icalparameter_partstat icalparameter_get_partstat(icalparameter* value);
-void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
+/* DIR */
+icalparameter* icalparameter_new_dir(const char* v);
+const char* icalparameter_get_dir(const icalparameter* value);
+void icalparameter_set_dir(icalparameter* value, const char* v);
@@ -1243,24 +1568,29 @@ void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
icalparameter* icalparameter_new_reltype(icalparameter_reltype v);
-icalparameter_reltype icalparameter_get_reltype(icalparameter* value);
+icalparameter_reltype icalparameter_get_reltype(const icalparameter* value);
void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v);
-/* CUTYPE */
-icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
-icalparameter_cutype icalparameter_get_cutype(icalparameter* value);
-void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
-
-/* MEMBER */
-icalparameter* icalparameter_new_member(const char* v);
-const char* icalparameter_get_member(icalparameter* value);
-void icalparameter_set_member(icalparameter* value, const char* v);
-
/* FMTTYPE */
icalparameter* icalparameter_new_fmttype(const char* v);
-const char* icalparameter_get_fmttype(icalparameter* value);
+const char* icalparameter_get_fmttype(const icalparameter* value);
void icalparameter_set_fmttype(icalparameter* value, const char* v);
-/* SENT-BY */
-icalparameter* icalparameter_new_sentby(const char* v);
-const char* icalparameter_get_sentby(icalparameter* value);
-void icalparameter_set_sentby(icalparameter* value, const char* v);
+/* TZID */
+icalparameter* icalparameter_new_tzid(const char* v);
+const char* icalparameter_get_tzid(const icalparameter* value);
+void icalparameter_set_tzid(icalparameter* value, const char* v);
+
+/* RANGE */
+icalparameter* icalparameter_new_range(icalparameter_range v);
+icalparameter_range icalparameter_get_range(const icalparameter* value);
+void icalparameter_set_range(icalparameter* value, icalparameter_range v);
+
+/* DELEGATED-TO */
+icalparameter* icalparameter_new_delegatedto(const char* v);
+const char* icalparameter_get_delegatedto(const icalparameter* value);
+void icalparameter_set_delegatedto(icalparameter* value, const char* v);
+
+/* CN */
+icalparameter* icalparameter_new_cn(const char* v);
+const char* icalparameter_get_cn(const icalparameter* value);
+void icalparameter_set_cn(icalparameter* value, const char* v);
@@ -1268,24 +1598,34 @@ void icalparameter_set_sentby(icalparameter* value, const char* v);
icalparameter* icalparameter_new_value(icalparameter_value v);
-icalparameter_value icalparameter_get_value(icalparameter* value);
+icalparameter_value icalparameter_get_value(const icalparameter* value);
void icalparameter_set_value(icalparameter* value, icalparameter_value v);
-/* ALTREP */
-icalparameter* icalparameter_new_altrep(const char* v);
-const char* icalparameter_get_altrep(icalparameter* value);
-void icalparameter_set_altrep(icalparameter* value, const char* v);
+/* X-LIC-COMPARETYPE */
+icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
+icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* value);
+void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
-/* DIR */
-icalparameter* icalparameter_new_dir(const char* v);
-const char* icalparameter_get_dir(icalparameter* value);
-void icalparameter_set_dir(icalparameter* value, const char* v);
+/* X */
+icalparameter* icalparameter_new_x(const char* v);
+const char* icalparameter_get_x(const icalparameter* value);
+void icalparameter_set_x(icalparameter* value, const char* v);
-/* RELATED */
-icalparameter* icalparameter_new_related(icalparameter_related v);
-icalparameter_related icalparameter_get_related(icalparameter* value);
-void icalparameter_set_related(icalparameter* value, icalparameter_related v);
+/* SENT-BY */
+icalparameter* icalparameter_new_sentby(const char* v);
+const char* icalparameter_get_sentby(const icalparameter* value);
+void icalparameter_set_sentby(icalparameter* value, const char* v);
-/* CN */
-icalparameter* icalparameter_new_cn(const char* v);
-const char* icalparameter_get_cn(icalparameter* value);
-void icalparameter_set_cn(icalparameter* value, const char* v);
+/* MEMBER */
+icalparameter* icalparameter_new_member(const char* v);
+const char* icalparameter_get_member(const icalparameter* value);
+void icalparameter_set_member(icalparameter* value, const char* v);
+
+/* RSVP */
+icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
+icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* value);
+void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
+
+/* CUTYPE */
+icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
+icalparameter_cutype icalparameter_get_cutype(const icalparameter* value);
+void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
@@ -1293,24 +1633,24 @@ void icalparameter_set_cn(icalparameter* value, const char* v);
icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v);
-icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value);
+icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* value);
void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v);
-/* X */
-icalparameter* icalparameter_new_x(const char* v);
-const char* icalparameter_get_x(icalparameter* value);
-void icalparameter_set_x(icalparameter* value, const char* v);
+/* RELATED */
+icalparameter* icalparameter_new_related(icalparameter_related v);
+icalparameter_related icalparameter_get_related(const icalparameter* value);
+void icalparameter_set_related(icalparameter* value, icalparameter_related v);
-/* LANGUAGE */
-icalparameter* icalparameter_new_language(const char* v);
-const char* icalparameter_get_language(icalparameter* value);
-void icalparameter_set_language(icalparameter* value, const char* v);
+/* ENCODING */
+icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
+icalparameter_encoding icalparameter_get_encoding(const icalparameter* value);
+void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
-/* ROLE */
-icalparameter* icalparameter_new_role(icalparameter_role v);
-icalparameter_role icalparameter_get_role(icalparameter* value);
-void icalparameter_set_role(icalparameter* value, icalparameter_role v);
+/* ALTREP */
+icalparameter* icalparameter_new_altrep(const char* v);
+const char* icalparameter_get_altrep(const icalparameter* value);
+void icalparameter_set_altrep(icalparameter* value, const char* v);
-/* X-LIC-COMPARETYPE */
-icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
-icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value);
-void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
+/* DELEGATED-FROM */
+icalparameter* icalparameter_new_delegatedfrom(const char* v);
+const char* icalparameter_get_delegatedfrom(const icalparameter* value);
+void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
@@ -1318,9 +1658,14 @@ void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xlicc
icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v);
-icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value);
+icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* value);
void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v);
-/* TZID */
-icalparameter* icalparameter_new_tzid(const char* v);
-const char* icalparameter_get_tzid(icalparameter* value);
-void icalparameter_set_tzid(icalparameter* value, const char* v);
+/* ROLE */
+icalparameter* icalparameter_new_role(icalparameter_role v);
+icalparameter_role icalparameter_get_role(const icalparameter* value);
+void icalparameter_set_role(icalparameter* value, icalparameter_role v);
+
+/* PARTSTAT */
+icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
+icalparameter_partstat icalparameter_get_partstat(const icalparameter* value);
+void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
@@ -1328,2 +1673,147 @@ void icalparameter_set_tzid(icalparameter* value, const char* v);
+/* Everything below this line is machine generated. Do not edit. */
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalvalue.h
+ CREATOR: eric 20 March 1999
+
+
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalvalue.h
+
+ ======================================================================*/
+
+#ifndef ICALVALUE_H
+#define ICALVALUE_H
+
+#include <time.h>
+
+/* Defined in icalderivedvalue.h */
+/*typedef struct icalvalue_impl icalvalue;*/
+
+icalvalue* icalvalue_new(icalvalue_kind kind);
+
+icalvalue* icalvalue_new_clone(const icalvalue* value);
+
+icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
+
+void icalvalue_free(icalvalue* value);
+
+int icalvalue_is_valid(const icalvalue* value);
+
+const char* icalvalue_as_ical_string(const icalvalue* value);
+
+icalvalue_kind icalvalue_isa(const icalvalue* value);
+
+int icalvalue_isa_value(void*);
+
+icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalvalue *b);
+
+
+/* Special, non autogenerated value accessors */
+
+icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
+void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
+struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value);
+
+icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
+void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
+struct icaltriggertype icalvalue_get_trigger(const icalvalue* value);
+
+icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
+void icalvalue_set_datetimeperiod(icalvalue* value,
+ struct icaldatetimeperiodtype v);
+struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value);
+
+/* Convert enumerations */
+
+icalvalue_kind icalvalue_string_to_kind(const char* str);
+const char* icalvalue_kind_to_string(const icalvalue_kind kind);
+
+/** Check validity of a specific icalvalue_kind **/
+int icalvalue_kind_is_valid(const icalvalue_kind kind);
+
+/** Encode a character string in ical format, esacpe certain characters, etc. */
+int icalvalue_encode_ical_string(const char *szText, char *szEncText, int MaxBufferLen);
+
+#endif /*ICALVALUE_H*/
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalparam.h
+ CREATOR: eric 20 March 1999
+
+
+
+
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalparam.h
+
+ ======================================================================*/
+
+#ifndef ICALPARAM_H
+#define ICALPARAM_H
+
+
+/* Declared in icalderivedparameter.h */
+/*typedef struct icalparameter_impl icalparameter;*/
+
+icalparameter* icalparameter_new(icalparameter_kind kind);
+icalparameter* icalparameter_new_clone(icalparameter* p);
+
+/* Create from string of form "PARAMNAME=VALUE" */
+icalparameter* icalparameter_new_from_string(const char* value);
+
+/* Create from just the value, the part after the "=" */
+icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
+
+void icalparameter_free(icalparameter* parameter);
+
+char* icalparameter_as_ical_string(icalparameter* parameter);
+
+int icalparameter_is_valid(icalparameter* parameter);
+
+icalparameter_kind icalparameter_isa(icalparameter* parameter);
+
+int icalparameter_isa_parameter(void* param);
+
+/* Acess the name of an X parameer */
+void icalparameter_set_xname (icalparameter* param, const char* v);
+const char* icalparameter_get_xname(icalparameter* param);
+void icalparameter_set_xvalue (icalparameter* param, const char* v);
+const char* icalparameter_get_xvalue(icalparameter* param);
+
+/* Convert enumerations */
+
+const char* icalparameter_kind_to_string(icalparameter_kind kind);
+icalparameter_kind icalparameter_string_to_kind(const char* string);
+
+
+
+#endif
/* -*- Mode: C -*-
@@ -1333,3 +1823,2 @@ void icalparameter_set_tzid(icalparameter* value, const char* v);
- $Id$
@@ -1344,6 +1833,4 @@ void icalparameter_set_tzid(icalparameter* value, const char* v);
-typedef void icalproperty;
+typedef struct icalproperty_impl icalproperty;
-
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalproperty_kind {
@@ -1351,5 +1838,9 @@ typedef enum icalproperty_kind {
ICAL_ACTION_PROPERTY,
+ ICAL_ALLOWCONFLICT_PROPERTY,
ICAL_ATTACH_PROPERTY,
ICAL_ATTENDEE_PROPERTY,
+ ICAL_CALID_PROPERTY,
+ ICAL_CALMASTER_PROPERTY,
ICAL_CALSCALE_PROPERTY,
+ ICAL_CARID_PROPERTY,
ICAL_CATEGORIES_PROPERTY,
@@ -1360,2 +1851,6 @@ typedef enum icalproperty_kind {
ICAL_CREATED_PROPERTY,
+ ICAL_DECREED_PROPERTY,
+ ICAL_DEFAULTCHARSET_PROPERTY,
+ ICAL_DEFAULTLOCALE_PROPERTY,
+ ICAL_DEFAULTTZID_PROPERTY,
ICAL_DESCRIPTION_PROPERTY,
@@ -1367,2 +1862,3 @@ typedef enum icalproperty_kind {
ICAL_EXDATE_PROPERTY,
+ ICAL_EXPAND_PROPERTY,
ICAL_EXRULE_PROPERTY,
@@ -1376,2 +1872,3 @@ typedef enum icalproperty_kind {
ICAL_ORGANIZER_PROPERTY,
+ ICAL_OWNER_PROPERTY,
ICAL_PERCENTCOMPLETE_PROPERTY,
@@ -1384,2 +1881,3 @@ typedef enum icalproperty_kind {
ICAL_RELATEDTO_PROPERTY,
+ ICAL_RELCALID_PROPERTY,
ICAL_REPEAT_PROPERTY,
@@ -1404,2 +1902,3 @@ typedef enum icalproperty_kind {
ICAL_X_PROPERTY,
+ ICAL_XLICCLASS_PROPERTY,
ICAL_XLICCLUSTERCOUNT_PROPERTY,
@@ -1415,3 +1914,2 @@ typedef enum icalproperty_kind {
-icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
@@ -1420,8 +1918,13 @@ icalproperty* icalproperty_new_action(enum icalproperty_action v);
void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v);
-enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...);
+enum icalproperty_action icalproperty_get_action(const icalproperty* prop);icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
+
+/* ALLOW-CONFLICT */
+icalproperty* icalproperty_new_allowconflict(const char* v);
+void icalproperty_set_allowconflict(icalproperty* prop, const char* v);
+const char* icalproperty_get_allowconflict(const icalproperty* prop);icalproperty* icalproperty_vanew_allowconflict(const char* v, ...);
/* ATTACH */
-icalproperty* icalproperty_new_attach(struct icalattachtype* v);
-void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v);
-struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
+icalproperty* icalproperty_new_attach(icalattach * v);
+void icalproperty_set_attach(icalproperty* prop, icalattach * v);
+icalattach * icalproperty_get_attach(const icalproperty* prop);icalproperty* icalproperty_vanew_attach(icalattach * v, ...);
@@ -1430,3 +1933,13 @@ icalproperty* icalproperty_new_attendee(const char* v);
void icalproperty_set_attendee(icalproperty* prop, const char* v);
-const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
+const char* icalproperty_get_attendee(const icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
+
+/* CALID */
+icalproperty* icalproperty_new_calid(const char* v);
+void icalproperty_set_calid(icalproperty* prop, const char* v);
+const char* icalproperty_get_calid(const icalproperty* prop);icalproperty* icalproperty_vanew_calid(const char* v, ...);
+
+/* CALMASTER */
+icalproperty* icalproperty_new_calmaster(const char* v);
+void icalproperty_set_calmaster(icalproperty* prop, const char* v);
+const char* icalproperty_get_calmaster(const icalproperty* prop);icalproperty* icalproperty_vanew_calmaster(const char* v, ...);
@@ -1435,3 +1948,8 @@ icalproperty* icalproperty_new_calscale(const char* v);
void icalproperty_set_calscale(icalproperty* prop, const char* v);
-const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
+const char* icalproperty_get_calscale(const icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
+
+/* CARID */
+icalproperty* icalproperty_new_carid(const char* v);
+void icalproperty_set_carid(icalproperty* prop, const char* v);
+const char* icalproperty_get_carid(const icalproperty* prop);icalproperty* icalproperty_vanew_carid(const char* v, ...);
@@ -1440,8 +1958,8 @@ icalproperty* icalproperty_new_categories(const char* v);
void icalproperty_set_categories(icalproperty* prop, const char* v);
-const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...);
+const char* icalproperty_get_categories(const icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
/* CLASS */
-icalproperty* icalproperty_new_class(const char* v);
-void icalproperty_set_class(icalproperty* prop, const char* v);
-const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
+icalproperty* icalproperty_new_class(enum icalproperty_class v);
+void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v);
+enum icalproperty_class icalproperty_get_class(const icalproperty* prop);icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...);
@@ -1450,3 +1968,3 @@ icalproperty* icalproperty_new_comment(const char* v);
void icalproperty_set_comment(icalproperty* prop, const char* v);
-const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
+const char* icalproperty_get_comment(const icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
@@ -1455,3 +1973,3 @@ icalproperty* icalproperty_new_completed(struct icaltimetype v);
void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
+struct icaltimetype icalproperty_get_completed(const icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
@@ -1460,3 +1978,3 @@ icalproperty* icalproperty_new_contact(const char* v);
void icalproperty_set_contact(icalproperty* prop, const char* v);
-const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
+const char* icalproperty_get_contact(const icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
@@ -1465,3 +1983,23 @@ icalproperty* icalproperty_new_created(struct icaltimetype v);
void icalproperty_set_created(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
+struct icaltimetype icalproperty_get_created(const icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
+
+/* DECREED */
+icalproperty* icalproperty_new_decreed(const char* v);
+void icalproperty_set_decreed(icalproperty* prop, const char* v);
+const char* icalproperty_get_decreed(const icalproperty* prop);icalproperty* icalproperty_vanew_decreed(const char* v, ...);
+
+/* DEFAULT-CHARSET */
+icalproperty* icalproperty_new_defaultcharset(const char* v);
+void icalproperty_set_defaultcharset(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaultcharset(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...);
+
+/* DEFAULT-LOCALE */
+icalproperty* icalproperty_new_defaultlocale(const char* v);
+void icalproperty_set_defaultlocale(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaultlocale(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...);
+
+/* DEFAULT-TZID */
+icalproperty* icalproperty_new_defaulttzid(const char* v);
+void icalproperty_set_defaulttzid(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaulttzid(const icalproperty* prop);icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...);
@@ -1470,3 +2008,3 @@ icalproperty* icalproperty_new_description(const char* v);
void icalproperty_set_description(icalproperty* prop, const char* v);
-const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
+const char* icalproperty_get_description(const icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
@@ -1475,3 +2013,3 @@ icalproperty* icalproperty_new_dtend(struct icaltimetype v);
void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtend(const icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
@@ -1480,3 +2018,3 @@ icalproperty* icalproperty_new_dtstamp(struct icaltimetype v);
void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
@@ -1485,3 +2023,3 @@ icalproperty* icalproperty_new_dtstart(struct icaltimetype v);
void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
@@ -1490,3 +2028,3 @@ icalproperty* icalproperty_new_due(struct icaltimetype v);
void icalproperty_set_due(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
+struct icaltimetype icalproperty_get_due(const icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
@@ -1495,3 +2033,3 @@ icalproperty* icalproperty_new_duration(struct icaldurationtype v);
void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v);
-struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
+struct icaldurationtype icalproperty_get_duration(const icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
@@ -1500,3 +2038,8 @@ icalproperty* icalproperty_new_exdate(struct icaltimetype v);
void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
+struct icaltimetype icalproperty_get_exdate(const icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
+
+/* EXPAND */
+icalproperty* icalproperty_new_expand(int v);
+void icalproperty_set_expand(icalproperty* prop, int v);
+int icalproperty_get_expand(const icalproperty* prop);icalproperty* icalproperty_vanew_expand(int v, ...);
@@ -1505,3 +2048,3 @@ icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v);
void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v);
-struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
+struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
@@ -1510,3 +2053,3 @@ icalproperty* icalproperty_new_freebusy(struct icalperiodtype v);
void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v);
-struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
+struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
@@ -1515,3 +2058,3 @@ icalproperty* icalproperty_new_geo(struct icalgeotype v);
void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v);
-struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
+struct icalgeotype icalproperty_get_geo(const icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
@@ -1520,3 +2063,3 @@ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v);
void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
+struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
@@ -1525,3 +2068,3 @@ icalproperty* icalproperty_new_location(const char* v);
void icalproperty_set_location(icalproperty* prop, const char* v);
-const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
+const char* icalproperty_get_location(const icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
@@ -1530,3 +2073,3 @@ icalproperty* icalproperty_new_maxresults(int v);
void icalproperty_set_maxresults(icalproperty* prop, int v);
-int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
+int icalproperty_get_maxresults(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
@@ -1535,3 +2078,3 @@ icalproperty* icalproperty_new_maxresultssize(int v);
void icalproperty_set_maxresultssize(icalproperty* prop, int v);
-int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
+int icalproperty_get_maxresultssize(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
@@ -1540,3 +2083,3 @@ icalproperty* icalproperty_new_method(enum icalproperty_method v);
void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v);
-enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
+enum icalproperty_method icalproperty_get_method(const icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
@@ -1545,3 +2088,8 @@ icalproperty* icalproperty_new_organizer(const char* v);
void icalproperty_set_organizer(icalproperty* prop, const char* v);
-const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
+const char* icalproperty_get_organizer(const icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
+
+/* OWNER */
+icalproperty* icalproperty_new_owner(const char* v);
+void icalproperty_set_owner(icalproperty* prop, const char* v);
+const char* icalproperty_get_owner(const icalproperty* prop);icalproperty* icalproperty_vanew_owner(const char* v, ...);
@@ -1550,3 +2098,3 @@ icalproperty* icalproperty_new_percentcomplete(int v);
void icalproperty_set_percentcomplete(icalproperty* prop, int v);
-int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
+int icalproperty_get_percentcomplete(const icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
@@ -1555,3 +2103,3 @@ icalproperty* icalproperty_new_priority(int v);
void icalproperty_set_priority(icalproperty* prop, int v);
-int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
+int icalproperty_get_priority(const icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
@@ -1560,3 +2108,3 @@ icalproperty* icalproperty_new_prodid(const char* v);
void icalproperty_set_prodid(icalproperty* prop, const char* v);
-const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
+const char* icalproperty_get_prodid(const icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
@@ -1565,3 +2113,3 @@ icalproperty* icalproperty_new_query(const char* v);
void icalproperty_set_query(icalproperty* prop, const char* v);
-const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
+const char* icalproperty_get_query(const icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
@@ -1570,3 +2118,3 @@ icalproperty* icalproperty_new_queryname(const char* v);
void icalproperty_set_queryname(icalproperty* prop, const char* v);
-const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
+const char* icalproperty_get_queryname(const icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
@@ -1575,3 +2123,3 @@ icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v);
void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
+struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
@@ -1580,3 +2128,3 @@ icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v);
void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
+struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
@@ -1585,3 +2133,8 @@ icalproperty* icalproperty_new_relatedto(const char* v);
void icalproperty_set_relatedto(icalproperty* prop, const char* v);
-const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
+const char* icalproperty_get_relatedto(const icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
+
+/* RELCALID */
+icalproperty* icalproperty_new_relcalid(const char* v);
+void icalproperty_set_relcalid(icalproperty* prop, const char* v);
+const char* icalproperty_get_relcalid(const icalproperty* prop);icalproperty* icalproperty_vanew_relcalid(const char* v, ...);
@@ -1590,3 +2143,3 @@ icalproperty* icalproperty_new_repeat(int v);
void icalproperty_set_repeat(icalproperty* prop, int v);
-int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
+int icalproperty_get_repeat(const icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
@@ -1595,3 +2148,3 @@ icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v);
void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v);
-struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
+struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
@@ -1600,3 +2153,3 @@ icalproperty* icalproperty_new_resources(const char* v);
void icalproperty_set_resources(icalproperty* prop, const char* v);
-const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
+const char* icalproperty_get_resources(const icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
@@ -1605,3 +2158,3 @@ icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v);
void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v);
-struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
+struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
@@ -1610,3 +2163,3 @@ icalproperty* icalproperty_new_scope(const char* v);
void icalproperty_set_scope(icalproperty* prop, const char* v);
-const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
+const char* icalproperty_get_scope(const icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
@@ -1615,3 +2168,3 @@ icalproperty* icalproperty_new_sequence(int v);
void icalproperty_set_sequence(icalproperty* prop, int v);
-int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
+int icalproperty_get_sequence(const icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
@@ -1620,3 +2173,3 @@ icalproperty* icalproperty_new_status(enum icalproperty_status v);
void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v);
-enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
+enum icalproperty_status icalproperty_get_status(const icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
@@ -1625,3 +2178,3 @@ icalproperty* icalproperty_new_summary(const char* v);
void icalproperty_set_summary(icalproperty* prop, const char* v);
-const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
+const char* icalproperty_get_summary(const icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
@@ -1630,8 +2183,8 @@ icalproperty* icalproperty_new_target(const char* v);
void icalproperty_set_target(icalproperty* prop, const char* v);
-const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...);
+const char* icalproperty_get_target(const icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
/* TRANSP */
-icalproperty* icalproperty_new_transp(const char* v);
-void icalproperty_set_transp(icalproperty* prop, const char* v);
-const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
+icalproperty* icalproperty_new_transp(enum icalproperty_transp v);
+void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v);
+enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop);icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...);
@@ -1640,3 +2193,3 @@ icalproperty* icalproperty_new_trigger(struct icaltriggertype v);
void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v);
-struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
+struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
@@ -1645,3 +2198,3 @@ icalproperty* icalproperty_new_tzid(const char* v);
void icalproperty_set_tzid(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
+const char* icalproperty_get_tzid(const icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
@@ -1650,3 +2203,3 @@ icalproperty* icalproperty_new_tzname(const char* v);
void icalproperty_set_tzname(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
+const char* icalproperty_get_tzname(const icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
@@ -1655,3 +2208,3 @@ icalproperty* icalproperty_new_tzoffsetfrom(int v);
void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v);
-int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
+int icalproperty_get_tzoffsetfrom(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
@@ -1660,3 +2213,3 @@ icalproperty* icalproperty_new_tzoffsetto(int v);
void icalproperty_set_tzoffsetto(icalproperty* prop, int v);
-int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
+int icalproperty_get_tzoffsetto(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
@@ -1665,3 +2218,3 @@ icalproperty* icalproperty_new_tzurl(const char* v);
void icalproperty_set_tzurl(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
+const char* icalproperty_get_tzurl(const icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
@@ -1670,3 +2223,3 @@ icalproperty* icalproperty_new_uid(const char* v);
void icalproperty_set_uid(icalproperty* prop, const char* v);
-const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
+const char* icalproperty_get_uid(const icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
@@ -1675,3 +2228,3 @@ icalproperty* icalproperty_new_url(const char* v);
void icalproperty_set_url(icalproperty* prop, const char* v);
-const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
+const char* icalproperty_get_url(const icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
@@ -1680,3 +2233,3 @@ icalproperty* icalproperty_new_version(const char* v);
void icalproperty_set_version(icalproperty* prop, const char* v);
-const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
+const char* icalproperty_get_version(const icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
@@ -1685,3 +2238,8 @@ icalproperty* icalproperty_new_x(const char* v);
void icalproperty_set_x(icalproperty* prop, const char* v);
-const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
+const char* icalproperty_get_x(const icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
+
+/* X-LIC-CLASS */
+icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v);
+void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v);
+enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...);
@@ -1690,3 +2248,3 @@ icalproperty* icalproperty_new_xlicclustercount(const char* v);
void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
+const char* icalproperty_get_xlicclustercount(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
@@ -1695,3 +2253,3 @@ icalproperty* icalproperty_new_xlicerror(const char* v);
void icalproperty_set_xlicerror(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
+const char* icalproperty_get_xlicerror(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
@@ -1700,3 +2258,3 @@ icalproperty* icalproperty_new_xlicmimecharset(const char* v);
void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
+const char* icalproperty_get_xlicmimecharset(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
@@ -1705,3 +2263,3 @@ icalproperty* icalproperty_new_xlicmimecid(const char* v);
void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
+const char* icalproperty_get_xlicmimecid(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
@@ -1710,3 +2268,3 @@ icalproperty* icalproperty_new_xlicmimecontenttype(const char* v);
void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
+const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
@@ -1715,3 +2273,3 @@ icalproperty* icalproperty_new_xlicmimeencoding(const char* v);
void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
+const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
@@ -1720,3 +2278,3 @@ icalproperty* icalproperty_new_xlicmimefilename(const char* v);
void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
+const char* icalproperty_get_xlicmimefilename(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
@@ -1725,150 +2283,6 @@ icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v);
void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop);
-
-#endif /*ICALPROPERTY_H*/
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalvalue.h
- CREATOR: eric 20 March 1999
-
-
- $Id$
- $Locker$
-
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalvalue.h
-
- ======================================================================*/
-
-#ifndef ICALVALUE_H
-#define ICALVALUE_H
-
-#include <time.h>
-
-/* Defined in icalderivedvalue.h */
-/*typedef void icalvalue;*/
-
-icalvalue* icalvalue_new(icalvalue_kind kind);
-
-icalvalue* icalvalue_new_clone(icalvalue* value);
-
-icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
-
-void icalvalue_free(icalvalue* value);
-
-int icalvalue_is_valid(icalvalue* value);
-
-const char* icalvalue_as_ical_string(icalvalue* value);
-
-icalvalue_kind icalvalue_isa(icalvalue* value);
-
-int icalvalue_isa_value(void*);
-
-icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b);
-
-
-/* Special, non autogenerated value accessors */
-
-icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
-void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
-struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
-
-icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
-void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
-struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
-
-icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
-void icalvalue_set_datetimeperiod(icalvalue* value,
- struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
-
-/* Convert enumerations */
-
-icalvalue_kind icalvalue_string_to_kind(const char* str);
-const char* icalvalue_kind_to_string(icalvalue_kind kind);
-
-
-#endif /*ICALVALUE_H*/
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalparam.h
- CREATOR: eric 20 March 1999
-
-
- $Id$
- $Locker$
-
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalparam.h
-
- ======================================================================*/
-
-#ifndef ICALPARAM_H
-#define ICALPARAM_H
-
-
-/* Declared in icalderivedparameter.h */
-/*typedef void icalparameter;*/
+const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
-icalparameter* icalparameter_new(icalparameter_kind kind);
-icalparameter* icalparameter_new_clone(icalparameter* p);
-
-/* Create from string of form "PARAMNAME=VALUE" */
-icalparameter* icalparameter_new_from_string(const char* value);
-
-/* Create from just the value, the part after the "=" */
-icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
-
-void icalparameter_free(icalparameter* parameter);
-
-char* icalparameter_as_ical_string(icalparameter* parameter);
-
-int icalparameter_is_valid(icalparameter* parameter);
-
-icalparameter_kind icalparameter_isa(icalparameter* parameter);
-
-int icalparameter_isa_parameter(void* param);
-
-/* Acess the name of an X parameer */
-void icalparameter_set_xname (icalparameter* param, const char* v);
-const char* icalparameter_get_xname(icalparameter* param);
-void icalparameter_set_xvalue (icalparameter* param, const char* v);
-const char* icalparameter_get_xvalue(icalparameter* param);
-
-/* Convert enumerations */
-const char* icalparameter_kind_to_string(icalparameter_kind kind);
-icalparameter_kind icalparameter_string_to_kind(const char* string);
-
-
-
-#endif
+#endif /*ICALPROPERTY_H*/
/* -*- Mode: C -*- */
@@ -1879,4 +2293,2 @@ icalparameter_kind icalparameter_string_to_kind(const char* string);
- $Id$
- $Locker$
@@ -1906,3 +2318,3 @@ icalparameter_kind icalparameter_string_to_kind(const char* string);
#include <time.h>
-
+#include <stdarg.h> /* for va_... */
@@ -1911,3 +2323,3 @@ icalparameter_kind icalparameter_string_to_kind(const char* string);
/* Actually in icalderivedproperty.h:
- typedef void icalproperty; */
+ typedef struct icalproperty_impl icalproperty; */
@@ -1927,2 +2339,3 @@ int icalproperty_isa_property(void* property);
+void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
@@ -1937,3 +2350,14 @@ void icalproperty_remove_parameter(icalproperty* prop,
-int icalproperty_count_parameters(icalproperty* prop);
+void icalproperty_remove_parameter_by_kind(icalproperty* prop,
+ icalparameter_kind kind);
+
+void icalproperty_remove_parameter_by_name(icalproperty* prop,
+ const char *name);
+
+void icalproperty_remove_parameter_by_ref(icalproperty* prop,
+ icalparameter *param);
+
+
+
+int icalproperty_count_parameters(const icalproperty* prop);
@@ -1948,4 +2372,4 @@ void icalproperty_set_value_from_string(icalproperty* prop,const char* value, co
-icalvalue* icalproperty_get_value(icalproperty* prop);
-const char* icalproperty_get_value_as_string(icalproperty* prop);
+icalvalue* icalproperty_get_value(const icalproperty* prop);
+const char* icalproperty_get_value_as_string(const icalproperty* prop);
@@ -1956,5 +2380,7 @@ const char* icalproperty_get_x_name(icalproperty* prop);
-/* Return 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 */
-const char* icalproperty_get_name (icalproperty* prop);
+/** Return 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
+ */
+const char* icalproperty_get_property_name (const icalproperty* prop);
@@ -1965,3 +2391,3 @@ icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
-icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
+icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
const char* icalproperty_kind_to_string(icalproperty_kind kind);
@@ -1969,2 +2395,5 @@ icalproperty_kind icalproperty_string_to_kind(const char* string);
+/** Check validity of a specific icalproperty_kind **/
+int icalproperty_kind_is_valid(const icalproperty_kind kind);
+
icalproperty_method icalproperty_string_to_method(const char* str);
@@ -1975,2 +2404,3 @@ const char* icalproperty_enum_to_string(int e);
int icalproperty_string_to_enum(const char* str);
+int icalproperty_kind_and_string_to_enum(const int kind, const char* str);
@@ -1985,64 +2415,2 @@ int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
#endif /*ICALPROPERTY_H*/
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalattendee.h
- CREATOR: eric 8 Mar 01
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icaltypes.h
-
-======================================================================*/
-
-#ifndef ICALATTENDEE_H
-#define ICALATTENDEE_H
-
-#include <time.h>
-
-struct icalorganizertype {
- const char* value;
- const char* common_name;
- const char* dir;
- const char* sentby;
- const char* language;
-
-};
-
-/* Create a copy of the given organizer. Libical will not own the
- memory for the strings in the copy; the call must free them */
-struct icalorganizertype icalorganizertype_new_clone(struct icalorganizertype a);
-
-
-struct icalattendeetype {
- const char* cuid; /* Cal user id, contents of the property value */
- /*icalparameter_cutype cutype;*/
- const char* member;
- /*icalparameter_role role;*/
- int rsvp;
- const char* delto;
- const char* delfrom;
- const char* sentby;
- const char* cn;
- const char* dir;
- const char* language;
-};
-
-/* Create a copy of the given attendee. Libical will not own the
- memory for the strings in the copy; the call must free them */
-struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a);
-
-
-#endif /* !ICALATTENDEE_H */
/*======================================================================
@@ -2059,19 +2427,17 @@ struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a);
-typedef void* pvl_list;
-typedef void* pvl_elem;
+typedef struct pvl_list_t* pvl_list;
+typedef struct pvl_elem_t* pvl_elem;
-/*
- struct pvl_elem_t
-
- This type is private. Always use pvl_elem instead. The struct would
- not even appear in this header except to make code in the USE_MACROS
- blocks work
+/**
+ * This type is private. Always use pvl_elem instead. The struct would
+ * not even appear in this header except to make code in the USE_MACROS
+ * blocks work
+ */
- */
typedef struct pvl_elem_t
{
- int MAGIC; /* Magic Identifier */
- void *d; /* Pointer to data user is storing */
- struct pvl_elem_t *next; /* Next element */
- struct pvl_elem_t *prior; /* prior element */
+ int MAGIC; /**< Magic Identifier */
+ void *d; /**< Pointer to data user is storing */
+ struct pvl_elem_t *next; /**< Next element */
+ struct pvl_elem_t *prior; /**< Prior element */
} pvl_elem_t;
@@ -2080,4 +2446,6 @@ typedef struct pvl_elem_t
-/* This global is incremented for each call to pvl_new_element(); it gives each
- * list a unique identifer */
+/**
+ * This global is incremented for each call to pvl_new_element(); it gives each
+ * list a unique identifer
+ */
@@ -2130,4 +2498,7 @@ pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v);
-/* Pass each element in the list to a function */
-typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/
+/**
+ * Pass each element in the list to a function
+ * a is list elem, b is other data
+ */
+typedef void (*pvl_applyf)(void* a, void* b);
void pvl_apply(pvl_list l,pvl_applyf f, void *v);
@@ -2141,2 +2512,63 @@ void pvl_apply(pvl_list l,pvl_applyf f, void *v);
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*======================================================================
+ FILE: icalarray.h
+ CREATOR: Damon Chaplin 07 March 2001
+
+
+
+ (C) COPYRIGHT 2001, Ximian, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+======================================================================*/
+
+
+#ifndef ICALARRAY_H
+#define ICALARRAY_H
+
+/** @file icalarray.h
+ *
+ * @brief An array of arbitrarily-sized elements which grows
+ * dynamically as elements are added.
+ */
+
+typedef struct _icalarray icalarray;
+struct _icalarray {
+ unsigned int element_size;
+ unsigned int increment_size;
+ unsigned int num_elements;
+ unsigned int space_allocated;
+ void *data;
+};
+
+
+
+icalarray *icalarray_new (int element_size,
+ int increment_size);
+void icalarray_free (icalarray *array);
+
+void icalarray_append (icalarray *array,
+ void *element);
+void icalarray_remove_element_at (icalarray *array,
+ int position);
+
+void *icalarray_element_at (icalarray *array,
+ int position);
+
+void icalarray_sort (icalarray *array,
+ int (*compare) (const void *, const void *));
+
+
+#endif /* ICALARRAY_H */
/* -*- Mode: C -*- */
@@ -2168,3 +2600,12 @@ void pvl_apply(pvl_list l,pvl_applyf f, void *v);
-typedef void icalcomponent;
+typedef struct icalcomponent_impl icalcomponent;
+
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+/** @brief An opaque struct representing a timezone.
+ * We declare this here to avoid a circular dependancy.
+ */
+typedef struct _icaltimezone icaltimezone;
+#endif
+
@@ -2189,3 +2630,3 @@ int icalcomponent_is_valid(icalcomponent* component);
-icalcomponent_kind icalcomponent_isa(icalcomponent* component);
+icalcomponent_kind icalcomponent_isa(const icalcomponent* component);
@@ -2235,2 +2676,10 @@ int icalcomponent_count_components(icalcomponent* component,
+/**
+ This takes 2 VCALENDAR components and merges the second one into the first,
+ resolving any problems with conflicting TZIDs. comp_to_merge will no
+ longer exist after calling this function. */
+void icalcomponent_merge_component(icalcomponent* comp,
+ icalcomponent* comp_to_merge);
+
+
/* Iteration Routines. There are two forms of iterators, internal and
@@ -2259,12 +2708,16 @@ icalcomponent* icalcompiter_deref(icalcompiter* i);
+/* Working with embedded error properties */
+/* Check the component against itip rules and insert error properties*/
/* Working with embedded error properties */
+int icalcomponent_check_restrictions(icalcomponent* comp);
+/** Count embedded errors. */
int icalcomponent_count_errors(icalcomponent* component);
-/* Remove all X-LIC-ERROR properties*/
+/** Remove all X-LIC-ERROR properties*/
void icalcomponent_strip_errors(icalcomponent* component);
-/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
+/** Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
void icalcomponent_convert_errors(icalcomponent* component);
@@ -2276,3 +2729,5 @@ void icalcomponent_set_parent(icalcomponent* component,
-/* Kind conversion routiens */
+/* Kind conversion routines */
+
+int icalcomponent_kind_is_valid(const icalcomponent_kind kind);
@@ -2289,3 +2744,3 @@ wrong component subtypes. */
-/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
+/** For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
VJOURNAL */
@@ -2293,3 +2748,3 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
-/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
+/** For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
times of an event in UTC */
@@ -2315,2 +2770,5 @@ void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
+struct icaltimetype icalcomponent_get_due(icalcomponent* comp);
+void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v);
+
void icalcomponent_set_duration(icalcomponent* comp,
@@ -2325,3 +2783,2 @@ void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
-
void icalcomponent_set_summary(icalcomponent* comp, const char* v);
@@ -2335,2 +2792,5 @@ const char* icalcomponent_get_uid(icalcomponent* comp);
+void icalcomponent_set_relcalid(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_relcalid(icalcomponent* comp);
+
void icalcomponent_set_recurrenceid(icalcomponent* comp,
@@ -2339,19 +2799,37 @@ struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
+void icalcomponent_set_description(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_description(icalcomponent* comp);
-void icalcomponent_set_organizer(icalcomponent* comp,
- struct icalorganizertype org);
- struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
+void icalcomponent_set_location(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_location(icalcomponent* comp);
+void icalcomponent_set_sequence(icalcomponent* comp, int v);
+int icalcomponent_get_sequence(icalcomponent* comp);
-void icalcomponent_add_attendee(icalcomponent *comp,
- struct icalattendeetype attendee);
+void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v);
+enum icalproperty_status icalcomponent_get_status(icalcomponent* comp);
-int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
-/* Get the Nth attendee. Out of range indices return an attendee
- with cuid == 0 */
-struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
- int index);
+/** Calls the given function for each TZID parameter found in the
+ component, and any subcomponents. */
+void icalcomponent_foreach_tzid(icalcomponent* comp,
+ void (*callback)(icalparameter *param, void *data),
+ void *callback_data);
+/** Returns the icaltimezone in the component corresponding to the
+ TZID, or NULL if it can't be found. */
+icaltimezone* icalcomponent_get_timezone(icalcomponent* comp,
+ const char *tzid);
+int icalproperty_recurrence_is_excluded(icalcomponent *comp,
+ struct icaltimetype *dtstart,
+ struct icaltimetype *recurtime);
+
+void icalcomponent_foreach_recurrence(icalcomponent* comp,
+ struct icaltimetype start,
+ struct icaltimetype end,
+ void (*callback)(icalcomponent *comp,
+ struct icaltime_span *span,
+ void *data),
+ void *callback_data);
@@ -2369,9 +2847,168 @@ icalcomponent* icalcomponent_new_xstandard();
icalcomponent* icalcomponent_new_xdaylight();
+icalcomponent* icalcomponent_new_vagenda();
+icalcomponent* icalcomponent_new_vquery();
+#endif /* !ICALCOMPONENT_H */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*======================================================================
+ FILE: icaltimezone.h
+ CREATOR: Damon Chaplin 15 March 2001
-#endif /* !ICALCOMPONENT_H */
+ (C) COPYRIGHT 2001, Damon Chaplin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+======================================================================*/
+/**
+ * @file icaltimezone.h
+ * @brief timezone handling routines
+ */
+
+#ifndef ICALTIMEZONE_H
+#define ICALTIMEZONE_H
+
+#include <stdio.h> /* For FILE* */
+
+
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+/** @brief An opaque struct representing a timezone.
+ * We declare this here to avoid a circular dependancy.
+ */
+typedef struct _icaltimezone icaltimezone;
+#endif
+
+/**
+ * @par Creating/Destroying individual icaltimezones.
+ */
+
+/** Creates a new icaltimezone. */
+icaltimezone *icaltimezone_new (void);
+
+/** Frees all memory used for the icaltimezone. Set free_struct to free the
+ icaltimezone struct as well. */
+void icaltimezone_free (icaltimezone *zone,
+ int free_struct);
+
+
+/**
+ * @par Accessing timezones.
+ */
+
+/** Free any builtin timezone information **/
+void icaltimezone_free_builtin_timezones(void);
+
+/** Returns the array of builtin icaltimezones. */
+icalarray* icaltimezone_get_builtin_timezones (void);
+/** Returns a single builtin timezone, given its Olson city name. */
+icaltimezone* icaltimezone_get_builtin_timezone (const char *location);
+/** Returns a single builtin timezone, given its TZID. */
+icaltimezone* icaltimezone_get_builtin_timezone_from_tzid (const char *tzid);
+
+/** Returns the UTC timezone. */
+icaltimezone* icaltimezone_get_utc_timezone (void);
+
+/** Returns the TZID of a timezone. */
+char* icaltimezone_get_tzid (icaltimezone *zone);
+
+/** Returns the city name of a timezone. */
+char* icaltimezone_get_location (icaltimezone *zone);
+
+/** Returns the TZNAME properties used in the latest STANDARD and DAYLIGHT
+ components. If they are the same it will return just one, e.g. "LMT".
+ If they are different it will format them like "EST/EDT". Note that this
+ may also return NULL. */
+char* icaltimezone_get_tznames (icaltimezone *zone);
+
+/** Returns the latitude of a builtin timezone. */
+double icaltimezone_get_latitude (icaltimezone *zone);
+
+/** Returns the longitude of a builtin timezone. */
+double icaltimezone_get_longitude (icaltimezone *zone);
+
+/** Returns the VTIMEZONE component of a timezone. */
+icalcomponent* icaltimezone_get_component (icaltimezone *zone);
+
+/** Sets the VTIMEZONE component of an icaltimezone, initializing the tzid,
+ location & tzname fields. It returns 1 on success or 0 on failure, i.e.
+ no TZID was found. */
+int icaltimezone_set_component (icaltimezone *zone,
+ icalcomponent *comp);
+
+/**
+ * @par Converting times between timezones.
+ */
+
+void icaltimezone_convert_time (struct icaltimetype *tt,
+ icaltimezone *from_zone,
+ icaltimezone *to_zone);
+
+
+/**
+ * @par Getting offsets from UTC.
+ */
+
+/** Calculates the UTC offset of a given local time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+/** Calculates the UTC offset of a given UTC time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+
+
+/*
+ * Handling arrays of timezones. Mainly for internal use.
+ */
+icalarray* icaltimezone_array_new (void);
+
+void icaltimezone_array_append_from_vtimezone (icalarray *timezones,
+ icalcomponent *child);
+void icaltimezone_array_free (icalarray *timezones);
+
+
+/*
+ * @par Handling the default location the timezone files
+ */
+
+/** Set the directory to look for the zonefiles */
+void set_zone_directory(char *path);
+
+/** Free memory dedicated to the zonefile directory */
+void free_zone_directory(void);
+
+/*
+ * @par Debugging Output.
+ */
+
+/** Dumps information about changes in the timezone up to and including
+ max_year. */
+int icaltimezone_dump_changes (icaltimezone *zone,
+ int max_year,
+ FILE *fp);
+
+#endif /* ICALTIMEZONE_H */
/* -*- Mode: C -*- */
@@ -2381,3 +3018,2 @@ icalcomponent* icalcomponent_new_xdaylight();
- $Id$
@@ -2408,12 +3044,13 @@ icalcomponent* icalcomponent_new_xdaylight();
-typedef void* icalparser;
+typedef struct icalparser_impl icalparser;
-/***********************************************************************
- * Line-oriented parsing.
+/**
+ * @file icalparser.h
+ * @brief Line-oriented parsing.
*
- * Create a new parser via icalparse_new_parser, then add ines one at
+ * Create a new parser via icalparse_new_parser, then add lines one at
* a time with icalparse_add_line(). icalparser_add_line() will return
* non-zero when it has finished with a component.
- ***********************************************************************/
+ */
@@ -2434,3 +3071,3 @@ void icalparser_free(icalparser* parser);
-/***********************************************************************
+/**
* Message oriented parsing. icalparser_parse takes a string that
@@ -2439,9 +3076,11 @@ void icalparser_free(icalparser* parser);
* pointer to a function that returns one content line per invocation
- **********************************************************************/
+ */
icalcomponent* icalparser_parse(icalparser *parser,
- char* (*line_gen_func)(char *s, size_t size, void *d));
+ char* (*line_gen_func)(char *s, size_t size, void *d));
-/* Set the data that icalparser_parse will give to the line_gen_func
- as the parameter 'd'*/
+/**
+ Set the data that icalparser_parse will give to the line_gen_func
+ as the parameter 'd'
+ */
void icalparser_set_gen_data(icalparser* parser, void* data);
@@ -2456,3 +3095,3 @@ icalcomponent* icalparser_parse_string(const char* str);
-/* Use the flex/bison parser to turn a string into a value type */
+/** Use the flex/bison parser to turn a string into a value type */
icalvalue* icalparser_parse_value(icalvalue_kind kind,
@@ -2460,6 +3099,6 @@ icalvalue* icalparser_parse_value(icalvalue_kind kind,
-/* Given a line generator function, return a single iCal content line.*/
+/** Given a line generator function, return a single iCal content line.*/
char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d));
-char* string_line_generator(char *out, size_t buf_size, void *d);
+char* icalparser_string_line_generator(char *out, size_t buf_size, void *d);
@@ -2472,4 +3111,2 @@ char* string_line_generator(char *out, size_t buf_size, void *d);
- $Id$
- $Locker$
@@ -2494,4 +3131,7 @@ char* string_line_generator(char *out, size_t buf_size, void *d);
+#ifndef WIN32
#include <sys/types.h> /* for size_t */
-
+#else
+#include <stddef.h>
+#endif
@@ -2503,3 +3143,3 @@ char* icalmemory_tmp_copy(const char* str);
-/* Add an externally allocated buffer to the ring. */
+/** Add an externally allocated buffer to the ring. */
void icalmemory_add_tmp_buffer(void*);
@@ -2507,3 +3147,3 @@ void icalmemory_add_tmp_buffer(void*);
-/* Free all memory used in the ring */
+/** Free all memory used in the ring */
void icalmemory_free_ring(void);
@@ -2518,3 +3158,4 @@ void icalmemory_free_buffer(void* buf);
-/* icalmemory_append_string will copy the string 'string' to the
+/**
+ icalmemory_append_string will copy the string 'string' to the
buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
@@ -2534,3 +3175,3 @@ void icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
-/* icalmemory_append_char is similar, but is appends a character instead of a string */
+/** icalmemory_append_char is similar, but is appends a character instead of a string */
void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
@@ -2538,4 +3179,4 @@ void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
-/* A wrapper around strdup. Partly to trap calls to strdup, partly
- because in -ansi, gcc on Red Hat claims that strudup is undeclared */
+/** A wrapper around strdup. Partly to trap calls to strdup, partly
+ because in -ansi, gcc on Red Hat claims that strdup is undeclared */
char* icalmemory_strdup(const char *s);
@@ -2551,3 +3192,2 @@ char* icalmemory_strdup(const char *s);
- $Id$
@@ -2580,3 +3220,2 @@ char* icalmemory_strdup(const char *s);
#ifdef HAVE_CONFIG_H
-#include "config.h"
#endif
@@ -2586,3 +3225,3 @@ char* icalmemory_strdup(const char *s);
-/* This routine is called before any error is triggered. It is called
+/** This routine is called before any error is triggered. It is called
by icalerror_set_errno, so it does not appear in all of the macros
@@ -2594,3 +3233,3 @@ void icalerror_crash_here(void);
typedef enum icalerrorenum {
-
+ ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */
ICAL_BADARG_ERROR,
@@ -2604,4 +3243,3 @@ typedef enum icalerrorenum {
ICAL_UNIMPLEMENTED_ERROR,
- ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/
- ICAL_NO_ERROR
+ ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/
@@ -2609,6 +3247,10 @@ typedef enum icalerrorenum {
-/* The libical error enumeration, like errno*/
-extern icalerrorenum icalerrno;
+icalerrorenum * icalerrno_return(void);
+#define icalerrno (*(icalerrno_return()))
-/* If true, libicl aborts after a call to icalerror_set_error*/
+/** If true, libicl aborts after a call to icalerror_set_error
+ *
+ * @warning NOT THREAD SAFE -- recommended that you do not change
+ * this in a multithreaded program.
+ */
extern int icalerror_errors_are_fatal;
@@ -2625,2 +3267,3 @@ extern int icalerror_errors_are_fatal;
void icalerror_clear_errno(void);
+void _icalerror_set_errno(icalerrorenum);
@@ -2649,3 +3292,3 @@ if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
#else
-void icalerror_set_errno(icalerrorenum);
+void icalerror_set_errno(icalerrorenum x);
#endif
@@ -2707,3 +3350,2 @@ void icalerror_restore(const char* error, icalerrorstate es);
- $Id$
@@ -2768,4 +3410,2 @@ int icalrestriction_check(icalcomponent* comp);
- $Id$
- $Locker$
@@ -2912,4 +3552,2 @@ int sspm_write_mime(struct sspm_part *parts,size_t num_parts,
- $Id$
- $Locker$
@@ -2954,4 +3592,2 @@ char* icalmime_as_mime_string(char* component);
- $Id$
- $Locker$
@@ -2990,2 +3626,5 @@ icalcomponent* icallangbind_get_next_component(icalcomponent *c,
+icalparameter* icallangbind_get_first_parameter(icalproperty *prop);
+
+icalparameter* icallangbind_get_next_parameter(icalproperty *prop);
@@ -2995,2 +3634,7 @@ const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
int icallangbind_string_to_open_flag(const char* str);
+
+const char* icallangbind_quote_as_ical(const char* str);
#endif /*__ICALLANGBIND_H__*/
+#ifdef __cplusplus
+};
+#endif
diff --git a/libical/src/libical/icalarray.c b/libical/src/libical/icalarray.c
new file mode 100644
index 0000000..78e1ada
--- a/dev/null
+++ b/libical/src/libical/icalarray.c
@@ -0,0 +1,163 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*-
+ ======================================================================
+ FILE: icalarray.c
+ CREATOR: Damon Chaplin 07 March 2001
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2001, Ximian, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+ ======================================================================*/
+
+/** @file icalarray.c
+ *
+ * @brief An array of arbitrarily-sized elements which grows
+ * dynamically as elements are added.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "icalarray.h"
+#include "icalerror.h"
+
+
+static void icalarray_expand (icalarray *array,
+ int space_needed);
+
+/** @brief Constructor
+ */
+
+icalarray*
+icalarray_new (int element_size,
+ int increment_size)
+{
+ icalarray *array;
+
+ array = (icalarray*) malloc (sizeof (icalarray));
+ if (!array) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return NULL;
+ }
+
+ array->element_size = element_size;
+ array->increment_size = increment_size;
+ array->num_elements = 0;
+ array->space_allocated = 0;
+ array->data = NULL;
+
+ return array;
+}
+
+/** @brief Destructor
+ */
+
+void
+icalarray_free (icalarray *array)
+{
+ if (array->data)
+ free (array->data);
+ free (array);
+}
+
+
+void
+icalarray_append (icalarray *array,
+ void *element)
+{
+ if (array->num_elements >= array->space_allocated)
+ icalarray_expand (array, 1);
+
+ memcpy ((char *)(array->data) + ( array->num_elements * array->element_size ), element,
+ array->element_size);
+ array->num_elements++;
+}
+
+
+void*
+icalarray_element_at (icalarray *array,
+ int position)
+{
+ assert (position >= 0);
+ assert (position < array->num_elements);
+
+ return (char *)(array->data) + (position * array->element_size);
+}
+
+
+void
+icalarray_remove_element_at (icalarray *array,
+ int position)
+{
+ void *dest;
+ int elements_to_move;
+
+ assert (position >= 0);
+ assert (position < array->num_elements);
+
+ dest = (char *)array->data + (position * array->element_size);
+ elements_to_move = array->num_elements - position - 1;
+
+ if (elements_to_move > 0)
+ memmove (dest, (char *)dest + array->element_size,
+ elements_to_move * array->element_size);
+
+ array->num_elements--;
+}
+
+
+void
+icalarray_sort (icalarray *array,
+ int (*compare) (const void *,
+ const void *))
+{
+ qsort (array->data, array->num_elements, array->element_size, compare);
+}
+
+
+static void
+icalarray_expand (icalarray *array,
+ int space_needed)
+{
+ int new_space_allocated;
+ void *new_data;
+
+ new_space_allocated = array->space_allocated + array->increment_size;
+
+ if (space_needed > array->increment_size)
+ new_space_allocated += space_needed;
+
+ /*
+ new_data = realloc (array->data,
+ new_space_allocated * array->element_size);
+ */
+ new_data = malloc(new_space_allocated * array->element_size);
+ memcpy(new_data,array->data,array->element_size*array->space_allocated);
+ free(array->data);
+
+ if (new_data) {
+ array->data = new_data;
+ array->space_allocated = new_space_allocated;
+ } else {
+ icalerror_set_errno(ICAL_ALLOCATION_ERROR);
+ }
+}
+
+
diff --git a/libical/src/libical/icalarray.h b/libical/src/libical/icalarray.h
new file mode 100644
index 0000000..e265167
--- a/dev/null
+++ b/libical/src/libical/icalarray.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*======================================================================
+ FILE: icalarray.h
+ CREATOR: Damon Chaplin 07 March 2001
+
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2001, Ximian, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+======================================================================*/
+
+
+#ifndef ICALARRAY_H
+#define ICALARRAY_H
+
+/** @file icalarray.h
+ *
+ * @brief An array of arbitrarily-sized elements which grows
+ * dynamically as elements are added.
+ */
+
+typedef struct _icalarray icalarray;
+struct _icalarray {
+ unsigned int element_size;
+ unsigned int increment_size;
+ unsigned int num_elements;
+ unsigned int space_allocated;
+ void *data;
+};
+
+
+
+icalarray *icalarray_new (int element_size,
+ int increment_size);
+void icalarray_free (icalarray *array);
+
+void icalarray_append (icalarray *array,
+ void *element);
+void icalarray_remove_element_at (icalarray *array,
+ int position);
+
+void *icalarray_element_at (icalarray *array,
+ int position);
+
+void icalarray_sort (icalarray *array,
+ int (*compare) (const void *, const void *));
+
+
+#endif /* ICALARRAY_H */
diff --git a/libical/src/libical/icalattach.c b/libical/src/libical/icalattach.c
new file mode 100644
index 0000000..8da9d43
--- a/dev/null
+++ b/libical/src/libical/icalattach.c
@@ -0,0 +1,139 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icalattach.c
+ CREATOR: acampi 28 May 02
+
+ $Id$
+ $Locker$
+
+
+ (C) COPYRIGHT 2000, Andrea Campi
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icaltypes.c
+
+ ======================================================================*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "icaltypes.h"
+#include "icalerror.h"
+#include "icalmemory.h"
+#include "icalattachimpl.h"
+#include <stdlib.h> /* for malloc and abs() */
+#include <errno.h> /* for errno */
+#include <string.h> /* for icalmemory_strdup */
+#include <assert.h>
+
+icalattach *
+icalattach_new_from_url (const char *url)
+{
+ icalattach *attach;
+ char *url_copy;
+
+ icalerror_check_arg_rz ((url != NULL), "url");
+
+ if ((attach = malloc (sizeof (icalattach))) == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ if ((url_copy = strdup (url)) == NULL) {
+ free (attach);
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ attach->refcount = 1;
+ attach->is_url = 1;
+ attach->u.url.url = url_copy;
+
+ return attach;
+}
+
+icalattach *
+icalattach_new_from_data (unsigned char *data, icalattach_free_fn_t free_fn,
+ void *free_fn_data)
+{
+ icalattach *attach;
+
+ icalerror_check_arg_rz ((data != NULL), "data");
+
+ if ((attach = malloc (sizeof (icalattach))) == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ attach->refcount = 1;
+ attach->is_url = 0;
+ attach->u.data.data = data;
+ attach->u.data.free_fn = free_fn;
+ attach->u.data.free_fn_data = free_fn_data;
+
+ return attach;
+}
+
+void
+icalattach_ref (icalattach *attach)
+{
+ icalerror_check_arg_rv ((attach != NULL), "attach");
+ icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0");
+
+ attach->refcount++;
+}
+
+void
+icalattach_unref (icalattach *attach)
+{
+ icalerror_check_arg_rv ((attach != NULL), "attach");
+ icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0");
+
+ attach->refcount--;
+
+ if (attach->refcount != 0)
+ return;
+
+ if (attach->is_url)
+ free (attach->u.url.url);
+ else if (attach->u.data.free_fn)
+ (* attach->u.data.free_fn) (attach->u.data.data, attach->u.data.free_fn_data);
+
+ free (attach);
+}
+
+int
+icalattach_get_is_url (icalattach *attach)
+{
+ icalerror_check_arg_rz ((attach != NULL), "attach");
+
+ return attach->is_url ? 1 : 0;
+}
+
+const char *
+icalattach_get_url (icalattach *attach)
+{
+ icalerror_check_arg_rz ((attach != NULL), "attach");
+ icalerror_check_arg_rz ((attach->is_url), "attach->is_url");
+
+ return attach->u.url.url;
+}
+
+unsigned char *
+icalattach_get_data (icalattach *attach)
+{
+ icalerror_check_arg_rz ((attach != NULL), "attach");
+ icalerror_check_arg_rz ((!attach->is_url), "!attach->is_url");
+
+ return attach->u.data.data;
+}
diff --git a/libical/src/libical/icalattach.h b/libical/src/libical/icalattach.h
new file mode 100644
index 0000000..ba4488d
--- a/dev/null
+++ b/libical/src/libical/icalattach.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalattach.h
+ CREATOR: acampi 28 May 02
+
+
+ (C) COPYRIGHT 2002, Andrea Campi
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalattach.h
+
+======================================================================*/
+
+#ifndef ICALATTACH_H
+#define ICALATTACH_H
+
+
+typedef struct icalattach_impl icalattach;
+
+typedef void (* icalattach_free_fn_t) (unsigned char *data, void *user_data);
+
+icalattach *icalattach_new_from_url (const char *url);
+icalattach *icalattach_new_from_data (unsigned char *data,
+ icalattach_free_fn_t free_fn, void *free_fn_data);
+
+void icalattach_ref (icalattach *attach);
+void icalattach_unref (icalattach *attach);
+
+int icalattach_get_is_url (icalattach *attach);
+const char *icalattach_get_url (icalattach *attach);
+unsigned char *icalattach_get_data (icalattach *attach);
+
+struct icalattachtype* icalattachtype_new(void);
+void icalattachtype_add_reference(struct icalattachtype* v);
+void icalattachtype_free(struct icalattachtype* v);
+
+void icalattachtype_set_url(struct icalattachtype* v, char* url);
+char* icalattachtype_get_url(struct icalattachtype* v);
+
+void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
+ int owns);
+char* icalattachtype_get_base64(struct icalattachtype* v);
+
+void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
+ int owns);
+void* icalattachtype_get_binary(struct icalattachtype* v);
+
+
+
+#endif /* !ICALATTACH_H */
diff --git a/libical/src/libical/icalattachimpl.h b/libical/src/libical/icalattachimpl.h
new file mode 100644
index 0000000..b8abe63
--- a/dev/null
+++ b/libical/src/libical/icalattachimpl.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalattachimpl.h
+ CREATOR: acampi 28 May 02
+
+ $Id$
+
+
+ (C) COPYRIGHT 2000, Andrea Campi
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalattachimpl.h
+
+
+======================================================================*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef ICALATTACHIMPL_H
+#define ICALATTACHIMPL_H
+
+#include "icalattach.h"
+
+/* Private structure for ATTACH values */
+struct icalattach_impl {
+ /* Reference count */
+ int refcount;
+
+ union {
+ /* URL attachment data */
+ struct {
+ char *url;
+ } url;
+
+ /* Inline data */
+ struct {
+ unsigned char *data;
+ icalattach_free_fn_t free_fn;
+ void *free_fn_data;
+ } data;
+ } u;
+
+ /* TRUE if URL, FALSE if inline data */
+ unsigned int is_url : 1;
+};
+
+#endif
diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c
index af0d3ec..fbd0492 100644
--- a/libical/src/libical/icalcomponent.c
+++ b/libical/src/libical/icalcomponent.c
@@ -6,3 +6,2 @@
-
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -35,2 +34,4 @@
#include "icaltime.h"
+#include "icalarray.h"
+#include "icaltimezone.h"
#include "icalduration.h"
@@ -38,2 +39,3 @@
#include "icalparser.h"
+#include "icalrestriction.h"
@@ -44,5 +46,4 @@
#include <stdio.h> /* for fprintf */
-#include <string.h>
-
-#define MAX_TMP 1024
+#include <string.h> /* for strdup */
+#include <limits.h> /* for INT_MAX */
@@ -58,2 +59,9 @@ struct icalcomponent_impl
icalcomponent* parent;
+
+ /** An array of icaltimezone structs. We use this so we can do fast
+ lookup of timezones using binary searches. timezones_sorted is
+ set to 0 whenever we add a timezone, so we remember to sort the
+ array before doing a binary search. */
+ icalarray* timezones;
+ int timezones_sorted;
};
@@ -64,8 +72,25 @@ void icalproperty_set_parent(icalproperty* property,
icalcomponent* icalproperty_get_parent(icalproperty* property);
-void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args);
-icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind);
-int icalcomponent_property_sorter(void *a, void *b);
-
-
-void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args)
+void icalcomponent_add_children(icalcomponent *impl,va_list args);
+static icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind);
+
+static void icalcomponent_merge_vtimezone (icalcomponent *comp,
+ icalcomponent *vtimezone,
+ icalarray *tzids_to_rename);
+static void icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
+ icalcomponent *vtimezone,
+ icalproperty *tzid_prop,
+ const char *tzid,
+ icalarray *tzids_to_rename);
+static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid);
+static void icalcomponent_rename_tzids(icalcomponent* comp,
+ icalarray* rename_table);
+static void icalcomponent_rename_tzids_callback(icalparameter *param,
+ void *data);
+static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
+ icalcomponent *vtimezone2);
+static int icalcomponent_compare_timezone_fn (const void *elem1,
+ const void *elem2);
+
+
+void icalcomponent_add_children(icalcomponent *impl, va_list args)
{
@@ -79,10 +104,6 @@ void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args)
if (icalcomponent_isa_component(vp) != 0 ){
-
- icalcomponent_add_component((icalcomponent*)impl,
- (icalcomponent*)vp);
+ icalcomponent_add_component(impl, (icalcomponent*)vp);
} else if (icalproperty_isa_property(vp) != 0 ){
-
- icalcomponent_add_property((icalcomponent*)impl,
- (icalproperty*)vp);
+ icalcomponent_add_property(impl, (icalproperty*)vp);
}
@@ -91,9 +112,11 @@ void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args)
-icalcomponent*
+static icalcomponent*
icalcomponent_new_impl (icalcomponent_kind kind)
{
- struct icalcomponent_impl* comp;
+ icalcomponent* comp;
- if ( ( comp = (struct icalcomponent_impl*)
- malloc(sizeof(struct icalcomponent_impl))) == 0) {
+ if (!icalcomponent_kind_is_valid(kind))
+ return NULL;
+
+ if ( ( comp = (icalcomponent*) malloc(sizeof(icalcomponent))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -111,2 +134,4 @@ icalcomponent_new_impl (icalcomponent_kind kind)
comp->parent = 0;
+ comp->timezones = NULL;
+ comp->timezones_sorted = 1;
@@ -115,2 +140,4 @@ icalcomponent_new_impl (icalcomponent_kind kind)
+/** @brief Constructor
+ */
icalcomponent*
@@ -118,5 +145,7 @@ icalcomponent_new (icalcomponent_kind kind)
{
- return (icalcomponent*)icalcomponent_new_impl(kind);
+ return icalcomponent_new_impl(kind);
}
+/** @brief Constructor
+ */
icalcomponent*
@@ -126,3 +155,3 @@ icalcomponent_vanew (icalcomponent_kind kind, ...)
- struct icalcomponent_impl *impl = icalcomponent_new_impl(kind);
+ icalcomponent *impl = icalcomponent_new_impl(kind);
@@ -136,5 +165,7 @@ icalcomponent_vanew (icalcomponent_kind kind, ...)
- return (icalcomponent*) impl;
+ return impl;
}
+/** @brief Constructor
+ */
icalcomponent* icalcomponent_new_from_string(char* str)
@@ -144,6 +175,7 @@ icalcomponent* icalcomponent_new_from_string(char* str)
-icalcomponent* icalcomponent_new_clone(icalcomponent* component)
+/** @brief Constructor
+ */
+icalcomponent* icalcomponent_new_clone(icalcomponent* old)
{
- struct icalcomponent_impl *old = (struct icalcomponent_impl*)component;
- struct icalcomponent_impl *new;
+ icalcomponent *new;
icalproperty *p;
@@ -152,3 +184,3 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component)
- icalerror_check_arg_rz( (component!=0), "component");
+ icalerror_check_arg_rz( (old!=0), "component");
@@ -182,5 +214,6 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component)
-
+/*** @brief Destructor
+ */
void
-icalcomponent_free (icalcomponent* component)
+icalcomponent_free (icalcomponent* c)
{
@@ -188,5 +221,4 @@ icalcomponent_free (icalcomponent* component)
icalcomponent* comp;
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
- icalerror_check_arg_rv( (component!=0), "component");
+ icalerror_check_arg_rv( (c!=0), "component");
@@ -200,11 +232,14 @@ icalcomponent_free (icalcomponent* component)
- if(component != 0 ){
+ if(c != 0 ){
- while( (prop=pvl_pop(c->properties)) != 0){
- assert(prop != 0);
- icalproperty_set_parent(prop,0);
- icalproperty_free(prop);
- }
-
- pvl_free(c->properties);
+ if ( c->properties != 0 )
+ {
+ while( (prop=pvl_pop(c->properties)) != 0){
+ assert(prop != 0);
+ icalproperty_set_parent(prop,0);
+ icalproperty_free(prop);
+ }
+ pvl_free(c->properties);
+ }
+
@@ -212,3 +247,3 @@ icalcomponent_free (icalcomponent* component)
assert(comp!=0);
- icalcomponent_remove_component(component,comp);
+ icalcomponent_remove_component(c,comp);
icalcomponent_free(comp);
@@ -222,2 +257,5 @@ icalcomponent_free (icalcomponent* component)
+ if (c->timezones)
+ icaltimezone_array_free (c->timezones);
+
c->kind = ICAL_NO_COMPONENT;
@@ -229,2 +267,3 @@ icalcomponent_free (icalcomponent* component)
c->id[0] = 'X';
+ c->timezones = NULL;
@@ -235,3 +274,3 @@ icalcomponent_free (icalcomponent* component)
char*
-icalcomponent_as_ical_string (icalcomponent* component)
+icalcomponent_as_ical_string (icalcomponent* impl)
{
@@ -242,12 +281,16 @@ icalcomponent_as_ical_string (icalcomponent* component)
pvl_elem itr;
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
+/* WIN32 automatically adds the \r, Anybody else need it?
#ifdef ICAL_UNIX_NEWLINE
+*/
char newline[] = "\n";
+/*
#else
- char newline[] = "\n";
+ char newline[] = "\r\n";
#endif
+*/
+
icalcomponent *c;
icalproperty *p;
- icalcomponent_kind kind = icalcomponent_isa(component);
+ icalcomponent_kind kind = icalcomponent_isa(impl);
@@ -258,3 +301,3 @@ icalcomponent_as_ical_string (icalcomponent* component)
- icalerror_check_arg_rz( (component!=0), "component");
+ icalerror_check_arg_rz( (impl!=0), "component");
icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
@@ -269,3 +312,4 @@ icalcomponent_as_ical_string (icalcomponent* component)
-
+
+
for( itr = pvl_head(impl->properties);
@@ -273,5 +317,3 @@ icalcomponent_as_ical_string (icalcomponent* component)
itr = pvl_next(itr))
- {
- // printf("3333calcomponent_as_ical_string System Timezone2: %s %s \n", *tzname, getenv("TZ") );
-
+ {
p = (icalproperty*)pvl_data(itr);
@@ -288,4 +330,3 @@ icalcomponent_as_ical_string (icalcomponent* component)
itr = pvl_next(itr))
- {
-
+ {
c = (icalcomponent*)pvl_data(itr);
@@ -293,2 +334,3 @@ icalcomponent_as_ical_string (icalcomponent* component)
tmp_buf = icalcomponent_as_ical_string(c);
+
icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
@@ -297,6 +339,6 @@ icalcomponent_as_ical_string (icalcomponent* component)
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:"); //tzset();
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:");
icalmemory_append_string(&buf, &buf_ptr, &buf_size,
icalcomponent_kind_to_string(kind));
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); //tzset();
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
@@ -312,7 +354,4 @@ icalcomponent_is_valid (icalcomponent* component)
{
- struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
-
-
- if ( (strcmp(impl->id,"comp") == 0) &&
- impl->kind != ICAL_NO_COMPONENT){
+ if ( (strcmp(component->id,"comp") == 0) &&
+ component->kind != ICAL_NO_COMPONENT){
return 1;
@@ -326,6 +365,5 @@ icalcomponent_is_valid (icalcomponent* component)
icalcomponent_kind
-icalcomponent_isa (icalcomponent* component)
+icalcomponent_isa (const icalcomponent* component)
{
- struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
- icalerror_check_arg_rz( (component!=0), "component");
+ icalerror_check_arg_rx( (component!=0), "component", ICAL_NO_COMPONENT);
@@ -333,3 +371,3 @@ icalcomponent_isa (icalcomponent* component)
{
- return impl->kind;
+ return component->kind;
}
@@ -343,3 +381,3 @@ icalcomponent_isa_component (void* component)
{
- struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
+ icalcomponent *impl = component;
@@ -355,17 +393,2 @@ icalcomponent_isa_component (void* component)
-int icalcomponent_property_sorter(void *a, void *b)
-{
- icalproperty_kind kinda, kindb;
- const char *ksa, *ksb;
-
- kinda = icalproperty_isa((icalproperty*)a);
- kindb = icalproperty_isa((icalproperty*)b);
-
- ksa = icalproperty_kind_to_string(kinda);
- ksb = icalproperty_kind_to_string(kindb);
-
- return strcmp(ksa,ksb);
-}
-
-
void
@@ -373,4 +396,2 @@ icalcomponent_add_property (icalcomponent* component, icalproperty* property)
{
- struct icalcomponent_impl *impl;
-
icalerror_check_arg_rv( (component!=0), "component");
@@ -378,4 +399,2 @@ icalcomponent_add_property (icalcomponent* component, icalproperty* property)
- impl = (struct icalcomponent_impl*)component;
-
icalerror_assert( (!icalproperty_get_parent(property)),"The property has already been added to a component. Remove the property with icalcomponent_remove_property before calling icalcomponent_add_property");
@@ -384,9 +403,3 @@ icalcomponent_add_property (icalcomponent* component, icalproperty* property)
-#ifdef ICAL_INSERT_ORDERED
- pvl_insert_ordered(impl->properties,
- icalcomponent_property_sorter,property);
-#else
- pvl_push(impl->properties,property);
-#endif
-
+ pvl_push(component->properties,property);
}
@@ -397,5 +410,3 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
{
- struct icalcomponent_impl *impl;
pvl_elem itr, next_itr;
- struct icalproperty_impl *pimpl;
@@ -404,6 +415,2 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
- impl = (struct icalcomponent_impl*)component;
-
- pimpl = (struct icalproperty_impl*)property;
-
icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component");
@@ -411,3 +418,3 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
- for( itr = pvl_head(impl->properties);
+ for( itr = pvl_head(component->properties);
itr != 0;
@@ -419,7 +426,7 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
- if (impl->property_iterator == itr){
- impl->property_iterator = pvl_next(itr);
+ if (component->property_iterator == itr){
+ component->property_iterator = pvl_next(itr);
}
- pvl_remove( impl->properties, itr);
+ pvl_remove( component->properties, itr);
icalproperty_set_parent(property,0);
@@ -435,3 +442,2 @@ icalcomponent_count_properties (icalcomponent* component,
pvl_elem itr;
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
@@ -439,3 +445,3 @@ icalcomponent_count_properties (icalcomponent* component,
- for( itr = pvl_head(impl->properties);
+ for( itr = pvl_head(component->properties);
itr != 0;
@@ -456,7 +462,5 @@ icalproperty* icalcomponent_get_current_property (icalcomponent* component)
{
-
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
icalerror_check_arg_rz( (component!=0),"component");
- if ((c->property_iterator==0)){
+ if ((component->property_iterator==0)){
return 0;
@@ -464,4 +468,3 @@ icalproperty* icalcomponent_get_current_property (icalcomponent* component)
- return (icalproperty*) pvl_data(c->property_iterator);
-
+ return (icalproperty*) pvl_data(component->property_iterator);
}
@@ -469,6 +472,5 @@ icalproperty* icalcomponent_get_current_property (icalcomponent* component)
icalproperty*
-icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind kind)
+icalcomponent_get_first_property (icalcomponent* c, icalproperty_kind kind)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
- icalerror_check_arg_rz( (component!=0),"component");
+ icalerror_check_arg_rz( (c!=0),"component");
@@ -489,6 +491,5 @@ icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind ki
icalproperty*
-icalcomponent_get_next_property (icalcomponent* component, icalproperty_kind kind)
+icalcomponent_get_next_property (icalcomponent* c, icalproperty_kind kind)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
- icalerror_check_arg_rz( (component!=0),"component");
+ icalerror_check_arg_rz( (c!=0),"component");
@@ -521,4 +522,2 @@ icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
{
- struct icalcomponent_impl *impl, *cimpl;
-
icalerror_check_arg_rv( (parent!=0), "parent");
@@ -526,6 +525,3 @@ icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
- impl = (struct icalcomponent_impl*)parent;
- cimpl = (struct icalcomponent_impl*)child;
-
- if (cimpl->parent !=0) {
+ if (child->parent !=0) {
icalerror_set_errno(ICAL_USAGE_ERROR);
@@ -533,5 +529,18 @@ icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
- cimpl->parent = parent;
+ child->parent = parent;
+
+ pvl_push(parent->components,child);
- pvl_push(impl->components,child);
+ /* If the new component is a VTIMEZONE, add it to our array. */
+ if (child->kind == ICAL_VTIMEZONE_COMPONENT) {
+ /* FIXME: Currently we are also creating this array when loading in
+ a builtin VTIMEZONE, when we don't need it. */
+ if (!parent->timezones)
+ parent->timezones = icaltimezone_array_new ();
+
+ icaltimezone_array_append_from_vtimezone (parent->timezones, child);
+
+ /* Flag that we need to sort it before doing any binary searches. */
+ parent->timezones_sorted = 0;
+ }
}
@@ -542,3 +551,2 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
{
- struct icalcomponent_impl *impl,*cimpl;
pvl_elem itr, next_itr;
@@ -548,6 +556,19 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
- impl = (struct icalcomponent_impl*)parent;
- cimpl = (struct icalcomponent_impl*)child;
-
- for( itr = pvl_head(impl->components);
+ /* If the component is a VTIMEZONE, remove it from our array as well. */
+ if (child->kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+ int i, num_elements;
+
+ num_elements = parent->timezones ? parent->timezones->num_elements : 0;
+ for (i = 0; i < num_elements; i++) {
+ zone = icalarray_element_at (parent->timezones, i);
+ if (icaltimezone_get_component (zone) == child) {
+ icaltimezone_free (zone, 0);
+ icalarray_remove_element_at (parent->timezones, i);
+ break;
+ }
+ }
+ }
+
+ for( itr = pvl_head(parent->components);
itr != 0;
@@ -559,3 +580,3 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
- if (impl->component_iterator == itr){
+ if (parent->component_iterator == itr){
/* Don't let the current iterator become invalid */
@@ -563,8 +584,8 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
/* HACK. The semantics for this are troubling. */
- impl->component_iterator =
- pvl_next(impl->component_iterator);
+ parent->component_iterator =
+ pvl_next(parent->component_iterator);
}
- pvl_remove( impl->components, itr);
- cimpl->parent = 0;
+ pvl_remove( parent->components, itr);
+ child->parent = 0;
break;
@@ -581,3 +602,2 @@ icalcomponent_count_components (icalcomponent* component,
pvl_elem itr;
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
@@ -585,3 +605,3 @@ icalcomponent_count_components (icalcomponent* component,
- for( itr = pvl_head(impl->components);
+ for( itr = pvl_head(component->components);
itr != 0;
@@ -601,7 +621,5 @@ icalcomponent_get_current_component(icalcomponent* component)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
-
icalerror_check_arg_rz( (component!=0),"component");
- if (c->component_iterator == 0){
+ if (component->component_iterator == 0){
return 0;
@@ -609,3 +627,3 @@ icalcomponent_get_current_component(icalcomponent* component)
- return (icalcomponent*) pvl_data(c->component_iterator);
+ return (icalcomponent*) pvl_data(component->component_iterator);
}
@@ -613,8 +631,6 @@ icalcomponent_get_current_component(icalcomponent* component)
icalcomponent*
-icalcomponent_get_first_component (icalcomponent* component,
+icalcomponent_get_first_component (icalcomponent* c,
icalcomponent_kind kind)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
-
- icalerror_check_arg_rz( (component!=0),"component");
+ icalerror_check_arg_rz( (c!=0),"component");
@@ -637,7 +653,5 @@ icalcomponent_get_first_component (icalcomponent* component,
icalcomponent*
-icalcomponent_get_next_component (icalcomponent* component, icalcomponent_kind kind)
+icalcomponent_get_next_component (icalcomponent* c, icalcomponent_kind kind)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
-
- icalerror_check_arg_rz( (component!=0),"component");
+ icalerror_check_arg_rz( (c!=0),"component");
@@ -675,3 +689,5 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c)
kind == ICAL_VJOURNAL_COMPONENT ||
- kind == ICAL_VFREEBUSY_COMPONENT ){
+ kind == ICAL_VFREEBUSY_COMPONENT ||
+ kind == ICAL_VQUERY_COMPONENT ||
+ kind == ICAL_VAGENDA_COMPONENT){
return comp;
@@ -682,61 +698,27 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c)
-time_t icalcomponent_convert_time(icalproperty *p)
-{
- struct icaltimetype sict;
- time_t convt;
- icalproperty *tzp;
-
-
- /* Though it says _dtstart, it will work for dtend too */
- sict = icalproperty_get_dtstart(p);
-
- tzp = icalproperty_get_first_parameter(p,ICAL_TZID_PARAMETER);
-
- if (sict.is_utc == 1 && tzp != 0){
- icalerror_warn("icalcomponent_get_span: component has a UTC DTSTART with a timezone specified ");
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
- if(sict.is_utc == 1){
- /* _as_timet will use gmtime() to do the conversion */
- convt = icaltime_as_timet(sict);
-
-#ifdef TEST_CONVERT_TIME
- printf("convert time: use as_timet:\n %s\n %s",
- icalproperty_as_ical_string(p), ctime(&convt));
-#endif
-
- } else if (sict.is_utc == 0 && tzp == 0 ) {
- time_t offset;
-
- /* _as_timet will use localtime() to do the conversion */
- convt = icaltime_as_timet(sict);
- offset = icaltime_utc_offset(sict,0);
- convt += offset;
-
-#ifdef TEST_CONVERT_TIME
- printf("convert time: use as_timet and adjust:\n %s\n %s",
- icalproperty_as_ical_string(p), ctime(&convt));
-#endif
- } else {
- /* Convert the time to UTC for the named timezone*/
- const char* timezone = icalparameter_get_tzid(tzp);
- convt = icaltime_as_timet(icaltime_as_utc(sict,timezone));
-
-#ifdef TEST_CONVERT_TIME
- printf("convert time: use _as_utc:\n %s\n %s",
- icalproperty_as_ical_string(p), ctime(&convt));
-#endif
- }
-
- return convt;
-}
-struct icaltime_span icalcomponent_get_span(icalcomponent* comp)
+/** @brief Get the timespan covered by this component, in UTC
+ * (deprecated)
+ *
+ * see icalcomponent_foreach_recurrence() for a better way to
+ * extract spans from an component.
+ *
+ * This method can be called on either a VCALENDAR or any real
+ * component. If the VCALENDAR contains no real component, but
+ * contains a VTIMEZONE, we return that span instead.
+ * This might not be a desirable behavior; we keep it for now
+ * for backward compatibility, but it might be deprecated at a
+ * future time.
+ *
+ * FIXME this API needs to be clarified. DTEND is defined as the
+ * first available time after the end of this event, so the span
+ * should actually end 1 second before DTEND.
+ */
+
+icaltime_span icalcomponent_get_span(icalcomponent* comp)
{
icalcomponent *inner;
- icalproperty *p, *duration;
icalcomponent_kind kind;
- struct icaltime_span span;
- struct icaltimetype start;
+ icaltime_span span;
+ struct icaltimetype start, end;
@@ -747,7 +729,8 @@ struct icaltime_span icalcomponent_get_span(icalcomponent* comp)
/* initial Error checking */
+ if (comp == NULL) {
+ return span;
+ }
-/* icalerror_check_arg_rz( (comp!=0),"comp");*/
-
+ /* FIXME this might go away */
kind = icalcomponent_isa(comp);
-
if(kind == ICAL_VCALENDAR_COMPONENT){
@@ -783,63 +766,325 @@ struct icaltime_span icalcomponent_get_span(icalcomponent* comp)
+ /* Get to work. starting with DTSTART */
+ start = icalcomponent_get_dtstart(comp);
+ if (icaltime_is_null_time(start)) {
+ return span;
+ }
+ span.start = icaltime_as_timet_with_zone(start,
+ icaltimezone_get_utc_timezone());
+ /* The end time could be specified as either a DTEND or a DURATION */
+ /* icalcomponent_get_dtend takes care of these cases. */
+ end = icalcomponent_get_dtend(comp);
+ if (icaltime_is_null_time(end)) {
+ if (!icaltime_is_date(start)) {
+ /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION
+ it takes no time */
+ span.start = 0;
+ return span;
+ } else {
+ end = start;
+ }
+ }
- /* Get to work. starting with DTSTART */
+ span.end = icaltime_as_timet_with_zone(end,
+ icaltimezone_get_utc_timezone());
+ if (icaltime_is_date(start)) {
+ /* Until the end of the day*/
+ span.end += 60*60*24 - 1;
+ }
- p = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
+ return span;
- if (p ==0 ) {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- /*icalerror_warn("icalcomponent_get_span: component has no DTSTART time");*/
- return span;
+}
+
+/**
+ * Decide if this recurrance is acceptable
+ *
+ * @param comp A valid icalcomponent.
+ * @param dtstart The base dtstart value for this component.
+ * @param recurtime The time to test against.
+ *
+ * @return true if the recurrence value is excluded, false otherwise.
+ *
+ * This function decides if a specific recurrence value is
+ * excluded by EXRULE or EXDATE properties.
+ *
+ * It's not the most efficient code. You might get better performance
+ * if you assume that recurtime is always increasing for each
+ * call. Then you could:
+ *
+ * - sort the EXDATE values
+ * - save the state of each EXRULE iterator for the next call.
+ *
+ * In this case though you don't need to worry how you call this
+ * function. It will always return the correct result.
+ */
+
+int icalproperty_recurrence_is_excluded(icalcomponent *comp,
+ struct icaltimetype *dtstart,
+ struct icaltimetype *recurtime) {
+ icalproperty *exdate, *exrule;
+
+ if (comp == NULL ||
+ dtstart == NULL ||
+ recurtime == NULL ||
+ icaltime_is_null_time(*recurtime))
+ /* BAD DATA */
+ return 1;
+
+ /** first test against the exdate values **/
+ for (exdate = icalcomponent_get_first_property(comp,ICAL_EXDATE_PROPERTY);
+ exdate != NULL;
+ exdate = icalcomponent_get_next_property(comp,ICAL_EXDATE_PROPERTY)) {
+
+ struct icaltimetype exdatetime = icalproperty_get_exdate(exdate);
+
+ if (icaltime_compare(*recurtime, exdatetime) == 0) {
+ /** MATCHED **/
+ return 1;
+ }
+ }
+
+ /** Now test against the EXRULEs **/
+ for (exrule = icalcomponent_get_first_property(comp,ICAL_EXRULE_PROPERTY);
+ exdate != NULL;
+ exdate = icalcomponent_get_next_property(comp,ICAL_EXRULE_PROPERTY)) {
+
+ struct icalrecurrencetype recur = icalproperty_get_exrule(exrule);
+ icalrecur_iterator *exrule_itr = icalrecur_iterator_new(recur, *dtstart);
+ struct icaltimetype exrule_time;
+
+ while (1) {
+ int result;
+ exrule_time = icalrecur_iterator_next(exrule_itr);
+
+ if (icaltime_is_null_time(exrule_time))
+ break;
+
+ result = icaltime_compare(*recurtime, exrule_time);
+ if (result == 0) {
+ icalrecur_iterator_free(exrule_itr);
+ return 1; /** MATCH **/
+ }
+ if (result == 1)
+ break; /** exrule_time > recurtime **/
}
+ icalrecur_iterator_free(exrule_itr);
+ }
- start = icalproperty_get_dtstart(p);
+ return 0; /** no matches **/
+}
- icalerror_clear_errno();
+/**
+ * @brief Return the busy status based on the TRANSP property.
+ *
+ * @param comp A valid icalcomponent.
+ *
+ * @return 1 if the event is a busy item, 0 if it is not.
+ */
- span.start = icalcomponent_convert_time(p);
+static int icalcomponent_is_busy(icalcomponent *comp) {
+ icalproperty *transp;
+ enum icalproperty_status status;
+ int ret = 1;
-#ifdef TEST_CONVERT_TIME
- printf("convert time:\n %s %s",
- icalproperty_as_ical_string(p), ctime(&span.start));
-#endif
+ /** @todo check access control here, converting busy->free if the
+ permissions do not allow access... */
- if(icalerrno != ICAL_NO_ERROR){
- span.start = 0;
- return span;
+ /* Is this a busy time? Check the TRANSP property */
+ transp = icalcomponent_get_first_property(comp, ICAL_TRANSP_PROPERTY);
+
+ if (transp) {
+ icalvalue *transp_val = icalproperty_get_value(transp);
+
+ switch (icalvalue_get_transp(transp_val)) {
+ case ICAL_TRANSP_OPAQUE:
+ case ICAL_TRANSP_OPAQUENOCONFLICT:
+ case ICAL_TRANSP_NONE:
+ ret = 1;
+ break;
+ case ICAL_TRANSP_TRANSPARENT:
+ case ICAL_TRANSP_TRANSPARENTNOCONFLICT:
+ ret = 0;
+ break;
+ default:
+ ret = 0;
+ break;
}
+ }
+ status = icalcomponent_get_status(comp);
+ if (ret && status) {
+ switch (status) {
+ case ICAL_STATUS_CANCELLED:
+ case ICAL_STATUS_TENTATIVE:
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ return(ret);
+}
- /* The end time could be specified as either a DTEND or a DURATION */
- p = icalcomponent_get_first_property(inner, ICAL_DTEND_PROPERTY);
- duration = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
- if (p==0 && duration == 0 && start.is_date != 1) {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- /*icalerror_warn("icalcomponent_get_span: component has neither DTEND nor DURATION time");*/
- span.start = 0;
- return span;
- }
- if (p!=0){
- span.end = icalcomponent_convert_time(p);
- } else if (start.is_date == 1) {
- /* Duration is all day */
- span.end = span.start + 60*60*24;
- } else {
- /* Use the duration */
- struct icaldurationtype dur;
- time_t durt;
-
-
- dur = icalproperty_get_duration(duration);
- durt = icaldurationtype_as_int(dur);
- span.end = span.start+durt;
+/**
+ * @brief cycle through all recurrances of an event
+ *
+ * @param comp A valid VEVENT component
+ * @param start Ignore timespans before this
+ * @param end Ignore timespans after this
+ * @param callback Function called for each timespan within the range
+ * @param callback_data Pointer passed back to the callback function
+ *
+ * This function will call the specified callback function for once
+ * for the base value of DTSTART, and foreach recurring date/time
+ * value.
+ *
+ * It will filter out events that are specified as an EXDATE or an EXRULE.
+ *
+ * @todo We do not filter out duplicate RRULES/RDATES
+ * @todo We do not handle RDATEs with explicit periods
+ */
+
+void icalcomponent_foreach_recurrence(icalcomponent* comp,
+ struct icaltimetype start,
+ struct icaltimetype end,
+ void (*callback)(icalcomponent *comp,
+ struct icaltime_span *span,
+ void *data),
+ void *callback_data)
+{
+ struct icaltimetype dtstart, dtend;
+ icaltime_span recurspan, basespan, limit_span;
+ time_t limit_start, limit_end;
+ int dtduration;
+ icalproperty *rrule, *rdate;
+ struct icaldurationtype dur;
+ pvl_elem property_iterator; /* for saving the iterator */
+
+ if (comp == NULL || callback == NULL)
+ return;
+
+ dtstart = icalcomponent_get_dtstart(comp);
+
+ if (icaltime_is_null_time(dtstart))
+ return;
+
+
+ /* The end time could be specified as either a DTEND or a DURATION */
+ /* icalcomponent_get_dtend takes care of these cases. */
+ dtend = icalcomponent_get_dtend(comp);
+
+ /* Now set up the base span for this item, corresponding to the
+ base DTSTART and DTEND */
+ basespan = icaltime_span_new(dtstart, dtend, 1);
+
+ basespan.is_busy = icalcomponent_is_busy(comp);
+
+
+ /** Calculate the ceiling and floor values.. **/
+ limit_start = icaltime_as_timet_with_zone(start, icaltimezone_get_utc_timezone());
+ if (!icaltime_is_null_time(end))
+ limit_end = icaltime_as_timet_with_zone(end, icaltimezone_get_utc_timezone());
+ else
+ limit_end = INT_MAX; /* max 32 bit time_t */
+
+ limit_span.start = limit_start;
+ limit_span.end = limit_end;
+
+
+ /* Do the callback for the initial DTSTART entry */
+
+ if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &dtstart)) {
+ /** call callback action **/
+ if (icaltime_span_overlaps(&basespan, &limit_span))
+ (*callback) (comp, &basespan, callback_data);
+ }
+
+ recurspan = basespan;
+ dtduration = basespan.end - basespan.start;
+
+ /* Now cycle through the rrule entries */
+ for (rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY);
+ rrule != NULL;
+ rrule = icalcomponent_get_next_property(comp,ICAL_RRULE_PROPERTY)) {
+
+ struct icalrecurrencetype recur = icalproperty_get_rrule(rrule);
+ icalrecur_iterator *rrule_itr = icalrecur_iterator_new(recur, dtstart);
+ struct icaltimetype rrule_time = icalrecur_iterator_next(rrule_itr);
+ /** note that icalrecur_iterator_next always returns dtstart
+ the first time.. **/
+
+ while (1) {
+ rrule_time = icalrecur_iterator_next(rrule_itr);
+
+ if (icaltime_is_null_time(rrule_time))
+ break;
+
+ dur = icaltime_subtract(rrule_time, dtstart);
+
+ recurspan.start = basespan.start + icaldurationtype_as_int(dur);
+ recurspan.end = recurspan.start + dtduration;
+
+ /** save the iterator ICK! **/
+ property_iterator = comp->property_iterator;
+
+ if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rrule_time)) {
+ /** call callback action **/
+ if (icaltime_span_overlaps(&recurspan, &limit_span))
+ (*callback) (comp, &recurspan, callback_data);
+ }
+ comp->property_iterator = property_iterator;
+ } /* end of iteration over a specific RRULE */
+
+ icalrecur_iterator_free(rrule_itr);
+ } /* end of RRULE loop */
+
+
+ /** Now process RDATE entries **/
+ for (rdate = icalcomponent_get_first_property(comp,ICAL_RDATE_PROPERTY);
+ rdate != NULL;
+ rdate = icalcomponent_get_next_property(comp,ICAL_RDATE_PROPERTY)) {
+
+ struct icaldatetimeperiodtype rdate_period = icalproperty_get_rdate(rdate);
+
+ /** RDATES can specify raw datetimes, periods, or dates.
+ we only support raw datetimes for now..
+
+ @todo Add support for other types **/
+
+ if (icaltime_is_null_time(rdate_period.time))
+ continue;
+
+ dur = icaltime_subtract(rdate_period.time, dtstart);
+
+ recurspan.start = basespan.start + icaldurationtype_as_int(dur);
+ recurspan.end = recurspan.start + dtduration;
+
+ /** save the iterator ICK! **/
+ property_iterator = comp->property_iterator;
+
+ if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rdate_period.time)) {
+ /** call callback action **/
+ (*callback) (comp, &recurspan, callback_data);
}
+ comp->property_iterator = property_iterator;
+ }
+}
+
- return span;
+int icalcomponent_check_restrictions(icalcomponent* comp){
+ icalerror_check_arg_rz(comp!=0,"comp");
+ return icalrestriction_check(comp);
}
+/** @brief returns the number of errors encountered parsing the data
+ *
+ * This function counts the number times the X-LIC-ERROR occurs
+ * in the data structure.
+ */
@@ -851,5 +1096,4 @@ int icalcomponent_count_errors(icalcomponent* component)
pvl_elem itr;
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
- for( itr = pvl_head(impl->properties);
+ for( itr = pvl_head(component->properties);
itr != 0;
@@ -866,3 +1110,3 @@ int icalcomponent_count_errors(icalcomponent* component)
- for( itr = pvl_head(impl->components);
+ for( itr = pvl_head(component->components);
itr != 0;
@@ -885,5 +1129,4 @@ void icalcomponent_strip_errors(icalcomponent* component)
pvl_elem itr, next_itr;
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
- for( itr = pvl_head(impl->properties);
+ for( itr = pvl_head(component->properties);
itr != 0;
@@ -900,3 +1143,3 @@ void icalcomponent_strip_errors(icalcomponent* component)
- for( itr = pvl_head(impl->components);
+ for( itr = pvl_head(component->components);
itr != 0;
@@ -954,2 +1197,3 @@ void icalcomponent_convert_errors(icalcomponent* component)
default: {
+ break;
}
@@ -978,5 +1222,3 @@ icalcomponent* icalcomponent_get_parent(icalcomponent* component)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
-
- return c->parent;
+ return component->parent;
}
@@ -985,5 +1227,3 @@ void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent)
{
- struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
-
- c->parent = parent;
+ component->parent = parent;
}
@@ -1006,2 +1246,3 @@ static struct icalcomponent_kind_map component_map[] =
{ ICAL_VCALENDAR_COMPONENT, "VCALENDAR" },
+ { ICAL_VAGENDA_COMPONENT, "VAGENDA" },
{ ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" },
@@ -1030,2 +1271,12 @@ static struct icalcomponent_kind_map component_map[] =
+int icalcomponent_kind_is_valid(const icalcomponent_kind kind)
+{
+ int i = 0;
+ do {
+ if (component_map[i].kind == kind)
+ return 1;
+ } while (component_map[i++].kind != ICAL_NO_COMPONENT);
+
+ return 0;
+}
@@ -1067,4 +1318,3 @@ icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind)
{
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
- icalcompiter itr = icalcompiter_null;
+ icalcompiter itr;
pvl_elem i;
@@ -1072,6 +1322,7 @@ icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind)
itr.kind = kind;
+ itr.iter = NULL;
- icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
+ icalerror_check_arg_re(component!=0,"component",icalcompiter_null);
- for( i = pvl_head(impl->components); i != 0; i = pvl_next(itr.iter)) {
+ for( i = pvl_head(component->components); i != 0; i = pvl_next(i)) {
@@ -1093,3 +1344,2 @@ icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind)
{
- struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
icalcompiter itr;
@@ -1099,5 +1349,5 @@ icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind)
- icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
+ icalerror_check_arg_re(component!=0,"component",icalcompiter_null);
- for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) {
+ for( i = pvl_tail(component->components); i != 0; i = pvl_prior(i)) {
@@ -1182,10 +1432,56 @@ icalcomponent* icalcomponent_get_inner(icalcomponent* comp)
+/** @brief sets the METHOD property to the given method
+ */
-void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
+void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
{
+ icalproperty *prop
+ = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
- icalcomponent *inner = icalcomponent_get_inner(comp);
+
+ if (prop == 0){
+ prop = icalproperty_new_method(method);
+ icalcomponent_add_property(comp, prop);
+ }
+
+ icalproperty_set_method(prop,method);
+
+}
+
+/** @brief returns the METHOD property
+ */
+
+icalproperty_method icalcomponent_get_method(icalcomponent* comp)
+{
icalproperty *prop
- = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
+ = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY);
+ if (prop == 0){
+ return ICAL_METHOD_NONE;
+ }
+
+ return icalproperty_get_method(prop);
+}
+
+#define ICALSETUPSET(p_kind) \
+ icalcomponent *inner; \
+ icalproperty *prop; \
+ icalerror_check_arg_rv(comp!=0,"comp");\
+ inner = icalcomponent_get_inner(comp); \
+ if(inner == 0){\
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);\
+ return;\
+ }\
+ prop = icalcomponent_get_first_property(inner, p_kind);
+
+
+/** @brief Set DTSTART property to given icaltime
+ *
+ * This method respects the icaltime type (DATE vs DATE-TIME) and
+ * timezone (or lack thereof).
+ */
+void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
+{
+ char *tzid;
+ ICALSETUPSET(ICAL_DTSTART_PROPERTY);
@@ -1194,2 +1490,4 @@ void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
icalcomponent_add_property(inner, prop);
+ } else {
+ icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
}
@@ -1198,5 +1496,46 @@ void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
+ if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) {
+ icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid));
+ }
}
+/** @brief Get a DATE or DATE-TIME property as an icaltime
+ *
+ * If the property is a DATE-TIME with a timezone 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.
+ *
+ * FIXME this is useless until we can flag the failure
+ */
+static struct icaltimetype
+icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop) {
+
+ icalparameter *param;
+ struct icaltimetype ret;
+
+ ret = icalvalue_get_datetime(icalproperty_get_value(prop));
+
+ if ((param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER))
+ != NULL) {
+ const char *tzid = icalparameter_get_tzid(param);
+ icaltimezone *tz;
+
+ if ((tz = icalcomponent_get_timezone(comp, tzid)) != NULL) {
+ icaltime_set_timezone(&ret, tz);
+ }
+ }
+
+ return ret;
+}
+/** @brief Get DTSTART property as an icaltime
+ *
+ * If DTSTART is a DATE-TIME with a timezone 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.
+ *
+ * FIXME this is useless until we can flag the failure
+ */
struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp)
@@ -1204,5 +1543,5 @@ struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp)
icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop
- = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
+ icalproperty *prop;
+ prop = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
if (prop == 0){
@@ -1210,7 +1549,18 @@ struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp)
}
-
- return icalproperty_get_dtstart(prop);
-}
+ return icalcomponent_get_datetime(comp, prop);
+}
+/** @brief Get DTEND property as an icaltime
+ *
+ * If a DTEND property is not present but a DURATION is, we use
+ * that to determine the proper end.
+ *
+ * If DTSTART is a DATE-TIME with a timezone 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.
+ *
+ * FIXME this is useless until we can flag the failure
+ */
struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp)
@@ -1218,16 +1568,12 @@ struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp)
icalcomponent *inner = icalcomponent_get_inner(comp);
-
icalproperty *end_prop
= icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
-
icalproperty *dur_prop
= icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
+ struct icaltimetype ret = icaltime_null_time();
-
- if( end_prop == 0 && dur_prop == 0){
- return icaltime_null_time();
- } else if ( end_prop != 0) {
- return icalproperty_get_dtend(end_prop);
+ if ( end_prop != 0) {
+ ret = icalcomponent_get_datetime(comp, end_prop);
} else if ( dur_prop != 0) {
-
+
struct icaltimetype start =
@@ -1236,48 +1582,42 @@ struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp)
icalproperty_get_duration(dur_prop);
-
- struct icaltimetype end = icaltime_add(start,duration);
- return end;
-
- } else {
- /* Error, both duration and dtend have been specified */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
+ struct icaltimetype end = icaltime_add(start,duration);
+ ret = end;
}
-
-}
+ return ret;
+}
+/** @brief Set DTEND property to given icaltime
+ *
+ * This method respects the icaltime type (DATE vs DATE-TIME) and
+ * timezone (or lack thereof).
+ *
+ * This also checks that a DURATION property isn't already there,
+ * and returns an error if it is. It's the caller's responsibility
+ * to remove it.
+ */
void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v)
{
- icalcomponent *inner = icalcomponent_get_inner(comp);
-
- icalproperty *end_prop
- = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
-
- icalproperty *dur_prop
- = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
-
+ char *tzid;
+ ICALSETUPSET(ICAL_DTEND_PROPERTY);
- if( end_prop == 0 && dur_prop == 0){
- end_prop = icalproperty_new_dtend(v);
- icalcomponent_add_property(inner,end_prop);
- } else if ( end_prop != 0) {
- icalproperty_set_dtend(end_prop,v);
- } else if ( dur_prop != 0) {
- struct icaltimetype start =
- icalcomponent_get_dtstart(inner);
-
- struct icaltimetype end =
- icalcomponent_get_dtend(inner);
+ if (icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY)
+ != NULL) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return;
+ }
- struct icaldurationtype dur
- = icaltime_subtract(end,start);
+ if (prop == 0) {
+ prop = icalproperty_new_dtend(v);
+ icalcomponent_add_property(inner, prop);
+ } else {
+ icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
+ }
- icalproperty_set_duration(dur_prop,dur);
+ icalproperty_set_dtend(prop,v);
- } else {
- /* Error, both duration and dtend have been specified */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) {
+ icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid));
}
@@ -1285,2 +1625,11 @@ void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v)
+/** @brief Set DURATION property to given icalduration
+ *
+ * This method respects the icaltime type (DATE vs DATE-TIME) and
+ * timezone (or lack thereof).
+ *
+ * This also checks that a DTEND property isn't already there,
+ * and returns an error if it is. It's the caller's responsibility
+ * to remove it.
+ */
void icalcomponent_set_duration(icalcomponent* comp,
@@ -1288,27 +1637,14 @@ void icalcomponent_set_duration(icalcomponent* comp,
{
- icalcomponent *inner = icalcomponent_get_inner(comp);
-
- icalproperty *end_prop
- = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
-
- icalproperty *dur_prop
- = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
-
-
- if( end_prop == 0 && dur_prop == 0){
- dur_prop = icalproperty_new_duration(v);
- icalcomponent_add_property(inner, dur_prop);
- } else if ( end_prop != 0) {
- struct icaltimetype start =
- icalcomponent_get_dtstart(inner);
-
- struct icaltimetype new_end = icaltime_add(start,v);
+ ICALSETUPSET(ICAL_DURATION_PROPERTY);
- icalproperty_set_dtend(end_prop,new_end);
+ if (icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY) != NULL) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return;
+ }
- } else if ( dur_prop != 0) {
- icalproperty_set_duration(dur_prop,v);
+ if (prop == 0) {
+ prop = icalproperty_new_duration(v);
+ icalcomponent_add_property(inner, prop);
} else {
- /* Error, both duration and dtend have been specified */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ icalproperty_set_duration(prop,v);
}
@@ -1316,2 +1652,7 @@ void icalcomponent_set_duration(icalcomponent* comp,
+/** @brief Get DURATION property as an icalduration
+ *
+ * If a DURATION property is not present but a DTEND is, we use
+ * that to determine the proper end.
+ */
struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
@@ -1326,20 +1667,19 @@ struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
- struct icaldurationtype null_duration;
- memset(&null_duration,0,sizeof(struct icaldurationtype));
+ struct icaldurationtype ret = icaldurationtype_null_duration();
+ if ( dur_prop != 0 && end_prop == 0) {
+ ret = icalproperty_get_duration(dur_prop);
- if( end_prop == 0 && dur_prop == 0){
- return null_duration;
- } else if ( end_prop != 0) {
+ } else if ( end_prop != 0 && dur_prop == 0) {
+ /**
+ * FIXME
+ * We assume DTSTART and DTEND are not in different time zones.
+ * Does the standard actually guarantee this?
+ */
struct icaltimetype start =
icalcomponent_get_dtstart(inner);
- time_t startt = icaltime_as_timet(start);
-
struct icaltimetype end =
icalcomponent_get_dtend(inner);
- time_t endt = icaltime_as_timet(end);
-
- return icaldurationtype_from_int(endt-startt);
- } else if ( dur_prop != 0) {
- return icalproperty_get_duration(dur_prop);
+
+ ret = icaltime_subtract(end, start);
} else {
@@ -1347,18 +1687,17 @@ struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return null_duration;
}
+ return ret;
}
-void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
+void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
{
- icalproperty *prop
- = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
+ ICALSETUPSET(ICAL_DTSTAMP_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_method(method);
- icalcomponent_add_property(comp, prop);
+ prop = icalproperty_new_dtstamp(v);
+ icalcomponent_add_property(inner, prop);
}
- icalproperty_set_method(prop,method);
+ icalproperty_set_dtstamp(prop,v);
@@ -1366,28 +1705,50 @@ void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
-icalproperty_method icalcomponent_get_method(icalcomponent* comp)
+
+struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp)
{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
icalproperty *prop
- = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY);
+ = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
if (prop == 0){
- return ICAL_METHOD_NONE;
+ return icaltime_null_time();
}
- return icalproperty_get_method(prop);
+ return icalproperty_get_dtstamp(prop);
}
-void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
+
+void icalcomponent_set_summary(icalcomponent* comp, const char* v)
+{
+ ICALSETUPSET(ICAL_SUMMARY_PROPERTY)
+
+ if (prop == 0){
+ prop = icalproperty_new_summary(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_summary(prop,v);
+}
+
+
+const char* icalcomponent_get_summary(icalcomponent* comp)
{
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
- icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop
- = icalcomponent_get_first_property(inner, ICAL_DTSTAMP_PROPERTY);
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+ prop= icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_dtstamp(v);
- icalcomponent_add_property(inner, prop);
+ return 0;
}
- icalproperty_set_dtstamp(prop,v);
+ return icalproperty_get_summary(prop);
@@ -1395,37 +1756,60 @@ void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
-
-struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp)
+void icalcomponent_set_comment(icalcomponent* comp, const char* v)
{
- icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop
- = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
+ ICALSETUPSET(ICAL_COMMENT_PROPERTY);
if (prop == 0){
- return icaltime_null_time();
+ prop = icalproperty_new_comment(v);
+ icalcomponent_add_property(inner, prop);
}
-
- return icalproperty_get_dtstamp(prop);
+
+ icalproperty_set_summary(prop,v);
+
}
+const char* icalcomponent_get_comment(icalcomponent* comp){
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+ inner = icalcomponent_get_inner(comp);
-void icalcomponent_set_summary(icalcomponent* comp, const char* v)
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_COMMENT_PROPERTY);
+
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_comment(prop);
+}
+
+void icalcomponent_set_uid(icalcomponent* comp, const char* v)
{
- icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop
- = icalcomponent_get_first_property(inner, ICAL_SUMMARY_PROPERTY);
+ ICALSETUPSET(ICAL_UID_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_summary(v);
+ prop = icalproperty_new_uid(v);
icalcomponent_add_property(inner, prop);
}
-
+
icalproperty_set_summary(prop,v);
+
}
+const char* icalcomponent_get_uid(icalcomponent* comp){
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+ inner = icalcomponent_get_inner(comp);
-const char* icalcomponent_get_summary(icalcomponent* comp)
-{
- icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop
- = icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY);
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
@@ -1435,18 +1819,173 @@ const char* icalcomponent_get_summary(icalcomponent* comp)
- return icalproperty_get_summary(prop);
+ return icalproperty_get_uid(prop);
+}
+void icalcomponent_set_recurrenceid(icalcomponent* comp, struct icaltimetype v)
+{
+ ICALSETUPSET(ICAL_RECURRENCEID_PROPERTY);
+
+ if (prop == 0){
+ prop = icalproperty_new_recurrenceid(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_recurrenceid(prop,v);
}
+struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp)
+{
+ icalcomponent *inner;
+ icalproperty *prop;
+ if (comp == 0) {
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return icaltime_null_time();
+ }
-void icalcomponent_set_comment(icalcomponent* comp, const char* v);
-const char* icalcomponent_get_comment(icalcomponent* comp);
+ inner = icalcomponent_get_inner(comp);
-void icalcomponent_set_uid(icalcomponent* comp, const char* v);
-const char* icalcomponent_get_uid(icalcomponent* comp);
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return icaltime_null_time();
+ }
-void icalcomponent_set_recurrenceid(icalcomponent* comp,
- struct icaltimetype v);
-struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
+ prop= icalcomponent_get_first_property(inner, ICAL_RECURRENCEID_PROPERTY);
+ if (prop == 0){
+ return icaltime_null_time();
+ }
+
+ return icalproperty_get_recurrenceid(prop);
+}
+
+void icalcomponent_set_description(icalcomponent* comp, const char* v)
+{
+ ICALSETUPSET(ICAL_DESCRIPTION_PROPERTY);
+
+ if (prop == 0){
+ prop = icalproperty_new_description(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_description(prop,v);
+}
+const char* icalcomponent_get_description(icalcomponent* comp)
+{
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_DESCRIPTION_PROPERTY);
+
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_description(prop);
+}
+
+void icalcomponent_set_location(icalcomponent* comp, const char* v)
+{
+ ICALSETUPSET(ICAL_LOCATION_PROPERTY)
+
+ if (prop == 0){
+ prop = icalproperty_new_location(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_location(prop,v);
+}
+const char* icalcomponent_get_location(icalcomponent* comp)
+{
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_LOCATION_PROPERTY);
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_location(prop);
+}
+
+void icalcomponent_set_sequence(icalcomponent* comp, int v)
+{
+ ICALSETUPSET(ICAL_SEQUENCE_PROPERTY);
+
+ if (prop == 0){
+ prop = icalproperty_new_sequence(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_sequence(prop,v);
+
+}
+int icalcomponent_get_sequence(icalcomponent* comp){
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_SEQUENCE_PROPERTY);
+
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_sequence(prop);
+}
+
+
+void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v)
+{
+ ICALSETUPSET(ICAL_STATUS_PROPERTY);
+
+ if (prop == 0){
+ prop = icalproperty_new_status(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_status(prop,v);
+
+}
+enum icalproperty_status icalcomponent_get_status(icalcomponent* comp){
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+ prop= icalcomponent_get_first_property(inner,ICAL_STATUS_PROPERTY);
+
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_status(prop);
+}
@@ -1488 +2027,569 @@ icalcomponent* icalcomponent_new_xdaylight()
}
+icalcomponent* icalcomponent_new_vagenda()
+{
+ return icalcomponent_new(ICAL_VAGENDA_COMPONENT);
+}
+icalcomponent* icalcomponent_new_vquery()
+{
+ return icalcomponent_new(ICAL_VQUERY_COMPONENT);
+}
+
+/*
+ * Timezone stuff.
+ */
+
+
+/**
+ * This takes 2 VCALENDAR components and merges the second one into the first,
+ * resolving any problems with conflicting TZIDs. comp_to_merge will no
+ * longer exist after calling this function.
+ */
+void icalcomponent_merge_component(icalcomponent* comp,
+ icalcomponent* comp_to_merge)
+{
+ icalcomponent *subcomp, *next_subcomp;
+ icalarray *tzids_to_rename;
+ int i;
+
+ /* Check that both components are VCALENDAR components. */
+ assert (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT);
+ assert (icalcomponent_isa(comp_to_merge) == ICAL_VCALENDAR_COMPONENT);
+
+ /* Step through each subcomponent of comp_to_merge, looking for VTIMEZONEs.
+ For each VTIMEZONE found, check if we need to add it to comp and if we
+ need to rename it and all TZID references to it. */
+ tzids_to_rename = icalarray_new (sizeof (char*), 16);
+ subcomp = icalcomponent_get_first_component (comp_to_merge,
+ ICAL_VTIMEZONE_COMPONENT);
+ while (subcomp) {
+ next_subcomp = icalcomponent_get_next_component (comp_to_merge,
+ ICAL_VTIMEZONE_COMPONENT);
+ /* This will add the VTIMEZONE to comp, if necessary, and also update
+ the array of TZIDs we need to rename. */
+ icalcomponent_merge_vtimezone (comp, subcomp, tzids_to_rename);
+ /* FIXME: Handle possible NEWFAILED error. */
+
+ subcomp = next_subcomp;
+ }
+
+ /* If we need to do any renaming of TZIDs, do it now. */
+ if (tzids_to_rename->num_elements != 0) {
+ icalcomponent_rename_tzids (comp_to_merge, tzids_to_rename);
+
+ /* Now free the tzids_to_rename array. */
+ for (i = 0; i < tzids_to_rename->num_elements; i++) {
+ free (icalarray_element_at (tzids_to_rename, i));
+ }
+ icalarray_free (tzids_to_rename);
+ }
+
+ /* Now move all the components from comp_to_merge to comp, excluding
+ VTIMEZONE components. */
+ subcomp = icalcomponent_get_first_component (comp_to_merge,
+ ICAL_ANY_COMPONENT);
+ while (subcomp) {
+ next_subcomp = icalcomponent_get_next_component (comp_to_merge,
+ ICAL_ANY_COMPONENT);
+ if (icalcomponent_isa(subcomp) != ICAL_VTIMEZONE_COMPONENT) {
+ icalcomponent_remove_component (comp_to_merge, subcomp);
+ icalcomponent_add_component (comp, subcomp);
+ }
+ subcomp = next_subcomp;
+ }
+
+ /* Free comp_to_merge. We have moved most of the subcomponents over to
+ comp now. */
+ icalcomponent_free (comp_to_merge);
+}
+
+
+static void icalcomponent_merge_vtimezone (icalcomponent *comp,
+ icalcomponent *vtimezone,
+ icalarray *tzids_to_rename)
+{
+ icalproperty *tzid_prop;
+ const char *tzid;
+ char *tzid_copy;
+ icaltimezone *existing_vtimezone;
+
+ /* Get the TZID of the VTIMEZONE. */
+ tzid_prop = icalcomponent_get_first_property (vtimezone, ICAL_TZID_PROPERTY);
+ if (!tzid_prop)
+ return;
+
+ tzid = icalproperty_get_tzid (tzid_prop);
+ if (!tzid)
+ return;
+
+ /* See if there is already a VTIMEZONE in comp with the same TZID. */
+ existing_vtimezone = icalcomponent_get_timezone (comp, tzid);
+
+ /* If there is no existing VTIMEZONE with the same TZID, we can just move
+ the VTIMEZONE to comp and return. */
+ if (!existing_vtimezone) {
+ icalcomponent_remove_component (icalcomponent_get_parent (vtimezone),
+ vtimezone);
+ icalcomponent_add_component (comp, vtimezone);
+ return;
+ }
+
+ /* If the TZID has a '/' prefix, then we don't have to worry about the
+ clashing TZIDs, as they are supposed to be exactly the same VTIMEZONE. */
+ if (tzid[0] == '/')
+ return;
+
+ /* Now we have two VTIMEZONEs with the same TZID (which isn't a globally
+ unique one), so we compare the VTIMEZONE components to see if they are
+ the same. If they are, we don't need to do anything. We make a copy of
+ the tzid, since the parameter may get modified in these calls. */
+ tzid_copy = strdup (tzid);
+ if (!tzid_copy) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ if (!icalcomponent_compare_vtimezones (comp, vtimezone)) {
+ /* FIXME: Handle possible NEWFAILED error. */
+
+ /* Now we have two different VTIMEZONEs with the same TZID. */
+ icalcomponent_handle_conflicting_vtimezones (comp, vtimezone, tzid_prop,
+ tzid_copy, tzids_to_rename);
+ }
+ free (tzid_copy);
+}
+
+
+static void
+icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
+ icalcomponent *vtimezone,
+ icalproperty *tzid_prop,
+ const char *tzid,
+ icalarray *tzids_to_rename)
+{
+ int i, suffix, max_suffix = 0, num_elements;
+ unsigned int tzid_len;
+ char *tzid_copy, *new_tzid, suffix_buf[32];
+
+ /* Find the length of the TZID without any trailing digits. */
+ tzid_len = icalcomponent_get_tzid_prefix_len (tzid);
+
+ /* Step through each of the VTIMEZONEs in comp. We may already have the
+ clashing VTIMEZONE in the calendar, but it may have been renamed
+ (i.e. a unique number added on the end of the TZID, e.g. 'London2').
+ So we compare the new VTIMEZONE with any VTIMEZONEs that have the
+ same prefix (e.g. 'London'). If it matches any of those, we have to
+ rename the TZIDs to that TZID, else we rename to a new TZID, using
+ the biggest numeric suffix found + 1. */
+ num_elements = comp->timezones ? comp->timezones->num_elements : 0;
+ for (i = 0; i < num_elements; i++) {
+ icaltimezone *zone;
+ char *existing_tzid, *existing_tzid_copy;
+ unsigned int existing_tzid_len;
+
+ zone = icalarray_element_at (comp->timezones, i);
+ existing_tzid = icaltimezone_get_tzid (zone);
+
+ /* Find the length of the TZID without any trailing digits. */
+ existing_tzid_len = icalcomponent_get_tzid_prefix_len (existing_tzid);
+
+ /* Check if we have the same prefix. */
+ if (tzid_len == existing_tzid_len
+ && !strncmp (tzid, existing_tzid, tzid_len)) {
+ /* Compare the VTIMEZONEs. */
+ if (icalcomponent_compare_vtimezones (icaltimezone_get_component (zone),
+ vtimezone)) {
+ /* The VTIMEZONEs match, so we can use the existing VTIMEZONE. But
+ we have to rename TZIDs to this TZID. */
+ tzid_copy = strdup (tzid);
+ existing_tzid_copy = strdup (existing_tzid);
+ if (!tzid_copy || !existing_tzid_copy) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ } else {
+ icalarray_append (tzids_to_rename, tzid_copy);
+ icalarray_append (tzids_to_rename, existing_tzid_copy);
+ }
+ return;
+ } else {
+ /* FIXME: Handle possible NEWFAILED error. */
+
+ /* Convert the suffix to an integer and remember the maximum numeric
+ suffix found. */
+ suffix = atoi (existing_tzid + existing_tzid_len);
+ if (max_suffix < suffix)
+ max_suffix = suffix;
+ }
+ }
+ }
+
+ /* We didn't find a VTIMEZONE that matched, so we have to rename the TZID,
+ using the maximum numerical suffix found + 1. */
+ tzid_copy = strdup (tzid);
+ sprintf (suffix_buf, "%i", max_suffix + 1);
+ new_tzid = malloc (tzid_len + strlen (suffix_buf) + 1);
+ if (!new_tzid || !tzid_copy) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ strncpy (new_tzid, tzid, tzid_len);
+ strcpy (new_tzid + tzid_len, suffix_buf);
+ icalarray_append (tzids_to_rename, tzid_copy);
+ icalarray_append (tzids_to_rename, new_tzid);
+}
+
+
+/* Returns the length of the TZID, without any trailing digits. */
+static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid)
+{
+ int len;
+ const char *p;
+
+ len = strlen (tzid);
+ p = tzid + len - 1;
+ while (len > 0 && *p >= '0' && *p <= '9') {
+ p--;
+ len--;
+ }
+
+ return len;
+}
+
+
+/**
+ * Renames all references to the given TZIDs to a new name. rename_table
+ * contains pairs of strings - a current TZID, and the new TZID to rename it
+ * to.
+ */
+static void icalcomponent_rename_tzids(icalcomponent* comp,
+ icalarray* rename_table)
+{
+ icalcomponent_foreach_tzid (comp, icalcomponent_rename_tzids_callback,
+ rename_table);
+}
+
+
+static void icalcomponent_rename_tzids_callback(icalparameter *param, void *data)
+{
+ icalarray *rename_table = data;
+ const char *tzid;
+ int i;
+
+ tzid = icalparameter_get_tzid (param);
+ if (!tzid)
+ return;
+
+ /* Step through the rename table to see if the current TZID matches
+ any of the ones we want to rename. */
+ for (i = 0; i < rename_table->num_elements - 1; i += 2) {
+ if (!strcmp (tzid, icalarray_element_at (rename_table, i))) {
+ icalparameter_set_tzid (param, icalarray_element_at (rename_table, i + 1));
+ break;
+ }
+ }
+}
+
+
+/**
+ * Calls the given function for each TZID parameter found in the component.
+ */
+void icalcomponent_foreach_tzid(icalcomponent* comp,
+ void (*callback)(icalparameter *param, void *data),
+ void *callback_data)
+{
+ icalproperty *prop;
+ icalproperty_kind kind;
+ icalparameter *param;
+ icalcomponent *subcomp;
+
+ /* First look for any TZID parameters used in this component itself. */
+ prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY);
+ while (prop) {
+ kind = icalproperty_isa (prop);
+
+ /* These are the only properties that can have a TZID. Note that
+ COMPLETED, CREATED, DTSTAMP & LASTMODIFIED must be in UTC. */
+ if (kind == ICAL_DTSTART_PROPERTY || kind == ICAL_DTEND_PROPERTY
+ || kind == ICAL_DUE_PROPERTY || kind == ICAL_EXDATE_PROPERTY
+ || kind == ICAL_RDATE_PROPERTY) {
+ param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ if (param)
+ (*callback) (param, callback_data);
+ }
+
+ prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY);
+ }
+
+ /* Now recursively check child components. */
+ subcomp = icalcomponent_get_first_component (comp, ICAL_ANY_COMPONENT);
+ while (subcomp) {
+ icalcomponent_foreach_tzid (subcomp, callback, callback_data);
+ subcomp = icalcomponent_get_next_component (comp, ICAL_ANY_COMPONENT);
+ }
+}
+
+
+
+/**
+ * Returns the icaltimezone from the component corresponding to the given
+ * TZID, or NULL if the component does not have a corresponding VTIMEZONE.
+ */
+icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, const char *tzid)
+{
+ icaltimezone *zone;
+ int lower, upper, middle, cmp;
+ char *zone_tzid;
+
+ if (!comp->timezones)
+ return NULL;
+
+ /* Sort the array if necessary (by the TZID string). */
+ if (!comp->timezones_sorted) {
+ icalarray_sort (comp->timezones, icalcomponent_compare_timezone_fn);
+ comp->timezones_sorted = 1;
+ }
+
+ /* Do a simple binary search. */
+ lower = middle = 0;
+ upper = comp->timezones->num_elements;
+
+ while (lower < upper) {
+ middle = (lower + upper) >> 1;
+ zone = icalarray_element_at (comp->timezones, middle);
+ zone_tzid = icaltimezone_get_tzid (zone);
+ cmp = strcmp (tzid, zone_tzid);
+ if (cmp == 0)
+ return zone;
+ else if (cmp < 0)
+ upper = middle;
+ else
+ lower = middle + 1;
+ }
+
+ return NULL;
+}
+
+
+/**
+ * A function to compare 2 icaltimezone elements, used for qsort().
+ */
+static int icalcomponent_compare_timezone_fn (const void *elem1,
+ const void *elem2)
+{
+ icaltimezone *zone1, *zone2;
+ const char *zone1_tzid, *zone2_tzid;
+
+ zone1 = (icaltimezone*) elem1;
+ zone2 = (icaltimezone*) elem2;
+
+ zone1_tzid = icaltimezone_get_tzid (zone1);
+ zone2_tzid = icaltimezone_get_tzid (zone2);
+
+ return strcmp (zone1_tzid, zone2_tzid);
+}
+
+
+/**
+ * Compares 2 VTIMEZONE components to see if they match, ignoring their TZIDs.
+ * It returns 1 if they match, 0 if they don't, or -1 on error.
+ */
+static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
+ icalcomponent *vtimezone2)
+{
+ icalproperty *prop1, *prop2;
+ const char *tzid1, *tzid2;
+ char *tzid2_copy, *string1, *string2;
+ int cmp;
+
+ /* Get the TZID property of the first VTIMEZONE. */
+ prop1 = icalcomponent_get_first_property (vtimezone1, ICAL_TZID_PROPERTY);
+ if (!prop1)
+ return -1;
+
+ tzid1 = icalproperty_get_tzid (prop1);
+ if (!tzid1)
+ return -1;
+
+ /* Get the TZID property of the second VTIMEZONE. */
+ prop2 = icalcomponent_get_first_property (vtimezone2, ICAL_TZID_PROPERTY);
+ if (!prop2)
+ return -1;
+
+ tzid2 = icalproperty_get_tzid (prop2);
+ if (!tzid2)
+ return -1;
+
+ /* Copy the second TZID, and set the property to the same as the first
+ TZID, since we don't care if these match of not. */
+ tzid2_copy = strdup (tzid2);
+ if (!tzid2_copy) {
+ icalerror_set_errno (ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ icalproperty_set_tzid (prop2, tzid1);
+
+ /* Now convert both VTIMEZONEs to strings and compare them. */
+ string1 = icalcomponent_as_ical_string (vtimezone1);
+ if (!string1) {
+ free (tzid2_copy);
+ return -1;
+ }
+
+ string2 = icalcomponent_as_ical_string (vtimezone2);
+ if (!string2) {
+ free (string1);
+ free (tzid2_copy);
+ return -1;
+ }
+
+ cmp = strcmp (string1, string2);
+
+ free (string1);
+ free (string2);
+
+ /* Now reset the second TZID. */
+ icalproperty_set_tzid (prop2, tzid2_copy);
+ free (tzid2_copy);
+
+ return (cmp == 0) ? 1 : 0;
+}
+
+
+
+
+
+
+/**
+ * @brief set the RELCALID property of a component.
+ *
+ * @param comp Valid calendar component.
+ * @param v Relcalid URL value
+ */
+
+void icalcomponent_set_relcalid(icalcomponent* comp, const char* v)
+{
+ ICALSETUPSET(ICAL_RELCALID_PROPERTY);
+
+ if (prop == 0){
+ prop = icalproperty_new_relcalid(v);
+ icalcomponent_add_property(inner, prop);
+ }
+
+ icalproperty_set_relcalid(prop,v);
+
+}
+
+
+/**
+ * @brief get the RELCALID property of a component.
+ *
+ * @param comp Valid calendar component.
+ */
+
+const char* icalcomponent_get_relcalid(icalcomponent* comp){
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalerror_check_arg_rz(comp!=0,"comp");
+
+ inner = icalcomponent_get_inner(comp);
+
+ if(inner == 0){
+ return 0;
+ }
+
+ prop= icalcomponent_get_first_property(inner,ICAL_RELCALID_PROPERTY);
+
+ if (prop == 0){
+ return 0;
+ }
+
+ return icalproperty_get_relcalid(prop);
+}
+
+
+/** @brief Return the time a TODO task is DUE.
+ *
+ * @param comp Valid calendar component.
+ *
+ * Uses the DUE: property if it exists, otherwise we calculate the DUE
+ * value by adding the task's duration to the DTSTART time
+ */
+
+struct icaltimetype icalcomponent_get_due(icalcomponent* comp)
+{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+
+ icalproperty *due_prop
+ = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY);
+
+ icalproperty *dur_prop
+ = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
+
+ if( due_prop == 0 && dur_prop == 0){
+ return icaltime_null_time();
+ } else if ( due_prop != 0) {
+ return icalproperty_get_due(due_prop);
+ } else if ( dur_prop != 0) {
+
+ struct icaltimetype start =
+ icalcomponent_get_dtstart(inner);
+ struct icaldurationtype duration =
+ icalproperty_get_duration(dur_prop);
+
+ struct icaltimetype due = icaltime_add(start,duration);
+
+ return due;
+
+ } else {
+ /* Error, both duration and due have been specified */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return icaltime_null_time();
+
+ }
+
+}
+
+/** @brief Set the due date of a VTODO task.
+ *
+ * @param comp Valid VTODO component.
+ * @param v Valid due date time.
+ *
+ * - If no duration or due properties then set the DUE property.
+ * - If a DUE property is already set, then reset it to the value v.
+ * - If a DURATION property is already set, then calculate the new
+ * duration based on the supplied value of v.
+ */
+
+void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v)
+{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+
+ icalproperty *due_prop
+ = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY);
+
+ icalproperty *dur_prop
+ = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
+
+
+ if( due_prop == 0 && dur_prop == 0){
+ due_prop = icalproperty_new_due(v);
+ icalcomponent_add_property(inner,due_prop);
+ } else if ( due_prop != 0) {
+ icalproperty_set_due(due_prop,v);
+ } else if ( dur_prop != 0) {
+ struct icaltimetype start =
+ icalcomponent_get_dtstart(inner);
+
+ struct icaltimetype due =
+ icalcomponent_get_due(inner);
+
+ struct icaldurationtype dur
+ = icaltime_subtract(due,start);
+
+ icalproperty_set_duration(dur_prop,dur);
+
+ } else {
+ /* Error, both duration and due have been specified */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ }
+}
diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h
index 6046bbe..be9bf8c 100644
--- a/libical/src/libical/icalcomponent.h
+++ b/libical/src/libical/icalcomponent.h
@@ -29,6 +29,14 @@
#include "icalenums.h" /* defines icalcomponent_kind */
-#include "icalattendee.h"
#include "pvl.h"
-typedef void icalcomponent;
+typedef struct icalcomponent_impl icalcomponent;
+
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+/** @brief An opaque struct representing a timezone.
+ * We declare this here to avoid a circular dependancy.
+ */
+typedef struct _icaltimezone icaltimezone;
+#endif
+
@@ -53,3 +61,3 @@ int icalcomponent_is_valid(icalcomponent* component);
-icalcomponent_kind icalcomponent_isa(icalcomponent* component);
+icalcomponent_kind icalcomponent_isa(const icalcomponent* component);
@@ -99,2 +107,10 @@ int icalcomponent_count_components(icalcomponent* component,
+/**
+ This takes 2 VCALENDAR components and merges the second one into the first,
+ resolving any problems with conflicting TZIDs. comp_to_merge will no
+ longer exist after calling this function. */
+void icalcomponent_merge_component(icalcomponent* comp,
+ icalcomponent* comp_to_merge);
+
+
/* Iteration Routines. There are two forms of iterators, internal and
@@ -123,12 +139,16 @@ icalcomponent* icalcompiter_deref(icalcompiter* i);
+/* Working with embedded error properties */
+/* Check the component against itip rules and insert error properties*/
/* Working with embedded error properties */
+int icalcomponent_check_restrictions(icalcomponent* comp);
+/** Count embedded errors. */
int icalcomponent_count_errors(icalcomponent* component);
-/* Remove all X-LIC-ERROR properties*/
+/** Remove all X-LIC-ERROR properties*/
void icalcomponent_strip_errors(icalcomponent* component);
-/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
+/** Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
void icalcomponent_convert_errors(icalcomponent* component);
@@ -140,3 +160,5 @@ void icalcomponent_set_parent(icalcomponent* component,
-/* Kind conversion routiens */
+/* Kind conversion routines */
+
+int icalcomponent_kind_is_valid(const icalcomponent_kind kind);
@@ -153,3 +175,3 @@ wrong component subtypes. */
-/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
+/** For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
VJOURNAL */
@@ -157,3 +179,3 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
-/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
+/** For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
times of an event in UTC */
@@ -179,2 +201,5 @@ void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
+struct icaltimetype icalcomponent_get_due(icalcomponent* comp);
+void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v);
+
void icalcomponent_set_duration(icalcomponent* comp,
@@ -189,3 +214,2 @@ void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
-
void icalcomponent_set_summary(icalcomponent* comp, const char* v);
@@ -199,2 +223,5 @@ const char* icalcomponent_get_uid(icalcomponent* comp);
+void icalcomponent_set_relcalid(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_relcalid(icalcomponent* comp);
+
void icalcomponent_set_recurrenceid(icalcomponent* comp,
@@ -203,19 +230,37 @@ struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
+void icalcomponent_set_description(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_description(icalcomponent* comp);
-void icalcomponent_set_organizer(icalcomponent* comp,
- struct icalorganizertype org);
- struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
+void icalcomponent_set_location(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_location(icalcomponent* comp);
+void icalcomponent_set_sequence(icalcomponent* comp, int v);
+int icalcomponent_get_sequence(icalcomponent* comp);
-void icalcomponent_add_attendee(icalcomponent *comp,
- struct icalattendeetype attendee);
+void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v);
+enum icalproperty_status icalcomponent_get_status(icalcomponent* comp);
-int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
-/* Get the Nth attendee. Out of range indices return an attendee
- with cuid == 0 */
-struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
- int index);
+/** Calls the given function for each TZID parameter found in the
+ component, and any subcomponents. */
+void icalcomponent_foreach_tzid(icalcomponent* comp,
+ void (*callback)(icalparameter *param, void *data),
+ void *callback_data);
+/** Returns the icaltimezone in the component corresponding to the
+ TZID, or NULL if it can't be found. */
+icaltimezone* icalcomponent_get_timezone(icalcomponent* comp,
+ const char *tzid);
+int icalproperty_recurrence_is_excluded(icalcomponent *comp,
+ struct icaltimetype *dtstart,
+ struct icaltimetype *recurtime);
+
+void icalcomponent_foreach_recurrence(icalcomponent* comp,
+ struct icaltimetype start,
+ struct icaltimetype end,
+ void (*callback)(icalcomponent *comp,
+ struct icaltime_span *span,
+ void *data),
+ void *callback_data);
@@ -233,8 +278,5 @@ icalcomponent* icalcomponent_new_xstandard();
icalcomponent* icalcomponent_new_xdaylight();
-
-
+icalcomponent* icalcomponent_new_vagenda();
+icalcomponent* icalcomponent_new_vquery();
#endif /* !ICALCOMPONENT_H */
-
-
-
diff --git a/libical/src/libical/icalderivedparameter.c b/libical/src/libical/icalderivedparameter.c
index 6898eb6..91604f0 100644
--- a/libical/src/libical/icalderivedparameter.c
+++ b/libical/src/libical/icalderivedparameter.c
@@ -57,41 +57,2 @@ struct icalparameter_kind_map {
-extern struct icalparameter_kind_map parameter_map[];
-
-
-const char* icalparameter_kind_to_string(icalparameter_kind kind)
-{
- int i;
-
- for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
- if (parameter_map[i].kind == kind) {
- return parameter_map[i].name;
- }
- }
-
- return 0;
-
-}
-
-icalparameter_kind icalparameter_string_to_kind(const char* string)
-{
- int i;
-
- if (string ==0 ) {
- return ICAL_NO_PARAMETER;
- }
-
- for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
-
- if (strcmp(parameter_map[i].name, string) == 0) {
- return parameter_map[i].kind;
- }
- }
-
- if(strncmp(string,"X-",2)==0){
- return ICAL_X_PARAMETER;
- }
-
- return ICAL_NO_PARAMETER;
-}
-
/* This map associates the enumerations for the VALUE parameter with
@@ -104,20 +65,2 @@ struct icalparameter_value_kind_map {
-extern struct icalparameter_value_kind_map value_kind_map[];
-
-
-icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
-{
- int i;
-
- for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) {
-
- if (value_kind_map[i].value == value) {
- return value_kind_map[i].kind;
- }
- }
-
- return ICAL_NO_VALUE;
-}
-
-
/* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
@@ -131,83 +74,4 @@ struct icalparameter_map {
-extern struct icalparameter_map icalparameter_map[];
-
-
-const char* icalparameter_enum_to_string(int e)
-{
- int i;
-
- icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e");
- icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e");
-
- for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
- if(e == icalparameter_map[i].enumeration){
- return icalparameter_map[i].str;
- }
- }
-
- return 0;
-}
-
-int icalparameter_string_to_enum(const char* str)
-{
- int i;
-
- icalerror_check_arg_rz(str != 0,"str");
-
- for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
- if(strcmp(str,icalparameter_map[i].str) == 0) {
- return icalparameter_map[i].enumeration;
- }
- }
-
- return 0;
-}
-icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val)
-{
-
- struct icalparameter_impl* param=0;
- int found_kind = 0;
- int i;
-
- icalerror_check_arg_rz((val!=0),"val");
-
- /* Search through the parameter map to find a matching kind */
-
- param = icalparameter_new_impl(kind);
-
- for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
- if(kind == icalparameter_map[i].kind) {
- found_kind = 1;
- if(strcmp(val,icalparameter_map[i].str) == 0) {
-
- param->data = (int)icalparameter_map[i].enumeration;
- return param;
- }
- }
- }
-
- if(found_kind == 1){
- /* The kind was in the parameter map, but the string did not
- match, so assume that it is an alternate value, like an
- X-value.*/
-
- icalparameter_set_xvalue(param, val);
-
- } else {
-
- /* If the kind was not found, then it must be a string type */
-
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val);
-
- }
-
- return param;
-}
-
-
-
-
-/* Everything below this line is machine generated. Do not edit. */
-struct icalparameter_value_kind_map value_kind_map[] = {
+static struct icalparameter_value_kind_map value_kind_map[15] = {
{ICAL_VALUE_BINARY,ICAL_BINARY_VALUE},
@@ -229,3 +93,3 @@ struct icalparameter_value_kind_map value_kind_map[] = {
-static struct icalparameter_kind_map parameter_map[] = {
+static struct icalparameter_kind_map parameter_map[24] = {
{ICAL_ALTREP_PARAMETER,"ALTREP"},
@@ -279,3 +143,3 @@ static struct icalparameter_map icalparameter_map[] = {
{ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"},
- {ICAL_RELATED_PARAMETER,ICAL_RELATED_END ,"END "},
+ {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"},
{ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"},
@@ -310,2 +174,4 @@ static struct icalparameter_map icalparameter_map[] = {
{ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"},
+ {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNULL,"ISNULL"},
+ {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNOTNULL,"ISNOTNULL"},
{ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT-PARSE-ERROR"},
@@ -318,6 +184,7 @@ static struct icalparameter_map icalparameter_map[] = {
{ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME-PARSE-ERROR"},
+ {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VCALPROPPARSEERROR,"VCAL-PROP-PARSE-ERROR"},
{ICAL_NO_PARAMETER,0,""}};
-/* DELEGATED-FROM */
-icalparameter* icalparameter_new_delegatedfrom(const char* v)
+/* LANGUAGE */
+icalparameter* icalparameter_new_language(const char* v)
{
@@ -326,3 +193,3 @@ icalparameter* icalparameter_new_delegatedfrom(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER);
if (impl == 0) {
@@ -331,3 +198,3 @@ icalparameter* icalparameter_new_delegatedfrom(const char* v)
- icalparameter_set_delegatedfrom((icalparameter*) impl,v);
+ icalparameter_set_language((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -340,3 +207,3 @@ icalparameter* icalparameter_new_delegatedfrom(const char* v)
-const char* icalparameter_get_delegatedfrom(icalparameter* param)
+const char* icalparameter_get_language(const icalparameter* param)
{
@@ -344,6 +211,6 @@ const char* icalparameter_get_delegatedfrom(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_delegatedfrom(icalparameter* param, const char* v)
+void icalparameter_set_language(icalparameter* param, const char* v)
{
@@ -356,4 +223,4 @@ void icalparameter_set_delegatedfrom(icalparameter* param, const char* v)
-/* DELEGATED-TO */
-icalparameter* icalparameter_new_delegatedto(const char* v)
+/* DIR */
+icalparameter* icalparameter_new_dir(const char* v)
{
@@ -362,3 +229,3 @@ icalparameter* icalparameter_new_delegatedto(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_DIR_PARAMETER);
if (impl == 0) {
@@ -367,3 +234,3 @@ icalparameter* icalparameter_new_delegatedto(const char* v)
- icalparameter_set_delegatedto((icalparameter*) impl,v);
+ icalparameter_set_dir((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -376,3 +243,3 @@ icalparameter* icalparameter_new_delegatedto(const char* v)
-const char* icalparameter_get_delegatedto(icalparameter* param)
+const char* icalparameter_get_dir(const icalparameter* param)
{
@@ -380,6 +247,6 @@ const char* icalparameter_get_delegatedto(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_delegatedto(icalparameter* param, const char* v)
+void icalparameter_set_dir(icalparameter* param, const char* v)
{
@@ -392,4 +259,4 @@ void icalparameter_set_delegatedto(icalparameter* param, const char* v)
-/* RANGE */
-icalparameter* icalparameter_new_range(icalparameter_range v)
+/* RELTYPE */
+icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
{
@@ -397,5 +264,5 @@ icalparameter* icalparameter_new_range(icalparameter_range v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v");
- icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER);
if (impl == 0) {
@@ -404,3 +271,3 @@ icalparameter* icalparameter_new_range(icalparameter_range v)
- icalparameter_set_range((icalparameter*) impl,v);
+ icalparameter_set_reltype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -413,3 +280,3 @@ icalparameter* icalparameter_new_range(icalparameter_range v)
-icalparameter_range icalparameter_get_range(icalparameter* param)
+icalparameter_reltype icalparameter_get_reltype(const icalparameter* param)
{
@@ -417,10 +284,13 @@ icalparameter_range icalparameter_get_range(icalparameter* param)
icalerror_check_arg( (param!=0), "param");
+ if (param->string != 0){
+ return ICAL_RELTYPE_X;
+ }
-return (icalparameter_range)((struct icalparameter_impl*)param)->data;
+return (icalparameter_reltype)(param->data);
}
-void icalparameter_set_range(icalparameter* param, icalparameter_range v)
+void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v)
{
- icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v");
- icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -431,4 +301,4 @@ void icalparameter_set_range(icalparameter* param, icalparameter_range v)
-/* ENCODING */
-icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
+/* FMTTYPE */
+icalparameter* icalparameter_new_fmttype(const char* v)
{
@@ -436,5 +306,4 @@ icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v");
- icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v");
- impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER);
+ icalerror_check_arg_rz( (v!=0),"v");
+ impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER);
if (impl == 0) {
@@ -443,3 +312,3 @@ icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
- icalparameter_set_encoding((icalparameter*) impl,v);
+ icalparameter_set_fmttype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -452,17 +321,48 @@ icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
-icalparameter_encoding icalparameter_get_encoding(icalparameter* param)
+const char* icalparameter_get_fmttype(const icalparameter* param)
{
icalerror_clear_errno();
-icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_ENCODING_X;
- }
+ icalerror_check_arg_rz( (param!=0), "param");
+ return param->string;
+}
-return (icalparameter_encoding)((struct icalparameter_impl*)param)->data;
+void icalparameter_set_fmttype(icalparameter* param, const char* v)
+{
+ icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv( (param!=0), "param");
+ icalerror_clear_errno();
+
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
}
-void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v)
+/* TZID */
+icalparameter* icalparameter_new_tzid(const char* v)
{
- icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v");
- icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v");
+ struct icalparameter_impl *impl;
+ icalerror_clear_errno();
+ icalerror_check_arg_rz( (v!=0),"v");
+ impl = icalparameter_new_impl(ICAL_TZID_PARAMETER);
+ if (impl == 0) {
+ return 0;
+ }
+
+ icalparameter_set_tzid((icalparameter*) impl,v);
+ if (icalerrno != ICAL_NO_ERROR) {
+ icalparameter_free((icalparameter*) impl);
+ return 0;
+ }
+
+ return (icalparameter*) impl;
+}
+
+const char* icalparameter_get_tzid(const icalparameter* param)
+{
+ icalerror_clear_errno();
+ icalerror_check_arg_rz( (param!=0), "param");
+ return param->string;
+}
+
+void icalparameter_set_tzid(icalparameter* param, const char* v)
+{
+ icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -470,7 +370,7 @@ void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v)
- ((struct icalparameter_impl*)param)->data = (int)v;
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
}
-/* RSVP */
-icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
+/* RANGE */
+icalparameter* icalparameter_new_range(icalparameter_range v)
{
@@ -478,5 +378,5 @@ icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v");
- icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v");
- impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER);
if (impl == 0) {
@@ -485,3 +385,3 @@ icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
- icalparameter_set_rsvp((icalparameter*) impl,v);
+ icalparameter_set_range((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -494,3 +394,3 @@ icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
-icalparameter_rsvp icalparameter_get_rsvp(icalparameter* param)
+icalparameter_range icalparameter_get_range(const icalparameter* param)
{
@@ -499,9 +399,9 @@ icalerror_check_arg( (param!=0), "param");
-return (icalparameter_rsvp)((struct icalparameter_impl*)param)->data;
+return (icalparameter_range)(param->data);
}
-void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v)
+void icalparameter_set_range(icalparameter* param, icalparameter_range v)
{
- icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v");
- icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -512,4 +412,4 @@ void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v)
-/* PARTSTAT */
-icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
+/* DELEGATED-TO */
+icalparameter* icalparameter_new_delegatedto(const char* v)
{
@@ -517,5 +417,4 @@ icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v");
- icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v");
- impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER);
+ icalerror_check_arg_rz( (v!=0),"v");
+ impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER);
if (impl == 0) {
@@ -524,3 +423,3 @@ icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
- icalparameter_set_partstat((icalparameter*) impl,v);
+ icalparameter_set_delegatedto((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -533,17 +432,48 @@ icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
-icalparameter_partstat icalparameter_get_partstat(icalparameter* param)
+const char* icalparameter_get_delegatedto(const icalparameter* param)
{
icalerror_clear_errno();
-icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_PARTSTAT_X;
- }
+ icalerror_check_arg_rz( (param!=0), "param");
+ return param->string;
+}
-return (icalparameter_partstat)((struct icalparameter_impl*)param)->data;
+void icalparameter_set_delegatedto(icalparameter* param, const char* v)
+{
+ icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv( (param!=0), "param");
+ icalerror_clear_errno();
+
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
}
-void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v)
+/* CN */
+icalparameter* icalparameter_new_cn(const char* v)
{
- icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v");
- icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v");
+ struct icalparameter_impl *impl;
+ icalerror_clear_errno();
+ icalerror_check_arg_rz( (v!=0),"v");
+ impl = icalparameter_new_impl(ICAL_CN_PARAMETER);
+ if (impl == 0) {
+ return 0;
+ }
+
+ icalparameter_set_cn((icalparameter*) impl,v);
+ if (icalerrno != ICAL_NO_ERROR) {
+ icalparameter_free((icalparameter*) impl);
+ return 0;
+ }
+
+ return (icalparameter*) impl;
+}
+
+const char* icalparameter_get_cn(const icalparameter* param)
+{
+ icalerror_clear_errno();
+ icalerror_check_arg_rz( (param!=0), "param");
+ return param->string;
+}
+
+void icalparameter_set_cn(icalparameter* param, const char* v)
+{
+ icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -551,7 +481,7 @@ void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v)
- ((struct icalparameter_impl*)param)->data = (int)v;
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
}
-/* RELTYPE */
-icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
+/* VALUE */
+icalparameter* icalparameter_new_value(icalparameter_value v)
{
@@ -559,5 +489,5 @@ icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v");
- icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER);
if (impl == 0) {
@@ -566,3 +496,3 @@ icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
- icalparameter_set_reltype((icalparameter*) impl,v);
+ icalparameter_set_value((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -575,3 +505,3 @@ icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
-icalparameter_reltype icalparameter_get_reltype(icalparameter* param)
+icalparameter_value icalparameter_get_value(const icalparameter* param)
{
@@ -579,13 +509,13 @@ icalparameter_reltype icalparameter_get_reltype(icalparameter* param)
icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_RELTYPE_X;
+ if (param->string != 0){
+ return ICAL_VALUE_X;
}
-return (icalparameter_reltype)((struct icalparameter_impl*)param)->data;
+return (icalparameter_value)(param->data);
}
-void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v)
+void icalparameter_set_value(icalparameter* param, icalparameter_value v)
{
- icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v");
- icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -596,4 +526,4 @@ void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v)
-/* CUTYPE */
-icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
+/* X-LIC-COMPARETYPE */
+icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v)
{
@@ -601,5 +531,5 @@ icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v");
- icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER);
if (impl == 0) {
@@ -608,3 +538,3 @@ icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
- icalparameter_set_cutype((icalparameter*) impl,v);
+ icalparameter_set_xliccomparetype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -617,3 +547,3 @@ icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
-icalparameter_cutype icalparameter_get_cutype(icalparameter* param)
+icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* param)
{
@@ -621,13 +551,10 @@ icalparameter_cutype icalparameter_get_cutype(icalparameter* param)
icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_CUTYPE_X;
- }
-return (icalparameter_cutype)((struct icalparameter_impl*)param)->data;
+return (icalparameter_xliccomparetype)(param->data);
}
-void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v)
+void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v)
{
- icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v");
- icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -638,4 +565,4 @@ void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v)
-/* MEMBER */
-icalparameter* icalparameter_new_member(const char* v)
+/* X */
+icalparameter* icalparameter_new_x(const char* v)
{
@@ -644,3 +571,3 @@ icalparameter* icalparameter_new_member(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_X_PARAMETER);
if (impl == 0) {
@@ -649,3 +576,3 @@ icalparameter* icalparameter_new_member(const char* v)
- icalparameter_set_member((icalparameter*) impl,v);
+ icalparameter_set_x((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -658,3 +585,3 @@ icalparameter* icalparameter_new_member(const char* v)
-const char* icalparameter_get_member(icalparameter* param)
+const char* icalparameter_get_x(const icalparameter* param)
{
@@ -662,6 +589,6 @@ const char* icalparameter_get_member(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_member(icalparameter* param, const char* v)
+void icalparameter_set_x(icalparameter* param, const char* v)
{
@@ -674,4 +601,4 @@ void icalparameter_set_member(icalparameter* param, const char* v)
-/* FMTTYPE */
-icalparameter* icalparameter_new_fmttype(const char* v)
+/* SENT-BY */
+icalparameter* icalparameter_new_sentby(const char* v)
{
@@ -680,3 +607,3 @@ icalparameter* icalparameter_new_fmttype(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER);
if (impl == 0) {
@@ -685,3 +612,3 @@ icalparameter* icalparameter_new_fmttype(const char* v)
- icalparameter_set_fmttype((icalparameter*) impl,v);
+ icalparameter_set_sentby((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -694,3 +621,3 @@ icalparameter* icalparameter_new_fmttype(const char* v)
-const char* icalparameter_get_fmttype(icalparameter* param)
+const char* icalparameter_get_sentby(const icalparameter* param)
{
@@ -698,6 +625,6 @@ const char* icalparameter_get_fmttype(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_fmttype(icalparameter* param, const char* v)
+void icalparameter_set_sentby(icalparameter* param, const char* v)
{
@@ -710,4 +637,4 @@ void icalparameter_set_fmttype(icalparameter* param, const char* v)
-/* SENT-BY */
-icalparameter* icalparameter_new_sentby(const char* v)
+/* MEMBER */
+icalparameter* icalparameter_new_member(const char* v)
{
@@ -716,3 +643,3 @@ icalparameter* icalparameter_new_sentby(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER);
if (impl == 0) {
@@ -721,3 +648,3 @@ icalparameter* icalparameter_new_sentby(const char* v)
- icalparameter_set_sentby((icalparameter*) impl,v);
+ icalparameter_set_member((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -730,3 +657,3 @@ icalparameter* icalparameter_new_sentby(const char* v)
-const char* icalparameter_get_sentby(icalparameter* param)
+const char* icalparameter_get_member(const icalparameter* param)
{
@@ -734,6 +661,6 @@ const char* icalparameter_get_sentby(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_sentby(icalparameter* param, const char* v)
+void icalparameter_set_member(icalparameter* param, const char* v)
{
@@ -746,4 +673,4 @@ void icalparameter_set_sentby(icalparameter* param, const char* v)
-/* VALUE */
-icalparameter* icalparameter_new_value(icalparameter_value v)
+/* RSVP */
+icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
{
@@ -751,5 +678,5 @@ icalparameter* icalparameter_new_value(icalparameter_value v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v");
- icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v");
+ icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER);
if (impl == 0) {
@@ -758,3 +685,3 @@ icalparameter* icalparameter_new_value(icalparameter_value v)
- icalparameter_set_value((icalparameter*) impl,v);
+ icalparameter_set_rsvp((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -767,3 +694,3 @@ icalparameter* icalparameter_new_value(icalparameter_value v)
-icalparameter_value icalparameter_get_value(icalparameter* param)
+icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* param)
{
@@ -771,13 +698,10 @@ icalparameter_value icalparameter_get_value(icalparameter* param)
icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_VALUE_X;
- }
-return (icalparameter_value)((struct icalparameter_impl*)param)->data;
+return (icalparameter_rsvp)(param->data);
}
-void icalparameter_set_value(icalparameter* param, icalparameter_value v)
+void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v)
{
- icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v");
- icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v");
+ icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -788,4 +712,4 @@ void icalparameter_set_value(icalparameter* param, icalparameter_value v)
-/* ALTREP */
-icalparameter* icalparameter_new_altrep(const char* v)
+/* CUTYPE */
+icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
{
@@ -793,4 +717,5 @@ icalparameter* icalparameter_new_altrep(const char* v)
icalerror_clear_errno();
- icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER);
if (impl == 0) {
@@ -799,3 +724,3 @@ icalparameter* icalparameter_new_altrep(const char* v)
- icalparameter_set_altrep((icalparameter*) impl,v);
+ icalparameter_set_cutype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -808,12 +733,17 @@ icalparameter* icalparameter_new_altrep(const char* v)
-const char* icalparameter_get_altrep(icalparameter* param)
+icalparameter_cutype icalparameter_get_cutype(const icalparameter* param)
{
icalerror_clear_errno();
- icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+icalerror_check_arg( (param!=0), "param");
+ if (param->string != 0){
+ return ICAL_CUTYPE_X;
+ }
+
+return (icalparameter_cutype)(param->data);
}
-void icalparameter_set_altrep(icalparameter* param, const char* v)
+void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v)
{
- icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -821,7 +751,7 @@ void icalparameter_set_altrep(icalparameter* param, const char* v)
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
+ ((struct icalparameter_impl*)param)->data = (int)v;
}
-/* DIR */
-icalparameter* icalparameter_new_dir(const char* v)
+/* X-LIC-ERRORTYPE */
+icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
{
@@ -829,4 +759,5 @@ icalparameter* icalparameter_new_dir(const char* v)
icalerror_clear_errno();
- icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_DIR_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER);
if (impl == 0) {
@@ -835,3 +766,3 @@ icalparameter* icalparameter_new_dir(const char* v)
- icalparameter_set_dir((icalparameter*) impl,v);
+ icalparameter_set_xlicerrortype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -844,12 +775,14 @@ icalparameter* icalparameter_new_dir(const char* v)
-const char* icalparameter_get_dir(icalparameter* param)
+icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* param)
{
icalerror_clear_errno();
- icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+icalerror_check_arg( (param!=0), "param");
+
+return (icalparameter_xlicerrortype)(param->data);
}
-void icalparameter_set_dir(icalparameter* param, const char* v)
+void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v)
{
- icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -857,3 +790,3 @@ void icalparameter_set_dir(icalparameter* param, const char* v)
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
+ ((struct icalparameter_impl*)param)->data = (int)v;
}
@@ -881,3 +814,3 @@ icalparameter* icalparameter_new_related(icalparameter_related v)
-icalparameter_related icalparameter_get_related(icalparameter* param)
+icalparameter_related icalparameter_get_related(const icalparameter* param)
{
@@ -886,3 +819,3 @@ icalerror_check_arg( (param!=0), "param");
-return (icalparameter_related)((struct icalparameter_impl*)param)->data;
+return (icalparameter_related)(param->data);
}
@@ -899,4 +832,4 @@ void icalparameter_set_related(icalparameter* param, icalparameter_related v)
-/* CN */
-icalparameter* icalparameter_new_cn(const char* v)
+/* ENCODING */
+icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
{
@@ -904,4 +837,5 @@ icalparameter* icalparameter_new_cn(const char* v)
icalerror_clear_errno();
- icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_CN_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v");
+ icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER);
if (impl == 0) {
@@ -910,3 +844,3 @@ icalparameter* icalparameter_new_cn(const char* v)
- icalparameter_set_cn((icalparameter*) impl,v);
+ icalparameter_set_encoding((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -919,12 +853,17 @@ icalparameter* icalparameter_new_cn(const char* v)
-const char* icalparameter_get_cn(icalparameter* param)
+icalparameter_encoding icalparameter_get_encoding(const icalparameter* param)
{
icalerror_clear_errno();
- icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+icalerror_check_arg( (param!=0), "param");
+ if (param->string != 0){
+ return ICAL_ENCODING_X;
+ }
+
+return (icalparameter_encoding)(param->data);
}
-void icalparameter_set_cn(icalparameter* param, const char* v)
+void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v)
{
- icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v");
+ icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -932,7 +871,7 @@ void icalparameter_set_cn(icalparameter* param, const char* v)
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
+ ((struct icalparameter_impl*)param)->data = (int)v;
}
-/* X-LIC-ERRORTYPE */
-icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
+/* ALTREP */
+icalparameter* icalparameter_new_altrep(const char* v)
{
@@ -940,5 +879,4 @@ icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v");
- icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER);
+ icalerror_check_arg_rz( (v!=0),"v");
+ impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER);
if (impl == 0) {
@@ -947,3 +885,3 @@ icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
- icalparameter_set_xlicerrortype((icalparameter*) impl,v);
+ icalparameter_set_altrep((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -956,14 +894,12 @@ icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
-icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* param)
+const char* icalparameter_get_altrep(const icalparameter* param)
{
icalerror_clear_errno();
-icalerror_check_arg( (param!=0), "param");
-
-return (icalparameter_xlicerrortype)((struct icalparameter_impl*)param)->data;
+ icalerror_check_arg_rz( (param!=0), "param");
+ return param->string;
}
-void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v)
+void icalparameter_set_altrep(icalparameter* param, const char* v)
{
- icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v");
- icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v");
+ icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -971,7 +907,7 @@ void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerr
- ((struct icalparameter_impl*)param)->data = (int)v;
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
}
-/* X */
-icalparameter* icalparameter_new_x(const char* v)
+/* DELEGATED-FROM */
+icalparameter* icalparameter_new_delegatedfrom(const char* v)
{
@@ -980,3 +916,3 @@ icalparameter* icalparameter_new_x(const char* v)
icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_X_PARAMETER);
+ impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER);
if (impl == 0) {
@@ -985,3 +921,3 @@ icalparameter* icalparameter_new_x(const char* v)
- icalparameter_set_x((icalparameter*) impl,v);
+ icalparameter_set_delegatedfrom((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -994,3 +930,3 @@ icalparameter* icalparameter_new_x(const char* v)
-const char* icalparameter_get_x(icalparameter* param)
+const char* icalparameter_get_delegatedfrom(const icalparameter* param)
{
@@ -998,6 +934,6 @@ const char* icalparameter_get_x(icalparameter* param)
icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ return param->string;
}
-void icalparameter_set_x(icalparameter* param, const char* v)
+void icalparameter_set_delegatedfrom(icalparameter* param, const char* v)
{
@@ -1010,4 +946,4 @@ void icalparameter_set_x(icalparameter* param, const char* v)
-/* LANGUAGE */
-icalparameter* icalparameter_new_language(const char* v)
+/* FBTYPE */
+icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v)
{
@@ -1015,4 +951,5 @@ icalparameter* icalparameter_new_language(const char* v)
icalerror_clear_errno();
- icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v");
+ icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER);
if (impl == 0) {
@@ -1021,3 +958,3 @@ icalparameter* icalparameter_new_language(const char* v)
- icalparameter_set_language((icalparameter*) impl,v);
+ icalparameter_set_fbtype((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -1030,12 +967,17 @@ icalparameter* icalparameter_new_language(const char* v)
-const char* icalparameter_get_language(icalparameter* param)
+icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* param)
{
icalerror_clear_errno();
- icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+icalerror_check_arg( (param!=0), "param");
+ if (param->string != 0){
+ return ICAL_FBTYPE_X;
+ }
+
+return (icalparameter_fbtype)(param->data);
}
-void icalparameter_set_language(icalparameter* param, const char* v)
+void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v)
{
- icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v");
+ icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -1043,3 +985,3 @@ void icalparameter_set_language(icalparameter* param, const char* v)
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
+ ((struct icalparameter_impl*)param)->data = (int)v;
}
@@ -1067,3 +1009,3 @@ icalparameter* icalparameter_new_role(icalparameter_role v)
-icalparameter_role icalparameter_get_role(icalparameter* param)
+icalparameter_role icalparameter_get_role(const icalparameter* param)
{
@@ -1071,3 +1013,3 @@ icalparameter_role icalparameter_get_role(icalparameter* param)
icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
+ if (param->string != 0){
return ICAL_ROLE_X;
@@ -1075,3 +1017,3 @@ icalerror_check_arg( (param!=0), "param");
-return (icalparameter_role)((struct icalparameter_impl*)param)->data;
+return (icalparameter_role)(param->data);
}
@@ -1088,4 +1030,4 @@ void icalparameter_set_role(icalparameter* param, icalparameter_role v)
-/* X-LIC-COMPARETYPE */
-icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v)
+/* PARTSTAT */
+icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
{
@@ -1093,5 +1035,5 @@ icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v
icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v");
- icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER);
+ icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v");
+ icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v");
+ impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER);
if (impl == 0) {
@@ -1100,3 +1042,3 @@ icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v
- icalparameter_set_xliccomparetype((icalparameter*) impl,v);
+ icalparameter_set_partstat((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
@@ -1109,3 +1051,3 @@ icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v
-icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* param)
+icalparameter_partstat icalparameter_get_partstat(const icalparameter* param)
{
@@ -1113,10 +1055,13 @@ icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* p
icalerror_check_arg( (param!=0), "param");
+ if (param->string != 0){
+ return ICAL_PARTSTAT_X;
+ }
-return (icalparameter_xliccomparetype)((struct icalparameter_impl*)param)->data;
+return (icalparameter_partstat)(param->data);
}
-void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v)
+void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v)
{
- icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v");
- icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v");
+ icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v");
+ icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v");
icalerror_check_arg_rv( (param!=0), "param");
@@ -1127,79 +1072,131 @@ void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xlicc
-/* FBTYPE */
-icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v)
+
+const char* icalparameter_kind_to_string(icalparameter_kind kind)
{
- struct icalparameter_impl *impl;
- icalerror_clear_errno();
- icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v");
- icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v");
- impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER);
- if (impl == 0) {
- return 0;
- }
+ int i;
- icalparameter_set_fbtype((icalparameter*) impl,v);
- if (icalerrno != ICAL_NO_ERROR) {
- icalparameter_free((icalparameter*) impl);
- return 0;
- }
+ for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
+ if (parameter_map[i].kind == kind) {
+ return parameter_map[i].name;
+ }
+ }
+
+ return 0;
- return (icalparameter*) impl;
}
-icalparameter_fbtype icalparameter_get_fbtype(icalparameter* param)
+icalparameter_kind icalparameter_string_to_kind(const char* string)
{
- icalerror_clear_errno();
-icalerror_check_arg( (param!=0), "param");
- if ( ((struct icalparameter_impl*)param)->string != 0){
- return ICAL_FBTYPE_X;
- }
+ int i;
+
+ if (string ==0 ) {
+ return ICAL_NO_PARAMETER;
+ }
+
+ for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
+
+ if (strcmp(parameter_map[i].name, string) == 0) {
+ return parameter_map[i].kind;
+ }
+ }
-return (icalparameter_fbtype)((struct icalparameter_impl*)param)->data;
+ if(strncmp(string,"X-",2)==0){
+ return ICAL_X_PARAMETER;
+ }
+
+ return ICAL_NO_PARAMETER;
}
-void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v)
+
+icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
{
- icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v");
- icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v");
- icalerror_check_arg_rv( (param!=0), "param");
- icalerror_clear_errno();
-
- ((struct icalparameter_impl*)param)->data = (int)v;
+ int i;
+
+ for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) {
+
+ if (value_kind_map[i].value == value) {
+ return value_kind_map[i].kind;
+ }
+ }
+
+ return ICAL_NO_VALUE;
}
-/* TZID */
-icalparameter* icalparameter_new_tzid(const char* v)
+
+const char* icalparameter_enum_to_string(int e)
{
- struct icalparameter_impl *impl;
- icalerror_clear_errno();
- icalerror_check_arg_rz( (v!=0),"v");
- impl = icalparameter_new_impl(ICAL_TZID_PARAMETER);
- if (impl == 0) {
- return 0;
- }
+ int i;
- icalparameter_set_tzid((icalparameter*) impl,v);
- if (icalerrno != ICAL_NO_ERROR) {
- icalparameter_free((icalparameter*) impl);
- return 0;
- }
+ icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e");
+ icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e");
- return (icalparameter*) impl;
+ for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
+ if(e == icalparameter_map[i].enumeration){
+ return icalparameter_map[i].str;
+ }
+ }
+
+ return 0;
}
-const char* icalparameter_get_tzid(icalparameter* param)
+int icalparameter_string_to_enum(const char* str)
{
- icalerror_clear_errno();
- icalerror_check_arg_rz( (param!=0), "param");
- return (const char*)((struct icalparameter_impl*)param)->string;
+ int i;
+
+ icalerror_check_arg_rz(str != 0,"str");
+
+ for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
+ if(strcmp(str,icalparameter_map[i].str) == 0) {
+ return icalparameter_map[i].enumeration;
+ }
+ }
+
+ return 0;
}
-void icalparameter_set_tzid(icalparameter* param, const char* v)
+icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val)
{
- icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_arg_rv( (param!=0), "param");
- icalerror_clear_errno();
-
- ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
+
+ struct icalparameter_impl* param=0;
+ int found_kind = 0;
+ int i;
+
+ icalerror_check_arg_rz((val!=0),"val");
+
+ /* Search through the parameter map to find a matching kind */
+
+ param = icalparameter_new_impl(kind);
+
+ for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
+ if(kind == icalparameter_map[i].kind) {
+ found_kind = 1;
+ if(strcmp(val,icalparameter_map[i].str) == 0) {
+
+ param->data = (int)icalparameter_map[i].enumeration;
+ return param;
+ }
+ }
+ }
+
+ if(found_kind == 1){
+ /* The kind was in the parameter map, but the string did not
+ match, so assume that it is an alternate value, like an
+ X-value.*/
+
+ icalparameter_set_xvalue(param, val);
+
+ } else {
+
+ /* If the kind was not found, then it must be a string type */
+
+ ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val);
+
+ }
+
+ return param;
}
+
+
+
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalderivedparameter.h b/libical/src/libical/icalderivedparameter.h
index adf4724..cbf0035 100644
--- a/libical/src/libical/icalderivedparameter.h
+++ b/libical/src/libical/icalderivedparameter.h
@@ -32,3 +32,3 @@
-typedef void icalparameter;
+typedef struct icalparameter_impl icalparameter;
@@ -37,3 +37,2 @@ int icalparameter_string_to_enum(const char* str);
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalparameter_kind {
@@ -116,3 +115,3 @@ typedef enum icalparameter_related {
ICAL_RELATED_START = 20031,
- ICAL_RELATED_END = 20032,
+ ICAL_RELATED_END = 20032,
ICAL_RELATED_NONE = 20033
@@ -172,3 +171,5 @@ typedef enum icalparameter_xliccomparetype {
ICAL_XLICCOMPARETYPE_REGEX = 20072,
- ICAL_XLICCOMPARETYPE_NONE = 20073
+ ICAL_XLICCOMPARETYPE_ISNULL = 20073,
+ ICAL_XLICCOMPARETYPE_ISNOTNULL = 20074,
+ ICAL_XLICCOMPARETYPE_NONE = 20075
} icalparameter_xliccomparetype;
@@ -176,45 +177,26 @@ typedef enum icalparameter_xliccomparetype {
typedef enum icalparameter_xlicerrortype {
- ICAL_XLICERRORTYPE_X = 20074,
- ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075,
- ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076,
- ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077,
- ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078,
- ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079,
- ICAL_XLICERRORTYPE_INVALIDITIP = 20080,
- ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081,
- ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082,
- ICAL_XLICERRORTYPE_NONE = 20083
+ ICAL_XLICERRORTYPE_X = 20076,
+ ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20077,
+ ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20078,
+ ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20079,
+ ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20080,
+ ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20081,
+ ICAL_XLICERRORTYPE_INVALIDITIP = 20082,
+ ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20083,
+ ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20084,
+ ICAL_XLICERRORTYPE_VCALPROPPARSEERROR = 20085,
+ ICAL_XLICERRORTYPE_NONE = 20086
} icalparameter_xlicerrortype;
-#define ICALPARAMETER_LAST_ENUM 20084
-
-/* DELEGATED-FROM */
-icalparameter* icalparameter_new_delegatedfrom(const char* v);
-const char* icalparameter_get_delegatedfrom(icalparameter* value);
-void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
-
-/* DELEGATED-TO */
-icalparameter* icalparameter_new_delegatedto(const char* v);
-const char* icalparameter_get_delegatedto(icalparameter* value);
-void icalparameter_set_delegatedto(icalparameter* value, const char* v);
-
-/* RANGE */
-icalparameter* icalparameter_new_range(icalparameter_range v);
-icalparameter_range icalparameter_get_range(icalparameter* value);
-void icalparameter_set_range(icalparameter* value, icalparameter_range v);
+#define ICALPARAMETER_LAST_ENUM 20087
-/* ENCODING */
-icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
-icalparameter_encoding icalparameter_get_encoding(icalparameter* value);
-void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
-
-/* RSVP */
-icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
-icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value);
-void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
+/* LANGUAGE */
+icalparameter* icalparameter_new_language(const char* v);
+const char* icalparameter_get_language(const icalparameter* value);
+void icalparameter_set_language(icalparameter* value, const char* v);
-/* PARTSTAT */
-icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
-icalparameter_partstat icalparameter_get_partstat(icalparameter* value);
-void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
+/* DIR */
+icalparameter* icalparameter_new_dir(const char* v);
+const char* icalparameter_get_dir(const icalparameter* value);
+void icalparameter_set_dir(icalparameter* value, const char* v);
@@ -222,24 +204,29 @@ void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
icalparameter* icalparameter_new_reltype(icalparameter_reltype v);
-icalparameter_reltype icalparameter_get_reltype(icalparameter* value);
+icalparameter_reltype icalparameter_get_reltype(const icalparameter* value);
void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v);
-/* CUTYPE */
-icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
-icalparameter_cutype icalparameter_get_cutype(icalparameter* value);
-void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
-
-/* MEMBER */
-icalparameter* icalparameter_new_member(const char* v);
-const char* icalparameter_get_member(icalparameter* value);
-void icalparameter_set_member(icalparameter* value, const char* v);
-
/* FMTTYPE */
icalparameter* icalparameter_new_fmttype(const char* v);
-const char* icalparameter_get_fmttype(icalparameter* value);
+const char* icalparameter_get_fmttype(const icalparameter* value);
void icalparameter_set_fmttype(icalparameter* value, const char* v);
-/* SENT-BY */
-icalparameter* icalparameter_new_sentby(const char* v);
-const char* icalparameter_get_sentby(icalparameter* value);
-void icalparameter_set_sentby(icalparameter* value, const char* v);
+/* TZID */
+icalparameter* icalparameter_new_tzid(const char* v);
+const char* icalparameter_get_tzid(const icalparameter* value);
+void icalparameter_set_tzid(icalparameter* value, const char* v);
+
+/* RANGE */
+icalparameter* icalparameter_new_range(icalparameter_range v);
+icalparameter_range icalparameter_get_range(const icalparameter* value);
+void icalparameter_set_range(icalparameter* value, icalparameter_range v);
+
+/* DELEGATED-TO */
+icalparameter* icalparameter_new_delegatedto(const char* v);
+const char* icalparameter_get_delegatedto(const icalparameter* value);
+void icalparameter_set_delegatedto(icalparameter* value, const char* v);
+
+/* CN */
+icalparameter* icalparameter_new_cn(const char* v);
+const char* icalparameter_get_cn(const icalparameter* value);
+void icalparameter_set_cn(icalparameter* value, const char* v);
@@ -247,24 +234,34 @@ void icalparameter_set_sentby(icalparameter* value, const char* v);
icalparameter* icalparameter_new_value(icalparameter_value v);
-icalparameter_value icalparameter_get_value(icalparameter* value);
+icalparameter_value icalparameter_get_value(const icalparameter* value);
void icalparameter_set_value(icalparameter* value, icalparameter_value v);
-/* ALTREP */
-icalparameter* icalparameter_new_altrep(const char* v);
-const char* icalparameter_get_altrep(icalparameter* value);
-void icalparameter_set_altrep(icalparameter* value, const char* v);
+/* X-LIC-COMPARETYPE */
+icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
+icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* value);
+void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
-/* DIR */
-icalparameter* icalparameter_new_dir(const char* v);
-const char* icalparameter_get_dir(icalparameter* value);
-void icalparameter_set_dir(icalparameter* value, const char* v);
+/* X */
+icalparameter* icalparameter_new_x(const char* v);
+const char* icalparameter_get_x(const icalparameter* value);
+void icalparameter_set_x(icalparameter* value, const char* v);
-/* RELATED */
-icalparameter* icalparameter_new_related(icalparameter_related v);
-icalparameter_related icalparameter_get_related(icalparameter* value);
-void icalparameter_set_related(icalparameter* value, icalparameter_related v);
+/* SENT-BY */
+icalparameter* icalparameter_new_sentby(const char* v);
+const char* icalparameter_get_sentby(const icalparameter* value);
+void icalparameter_set_sentby(icalparameter* value, const char* v);
-/* CN */
-icalparameter* icalparameter_new_cn(const char* v);
-const char* icalparameter_get_cn(icalparameter* value);
-void icalparameter_set_cn(icalparameter* value, const char* v);
+/* MEMBER */
+icalparameter* icalparameter_new_member(const char* v);
+const char* icalparameter_get_member(const icalparameter* value);
+void icalparameter_set_member(icalparameter* value, const char* v);
+
+/* RSVP */
+icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
+icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* value);
+void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
+
+/* CUTYPE */
+icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
+icalparameter_cutype icalparameter_get_cutype(const icalparameter* value);
+void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
@@ -272,24 +269,24 @@ void icalparameter_set_cn(icalparameter* value, const char* v);
icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v);
-icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value);
+icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* value);
void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v);
-/* X */
-icalparameter* icalparameter_new_x(const char* v);
-const char* icalparameter_get_x(icalparameter* value);
-void icalparameter_set_x(icalparameter* value, const char* v);
+/* RELATED */
+icalparameter* icalparameter_new_related(icalparameter_related v);
+icalparameter_related icalparameter_get_related(const icalparameter* value);
+void icalparameter_set_related(icalparameter* value, icalparameter_related v);
-/* LANGUAGE */
-icalparameter* icalparameter_new_language(const char* v);
-const char* icalparameter_get_language(icalparameter* value);
-void icalparameter_set_language(icalparameter* value, const char* v);
+/* ENCODING */
+icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
+icalparameter_encoding icalparameter_get_encoding(const icalparameter* value);
+void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
-/* ROLE */
-icalparameter* icalparameter_new_role(icalparameter_role v);
-icalparameter_role icalparameter_get_role(icalparameter* value);
-void icalparameter_set_role(icalparameter* value, icalparameter_role v);
+/* ALTREP */
+icalparameter* icalparameter_new_altrep(const char* v);
+const char* icalparameter_get_altrep(const icalparameter* value);
+void icalparameter_set_altrep(icalparameter* value, const char* v);
-/* X-LIC-COMPARETYPE */
-icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
-icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value);
-void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
+/* DELEGATED-FROM */
+icalparameter* icalparameter_new_delegatedfrom(const char* v);
+const char* icalparameter_get_delegatedfrom(const icalparameter* value);
+void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
@@ -297,9 +294,14 @@ void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xlicc
icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v);
-icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value);
+icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* value);
void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v);
-/* TZID */
-icalparameter* icalparameter_new_tzid(const char* v);
-const char* icalparameter_get_tzid(icalparameter* value);
-void icalparameter_set_tzid(icalparameter* value, const char* v);
+/* ROLE */
+icalparameter* icalparameter_new_role(icalparameter_role v);
+icalparameter_role icalparameter_get_role(const icalparameter* value);
+void icalparameter_set_role(icalparameter* value, icalparameter_role v);
+
+/* PARTSTAT */
+icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
+icalparameter_partstat icalparameter_get_partstat(const icalparameter* value);
+void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
@@ -307 +309,2 @@ void icalparameter_set_tzid(icalparameter* value, const char* v);
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalderivedproperty.c b/libical/src/libical/icalderivedproperty.c
index b41562b..362bfbe 100644
--- a/libical/src/libical/icalderivedproperty.c
+++ b/libical/src/libical/icalderivedproperty.c
@@ -45,6 +45,5 @@
-#define TMP_BUF_SIZE 1024
-
struct icalproperty_impl*
icalproperty_new_impl (icalproperty_kind kind);
+void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
@@ -61,72 +60,2 @@ struct icalproperty_map {
-extern struct icalproperty_map property_map[];
-extern void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
-const char* icalproperty_kind_to_string(icalproperty_kind kind)
-{
- int i;
-
- for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
- if (property_map[i].kind == kind) {
- return property_map[i].name;
- }
- }
-
- return 0;
-
-}
-
-
-icalproperty_kind icalproperty_string_to_kind(const char* string)
-{
- int i;
-
- if (string ==0 ) {
- return ICAL_NO_PROPERTY;
- }
-
-
- for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
- if (strcmp(property_map[i].name, string) == 0) {
- return property_map[i].kind;
- }
- }
-
- if(strncmp(string,"X-",2)==0){
- return ICAL_X_PROPERTY;
- }
-
-
- return ICAL_NO_PROPERTY;
-}
-
-
-icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
-{
- int i;
-
- for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
- if ( property_map[i].value == kind ) {
- return property_map[i].kind;
- }
- }
-
- return ICAL_NO_VALUE;
-}
-
-
-
-icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind)
-{
- int i;
-
- for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
- if ( property_map[i].kind == kind ) {
- return property_map[i].value;
- }
- }
-
- return ICAL_NO_VALUE;
-}
-
-
/* This map associates the property enumerations with the king of
@@ -141,113 +70,6 @@ struct icalproperty_enum_map {
-extern struct icalproperty_enum_map enum_map[];
-
-
-const char* icalproperty_enum_to_string(int e)
-{
- icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e");
- icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e");
-
- return enum_map[e-ICALPROPERTY_FIRST_ENUM].str;
-}
-
-int icalproperty_string_to_enum(const char* str)
-{
- int i;
-
- icalerror_check_arg_rz(str!=0,"str")
-
- while(*str == ' '){
- str++;
- }
-
- for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
- if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
- return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
- }
- }
-
- return 0;
-}
-
-int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e)
-{
- int i;
-
-
- for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
- if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e &&
- enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){
- return 1;
- }
- }
-
- return 0;
-}
-
-
-const char* icalproperty_method_to_string(icalproperty_method method)
-{
- icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method");
- icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method");
-
- return enum_map[method-ICALPROPERTY_FIRST_ENUM].str;
-}
-
-icalproperty_method icalproperty_string_to_method(const char* str)
-{
- int i;
-
- icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE)
-
- while(*str == ' '){
- str++;
- }
-
- for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM;
- i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM;
- i++) {
- if ( strcmp(enum_map[i].str, str) == 0) {
- return (icalproperty_method)enum_map[i].prop_enum;
- }
- }
-
- return ICAL_METHOD_NONE;
-}
-
-
-const char* icalenum_status_to_string(icalproperty_status status)
-{
- icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status");
- icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status");
-
- return enum_map[status-ICALPROPERTY_FIRST_ENUM].str;
-}
-
-icalproperty_status icalenum_string_to_status(const char* str)
-{
- int i;
-
- icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE)
-
- while(*str == ' '){
- str++;
- }
-
- for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM;
- i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM;
- i++) {
- if ( strcmp(enum_map[i].str, str) == 0) {
- return (icalproperty_method)enum_map[i].prop_enum;
- }
- }
-
- return ICAL_STATUS_NONE;
-
-}
-
-
-/* Everything below this line is machine generated. Do not edit. */
-static struct icalproperty_map property_map[] = {
+static struct icalproperty_map property_map[77] = {
{ICAL_ACTION_PROPERTY,"ACTION",ICAL_ACTION_VALUE},
+{ICAL_ALLOWCONFLICT_PROPERTY,"ALLOW-CONFLICT",ICAL_TEXT_VALUE},
{ICAL_ANY_PROPERTY,"ANY",ICAL_NO_VALUE},
@@ -255,5 +77,8 @@ static struct icalproperty_map property_map[] = {
{ICAL_ATTENDEE_PROPERTY,"ATTENDEE",ICAL_CALADDRESS_VALUE},
+{ICAL_CALID_PROPERTY,"CALID",ICAL_TEXT_VALUE},
+{ICAL_CALMASTER_PROPERTY,"CALMASTER",ICAL_TEXT_VALUE},
{ICAL_CALSCALE_PROPERTY,"CALSCALE",ICAL_TEXT_VALUE},
+{ICAL_CARID_PROPERTY,"CARID",ICAL_TEXT_VALUE},
{ICAL_CATEGORIES_PROPERTY,"CATEGORIES",ICAL_TEXT_VALUE},
-{ICAL_CLASS_PROPERTY,"CLASS",ICAL_TEXT_VALUE},
+{ICAL_CLASS_PROPERTY,"CLASS",ICAL_CLASS_VALUE},
{ICAL_COMMENT_PROPERTY,"COMMENT",ICAL_TEXT_VALUE},
@@ -262,2 +87,6 @@ static struct icalproperty_map property_map[] = {
{ICAL_CREATED_PROPERTY,"CREATED",ICAL_DATETIME_VALUE},
+{ICAL_DECREED_PROPERTY,"DECREED",ICAL_TEXT_VALUE},
+{ICAL_DEFAULTCHARSET_PROPERTY,"DEFAULT-CHARSET",ICAL_TEXT_VALUE},
+{ICAL_DEFAULTLOCALE_PROPERTY,"DEFAULT-LOCALE",ICAL_TEXT_VALUE},
+{ICAL_DEFAULTTZID_PROPERTY,"DEFAULT-TZID",ICAL_TEXT_VALUE},
{ICAL_DESCRIPTION_PROPERTY,"DESCRIPTION",ICAL_TEXT_VALUE},
@@ -269,2 +98,3 @@ static struct icalproperty_map property_map[] = {
{ICAL_EXDATE_PROPERTY,"EXDATE",ICAL_DATETIME_VALUE},
+{ICAL_EXPAND_PROPERTY,"EXPAND",ICAL_INTEGER_VALUE},
{ICAL_EXRULE_PROPERTY,"EXRULE",ICAL_RECUR_VALUE},
@@ -278,2 +108,3 @@ static struct icalproperty_map property_map[] = {
{ICAL_ORGANIZER_PROPERTY,"ORGANIZER",ICAL_CALADDRESS_VALUE},
+{ICAL_OWNER_PROPERTY,"OWNER",ICAL_TEXT_VALUE},
{ICAL_PERCENTCOMPLETE_PROPERTY,"PERCENT-COMPLETE",ICAL_INTEGER_VALUE},
@@ -286,2 +117,3 @@ static struct icalproperty_map property_map[] = {
{ICAL_RELATEDTO_PROPERTY,"RELATED-TO",ICAL_TEXT_VALUE},
+{ICAL_RELCALID_PROPERTY,"RELCALID",ICAL_TEXT_VALUE},
{ICAL_REPEAT_PROPERTY,"REPEAT",ICAL_INTEGER_VALUE},
@@ -295,3 +127,3 @@ static struct icalproperty_map property_map[] = {
{ICAL_TARGET_PROPERTY,"TARGET",ICAL_CALADDRESS_VALUE},
-{ICAL_TRANSP_PROPERTY,"TRANSP",ICAL_TEXT_VALUE},
+{ICAL_TRANSP_PROPERTY,"TRANSP",ICAL_TRANSP_VALUE},
{ICAL_TRIGGER_PROPERTY,"TRIGGER",ICAL_TRIGGER_VALUE},
@@ -305,3 +137,4 @@ static struct icalproperty_map property_map[] = {
{ICAL_VERSION_PROPERTY,"VERSION",ICAL_TEXT_VALUE},
-{ICAL_X_PROPERTY,"X",ICAL_TEXT_VALUE},
+{ICAL_X_PROPERTY,"X",ICAL_X_VALUE},
+{ICAL_XLICCLASS_PROPERTY,"X-LIC-CLASS",ICAL_XLICCLASS_VALUE},
{ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT",ICAL_STRING_VALUE},
@@ -316,3 +149,3 @@ static struct icalproperty_map property_map[] = {
-static struct icalproperty_enum_map enum_map[] = {
+static struct icalproperty_enum_map enum_map[75] = {
{ICAL_ACTION_PROPERTY,ICAL_ACTION_X,"" }, /*10000*/
@@ -357,4 +190,35 @@ static struct icalproperty_enum_map enum_map[] = {
{ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUE,"OPAQUE" }, /*10039*/
- {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENT,"TRANSPARENT" }, /*10040*/
- {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_NONE,"" }, /*10041*/
+ {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUENOCONFLICT,"OPAQUE-NOCONFLICT" }, /*10040*/
+ {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENT,"TRANSPARENT" }, /*10041*/
+ {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENTNOCONFLICT,"TRANSPARENT-NOCONFLICT" }, /*10042*/
+ {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_NONE,"" }, /*10043*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_X,"" }, /*10044*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHNEW,"PUBLISH-NEW" }, /*10045*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHUPDATE,"PUBLISH-UPDATE" }, /*10046*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHFREEBUSY,"PUBLISH-FREEBUSY" }, /*10047*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTNEW,"REQUEST-NEW" }, /*10048*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTUPDATE,"REQUEST-UPDATE" }, /*10049*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTRESCHEDULE,"REQUEST-RESCHEDULE" }, /*10050*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTDELEGATE,"REQUEST-DELEGATE" }, /*10051*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTNEWORGANIZER,"REQUEST-NEW-ORGANIZER" }, /*10052*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTFORWARD,"REQUEST-FORWARD" }, /*10053*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTSTATUS,"REQUEST-STATUS" }, /*10054*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTFREEBUSY,"REQUEST-FREEBUSY" }, /*10055*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYACCEPT,"REPLY-ACCEPT" }, /*10056*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYDECLINE,"REPLY-DECLINE" }, /*10057*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYDELEGATE,"REPLY-DELEGATE" }, /*10058*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYCRASHERACCEPT,"REPLY-CRASHER-ACCEPT" }, /*10059*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYCRASHERDECLINE,"REPLY-CRASHER-DECLINE" }, /*10060*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_ADDINSTANCE,"ADD-INSTANCE" }, /*10061*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELEVENT,"CANCEL-EVENT" }, /*10062*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELINSTANCE,"CANCEL-INSTANCE" }, /*10063*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELALL,"CANCEL-ALL" }, /*10064*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REFRESH,"REFRESH" }, /*10065*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_COUNTER,"COUNTER" }, /*10066*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_DECLINECOUNTER,"DECLINECOUNTER" }, /*10067*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_MALFORMED,"MALFORMED" }, /*10068*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_OBSOLETE,"OBSOLETE" }, /*10069*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_MISSEQUENCED,"MISSEQUENCED" }, /*10070*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_UNKNOWN,"UNKNOWN" }, /*10071*/
+ {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_NONE,"" }, /*10072*/
{ICAL_NO_PROPERTY,0,""}
@@ -371,2 +235,3 @@ icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...){
}
+
/* ACTION */
@@ -383,3 +248,3 @@ void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v){
}
-enum icalproperty_action icalproperty_get_action(icalproperty* prop){
+enum icalproperty_action icalproperty_get_action(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -387,3 +252,32 @@ enum icalproperty_action icalproperty_get_action(icalproperty* prop){
}
-icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...){
+icalproperty* icalproperty_vanew_allowconflict(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_allowconflict((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* ALLOW-CONFLICT */
+icalproperty* icalproperty_new_allowconflict(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_allowconflict((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_allowconflict(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_allowconflict(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_attach(icalattach * v, ...){
va_list args;
@@ -397,4 +291,5 @@ icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...){
}
+
/* ATTACH */
-icalproperty* icalproperty_new_attach(struct icalattachtype* v) {
+icalproperty* icalproperty_new_attach(icalattach * v) {
struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
@@ -405,3 +300,3 @@ icalproperty* icalproperty_new_attach(struct icalattachtype* v) {
-void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v){
+void icalproperty_set_attach(icalproperty* prop, icalattach * v){
icalerror_check_arg_rv( (v!=0),"v");
@@ -411,3 +306,3 @@ void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v){
}
-struct icalattachtype* icalproperty_get_attach(icalproperty* prop){
+icalattach * icalproperty_get_attach(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -425,2 +320,3 @@ icalproperty* icalproperty_vanew_attendee(const char* v, ...){
}
+
/* ATTENDEE */
@@ -439,3 +335,3 @@ void icalproperty_set_attendee(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_attendee(icalproperty* prop){
+const char* icalproperty_get_attendee(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -443,2 +339,60 @@ const char* icalproperty_get_attendee(icalproperty* prop){
}
+icalproperty* icalproperty_vanew_calid(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_calid((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* CALID */
+icalproperty* icalproperty_new_calid(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_calid((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_calid(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_calid(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_calmaster(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_calmaster((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* CALMASTER */
+icalproperty* icalproperty_new_calmaster(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_calmaster((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_calmaster(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_calmaster(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
icalproperty* icalproperty_vanew_calscale(const char* v, ...){
@@ -453,2 +407,3 @@ icalproperty* icalproperty_vanew_calscale(const char* v, ...){
}
+
/* CALSCALE */
@@ -467,3 +422,32 @@ void icalproperty_set_calscale(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_calscale(icalproperty* prop){
+const char* icalproperty_get_calscale(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_carid(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_carid((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* CARID */
+icalproperty* icalproperty_new_carid(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_carid((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_carid(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_carid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -481,2 +465,3 @@ icalproperty* icalproperty_vanew_categories(const char* v, ...){
}
+
/* CATEGORIES */
@@ -495,3 +480,3 @@ void icalproperty_set_categories(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_categories(icalproperty* prop){
+const char* icalproperty_get_categories(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -499,6 +484,5 @@ const char* icalproperty_get_categories(icalproperty* prop){
}
-icalproperty* icalproperty_vanew_class(const char* v, ...){
+icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...){
va_list args;
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
-
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY);
icalproperty_set_class((icalproperty*)impl,v);
@@ -509,6 +493,6 @@ icalproperty* icalproperty_vanew_class(const char* v, ...){
}
-/* CLASS */
-icalproperty* icalproperty_new_class(const char* v) {
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+/* CLASS */
+icalproperty* icalproperty_new_class(enum icalproperty_class v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY);
icalproperty_set_class((icalproperty*)impl,v);
@@ -517,11 +501,10 @@ icalproperty* icalproperty_new_class(const char* v) {
-void icalproperty_set_class(icalproperty* prop, const char* v){
- icalerror_check_arg_rv( (v!=0),"v");
-
+void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v){
+
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_text(v));
+ icalproperty_set_value(prop,icalvalue_new_class(v));
}
-const char* icalproperty_get_class(icalproperty* prop){
+enum icalproperty_class icalproperty_get_class(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
- return icalvalue_get_text(icalproperty_get_value(prop));
+ return icalvalue_get_class(icalproperty_get_value(prop));
}
@@ -537,2 +520,3 @@ icalproperty* icalproperty_vanew_comment(const char* v, ...){
}
+
/* COMMENT */
@@ -551,3 +535,3 @@ void icalproperty_set_comment(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_comment(icalproperty* prop){
+const char* icalproperty_get_comment(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -564,2 +548,3 @@ icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...){
}
+
/* COMPLETED */
@@ -576,3 +561,3 @@ void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v){
}
-struct icaltimetype icalproperty_get_completed(icalproperty* prop){
+struct icaltimetype icalproperty_get_completed(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -590,2 +575,3 @@ icalproperty* icalproperty_vanew_contact(const char* v, ...){
}
+
/* CONTACT */
@@ -604,3 +590,3 @@ void icalproperty_set_contact(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_contact(icalproperty* prop){
+const char* icalproperty_get_contact(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -617,2 +603,3 @@ icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...){
}
+
/* CREATED */
@@ -629,3 +616,3 @@ void icalproperty_set_created(icalproperty* prop, struct icaltimetype v){
}
-struct icaltimetype icalproperty_get_created(icalproperty* prop){
+struct icaltimetype icalproperty_get_created(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -633,2 +620,118 @@ struct icaltimetype icalproperty_get_created(icalproperty* prop){
}
+icalproperty* icalproperty_vanew_decreed(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_decreed((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* DECREED */
+icalproperty* icalproperty_new_decreed(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_decreed((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_decreed(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_decreed(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaultcharset((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* DEFAULT-CHARSET */
+icalproperty* icalproperty_new_defaultcharset(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaultcharset((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_defaultcharset(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_defaultcharset(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaultlocale((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* DEFAULT-LOCALE */
+icalproperty* icalproperty_new_defaultlocale(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaultlocale((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_defaultlocale(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_defaultlocale(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaulttzid((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* DEFAULT-TZID */
+icalproperty* icalproperty_new_defaulttzid(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_defaulttzid((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_defaulttzid(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_defaulttzid(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
icalproperty* icalproperty_vanew_description(const char* v, ...){
@@ -643,2 +746,3 @@ icalproperty* icalproperty_vanew_description(const char* v, ...){
}
+
/* DESCRIPTION */
@@ -657,3 +761,3 @@ void icalproperty_set_description(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_description(icalproperty* prop){
+const char* icalproperty_get_description(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -670,2 +774,3 @@ icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...){
}
+
/* DTEND */
@@ -678,7 +783,12 @@ icalproperty* icalproperty_new_dtend(struct icaltimetype v) {
void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v){
+ icalvalue *value;
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_datetime(v));
+ if (v.is_date)
+ value = icalvalue_new_date(v);
+ else
+ value = icalvalue_new_datetime(v);
+ icalproperty_set_value(prop,value);
}
-struct icaltimetype icalproperty_get_dtend(icalproperty* prop){
+struct icaltimetype icalproperty_get_dtend(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -695,2 +805,3 @@ icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...){
}
+
/* DTSTAMP */
@@ -707,3 +818,3 @@ void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v){
}
-struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop){
+struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -720,2 +831,3 @@ icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...){
}
+
/* DTSTART */
@@ -728,7 +840,12 @@ icalproperty* icalproperty_new_dtstart(struct icaltimetype v) {
void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v){
+ icalvalue *value;
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_datetime(v));
+ if (v.is_date)
+ value = icalvalue_new_date(v);
+ else
+ value = icalvalue_new_datetime(v);
+ icalproperty_set_value(prop,value);
}
-struct icaltimetype icalproperty_get_dtstart(icalproperty* prop){
+struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -745,2 +862,3 @@ icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...){
}
+
/* DUE */
@@ -753,7 +871,12 @@ icalproperty* icalproperty_new_due(struct icaltimetype v) {
void icalproperty_set_due(icalproperty* prop, struct icaltimetype v){
+ icalvalue *value;
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_datetime(v));
+ if (v.is_date)
+ value = icalvalue_new_date(v);
+ else
+ value = icalvalue_new_datetime(v);
+ icalproperty_set_value(prop,value);
}
-struct icaltimetype icalproperty_get_due(icalproperty* prop){
+struct icaltimetype icalproperty_get_due(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -770,2 +893,3 @@ icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...){
}
+
/* DURATION */
@@ -782,3 +906,3 @@ void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v){
}
-struct icaldurationtype icalproperty_get_duration(icalproperty* prop){
+struct icaldurationtype icalproperty_get_duration(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -795,2 +919,3 @@ icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...){
}
+
/* EXDATE */
@@ -803,7 +928,12 @@ icalproperty* icalproperty_new_exdate(struct icaltimetype v) {
void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v){
+ icalvalue *value;
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_datetime(v));
+ if (v.is_date)
+ value = icalvalue_new_date(v);
+ else
+ value = icalvalue_new_datetime(v);
+ icalproperty_set_value(prop,value);
}
-struct icaltimetype icalproperty_get_exdate(icalproperty* prop){
+struct icaltimetype icalproperty_get_exdate(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -811,2 +941,28 @@ struct icaltimetype icalproperty_get_exdate(icalproperty* prop){
}
+icalproperty* icalproperty_vanew_expand(int v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXPAND_PROPERTY);
+ icalproperty_set_expand((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* EXPAND */
+icalproperty* icalproperty_new_expand(int v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXPAND_PROPERTY);
+ icalproperty_set_expand((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_expand(icalproperty* prop, int v){
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_integer(v));
+}
+int icalproperty_get_expand(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_integer(icalproperty_get_value(prop));
+}
icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){
@@ -820,2 +976,3 @@ icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){
}
+
/* EXRULE */
@@ -832,3 +989,3 @@ void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v){
}
-struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop){
+struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -845,2 +1002,3 @@ icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...){
}
+
/* FREEBUSY */
@@ -857,3 +1015,3 @@ void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v){
}
-struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop){
+struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -870,2 +1028,3 @@ icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...){
}
+
/* GEO */
@@ -882,3 +1041,3 @@ void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v){
}
-struct icalgeotype icalproperty_get_geo(icalproperty* prop){
+struct icalgeotype icalproperty_get_geo(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -895,2 +1054,3 @@ icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...){
}
+
/* LAST-MODIFIED */
@@ -907,3 +1067,3 @@ void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v){
}
-struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop){
+struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -921,2 +1081,3 @@ icalproperty* icalproperty_vanew_location(const char* v, ...){
}
+
/* LOCATION */
@@ -935,3 +1096,3 @@ void icalproperty_set_location(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_location(icalproperty* prop){
+const char* icalproperty_get_location(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -948,2 +1109,3 @@ icalproperty* icalproperty_vanew_maxresults(int v, ...){
}
+
/* MAXRESULTS */
@@ -960,3 +1122,3 @@ void icalproperty_set_maxresults(icalproperty* prop, int v){
}
-int icalproperty_get_maxresults(icalproperty* prop){
+int icalproperty_get_maxresults(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -973,2 +1135,3 @@ icalproperty* icalproperty_vanew_maxresultssize(int v, ...){
}
+
/* MAXRESULTSSIZE */
@@ -985,3 +1148,3 @@ void icalproperty_set_maxresultssize(icalproperty* prop, int v){
}
-int icalproperty_get_maxresultssize(icalproperty* prop){
+int icalproperty_get_maxresultssize(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -998,2 +1161,3 @@ icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...){
}
+
/* METHOD */
@@ -1010,3 +1174,3 @@ void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v){
}
-enum icalproperty_method icalproperty_get_method(icalproperty* prop){
+enum icalproperty_method icalproperty_get_method(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1024,2 +1188,3 @@ icalproperty* icalproperty_vanew_organizer(const char* v, ...){
}
+
/* ORGANIZER */
@@ -1038,3 +1203,3 @@ void icalproperty_set_organizer(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_organizer(icalproperty* prop){
+const char* icalproperty_get_organizer(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1042,2 +1207,31 @@ const char* icalproperty_get_organizer(icalproperty* prop){
}
+icalproperty* icalproperty_vanew_owner(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_owner((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* OWNER */
+icalproperty* icalproperty_new_owner(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_owner((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_owner(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_owner(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
icalproperty* icalproperty_vanew_percentcomplete(int v, ...){
@@ -1051,2 +1245,3 @@ icalproperty* icalproperty_vanew_percentcomplete(int v, ...){
}
+
/* PERCENT-COMPLETE */
@@ -1063,3 +1258,3 @@ void icalproperty_set_percentcomplete(icalproperty* prop, int v){
}
-int icalproperty_get_percentcomplete(icalproperty* prop){
+int icalproperty_get_percentcomplete(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1076,2 +1271,3 @@ icalproperty* icalproperty_vanew_priority(int v, ...){
}
+
/* PRIORITY */
@@ -1088,3 +1284,3 @@ void icalproperty_set_priority(icalproperty* prop, int v){
}
-int icalproperty_get_priority(icalproperty* prop){
+int icalproperty_get_priority(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1102,2 +1298,3 @@ icalproperty* icalproperty_vanew_prodid(const char* v, ...){
}
+
/* PRODID */
@@ -1116,3 +1313,3 @@ void icalproperty_set_prodid(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_prodid(icalproperty* prop){
+const char* icalproperty_get_prodid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1130,2 +1327,3 @@ icalproperty* icalproperty_vanew_query(const char* v, ...){
}
+
/* QUERY */
@@ -1144,3 +1342,3 @@ void icalproperty_set_query(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_query(icalproperty* prop){
+const char* icalproperty_get_query(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1158,2 +1356,3 @@ icalproperty* icalproperty_vanew_queryname(const char* v, ...){
}
+
/* QUERYNAME */
@@ -1172,3 +1371,3 @@ void icalproperty_set_queryname(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_queryname(icalproperty* prop){
+const char* icalproperty_get_queryname(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1185,2 +1384,3 @@ icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...){
}
+
/* RDATE */
@@ -1197,3 +1397,3 @@ void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v)
}
-struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop){
+struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1210,2 +1410,3 @@ icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...){
}
+
/* RECURRENCE-ID */
@@ -1218,7 +1419,12 @@ icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) {
void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v){
+ icalvalue *value;
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_datetime(v));
+ if (v.is_date)
+ value = icalvalue_new_date(v);
+ else
+ value = icalvalue_new_datetime(v);
+ icalproperty_set_value(prop,value);
}
-struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop){
+struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1236,2 +1442,3 @@ icalproperty* icalproperty_vanew_relatedto(const char* v, ...){
}
+
/* RELATED-TO */
@@ -1250,3 +1457,32 @@ void icalproperty_set_relatedto(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_relatedto(icalproperty* prop){
+const char* icalproperty_get_relatedto(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_text(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_relcalid(const char* v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_relcalid((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* RELCALID */
+icalproperty* icalproperty_new_relcalid(const char* v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+
+ icalproperty_set_relcalid((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_relcalid(icalproperty* prop, const char* v){
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_text(v));
+}
+const char* icalproperty_get_relcalid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1263,2 +1499,3 @@ icalproperty* icalproperty_vanew_repeat(int v, ...){
}
+
/* REPEAT */
@@ -1275,3 +1512,3 @@ void icalproperty_set_repeat(icalproperty* prop, int v){
}
-int icalproperty_get_repeat(icalproperty* prop){
+int icalproperty_get_repeat(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1288,2 +1525,3 @@ icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...){
}
+
/* REQUEST-STATUS */
@@ -1300,3 +1538,3 @@ void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v
}
-struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop){
+struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1314,2 +1552,3 @@ icalproperty* icalproperty_vanew_resources(const char* v, ...){
}
+
/* RESOURCES */
@@ -1328,3 +1567,3 @@ void icalproperty_set_resources(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_resources(icalproperty* prop){
+const char* icalproperty_get_resources(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1341,2 +1580,3 @@ icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...){
}
+
/* RRULE */
@@ -1353,3 +1593,3 @@ void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v){
}
-struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop){
+struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1367,2 +1607,3 @@ icalproperty* icalproperty_vanew_scope(const char* v, ...){
}
+
/* SCOPE */
@@ -1381,3 +1622,3 @@ void icalproperty_set_scope(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_scope(icalproperty* prop){
+const char* icalproperty_get_scope(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1394,2 +1635,3 @@ icalproperty* icalproperty_vanew_sequence(int v, ...){
}
+
/* SEQUENCE */
@@ -1406,3 +1648,3 @@ void icalproperty_set_sequence(icalproperty* prop, int v){
}
-int icalproperty_get_sequence(icalproperty* prop){
+int icalproperty_get_sequence(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1419,2 +1661,3 @@ icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...){
}
+
/* STATUS */
@@ -1431,3 +1674,3 @@ void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v){
}
-enum icalproperty_status icalproperty_get_status(icalproperty* prop){
+enum icalproperty_status icalproperty_get_status(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1445,2 +1688,3 @@ icalproperty* icalproperty_vanew_summary(const char* v, ...){
}
+
/* SUMMARY */
@@ -1459,3 +1703,3 @@ void icalproperty_set_summary(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_summary(icalproperty* prop){
+const char* icalproperty_get_summary(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1473,2 +1717,3 @@ icalproperty* icalproperty_vanew_target(const char* v, ...){
}
+
/* TARGET */
@@ -1487,3 +1732,3 @@ void icalproperty_set_target(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_target(icalproperty* prop){
+const char* icalproperty_get_target(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1491,6 +1736,5 @@ const char* icalproperty_get_target(icalproperty* prop){
}
-icalproperty* icalproperty_vanew_transp(const char* v, ...){
+icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...){
va_list args;
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
-
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY);
icalproperty_set_transp((icalproperty*)impl,v);
@@ -1501,6 +1745,6 @@ icalproperty* icalproperty_vanew_transp(const char* v, ...){
}
-/* TRANSP */
-icalproperty* icalproperty_new_transp(const char* v) {
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
+/* TRANSP */
+icalproperty* icalproperty_new_transp(enum icalproperty_transp v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY);
icalproperty_set_transp((icalproperty*)impl,v);
@@ -1509,11 +1753,10 @@ icalproperty* icalproperty_new_transp(const char* v) {
-void icalproperty_set_transp(icalproperty* prop, const char* v){
- icalerror_check_arg_rv( (v!=0),"v");
-
+void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v){
+
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_text(v));
+ icalproperty_set_value(prop,icalvalue_new_transp(v));
}
-const char* icalproperty_get_transp(icalproperty* prop){
+enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
- return icalvalue_get_text(icalproperty_get_value(prop));
+ return icalvalue_get_transp(icalproperty_get_value(prop));
}
@@ -1528,2 +1771,3 @@ icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...){
}
+
/* TRIGGER */
@@ -1540,3 +1784,3 @@ void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v){
}
-struct icaltriggertype icalproperty_get_trigger(icalproperty* prop){
+struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1554,2 +1798,3 @@ icalproperty* icalproperty_vanew_tzid(const char* v, ...){
}
+
/* TZID */
@@ -1568,3 +1813,3 @@ void icalproperty_set_tzid(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_tzid(icalproperty* prop){
+const char* icalproperty_get_tzid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1582,2 +1827,3 @@ icalproperty* icalproperty_vanew_tzname(const char* v, ...){
}
+
/* TZNAME */
@@ -1596,3 +1842,3 @@ void icalproperty_set_tzname(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_tzname(icalproperty* prop){
+const char* icalproperty_get_tzname(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1609,2 +1855,3 @@ icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...){
}
+
/* TZOFFSETFROM */
@@ -1621,3 +1868,3 @@ void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v){
}
-int icalproperty_get_tzoffsetfrom(icalproperty* prop){
+int icalproperty_get_tzoffsetfrom(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1634,2 +1881,3 @@ icalproperty* icalproperty_vanew_tzoffsetto(int v, ...){
}
+
/* TZOFFSETTO */
@@ -1646,3 +1894,3 @@ void icalproperty_set_tzoffsetto(icalproperty* prop, int v){
}
-int icalproperty_get_tzoffsetto(icalproperty* prop){
+int icalproperty_get_tzoffsetto(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1660,2 +1908,3 @@ icalproperty* icalproperty_vanew_tzurl(const char* v, ...){
}
+
/* TZURL */
@@ -1674,3 +1923,3 @@ void icalproperty_set_tzurl(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_tzurl(icalproperty* prop){
+const char* icalproperty_get_tzurl(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1688,2 +1937,3 @@ icalproperty* icalproperty_vanew_uid(const char* v, ...){
}
+
/* UID */
@@ -1702,3 +1952,3 @@ void icalproperty_set_uid(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_uid(icalproperty* prop){
+const char* icalproperty_get_uid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1716,2 +1966,3 @@ icalproperty* icalproperty_vanew_url(const char* v, ...){
}
+
/* URL */
@@ -1730,3 +1981,3 @@ void icalproperty_set_url(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_url(icalproperty* prop){
+const char* icalproperty_get_url(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1744,2 +1995,3 @@ icalproperty* icalproperty_vanew_version(const char* v, ...){
}
+
/* VERSION */
@@ -1758,3 +2010,3 @@ void icalproperty_set_version(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_version(icalproperty* prop){
+const char* icalproperty_get_version(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1772,2 +2024,3 @@ icalproperty* icalproperty_vanew_x(const char* v, ...){
}
+
/* X */
@@ -1784,7 +2037,33 @@ void icalproperty_set_x(icalproperty* prop, const char* v){
icalerror_check_arg_rv( (prop!=0),"prop");
- icalproperty_set_value(prop,icalvalue_new_text(v));
+ icalproperty_set_value(prop,icalvalue_new_x(v));
}
-const char* icalproperty_get_x(icalproperty* prop){
+const char* icalproperty_get_x(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
- return icalvalue_get_text(icalproperty_get_value(prop));
+ return icalvalue_get_x(icalproperty_get_value(prop));
+}
+icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...){
+ va_list args;
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLASS_PROPERTY);
+ icalproperty_set_xlicclass((icalproperty*)impl,v);
+ va_start(args,v);
+ icalproperty_add_parameters(impl, args);
+ va_end(args);
+ return (icalproperty*)impl;
+}
+
+/* X-LIC-CLASS */
+icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v) {
+ struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLASS_PROPERTY);
+ icalproperty_set_xlicclass((icalproperty*)impl,v);
+ return (icalproperty*)impl;
+}
+
+void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v){
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalproperty_set_value(prop,icalvalue_new_xlicclass(v));
+}
+enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop){
+ icalerror_check_arg( (prop!=0),"prop");
+ return icalvalue_get_xlicclass(icalproperty_get_value(prop));
}
@@ -1800,2 +2079,3 @@ icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){
}
+
/* X-LIC-CLUSTERCOUNT */
@@ -1814,3 +2094,3 @@ void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicclustercount(icalproperty* prop){
+const char* icalproperty_get_xlicclustercount(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1828,2 +2108,3 @@ icalproperty* icalproperty_vanew_xlicerror(const char* v, ...){
}
+
/* X-LIC-ERROR */
@@ -1842,3 +2123,3 @@ void icalproperty_set_xlicerror(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicerror(icalproperty* prop){
+const char* icalproperty_get_xlicerror(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1856,2 +2137,3 @@ icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...){
}
+
/* X-LIC-MIMECHARSET */
@@ -1870,3 +2152,3 @@ void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimecharset(icalproperty* prop){
+const char* icalproperty_get_xlicmimecharset(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1884,2 +2166,3 @@ icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...){
}
+
/* X-LIC-MIMECID */
@@ -1898,3 +2181,3 @@ void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimecid(icalproperty* prop){
+const char* icalproperty_get_xlicmimecid(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1912,2 +2195,3 @@ icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...){
}
+
/* X-LIC-MIMECONTENTTYPE */
@@ -1926,3 +2210,3 @@ void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop){
+const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1940,2 +2224,3 @@ icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...){
}
+
/* X-LIC-MIMEENCODING */
@@ -1954,3 +2239,3 @@ void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimeencoding(icalproperty* prop){
+const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1968,2 +2253,3 @@ icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...){
}
+
/* X-LIC-MIMEFILENAME */
@@ -1982,3 +2268,3 @@ void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimefilename(icalproperty* prop){
+const char* icalproperty_get_xlicmimefilename(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -1996,2 +2282,3 @@ icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...){
}
+
/* X-LIC-MIMEOPTINFO */
@@ -2010,3 +2297,3 @@ void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v){
}
-const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop){
+const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop){
icalerror_check_arg( (prop!=0),"prop");
@@ -2014 +2301,214 @@ const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop){
}
+
+int icalproperty_kind_is_valid(const icalproperty_kind kind)
+{
+ int i = 0;
+ do {
+ if (property_map[i].kind == kind)
+ return 1;
+ } while (property_map[i++].kind != ICAL_NO_PROPERTY);
+
+ return 0;
+}
+
+const char* icalproperty_kind_to_string(icalproperty_kind kind)
+{
+ int i;
+
+ for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
+ if (property_map[i].kind == kind) {
+ return property_map[i].name;
+ }
+ }
+
+ return 0;
+
+}
+
+
+icalproperty_kind icalproperty_string_to_kind(const char* string)
+{
+ int i;
+
+ if (string ==0 ) {
+ return ICAL_NO_PROPERTY;
+ }
+
+
+ for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
+ if (strcmp(property_map[i].name, string) == 0) {
+ return property_map[i].kind;
+ }
+ }
+
+ if(strncmp(string,"X-",2)==0){
+ return ICAL_X_PROPERTY;
+ }
+
+
+ return ICAL_NO_PROPERTY;
+}
+
+
+icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
+{
+ int i;
+
+ for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
+ if ( property_map[i].value == kind ) {
+ return property_map[i].kind;
+ }
+ }
+
+ return ICAL_NO_PROPERTY;
+}
+
+
+
+icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind)
+{
+ int i;
+
+ for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
+ if ( property_map[i].kind == kind ) {
+ return property_map[i].value;
+ }
+ }
+
+ return ICAL_NO_VALUE;
+}
+
+
+const char* icalproperty_enum_to_string(int e)
+{
+ icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e");
+ icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e");
+
+ return enum_map[e-ICALPROPERTY_FIRST_ENUM].str;
+}
+
+int icalproperty_kind_and_string_to_enum(const int kind, const char* str)
+{
+ icalproperty_kind pkind;
+ int i;
+
+ icalerror_check_arg_rz(str!=0,"str")
+
+ if ((pkind = icalproperty_value_kind_to_kind(kind)) == ICAL_NO_VALUE)
+ return 0;
+
+ while(*str == ' '){
+ str++;
+ }
+
+ for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
+ if (enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == pkind)
+ break;
+ }
+ if (i == ICALPROPERTY_LAST_ENUM)
+ return 0;
+
+ for (; i != ICALPROPERTY_LAST_ENUM; i++) {
+ if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
+ return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
+ }
+ }
+
+ return 0;
+}
+
+/** @deprecated please use icalproperty_kind_and_string_to_enum instead */
+int icalproperty_string_to_enum(const char* str)
+{
+ int i;
+
+ icalerror_check_arg_rz(str!=0,"str")
+
+ while(*str == ' '){
+ str++;
+ }
+
+ for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
+ if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
+ return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
+ }
+ }
+
+ return 0;
+}
+
+int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e)
+{
+ int i;
+
+
+ for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
+ if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e &&
+ enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+const char* icalproperty_method_to_string(icalproperty_method method)
+{
+ icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method");
+ icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method");
+
+ return enum_map[method-ICALPROPERTY_FIRST_ENUM].str;
+}
+
+icalproperty_method icalproperty_string_to_method(const char* str)
+{
+ int i;
+
+ icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE)
+
+ while(*str == ' '){
+ str++;
+ }
+
+ for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM;
+ i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM;
+ i++) {
+ if ( strcmp(enum_map[i].str, str) == 0) {
+ return (icalproperty_method)enum_map[i].prop_enum;
+ }
+ }
+
+ return ICAL_METHOD_NONE;
+}
+
+
+const char* icalenum_status_to_string(icalproperty_status status)
+{
+ icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status");
+ icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status");
+
+ return enum_map[status-ICALPROPERTY_FIRST_ENUM].str;
+}
+
+icalproperty_status icalenum_string_to_status(const char* str)
+{
+ int i;
+
+ icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE)
+
+ while(*str == ' '){
+ str++;
+ }
+
+ for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM;
+ i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM;
+ i++) {
+ if ( strcmp(enum_map[i].str, str) == 0) {
+ return (icalproperty_status)enum_map[i].prop_enum;
+ }
+ }
+
+ return ICAL_STATUS_NONE;
+
+}
diff --git a/libical/src/libical/icalderivedproperty.h b/libical/src/libical/icalderivedproperty.h
index 07e01b0..ae19c81 100644
--- a/libical/src/libical/icalderivedproperty.h
+++ b/libical/src/libical/icalderivedproperty.h
@@ -19,6 +19,4 @@
-typedef void icalproperty;
+typedef struct icalproperty_impl icalproperty;
-
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalproperty_kind {
@@ -26,5 +24,9 @@ typedef enum icalproperty_kind {
ICAL_ACTION_PROPERTY,
+ ICAL_ALLOWCONFLICT_PROPERTY,
ICAL_ATTACH_PROPERTY,
ICAL_ATTENDEE_PROPERTY,
+ ICAL_CALID_PROPERTY,
+ ICAL_CALMASTER_PROPERTY,
ICAL_CALSCALE_PROPERTY,
+ ICAL_CARID_PROPERTY,
ICAL_CATEGORIES_PROPERTY,
@@ -35,2 +37,6 @@ typedef enum icalproperty_kind {
ICAL_CREATED_PROPERTY,
+ ICAL_DECREED_PROPERTY,
+ ICAL_DEFAULTCHARSET_PROPERTY,
+ ICAL_DEFAULTLOCALE_PROPERTY,
+ ICAL_DEFAULTTZID_PROPERTY,
ICAL_DESCRIPTION_PROPERTY,
@@ -42,2 +48,3 @@ typedef enum icalproperty_kind {
ICAL_EXDATE_PROPERTY,
+ ICAL_EXPAND_PROPERTY,
ICAL_EXRULE_PROPERTY,
@@ -51,2 +58,3 @@ typedef enum icalproperty_kind {
ICAL_ORGANIZER_PROPERTY,
+ ICAL_OWNER_PROPERTY,
ICAL_PERCENTCOMPLETE_PROPERTY,
@@ -59,2 +67,3 @@ typedef enum icalproperty_kind {
ICAL_RELATEDTO_PROPERTY,
+ ICAL_RELCALID_PROPERTY,
ICAL_REPEAT_PROPERTY,
@@ -79,2 +88,3 @@ typedef enum icalproperty_kind {
ICAL_X_PROPERTY,
+ ICAL_XLICCLASS_PROPERTY,
ICAL_XLICCLUSTERCOUNT_PROPERTY,
@@ -90,3 +100,2 @@ typedef enum icalproperty_kind {
-icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
@@ -95,8 +104,13 @@ icalproperty* icalproperty_new_action(enum icalproperty_action v);
void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v);
-enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...);
+enum icalproperty_action icalproperty_get_action(const icalproperty* prop);icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
+
+/* ALLOW-CONFLICT */
+icalproperty* icalproperty_new_allowconflict(const char* v);
+void icalproperty_set_allowconflict(icalproperty* prop, const char* v);
+const char* icalproperty_get_allowconflict(const icalproperty* prop);icalproperty* icalproperty_vanew_allowconflict(const char* v, ...);
/* ATTACH */
-icalproperty* icalproperty_new_attach(struct icalattachtype* v);
-void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v);
-struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
+icalproperty* icalproperty_new_attach(icalattach * v);
+void icalproperty_set_attach(icalproperty* prop, icalattach * v);
+icalattach * icalproperty_get_attach(const icalproperty* prop);icalproperty* icalproperty_vanew_attach(icalattach * v, ...);
@@ -105,3 +119,13 @@ icalproperty* icalproperty_new_attendee(const char* v);
void icalproperty_set_attendee(icalproperty* prop, const char* v);
-const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
+const char* icalproperty_get_attendee(const icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
+
+/* CALID */
+icalproperty* icalproperty_new_calid(const char* v);
+void icalproperty_set_calid(icalproperty* prop, const char* v);
+const char* icalproperty_get_calid(const icalproperty* prop);icalproperty* icalproperty_vanew_calid(const char* v, ...);
+
+/* CALMASTER */
+icalproperty* icalproperty_new_calmaster(const char* v);
+void icalproperty_set_calmaster(icalproperty* prop, const char* v);
+const char* icalproperty_get_calmaster(const icalproperty* prop);icalproperty* icalproperty_vanew_calmaster(const char* v, ...);
@@ -110,3 +134,8 @@ icalproperty* icalproperty_new_calscale(const char* v);
void icalproperty_set_calscale(icalproperty* prop, const char* v);
-const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
+const char* icalproperty_get_calscale(const icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
+
+/* CARID */
+icalproperty* icalproperty_new_carid(const char* v);
+void icalproperty_set_carid(icalproperty* prop, const char* v);
+const char* icalproperty_get_carid(const icalproperty* prop);icalproperty* icalproperty_vanew_carid(const char* v, ...);
@@ -115,8 +144,8 @@ icalproperty* icalproperty_new_categories(const char* v);
void icalproperty_set_categories(icalproperty* prop, const char* v);
-const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...);
+const char* icalproperty_get_categories(const icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
/* CLASS */
-icalproperty* icalproperty_new_class(const char* v);
-void icalproperty_set_class(icalproperty* prop, const char* v);
-const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
+icalproperty* icalproperty_new_class(enum icalproperty_class v);
+void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v);
+enum icalproperty_class icalproperty_get_class(const icalproperty* prop);icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...);
@@ -125,3 +154,3 @@ icalproperty* icalproperty_new_comment(const char* v);
void icalproperty_set_comment(icalproperty* prop, const char* v);
-const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
+const char* icalproperty_get_comment(const icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
@@ -130,3 +159,3 @@ icalproperty* icalproperty_new_completed(struct icaltimetype v);
void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
+struct icaltimetype icalproperty_get_completed(const icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
@@ -135,3 +164,3 @@ icalproperty* icalproperty_new_contact(const char* v);
void icalproperty_set_contact(icalproperty* prop, const char* v);
-const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
+const char* icalproperty_get_contact(const icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
@@ -140,3 +169,23 @@ icalproperty* icalproperty_new_created(struct icaltimetype v);
void icalproperty_set_created(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
+struct icaltimetype icalproperty_get_created(const icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
+
+/* DECREED */
+icalproperty* icalproperty_new_decreed(const char* v);
+void icalproperty_set_decreed(icalproperty* prop, const char* v);
+const char* icalproperty_get_decreed(const icalproperty* prop);icalproperty* icalproperty_vanew_decreed(const char* v, ...);
+
+/* DEFAULT-CHARSET */
+icalproperty* icalproperty_new_defaultcharset(const char* v);
+void icalproperty_set_defaultcharset(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaultcharset(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...);
+
+/* DEFAULT-LOCALE */
+icalproperty* icalproperty_new_defaultlocale(const char* v);
+void icalproperty_set_defaultlocale(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaultlocale(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...);
+
+/* DEFAULT-TZID */
+icalproperty* icalproperty_new_defaulttzid(const char* v);
+void icalproperty_set_defaulttzid(icalproperty* prop, const char* v);
+const char* icalproperty_get_defaulttzid(const icalproperty* prop);icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...);
@@ -145,3 +194,3 @@ icalproperty* icalproperty_new_description(const char* v);
void icalproperty_set_description(icalproperty* prop, const char* v);
-const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
+const char* icalproperty_get_description(const icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
@@ -150,3 +199,3 @@ icalproperty* icalproperty_new_dtend(struct icaltimetype v);
void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtend(const icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
@@ -155,3 +204,3 @@ icalproperty* icalproperty_new_dtstamp(struct icaltimetype v);
void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
@@ -160,3 +209,3 @@ icalproperty* icalproperty_new_dtstart(struct icaltimetype v);
void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
+struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
@@ -165,3 +214,3 @@ icalproperty* icalproperty_new_due(struct icaltimetype v);
void icalproperty_set_due(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
+struct icaltimetype icalproperty_get_due(const icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
@@ -170,3 +219,3 @@ icalproperty* icalproperty_new_duration(struct icaldurationtype v);
void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v);
-struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
+struct icaldurationtype icalproperty_get_duration(const icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
@@ -175,3 +224,8 @@ icalproperty* icalproperty_new_exdate(struct icaltimetype v);
void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
+struct icaltimetype icalproperty_get_exdate(const icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
+
+/* EXPAND */
+icalproperty* icalproperty_new_expand(int v);
+void icalproperty_set_expand(icalproperty* prop, int v);
+int icalproperty_get_expand(const icalproperty* prop);icalproperty* icalproperty_vanew_expand(int v, ...);
@@ -180,3 +234,3 @@ icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v);
void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v);
-struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
+struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
@@ -185,3 +239,3 @@ icalproperty* icalproperty_new_freebusy(struct icalperiodtype v);
void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v);
-struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
+struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
@@ -190,3 +244,3 @@ icalproperty* icalproperty_new_geo(struct icalgeotype v);
void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v);
-struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
+struct icalgeotype icalproperty_get_geo(const icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
@@ -195,3 +249,3 @@ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v);
void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
+struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
@@ -200,3 +254,3 @@ icalproperty* icalproperty_new_location(const char* v);
void icalproperty_set_location(icalproperty* prop, const char* v);
-const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
+const char* icalproperty_get_location(const icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
@@ -205,3 +259,3 @@ icalproperty* icalproperty_new_maxresults(int v);
void icalproperty_set_maxresults(icalproperty* prop, int v);
-int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
+int icalproperty_get_maxresults(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
@@ -210,3 +264,3 @@ icalproperty* icalproperty_new_maxresultssize(int v);
void icalproperty_set_maxresultssize(icalproperty* prop, int v);
-int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
+int icalproperty_get_maxresultssize(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
@@ -215,3 +269,3 @@ icalproperty* icalproperty_new_method(enum icalproperty_method v);
void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v);
-enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
+enum icalproperty_method icalproperty_get_method(const icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
@@ -220,3 +274,8 @@ icalproperty* icalproperty_new_organizer(const char* v);
void icalproperty_set_organizer(icalproperty* prop, const char* v);
-const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
+const char* icalproperty_get_organizer(const icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
+
+/* OWNER */
+icalproperty* icalproperty_new_owner(const char* v);
+void icalproperty_set_owner(icalproperty* prop, const char* v);
+const char* icalproperty_get_owner(const icalproperty* prop);icalproperty* icalproperty_vanew_owner(const char* v, ...);
@@ -225,3 +284,3 @@ icalproperty* icalproperty_new_percentcomplete(int v);
void icalproperty_set_percentcomplete(icalproperty* prop, int v);
-int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
+int icalproperty_get_percentcomplete(const icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
@@ -230,3 +289,3 @@ icalproperty* icalproperty_new_priority(int v);
void icalproperty_set_priority(icalproperty* prop, int v);
-int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
+int icalproperty_get_priority(const icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
@@ -235,3 +294,3 @@ icalproperty* icalproperty_new_prodid(const char* v);
void icalproperty_set_prodid(icalproperty* prop, const char* v);
-const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
+const char* icalproperty_get_prodid(const icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
@@ -240,3 +299,3 @@ icalproperty* icalproperty_new_query(const char* v);
void icalproperty_set_query(icalproperty* prop, const char* v);
-const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
+const char* icalproperty_get_query(const icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
@@ -245,3 +304,3 @@ icalproperty* icalproperty_new_queryname(const char* v);
void icalproperty_set_queryname(icalproperty* prop, const char* v);
-const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
+const char* icalproperty_get_queryname(const icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
@@ -250,3 +309,3 @@ icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v);
void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
+struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
@@ -255,3 +314,3 @@ icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v);
void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v);
-struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
+struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
@@ -260,3 +319,8 @@ icalproperty* icalproperty_new_relatedto(const char* v);
void icalproperty_set_relatedto(icalproperty* prop, const char* v);
-const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
+const char* icalproperty_get_relatedto(const icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
+
+/* RELCALID */
+icalproperty* icalproperty_new_relcalid(const char* v);
+void icalproperty_set_relcalid(icalproperty* prop, const char* v);
+const char* icalproperty_get_relcalid(const icalproperty* prop);icalproperty* icalproperty_vanew_relcalid(const char* v, ...);
@@ -265,3 +329,3 @@ icalproperty* icalproperty_new_repeat(int v);
void icalproperty_set_repeat(icalproperty* prop, int v);
-int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
+int icalproperty_get_repeat(const icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
@@ -270,3 +334,3 @@ icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v);
void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v);
-struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
+struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
@@ -275,3 +339,3 @@ icalproperty* icalproperty_new_resources(const char* v);
void icalproperty_set_resources(icalproperty* prop, const char* v);
-const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
+const char* icalproperty_get_resources(const icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
@@ -280,3 +344,3 @@ icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v);
void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v);
-struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
+struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
@@ -285,3 +349,3 @@ icalproperty* icalproperty_new_scope(const char* v);
void icalproperty_set_scope(icalproperty* prop, const char* v);
-const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
+const char* icalproperty_get_scope(const icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
@@ -290,3 +354,3 @@ icalproperty* icalproperty_new_sequence(int v);
void icalproperty_set_sequence(icalproperty* prop, int v);
-int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
+int icalproperty_get_sequence(const icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
@@ -295,3 +359,3 @@ icalproperty* icalproperty_new_status(enum icalproperty_status v);
void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v);
-enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
+enum icalproperty_status icalproperty_get_status(const icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
@@ -300,3 +364,3 @@ icalproperty* icalproperty_new_summary(const char* v);
void icalproperty_set_summary(icalproperty* prop, const char* v);
-const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
+const char* icalproperty_get_summary(const icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
@@ -305,8 +369,8 @@ icalproperty* icalproperty_new_target(const char* v);
void icalproperty_set_target(icalproperty* prop, const char* v);
-const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...);
+const char* icalproperty_get_target(const icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
/* TRANSP */
-icalproperty* icalproperty_new_transp(const char* v);
-void icalproperty_set_transp(icalproperty* prop, const char* v);
-const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
+icalproperty* icalproperty_new_transp(enum icalproperty_transp v);
+void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v);
+enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop);icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...);
@@ -315,3 +379,3 @@ icalproperty* icalproperty_new_trigger(struct icaltriggertype v);
void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v);
-struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
+struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
@@ -320,3 +384,3 @@ icalproperty* icalproperty_new_tzid(const char* v);
void icalproperty_set_tzid(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
+const char* icalproperty_get_tzid(const icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
@@ -325,3 +389,3 @@ icalproperty* icalproperty_new_tzname(const char* v);
void icalproperty_set_tzname(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
+const char* icalproperty_get_tzname(const icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
@@ -330,3 +394,3 @@ icalproperty* icalproperty_new_tzoffsetfrom(int v);
void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v);
-int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
+int icalproperty_get_tzoffsetfrom(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
@@ -335,3 +399,3 @@ icalproperty* icalproperty_new_tzoffsetto(int v);
void icalproperty_set_tzoffsetto(icalproperty* prop, int v);
-int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
+int icalproperty_get_tzoffsetto(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
@@ -340,3 +404,3 @@ icalproperty* icalproperty_new_tzurl(const char* v);
void icalproperty_set_tzurl(icalproperty* prop, const char* v);
-const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
+const char* icalproperty_get_tzurl(const icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
@@ -345,3 +409,3 @@ icalproperty* icalproperty_new_uid(const char* v);
void icalproperty_set_uid(icalproperty* prop, const char* v);
-const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
+const char* icalproperty_get_uid(const icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
@@ -350,3 +414,3 @@ icalproperty* icalproperty_new_url(const char* v);
void icalproperty_set_url(icalproperty* prop, const char* v);
-const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
+const char* icalproperty_get_url(const icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
@@ -355,3 +419,3 @@ icalproperty* icalproperty_new_version(const char* v);
void icalproperty_set_version(icalproperty* prop, const char* v);
-const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
+const char* icalproperty_get_version(const icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
@@ -360,3 +424,8 @@ icalproperty* icalproperty_new_x(const char* v);
void icalproperty_set_x(icalproperty* prop, const char* v);
-const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
+const char* icalproperty_get_x(const icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
+
+/* X-LIC-CLASS */
+icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v);
+void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v);
+enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...);
@@ -365,3 +434,3 @@ icalproperty* icalproperty_new_xlicclustercount(const char* v);
void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
+const char* icalproperty_get_xlicclustercount(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
@@ -370,3 +439,3 @@ icalproperty* icalproperty_new_xlicerror(const char* v);
void icalproperty_set_xlicerror(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
+const char* icalproperty_get_xlicerror(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
@@ -375,3 +444,3 @@ icalproperty* icalproperty_new_xlicmimecharset(const char* v);
void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
+const char* icalproperty_get_xlicmimecharset(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
@@ -380,3 +449,3 @@ icalproperty* icalproperty_new_xlicmimecid(const char* v);
void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
+const char* icalproperty_get_xlicmimecid(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
@@ -385,3 +454,3 @@ icalproperty* icalproperty_new_xlicmimecontenttype(const char* v);
void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
+const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
@@ -390,3 +459,3 @@ icalproperty* icalproperty_new_xlicmimeencoding(const char* v);
void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
+const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
@@ -395,3 +464,3 @@ icalproperty* icalproperty_new_xlicmimefilename(const char* v);
void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
+const char* icalproperty_get_xlicmimefilename(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
@@ -400,3 +469,4 @@ icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v);
void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v);
-const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop);
+const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
+
diff --git a/libical/src/libical/icalderivedvalue.c b/libical/src/libical/icalderivedvalue.c
index db762ea..8dbbe9e 100644
--- a/libical/src/libical/icalderivedvalue.c
+++ b/libical/src/libical/icalderivedvalue.c
@@ -49,6 +49,2 @@
-
-
-#define TMP_BUF_SIZE 1024
-
struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind);
@@ -62,39 +58,42 @@ struct icalvalue_kind_map {
-extern struct icalvalue_kind_map value_map[];
-
-const char* icalvalue_kind_to_string(icalvalue_kind kind)
-{
- int i;
-
- for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
- if (value_map[i].kind == kind) {
- return value_map[i].name;
- }
- }
-
- return 0;
-}
-
-icalvalue_kind icalvalue_string_to_kind(const char* str)
-{
- int i;
-
- for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
- if (strcmp(value_map[i].name,str) == 0) {
- return value_map[i].kind;
- }
- }
-
- return value_map[i].kind;
+static struct icalvalue_kind_map value_map[28]={
+ {ICAL_QUERY_VALUE,"QUERY"},
+ {ICAL_DATE_VALUE,"DATE"},
+ {ICAL_ATTACH_VALUE,"ATTACH"},
+ {ICAL_GEO_VALUE,"GEO"},
+ {ICAL_STATUS_VALUE,"STATUS"},
+ {ICAL_TRANSP_VALUE,"TRANSP"},
+ {ICAL_STRING_VALUE,"STRING"},
+ {ICAL_TEXT_VALUE,"TEXT"},
+ {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"},
+ {ICAL_BINARY_VALUE,"BINARY"},
+ {ICAL_PERIOD_VALUE,"PERIOD"},
+ {ICAL_FLOAT_VALUE,"FLOAT"},
+ {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
+ {ICAL_INTEGER_VALUE,"INTEGER"},
+ {ICAL_CLASS_VALUE,"CLASS"},
+ {ICAL_URI_VALUE,"URI"},
+ {ICAL_DURATION_VALUE,"DURATION"},
+ {ICAL_BOOLEAN_VALUE,"BOOLEAN"},
+ {ICAL_X_VALUE,"X"},
+ {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
+ {ICAL_TRIGGER_VALUE,"TRIGGER"},
+ {ICAL_XLICCLASS_VALUE,"X-LIC-CLASS"},
+ {ICAL_RECUR_VALUE,"RECUR"},
+ {ICAL_ACTION_VALUE,"ACTION"},
+ {ICAL_DATETIME_VALUE,"DATE-TIME"},
+ {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
+ {ICAL_METHOD_VALUE,"METHOD"},
+ {ICAL_NO_VALUE,""}
+};
-}
-icalvalue* icalvalue_new_x (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
+icalvalue* icalvalue_new_query (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_x((icalvalue*)impl,v);
+ icalvalue_set_query((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_x(icalvalue* value, const char* v) {
+void icalvalue_set_query(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
@@ -103,8 +102,10 @@ void icalvalue_set_x(icalvalue* value, const char* v) {
+ icalerror_check_value_type(value, ICAL_QUERY_VALUE);
impl = (struct icalvalue_impl*)value;
- if(impl->x_value!=0) {free((void*)impl->x_value);}
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->x_value = icalmemory_strdup(v);
- if (impl->x_value == 0){
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
errno = ENOMEM;
@@ -112,46 +113,37 @@ void icalvalue_set_x(icalvalue* value, const char* v) {
- }
-const char* icalvalue_get_x(icalvalue* value) {
+
+ icalvalue_reset_kind(impl);
+}
+const char* icalvalue_get_query(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_X_VALUE);
- return ((struct icalvalue_impl*)value)->x_value;
+ icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
-/* Attachment is a special case, so it is not auto generated. */
-icalvalue*
-icalvalue_new_attach (struct icalattachtype *v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE);
-
- icalvalue_set_attach((icalvalue*)impl,v);
+
+icalvalue* icalvalue_new_date (struct icaltimetype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
+
+ icalvalue_set_date((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_attach(icalvalue* value, struct icalattachtype *v)
-{
+void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
-
+
+ icalerror_check_value_type(value, ICAL_DATE_VALUE);
impl = (struct icalvalue_impl*)value;
- if (impl->data.v_attach != 0){
- icalattachtype_free(impl->data.v_attach);
- }
- impl->data.v_attach = v;
- icalattachtype_add_reference(v);
+ impl->data.v_time = v;
+
+ icalvalue_reset_kind(impl);
}
+struct icaltimetype icalvalue_get_date(const icalvalue* value) {
-struct icalattachtype*
-icalvalue_get_attach(icalvalue* value)
-{
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
-
- return ((struct icalvalue_impl*)value)->data.v_attach;
+ icalerror_check_value_type(value, ICAL_DATE_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_time;
}
@@ -159,46 +151,26 @@ icalvalue_get_attach(icalvalue* value)
-/* Recur is a special case, so it is not auto generated. */
-icalvalue*
-icalvalue_new_recur (struct icalrecurrencetype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
-
- icalvalue_set_recur((icalvalue*)impl,v);
+icalvalue* icalvalue_new_geo (struct icalgeotype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
+
+ icalvalue_set_geo((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
-{
+void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_RECUR_VALUE);
-
+
+ icalerror_check_value_type(value, ICAL_GEO_VALUE);
impl = (struct icalvalue_impl*)value;
- if (impl->data.v_recur != 0){
- free(impl->data.v_recur);
- impl->data.v_recur = 0;
- }
- impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
+ impl->data.v_geo = v;
- if (impl->data.v_recur == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return;
- } else {
- memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
- }
-
+ icalvalue_reset_kind(impl);
}
+struct icalgeotype icalvalue_get_geo(const icalvalue* value) {
-struct icalrecurrencetype
-icalvalue_get_recur(icalvalue* value)
-{
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_RECUR_VALUE);
-
- return *(((struct icalvalue_impl*)value)->data.v_recur);
+ icalerror_check_value_type(value, ICAL_GEO_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_geo;
}
@@ -207,120 +179,53 @@ icalvalue_get_recur(icalvalue* value)
-
-icalvalue*
-icalvalue_new_trigger (struct icaltriggertype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
-
- icalvalue_set_trigger((icalvalue*)impl,v);
-
+icalvalue* icalvalue_new_status (enum icalproperty_status v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
+
+ icalvalue_set_status((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
-{
+void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_STATUS_VALUE);
impl = (struct icalvalue_impl*)value;
- if(!icaltime_is_null_time(v.time)){
- icalvalue_set_datetime((icalvalue*)impl,v.time);
- impl->kind = ICAL_DATETIME_VALUE;
- } else {
- icalvalue_set_duration((icalvalue*)impl,v.duration);
- impl->kind = ICAL_DURATION_VALUE;
- }
-}
+ impl->data.v_enum = v;
-struct icaltriggertype
-icalvalue_get_trigger(icalvalue* value)
-{
- struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
- struct icaltriggertype tr;
+ icalvalue_reset_kind(impl);
+}
+enum icalproperty_status icalvalue_get_status(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_arg( (value!=0),"value");
-
- if(impl->kind == ICAL_DATETIME_VALUE){
- tr.duration = icaldurationtype_from_int(0);
- tr.time = impl->data.v_time;
- } else if(impl->kind == ICAL_DURATION_VALUE){
- tr.time = icaltime_null_time();
- tr.duration = impl->data.v_duration;
- } else {
- tr.duration = icaldurationtype_from_int(0);
- tr.time = icaltime_null_time();
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
-
- return tr;
+ icalerror_check_value_type(value, ICAL_STATUS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
-/* DATE-TIME-PERIOD is a special case, and is not auto generated */
-
-icalvalue*
-icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
- icalvalue_set_datetimeperiod((icalvalue*)impl,v);
+icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
+
+ icalvalue_set_transp((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
-{
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
-
+void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
+ struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
+ icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ impl = (struct icalvalue_impl*)value;
- if(!icaltime_is_null_time(v.time)){
- if(!icaltime_is_valid_time(v.time)){
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
- }
- impl->kind = ICAL_DATETIME_VALUE;
- icalvalue_set_datetime(impl,v.time);
- } else if (!icalperiodtype_is_null_period(v.period)) {
- if(!icalperiodtype_is_valid_period(v.period)){
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
- }
- impl->kind = ICAL_PERIOD_VALUE;
- icalvalue_set_period(impl,v.period);
- } else {
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
-}
-struct icaldatetimeperiodtype
-icalvalue_get_datetimeperiod(icalvalue* value)
-{
- struct icaldatetimeperiodtype dtp;
-
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
-
- if(impl->kind == ICAL_DATETIME_VALUE){
- dtp.period = icalperiodtype_null_period();
- dtp.time = impl->data.v_time;
- } else if(impl->kind == ICAL_PERIOD_VALUE) {
- dtp.period = impl->data.v_period;
- dtp.time = icaltime_null_time();
- } else {
- dtp.period = icalperiodtype_null_period();
- dtp.time = icaltime_null_time();
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
+ impl->data.v_enum = v;
- return dtp;
+ icalvalue_reset_kind(impl);
}
+enum icalproperty_transp icalvalue_get_transp(const icalvalue* value) {
+ icalerror_check_arg( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
+}
@@ -328,51 +233,10 @@ icalvalue_get_datetimeperiod(icalvalue* value)
-
-
-
-
-
-/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
- types */
-
-
-/* Everything below this line is machine generated. Do not edit. */
-static struct icalvalue_kind_map value_map[]={
- {ICAL_QUERY_VALUE,"QUERY"},
- {ICAL_TRIGGER_VALUE,"TRIGGER"},
- {ICAL_STATUS_VALUE,"STATUS"},
- {ICAL_TRANSP_VALUE,"TRANSP"},
- {ICAL_CLASS_VALUE,"CLASS"},
- {ICAL_DATE_VALUE,"DATE"},
- {ICAL_STRING_VALUE,"STRING"},
- {ICAL_INTEGER_VALUE,"INTEGER"},
- {ICAL_PERIOD_VALUE,"PERIOD"},
- {ICAL_TEXT_VALUE,"TEXT"},
- {ICAL_DURATION_VALUE,"DURATION"},
- {ICAL_BOOLEAN_VALUE,"BOOLEAN"},
- {ICAL_URI_VALUE,"URI"},
- {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
- {ICAL_GEO_VALUE,"GEO"},
- {ICAL_DATETIME_VALUE,"DATE-TIME"},
- {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
- {ICAL_ATTACH_VALUE,"ATTACH"},
- {ICAL_ACTION_VALUE,"ACTION"},
- {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
- {ICAL_X_VALUE,"X"},
- {ICAL_FLOAT_VALUE,"FLOAT"},
- {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"},
- {ICAL_METHOD_VALUE,"METHOD"},
- {ICAL_BINARY_VALUE,"BINARY"},
- {ICAL_RECUR_VALUE,"RECUR"},
- {ICAL_NO_VALUE,""}
-};
-
-
-icalvalue* icalvalue_new_query (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
+icalvalue* icalvalue_new_string (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_query((icalvalue*)impl,v);
+ icalvalue_set_string((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_query(icalvalue* value, const char* v) {
+void icalvalue_set_string(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
@@ -381,3 +245,3 @@ void icalvalue_set_query(icalvalue* value, const char* v) {
- icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ icalerror_check_value_type(value, ICAL_STRING_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -395,6 +259,6 @@ void icalvalue_set_query(icalvalue* value, const char* v) {
}
-const char* icalvalue_get_query(icalvalue* value) {
+const char* icalvalue_get_string(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ icalerror_check_value_type(value, ICAL_STRING_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
@@ -404,17 +268,25 @@ const char* icalvalue_get_query(icalvalue* value) {
-icalvalue* icalvalue_new_status (enum icalproperty_status v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
-
- icalvalue_set_status((icalvalue*)impl,v);
+icalvalue* icalvalue_new_text (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
+ icalerror_check_arg_rz( (v!=0),"v");
+
+ icalvalue_set_text((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
+void icalvalue_set_text(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_STATUS_VALUE);
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_value_type(value, ICAL_TEXT_VALUE);
impl = (struct icalvalue_impl*)value;
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_enum = v;
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
+ errno = ENOMEM;
+ }
+
@@ -422,7 +294,7 @@ void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
}
-enum icalproperty_status icalvalue_get_status(icalvalue* value) {
+const char* icalvalue_get_text(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_STATUS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
@@ -431,9 +303,9 @@ enum icalproperty_status icalvalue_get_status(icalvalue* value) {
-icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
+icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE);
- icalvalue_set_transp((icalvalue*)impl,v);
+ icalvalue_set_requeststatus((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
+void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) {
struct icalvalue_impl* impl;
@@ -441,3 +313,3 @@ void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
- icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -445,3 +317,3 @@ void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
- impl->data.v_enum = v;
+ impl->data.v_requeststatus = v;
@@ -449,7 +321,7 @@ void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
}
-enum icalproperty_transp icalvalue_get_transp(icalvalue* value) {
+struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_requeststatus;
}
@@ -458,17 +330,25 @@ enum icalproperty_transp icalvalue_get_transp(icalvalue* value) {
-icalvalue* icalvalue_new_class (enum icalproperty_class v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
-
- icalvalue_set_class((icalvalue*)impl,v);
+icalvalue* icalvalue_new_binary (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
+ icalerror_check_arg_rz( (v!=0),"v");
+
+ icalvalue_set_binary((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
+void icalvalue_set_binary(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_CLASS_VALUE);
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_value_type(value, ICAL_BINARY_VALUE);
impl = (struct icalvalue_impl*)value;
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_enum = v;
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
+ errno = ENOMEM;
+ }
+
@@ -476,7 +356,7 @@ void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
}
-enum icalproperty_class icalvalue_get_class(icalvalue* value) {
+const char* icalvalue_get_binary(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_CLASS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_BINARY_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
@@ -485,9 +365,9 @@ enum icalproperty_class icalvalue_get_class(icalvalue* value) {
-icalvalue* icalvalue_new_date (struct icaltimetype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
+icalvalue* icalvalue_new_period (struct icalperiodtype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
- icalvalue_set_date((icalvalue*)impl,v);
+ icalvalue_set_period((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
+void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
struct icalvalue_impl* impl;
@@ -495,3 +375,3 @@ void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
- icalerror_check_value_type(value, ICAL_DATE_VALUE);
+ icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -499,3 +379,3 @@ void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
- impl->data.v_time = v;
+ impl->data.v_period = v;
@@ -503,7 +383,7 @@ void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
}
-struct icaltimetype icalvalue_get_date(icalvalue* value) {
+struct icalperiodtype icalvalue_get_period(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATE_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_time;
+ icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_period;
}
@@ -512,25 +392,17 @@ struct icaltimetype icalvalue_get_date(icalvalue* value) {
-icalvalue* icalvalue_new_string (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
- icalerror_check_arg_rz( (v!=0),"v");
-
- icalvalue_set_string((icalvalue*)impl,v);
+icalvalue* icalvalue_new_float (float v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
+
+ icalvalue_set_float((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_string(icalvalue* value, const char* v) {
+void icalvalue_set_float(icalvalue* value, float v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_arg_rv( (v!=0),"v");
-
- icalerror_check_value_type(value, ICAL_STRING_VALUE);
+
+ icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_string = icalmemory_strdup(v);
-
- if (impl->data.v_string == 0){
- errno = ENOMEM;
- }
-
+ impl->data.v_float = v;
@@ -538,7 +410,7 @@ void icalvalue_set_string(icalvalue* value, const char* v) {
}
-const char* icalvalue_get_string(icalvalue* value) {
+float icalvalue_get_float(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_STRING_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+ icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_float;
}
@@ -565,3 +437,3 @@ void icalvalue_set_integer(icalvalue* value, int v) {
}
-int icalvalue_get_integer(icalvalue* value) {
+int icalvalue_get_integer(const icalvalue* value) {
@@ -574,9 +446,9 @@ int icalvalue_get_integer(icalvalue* value) {
-icalvalue* icalvalue_new_period (struct icalperiodtype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
+icalvalue* icalvalue_new_class (enum icalproperty_class v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
- icalvalue_set_period((icalvalue*)impl,v);
+ icalvalue_set_class((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
+void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
struct icalvalue_impl* impl;
@@ -584,3 +456,3 @@ void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
- icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
+ icalerror_check_value_type(value, ICAL_CLASS_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -588,3 +460,3 @@ void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
- impl->data.v_period = v;
+ impl->data.v_enum = v;
@@ -592,7 +464,7 @@ void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
}
-struct icalperiodtype icalvalue_get_period(icalvalue* value) {
+enum icalproperty_class icalvalue_get_class(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_period;
+ icalerror_check_value_type(value, ICAL_CLASS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
@@ -601,10 +473,10 @@ struct icalperiodtype icalvalue_get_period(icalvalue* value) {
-icalvalue* icalvalue_new_text (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
+icalvalue* icalvalue_new_uri (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_text((icalvalue*)impl,v);
+ icalvalue_set_uri((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_text(icalvalue* value, const char* v) {
+void icalvalue_set_uri(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
@@ -613,3 +485,3 @@ void icalvalue_set_text(icalvalue* value, const char* v) {
- icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ icalerror_check_value_type(value, ICAL_URI_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -627,6 +499,6 @@ void icalvalue_set_text(icalvalue* value, const char* v) {
}
-const char* icalvalue_get_text(icalvalue* value) {
+const char* icalvalue_get_uri(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ icalerror_check_value_type(value, ICAL_URI_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
@@ -654,3 +526,3 @@ void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) {
}
-struct icaldurationtype icalvalue_get_duration(icalvalue* value) {
+struct icaldurationtype icalvalue_get_duration(const icalvalue* value) {
@@ -681,3 +553,3 @@ void icalvalue_set_boolean(icalvalue* value, int v) {
}
-int icalvalue_get_boolean(icalvalue* value) {
+int icalvalue_get_boolean(const icalvalue* value) {
@@ -690,10 +562,10 @@ int icalvalue_get_boolean(icalvalue* value) {
-icalvalue* icalvalue_new_uri (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
+icalvalue* icalvalue_new_caladdress (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_uri((icalvalue*)impl,v);
+ icalvalue_set_caladdress((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_uri(icalvalue* value, const char* v) {
+void icalvalue_set_caladdress(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
@@ -702,3 +574,3 @@ void icalvalue_set_uri(icalvalue* value, const char* v) {
- icalerror_check_value_type(value, ICAL_URI_VALUE);
+ icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -716,6 +588,6 @@ void icalvalue_set_uri(icalvalue* value, const char* v) {
}
-const char* icalvalue_get_uri(icalvalue* value) {
+const char* icalvalue_get_caladdress(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_URI_VALUE);
+ icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
@@ -725,9 +597,9 @@ const char* icalvalue_get_uri(icalvalue* value) {
-icalvalue* icalvalue_new_geo (struct icalgeotype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
+icalvalue* icalvalue_new_xlicclass (enum icalproperty_xlicclass v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_XLICCLASS_VALUE);
- icalvalue_set_geo((icalvalue*)impl,v);
+ icalvalue_set_xlicclass((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
+void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v) {
struct icalvalue_impl* impl;
@@ -735,3 +607,3 @@ void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
- icalerror_check_value_type(value, ICAL_GEO_VALUE);
+ icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -739,3 +611,3 @@ void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
- impl->data.v_geo = v;
+ impl->data.v_enum = v;
@@ -743,7 +615,34 @@ void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
}
-struct icalgeotype icalvalue_get_geo(icalvalue* value) {
+enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_GEO_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_geo;
+ icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
+}
+
+
+
+icalvalue* icalvalue_new_action (enum icalproperty_action v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
+
+ icalvalue_set_action((icalvalue*)impl,v);
+ return (icalvalue*)impl;
+}
+void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
+ struct icalvalue_impl* impl;
+ icalerror_check_arg_rv( (value!=0),"value");
+
+ icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ impl = (struct icalvalue_impl*)value;
+
+
+ impl->data.v_enum = v;
+
+ icalvalue_reset_kind(impl);
+}
+enum icalproperty_action icalvalue_get_action(const icalvalue* value) {
+
+ icalerror_check_arg( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
@@ -770,3 +669,3 @@ void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) {
}
-struct icaltimetype icalvalue_get_datetime(icalvalue* value) {
+struct icaltimetype icalvalue_get_datetime(const icalvalue* value) {
@@ -797,3 +696,3 @@ void icalvalue_set_utcoffset(icalvalue* value, int v) {
}
-int icalvalue_get_utcoffset(icalvalue* value) {
+int icalvalue_get_utcoffset(const icalvalue* value) {
@@ -806,9 +705,9 @@ int icalvalue_get_utcoffset(icalvalue* value) {
-icalvalue* icalvalue_new_action (enum icalproperty_action v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
+icalvalue* icalvalue_new_method (enum icalproperty_method v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
- icalvalue_set_action((icalvalue*)impl,v);
+ icalvalue_set_method((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
+void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
struct icalvalue_impl* impl;
@@ -816,3 +715,3 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
- icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ icalerror_check_value_type(value, ICAL_METHOD_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -824,6 +723,6 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
}
-enum icalproperty_action icalvalue_get_action(icalvalue* value) {
+enum icalproperty_method icalvalue_get_method(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ icalerror_check_value_type(value, ICAL_METHOD_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
@@ -832,23 +731,56 @@ enum icalproperty_action icalvalue_get_action(icalvalue* value) {
+int icalvalue_kind_is_valid(const icalvalue_kind kind)
+{
+ int i = 0;
+ do {
+ if (value_map[i].kind == kind)
+ return 1;
+ } while (value_map[i++].kind != ICAL_NO_VALUE);
-icalvalue* icalvalue_new_caladdress (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
+ return 0;
+}
+
+const char* icalvalue_kind_to_string(const icalvalue_kind kind)
+{
+ int i;
+
+ for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
+ if (value_map[i].kind == kind) {
+ return value_map[i].name;
+ }
+ }
+
+ return 0;
+}
+
+icalvalue_kind icalvalue_string_to_kind(const char* str)
+{
+ int i;
+
+ for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
+ if (strcmp(value_map[i].name,str) == 0) {
+ return value_map[i].kind;
+ }
+ }
+
+ return value_map[i].kind;
+
+}
+
+icalvalue* icalvalue_new_x (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_caladdress((icalvalue*)impl,v);
+ icalvalue_set_x((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_caladdress(icalvalue* value, const char* v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
+void icalvalue_set_x(icalvalue* impl, const char* v) {
+ icalerror_check_arg_rv( (impl!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
- impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
-
+ if(impl->x_value!=0) {free((void*)impl->x_value);}
- impl->data.v_string = icalmemory_strdup(v);
+ impl->x_value = icalmemory_strdup(v);
- if (impl->data.v_string == 0){
+ if (impl->x_value == 0){
errno = ENOMEM;
@@ -856,37 +788,50 @@ void icalvalue_set_caladdress(icalvalue* value, const char* v) {
-
- icalvalue_reset_kind(impl);
-}
-const char* icalvalue_get_caladdress(icalvalue* value) {
+ }
+const char* icalvalue_get_x(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+ icalerror_check_value_type(value, ICAL_X_VALUE);
+ return value->x_value;
}
+/* Recur is a special case, so it is not auto generated. */
+icalvalue*
+icalvalue_new_recur (struct icalrecurrencetype v)
+{
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
+
+ icalvalue_set_recur((icalvalue*)impl,v);
-
-icalvalue* icalvalue_new_float (float v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
-
- icalvalue_set_float((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_float(icalvalue* value, float v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
- impl = (struct icalvalue_impl*)value;
+void
+icalvalue_set_recur(icalvalue* impl, struct icalrecurrencetype v)
+{
+ icalerror_check_arg_rv( (impl!=0),"value");
+ icalerror_check_value_type(value, ICAL_RECUR_VALUE);
- impl->data.v_float = v;
+ if (impl->data.v_recur != 0){
+ free(impl->data.v_recur);
+ impl->data.v_recur = 0;
+ }
- icalvalue_reset_kind(impl);
+ impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
+
+ if (impl->data.v_recur == 0){
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ } else {
+ memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
+ }
+
}
-float icalvalue_get_float(icalvalue* value) {
+struct icalrecurrencetype
+icalvalue_get_recur(const icalvalue* value)
+{
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_float;
+ icalerror_check_value_type(value, ICAL_RECUR_VALUE);
+
+ return *(value->data.v_recur);
}
@@ -895,87 +840,168 @@ float icalvalue_get_float(icalvalue* value) {
-icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE);
-
- icalvalue_set_requeststatus((icalvalue*)impl,v);
+
+icalvalue*
+icalvalue_new_trigger (struct icaltriggertype v)
+{
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
+
+ icalvalue_set_trigger((icalvalue*)impl,v);
+
return (icalvalue*)impl;
}
-void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) {
- struct icalvalue_impl* impl;
+
+void
+icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
+{
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
- impl = (struct icalvalue_impl*)value;
+ if(!icaltime_is_null_time(v.time)){
+ icalvalue_set_datetime(value,v.time);
+ value->kind = ICAL_DATETIME_VALUE;
+ } else {
+ icalvalue_set_duration(value,v.duration);
+ value->kind = ICAL_DURATION_VALUE;
+ }
+}
+struct icaltriggertype
+icalvalue_get_trigger(const icalvalue* impl)
+{
+ struct icaltriggertype tr;
- impl->data.v_requeststatus = v;
+ icalerror_check_arg( (impl!=0),"value");
+ icalerror_check_arg( (impl!=0),"value");
- icalvalue_reset_kind(impl);
-}
-struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value) {
+ if(impl->kind == ICAL_DATETIME_VALUE){
+ tr.duration = icaldurationtype_from_int(0);
+ tr.time = impl->data.v_time;
+ } else if(impl->kind == ICAL_DURATION_VALUE){
+ tr.time = icaltime_null_time();
+ tr.duration = impl->data.v_duration;
+ } else {
+ tr.duration = icaldurationtype_from_int(0);
+ tr.time = icaltime_null_time();
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ }
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_requeststatus;
+ return tr;
}
+/* DATE-TIME-PERIOD is a special case, and is not auto generated */
+icalvalue*
+icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
+{
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
+
+ icalvalue_set_datetimeperiod(impl,v);
-icalvalue* icalvalue_new_method (enum icalproperty_method v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
-
- icalvalue_set_method((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_METHOD_VALUE);
- impl = (struct icalvalue_impl*)value;
-
- impl->data.v_enum = v;
+void
+icalvalue_set_datetimeperiod(icalvalue* impl, struct icaldatetimeperiodtype v)
+{
+ icalerror_check_arg_rv( (impl!=0),"value");
+
+ icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
- icalvalue_reset_kind(impl);
+ if(!icaltime_is_null_time(v.time)){
+ if(!icaltime_is_valid_time(v.time)){
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
+ }
+ impl->kind = ICAL_DATETIME_VALUE;
+ icalvalue_set_datetime(impl,v.time);
+ } else if (!icalperiodtype_is_null_period(v.period)) {
+ if(!icalperiodtype_is_valid_period(v.period)){
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
+ }
+ impl->kind = ICAL_PERIOD_VALUE;
+ icalvalue_set_period(impl,v.period);
+ } else {
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ }
}
-enum icalproperty_method icalvalue_get_method(icalvalue* value) {
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_METHOD_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
-}
+struct icaldatetimeperiodtype
+icalvalue_get_datetimeperiod(const icalvalue* impl)
+{
+ struct icaldatetimeperiodtype dtp;
+
+ icalerror_check_arg( (impl!=0),"value");
+ icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
+
+ if(impl->kind == ICAL_DATETIME_VALUE){
+ dtp.period = icalperiodtype_null_period();
+ dtp.time = impl->data.v_time;
+ } else if(impl->kind == ICAL_PERIOD_VALUE) {
+ dtp.period = impl->data.v_period;
+ dtp.time = icaltime_null_time();
+ } else {
+ dtp.period = icalperiodtype_null_period();
+ dtp.time = icaltime_null_time();
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ }
+ return dtp;
+}
-icalvalue* icalvalue_new_binary (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
- icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_binary((icalvalue*)impl,v);
- return (icalvalue*)impl;
-}
-void icalvalue_set_binary(icalvalue* value, const char* v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_arg_rv( (v!=0),"v");
+icalvalue *
+icalvalue_new_attach (icalattach *attach)
+{
+ struct icalvalue_impl *impl;
- icalerror_check_value_type(value, ICAL_BINARY_VALUE);
- impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
+ icalerror_check_arg_rz ((attach != NULL), "attach");
+ impl = icalvalue_new_impl (ICAL_ATTACH_VALUE);
+ if (!impl) {
+ errno = ENOMEM;
+ return NULL;
+ }
- impl->data.v_string = icalmemory_strdup(v);
+ icalvalue_set_attach ((icalvalue *) impl, attach);
+ return (icalvalue *) impl;
+}
- if (impl->data.v_string == 0){
- errno = ENOMEM;
- }
+void
+icalvalue_set_attach (icalvalue *value, icalattach *attach)
+{
+ struct icalvalue_impl *impl;
+
+ icalerror_check_arg_rv ((value != NULL), "value");
+ icalerror_check_value_type (value, ICAL_ATTACH_VALUE);
+ icalerror_check_arg_rv ((attach != NULL), "attach");
+
+ impl = (struct icalvalue_impl *) value;
+ icalattach_ref (attach);
- icalvalue_reset_kind(impl);
+ if (impl->data.v_attach)
+ icalattach_unref (impl->data.v_attach);
+
+ impl->data.v_attach = attach;
}
-const char* icalvalue_get_binary(icalvalue* value) {
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_BINARY_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+icalattach *
+icalvalue_get_attach (const icalvalue *value)
+{
+ icalerror_check_arg_rz ((value != NULL), "value");
+ icalerror_check_value_type (value, ICAL_ATTACH_VALUE);
+
+ return value->data.v_attach;
}
+
+
+
+
+
+
+
+/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
+ types */
+
+
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalderivedvalue.h b/libical/src/libical/icalderivedvalue.h
index 8324f04..7043ae7 100644
--- a/libical/src/libical/icalderivedvalue.h
+++ b/libical/src/libical/icalderivedvalue.h
@@ -36,4 +36,5 @@
#include "icalperiod.h"
+#include "icalattach.h"
-typedef void icalvalue;
+typedef struct icalvalue_impl icalvalue;
@@ -43,7 +44,3 @@ void icalvalue_set_x(icalvalue* value, const char* v);
icalvalue* icalvalue_new_x(const char* v);
-const char* icalvalue_get_x(icalvalue* value);
-
-icalvalue* icalvalue_new_attach (struct icalattachtype* v);
-void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v);
-struct icalattachtype* icalvalue_get_attach(icalvalue* value);
+const char* icalvalue_get_x(const icalvalue* value);
@@ -51,3 +48,3 @@ icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
-struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
+struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value);
@@ -55,3 +52,3 @@ icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
-struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
+struct icaltriggertype icalvalue_get_trigger(const icalvalue* value);
@@ -59,3 +56,7 @@ icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
+struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value);
+
+icalvalue *icalvalue_new_attach (icalattach *attach);
+void icalvalue_set_attach (icalvalue *value, icalattach *attach);
+icalattach *icalvalue_get_attach (const icalvalue *value);
@@ -63,3 +64,2 @@ void icalvalue_reset_kind(icalvalue* value);
-/* Everything below this line is machine generated. Do not edit. */
typedef enum icalvalue_kind {
@@ -67,28 +67,29 @@ typedef enum icalvalue_kind {
ICAL_QUERY_VALUE=5001,
- ICAL_TRIGGER_VALUE=5002,
- ICAL_STATUS_VALUE=5003,
- ICAL_TRANSP_VALUE=5004,
- ICAL_CLASS_VALUE=5005,
- ICAL_DATE_VALUE=5006,
+ ICAL_DATE_VALUE=5002,
+ ICAL_ATTACH_VALUE=5003,
+ ICAL_GEO_VALUE=5004,
+ ICAL_STATUS_VALUE=5005,
+ ICAL_TRANSP_VALUE=5006,
ICAL_STRING_VALUE=5007,
- ICAL_INTEGER_VALUE=5008,
- ICAL_PERIOD_VALUE=5009,
- ICAL_TEXT_VALUE=5010,
- ICAL_DURATION_VALUE=5011,
- ICAL_BOOLEAN_VALUE=5012,
- ICAL_URI_VALUE=5013,
- ICAL_DATETIMEPERIOD_VALUE=5014,
- ICAL_GEO_VALUE=5015,
- ICAL_DATETIME_VALUE=5016,
- ICAL_UTCOFFSET_VALUE=5017,
- ICAL_ATTACH_VALUE=5018,
- ICAL_ACTION_VALUE=5019,
+ ICAL_TEXT_VALUE=5008,
+ ICAL_REQUESTSTATUS_VALUE=5009,
+ ICAL_BINARY_VALUE=5010,
+ ICAL_PERIOD_VALUE=5011,
+ ICAL_FLOAT_VALUE=5012,
+ ICAL_DATETIMEPERIOD_VALUE=5013,
+ ICAL_INTEGER_VALUE=5014,
+ ICAL_CLASS_VALUE=5015,
+ ICAL_URI_VALUE=5016,
+ ICAL_DURATION_VALUE=5017,
+ ICAL_BOOLEAN_VALUE=5018,
+ ICAL_X_VALUE=5019,
ICAL_CALADDRESS_VALUE=5020,
- ICAL_X_VALUE=5021,
- ICAL_FLOAT_VALUE=5022,
- ICAL_REQUESTSTATUS_VALUE=5023,
- ICAL_METHOD_VALUE=5024,
- ICAL_BINARY_VALUE=5025,
- ICAL_RECUR_VALUE=5026,
- ICAL_NO_VALUE=5027
+ ICAL_TRIGGER_VALUE=5021,
+ ICAL_XLICCLASS_VALUE=5022,
+ ICAL_RECUR_VALUE=5023,
+ ICAL_ACTION_VALUE=5024,
+ ICAL_DATETIME_VALUE=5025,
+ ICAL_UTCOFFSET_VALUE=5026,
+ ICAL_METHOD_VALUE=5027,
+ ICAL_NO_VALUE=5028
} icalvalue_kind ;
@@ -150,7 +151,41 @@ typedef enum icalproperty_transp {
ICAL_TRANSP_OPAQUE = 10039,
- ICAL_TRANSP_TRANSPARENT = 10040,
- ICAL_TRANSP_NONE = 10041
+ ICAL_TRANSP_OPAQUENOCONFLICT = 10040,
+ ICAL_TRANSP_TRANSPARENT = 10041,
+ ICAL_TRANSP_TRANSPARENTNOCONFLICT = 10042,
+ ICAL_TRANSP_NONE = 10043
} icalproperty_transp;
-#define ICALPROPERTY_LAST_ENUM 10042
+typedef enum icalproperty_xlicclass {
+ ICAL_XLICCLASS_X = 10044,
+ ICAL_XLICCLASS_PUBLISHNEW = 10045,
+ ICAL_XLICCLASS_PUBLISHUPDATE = 10046,
+ ICAL_XLICCLASS_PUBLISHFREEBUSY = 10047,
+ ICAL_XLICCLASS_REQUESTNEW = 10048,
+ ICAL_XLICCLASS_REQUESTUPDATE = 10049,
+ ICAL_XLICCLASS_REQUESTRESCHEDULE = 10050,
+ ICAL_XLICCLASS_REQUESTDELEGATE = 10051,
+ ICAL_XLICCLASS_REQUESTNEWORGANIZER = 10052,
+ ICAL_XLICCLASS_REQUESTFORWARD = 10053,
+ ICAL_XLICCLASS_REQUESTSTATUS = 10054,
+ ICAL_XLICCLASS_REQUESTFREEBUSY = 10055,
+ ICAL_XLICCLASS_REPLYACCEPT = 10056,
+ ICAL_XLICCLASS_REPLYDECLINE = 10057,
+ ICAL_XLICCLASS_REPLYDELEGATE = 10058,
+ ICAL_XLICCLASS_REPLYCRASHERACCEPT = 10059,
+ ICAL_XLICCLASS_REPLYCRASHERDECLINE = 10060,
+ ICAL_XLICCLASS_ADDINSTANCE = 10061,
+ ICAL_XLICCLASS_CANCELEVENT = 10062,
+ ICAL_XLICCLASS_CANCELINSTANCE = 10063,
+ ICAL_XLICCLASS_CANCELALL = 10064,
+ ICAL_XLICCLASS_REFRESH = 10065,
+ ICAL_XLICCLASS_COUNTER = 10066,
+ ICAL_XLICCLASS_DECLINECOUNTER = 10067,
+ ICAL_XLICCLASS_MALFORMED = 10068,
+ ICAL_XLICCLASS_OBSOLETE = 10069,
+ ICAL_XLICCLASS_MISSEQUENCED = 10070,
+ ICAL_XLICCLASS_UNKNOWN = 10071,
+ ICAL_XLICCLASS_NONE = 10072
+} icalproperty_xlicclass;
+
+#define ICALPROPERTY_LAST_ENUM 10073
@@ -159,3 +194,3 @@ typedef enum icalproperty_transp {
icalvalue* icalvalue_new_query(const char* v);
-const char* icalvalue_get_query(icalvalue* value);
+const char* icalvalue_get_query(const icalvalue* value);
void icalvalue_set_query(icalvalue* value, const char* v);
@@ -163,5 +198,17 @@ void icalvalue_set_query(icalvalue* value, const char* v);
+ /* DATE */
+icalvalue* icalvalue_new_date(struct icaltimetype v);
+struct icaltimetype icalvalue_get_date(const icalvalue* value);
+void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
+
+
+ /* GEO */
+icalvalue* icalvalue_new_geo(struct icalgeotype v);
+struct icalgeotype icalvalue_get_geo(const icalvalue* value);
+void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
+
+
/* STATUS */
icalvalue* icalvalue_new_status(enum icalproperty_status v);
-enum icalproperty_status icalvalue_get_status(icalvalue* value);
+enum icalproperty_status icalvalue_get_status(const icalvalue* value);
void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
@@ -171,3 +218,3 @@ void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
icalvalue* icalvalue_new_transp(enum icalproperty_transp v);
-enum icalproperty_transp icalvalue_get_transp(icalvalue* value);
+enum icalproperty_transp icalvalue_get_transp(const icalvalue* value);
void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
@@ -175,24 +222,24 @@ void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
- /* CLASS */
-icalvalue* icalvalue_new_class(enum icalproperty_class v);
-enum icalproperty_class icalvalue_get_class(icalvalue* value);
-void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
+ /* STRING */
+icalvalue* icalvalue_new_string(const char* v);
+const char* icalvalue_get_string(const icalvalue* value);
+void icalvalue_set_string(icalvalue* value, const char* v);
- /* DATE */
-icalvalue* icalvalue_new_date(struct icaltimetype v);
-struct icaltimetype icalvalue_get_date(icalvalue* value);
-void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
+ /* TEXT */
+icalvalue* icalvalue_new_text(const char* v);
+const char* icalvalue_get_text(const icalvalue* value);
+void icalvalue_set_text(icalvalue* value, const char* v);
- /* STRING */
-icalvalue* icalvalue_new_string(const char* v);
-const char* icalvalue_get_string(icalvalue* value);
-void icalvalue_set_string(icalvalue* value, const char* v);
+ /* REQUEST-STATUS */
+icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
+struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value);
+void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
- /* INTEGER */
-icalvalue* icalvalue_new_integer(int v);
-int icalvalue_get_integer(icalvalue* value);
-void icalvalue_set_integer(icalvalue* value, int v);
+ /* BINARY */
+icalvalue* icalvalue_new_binary(const char* v);
+const char* icalvalue_get_binary(const icalvalue* value);
+void icalvalue_set_binary(icalvalue* value, const char* v);
@@ -201,3 +248,3 @@ void icalvalue_set_integer(icalvalue* value, int v);
icalvalue* icalvalue_new_period(struct icalperiodtype v);
-struct icalperiodtype icalvalue_get_period(icalvalue* value);
+struct icalperiodtype icalvalue_get_period(const icalvalue* value);
void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
@@ -205,18 +252,18 @@ void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
- /* TEXT */
-icalvalue* icalvalue_new_text(const char* v);
-const char* icalvalue_get_text(icalvalue* value);
-void icalvalue_set_text(icalvalue* value, const char* v);
+ /* FLOAT */
+icalvalue* icalvalue_new_float(float v);
+float icalvalue_get_float(const icalvalue* value);
+void icalvalue_set_float(icalvalue* value, float v);
- /* DURATION */
-icalvalue* icalvalue_new_duration(struct icaldurationtype v);
-struct icaldurationtype icalvalue_get_duration(icalvalue* value);
-void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
+ /* INTEGER */
+icalvalue* icalvalue_new_integer(int v);
+int icalvalue_get_integer(const icalvalue* value);
+void icalvalue_set_integer(icalvalue* value, int v);
- /* BOOLEAN */
-icalvalue* icalvalue_new_boolean(int v);
-int icalvalue_get_boolean(icalvalue* value);
-void icalvalue_set_boolean(icalvalue* value, int v);
+ /* CLASS */
+icalvalue* icalvalue_new_class(enum icalproperty_class v);
+enum icalproperty_class icalvalue_get_class(const icalvalue* value);
+void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
@@ -225,3 +272,3 @@ void icalvalue_set_boolean(icalvalue* value, int v);
icalvalue* icalvalue_new_uri(const char* v);
-const char* icalvalue_get_uri(icalvalue* value);
+const char* icalvalue_get_uri(const icalvalue* value);
void icalvalue_set_uri(icalvalue* value, const char* v);
@@ -229,18 +276,24 @@ void icalvalue_set_uri(icalvalue* value, const char* v);
- /* GEO */
-icalvalue* icalvalue_new_geo(struct icalgeotype v);
-struct icalgeotype icalvalue_get_geo(icalvalue* value);
-void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
+ /* DURATION */
+icalvalue* icalvalue_new_duration(struct icaldurationtype v);
+struct icaldurationtype icalvalue_get_duration(const icalvalue* value);
+void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
- /* DATE-TIME */
-icalvalue* icalvalue_new_datetime(struct icaltimetype v);
-struct icaltimetype icalvalue_get_datetime(icalvalue* value);
-void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
+ /* BOOLEAN */
+icalvalue* icalvalue_new_boolean(int v);
+int icalvalue_get_boolean(const icalvalue* value);
+void icalvalue_set_boolean(icalvalue* value, int v);
- /* UTC-OFFSET */
-icalvalue* icalvalue_new_utcoffset(int v);
-int icalvalue_get_utcoffset(icalvalue* value);
-void icalvalue_set_utcoffset(icalvalue* value, int v);
+ /* CAL-ADDRESS */
+icalvalue* icalvalue_new_caladdress(const char* v);
+const char* icalvalue_get_caladdress(const icalvalue* value);
+void icalvalue_set_caladdress(icalvalue* value, const char* v);
+
+
+ /* X-LIC-CLASS */
+icalvalue* icalvalue_new_xlicclass(enum icalproperty_xlicclass v);
+enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value);
+void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v);
@@ -249,3 +302,3 @@ void icalvalue_set_utcoffset(icalvalue* value, int v);
icalvalue* icalvalue_new_action(enum icalproperty_action v);
-enum icalproperty_action icalvalue_get_action(icalvalue* value);
+enum icalproperty_action icalvalue_get_action(const icalvalue* value);
void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
@@ -253,18 +306,12 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
- /* CAL-ADDRESS */
-icalvalue* icalvalue_new_caladdress(const char* v);
-const char* icalvalue_get_caladdress(icalvalue* value);
-void icalvalue_set_caladdress(icalvalue* value, const char* v);
-
-
- /* FLOAT */
-icalvalue* icalvalue_new_float(float v);
-float icalvalue_get_float(icalvalue* value);
-void icalvalue_set_float(icalvalue* value, float v);
+ /* DATE-TIME */
+icalvalue* icalvalue_new_datetime(struct icaltimetype v);
+struct icaltimetype icalvalue_get_datetime(const icalvalue* value);
+void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
- /* REQUEST-STATUS */
-icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
-struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value);
-void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
+ /* UTC-OFFSET */
+icalvalue* icalvalue_new_utcoffset(int v);
+int icalvalue_get_utcoffset(const icalvalue* value);
+void icalvalue_set_utcoffset(icalvalue* value, int v);
@@ -273,11 +320,5 @@ void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
icalvalue* icalvalue_new_method(enum icalproperty_method v);
-enum icalproperty_method icalvalue_get_method(icalvalue* value);
+enum icalproperty_method icalvalue_get_method(const icalvalue* value);
void icalvalue_set_method(icalvalue* value, enum icalproperty_method v);
-
- /* BINARY */
-icalvalue* icalvalue_new_binary(const char* v);
-const char* icalvalue_get_binary(icalvalue* value);
-void icalvalue_set_binary(icalvalue* value, const char* v);
-
#endif /*ICALVALUE_H*/
diff --git a/libical/src/libical/icalduration.c b/libical/src/libical/icalduration.c
index 4468e0f..821a3b7 100644
--- a/libical/src/libical/icalduration.c
+++ b/libical/src/libical/icalduration.c
@@ -38,10 +38,5 @@
-#ifdef ICAL_NO_LIBICAL
-#define icalerror_set_errno(x)
-#define icalerror_check_arg_rv(x,y)
-#define icalerror_check_arg_re(x,y,z)
-#else
#include "icalerror.h"
#include "icalmemory.h"
-#endif
+#include "icalvalue.h"
@@ -53,30 +48,28 @@ struct icaldurationtype icaldurationtype_from_int(int t)
{
- struct icaldurationtype dur;
- int used = 0;
-
- dur = icaldurationtype_null_duration();
-
- if(t < 0){
- dur.is_neg = 1;
- t = -t;
- }
-
- if (t % (60 * 60 * 24 * 7) == 0) {
- dur.weeks = t / (60 * 60 * 24 * 7);
- } else {
- used += dur.weeks * (60 * 60 * 24 * 7);
- dur.days = (t - used) / (60 * 60 * 24);
- used += dur.days * (60 * 60 * 24);
- dur.hours = (t - used) / (60 * 60);
- used += dur.hours * (60 * 60);
- dur.minutes = (t - used) / (60);
- used += dur.minutes * (60);
- dur.seconds = (t - used);
- }
+ struct icaldurationtype dur;
+ int used = 0;
+
+ dur = icaldurationtype_null_duration();
+
+ if(t < 0){
+ dur.is_neg = 1;
+ t = -t;
+ }
+
+ if (t % (60 * 60 * 24 * 7) == 0) {
+ dur.weeks = t / (60 * 60 * 24 * 7);
+ } else {
+ used += dur.weeks * (60 * 60 * 24 * 7);
+ dur.days = (t - used) / (60 * 60 * 24);
+ used += dur.days * (60 * 60 * 24);
+ dur.hours = (t - used) / (60 * 60);
+ used += dur.hours * (60 * 60);
+ dur.minutes = (t - used) / (60);
+ used += dur.minutes * (60);
+ dur.seconds = (t - used);
+ }
- return dur;
+ return dur;
}
-#ifndef ICAL_NO_LIBICAL
-#include "icalvalue.h"
struct icaldurationtype icaldurationtype_from_string(const char* str)
@@ -140,3 +133,3 @@ struct icaldurationtype icaldurationtype_from_string(const char* str)
/* Get all of the digits, not one at a time */
- scan_size = sscanf((char*)(str+i),"%d",&digits);
+ scan_size = sscanf(&str[i],"%d",&digits);
if(scan_size == 0) goto error;
@@ -189,5 +182,3 @@ struct icaldurationtype icaldurationtype_from_string(const char* str)
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- memset(&d, 0, sizeof(struct icaldurationtype));
- return d;
-
+ return icaldurationtype_bad_duration();
}
@@ -195,2 +186,3 @@ struct icaldurationtype icaldurationtype_from_string(const char* str)
#define TMP_BUF_SIZE 1024
+static
void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size,
@@ -255,3 +247,3 @@ char* icaldurationtype_as_ical_string(struct icaldurationtype d)
} else {
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PTS0");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PT0S");
}
@@ -265,4 +257,2 @@ char* icaldurationtype_as_ical_string(struct icaldurationtype d)
-#endif
-
@@ -279,3 +269,3 @@ int icaldurationtype_as_int(struct icaldurationtype dur)
-struct icaldurationtype icaldurationtype_null_duration()
+struct icaldurationtype icaldurationtype_null_duration(void)
{
@@ -297,2 +287,21 @@ int icaldurationtype_is_null_duration(struct icaldurationtype d)
+/* in icalvalue_new_from_string_with_error, we should not call
+ icaldurationtype_is_null_duration() to see if there is an error
+ condition. Null duration is perfectly valid for an alarm.
+ We cannot depend on the caller to check icalerrno either,
+ following the philosophy of unix errno. we set the is_neg
+ to -1 to indicate that this is a bad duration.
+*/
+struct icaldurationtype icaldurationtype_bad_duration()
+{
+ struct icaldurationtype d;
+ memset(&d,0,sizeof(struct icaldurationtype));
+ d.is_neg = -1;
+ return d;
+}
+
+int icaldurationtype_is_bad_duration(struct icaldurationtype d)
+{
+ return (d.is_neg == -1);
+}
@@ -318,3 +327,3 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
- return icaldurationtype_from_int(t1t-t2t);
+ return icaldurationtype_from_int((int)(t1t-t2t));
diff --git a/libical/src/libical/icalduration.h b/libical/src/libical/icalduration.h
index dd6e311..0e64cad 100644
--- a/libical/src/libical/icalduration.h
+++ b/libical/src/libical/icalduration.h
@@ -47,4 +47,6 @@ int icaldurationtype_as_int(struct icaldurationtype duration);
char* icaldurationtype_as_ical_string(struct icaldurationtype d);
-struct icaldurationtype icaldurationtype_null_duration();
+struct icaldurationtype icaldurationtype_null_duration(void);
+struct icaldurationtype icaldurationtype_bad_duration(void);
int icaldurationtype_is_null_duration(struct icaldurationtype d);
+int icaldurationtype_is_bad_duration(struct icaldurationtype d);
diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c
index 6751933..66c5ccd 100644
--- a/libical/src/libical/icalenums.c
+++ b/libical/src/libical/icalenums.c
@@ -36,6 +36,7 @@
#include <assert.h>
+#include "icalmemory.h"
-
-
-struct {
+/*** @brief Allowed request status values
+ */
+static struct {
enum icalrequeststatus kind;
@@ -72,3 +73,7 @@ struct {
{ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."},
+ {ICAL_3_15_INVCOMMAND, 3,15,"Invalid command."},
{ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."},
+ {ICAL_4_1_STORE_ACCESS_DENIED, 4,1,"Store Access Denied."},
+ {ICAL_4_2_STORE_FAILED, 4,2,"Store Failed."},
+ {ICAL_4_3_STORE_NOT_FOUND, 4,3,"Store not found."},
{ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."},
@@ -77,2 +82,4 @@ struct {
{ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."},
+ {ICAL_6_1_CONTAINER_NOT_FOUND, 6,1,"Container not found."},
+ {ICAL_9_0_UNRECOGNIZED_COMMAND, 9,0,"An unrecognized command was received."},
{ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"}
@@ -81,5 +88,6 @@ struct {
+/*** @brief Return the descriptive text for a request status
+ */
const char* icalenum_reqstat_desc(icalrequeststatus stat)
{
-
int i;
@@ -95,3 +103,22 @@ const char* icalenum_reqstat_desc(icalrequeststatus stat)
+/*** @brief Return the code for a request status
+ */
+char* icalenum_reqstat_code(icalrequeststatus stat)
+{
+ int i, major, minor;
+ char tmpbuf[36];
+
+ for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
+ if ( request_status_map[i].kind == stat) {
+ major = request_status_map[i].major;
+ minor = request_status_map[i].minor;
+ sprintf(tmpbuf, "%i.%i", major, minor);
+ return icalmemory_tmp_copy(tmpbuf);
+ }
+ }
+ return NULL;
+}
+/*** @brief Return the major number for a request status
+ */
short icalenum_reqstat_major(icalrequeststatus stat)
@@ -108,2 +135,4 @@ short icalenum_reqstat_major(icalrequeststatus stat)
+/*** @brief Return the minor number for a request status
+ */
short icalenum_reqstat_minor(icalrequeststatus stat)
@@ -121,2 +150,4 @@ short icalenum_reqstat_minor(icalrequeststatus stat)
+/*** @brief Return a request status for major/minor status numbers
+ */
icalrequeststatus icalenum_num_to_reqstat(short major, short minor)
diff --git a/libical/src/libical/icalenums.h b/libical/src/libical/icalenums.h
index 21031dd..b00907f 100644
--- a/libical/src/libical/icalenums.h
+++ b/libical/src/libical/icalenums.h
@@ -45,2 +45,3 @@ typedef enum icalcomponent_kind {
ICAL_VCALENDAR_COMPONENT,
+ ICAL_VAGENDA_COMPONENT,
ICAL_VFREEBUSY_COMPONENT,
@@ -100,3 +101,7 @@ typedef enum icalrequeststatus {
ICAL_3_14_NOCAP_STATUS,
+ ICAL_3_15_INVCOMMAND,
ICAL_4_0_BUSY_STATUS,
+ ICAL_4_1_STORE_ACCESS_DENIED,
+ ICAL_4_2_STORE_FAILED,
+ ICAL_4_3_STORE_NOT_FOUND,
ICAL_5_0_MAYBE_STATUS,
@@ -104,3 +109,5 @@ typedef enum icalrequeststatus {
ICAL_5_2_NOSERVICE_STATUS,
- ICAL_5_3_NOSCHED_STATUS
+ ICAL_5_3_NOSCHED_STATUS,
+ ICAL_6_1_CONTAINER_NOT_FOUND,
+ ICAL_9_0_UNRECOGNIZED_COMMAND
} icalrequeststatus;
@@ -112,2 +119,3 @@ short icalenum_reqstat_minor(icalrequeststatus stat);
icalrequeststatus icalenum_num_to_reqstat(short major, short minor);
+char* icalenum_reqstat_code(icalrequeststatus stat);
diff --git a/libical/src/libical/icalerror.c b/libical/src/libical/icalerror.c
index d44d37a..61043b2 100644
--- a/libical/src/libical/icalerror.c
+++ b/libical/src/libical/icalerror.c
@@ -31,9 +31,49 @@
+#include <stdlib.h> /* for malloc() */
+#include <string.h> /* for strcmp */
#include "icalerror.h"
-#include <string.h>
+#ifdef HAVE_PTHREAD
+#include <pthread.h>
-icalerrorenum icalerrno;
+static pthread_key_t icalerrno_key;
+static pthread_once_t icalerrno_key_once = PTHREAD_ONCE_INIT;
+
+static void icalerrno_destroy(void* buf) {
+ free(buf);
+ pthread_setspecific(icalerrno_key, NULL);
+}
+
+static void icalerrno_key_alloc(void) {
+ pthread_key_create(&icalerrno_key, icalerrno_destroy);
+}
+
+icalerrorenum *icalerrno_return(void) {
+ icalerrorenum *_errno;
+
+ pthread_once(&icalerrno_key_once, icalerrno_key_alloc);
+
+ _errno = (icalerrorenum*) pthread_getspecific(icalerrno_key);
+
+ if (!_errno) {
+ _errno = malloc(sizeof(icalerrorenum));
+ *_errno = ICAL_NO_ERROR;
+ pthread_setspecific(icalerrno_key, _errno);
+ }
+ return _errno;
+}
+
+#else
+
+static icalerrorenum icalerrno_storage = ICAL_NO_ERROR;
+
+icalerrorenum *icalerrno_return(void) {
+ return &icalerrno_storage;
+}
+
+#endif
+
+
+static int foo;
-int foo;
void icalerror_stop_here(void)
@@ -81,3 +121,3 @@ struct icalerror_state {
-struct icalerror_state error_state_map[] =
+static struct icalerror_state error_state_map[] =
{
@@ -85,2 +125,3 @@ struct icalerror_state error_state_map[] =
{ ICAL_NEWFAILED_ERROR,ICAL_ERROR_DEFAULT},
+ { ICAL_ALLOCATION_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_DEFAULT},
@@ -106,2 +147,3 @@ static struct icalerror_string_map string_map[] =
{ "NEWFAILED",ICAL_NEWFAILED_ERROR,"NEWFAILED: Failed to create a new object via a *_new() routine"},
+ { "ALLOCATION",ICAL_ALLOCATION_ERROR,"ALLOCATION: Failed to allocate new memory"},
{"MALFORMEDDATA",ICAL_MALFORMEDDATA_ERROR,"MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties"},
@@ -170,3 +212,3 @@ void icalerror_set_error_state( icalerrorenum error,
- for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
+ for(i = 0; error_state_map[i].error!= ICAL_NO_ERROR;i++){
if(error_state_map[i].error == error){
@@ -181,3 +223,3 @@ icalerrorstate icalerror_get_error_state( icalerrorenum error)
- for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
+ for(i = 0; error_state_map[i].error!= ICAL_NO_ERROR;i++){
if(error_state_map[i].error == error){
diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h
index 52f5ba9..826c8e8 100644
--- a/libical/src/libical/icalerror.h
+++ b/libical/src/libical/icalerror.h
@@ -40,3 +40,3 @@
-/* This routine is called before any error is triggered. It is called
+/** This routine is called before any error is triggered. It is called
by icalerror_set_errno, so it does not appear in all of the macros
@@ -48,3 +48,3 @@ void icalerror_crash_here(void);
typedef enum icalerrorenum {
-
+ ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */
ICAL_BADARG_ERROR,
@@ -58,4 +58,3 @@ typedef enum icalerrorenum {
ICAL_UNIMPLEMENTED_ERROR,
- ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/
- ICAL_NO_ERROR
+ ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/
@@ -63,6 +62,10 @@ typedef enum icalerrorenum {
-/* The libical error enumeration, like errno*/
-extern icalerrorenum icalerrno;
+icalerrorenum * icalerrno_return(void);
+#define icalerrno (*(icalerrno_return()))
-/* If true, libicl aborts after a call to icalerror_set_error*/
+/** If true, libicl aborts after a call to icalerror_set_error
+ *
+ * @warning NOT THREAD SAFE -- recommended that you do not change
+ * this in a multithreaded program.
+ */
extern int icalerror_errors_are_fatal;
@@ -79,2 +82,3 @@ extern int icalerror_errors_are_fatal;
void icalerror_clear_errno(void);
+void _icalerror_set_errno(icalerrorenum);
@@ -96,2 +100,3 @@ icalerrorstate icalerror_get_error_state( icalerrorenum error);
icalerrno = x; \
+ fprintf(stderr,"Ical error # %d\n", x); \
if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
@@ -101,5 +106,5 @@ if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
assert(0); \
-}
+}
#else
-void icalerror_set_errno(icalerrorenum);
+void icalerror_set_errno(icalerrorenum x);
#endif
diff --git a/libical/src/libical/icallangbind.c b/libical/src/libical/icallangbind.c
index c079034..1a3ad48 100644
--- a/libical/src/libical/icallangbind.c
+++ b/libical/src/libical/icallangbind.c
@@ -24,7 +24,10 @@
#include "icalmemory.h"
+#include "icalvalue.h"
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
-int snprintf(char *str, size_t n, char const *fmt, ...);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
@@ -43,7 +46,24 @@ int icallangbind_access_array(int* array, int index) {
+/** Iterators to fetch parameters given property */
+icalparameter* icallangbind_get_first_parameter(icalproperty *prop)
-/* LIke icalcomponent_get_first_component, buut takes a string for the
+{
+ icalparameter_kind kind = ICAL_ANY_PARAMETER;
+
+ return icalproperty_get_first_parameter(prop,kind);
+}
+
+icalparameter* icallangbind_get_next_parameter(icalproperty *prop)
+{
+ icalparameter_kind kind = ICAL_ANY_PARAMETER;
+
+ return icalproperty_get_next_parameter(prop,kind);
+}
+
+
+/** Like icalcomponent_get_first_component(), but takes a string for the
kind and can iterate over X properties as if each X name was a
seperate kind */
+
icalproperty* icallangbind_get_first_property(icalcomponent *c,
@@ -134,2 +154,3 @@ icalcomponent* icallangbind_get_next_component(icalcomponent *c,
+
const char* icallangbind_property_eval_string(icalproperty* prop, char* sep)
@@ -155,3 +176,3 @@ const char* icallangbind_property_eval_string(icalproperty* prop, char* sep)
APPENDC('\'');
- APPENDS(icalenum_property_kind_to_string(icalproperty_isa(prop)));
+ APPENDS(icalproperty_kind_to_string(icalproperty_isa(prop)));
APPENDC('\'');
@@ -162,3 +183,3 @@ const char* icallangbind_property_eval_string(icalproperty* prop, char* sep)
APPENDC('\'');
- APPENDS(icalenum_value_kind_to_string(icalvalue_isa(value)));
+ APPENDS(icalvalue_kind_to_string(icalvalue_isa(value)));
APPENDC('\'');
@@ -271,2 +292,3 @@ int icallangbind_string_to_open_flag(const char* str)
else if (strcmp(str,"w") == 0) {return O_WRONLY;}
+ else if (strcmp(str,"w+") == 0) {return O_RDWR|O_CREAT;}
else if (strcmp(str,"a") == 0) {return O_WRONLY|O_APPEND;}
@@ -275 +297,16 @@ int icallangbind_string_to_open_flag(const char* str)
+
+const char* icallangbind_quote_as_ical(const char* str)
+{
+ size_t buf_size = 2 * strlen(str);
+
+ /* assume every char could be quoted */
+ char* buf = icalmemory_new_buffer(buf_size);
+ int result;
+
+ result = icalvalue_encode_ical_string(str, buf, buf_size);
+
+ icalmemory_add_tmp_buffer(buf);
+
+ return buf;
+}
diff --git a/libical/src/libical/icallangbind.h b/libical/src/libical/icallangbind.h
index 2ed5003..fed3626 100644
--- a/libical/src/libical/icallangbind.h
+++ b/libical/src/libical/icallangbind.h
@@ -43,2 +43,5 @@ icalcomponent* icallangbind_get_next_component(icalcomponent *c,
+icalparameter* icallangbind_get_first_parameter(icalproperty *prop);
+
+icalparameter* icallangbind_get_next_parameter(icalproperty *prop);
@@ -48,2 +51,4 @@ const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
int icallangbind_string_to_open_flag(const char* str);
+
+const char* icallangbind_quote_as_ical(const char* str);
#endif /*__ICALLANGBIND_H__*/
diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c
index 297ead8..058ef37 100644
--- a/libical/src/libical/icalmemory.c
+++ b/libical/src/libical/icalmemory.c
@@ -34,3 +34,7 @@
-/* libical often passes strings back to the caller. To make these
+/**
+ * @file icalmemory.c
+ * @brief Common memory management routines.
+ *
+ * libical often passes strings back to the caller. To make these
* interfaces simple, I did not want the caller to have to pass in a
@@ -43,3 +47,4 @@
* several buffers active simultaneously, which is handy when creating
- * string representations of components. */
+ * string representations of components.
+ */
@@ -62,29 +67,95 @@
-#define BUFFER_RING_SIZE 25
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#define BUFFER_RING_SIZE 2500
#define MIN_BUFFER_SIZE 200
+
+/* HACK. Not threadsafe */
+
+typedef struct {
+ int pos;
+ void *ring[BUFFER_RING_SIZE];
+} buffer_ring;
+
void icalmemory_free_tmp_buffer (void* buf);
+void icalmemory_free_ring_byval(buffer_ring *br);
+static buffer_ring* global_buffer_ring = 0;
-/* HACK. Not threadsafe */
-void* buffer_ring[BUFFER_RING_SIZE];
-int buffer_pos = -1;
-int initialized = 0;
+#ifdef HAVE_PTHREAD
+#include <pthread.h>
-/* Add an existing buffer to the buffer ring */
-void icalmemory_add_tmp_buffer(void* buf)
-{
- /* I don't think I need this -- I think static arrays are
- initialized to 0 as a standard part of C, but I am not sure. */
- if (initialized == 0){
+static pthread_key_t ring_key;
+static pthread_once_t ring_key_once = PTHREAD_ONCE_INIT;
+
+static void ring_destroy(void * buf) {
+ if (buf) icalmemory_free_ring_byval((buffer_ring *) buf);
+ pthread_setspecific(ring_key, NULL);
+}
+
+static void ring_key_alloc(void) {
+ pthread_key_create(&ring_key, ring_destroy);
+}
+#endif
+
+
+static buffer_ring * buffer_ring_new(void) {
+ buffer_ring *br;
int i;
+
+ br = (buffer_ring *)malloc(sizeof(buffer_ring));
+
for(i=0; i<BUFFER_RING_SIZE; i++){
- buffer_ring[i] = 0;
+ br->ring[i] = 0;
}
- initialized = 1;
+ br->pos = 0;
+ return(br);
+}
+
+
+#ifdef HAVE_PTHREAD
+static buffer_ring* get_buffer_ring_pthread(void) {
+ buffer_ring *br;
+
+ pthread_once(&ring_key_once, ring_key_alloc);
+
+ br = pthread_getspecific(ring_key);
+
+ if (!br) {
+ br = buffer_ring_new();
+ pthread_setspecific(ring_key, br);
}
+ return(br);
+}
+#endif
+
+/* get buffer ring via a single global for a non-threaded program */
+static buffer_ring* get_buffer_ring_global(void) {
+ if (global_buffer_ring == 0) {
+ global_buffer_ring = buffer_ring_new();
+ }
+ return(global_buffer_ring);
+}
+
+static buffer_ring *get_buffer_ring(void) {
+#ifdef HAVE_PTHREAD
+ return(get_buffer_ring_pthread());
+#else
+ return get_buffer_ring_global();
+#endif
+}
+
+
+/** Add an existing buffer to the buffer ring */
+void icalmemory_add_tmp_buffer(void* buf)
+{
+ buffer_ring *br = get_buffer_ring();
+
/* Wrap around the ring */
- if(++buffer_pos == BUFFER_RING_SIZE){
- buffer_pos = 0;
+ if(++(br->pos) == BUFFER_RING_SIZE){
+ br->pos = 0;
}
@@ -92,5 +163,4 @@ void icalmemory_add_tmp_buffer(void* buf)
/* Free buffers as their slots are overwritten */
- if ( buffer_ring[buffer_pos] != 0){
- free( buffer_ring[buffer_pos]);
- buffer_ring[buffer_pos] = 0;
+ if ( br->ring[br->pos] != 0){
+ free( br->ring[br->pos]);
}
@@ -98,7 +168,11 @@ void icalmemory_add_tmp_buffer(void* buf)
/* Assign the buffer to a slot */
- buffer_ring[buffer_pos] = buf;
+ br->ring[br->pos] = buf;
}
-/* Create a new temporary buffer on the ring. Libical owns these and
- wil deallocate them. */
+
+/**
+ * Create a new temporary buffer on the ring. Libical owns these and
+ * will deallocate them.
+ */
+
void*
@@ -126,15 +200,19 @@ icalmemory_tmp_buffer (size_t size)
-void icalmemory_free_ring()
-{
-
+/** get rid of this buffer ring */
+void icalmemory_free_ring_byval(buffer_ring *br) {
int i;
for(i=0; i<BUFFER_RING_SIZE; i++){
- if ( buffer_ring[i] != 0){
- free( buffer_ring[i]);
+ if ( br->ring[i] != 0){
+ free( br->ring[i]);
}
- buffer_ring[i] = 0;
- }
+ }
+ free(br);
+}
- initialized = 1;
+void icalmemory_free_ring()
+{
+ buffer_ring *br;
+ br = get_buffer_ring();
+ icalmemory_free_ring_byval(br);
}
@@ -143,3 +221,3 @@ void icalmemory_free_ring()
-/* Like strdup, but the buffer is on the ring. */
+/** Like strdup, but the buffer is on the ring. */
char*
@@ -172,4 +250,6 @@ icalmemory_free_tmp_buffer (void* buf)
-/* These buffer routines create memory the old fashioned way -- so the
- caller will have to delocate the new memory */
+/*
+ * These buffer routines create memory the old fashioned way -- so the
+ * caller will have to deallocate the new memory
+ */
diff --git a/libical/src/libical/icalmemory.h b/libical/src/libical/icalmemory.h
index f833c6c..7c42566 100644
--- a/libical/src/libical/icalmemory.h
+++ b/libical/src/libical/icalmemory.h
@@ -28,9 +28,7 @@
+#ifndef WIN32
#include <sys/types.h> /* for size_t */
-
-// Eugen C. <eug@thekompany.com>
-#ifdef _WIN32
+#else
#include <stddef.h>
#endif
-// Eugen C. <eug@thekompany.com>
@@ -42,3 +40,3 @@ char* icalmemory_tmp_copy(const char* str);
-/* Add an externally allocated buffer to the ring. */
+/** Add an externally allocated buffer to the ring. */
void icalmemory_add_tmp_buffer(void*);
@@ -46,3 +44,3 @@ void icalmemory_add_tmp_buffer(void*);
-/* Free all memory used in the ring */
+/** Free all memory used in the ring */
void icalmemory_free_ring(void);
@@ -57,3 +55,4 @@ void icalmemory_free_buffer(void* buf);
-/* icalmemory_append_string will copy the string 'string' to the
+/**
+ icalmemory_append_string will copy the string 'string' to the
buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
@@ -73,3 +72,3 @@ void icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
-/* icalmemory_append_char is similar, but is appends a character instead of a string */
+/** icalmemory_append_char is similar, but is appends a character instead of a string */
void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
@@ -77,4 +76,4 @@ void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
-/* A wrapper around strdup. Partly to trap calls to strdup, partly
- because in -ansi, gcc on Red Hat claims that strudup is undeclared */
+/** A wrapper around strdup. Partly to trap calls to strdup, partly
+ because in -ansi, gcc on Red Hat claims that strdup is undeclared */
char* icalmemory_strdup(const char *s);
diff --git a/libical/src/libical/icalmime.c b/libical/src/libical/icalmime.c
index 7021746..12443c3 100644
--- a/libical/src/libical/icalmime.c
+++ b/libical/src/libical/icalmime.c
@@ -36,4 +36,2 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
-
#ifdef DMALLOC
@@ -42,2 +40,6 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c
index 156ecdb..759306f 100644
--- a/libical/src/libical/icalparameter.c
+++ b/libical/src/libical/icalparameter.c
@@ -80,7 +80,4 @@ icalparameter_new (icalparameter_kind kind)
void
-icalparameter_free (icalparameter* parameter)
+icalparameter_free (icalparameter* param)
{
- struct icalparameter_impl * impl;
-
- impl = (struct icalparameter_impl*)parameter;
@@ -91,6 +88,6 @@ icalparameter_free (icalparameter* parameter)
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
- icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. ");
+ icalerror_assert( (param->parent ==0),"Tried to free a parameter that is still attached to a component. ");
#else
- if(impl->parent !=0){
+ if(param->parent !=0){
return;
@@ -100,15 +97,15 @@ icalparameter_free (icalparameter* parameter)
- if (impl->string != 0){
- free ((void*)impl->string);
+ if (param->string != 0){
+ free ((void*)param->string);
}
- if (impl->x_name != 0){
- free ((void*)impl->x_name);
+ if (param->x_name != 0){
+ free ((void*)param->x_name);
}
- memset(impl,0,sizeof(impl));
+ memset(param,0,sizeof(param));
- impl->parent = 0;
- impl->id[0] = 'X';
- free(impl);
+ param->parent = 0;
+ param->id[0] = 'X';
+ free(param);
}
@@ -118,11 +115,9 @@ icalparameter_free (icalparameter* parameter)
icalparameter*
-icalparameter_new_clone(icalparameter* param)
+icalparameter_new_clone(icalparameter* old)
{
- struct icalparameter_impl *old;
struct icalparameter_impl *new;
- old = (struct icalparameter_impl *)param;
new = icalparameter_new_impl(old->kind);
- icalerror_check_arg_rz((param!=0),"param");
+ icalerror_check_arg_rz((old!=0),"param");
@@ -199,6 +194,16 @@ icalparameter* icalparameter_new_from_string(const char *str)
+/**
+ * Return a string representation of the parameter according to RFC2445.
+ *
+ * param = param-name "=" param-value
+ * param-name = iana-token / x-token
+ * param-value = paramtext /quoted-string
+ * paramtext = *SAFE-SHARE
+ * quoted-string= DQUOTE *QSAFE-CHARE DQUOTE
+ * QSAFE-CHAR = any character except CTLs and DQUOTE
+ * SAFE-CHAR = any character except CTLs, DQUOTE. ";", ":", ","
+ */
char*
-icalparameter_as_ical_string (icalparameter* parameter)
+icalparameter_as_ical_string (icalparameter* param)
{
- struct icalparameter_impl* impl;
size_t buf_size = 1024;
@@ -209,3 +214,3 @@ icalparameter_as_ical_string (icalparameter* parameter)
- icalerror_check_arg_rz( (parameter!=0), "parameter");
+ icalerror_check_arg_rz( (param!=0), "parameter");
@@ -219,8 +224,7 @@ icalparameter_as_ical_string (icalparameter* parameter)
buf_ptr = buf;
- impl = (struct icalparameter_impl*)parameter;
- if(impl->kind == ICAL_X_PARAMETER) {
+ if(param->kind == ICAL_X_PARAMETER) {
icalmemory_append_string(&buf, &buf_ptr, &buf_size,
- icalparameter_get_xname(impl));
+ icalparameter_get_xname(param));
@@ -228,6 +232,6 @@ icalparameter_as_ical_string (icalparameter* parameter)
- kind_string = icalparameter_kind_to_string(impl->kind);
+ kind_string = icalparameter_kind_to_string(param->kind);
- if (impl->kind == ICAL_NO_PARAMETER ||
- impl->kind == ICAL_ANY_PARAMETER ||
+ if (param->kind == ICAL_NO_PARAMETER ||
+ param->kind == ICAL_ANY_PARAMETER ||
kind_string == 0)
@@ -246,6 +250,16 @@ icalparameter_as_ical_string (icalparameter* parameter)
- if(impl->string !=0){
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string);
- } else if (impl->data != 0){
- const char* str = icalparameter_enum_to_string(impl->data);
+ if(param->string !=0){
+ int qm = 0;
+
+ /* Encapsulate the property in quotes if necessary */
+ if (strpbrk(param->string, ";:,") != 0) {
+ icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"');
+ qm = 1;
+ }
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, param->string);
+ if (qm == 1) {
+ icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"');
+ }
+ } else if (param->data != 0){
+ const char* str = icalparameter_enum_to_string(param->data);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
@@ -280,3 +294,3 @@ icalparameter_isa (icalparameter* parameter)
- return ((struct icalparameter_impl *)parameter)->kind;
+ return parameter->kind;
}
@@ -304,3 +318,2 @@ icalparameter_set_xname (icalparameter* param, const char* v)
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rv( (param!=0),"param");
@@ -308,9 +321,9 @@ icalparameter_set_xname (icalparameter* param, const char* v)
- if (impl->x_name != 0){
- free((void*)impl->x_name);
+ if (param->x_name != 0){
+ free((void*)param->x_name);
}
- impl->x_name = icalmemory_strdup(v);
+ param->x_name = icalmemory_strdup(v);
- if (impl->x_name == 0){
+ if (param->x_name == 0){
errno = ENOMEM;
@@ -323,6 +336,5 @@ icalparameter_get_xname (icalparameter* param)
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rz( (param!=0),"param");
- return impl->x_name;
+ return param->x_name;
}
@@ -332,4 +344,2 @@ icalparameter_set_xvalue (icalparameter* param, const char* v)
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
icalerror_check_arg_rv( (param!=0),"param");
@@ -337,9 +347,9 @@ icalparameter_set_xvalue (icalparameter* param, const char* v)
- if (impl->string != 0){
- free((void*)impl->string);
+ if (param->string != 0){
+ free((void*)param->string);
}
- impl->string = icalmemory_strdup(v);
+ param->string = icalmemory_strdup(v);
- if (impl->string == 0){
+ if (param->string == 0){
errno = ENOMEM;
@@ -352,8 +362,5 @@ icalparameter_get_xvalue (icalparameter* param)
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
icalerror_check_arg_rz( (param!=0),"param");
- return impl->string;
-
+ return param->string;
}
@@ -363,7 +370,5 @@ void icalparameter_set_parent(icalparameter* param,
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
icalerror_check_arg_rv( (param!=0),"param");
- impl->parent = property;
+ param->parent = property;
}
@@ -372,7 +377,5 @@ icalproperty* icalparameter_get_parent(icalparameter* param)
{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
icalerror_check_arg_rz( (param!=0),"param");
- return impl->parent;
+ return param->parent;
}
diff --git a/libical/src/libical/icalparameter.h b/libical/src/libical/icalparameter.h
index 3f3b59f..f3d64ab 100644
--- a/libical/src/libical/icalparameter.h
+++ b/libical/src/libical/icalparameter.h
@@ -34,3 +34,3 @@
/* Declared in icalderivedparameter.h */
-/*typedef void icalparameter;*/
+/*typedef struct icalparameter_impl icalparameter;*/
diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c
index b5824d5..5c4296b 100644
--- a/libical/src/libical/icalparser.c
+++ b/libical/src/libical/icalparser.c
@@ -1,2 +1,2 @@
-/* -*- Mode: C -*-
+/* -*- Mode: C; tab-width: 4; c-basic-offset: 8; -*-
======================================================================
@@ -40,5 +40,3 @@
-#include "icalparser.h"
#include "pvl.h"
-#include "icalmemory.h"
#include "icalerror.h"
@@ -54,9 +52,24 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
+#include "icalmemory.h"
+#include "icalparser.h"
+
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+/* Some systems have an imcomplete implementation on wctype (FreeBSD,
+ * Darwin). Cope with that. */
+# ifndef HAVE_ISWSPACE
+# define iswspace isspace
+# endif
+#else
+# ifndef HAVE_ISWSPACE
+# define iswspace isspace
+# endif
+#endif
-extern icalvalue* icalparser_yy_value;
-void set_parser_value_state(icalvalue_kind kind);
-int ical_yyparse(void);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
-char* icalparser_get_next_char(char c, char *str);
+char* icalparser_get_next_char(char c, char *str, int qm);
char* icalparser_get_next_parameter(char* line,char** end);
@@ -83,3 +96,3 @@ struct icalparser_impl
void *line_gen_data;
-
+
};
@@ -102,2 +115,3 @@ icalparser* icalparser_new(void)
impl->buffer_full = 0;
+ impl->continuation_line = 0;
impl->lineno = 0;
@@ -112,10 +126,9 @@ void icalparser_free(icalparser* parser)
{
- struct icalparser_impl* impl = (struct icalparser_impl*)parser;
icalcomponent *c;
- if (impl->root_component != 0){
- icalcomponent_free(impl->root_component);
+ if (parser->root_component != 0){
+ icalcomponent_free(parser->root_component);
}
- while( (c=pvl_pop(impl->components)) != 0){
+ while( (c=pvl_pop(parser->components)) != 0){
icalcomponent_free(c);
@@ -123,5 +136,5 @@ void icalparser_free(icalparser* parser)
- pvl_free(impl->components);
+ pvl_free(parser->components);
- free(impl);
+ free(parser);
}
@@ -130,5 +143,3 @@ void icalparser_set_gen_data(icalparser* parser, void* data)
{
- struct icalparser_impl* impl = (struct icalparser_impl*)parser;
-
- impl->line_gen_data = data;
+ parser->line_gen_data = data;
}
@@ -142,3 +153,3 @@ icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind,
-char* icalparser_get_next_char(char c, char *str)
+char* icalparser_get_next_char(char c, char *str, int qm)
{
@@ -146,19 +157,19 @@ char* icalparser_get_next_char(char c, char *str)
char* p;
-
for(p=str; *p!=0; p++){
-
- if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){
- quote_mode =1;
- continue;
- }
-
- if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){
- quote_mode =0;
- continue;
- }
-
- if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){
- return p;
- }
+ if (qm == 1) {
+ if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){
+ quote_mode =1;
+ continue;
+ }
+
+ if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){
+ quote_mode =0;
+ continue;
+ }
+ }
+
+ if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){
+ return p;
+ }
@@ -169,6 +180,7 @@ char* icalparser_get_next_char(char c, char *str)
-/* make a new tmp buffer out of a substring */
-char* make_segment(char* start, char* end)
+
+/** make a new tmp buffer out of a substring */
+static char* make_segment(char* start, char* end)
{
- char *buf;
+ char *buf, *tmp;
size_t size = (size_t)end - (size_t)start;
@@ -180,60 +192,13 @@ char* make_segment(char* start, char* end)
*(buf+size) = 0;
+
+ tmp = (buf+size);
+ while ( *tmp == '\0' || iswspace(*tmp) )
+ {
+ *tmp = 0;
+ tmp--;
+ }
return buf;
-
}
-const char* input_buffer;
-const char* input_buffer_p;
-//#define min(a,b) ((a) < (b) ? (a) : (b))
-
-int icalparser_flex_input(char* buf, int max_size)
-{
- int n = max_size; // = min(max_size,strlen(input_buffer_p));
- if ( n < ((int )strlen(input_buffer_p)) )
- n = strlen(input_buffer_p);
- if (n > 0){
- memcpy(buf, input_buffer_p, n);
- input_buffer_p += n;
- return n;
- } else {
- return 0;
- }
-}
-
-void icalparser_clear_flex_input(void)
-{
- input_buffer_p = input_buffer+strlen(input_buffer);
-}
-
-/* Call the flex/bison parser to parse a complex value */
-
-icalvalue* icalparser_parse_value(icalvalue_kind kind,
- const char* str, icalproperty** error)
-{
- int r;
- input_buffer_p = input_buffer = str;
-
- set_parser_value_state(kind);
- icalparser_yy_value = 0;
-
- r = ical_yyparse();
-
- /* Error. Parse failed */
- if( icalparser_yy_value == 0 || r != 0){
-
- if(icalparser_yy_value !=0){
- icalvalue_free(icalparser_yy_value);
- icalparser_yy_value = 0;
- }
-
- return 0;
- }
-
- if (error != 0){
- *error = 0;
- }
-
- return icalparser_yy_value;
-}
@@ -245,4 +210,4 @@ char* icalparser_get_prop_name(char* line, char** end)
- p = icalparser_get_next_char(';',line);
- v = icalparser_get_next_char(':',line);
+ p = icalparser_get_next_char(';',line,1);
+ v = icalparser_get_next_char(':',line,1);
if (p== 0 && v == 0) {
@@ -264,5 +229,5 @@ char* icalparser_get_prop_name(char* line, char** end)
+
char* icalparser_get_param_name(char* line, char **end)
{
-
char* next;
@@ -270,3 +235,3 @@ char* icalparser_get_param_name(char* line, char **end)
- next = icalparser_get_next_char('=',line);
+ next = icalparser_get_next_char('=',line,1);
@@ -278,9 +243,18 @@ char* icalparser_get_param_name(char* line, char **end)
*end = next+1;
+ if (**end == '"') {
+ *end = *end+1;
+ next = icalparser_get_next_char('"',*end,0);
+ if (next == 0) {
+ return 0;
+ }
+
+ *end = make_segment(*end,next);
+ }
+
return str;
-
}
+
char* icalparser_get_next_paramvalue(char* line, char **end)
{
-
char* next;
@@ -288,3 +262,3 @@ char* icalparser_get_next_paramvalue(char* line, char **end)
- next = icalparser_get_next_char(',',line);
+ next = icalparser_get_next_char(',',line,1);
@@ -301,6 +275,7 @@ char* icalparser_get_next_paramvalue(char* line, char **end)
}
-
}
-/* A property may have multiple values, if the values are seperated by
+
+/**
+ A property may have multiple values, if the values are seperated by
commas in the content line. This routine will look for the next
@@ -320,3 +295,3 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind)
- next = icalparser_get_next_char(',',p);
+ next = icalparser_get_next_char(',',p,1);
@@ -342,2 +317,11 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind)
}
+ /* ignore all , for query value. select dtstart, dtend etc ... */
+ else if( kind == ICAL_QUERY_VALUE) {
+ if ( next != 0) {
+ p = next+1;
+ continue;
+ }
+ else
+ break;
+ }
@@ -381,4 +365,4 @@ char* icalparser_get_next_parameter(char* line,char** end)
- v = icalparser_get_next_char(':',line);
- next = icalparser_get_next_char(';', line);
+ v = icalparser_get_next_char(':',line,1);
+ next = icalparser_get_next_char(';', line,1);
@@ -388,3 +372,3 @@ char* icalparser_get_next_parameter(char* line,char** end)
if (next == 0 || next > v) {
- next = icalparser_get_next_char(':', line);
+ next = icalparser_get_next_char(':', line,1);
}
@@ -401,5 +385,7 @@ char* icalparser_get_next_parameter(char* line,char** end)
-/* Get a single property line, from the property name through the
- final new line, and include any continuation lines */
+/**
+ * Get a single property line, from the property name through the
+ * final new line, and include any continuation lines
+ */
char* icalparser_get_line(icalparser *parser,
@@ -409,5 +395,3 @@ char* icalparser_get_line(icalparser *parser,
char *line_p;
- struct icalparser_impl* impl = (struct icalparser_impl*)parser;
- size_t buf_size = impl->tmp_buf_size;
-
+ size_t buf_size = parser->tmp_buf_size;
@@ -417,3 +401,3 @@ char* icalparser_get_line(icalparser *parser,
/* Read lines by calling line_gen_func and putting the data into
- impl->temp. If the line is a continuation line ( begins with a
+ parser->temp. If the line is a continuation line ( begins with a
space after a newline ) then append the data onto line and read
@@ -431,3 +415,3 @@ char* icalparser_get_line(icalparser *parser,
output. This may be left over from a previous call */
- if (impl->temp[0] != '\0' ) {
+ if (parser->temp[0] != '\0' ) {
@@ -436,8 +420,8 @@ char* icalparser_get_line(icalparser *parser,
read later, because the line is not finished */
- if (impl->temp[impl->tmp_buf_size-1] == 0 &&
- impl->temp[impl->tmp_buf_size-2] != '\n'&&
- impl->temp[impl->tmp_buf_size-2] != 0 ){
- impl->buffer_full = 1;
+ if (parser->temp[parser->tmp_buf_size-1] == 0 &&
+ parser->temp[parser->tmp_buf_size-2] != '\n'&&
+ parser->temp[parser->tmp_buf_size-2] != 0 ){
+ parser->buffer_full = 1;
} else {
- impl->buffer_full = 0;
+ parser->buffer_full = 0;
}
@@ -445,5 +429,5 @@ char* icalparser_get_line(icalparser *parser,
/* Copy the temp to the output and clear the temp buffer. */
- if(impl->continuation_line==1){
+ if(parser->continuation_line==1){
/* back up the pointer to erase the continuation characters */
- impl->continuation_line = 0;
+ parser->continuation_line = 0;
line_p--;
@@ -456,15 +440,15 @@ char* icalparser_get_line(icalparser *parser,
icalmemory_append_string(&line,&line_p,&buf_size,
- impl->temp+1);
+ parser->temp+1);
} else {
- icalmemory_append_string(&line,&line_p,&buf_size,impl->temp);
+ icalmemory_append_string(&line,&line_p,&buf_size,parser->temp);
}
- impl->temp[0] = '\0' ;
+ parser->temp[0] = '\0' ;
}
- impl->temp[impl->tmp_buf_size-1] = 1; /* Mark end of buffer */
+ parser->temp[parser->tmp_buf_size-1] = 1; /* Mark end of buffer */
/****** Here is where the routine gets string data ******************/
- if ((*line_gen_func)(impl->temp,impl->tmp_buf_size,impl->line_gen_data)
+ if ((*line_gen_func)(parser->temp,parser->tmp_buf_size,parser->line_gen_data)
==0){/* Get more data */
@@ -473,3 +457,3 @@ char* icalparser_get_line(icalparser *parser,
any more data from the last call to line_ge_func*/
- if (impl->temp[0] == '\0'){
+ if (parser->temp[0] == '\0'){
@@ -492,8 +476,7 @@ char* icalparser_get_line(icalparser *parser,
- if ( line_p > line+1 && *(line_p-1) == '\n'
- && (impl->temp[0] == ' ' || impl->temp[0] == '\t') ) {
+ if ( line_p > line+1 && *(line_p-1) == '\n' && parser->temp[0] == ' ') {
- impl->continuation_line = 1;
+ parser->continuation_line = 1;
- } else if ( impl->buffer_full == 1 ) {
+ } else if ( parser->buffer_full == 1 ) {
@@ -521,2 +504,8 @@ char* icalparser_get_line(icalparser *parser,
+ while ( (*line_p == '\0' || iswspace(*line_p)) && line_p > line )
+ {
+ *line_p = '\0';
+ line_p--;
+ }
+
return line;
@@ -525,3 +514,3 @@ char* icalparser_get_line(icalparser *parser,
-void insert_error(icalcomponent* comp, char* text,
+static void insert_error(icalcomponent* comp, char* text,
char* message, icalparameter_xlicerrortype type)
@@ -544,3 +533,4 @@ void insert_error(icalcomponent* comp, char* text,
-int line_is_blank(char* line){
+
+static int line_is_blank(char* line){
int i=0;
@@ -566,4 +556,4 @@ icalcomponent* icalparser_parse(icalparser *parser,
icalcomponent *root=0;
- struct icalparser_impl *impl = (struct icalparser_impl*)parser;
icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
+ int cont;
@@ -582,4 +572,4 @@ icalcomponent* icalparser_parse(icalparser *parser,
- assert(impl->root_component == 0);
- assert(pvl_count(impl->components) ==0);
+ assert(parser->root_component == 0);
+ assert(pvl_count(parser->components) ==0);
@@ -608,6 +598,8 @@ icalcomponent* icalparser_parse(icalparser *parser,
}
+ cont = 0;
if(line != 0){
free(line);
+ cont = 1;
}
- } while ( line != 0);
+ } while ( cont );
@@ -623,3 +615,2 @@ icalcomponent* icalparser_add_line(icalparser* parser,
{
- char *p;
char *str;
@@ -633,3 +624,2 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- struct icalparser_impl *impl = (struct icalparser_impl*)parser;
icalerror_check_arg_rz((parser != 0),"parser");
@@ -639,3 +629,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
{
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -657,3 +647,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
/* Could not get a property name */
- icalcomponent *tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent *tail = pvl_data(pvl_tail(parser->components));
@@ -665,3 +655,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -675,2 +665,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
+
if(strcmp(str,"BEGIN") == 0){
@@ -679,3 +670,4 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- impl->level++;
+
+ parser->level++;
str = icalparser_get_next_value(end,&end, value_kind);
@@ -685,3 +677,6 @@ icalcomponent* icalparser_add_line(icalparser* parser,
+
if (comp_kind == ICAL_NO_COMPONENT){
+
+
c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT);
@@ -699,5 +694,5 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- pvl_push(impl->components,c);
+ pvl_push(parser->components,c);
- impl->state = ICALPARSER_BEGIN_COMP;
+ parser->state = ICALPARSER_BEGIN_COMP;
return 0;
@@ -707,3 +702,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- impl->level--;
+ parser->level--;
str = icalparser_get_next_value(end,&end, value_kind);
@@ -711,8 +706,8 @@ icalcomponent* icalparser_add_line(icalparser* parser,
/* Pop last component off of list and add it to the second-to-last*/
- impl->root_component = pvl_pop(impl->components);
+ parser->root_component = pvl_pop(parser->components);
- tail = pvl_data(pvl_tail(impl->components));
+ tail = pvl_data(pvl_tail(parser->components));
if(tail != 0){
- icalcomponent_add_component(tail,impl->root_component);
+ icalcomponent_add_component(tail,parser->root_component);
}
@@ -722,17 +717,17 @@ icalcomponent* icalparser_add_line(icalparser* parser,
/* Return the component if we are back to the 0th level */
- if (impl->level == 0){
+ if (parser->level == 0){
icalcomponent *rtrn;
- if(pvl_count(impl->components) != 0){
+ if(pvl_count(parser->components) != 0){
/* There are still components on the stack -- this means
that one of them did not have a proper "END" */
- pvl_push(impl->components,impl->root_component);
- icalparser_clean(parser); /* may reset impl->root_component*/
+ pvl_push(parser->components,parser->root_component);
+ icalparser_clean(parser); /* may reset parser->root_component*/
}
- assert(pvl_count(impl->components) == 0);
+ assert(pvl_count(parser->components) == 0);
- impl->state = ICALPARSER_SUCCESS;
- rtrn = impl->root_component;
- impl->root_component = 0;
+ parser->state = ICALPARSER_SUCCESS;
+ rtrn = parser->root_component;
+ parser->root_component = 0;
return rtrn;
@@ -740,3 +735,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
} else {
- impl->state = ICALPARSER_END_COMP;
+ parser->state = ICALPARSER_END_COMP;
return 0;
@@ -749,4 +744,4 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- if(pvl_data(pvl_tail(impl->components)) == 0){
- impl->state = ICALPARSER_ERROR;
+ if(pvl_data(pvl_tail(parser->components)) == 0){
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -769,3 +764,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
if (prop != 0){
- icalcomponent *tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent *tail = pvl_data(pvl_tail(parser->components));
@@ -782,3 +777,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
} else {
- icalcomponent* tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent* tail = pvl_data(pvl_tail(parser->components));
@@ -788,3 +783,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -798,3 +793,2 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- p = 0;
while(1) {
@@ -816,3 +810,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
icalparameter_kind kind;
- icalcomponent *tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent *tail = pvl_data(pvl_tail(parser->components));
@@ -847,3 +841,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -857,3 +851,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
continue;
@@ -887,3 +881,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -921,3 +915,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
icalproperty* clone = icalproperty_new_clone(prop);
- icalcomponent* tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent* tail = pvl_data(pvl_tail(parser->components));
@@ -935,3 +929,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
icalproperty_kind prop_kind = icalproperty_isa(prop);
- icalcomponent* tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent* tail = pvl_data(pvl_tail(parser->components));
@@ -949,3 +943,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -963,3 +957,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
icalproperty_kind prop_kind = icalproperty_isa(prop);
- icalcomponent *tail = pvl_data(pvl_tail(impl->components));
+ icalcomponent *tail = pvl_data(pvl_tail(parser->components));
@@ -976,3 +970,3 @@ icalcomponent* icalparser_add_line(icalparser* parser,
tail = 0;
- impl->state = ICALPARSER_ERROR;
+ parser->state = ICALPARSER_ERROR;
return 0;
@@ -989,10 +983,10 @@ icalcomponent* icalparser_add_line(icalparser* parser,
- if (pvl_data(pvl_tail(impl->components)) == 0 &&
- impl->level == 0){
+ if (pvl_data(pvl_tail(parser->components)) == 0 &&
+ parser->level == 0){
/* HACK. Does this clause ever get executed? */
- impl->state = ICALPARSER_SUCCESS;
+ parser->state = ICALPARSER_SUCCESS;
assert(0);
- return impl->root_component;
+ return parser->root_component;
} else {
- impl->state = ICALPARSER_IN_PROGRESS;
+ parser->state = ICALPARSER_IN_PROGRESS;
return 0;
@@ -1004,4 +998,3 @@ icalparser_state icalparser_get_state(icalparser* parser)
{
- struct icalparser_impl* impl = (struct icalparser_impl*) parser;
- return impl->state;
+ return parser->state;
@@ -1011,3 +1004,2 @@ icalcomponent* icalparser_clean(icalparser* parser)
{
- struct icalparser_impl* impl = (struct icalparser_impl*) parser;
icalcomponent *tail;
@@ -1019,3 +1011,3 @@ icalcomponent* icalparser_clean(icalparser* parser)
- while((tail=pvl_data(pvl_tail(impl->components))) != 0){
+ while((tail=pvl_data(pvl_tail(parser->components))) != 0){
@@ -1026,10 +1018,10 @@ icalcomponent* icalparser_clean(icalparser* parser)
- impl->root_component = pvl_pop(impl->components);
- tail=pvl_data(pvl_tail(impl->components));
+ parser->root_component = pvl_pop(parser->components);
+ tail=pvl_data(pvl_tail(parser->components));
if(tail != 0){
- if(icalcomponent_get_parent(impl->root_component)!=0){
+ if(icalcomponent_get_parent(parser->root_component)!=0){
icalerror_warn("icalparser_clean is trying to attach a component for the second time");
} else {
- icalcomponent_add_component(tail,impl->root_component);
+ icalcomponent_add_component(tail,parser->root_component);
}
@@ -1039,3 +1031,3 @@ icalcomponent* icalparser_clean(icalparser* parser)
- return impl->root_component;
+ return parser->root_component;
@@ -1048,3 +1040,4 @@ struct slg_data {
-char* string_line_generator(char *out, size_t buf_size, void *d)
+
+char* icalparser_string_line_generator(char *out, size_t buf_size, void *d)
{
@@ -1102,3 +1095,3 @@ icalcomponent* icalparser_parse_string(const char* str)
- c = icalparser_parse(p,string_line_generator);
+ c = icalparser_parse(p,icalparser_string_line_generator);
diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h
index 5e1c88f..7773af4 100644
--- a/libical/src/libical/icalparser.h
+++ b/libical/src/libical/icalparser.h
@@ -35,12 +35,13 @@
-typedef void* icalparser;
+typedef struct icalparser_impl icalparser;
-/***********************************************************************
- * Line-oriented parsing.
+/**
+ * @file icalparser.h
+ * @brief Line-oriented parsing.
*
- * Create a new parser via icalparse_new_parser, then add ines one at
+ * Create a new parser via icalparse_new_parser, then add lines one at
* a time with icalparse_add_line(). icalparser_add_line() will return
* non-zero when it has finished with a component.
- ***********************************************************************/
+ */
@@ -61,3 +62,3 @@ void icalparser_free(icalparser* parser);
-/***********************************************************************
+/**
* Message oriented parsing. icalparser_parse takes a string that
@@ -66,9 +67,11 @@ void icalparser_free(icalparser* parser);
* pointer to a function that returns one content line per invocation
- **********************************************************************/
+ */
icalcomponent* icalparser_parse(icalparser *parser,
- char* (*line_gen_func)(char *s, size_t size, void *d));
+ char* (*line_gen_func)(char *s, size_t size, void *d));
-/* Set the data that icalparser_parse will give to the line_gen_func
- as the parameter 'd'*/
+/**
+ Set the data that icalparser_parse will give to the line_gen_func
+ as the parameter 'd'
+ */
void icalparser_set_gen_data(icalparser* parser, void* data);
@@ -83,3 +86,3 @@ icalcomponent* icalparser_parse_string(const char* str);
-/* Use the flex/bison parser to turn a string into a value type */
+/** Use the flex/bison parser to turn a string into a value type */
icalvalue* icalparser_parse_value(icalvalue_kind kind,
@@ -87,6 +90,6 @@ icalvalue* icalparser_parse_value(icalvalue_kind kind,
-/* Given a line generator function, return a single iCal content line.*/
+/** Given a line generator function, return a single iCal content line.*/
char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d));
-char* string_line_generator(char *out, size_t buf_size, void *d);
+char* icalparser_string_line_generator(char *out, size_t buf_size, void *d);
diff --git a/libical/src/libical/icalperiod.c b/libical/src/libical/icalperiod.c
index c74c157..0dfbe81 100644
--- a/libical/src/libical/icalperiod.c
+++ b/libical/src/libical/icalperiod.c
@@ -38,10 +38,4 @@
-#ifdef ICAL_NO_LIBICAL
-#define icalerror_set_errno(x)
-#define icalerror_check_arg_rv(x,y)
-#define icalerror_check_arg_re(x,y,z)
-#else
#include "icalerror.h"
#include "icalmemory.h"
-#endif
@@ -99,2 +93,4 @@ struct icalperiodtype icalperiodtype_from_string (const char* str)
+ icalmemory_free_buffer(s);
+
return p;
@@ -103,2 +99,5 @@ struct icalperiodtype icalperiodtype_from_string (const char* str)
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+
+ if (s)
+ icalmemory_free_buffer (s);
return null_p;
@@ -135,2 +134,3 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
+ icalmemory_add_tmp_buffer(buf);
@@ -141,3 +141,3 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
-struct icalperiodtype icalperiodtype_null_period() {
+struct icalperiodtype icalperiodtype_null_period(void) {
struct icalperiodtype p;
diff --git a/libical/src/libical/icalperiod.h b/libical/src/libical/icalperiod.h
index 64d5323..5f07dd4 100644
--- a/libical/src/libical/icalperiod.h
+++ b/libical/src/libical/icalperiod.h
@@ -44,8 +44,8 @@ struct icalperiodtype icalperiodtype_from_string (const char* str);
const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
-struct icalperiodtype icalperiodtype_null_period();
-int icalperiodtype_is_null_period(struct icalperiodtype p);
-int icalperiodtype_is_valid_period(struct icalperiodtype p);
+struct icalperiodtype icalperiodtype_null_period(void);
+int icalperiodtype_is_null_period(struct icalperiodtype p);
+int icalperiodtype_is_valid_period(struct icalperiodtype p);
diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c
index 7f2cfa5..45d7a75 100644
--- a/libical/src/libical/icalproperty.c
+++ b/libical/src/libical/icalproperty.c
@@ -25,3 +25,2 @@
======================================================================*/
-/*#line 27 "icalproperty.c.in"*/
@@ -47,5 +46,6 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
-
-#define TMP_BUF_SIZE 1024
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
@@ -74,9 +74,6 @@ struct icalproperty_impl
-void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
+void icalproperty_add_parameters(icalproperty* prop, va_list args)
{
-
void* vp;
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
while((vp = va_arg(args, void*)) != 0) {
@@ -86,6 +83,6 @@ void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
- icalproperty_add_parameter((icalproperty*)impl,
+ icalproperty_add_parameter((icalproperty*)prop,
(icalparameter*)vp);
} else {
- assert(0);
+ icalerror_set_errno(ICAL_BADARG_ERROR);
}
@@ -93,4 +90,2 @@ void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
}
-
-
}
@@ -98,9 +93,11 @@ void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
-struct icalproperty_impl*
-icalproperty_new_impl (icalproperty_kind kind)
+icalproperty*
+icalproperty_new_impl(icalproperty_kind kind)
{
- struct icalproperty_impl* prop;
+ icalproperty* prop;
+
+ if (!icalproperty_kind_is_valid(kind))
+ return NULL;
- if ( ( prop = (struct icalproperty_impl*)
- malloc(sizeof(struct icalproperty_impl))) == 0) {
+ if ( ( prop = (icalproperty*) malloc(sizeof(icalproperty))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -125,3 +122,3 @@ icalproperty_new (icalproperty_kind kind)
{
- if(kind == ICAL_NO_PROPERTY){
+ if (kind == ICAL_NO_PROPERTY){
return 0;
@@ -134,9 +131,7 @@ icalproperty_new (icalproperty_kind kind)
icalproperty*
-icalproperty_new_clone(icalproperty* prop)
+icalproperty_new_clone(icalproperty* old)
{
- struct icalproperty_impl *old = (struct icalproperty_impl*)prop;
- struct icalproperty_impl *new = icalproperty_new_impl(old->kind);
+ icalproperty *new = icalproperty_new_impl(old->kind);
pvl_elem p;
- icalerror_check_arg_rz((prop!=0),"Prop");
icalerror_check_arg_rz((old!=0),"old");
@@ -221,11 +216,7 @@ icalproperty* icalproperty_new_from_string(const char* str)
void
-icalproperty_free (icalproperty* prop)
+icalproperty_free (icalproperty* p)
{
- struct icalproperty_impl *p;
-
icalparameter* param;
- icalerror_check_arg_rv((prop!=0),"prop");
-
- p = (struct icalproperty_impl*)prop;
+ icalerror_check_arg_rv((p!=0),"prop");
@@ -267,52 +258,118 @@ icalproperty_free (icalproperty* prop)
-const char*
-icalproperty_as_ical_string (icalproperty* prop)
-{
- icalparameter *param;
+/* This returns where the start of the next line should be. chars_left does
+ not include the trailing '\0'. */
+#define MAX_LINE_LEN 75
+/*#define MAX_LINE_LEN 120*/
- /* Create new buffer that we can append names, parameters and a
- value to, and reallocate as needed. Later, this buffer will be
- copied to a icalmemory_tmp_buffer, which is managed internally
- by libical, so it can be given to the caller without fear of
- the caller forgetting to free it */
-
- const char* property_name = 0;
- size_t buf_size = 1024;
- char* buf = icalmemory_new_buffer(buf_size);
- char* buf_ptr = buf;
- icalvalue* value;
- char *out_buf;
+static char*
+get_next_line_start (char *line_start, int chars_left)
+{
+ char *pos;
- char newline[] = "\n";
+ /* If we have 74 chars or less left, we can output all of them.
+ we return a pointer to the '\0' at the end of the string. */
+ if (chars_left < MAX_LINE_LEN) {
+ return line_start + chars_left;
+ }
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
- icalerror_check_arg_rz( (prop!=0),"prop");
+ /* Now we jump to the last possible character of the line, and step back
+ trying to find a ';' ':' or ' '. If we find one, we return the character
+ after it. */
+ pos = line_start + MAX_LINE_LEN - 2;
+ while (pos > line_start) {
+ if (*pos == ';' || *pos == ':' || *pos == ' ') {
+ return pos + 1;
+ }
+ pos--;
+ }
+ /* Now try to split on a UTF-8 boundary defined as a 7-bit
+ value or as a byte with the two high-most bits set:
+ 11xxxxxx. See http://czyborra.com/utf/ */
+ pos = line_start + MAX_LINE_LEN - 1;
+ while (pos > line_start) {
+ /* plain ascii */
+ if ((*pos & 128) == 0)
+ return pos;
- /* Append property name */
+ /* utf8 escape byte */
+ if ((*pos & 192) == 192)
+ return pos;
- if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
- property_name = impl->x_name;
- } else {
- property_name = icalproperty_kind_to_string(impl->kind);
+ pos--;
}
- if (property_name == 0 ) {
- icalerror_warn("Got a property of an unknown kind.");
- icalmemory_free_buffer(buf);
- return 0;
-
- }
+ /* Give up, just break at 74 chars (the 75th char is the space at
+ the start of the line). */
+
+ return line_start + MAX_LINE_LEN - 1;
+}
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
+/** This splits the property into lines less than 75 octects long (as
+ * specified in RFC2445). It tries to split after a ';' if it can.
+ * It returns a tmp buffer. NOTE: I'm not sure if it matters if we
+ * split a line in the middle of a UTF-8 character. It probably won't
+ * look nice in a text editor.
+ */
+static char*
+fold_property_line (char *text)
+{
+ size_t buf_size;
+ char *buf, *buf_ptr, *line_start, *next_line_start, *out_buf;
+ int len, chars_left, first_line;
+ char ch;
+
+ /* Start with a buffer twice the size of our property line, so we almost
+ certainly won't overflow it. */
+ len = strlen (text);
+ buf_size = len * 2;
+ buf = icalmemory_new_buffer (buf_size);
+ buf_ptr = buf;
+
+ /* Step through the text, finding each line to add to the output. */
+ line_start = text;
+ chars_left = len;
+ first_line = 1;
+ for (;;) {
+ if (chars_left <= 0)
+ break;
+
+ /* This returns the first character for the next line. */
+ next_line_start = get_next_line_start (line_start, chars_left);
+
+ /* If this isn't the first line, we need to output a newline and space
+ first. */
+ if (!first_line) {
+ icalmemory_append_string (&buf, &buf_ptr, &buf_size, "\n ");
+ }
+ first_line = 0;
+
+ /* This adds the line to our tmp buffer. We temporarily place a '\0'
+ in text, so we can copy the line in one go. */
+ ch = *next_line_start;
+ *next_line_start = '\0';
+ icalmemory_append_string (&buf, &buf_ptr, &buf_size, line_start);
+ *next_line_start = ch;
+ /* Now we move on to the next line. */
+ chars_left -= (next_line_start - line_start);
+ line_start = next_line_start;
+ }
+
+ /* Copy it to a temporary buffer, and then free it. */
+ out_buf = icalmemory_tmp_buffer (strlen (buf) + 1);
+ strcpy (out_buf, buf);
+ icalmemory_free_buffer (buf);
+
+ return out_buf;
+}
- /* Determine what VALUE parameter to include. The VALUE parameters
- are ignored in the normal parameter printing ( the block after
- this one, so we need to do it here */
- {
+/* Determine what VALUE parameter to include. The VALUE parameters
+ are ignored in the normal parameter printing ( the block after
+ this one, so we need to do it here */
+static const char *
+icalproperty_get_value_kind(icalproperty *prop)
+{
const char* kind_string = 0;
@@ -322,3 +379,3 @@ icalproperty_as_ical_string (icalproperty* prop)
- icalvalue *value = icalproperty_get_value(impl);
+ icalvalue *value = icalproperty_get_value(prop);
@@ -329,3 +386,3 @@ icalproperty_as_ical_string (icalproperty* prop)
icalvalue_kind default_kind
- = icalproperty_kind_to_value_kind(impl->kind);
+ = icalproperty_kind_to_value_kind(prop->kind);
@@ -356,10 +413,51 @@ icalproperty_as_ical_string (icalproperty* prop)
- if(kind_string!=0){
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE=");
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
- }
+ return kind_string;
+}
+
+const char*
+icalproperty_as_ical_string (icalproperty* prop)
+{
+ icalparameter *param;
+
+ /* Create new buffer that we can append names, parameters and a
+ value to, and reallocate as needed. Later, this buffer will be
+ copied to a icalmemory_tmp_buffer, which is managed internally
+ by libical, so it can be given to the caller without fear of
+ the caller forgetting to free it */
+
+ const char* property_name = 0;
+ size_t buf_size = 1024;
+ char* buf = icalmemory_new_buffer(buf_size);
+ char* buf_ptr = buf;
+ icalvalue* value;
+ char *out_buf;
+ const char* kind_string = 0;
+
+ char newline[] = "\n";
+
+
+ icalerror_check_arg_rz( (prop!=0),"prop");
+
+
+ /* Append property name */
+
+ if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){
+ property_name = prop->x_name;
+ } else {
+ property_name = icalproperty_kind_to_string(prop->kind);
+ }
+
+ if (property_name == 0 ) {
+ icalerror_warn("Got a property of an unknown kind.");
+ icalmemory_free_buffer(buf);
+ return 0;
+ }
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
+
+ kind_string = icalproperty_get_value_kind(prop);
+ if(kind_string!=0){
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";VALUE=");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
}
@@ -371,4 +469,4 @@ icalproperty_as_ical_string (icalproperty* prop)
- char* kind_string = icalparameter_as_ical_string(param);
icalparameter_kind kind = icalparameter_isa(param);
+ kind_string = icalparameter_as_ical_string(param);
@@ -379,5 +477,5 @@ icalproperty_as_ical_string (icalproperty* prop)
if (kind_string == 0 ) {
- char temp[TMP_BUF_SIZE];
- snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
- icalerror_warn(temp);
+ icalerror_warn("Got a parameter of unknown kind for the following property");
+
+ icalerror_warn((property_name) ? property_name : "(NULL)");
continue;
@@ -385,6 +483,4 @@ icalproperty_as_ical_string (icalproperty* prop)
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
-
}
@@ -393,3 +489,3 @@ icalproperty_as_ical_string (icalproperty* prop)
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ":");
@@ -411,5 +507,4 @@ icalproperty_as_ical_string (icalproperty* prop)
-
- out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
- strcpy(out_buf, buf);
+ /* We now use a function to fold the line properly every 75 characters. */
+ out_buf = fold_property_line (buf);
@@ -423,7 +518,5 @@ icalproperty_as_ical_string (icalproperty* prop)
icalproperty_kind
-icalproperty_isa (icalproperty* property)
+icalproperty_isa (icalproperty* p)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)property;
-
- if(property != 0){
+ if(p != 0){
return p->kind;
@@ -437,6 +530,5 @@ icalproperty_isa_property (void* property)
{
- struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
+ icalproperty *impl = (icalproperty *) property;
icalerror_check_arg_rz( (property!=0), "property");
-
if (strcmp(impl->id,"prop") == 0) {
@@ -450,7 +542,5 @@ icalproperty_isa_property (void* property)
void
-icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter)
+icalproperty_add_parameter (icalproperty* p,icalparameter* parameter)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
-
- icalerror_check_arg_rv( (prop!=0),"prop");
+ icalerror_check_arg_rv( (p!=0),"prop");
icalerror_check_arg_rv( (parameter!=0),"parameter");
@@ -470,4 +560,7 @@ icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
kind = icalparameter_isa(parameter);
-
- icalproperty_remove_parameter(prop,kind);
+ if (kind != ICAL_X_PARAMETER)
+ icalproperty_remove_parameter_by_kind(prop,kind);
+ else
+ icalproperty_remove_parameter_by_name(prop,
+ icalparameter_get_xname(parameter));
@@ -493,3 +586,3 @@ void icalproperty_set_parameter_from_string(icalproperty* prop,
}
-
+
param = icalparameter_new_from_value_string(kind,value);
@@ -501,2 +594,6 @@ void icalproperty_set_parameter_from_string(icalproperty* prop,
+ if(kind == ICAL_X_PARAMETER){
+ icalparameter_set_xname(param, name);
+ }
+
icalproperty_set_parameter(prop,param);
@@ -518,3 +615,3 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop,
- if(kind == ICAL_NO_PROPERTY){
+ if(kind == ICAL_NO_PARAMETER){
/* icalenum_string_to_parameter_kind will set icalerrno */
@@ -522,4 +619,14 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop,
}
+
+ for(param = icalproperty_get_first_parameter(prop,kind);
+ param != 0;
+ param = icalproperty_get_next_parameter(prop,kind)) {
+ if (kind != ICAL_X_PARAMETER) {
+ break;
+ }
- param = icalproperty_get_first_parameter(prop,kind);
+ if (strcmp(icalparameter_get_xname(param),name)==0) {
+ break;
+ }
+ }
@@ -529,2 +636,3 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop,
+
str = icalparameter_as_ical_string(param);
@@ -542,7 +650,29 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop,
+/** @see icalproperty_remove_parameter_by_kind()
+ *
+ * @deprecated Please use icalproperty_remove_parameter_by_kind()
+ * instead.
+ */
+
void
-icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
+icalproperty_remove_parameter(icalproperty* prop, icalparameter_kind kind)
+{
+ icalproperty_remove_parameter_by_kind(prop, kind);
+}
+
+
+/** @brief Remove all parameters with the specified kind.
+ *
+ * @param prop A valid icalproperty.
+ * @param kind The 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
+ */
+
+void
+icalproperty_remove_parameter_by_kind(icalproperty* prop, icalparameter_kind kind)
{
pvl_elem p;
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
@@ -550,7 +680,7 @@ icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
- for(p=pvl_head(impl->parameters);p != 0; p = pvl_next(p)){
+ for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
icalparameter* param = (icalparameter *)pvl_data (p);
if (icalparameter_isa(param) == kind) {
- pvl_remove (impl->parameters, p);
- icalparameter_free (param);
+ pvl_remove (prop->parameters, p);
+ icalparameter_free(param);
break;
@@ -561,9 +691,88 @@ icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
-int
-icalproperty_count_parameters (icalproperty* prop)
+/** @brief Remove all parameters with the specified name.
+ *
+ * @param prop A valid icalproperty.
+ * @param name The name of the parameter to remove
+ *
+ * This function removes paramters 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
+ */
+
+
+void
+icalproperty_remove_parameter_by_name(icalproperty* prop, const char *name)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
+ pvl_elem p;
+
+ icalerror_check_arg_rv((prop!=0),"prop");
+
+ for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
+ icalparameter* param = (icalparameter *)pvl_data (p);
+ const char * kind_string;
+
+ if (icalparameter_isa(param) == ICAL_X_PARAMETER)
+ kind_string = icalparameter_get_xname(param);
+ else
+ kind_string = icalparameter_kind_to_string(icalparameter_isa(param));
+
+ if (!kind_string)
+ continue;
+ if (0 == strcmp(kind_string, name)) {
+ pvl_remove (prop->parameters, p);
+ break;
+ }
+ }
+}
+
+
+/** @brief Remove the specified parameter reference from the property.
+ *
+ * @param prop A valid icalproperty.
+ * @param parameter A reference to a specific icalparameter.
+ *
+ * This function removes the specified parameter reference from the
+ * property.
+ */
+
+void
+icalproperty_remove_parameter_by_ref(icalproperty* prop, icalparameter* parameter)
+{
+ pvl_elem p;
+ icalparameter_kind kind;
+ const char *name;
+
+ icalerror_check_arg_rv((prop!=0),"prop");
+ icalerror_check_arg_rv((parameter!=0),"parameter");
+
+ kind = icalparameter_isa(parameter);
+ name = icalparameter_get_xname(parameter);
+
+ /*
+ * FIXME If it's an X- parameter, also compare the names. It would be nice
+ * to have a better abstraction like icalparameter_equals()
+ */
+ for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
+ icalparameter* p_param = (icalparameter *)pvl_data (p);
+ if (icalparameter_isa(p_param) == kind &&
+ (kind != ICAL_X_PARAMETER ||
+ !strcmp(icalparameter_get_xname(p_param), name))) {
+ pvl_remove (prop->parameters, p);
+ icalparameter_free(p_param);
+ break;
+ }
+ }
+}
+
+
+int
+icalproperty_count_parameters (const icalproperty* prop)
+{
if(prop != 0){
- return pvl_count(p->parameters);
+ return pvl_count(prop->parameters);
}
@@ -576,7 +785,5 @@ icalproperty_count_parameters (icalproperty* prop)
icalparameter*
-icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind)
+icalproperty_get_first_parameter(icalproperty* p, icalparameter_kind kind)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
-
- icalerror_check_arg_rz( (prop!=0),"prop");
+ icalerror_check_arg_rz( (p!=0),"prop");
@@ -604,7 +811,5 @@ icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind)
icalparameter*
-icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind)
+icalproperty_get_next_parameter (icalproperty* p, icalparameter_kind kind)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
-
- icalerror_check_arg_rz( (prop!=0),"prop");
+ icalerror_check_arg_rz( (p!=0),"prop");
@@ -630,7 +835,5 @@ icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind)
void
-icalproperty_set_value (icalproperty* prop, icalvalue* value)
+icalproperty_set_value (icalproperty* p, icalvalue* value)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
-
- icalerror_check_arg_rv((prop !=0),"prop");
+ icalerror_check_arg_rv((p !=0),"prop");
icalerror_check_arg_rv((value !=0),"value");
@@ -645,3 +848,3 @@ icalproperty_set_value (icalproperty* prop, icalvalue* value)
- icalvalue_set_parent(value,prop);
+ icalvalue_set_parent(value,p);
}
@@ -693,12 +896,10 @@ void icalproperty_set_value_from_string(icalproperty* prop,const char* str,
icalvalue*
-icalproperty_get_value (icalproperty* prop)
+icalproperty_get_value(const icalproperty* prop)
{
- struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
-
icalerror_check_arg_rz( (prop!=0),"prop");
- return p->value;
+ return prop->value;
}
-const char* icalproperty_get_value_as_string(icalproperty* prop)
+const char* icalproperty_get_value_as_string(const icalproperty* prop)
{
@@ -706,7 +907,5 @@ const char* icalproperty_get_value_as_string(icalproperty* prop)
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
icalerror_check_arg_rz( (prop!=0),"prop");
- value = impl->value;
+ value = prop->value;
@@ -718,4 +917,2 @@ void icalproperty_set_x_name(icalproperty* prop, const char* name)
{
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
icalerror_check_arg_rv( (name!=0),"name");
@@ -723,9 +920,9 @@ void icalproperty_set_x_name(icalproperty* prop, const char* name)
- if (impl->x_name != 0) {
- free(impl->x_name);
+ if (prop->x_name != 0) {
+ free(prop->x_name);
}
- impl->x_name = icalmemory_strdup(name);
+ prop->x_name = icalmemory_strdup(name);
- if(impl->x_name == 0){
+ if(prop->x_name == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -736,8 +933,5 @@ void icalproperty_set_x_name(icalproperty* prop, const char* name)
const char* icalproperty_get_x_name(icalproperty* prop){
-
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
icalerror_check_arg_rz( (prop!=0),"prop");
- return impl->x_name;
+ return prop->x_name;
}
@@ -745,4 +939,11 @@ const char* icalproperty_get_x_name(icalproperty* prop){
-/* From Jonathan Yue <jonathan.yue@cp.net> */
-const char* icalproperty_get_name (icalproperty* prop)
+const char* icalproperty_get_name(const icalproperty* prop)
+{
+#ifndef NO_WARN_DEPRECATED
+ icalerror_warn("icalproperty_get_name() is DEPRECATED, please use icalproperty_get_property_name() instead.");
+#endif
+ return icalproperty_get_property_name(prop);
+}
+
+const char* icalproperty_get_property_name(const icalproperty* prop)
{
@@ -754,10 +955,8 @@ const char* icalproperty_get_name (icalproperty* prop)
- struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
-
icalerror_check_arg_rz( (prop!=0),"prop");
- if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
- property_name = impl->x_name;
+ if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){
+ property_name = prop->x_name;
} else {
- property_name = icalproperty_kind_to_string(impl->kind);
+ property_name = icalproperty_kind_to_string(prop->kind);
}
@@ -787,24 +986,12 @@ void icalproperty_set_parent(icalproperty* property,
{
- struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
-
icalerror_check_arg_rv( (property!=0),"property");
- impl->parent = component;
+ property->parent = component;
}
-icalcomponent* icalproperty_get_parent(icalproperty* property)
+icalcomponent* icalproperty_get_parent(const icalproperty* property)
{
- struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
-
icalerror_check_arg_rz( (property!=0),"property");
- return impl->parent;
+ return property->parent;
}
-
-
-
-
-
-
-
-/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h
index e39c6b5..472adb9 100644
--- a/libical/src/libical/icalproperty.h
+++ b/libical/src/libical/icalproperty.h
@@ -33,7 +33,3 @@
#include <time.h>
-
-#ifdef _WIN32
-#include <stdio.h> /* for printf */
-#include <stdarg.h> /* for va_list, va_start, etc. */
-#endif
+#include <stdarg.h> /* for va_... */
@@ -45,3 +41,3 @@
/* Actually in icalderivedproperty.h:
- typedef void icalproperty; */
+ typedef struct icalproperty_impl icalproperty; */
@@ -49,4 +45,2 @@
-// void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
-
icalproperty* icalproperty_new(icalproperty_kind kind);
@@ -64,2 +58,3 @@ int icalproperty_isa_property(void* property);
+void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
@@ -74,3 +69,14 @@ void icalproperty_remove_parameter(icalproperty* prop,
-int icalproperty_count_parameters(icalproperty* prop);
+void icalproperty_remove_parameter_by_kind(icalproperty* prop,
+ icalparameter_kind kind);
+
+void icalproperty_remove_parameter_by_name(icalproperty* prop,
+ const char *name);
+
+void icalproperty_remove_parameter_by_ref(icalproperty* prop,
+ icalparameter *param);
+
+
+
+int icalproperty_count_parameters(const icalproperty* prop);
@@ -85,4 +91,4 @@ void icalproperty_set_value_from_string(icalproperty* prop,const char* value, co
-icalvalue* icalproperty_get_value(icalproperty* prop);
-const char* icalproperty_get_value_as_string(icalproperty* prop);
+icalvalue* icalproperty_get_value(const icalproperty* prop);
+const char* icalproperty_get_value_as_string(const icalproperty* prop);
@@ -93,5 +99,7 @@ const char* icalproperty_get_x_name(icalproperty* prop);
-/* Return 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 */
-const char* icalproperty_get_name (icalproperty* prop);
+/** Return 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
+ */
+const char* icalproperty_get_property_name (const icalproperty* prop);
@@ -102,3 +110,3 @@ icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
-icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
+icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
const char* icalproperty_kind_to_string(icalproperty_kind kind);
@@ -106,2 +114,5 @@ icalproperty_kind icalproperty_string_to_kind(const char* string);
+/** Check validity of a specific icalproperty_kind **/
+int icalproperty_kind_is_valid(const icalproperty_kind kind);
+
icalproperty_method icalproperty_string_to_method(const char* str);
@@ -112,2 +123,3 @@ const char* icalproperty_enum_to_string(int e);
int icalproperty_string_to_enum(const char* str);
+int icalproperty_kind_and_string_to_enum(const int kind, const char* str);
diff --git a/libical/src/libical/icalrecur.c b/libical/src/libical/icalrecur.c
index 203ce70..d5a59c6 100644
--- a/libical/src/libical/icalrecur.c
+++ b/libical/src/libical/icalrecur.c
@@ -21,3 +21,7 @@
the License at http://www.mozilla.org/MPL/
+*/
+/**
+ @file icalrecur.c
+ @brief Implementation of routines for dealing with recurring time
@@ -132,11 +136,10 @@
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
#include "icalrecur.h"
-#ifdef ICAL_NO_LIBICAL
-#define icalerror_set_errno(x)
-#define icalerror_check_arg_rv(x,y)
-#else
#include "icalerror.h"
#include "icalmemory.h"
-#endif
@@ -150,2 +153,6 @@
+/** This is the last year we will go up to, since 32-bit time_t values
+ only go up to the start of 2038. */
+#define MAX_TIME_T_YEAR 2037
+
#define TEMP_MAX 1024
@@ -172,3 +179,2 @@ icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str);
-
/*********************** Rule parsing routines ************************/
@@ -255,3 +261,3 @@ void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array,
int sign = 1;
- short v;
+ int v;
@@ -282,2 +288,4 @@ void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array,
t++;
+ } else {
+ sign = 1;
}
@@ -287,3 +295,3 @@ void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array,
- array[i++] = v;
+ array[i++] = (short)v;
array[i] = ICAL_RECURRENCE_ARRAY_MAX;
@@ -334,13 +342,10 @@ void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals)
- weekno = 0;
/* Get Optional weekno */
- if( sscanf(t,"%d",&weekno) != 0){
- if (n != 0){
- int weeknolen = (n-t)-3; /* 3 -> one for \0, 2 for day name */
- /* could use abs(log10(weekno))+1, but that needs libm */
- t += weeknolen;
- } else {
- t = end -2;
- }
- }
+ weekno = strtol(t,&t,10);
+
+ /* Outlook/Exchange generate "BYDAY=MO, FR" and "BYDAY=2 TH".
+ * Cope with that.
+ */
+ if (*t == ' ')
+ t++;
@@ -348,3 +353,3 @@ void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals)
- array[i++] = sign* ((int)wd + 8*weekno);
+ array[i++] = (short)(sign* (wd + 8*weekno));
array[i] = ICAL_RECURRENCE_ARRAY_MAX;
@@ -389,2 +394,3 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
icalrecurrencetype_clear(&parser.rt);
+ free(parser.copy);
return parser.rt;
@@ -399,3 +405,3 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
} else if (strcmp(name,"INTERVAL") == 0){
- parser.rt.interval = atoi(value);
+ parser.rt.interval = (short)atoi(value);
} else if (strcmp(name,"WKST") == 0){
@@ -431,2 +437,3 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
icalrecurrencetype_clear(&parser.rt);
+ free(parser.copy);
return parser.rt;
@@ -442,5 +449,3 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
-#ifndef ICAL_NO_LIBICAL
-
-struct { char* str;size_t offset; short limit; } recurmap[] =
+static struct { char* str;size_t offset; int limit; } recurmap[] =
{
@@ -459,2 +464,3 @@ struct { char* str;size_t offset; short limit; } recurmap[] =
/* A private routine in icalvalue.c */
+void print_date_to_string(char* str, struct icaltimetype *data);
void print_datetime_to_string(char* str, struct icaltimetype *data);
@@ -483,3 +489,6 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
temp[0] = 0;
- print_datetime_to_string(temp,&(recur->until));
+ if (recur->until.is_date)
+ print_date_to_string(temp,&(recur->until));
+ else
+ print_datetime_to_string(temp,&(recur->until));
@@ -503,3 +512,3 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
short* array = (short*)(recurmap[j].offset+ (size_t)recur);
- short limit = recurmap[j].limit;
+ int limit = recurmap[j].limit;
@@ -514,5 +523,5 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
if (j == 3) { /* BYDAY */
- short dow = icalrecurrencetype_day_day_of_week(array[i]);
- const char *daystr = icalrecur_weekday_to_string(dow);
- short pos;
+ const char *daystr = icalrecur_weekday_to_string(
+ icalrecurrencetype_day_day_of_week(array[i]));
+ int pos;
@@ -542,4 +551,2 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
}
-#endif
-
@@ -575,6 +582,6 @@ struct icalrecur_iterator_impl {
short by_indices[9];
- short orig_data[9]; /* 1 if there was data in the byrule */
+ short orig_data[9]; /**< 1 if there was data in the byrule */
- short *by_ptrs[9]; /* Pointers into the by_* array elements of the rule */
+ short *by_ptrs[9]; /**< Pointers into the by_* array elements of the rule */
@@ -582,2 +589,4 @@ struct icalrecur_iterator_impl {
+static void increment_year(icalrecur_iterator* impl, int inc);
+
int icalrecur_iterator_sizeof_byarray(short* byarray)
@@ -601,6 +610,9 @@ enum expand_table {
-/* The split map indicates, for a particular interval, wether a BY_*
- rule part expands the number of instances in the occcurrence set or
- contracts it. 1=> contract, 2=>expand, and 3 means the pairing is
- not allowed. */
+/**
+ * The split map indicates, for a particular interval, wether a BY_*
+ * rule part expands the number of instances in the occcurrence set or
+ * contracts it. 1=> contract, 2=>expand, and 3 means the pairing is
+ * not allowed.
+ */
+
struct expand_split_map_struct
@@ -615,3 +627,3 @@ struct expand_split_map_struct
-struct expand_split_map_struct expand_map[] =
+static struct expand_split_map_struct expand_map[] =
{
@@ -630,4 +642,5 @@ struct expand_split_map_struct expand_map[] =
-/* Check that the rule has only the two given interday byrule parts. */
-int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl,
+/** Check that the rule has only the two given interday byrule parts. */
+static
+int icalrecur_two_byrule(icalrecur_iterator* impl,
enum byrule one,enum byrule two)
@@ -638,3 +651,3 @@ int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl,
- memset(test_array,0,9);
+ memset(test_array,0,sizeof(test_array));
@@ -661,4 +674,4 @@ int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl,
-/* Check that the rule has only the one given interdat byrule parts. */
-int icalrecur_one_byrule(struct icalrecur_iterator_impl* impl,enum byrule one)
+/** Check that the rule has only the one given interdat byrule parts. */
+static int icalrecur_one_byrule(icalrecur_iterator* impl,enum byrule one)
{
@@ -678,3 +691,3 @@ int icalrecur_one_byrule(struct icalrecur_iterator_impl* impl,enum byrule one)
-int count_byrules(struct icalrecur_iterator_impl* impl)
+static int count_byrules(icalrecur_iterator* impl)
{
@@ -693,5 +706,5 @@ int count_byrules(struct icalrecur_iterator_impl* impl)
-void setup_defaults(struct icalrecur_iterator_impl* impl,
+static void setup_defaults(icalrecur_iterator* impl,
enum byrule byrule, icalrecurrencetype_frequency req,
- short deftime, int *timepart)
+ int deftime, int *timepart)
{
@@ -706,3 +719,3 @@ void setup_defaults(struct icalrecur_iterator_impl* impl,
expand_map[freq].map[byrule] != CONTRACT){
- impl->by_ptrs[byrule][0] = deftime;
+ impl->by_ptrs[byrule][0] = (short)deftime;
}
@@ -717,3 +730,3 @@ void setup_defaults(struct icalrecur_iterator_impl* impl,
-int has_by_data(struct icalrecur_iterator_impl* impl, enum byrule byrule){
+static int has_by_data(icalrecur_iterator* impl, enum byrule byrule){
@@ -723,3 +736,3 @@ int has_by_data(struct icalrecur_iterator_impl* impl, enum byrule byrule){
-int expand_year_days(struct icalrecur_iterator_impl* impl,short year);
+static int expand_year_days(icalrecur_iterator* impl, int year);
@@ -729,9 +742,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
{
- struct icalrecur_iterator_impl* impl;
+ icalrecur_iterator* impl;
icalrecurrencetype_frequency freq;
- short days_in_month;
-
- if ( ( impl = (struct icalrecur_iterator_impl *)
- malloc(sizeof(struct icalrecur_iterator_impl))) == 0) {
+ if ( ( impl = (icalrecur_iterator*)
+ malloc(sizeof(icalrecur_iterator))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
@@ -740,3 +751,3 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- memset(impl,0,sizeof(struct icalrecur_iterator_impl));
+ memset(impl,0,sizeof(icalrecur_iterator));
@@ -762,3 +773,3 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- memset(impl->orig_data,0,9);
+ memset(impl->orig_data,0,9*sizeof(short));
@@ -770,19 +781,19 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
impl->orig_data[BY_MONTH]
- = (impl->rule.by_month[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_month[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_WEEK_NO]
- =(impl->rule.by_week_no[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ =(short)(impl->rule.by_week_no[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_YEAR_DAY]
- =(impl->rule.by_year_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ =(short)(impl->rule.by_year_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_MONTH_DAY]
- =(impl->rule.by_month_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ =(short)(impl->rule.by_month_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_DAY]
- = (impl->rule.by_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_HOUR]
- = (impl->rule.by_hour[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_hour[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_MINUTE]
- = (impl->rule.by_minute[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_minute[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_SECOND]
- = (impl->rule.by_second[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_second[0]!=ICAL_RECURRENCE_ARRAY_MAX);
impl->orig_data[BY_SET_POS]
- = (impl->rule.by_set_pos[0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ = (short)(impl->rule.by_set_pos[0]!=ICAL_RECURRENCE_ARRAY_MAX);
@@ -854,15 +865,20 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- setup_defaults(impl,BY_SECOND,ICAL_SECONDLY_RECURRENCE,impl->dtstart.second,
+ setup_defaults(impl,BY_SECOND,ICAL_SECONDLY_RECURRENCE,
+ impl->dtstart.second,
&(impl->last.second));
- setup_defaults(impl,BY_MINUTE,ICAL_MINUTELY_RECURRENCE,impl->dtstart.minute,
+ setup_defaults(impl,BY_MINUTE,ICAL_MINUTELY_RECURRENCE,
+ impl->dtstart.minute,
&(impl->last.minute));
- setup_defaults(impl,BY_HOUR,ICAL_HOURLY_RECURRENCE,impl->dtstart.hour,
+ setup_defaults(impl,BY_HOUR,ICAL_HOURLY_RECURRENCE,
+ impl->dtstart.hour,
&(impl->last.hour));
- setup_defaults(impl,BY_MONTH_DAY,ICAL_DAILY_RECURRENCE,impl->dtstart.day,
+ setup_defaults(impl,BY_MONTH_DAY,ICAL_DAILY_RECURRENCE,
+ impl->dtstart.day,
&(impl->last.day));
- setup_defaults(impl,BY_MONTH,ICAL_MONTHLY_RECURRENCE,impl->dtstart.month,
+ setup_defaults(impl,BY_MONTH,ICAL_MONTHLY_RECURRENCE,
+ impl->dtstart.month,
&(impl->last.month));
@@ -876,3 +892,3 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
same day of the week as the start time . */
- impl->by_ptrs[BY_DAY][0] = icaltime_day_of_week(impl->dtstart);
+ impl->by_ptrs[BY_DAY][0] = (short)icaltime_day_of_week(impl->dtstart);
@@ -890,3 +906,3 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- short dow = impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last);
+ short dow = (short)(impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last));
@@ -903,6 +919,20 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- /* For YEARLY rule, begin by setting up the year days array */
+ /* For YEARLY rule, begin by setting up the year days array . The
+ YEARLY rules work by expanding one year at a time. */
if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){
- expand_year_days(impl,impl->last.year);
+ struct icaltimetype next;
+
+ for (;;) {
+ expand_year_days(impl, impl->last.year);
+ if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX)
+ break; /* break when no days are expanded */
+ increment_year(impl,impl->rule.interval);
+ }
+
+ /* Copy the first day into last. */
+ next = icaltime_from_day_of_year(impl->days[0], impl->last.year);
+
+ impl->last.day = next.day;
+ impl->last.month = next.month;
}
@@ -916,9 +946,9 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
- short dow = icalrecurrencetype_day_day_of_week(
+ int dow = icalrecurrencetype_day_day_of_week(
impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]);
- short pos = icalrecurrencetype_day_position(
+ int pos = icalrecurrencetype_day_position(
impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]);
- short poscount = 0;
- days_in_month =
+ int poscount = 0;
+ int days_in_month =
icaltime_days_in_month(impl->last.month, impl->last.year);
@@ -971,9 +1001,5 @@ void icalrecur_iterator_free(icalrecur_iterator* i)
{
+ icalerror_check_arg_rv((i!=0),"impl");
- struct icalrecur_iterator_impl* impl =
- (struct icalrecur_iterator_impl*)i;
-
- icalerror_check_arg_rv((impl!=0),"impl");
-
- free(impl);
+ free(i);
@@ -981,4 +1007,3 @@ void icalrecur_iterator_free(icalrecur_iterator* i)
-
-void increment_year(struct icalrecur_iterator_impl* impl, int inc)
+static void increment_year(icalrecur_iterator* impl, int inc)
{
@@ -987,6 +1012,6 @@ void increment_year(struct icalrecur_iterator_impl* impl, int inc)
-/* Increment month is different that the other incement_* routines --
+/** Increment month is different that the other incement_* routines --
it figures out the interval for itself, and uses BYMONTH data if
available. */
-void increment_month(struct icalrecur_iterator_impl* impl)
+static void increment_month(icalrecur_iterator* impl)
{
@@ -1037,3 +1062,3 @@ void increment_month(struct icalrecur_iterator_impl* impl)
-void increment_monthday(struct icalrecur_iterator_impl* impl, int inc)
+static void increment_monthday(icalrecur_iterator* impl, int inc)
{
@@ -1043,4 +1068,4 @@ void increment_monthday(struct icalrecur_iterator_impl* impl, int inc)
- short days_in_month =
- icaltime_days_in_month(impl->last.month,impl->last.year);
+ int days_in_month =
+ icaltime_days_in_month(impl->last.month, impl->last.year);
@@ -1056,5 +1081,5 @@ void increment_monthday(struct icalrecur_iterator_impl* impl, int inc)
-void increment_hour(struct icalrecur_iterator_impl* impl, int inc)
+static void increment_hour(icalrecur_iterator* impl, int inc)
{
- short days;
+ int days;
@@ -1070,5 +1095,5 @@ void increment_hour(struct icalrecur_iterator_impl* impl, int inc)
-void increment_minute(struct icalrecur_iterator_impl* impl, int inc)
+static void increment_minute(icalrecur_iterator* impl, int inc)
{
- short hours;
+ int hours;
@@ -1085,5 +1110,5 @@ void increment_minute(struct icalrecur_iterator_impl* impl, int inc)
-void increment_second(struct icalrecur_iterator_impl* impl, int inc)
+static void increment_second(icalrecur_iterator* impl, int inc)
{
- short minutes;
+ int minutes;
@@ -1104,3 +1129,3 @@ void test_increment()
{
- struct icalrecur_iterator_impl impl;
+ icalrecur_iterator impl;
@@ -1134,13 +1159,13 @@ void test_increment()
-short next_second(struct icalrecur_iterator_impl* impl)
+static int next_second(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_SECOND][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short this_frequency = (impl->rule.freq == ICAL_SECONDLY_RECURRENCE);
+ int has_by_second = (impl->by_ptrs[BY_SECOND][0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ int this_frequency = (impl->rule.freq == ICAL_SECONDLY_RECURRENCE);
- short end_of_data = 0;
+ int end_of_data = 0;
- assert(has_by_data || this_frequency);
+ assert(has_by_second || this_frequency);
- if( has_by_data ){
+ if( has_by_second ){
/* Ignore the frequency and use the byrule data */
@@ -1161,3 +1186,3 @@ short next_second(struct icalrecur_iterator_impl* impl)
- } else if( !has_by_data && this_frequency ){
+ } else if( !has_by_second && this_frequency ){
/* Compute the next value from the last time and the frequency interval*/
@@ -1170,3 +1195,3 @@ short next_second(struct icalrecur_iterator_impl* impl)
- if(has_by_data && end_of_data && this_frequency ){
+ if(has_by_second && end_of_data && this_frequency ){
increment_minute(impl,1);
@@ -1178,11 +1203,11 @@ short next_second(struct icalrecur_iterator_impl* impl)
-int next_minute(struct icalrecur_iterator_impl* impl)
+static int next_minute(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_MINUTE][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short this_frequency = (impl->rule.freq == ICAL_MINUTELY_RECURRENCE);
+ int has_by_minute = (impl->by_ptrs[BY_MINUTE][0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ int this_frequency = (impl->rule.freq == ICAL_MINUTELY_RECURRENCE);
- short end_of_data = 0;
+ int end_of_data = 0;
- assert(has_by_data || this_frequency);
+ assert(has_by_minute || this_frequency);
@@ -1193,3 +1218,3 @@ int next_minute(struct icalrecur_iterator_impl* impl)
- if( has_by_data ){
+ if( has_by_minute ){
/* Ignore the frequency and use the byrule data */
@@ -1209,3 +1234,3 @@ int next_minute(struct icalrecur_iterator_impl* impl)
- } else if( !has_by_data && this_frequency ){
+ } else if( !has_by_minute && this_frequency ){
/* Compute the next value from the last time and the frequency interval*/
@@ -1217,3 +1242,3 @@ int next_minute(struct icalrecur_iterator_impl* impl)
- if(has_by_data && end_of_data && this_frequency ){
+ if(has_by_minute && end_of_data && this_frequency ){
increment_hour(impl,1);
@@ -1224,11 +1249,11 @@ int next_minute(struct icalrecur_iterator_impl* impl)
-int next_hour(struct icalrecur_iterator_impl* impl)
+static int next_hour(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_HOUR][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short this_frequency = (impl->rule.freq == ICAL_HOURLY_RECURRENCE);
+ int has_by_hour = (impl->by_ptrs[BY_HOUR][0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ int this_frequency = (impl->rule.freq == ICAL_HOURLY_RECURRENCE);
- short end_of_data = 0;
+ int end_of_data = 0;
- assert(has_by_data || this_frequency);
+ assert(has_by_hour || this_frequency);
@@ -1238,3 +1263,3 @@ int next_hour(struct icalrecur_iterator_impl* impl)
- if( has_by_data ){
+ if( has_by_hour ){
/* Ignore the frequency and use the byrule data */
@@ -1253,3 +1278,3 @@ int next_hour(struct icalrecur_iterator_impl* impl)
- } else if( !has_by_data && this_frequency ){
+ } else if( !has_by_hour && this_frequency ){
/* Compute the next value from the last time and the frequency interval*/
@@ -1262,3 +1287,3 @@ int next_hour(struct icalrecur_iterator_impl* impl)
- if(has_by_data && end_of_data && this_frequency ){
+ if(has_by_hour && end_of_data && this_frequency ){
increment_monthday(impl,1);
@@ -1270,9 +1295,9 @@ int next_hour(struct icalrecur_iterator_impl* impl)
-int next_day(struct icalrecur_iterator_impl* impl)
+static int next_day(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short this_frequency = (impl->rule.freq == ICAL_DAILY_RECURRENCE);
+ int has_by_day = (impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ int this_frequency = (impl->rule.freq == ICAL_DAILY_RECURRENCE);
- assert(has_by_data || this_frequency);
+ assert(has_by_day || this_frequency);
@@ -1298,10 +1323,10 @@ int next_day(struct icalrecur_iterator_impl* impl)
-int next_yearday(struct icalrecur_iterator_impl* impl)
+static int next_yearday(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_YEAR_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
+ int has_by_yearday = (impl->by_ptrs[BY_YEAR_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short end_of_data = 0;
+ int end_of_data = 0;
- assert(has_by_data );
+ assert(has_by_yearday );
@@ -1323,3 +1348,3 @@ int next_yearday(struct icalrecur_iterator_impl* impl)
- if(has_by_data && end_of_data){
+ if(has_by_yearday && end_of_data){
increment_year(impl,1);
@@ -1331,58 +1356,11 @@ int next_yearday(struct icalrecur_iterator_impl* impl)
-/* This routine is only called by next_week. It is certain that BY_DAY
-has data */
-
-int next_weekday_by_week(struct icalrecur_iterator_impl* impl)
-{
-
- short end_of_data = 0;
- short start_of_week, dow;
- struct icaltimetype next;
-
- if (next_hour(impl) == 0){
- return 0;
- }
-
- assert( impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
-
- while(1) {
-
- impl->by_indices[BY_DAY]++; /* Look at next elem in BYDAY array */
-
- /* Are we at the end of the BYDAY array? */
- if (impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]
- ==ICAL_RECURRENCE_ARRAY_MAX){
-
- impl->by_indices[BY_DAY] = 0; /* Reset to 0 */
- end_of_data = 1; /* Signal that we're at the end */
- }
-
- /* Add the day of week offset to to the start of this week, and use
- that to get the next day */
- dow = impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]];
- start_of_week = icaltime_start_doy_of_week(impl->last);
-
- dow--; /*Sun is 1, not 0 */
-
- if(dow+start_of_week <1 && !end_of_data){
- /* The selected date is in the previous year. */
- continue;
- }
-
- next = icaltime_from_day_of_year(start_of_week + dow,impl->last.year);
-
- impl->last.day = next.day;
- impl->last.month = next.month;
- impl->last.year = next.year;
-
- return end_of_data;
- }
-}
+/* Returns the day of the month for the current month of t that is the
+ pos'th instance of the day-of-week dow */
-int nth_weekday(short dow, short pos, struct icaltimetype t){
+static int nth_weekday(int dow, int pos, struct icaltimetype t){
- short days_in_month = icaltime_days_in_month(t.month,t.year);
- short end_dow, start_dow;
- short wd;
+ int days_in_month = icaltime_days_in_month(t.month, t.year);
+ int end_dow, start_dow;
+ int wd;
@@ -1430,4 +1408,21 @@ int nth_weekday(short dow, short pos, struct icaltimetype t){
+static int is_day_in_byday(icalrecur_iterator* impl,struct icaltimetype tt){
+
+ int idx;
-int next_month(struct icalrecur_iterator_impl* impl)
+ for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){
+ int dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]);
+ int pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
+ int this_dow = icaltime_day_of_week(tt);
+
+ if( (pos == 0 && dow == this_dow ) || /* Just a dow, like "TU" or "FR" */
+ (nth_weekday(dow,pos,tt) == tt.day)){ /*pos+wod: "3FR" or -1TU" */
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int next_month(icalrecur_iterator* impl)
{
@@ -1435,3 +1430,3 @@ int next_month(struct icalrecur_iterator_impl* impl)
- short this_frequency = (impl->rule.freq == ICAL_MONTHLY_RECURRENCE);
+ int this_frequency = (impl->rule.freq == ICAL_MONTHLY_RECURRENCE);
@@ -1447,10 +1442,13 @@ int next_month(struct icalrecur_iterator_impl* impl)
-
/* Now iterate through the occurrences within a month -- by days,
weeks or weekdays. */
+
+ /*
+ * Case 1:
+ * Rules Like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYMONTHDAY=13
+ */
if(has_by_data(impl,BY_DAY) && has_by_data(impl,BY_MONTH_DAY)){
- /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYMONTHDAY=13 */
- short day, idx,j;
- short days_in_month = icaltime_days_in_month(impl->last.month,
+ int day, idx,j;
+ int days_in_month = icaltime_days_in_month(impl->last.month,
impl->last.year);
@@ -1465,7 +1463,7 @@ int next_month(struct icalrecur_iterator_impl* impl)
for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
- short dow =
+ int dow =
icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]);
- short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
- short mday = BYMDPTR[j];
- short this_dow;
+ int pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
+ int mday = BYMDPTR[j];
+ int this_dow;
@@ -1490,5 +1488,9 @@ int next_month(struct icalrecur_iterator_impl* impl)
-
+
+ /*
+ * Case 2:
+ * Rules Like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR
+ */
+
} else if(has_by_data(impl,BY_DAY)){
- /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR */
/* For this case, the weekdays are relative to the
@@ -1496,27 +1498,18 @@ int next_month(struct icalrecur_iterator_impl* impl)
- short day, idx;
- short days_in_month = icaltime_days_in_month(impl->last.month,
- impl->last.year);
+ /* This code iterates through the remaining days in the month
+ and checks if each day is listed in the BY_DAY array. This
+ seems very inneficient, but I think it is the simplest way to
+ account for both BYDAY=1FR (First friday in month) and
+ BYDAY=FR ( every friday in month ) */
+ int day;
+ int days_in_month = icaltime_days_in_month(impl->last.month,
+ impl->last.year);
assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX);
- /* Iterate through the remaining days in the month and check if
- each day is listed in the BY_DAY array. This seems very
- inneficient, but I think it is the simplest way to account
- for both BYDAY=1FR (First friday in month) and BYDAY=FR (
- every friday in month ) */
-
for(day = impl->last.day+1; day <= days_in_month; day++){
- for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){
- short dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]);
- short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
- short this_dow;
-
- impl->last.day = day;
- this_dow = icaltime_day_of_week(impl->last);
-
- if( (pos == 0 && dow == this_dow ) ||
- (nth_weekday(dow,pos,impl->last) == day)){
- goto DEND;
- }
+ impl->last.day = day;
+ if(is_day_in_byday(impl,impl->last)){
+ data_valid = 1;
+ break;
}
@@ -1524,4 +1517,2 @@ int next_month(struct icalrecur_iterator_impl* impl)
- DEND:
-
if ( day > days_in_month){
@@ -1529,8 +1520,21 @@ int next_month(struct icalrecur_iterator_impl* impl)
increment_month(impl);
- data_valid = 0; /* signal that impl->last is invalid */
+
+ /* Did moving to the next month put us on a valid date? if
+ so, note that the new data is valid, if, not, mark it
+ invalid */
+
+ if(is_day_in_byday(impl,impl->last)){
+ data_valid = 1;
+ } else {
+ data_valid = 0; /* signal that impl->last is invalid */
+ }
}
+ /*
+ * Case 3
+ * Rules Like: FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-3
+ */
+
} else if (has_by_data(impl,BY_MONTH_DAY)) {
- /* Cases like: FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-3 */
- short day;
+ int day;
@@ -1550,4 +1554,3 @@ int next_month(struct icalrecur_iterator_impl* impl)
if (day < 0) {
- day = icaltime_days_in_month(impl->last.month,impl->last.year)+
- day + 1;
+ day = icaltime_days_in_month(impl->last.month, impl->last.year) + day + 1;
}
@@ -1560,3 +1563,3 @@ int next_month(struct icalrecur_iterator_impl* impl)
- return data_valid; /* Signal that the data is valid */
+ return data_valid;
@@ -1564,10 +1567,64 @@ int next_month(struct icalrecur_iterator_impl* impl)
+static int next_weekday_by_week(icalrecur_iterator* impl)
+{
+
+ int end_of_data = 0;
+ int start_of_week, dow;
+ struct icaltimetype next;
+
+ if (next_hour(impl) == 0){
+ return 0;
+ }
+
+ if(!has_by_data(impl,BY_DAY)){
+ return 1;
+ }
+
+ /* If we get here, we need to step to tne next day */
+
+ for (;;) {
+ struct icaltimetype tt = icaltime_null_time();
+ BYDAYIDX++; /* Look at next elem in BYDAY array */
+
+ /* Are we at the end of the BYDAY array? */
+ if (BYDAYPTR[BYDAYIDX]==ICAL_RECURRENCE_ARRAY_MAX){
+ BYDAYIDX = 0; /* Reset to 0 */
+ end_of_data = 1; /* Signal that we're at the end */
+ }
+
+ /* Add the day of week offset to to the start of this week, and use
+ that to get the next day */
+ /* ignore position of dow ("4FR"), only use dow ("FR")*/
+ dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[BYDAYIDX]);
+ tt.year = impl->last.year;
+ tt.day = impl->last.day;
+ tt.month = impl->last.month;
+
+ start_of_week = icaltime_start_doy_of_week(tt);
+
+ dow--; /* Set Sunday to be 0 */
+
+ if(dow+start_of_week <1){
+ /* The selected date is in the previous year. */
+ if(!end_of_data){
+ continue;
+ }
+ }
+
+ next = icaltime_from_day_of_year(start_of_week + dow,impl->last.year);
+
+ impl->last.day = next.day;
+ impl->last.month = next.month;
+ impl->last.year = next.year;
+
+ return end_of_data;
+ }
+
+}
-int next_week(struct icalrecur_iterator_impl* impl)
+static int next_week(icalrecur_iterator* impl)
{
- short has_by_data = (impl->by_ptrs[BY_WEEK_NO][0]!=ICAL_RECURRENCE_ARRAY_MAX);
- short this_frequency = (impl->rule.freq == ICAL_WEEKLY_RECURRENCE);
- short end_of_data = 0;
+ int end_of_data = 0;
- /* Increment to the next week day */
+ /* Increment to the next week day, if there is data at a level less than a week */
if (next_weekday_by_week(impl) == 0){
@@ -1579,4 +1636,4 @@ int next_week(struct icalrecur_iterator_impl* impl)
-
- if( has_by_data){
+ if( has_by_data(impl,BY_WEEK_NO)){
+ /*FREQ=WEEKLY;BYWEEK=20*/
/* Use the Week Number byrule data */
@@ -1604,4 +1661,4 @@ int next_week(struct icalrecur_iterator_impl* impl)
- } else if( !has_by_data && this_frequency ){
- /* If there is no BY_WEEK_NO data, just jump forward 7 days. */
+ } else {
+ /* Jump to the next week */
increment_monthday(impl,7*impl->rule.interval);
@@ -1609,4 +1666,3 @@ int next_week(struct icalrecur_iterator_impl* impl)
-
- if(has_by_data && end_of_data && this_frequency ){
+ if( has_by_data(impl,BY_WEEK_NO) && end_of_data){
increment_year(impl,1);
@@ -1618,4 +1674,4 @@ int next_week(struct icalrecur_iterator_impl* impl)
-/* Expand the BYDAY rule part and return a pointer to a newly allocated list of days. */
-pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
+/** Expand the BYDAY rule part and return a pointer to a newly allocated list of days. */
+static pvl_list expand_by_day(icalrecur_iterator* impl, int year)
{
@@ -1625,3 +1681,3 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
- short start_dow, end_dow, end_year_day, start_doy;
+ int start_dow, end_dow, end_year_day;
struct icaltimetype tmp = impl->last;
@@ -1633,10 +1689,10 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
+ /* Find the day that 1st Jan falls on, 1 (Sun) to 7 (Sat). */
start_dow = icaltime_day_of_week(tmp);
- start_doy = icaltime_start_doy_of_week(tmp);
/* Get the last day of the year*/
- tmp.year++;
- tmp = icaltime_normalize(tmp);
- tmp.day--;
- tmp = icaltime_normalize(tmp);
+ tmp.year= year;
+ tmp.month = 12;
+ tmp.day = 31;
+ tmp.is_date = 1;
@@ -1646,5 +1702,6 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
for(i = 0; BYDAYPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
- short dow =
+ /* This is 1 (Sun) to 7 (Sat). */
+ int dow =
icalrecurrencetype_day_day_of_week(BYDAYPTR[i]);
- short pos = icalrecurrencetype_day_position(BYDAYPTR[i]);
+ int pos = icalrecurrencetype_day_position(BYDAYPTR[i]);
@@ -1654,12 +1711,9 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
days of the year with this day-of-week*/
- int week;
- for(week = 0; week < 52 ; week ++){
- short doy = start_doy + (week * 7) + dow-1;
+ int doy, tmp_start_doy;
- if(doy > end_year_day){
- break;
- } else {
+ tmp_start_doy = ((dow + 7 - start_dow) % 7) + 1;
+
+ for (doy = tmp_start_doy; doy <= end_year_day; doy += 7)
pvl_push(days_list,(void*)(int)doy);
- }
- }
+
} else if ( pos > 0) {
@@ -1673,3 +1727,3 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
- /* THen just multiple the position times 7 to get the pos'th day in the year */
+ /* Then just multiple the position times 7 to get the pos'th day in the year */
pvl_push(days_list,(void*)(first+ (pos-1) * 7));
@@ -1698,3 +1752,3 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
-int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
+static int expand_year_days(icalrecur_iterator* impl, int year)
{
@@ -1705,3 +1759,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- t = icaltime_null_time();
+ t = icaltime_null_date();
@@ -1709,7 +1763,8 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- t.is_date = 1; /* Needed to make day_of_year routines work property */
-
- memset(&t,0,sizeof(t));
memset(impl->days,ICAL_RECURRENCE_ARRAY_MAX_BYTE,sizeof(impl->days));
+ /* The flags and the following switch statement select which code
+ to use to expand the yers days, based on which BY-rules are
+ present. */
+
flags = (HBD(BY_DAY) ? 1<<BY_DAY : 0) +
@@ -1725,3 +1780,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
/* FREQ=YEARLY; */
+ t = impl->dtstart;
+ t.year = impl->last.year;
+ impl->days[days_index++] = (short)icaltime_day_of_year(t);
+
break;
@@ -1732,5 +1791,4 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
- struct icaltimetype t;
- short month = impl->by_ptrs[BY_MONTH][j];
- short doy;
+ int month = impl->by_ptrs[BY_MONTH][j];
+ int doy;
@@ -1743,3 +1801,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- impl->days[days_index++] = doy;
+ impl->days[days_index++] = (short)doy;
@@ -1753,4 +1811,4 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
{
- short month_day = impl->by_ptrs[BY_MONTH_DAY][k];
- short doy;
+ int month_day = impl->by_ptrs[BY_MONTH_DAY][k];
+ int doy;
@@ -1763,3 +1821,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- impl->days[days_index++] = doy;
+ impl->days[days_index++] = (short)doy;
@@ -1775,5 +1833,5 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
{
- short month = impl->by_ptrs[BY_MONTH][j];
- short month_day = impl->by_ptrs[BY_MONTH_DAY][k];
- short doy;
+ int month = impl->by_ptrs[BY_MONTH][j];
+ int month_day = impl->by_ptrs[BY_MONTH_DAY][k];
+ int doy;
@@ -1786,3 +1844,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- impl->days[days_index++] = doy;
+ impl->days[days_index++] = (short)doy;
@@ -1797,4 +1855,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- struct icaltimetype t;
- short dow;
+ int dow;
@@ -1821,3 +1878,2 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
/*FREQ=YEARLY; BYDAY=TH,20MO,-10FR*/
- int days_index = 0;
pvl_elem i;
@@ -1827,3 +1883,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(i=pvl_head(days);i!=0;i=pvl_next(i)){
- short day = (short)(int)pvl_data(i);
+ short day = (short)(*((int*)pvl_data(i)));
impl->days[days_index++] = day;
@@ -1839,27 +1895,55 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- int days_index = 0;
- pvl_elem itr;
- pvl_list days = expand_by_day(impl,year);
- for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
- short doy = (short)(int)pvl_data(itr);
- struct icaltimetype tt;
- short j;
+ for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
+ int month = impl->by_ptrs[BY_MONTH][j];
+ int days_in_month = icaltime_days_in_month(month,year);
+ int first_dow, last_dow, doy_offset;
- tt = icaltime_from_day_of_year(doy,year);
+ t.year = year;
+ t.month = month;
+ t.day = 1;
+ t.is_date = 1;
- for(j=0;
- impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;
- j++){
- short month = impl->by_ptrs[BY_MONTH][j];
+ first_dow = icaltime_day_of_week(t);
- if(tt.month == month){
- impl->days[days_index++] = doy;
- }
- }
+ /* This holds the day offset used to calculate the day of the year
+ from the month day. Just add the month day to this. */
+ doy_offset = icaltime_day_of_year(t) - 1;
- }
+ t.day = days_in_month;
+ last_dow = icaltime_day_of_week(t);
- pvl_free(days);
+ for(k=0;impl->by_ptrs[BY_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++){
+ short day_coded = impl->by_ptrs[BY_DAY][k];
+ enum icalrecurrencetype_weekday dow =
+ icalrecurrencetype_day_day_of_week(day_coded);
+ int pos = icalrecurrencetype_day_position(day_coded);
+ int first_matching_day, last_matching_day, day, month_day;
+
+ /* Calculate the first day in the month with the given weekday,
+ and the last day. */
+ first_matching_day = ((dow + 7 - first_dow) % 7) + 1;
+ last_matching_day = days_in_month - ((last_dow + 7 - dow) % 7);
+
+ if (pos == 0) {
+ /* Add all of instances of the weekday within the month. */
+ for (day = first_matching_day; day <= days_in_month; day += 7)
+ impl->days[days_index++] = (short)(doy_offset + day);
+
+ } else if (pos > 0) {
+ /* Add the nth instance of the weekday within the month. */
+ month_day = first_matching_day + (pos - 1) * 7;
+
+ if (month_day <= days_in_month)
+ impl->days[days_index++] = (short)(doy_offset + month_day);
+ } else {
+ /* Add the -nth instance of the weekday within the month.*/
+ month_day = last_matching_day + (pos + 1) * 7;
+
+ if (month_day > 0)
+ impl->days[days_index++] = (short)(doy_offset + month_day);
+ }
+ }
+ }
break;
@@ -1870,3 +1954,2 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- int days_index = 0;
pvl_elem itr;
@@ -1875,5 +1958,4 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
- short day = (short)(int)pvl_data(itr);
+ short day = (short)(*((int*)pvl_data(itr)));
struct icaltimetype tt;
- short j;
@@ -1882,3 +1964,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
- short mday = BYMDPTR[j];
+ int mday = BYMDPTR[j];
@@ -1899,3 +1981,2 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- int days_index = 0;
pvl_elem itr;
@@ -1904,5 +1985,5 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
- short day = (short)(int)pvl_data(itr);
+ short day = (short)(*((int*)pvl_data(itr)));
struct icaltimetype tt;
- short i,j;
+ int i;
@@ -1912,4 +1993,4 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
- short mday = BYMDPTR[j];
- short month = BYMONPTR[i];
+ int mday = BYMDPTR[j];
+ int month = BYMONPTR[i];
@@ -1932,3 +2013,2 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
- int days_index = 0;
pvl_elem itr;
@@ -1937,5 +2017,5 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
- short day = (short)(int)pvl_data(itr);
+ short day = (short)(*((int*)pvl_data(itr)));
struct icaltimetype tt;
- short i;
+ int i;
@@ -1944,5 +2024,5 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
- short weekno = BYWEEKPTR[i];
-
- if(weekno== icaltime_week_number(tt)){
+ int weekno = BYWEEKPTR[i];
+ int this_weekno = icaltime_week_number(tt);
+ if(weekno== this_weekno){
impl->days[days_index++] = day;
@@ -1965,4 +2045,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
for(j=0;impl->by_ptrs[BY_YEAR_DAY][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
- short doy = impl->by_ptrs[BY_YEAR_DAY][j];
- impl->days[days_index++] = doy;
+ impl->days[days_index++] = impl->by_ptrs[BY_YEAR_DAY][j];
}
@@ -1982,3 +2061,3 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
-int next_year(struct icalrecur_iterator_impl* impl)
+static int next_year(icalrecur_iterator* impl)
{
@@ -1986,5 +2065,4 @@ int next_year(struct icalrecur_iterator_impl* impl)
- /* Next_year does it's own interatio in days, so the next level down is hours */
if (next_hour(impl) == 0){
- return 1;
+ return 0;
}
@@ -1993,11 +2071,12 @@ int next_year(struct icalrecur_iterator_impl* impl)
impl->days_index = 0;
+
+ for (;;) {
increment_year(impl,impl->rule.interval);
expand_year_days(impl,impl->last.year);
+ if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX)
+ break;
}
-
- if(impl->days[0] == ICAL_RECURRENCE_ARRAY_MAX) {
- return 0;
}
- next = icaltime_from_day_of_year(impl->days[impl->days_index],impl->last.year);
+ next = icaltime_from_day_of_year(impl->days[impl->days_index], impl->last.year);
@@ -2009,4 +2088,4 @@ int next_year(struct icalrecur_iterator_impl* impl)
-int icalrecur_check_rulepart(struct icalrecur_iterator_impl* impl,
- short v, enum byrule byrule)
+int icalrecur_check_rulepart(icalrecur_iterator* impl,
+ int v, enum byrule byrule)
{
@@ -2025,4 +2104,4 @@ int icalrecur_check_rulepart(struct icalrecur_iterator_impl* impl,
-int check_contract_restriction(struct icalrecur_iterator_impl* impl,
- enum byrule byrule, short v)
+static int check_contract_restriction(icalrecur_iterator* impl,
+ enum byrule byrule, int v)
{
@@ -2050,18 +2129,18 @@ int check_contract_restriction(struct icalrecur_iterator_impl* impl,
-int check_contracting_rules(struct icalrecur_iterator_impl* impl)
+static int check_contracting_rules(icalrecur_iterator* impl)
{
- int day_of_week=0;
- int week_no=0;
- int year_day=0;
+ int day_of_week = icaltime_day_of_week(impl->last);
+ int week_no = icaltime_week_number(impl->last);
+ int year_day = icaltime_day_of_year(impl->last);
if (
- check_contract_restriction(impl,BY_SECOND,impl->last.second) &&
- check_contract_restriction(impl,BY_MINUTE,impl->last.minute) &&
- check_contract_restriction(impl,BY_HOUR,impl->last.hour) &&
- check_contract_restriction(impl,BY_DAY,day_of_week) &&
- check_contract_restriction(impl,BY_WEEK_NO,week_no) &&
- check_contract_restriction(impl,BY_MONTH_DAY,impl->last.day) &&
- check_contract_restriction(impl,BY_MONTH,impl->last.month) &&
- check_contract_restriction(impl,BY_YEAR_DAY,year_day) )
+ check_contract_restriction(impl,BY_SECOND, impl->last.second) &&
+ check_contract_restriction(impl,BY_MINUTE, impl->last.minute) &&
+ check_contract_restriction(impl,BY_HOUR, impl->last.hour) &&
+ check_contract_restriction(impl,BY_DAY, day_of_week) &&
+ check_contract_restriction(impl,BY_WEEK_NO, week_no) &&
+ check_contract_restriction(impl,BY_MONTH_DAY, impl->last.day) &&
+ check_contract_restriction(impl,BY_MONTH, impl->last.month) &&
+ check_contract_restriction(impl,BY_YEAR_DAY, year_day) )
{
@@ -2074,7 +2153,5 @@ int check_contracting_rules(struct icalrecur_iterator_impl* impl)
-struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr)
+struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl)
{
int valid = 1;
- struct icalrecur_iterator_impl* impl =
- (struct icalrecur_iterator_impl*)itr;
@@ -2122,3 +2199,3 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr)
case ICAL_YEARLY_RECURRENCE:{
- valid = next_year(impl);
+ next_year(impl);
break;
@@ -2137,3 +2214,3 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr)
} while(!check_contracting_rules(impl)
- || icaltime_compare(impl->last,impl->dtstart) <= 0
+ || icaltime_compare(impl->last,impl->dtstart) < 0
|| valid == 0);
@@ -2168,12 +2245,11 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *recur)
-/* The 'day' element of icalrecurrencetype_weekday is encoded to allow
-reporesentation of both the day of the week ( Monday, Tueday), but
-also the Nth day of the week ( First tuesday of the month, last
-thursday of the year) These routines decode the day values.
-
-The day's position in the period ( Nth-ness) and the numerical value
-of the day are encoded together as: pos*7 + dow
-
-A position of 0 means 'any' or 'every'
-
+/** The 'day' element of icalrecurrencetype_weekday is encoded to
+ * allow representation of both the day of the week ( Monday, Tueday),
+ * but also the Nth day of the week ( First tuesday of the month, last
+ * thursday of the year) These routines decode the day values.
+ *
+ * The day's position in the period ( Nth-ness) and the numerical
+ * value of the day are encoded together as: pos*7 + dow
+ *
+ * A position of 0 means 'any' or 'every'
*/
@@ -2185,5 +2261,5 @@ enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day)
-short icalrecurrencetype_day_position(short day)
+int icalrecurrencetype_day_position(short day)
{
- short wd, pos;
+ int wd, pos;
@@ -2200,3 +2276,3 @@ short icalrecurrencetype_day_position(short day)
-struct {icalrecurrencetype_weekday wd; const char * str; }
+static struct {icalrecurrencetype_weekday wd; const char * str; }
wd_map[] = {
@@ -2240,3 +2316,3 @@ icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str)
-struct {
+static struct {
icalrecurrencetype_frequency kind;
@@ -2278,6 +2354,7 @@ icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str)
-/* Fill an array with the 'count' number of occurrences generated by
- the rrule. Note that the times are returned in UTC, but the times
- are calculated in local time. YOu will have to convert the results
- back into local time before using them. */
+/** Fill an array with the 'count' number of occurrences generated by
+ * the rrule. Note that the times are returned in UTC, but the times
+ * are calculated in local time. YOu will have to convert the results
+ * back into local time before using them.
+ */
@@ -2294,3 +2371,3 @@ int icalrecur_expand_recurrence(char* rule, time_t start,
- icstart = icaltime_from_timet(start,0);
+ icstart = icaltime_from_timet_with_zone(start,0,0);
diff --git a/libical/src/libical/icalrecur.h b/libical/src/libical/icalrecur.h
index 5fcdc15..5f6ac55 100644
--- a/libical/src/libical/icalrecur.h
+++ b/libical/src/libical/icalrecur.h
@@ -18,2 +18,7 @@
the License at http://www.mozilla.org/MPL/
+*/
+
+/**
+@file icalrecur.h
+@brief Routines for dealing with recurring time
@@ -22,2 +27,4 @@ How to use:
1) Get a rule and a start time from a component
+
+@code
icalproperty rrule;
@@ -29,12 +36,21 @@ How to use:
start = icalproperty_get_dtstart(dtstart);
+@endcode
Or, just make them up:
+
+@code
recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE");
dtstart = icaltime_from_string("19970101T123000")
+@endcode
2) Create an iterator
+
+@code
icalrecur_iterator* ritr;
ritr = icalrecur_iterator_new(recur,start);
+@endcode
3) Iterator over the occurrences
+
+@code
struct icaltimetype next;
@@ -44,2 +60,3 @@ Or, just make them up:
}
+@endcode
@@ -48,3 +65,3 @@ whatever timezone that dtstart is in.
-======================================================================*/
+*/
@@ -56,5 +73,5 @@ whatever timezone that dtstart is in.
-/***********************************************************************
+/*
* Recurrance enumerations
-**********************************************************************/
+ */
@@ -95,3 +112,5 @@ enum {
-/********************** Recurrence type routines **************/
+/**
+ * Recurrence type routines
+ */
@@ -110,3 +129,3 @@ enum {
-/* Main struct for holding digested recurrence rules */
+/** Main struct for holding digested recurrence rules */
struct icalrecurrencetype
@@ -147,19 +166,21 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *r);
-/* The 'day' element of the by_day array is encoded to allow
-representation of both the day of the week ( Monday, Tueday), but also
-the Nth day of the week ( First tuesday of the month, last thursday of
-the year) These routines decode the day values */
+/**
+ * Array Encoding
+ *
+ * The 'day' element of the by_day array is encoded to allow
+ * representation of both the day of the week ( Monday, Tueday), but also
+ * the Nth day of the week ( First tuesday of the month, last thursday of
+ * the year) These routines decode the day values
+ */
-/* 1 == Monday, etc. */
+/** 1 == Monday, etc. */
enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
-/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
-short icalrecurrencetype_day_position(short day);
+/** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
+int icalrecurrencetype_day_position(short day);
-/***********************************************************************
- * Recurrance rule parser
-**********************************************************************/
+/** Recurrance rule parser */
-/* Convert between strings ans recurrencetype structures. */
+/** Convert between strings and recurrencetype structures. */
struct icalrecurrencetype icalrecurrencetype_from_string(const char* str);
@@ -168,7 +189,7 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur);
-/********** recurrence iteration routines ********************/
+/** Recurrence iteration routines */
-typedef void icalrecur_iterator;
+typedef struct icalrecur_iterator_impl icalrecur_iterator;
-/* Create a new recurrence rule iterator */
+/** Create a new recurrence rule iterator */
icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
@@ -176,10 +197,14 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
-/* Get the next occurrence from an iterator */
+/** Get the next occurrence from an iterator */
struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*);
-/* Free the iterator */
+void icalrecur_iterator_decrement_count(icalrecur_iterator*);
+
+/** Free the iterator */
void icalrecur_iterator_free(icalrecur_iterator*);
-/* Fills array up with at most 'count' time_t values, each
- representing an occurrence time in seconds past the POSIX epoch */
+/**
+ * Fills array up with at most 'count' time_t values, each
+ * representing an occurrence time in seconds past the POSIX epoch
+ */
int icalrecur_expand_recurrence(char* rule, time_t start,
diff --git a/libical/src/libical/icalrestriction.c b/libical/src/libical/icalrestriction.c
index 0f863c4..3d2bd15 100644
--- a/libical/src/libical/icalrestriction.c
+++ b/libical/src/libical/icalrestriction.c
@@ -19,6 +19,9 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
-
#define TMP_BUF_SIZE 1024
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
+
@@ -65,3 +68,3 @@ icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_
-/* The each row gives the result of comparing a restriction against a
+/** The each row gives the result of comparing a restriction against a
count. The columns in each row represent 0,1,2+. '-1' indicates
@@ -223,3 +226,3 @@ char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
- return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
+ return "Failed iTIP restrictions. This component must have a DURATION property";
@@ -234,3 +237,3 @@ char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
- return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
+ return "Failed iTIP restrictions. This component must have a REPEAT property";
@@ -251,5 +254,5 @@ char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
- if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
+ if( icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
- return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
+ return "Failed iTIP restrictions. The component must not have both DURATION and DTEND";
@@ -266,3 +269,17 @@ char* icalrestriction_no_duration(icalrestriction_property_record *rec,
}
+char* icalrestriction_must_be_email(
+ icalrestriction_property_record *rec,
+ icalcomponent* comp,
+ icalproperty* prop)
+{
+ icalproperty_status stat = icalproperty_get_action(prop);
+ if( !( stat == ICAL_ACTION_EMAIL)){
+
+ return "Failed iTIP restrictions for ACTION property. Value must be EMAIL.";
+
+ }
+
+ return 0;
+}
@@ -274,4 +291,3 @@ int icalrestriction_check_component(icalproperty_method method,
icalrestriction_kind restr;
- icalrestriction_property_record *prop_record = 0L;
- icalrestriction_component_record *comp_record = 0L;
+ icalrestriction_property_record *prop_record;
char* funcr = 0;
@@ -465,4 +481,4 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
- {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
- {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
+ {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
{ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -483,2 +499,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
@@ -515,2 +532,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -547,2 +565,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -562,3 +581,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
- {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
+ {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
{ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -579,2 +598,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -593,3 +613,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
- {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
+ {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
{ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -611,2 +631,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -643,2 +664,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -658,3 +680,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
- {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
+ {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
{ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -675,2 +697,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -707,2 +730,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -748,3 +772,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
- {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
{ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -779,5 +803,6 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
{ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
- {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
{ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -811,2 +836,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
@@ -843,2 +869,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -875,2 +902,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -906,2 +934,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -937,2 +966,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
@@ -969,2 +999,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
@@ -1000,2 +1031,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
@@ -1073,2 +1105,42 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_ALLOWCONFLICT_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTCHARSET_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTLOCALE_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTTZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
{ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
@@ -1076,2 +1148,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
@@ -1136,3 +1209,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
- {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
+ {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
{ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -1169,2 +1242,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
@@ -1217,2 +1291,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
{ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
@@ -1553,3 +1628,3 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
- {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,icalrestriction_must_be_email},
{ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
@@ -1649,2 +1724,5 @@ icalrestriction_property_record icalrestriction_property_records[] = {
{ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_QUERY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
+ {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_QUERYNAME_PROPERTY,ICAL_RESTRICTION_ONE,0},
+ {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_EXPAND_PROPERTY,ICAL_RESTRICTION_ONE,0},
{ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE}
@@ -1779,2 +1857,4 @@ icalrestriction_component_record icalrestriction_component_records[] = {
{ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
+ {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_XSTANDARD_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
+ {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_XDAYLIGHT_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
{ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
index a04ca04..3aac74e 100644
--- a/libical/src/libical/icaltime.c
+++ b/libical/src/libical/icaltime.c
@@ -28,3 +28,3 @@
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
@@ -36,126 +36,207 @@
#include <stdio.h>
+#include <time.h>
-int snprintf(char *str, size_t n, char const *fmt, ...);
+#include "astime.h" /* Julian data handling routines */
-#ifdef ICAL_NO_LIBICAL
-#define icalerror_set_errno(x)
-#define icalerror_check_arg_rv(x,y)
-#define icalerror_check_arg_re(x,y,z)
-#else
#include "icalerror.h"
#include "icalmemory.h"
+
+#include "icaltimezone.h"
+#include "icalvalue.h"
+
+#ifdef WIN32
+#include <Windows.h>
+#define ERROR error
+#define snprintf _snprintf
+#define strcasecmp stricmp
#endif
+/*
+ * Function to convert a struct tm time specification
+ * to an ANSI time_t using the specified time zone.
+ * This is different from the standard mktime() function
+ * in that we dont want the automatic adjustments for
+ * local daylight savings time applied to the result.
+ * This function expects well-formed input.
+ */
+static time_t make_time(struct tm *tm, int tzm)
+{
+ time_t tim;
+ static int days[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 };
+ /* check that year specification within range */
-struct icaltimetype
-icaltime_from_timet(time_t tm, int is_date)
-{
- struct icaltimetype tt = icaltime_null_time();
- struct tm t;
+ if (tm->tm_year < 70 || tm->tm_year > 138)
+ return((time_t) -1);
- t = *(gmtime(&tm));
-
- if(is_date == 0){
- tt.second = t.tm_sec;
- tt.minute = t.tm_min;
- tt.hour = t.tm_hour;
- } else {
- tt.second = tt.minute =tt.hour = 0 ;
- }
+ /* check that month specification within range */
- tt.day = t.tm_mday;
- tt.month = t.tm_mon + 1;
- tt.year = t.tm_year+ 1900;
-
- tt.is_utc = 1;
- tt.is_date = is_date;
+ if (tm->tm_mon < 0 || tm->tm_mon > 11)
+ return((time_t) -1);
- return tt;
-}
+ /* check for upper bound of Jan 17, 2038 (to avoid possibility of
+ 32-bit arithmetic overflow) */
+
+ if (tm->tm_year == 138) {
+ if (tm->tm_mon > 0)
+ return((time_t) -1);
+ else if (tm->tm_mday > 17)
+ return((time_t) -1);
+ }
-/* Structure used by set_tz to hold an old value of TZ, and the new
- value, which is in memory we will have to free in unset_tz */
-struct set_tz_save {char* orig_tzid; char* new_env_str;};
+ /*
+ * calculate elapsed days since start of the epoch (midnight Jan
+ * 1st, 1970 UTC) 17 = number of leap years between 1900 and 1970
+ * (number of leap days to subtract)
+ */
-/* Temporarily change the TZ environmental variable. */
-struct set_tz_save set_tz(const char* tzid)
-{
+ tim = (tm->tm_year - 70) * 365 + ((tm->tm_year - 1) / 4) - 17;
- char *orig_tzid = 0;
- char *new_env_str;
- struct set_tz_save savetz;
- size_t tmp_sz;
+ /* add number of days elapsed in the current year */
- savetz.orig_tzid = 0;
- savetz.new_env_str = 0;
+ tim += days[tm->tm_mon];
- if(getenv("TZ") != 0){
- orig_tzid = (char*)icalmemory_strdup(getenv("TZ"));
+ /* check and adjust for leap years (the leap year check only valid
+ during the 32-bit era */
- if(orig_tzid == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return savetz;
- }
- }
+ if ((tm->tm_year & 3) == 0 && tm->tm_mon > 1)
+ tim += 1;
- tmp_sz =strlen(tzid)+4;
- new_env_str = (char*)malloc(tmp_sz);
+ /* elapsed days to current date */
- if(new_env_str == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return savetz;
- }
-
- /* Copy the TZid into a string with the form that putenv expects. */
- strcpy(new_env_str,"TZ=");
- strcpy(new_env_str+3,tzid);
+ tim += tm->tm_mday;
- putenv(new_env_str);
- /* Old value of TZ and the string we will have to free later */
- savetz.orig_tzid = orig_tzid;
- savetz.new_env_str = new_env_str;
- return savetz;
+ /* calculate elapsed hours since start of the epoch */
+
+ tim = tim * 24 + tm->tm_hour;
+
+ /* calculate elapsed minutes since start of the epoch */
+
+ tim = tim * 60 + tm->tm_min;
+
+ /* adjust per time zone specification */
+
+ tim -= tzm;
+
+ /* calculate elapsed seconds since start of the epoch */
+
+ tim = tim * 60 + tm->tm_sec;
+
+ /* return number of seconds since start of the epoch */
+
+ return(tim);
}
-void unset_tz(struct set_tz_save savetz)
+/** @brief Constructor (deprecated).
+ *
+ * Convert seconds past UNIX epoch to a timetype.
+ *
+ * @deprecated This constructor is deprecated and shouldn't be used in
+ * new software. Use icaltime_from_timet_with_zone(time_t, int,
+ * icaltimezone *) instead. In the meantime, calls to this method
+ * return a floating time, which can always be converted to a local
+ * time with an appropriate call to icaltime_convert_to_zone().
+ */
+
+struct icaltimetype
+icaltime_from_timet(const time_t tm, const int is_date)
{
- /* restore the original TZ environment */
+#ifndef NO_WARN_DEPRECATED
+ icalerror_warn("icaltime_from_timet() is DEPRECATED, use icaltime_from_timet_with_zone() instead");
+#endif
- char* orig_tzid = savetz.orig_tzid;
+ return icaltime_from_timet_with_zone(tm, is_date, 0);
+}
- if(orig_tzid!=0){
- size_t tmp_sz =strlen(orig_tzid)+4;
- char* orig_env_str = (char*)icalmemory_tmp_buffer(tmp_sz);
- if(orig_env_str == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return;
- }
-
- strcpy(orig_env_str,"TZ=");
- strcpy(orig_env_str+3,orig_tzid);
-#ifndef _WIN32
- setenv("TZ", savetz.orig_tzid,1 );
-#else
- putenv("TZ=MEZ");//, savetz.orig_tzid );
-#endif
- free(orig_tzid);
- } else {
-#ifdef __FreeBSD__
- unsetenv("TZ");
+/** @brief Constructor.
+ *
+ * @param tm The time
+ * @param is_date Boolean: 1 means we should treat tm as a DATE
+ * @param zone The timezone tm is in, NULL means to treat tm as a
+ * floating time
+ *
+ * Return a new icaltime instance, initialized to the given time
+ * expressed as seconds past UNIX epoch, optionally using the given
+ * timezone.
+ *
+ * If the caller specifies the is_date param as TRUE, the returned
+ * object is of DATE type, otherwise the input is meant to be of
+ * DATE-TIME type.
+ * If the zone is not specified (NULL zone param) the time is taken
+ * to be floating, that is, valid in any timezone. Note that, in
+ * addition to the uses specified in [RFC2445], this can be used
+ * when doing simple math on couples of times.
+ * If the zone is specified (UTC or otherwise), it's stored in the
+ * object and it's used as the native timezone for this object.
+ * This means that the caller can convert this time to a different
+ * target timezone with no need to store the source timezone.
+ *
+ */
+struct icaltimetype
+icaltime_from_timet_with_zone(const time_t tm, const int is_date,
+ const icaltimezone *zone)
+{
+ struct icaltimetype tt = icaltime_null_time();
+ struct tm t;
+ icaltimezone *utc_zone;
+
+ /* Convert the time_t to a struct tm. We can trust gmtime for this. */
+#ifdef HAVE_GMTIME_R
+ gmtime_r(&tm, &t);
#else
- putenv("TZ"); /* Delete from environment */
+ {
+ struct tm *t_ptr = gmtime(&tm);
+ t = *t_ptr;
+ }
#endif
- }
- if(savetz.new_env_str != 0){
- free(savetz.new_env_str);
+ tt.year = t.tm_year + 1900;
+ tt.month = t.tm_mon + 1;
+ tt.day = t.tm_mday;
+
+ if (is_date) {
+ tt.is_date = 1;
+ return tt;
}
+
+ tt.hour = t.tm_hour;
+ tt.minute = t.tm_min;
+ tt.second = t.tm_sec;
+
+ /* If it's a floating time, we don't do any conversion. */
+ if (zone == NULL) {
+ return tt;
+ }
+
+ utc_zone = icaltimezone_get_utc_timezone ();
+ tt.is_utc = (zone == utc_zone) ? 1 : 0;
+ tt.zone = zone;
+
+ return tt;
}
+/** @brief Convenience constructor.
+ *
+ * Returns the current time in the given timezone, as an icaltimetype.
+ */
+struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone)
+{
+ return icaltime_from_timet_with_zone (time (NULL), 0, zone);
+}
-time_t icaltime_as_timet(struct icaltimetype tt)
+/** @brief Convenience constructor.
+ *
+ * Returns the current day as an icaltimetype, with is_date set.
+ */
+struct icaltimetype icaltime_today(void)
+{
+ return icaltime_from_timet_with_zone (time (NULL), 1, NULL);
+}
+
+/** @brief Return the time as seconds past the UNIX epoch
+ */
+time_t icaltime_as_timet(const struct icaltimetype tt)
{
@@ -164,5 +245,4 @@ time_t icaltime_as_timet(struct icaltimetype tt)
- memset(&stm,0,sizeof( struct tm));
-
- if(icaltime_is_null_time(tt)) {
+ /* If the time is the special null time, return 0. */
+ if (icaltime_is_null_time(tt)) {
return 0;
@@ -170,2 +250,5 @@ time_t icaltime_as_timet(struct icaltimetype tt)
+ /* Copy the icaltimetype to a struct tm. */
+ memset (&stm, 0, sizeof (struct tm));
+
stm.tm_sec = tt.second;
@@ -178,9 +261,3 @@ time_t icaltime_as_timet(struct icaltimetype tt)
- if(tt.is_utc == 1 || tt.is_date == 1){
- struct set_tz_save old_tz = set_tz("UTC");
- t = mktime(&stm);
- unset_tz(old_tz);
- } else {
- t = mktime(&stm);
- }
+ t = make_time(&stm, 0);
@@ -190,3 +267,47 @@ time_t icaltime_as_timet(struct icaltimetype tt)
-char* icaltime_as_ical_string(struct icaltimetype tt)
+/** @brief Return the time as seconds past the UNIX epoch, using the
+ * given timezone.
+ *
+ * This convenience method combines a call to icaltime_convert() with
+ * a call to icaltime_as_timet().
+ * If the input timezone is null, no conversion is done; that is, the
+ * time is simply returned as time_t in its native timezone.
+ */
+time_t icaltime_as_timet_with_zone(const struct icaltimetype _tt,
+ const icaltimezone *zone)
+{
+ struct icaltimetype tt = _tt;
+ struct tm stm;
+ time_t t;
+
+ /* If the time is the special null time, return 0. */
+ if (icaltime_is_null_time(tt)) {
+ return 0;
+ }
+
+ if (zone != NULL) {
+ tt = icaltime_convert_to_zone(_tt, zone);
+ }
+
+ /* Copy the icaltimetype to a struct tm. */
+ memset (&stm, 0, sizeof (struct tm));
+
+ stm.tm_sec = tt.second;
+ stm.tm_min = tt.minute;
+ stm.tm_hour = tt.hour;
+ stm.tm_mday = tt.day;
+ stm.tm_mon = tt.month-1;
+ stm.tm_year = tt.year-1900;
+ stm.tm_isdst = -1;
+
+ t = make_time(&stm, 0);
+
+ return t;
+}
+
+/**
+ * Return a string represention of the time, in RFC2445 format. The
+ * string is owned by libical
+ */
+const char* icaltime_as_ical_string(const struct icaltimetype tt)
{
@@ -214,97 +335,16 @@ char* icaltime_as_ical_string(struct icaltimetype tt)
-
-/* convert tt, of timezone tzid, into a utc time */
-struct icaltimetype icaltime_as_utc(struct icaltimetype tt,const char* tzid)
-{
- int tzid_offset;
-
- if(tt.is_utc == 1 || tt.is_date == 1){
- return tt;
- }
-
- tzid_offset = icaltime_utc_offset(tt,tzid);
-
- tt.second -= tzid_offset;
-
- tt.is_utc = 1;
-
- return icaltime_normalize(tt);
-}
-
-/* convert tt, a time in UTC, into a time in timezone tzid */
-struct icaltimetype icaltime_as_zone(struct icaltimetype tt,const char* tzid)
+/**
+ * Reset all of the time components to be in their normal ranges. For
+ * instance, given a time with minutes=70, the minutes will be reduces
+ * to 10, and the hour incremented. This allows the caller to do
+ * arithmetic on times without worrying about overflow or
+ * underflow.
+ *
+ * Implementation note: we call icaltime_adjust() with no adjustment.
+ */
+struct icaltimetype icaltime_normalize(const struct icaltimetype tt)
{
- int tzid_offset;
-
- tzid_offset = icaltime_utc_offset(tt,tzid);
-
- tt.second += tzid_offset;
-
- tt.is_utc = 0;
-
- return icaltime_normalize(tt);
-
-}
-
-
-/* Return the offset of the named zone as seconds. tt is a time
- indicating the date for which you want the offset */
-int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid)
-{
-
- time_t tt = icaltime_as_timet(ictt);
- time_t offset_tt;
- struct tm gtm;
- struct set_tz_save old_tz;
-
- if(tzid != 0){
- old_tz = set_tz(tzid);
- }
-
- /* Mis-interpret a UTC broken out time as local time */
- gtm = *(gmtime(&tt));
- gtm.tm_isdst = localtime(&tt)->tm_isdst;
- offset_tt = mktime(&gtm);
-
- if(tzid != 0){
- unset_tz(old_tz);
- }
-
- return tt-offset_tt;
-}
-
-
-
-/* Normalize by converting from localtime to utc and back to local
- time. This uses localtime because localtime and mktime are inverses
- of each other */
-
-struct icaltimetype icaltime_normalize(struct icaltimetype tt)
-{
- struct tm stm;
- time_t tut;
-
- memset(&stm,0,sizeof( struct tm));
-
- stm.tm_sec = tt.second;
- stm.tm_min = tt.minute;
- stm.tm_hour = tt.hour;
- stm.tm_mday = tt.day;
- stm.tm_mon = tt.month-1;
- stm.tm_year = tt.year-1900;
- stm.tm_isdst = -1; /* prevents mktime from changing hour based on
- daylight savings */
-
- tut = mktime(&stm);
-
- stm = *(localtime(&tut));
-
- tt.second = stm.tm_sec;
- tt.minute = stm.tm_min;
- tt.hour = stm.tm_hour;
- tt.day = stm.tm_mday;
- tt.month = stm.tm_mon +1;
- tt.year = stm.tm_year+1900;
-
- return tt;
+ struct icaltimetype ret = tt;
+ icaltime_adjust(&ret, 0, 0, 0, 0);
+ return ret;
}
@@ -312,5 +352,12 @@ struct icaltimetype icaltime_normalize(struct icaltimetype tt)
-#ifndef ICAL_NO_LIBICAL
-#include "icalvalue.h"
+/** @brief Contructor.
+ *
+ * Create a time from an ISO format string.
+ *
+ * @todo If the given string specifies a DATE-TIME not in UTC, there
+ * is no way to know if this is a floating time or really refers to a
+ * timezone. We should probably add a new constructor:
+ * icaltime_from_string_with_zone()
+ */
struct icaltimetype icaltime_from_string(const char* str)
@@ -328,10 +375,8 @@ struct icaltimetype icaltime_from_string(const char* str)
} else if (size == 16) { /* UTC time, ends in 'Z'*/
+ if(str[15] != 'Z')
+ goto ERROR;
+
tt.is_utc = 1;
+ tt.zone = icaltimezone_get_utc_timezone();
tt.is_date = 0;
-
- if(str[15] != 'Z'){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
- }
-
} else if (size == 8) { /* A DATE */
@@ -340,4 +385,3 @@ struct icaltimetype icaltime_from_string(const char* str)
} else { /* error */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
+ goto ERROR;
}
@@ -345,13 +389,12 @@ struct icaltimetype icaltime_from_string(const char* str)
if(tt.is_date == 1){
- sscanf(str,"%04d%02d%02d",&tt.year,&tt.month,&tt.day);
+ if (sscanf(str,"%04d%02d%02d",&tt.year,&tt.month,&tt.day) < 3)
+ goto ERROR;
} else {
char tsep;
- sscanf(str,"%04d%02d%02d%c%02d%02d%02d",&tt.year,&tt.month,&tt.day,
- &tsep,&tt.hour,&tt.minute,&tt.second);
-
- if(tsep != 'T'){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
- }
+ if (sscanf(str,"%04d%02d%02d%c%02d%02d%02d",&tt.year,&tt.month,&tt.day,
+ &tsep,&tt.hour,&tt.minute,&tt.second) < 7)
+ goto ERROR;
+ if(tsep != 'T')
+ goto ERROR;
}
@@ -359,26 +402,27 @@ struct icaltimetype icaltime_from_string(const char* str)
return tt;
+
+ERROR:
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return icaltime_null_time();
}
-#endif
-char ctime_str[20];
-char* icaltime_as_ctime(struct icaltimetype t)
-{
- time_t tt;
-
- tt = icaltime_as_timet(t);
- sprintf(ctime_str,"%s",ctime(&tt));
- ctime_str[strlen(ctime_str)-1] = 0;
+/* Returns whether the specified year is a leap year. Year is the normal year,
+ e.g. 2001. */
+int
+icaltime_is_leap_year (const int year)
+{
- return ctime_str;
+ if (year <= 1752)
+ return (year % 4 == 0);
+ else
+ return ( (year % 4==0) && (year % 100 !=0 )) || (year % 400 == 0);
}
+static int _days_in_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
-short days_in_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
-
-short icaltime_days_in_month(short month,short year)
+int icaltime_days_in_month(const int month, const int year)
{
- int is_leap =0;
- int days = days_in_month[month];
+ int days = _days_in_month[month];
@@ -387,9 +431,4 @@ short icaltime_days_in_month(short month,short year)
- if( (year % 4 == 0 && year % 100 != 0) ||
- year % 400 == 0){
- is_leap =1;
- }
-
if( month == 2){
- days += is_leap;
+ days += icaltime_is_leap_year(year);
}
@@ -400,104 +439,138 @@ short icaltime_days_in_month(short month,short year)
/* 1-> Sunday, 7->Saturday */
-short icaltime_day_of_week(struct icaltimetype t){
+int icaltime_day_of_week(const struct icaltimetype t){
+ UTinstant jt;
- time_t tt = icaltime_as_timet(t);
- struct tm *tm;
+ memset(&jt,0,sizeof(UTinstant));
- if(t.is_utc == 1 || t.is_date == 1){
- tm = gmtime(&tt);
- } else {
- tm = localtime(&tt);
- }
+ jt.year = t.year;
+ jt.month = t.month;
+ jt.day = t.day;
+ jt.i_hour = 0;
+ jt.i_minute = 0;
+ jt.i_second = 0;
+
+ juldat(&jt);
- return tm->tm_wday+1;
+ return jt.weekday + 1;
}
-/* Day of the year that the first day of the week (Sunday) is on */
-short icaltime_start_doy_of_week(struct icaltimetype t){
- time_t tt = icaltime_as_timet(t);
- time_t start_tt;
- struct tm *stm;
- int syear;
+/** Day of the year that the first day of the week (Sunday) is on.
+ *
+ * @todo Doesn't take into account different week start days.
+ */
+int icaltime_start_doy_of_week(const struct icaltimetype t){
+ UTinstant jt;
- stm = gmtime(&tt);
- syear = stm->tm_year;
+ memset(&jt,0,sizeof(UTinstant));
- start_tt = tt - stm->tm_wday*(60*60*24);
+ jt.year = t.year;
+ jt.month = t.month;
+ jt.day = t.day;
+ jt.i_hour = 0;
+ jt.i_minute = 0;
+ jt.i_second = 0;
- stm = gmtime(&start_tt);
-
- if(syear == stm->tm_year){
- return stm->tm_yday+1;
- } else {
- /* return negative to indicate that start of week is in
- previous year. */
- int is_leap = 0;
- int year = stm->tm_year;
-
- if( (year % 4 == 0 && year % 100 != 0) ||
- year % 400 == 0){
- is_leap =1;
- }
+ juldat(&jt);
+ caldat(&jt);
- return (stm->tm_yday+1)-(365+is_leap);
- }
-
+ return jt.day_of_year - jt.weekday;
}
-short icaltime_week_number(struct icaltimetype ictt)
+/**
+ * @todo Doesn't take into account the start day of the
+ * week. strftime assumes that weeks start on Monday.
+ */
+int icaltime_week_number(const struct icaltimetype ictt)
{
- char str[5];
- time_t t = icaltime_as_timet(ictt);
- int week_no;
+ UTinstant jt;
- strftime(str,5,"%V", gmtime(&t));
+ memset(&jt,0,sizeof(UTinstant));
- week_no = atoi(str);
+ jt.year = ictt.year;
+ jt.month = ictt.month;
+ jt.day = ictt.day;
+ jt.i_hour = 0;
+ jt.i_minute = 0;
+ jt.i_second = 0;
- return week_no;
+ juldat(&jt);
+ caldat(&jt);
+ return (jt.day_of_year - jt.weekday) / 7;
}
+/* The first array is for non-leap years, the second for leap years*/
+static const int days_in_year[2][13] =
+{ /* jan feb mar apr may jun jul aug sep oct nov dec */
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
-short icaltime_day_of_year(struct icaltimetype t){
- time_t tt;
- struct tm *stm;
- struct set_tz_save old_tz;
-
- tt = icaltime_as_timet(t);
+/**
+ * Returns the day of the year, counting from 1 (Jan 1st).
+ */
+int icaltime_day_of_year(const struct icaltimetype t){
+ int is_leap = icaltime_is_leap_year (t.year);
- old_tz = set_tz("UTC");
- stm = localtime(&tt);
- unset_tz(old_tz);
-
- return stm->tm_yday+1;
-
+ return days_in_year[is_leap][t.month - 1] + t.day;
}
+/** @brief Contructor.
+ *
+ * Create a new time, given a day of year and a year.
+ */
/* Jan 1 is day #1, not 0 */
-struct icaltimetype icaltime_from_day_of_year(short doy, short year)
+struct icaltimetype icaltime_from_day_of_year(const int _doy, const int _year)
{
- struct tm stm;
- time_t tt;
- struct set_tz_save old_tz;
-
- /* Get the time of january 1 of this year*/
- memset(&stm,0,sizeof(struct tm));
- stm.tm_year = year-1900;
- stm.tm_mday = 1;
+ struct icaltimetype tt = icaltime_null_date();
+ int is_leap;
+ int month;
+ int doy = _doy;
+ int year = _year;
+
+ is_leap = icaltime_is_leap_year(year);
+
+ /* Zero and neg numbers represent days of the previous year */
+ if(doy <1){
+ year--;
+ is_leap = icaltime_is_leap_year(year);
+ doy += days_in_year[is_leap][12];
+ } else if(doy > days_in_year[is_leap][12]){
+ /* Move on to the next year*/
+ is_leap = icaltime_is_leap_year(year);
+ doy -= days_in_year[is_leap][12];
+ year++;
+ }
- old_tz = set_tz("UTC");
- tt = mktime(&stm);
- unset_tz(old_tz);
+ tt.year = year;
+ for (month = 11; month >= 0; month--) {
+ if (doy > days_in_year[is_leap][month]) {
+ tt.month = month + 1;
+ tt.day = doy - days_in_year[is_leap][month];
+ break;
+ }
+ }
- /* Now add in the days */
+ return tt;
+}
- doy--;
- tt += doy *60*60*24;
+/** @brief Constructor.
+ *
+ * Return a null time, which indicates no time has been set.
+ * This time represents the beginning of the epoch.
+ */
+struct icaltimetype icaltime_null_time(void)
+{
+ struct icaltimetype t;
+ memset(&t,0,sizeof(struct icaltimetype));
- return icaltime_from_timet(tt, 1);
+ return t;
}
-struct icaltimetype icaltime_null_time()
+/** @brief Constructor.
+ *
+ * Return a null date, which indicates no time has been set.
+ */
+struct icaltimetype icaltime_null_date(void)
{
@@ -506,2 +579,12 @@ struct icaltimetype icaltime_null_time()
+ t.is_date = 1;
+
+ /*
+ * Init to -1 to match what icalyacc.y used to do.
+ * Does anything depend on this?
+ */
+ t.hour = -1;
+ t.minute = -1;
+ t.second = -1;
+
return t;
@@ -510,3 +593,8 @@ struct icaltimetype icaltime_null_time()
-int icaltime_is_valid_time(struct icaltimetype t){
+/**
+ * Returns false if the time is clearly invalid, but is not null. This
+ * is usually the result of creating a new time type buy not clearing
+ * it, or setting one of the flags to an illegal value.
+ */
+int icaltime_is_valid_time(const struct icaltimetype t){
if(t.is_utc > 1 || t.is_utc < 0 ||
@@ -521,3 +609,22 @@ int icaltime_is_valid_time(struct icaltimetype t){
-int icaltime_is_null_time(struct icaltimetype t)
+/** @brief Returns true if time is a DATE
+ */
+int icaltime_is_date(const struct icaltimetype t) {
+
+ return t.is_date;
+}
+
+/** @brief Returns true if time is relative to UTC zone
+ *
+ * @todo We should only check the zone
+ */
+int icaltime_is_utc(const struct icaltimetype t) {
+
+ return t.is_utc;
+}
+
+/**
+ * Return true if the time is null.
+ */
+int icaltime_is_null_time(const struct icaltimetype t)
{
@@ -531,40 +638,97 @@ int icaltime_is_null_time(struct icaltimetype t)
-int icaltime_compare(struct icaltimetype a,struct icaltimetype b)
-{
- time_t t1 = icaltime_as_timet(a);
- time_t t2 = icaltime_as_timet(b);
-
- if (t1 > t2) {
- return 1;
- } else if (t1 < t2) {
- return -1;
- } else {
- return 0;
- }
+/**
+ * Return -1, 0, or 1 to indicate that a<b, a==b, or a>b.
+ * This calls icaltime_compare function after converting them to the utc
+ * timezone.
+ */
+int icaltime_compare(const struct icaltimetype a_in, const struct icaltimetype b_in)
+{
+ int retval = 0;
+ struct icaltimetype a, b;
+
+ a = icaltime_convert_to_zone(a_in, icaltimezone_get_utc_timezone());
+ b = icaltime_convert_to_zone(b_in, icaltimezone_get_utc_timezone());
+
+ if (a.year > b.year)
+ retval = 1;
+ else if (a.year < b.year)
+ retval = -1;
+
+ else if (a.month > b.month)
+ retval = 1;
+ else if (a.month < b.month)
+ retval = -1;
+
+ else if (a.day > b.day)
+ retval = 1;
+ else if (a.day < b.day)
+ retval = -1;
+
+ /* if both are dates, we are done */
+ if (a.is_date && b.is_date)
+ return retval;
+
+ /* else, if we already found a difference, we are done */
+ else if (retval != 0)
+ return retval;
+
+ /* else, if only one is a date (and we already know the date part is equal),
+ then the other is greater */
+ else if (b.is_date)
+ retval = 1;
+ else if (a.is_date)
+ retval = -1;
+
+ else if (a.hour > b.hour)
+ retval = 1;
+ else if (a.hour < b.hour)
+ retval = -1;
+
+ else if (a.minute > b.minute)
+ retval = 1;
+ else if (a.minute < b.minute)
+ retval = -1;
+
+ else if (a.second > b.second)
+ retval = 1;
+ else if (a.second < b.second)
+ retval = -1;
+
+ return retval;
}
+/**
+ * like icaltime_compare, but only use the date parts.
+ */
+
int
-icaltime_compare_date_only (struct icaltimetype a, struct icaltimetype b)
+icaltime_compare_date_only(const struct icaltimetype a_in, const struct icaltimetype b_in)
{
- time_t t1;
- time_t t2;
-
- if (a.year == b.year && a.month == b.month && a.day == b.day)
- return 0;
-
- t1 = icaltime_as_timet (a);
- t2 = icaltime_as_timet (b);
-
- if (t1 > t2)
- return 1;
- else if (t1 < t2)
- return -1;
- else {
- /* not reached */
- assert (0);
- return 0;
- }
-}
+ int retval;
+ struct icaltimetype a, b;
+
+ a = icaltime_convert_to_zone(a_in, icaltimezone_get_utc_timezone());
+ b = icaltime_convert_to_zone(b_in, icaltimezone_get_utc_timezone());
+
+ if (a.year > b.year)
+ retval = 1;
+ else if (a.year < b.year)
+ retval = -1;
+
+ else if (a.month > b.month)
+ retval = 1;
+ else if (a.month < b.month)
+ retval = -1;
+
+ else if (a.day > b.day)
+ retval = 1;
+ else if (a.day < b.day)
+ retval = -1;
+ else
+ retval = 0;
+
+ return retval;
+}
@@ -577 +741,275 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
+
+
+/** @brief Internal, shouldn't be part of the public API
+ *
+ * Adds (or subtracts) a time from a icaltimetype.
+ * NOTE: This function is exactly the same as icaltimezone_adjust_change()
+ * except for the type of the first parameter.
+ */
+void
+icaltime_adjust(struct icaltimetype *tt, const int days, const int hours,
+ const int minutes, const int seconds) {
+
+ int second, minute, hour, day;
+ int minutes_overflow, hours_overflow, days_overflow, years_overflow;
+ int days_in_month;
+
+ /* Add on the seconds. */
+ second = tt->second + seconds;
+ tt->second = second % 60;
+ minutes_overflow = second / 60;
+ if (tt->second < 0) {
+ tt->second += 60;
+ minutes_overflow--;
+ }
+
+ /* Add on the minutes. */
+ minute = tt->minute + minutes + minutes_overflow;
+ tt->minute = minute % 60;
+ hours_overflow = minute / 60;
+ if (tt->minute < 0) {
+ tt->minute += 60;
+ hours_overflow--;
+ }
+
+ /* Add on the hours. */
+ hour = tt->hour + hours + hours_overflow;
+ tt->hour = hour % 24;
+ days_overflow = hour / 24;
+ if (tt->hour < 0) {
+ tt->hour += 24;
+ days_overflow--;
+ }
+
+ /* Normalize the month. We do this before handling the day since we may
+ need to know what month it is to get the number of days in it.
+ Note that months are 1 to 12, so we have to be a bit careful. */
+ if (tt->month >= 13) {
+ years_overflow = (tt->month - 1) / 12;
+ tt->year += years_overflow;
+ tt->month -= years_overflow * 12;
+ } else if (tt->month <= 0) {
+ /* 0 to -11 is -1 year out, -12 to -23 is -2 years. */
+ years_overflow = (tt->month / 12) - 1;
+ tt->year += years_overflow;
+ tt->month -= years_overflow * 12;
+ }
+
+ /* Add on the days. */
+ day = tt->day + days + days_overflow;
+ if (day > 0) {
+ for (;;) {
+ days_in_month = icaltime_days_in_month (tt->month, tt->year);
+ if (day <= days_in_month)
+ break;
+
+ tt->month++;
+ if (tt->month >= 13) {
+ tt->year++;
+ tt->month = 1;
+ }
+
+ day -= days_in_month;
+ }
+ } else {
+ while (day <= 0) {
+ if (tt->month == 1) {
+ tt->year--;
+ tt->month = 12;
+ } else {
+ tt->month--;
+ }
+
+ day += icaltime_days_in_month (tt->month, tt->year);
+ }
+ }
+ tt->day = day;
+}
+
+/** @brief Convert time to a given timezone
+ *
+ * Convert a time from its native timezone to a given timezone.
+ *
+ * If tt is a date, the returned time is an exact
+ * copy of the input. If it's a floating time, the returned object
+ * represents the same time translated to the given timezone.
+ * Otherwise the time will be converted to the new
+ * time zone, and its native timezone set to the right timezone.
+ */
+struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt,
+ icaltimezone *zone) {
+
+ struct icaltimetype ret = tt;
+
+ /* If it's a date do nothing */
+ if (tt.is_date) {
+ return ret;
+ }
+
+ if (tt.zone == zone) {
+ return ret;
+ }
+
+ /* If it's a floating time we don't want to adjust the time */
+ if (tt.zone != NULL) {
+ icaltimezone_convert_time(&ret, tt.zone, zone);
+ }
+
+ ret.zone = zone;
+ if (zone == icaltimezone_get_utc_timezone()) {
+ ret.is_utc = 1;
+ } else {
+ ret.is_utc = 0;
+ }
+
+ return ret;
+}
+
+const icaltimezone *
+icaltime_get_timezone(const struct icaltimetype t) {
+
+ return t.zone;
+}
+
+char *
+icaltime_get_tzid(const struct icaltimetype t) {
+
+ if (t.zone != NULL) {
+ return icaltimezone_get_tzid(t.zone);
+ } else {
+ return NULL;
+ }
+}
+
+/** @brief Set the timezone
+ *
+ * Force the icaltime to be interpreted relative to another timezone.
+ * If you need to do timezone conversion, applying offset adjustments,
+ * then you should use icaltime_convert_to_timezone instead.
+ */
+struct icaltimetype
+icaltime_set_timezone(struct icaltimetype *t, const icaltimezone *zone) {
+
+ /* If it's a date do nothing */
+ if (t->is_date) {
+ return *t;
+ }
+
+ if (t->zone == zone) {
+ return *t;
+ }
+
+ t->zone = zone;
+ if (zone == icaltimezone_get_utc_timezone()) {
+ t->is_utc = 1;
+ } else {
+ t->is_utc = 0;
+ }
+
+ return *t;
+}
+
+
+/**
+ * @brief builds an icaltimespan given a start time, end time and busy value.
+ *
+ * @param dtstart The beginning time of the span, can be a date-time
+ * or just a date.
+ * @param dtend The end time of the span.
+ * @param is_busy A boolean value, 0/1.
+ * @return A span using the supplied values.
+ *
+ * returned span contains times specified in UTC.
+ */
+
+icaltime_span icaltime_span_new(struct icaltimetype dtstart,
+ struct icaltimetype dtend,
+ int is_busy)
+{
+ icaltime_span span;
+
+ span.is_busy = is_busy;
+
+ span.start = icaltime_as_timet_with_zone(dtstart,
+ icaltimezone_get_utc_timezone());
+
+ if (icaltime_is_null_time(dtend)) {
+ if (!icaltime_is_date(dtstart)) {
+ /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION
+ it takes no time */
+ span.end = span.start;
+ return span;
+ } else {
+ dtend = dtstart;
+ }
+ }
+
+ span.end = icaltime_as_timet_with_zone(dtend, icaltimezone_get_utc_timezone());
+
+ if (icaltime_is_date(dtstart)) {
+ /* no time specified, go until the end of the day..*/
+ span.end += 60*60*24 - 1;
+ }
+ return span;
+}
+
+
+/** @brief Returns true if the two spans overlap
+ *
+ * @param s1 1st span to test
+ * @param s2 2nd span to test
+ * @return boolean value
+ *
+ * The result is calculated by testing if the start time of s1 is contained
+ * by the s2 span, or if the end time of s1 is contained by the s2 span.
+ *
+ * Also returns true if the spans are equal.
+ *
+ * Note, this will return false if the spans are adjacent.
+ */
+
+int icaltime_span_overlaps(icaltime_span *s1,
+ icaltime_span *s2)
+{
+ /* s1->start in s2 */
+ if (s1->start > s2->start && s1->start < s2->end)
+ return 1;
+
+ /* s1->end in s2 */
+ if (s1->end > s2->start && s1->end < s2->end)
+ return 1;
+
+ /* s2->start in s1 */
+ if (s2->start > s1->start && s2->start < s1->end)
+ return 1;
+
+ /* s2->end in s1 */
+ if (s2->end > s1->start && s2->end < s1->end)
+ return 1;
+
+ if (s1->start == s2->start && s1->end == s2->end)
+ return 1;
+
+ return 0;
+}
+
+/** @brief Returns true if the span is totally within the containing
+ * span
+ *
+ * @param s The span to test for.
+ * @param container The span to test against.
+ * @return boolean value.
+ *
+ */
+
+int icaltime_span_contains(icaltime_span *s,
+ icaltime_span *container)
+{
+
+ if ((s->start >= container->start && s->start < container->end) &&
+ (s->end <= container->end && s->end > container->start))
+ return 1;
+
+ return 0;
+}
diff --git a/libical/src/libical/icaltime.h b/libical/src/libical/icaltime.h
index 0f0379b..ce1696a 100644
--- a/libical/src/libical/icaltime.h
+++ b/libical/src/libical/icaltime.h
@@ -28,2 +28,66 @@
+/** @file icaltime.h
+ * @brief struct icaltimetype is a pseudo-object that abstracts time
+ * handling.
+ *
+ * It can represent either a DATE or a DATE-TIME (floating, UTC or in a
+ * given timezone), and it keeps track internally of its native timezone.
+ *
+ * The typical usage is to call the correct constructor specifying the
+ * desired timezone. If this is not known until a later time, the
+ * correct behavior is to specify a NULL timezone and call
+ * icaltime_convert_to_zone() at a later time.
+ *
+ * There are several ways to create a new icaltimetype:
+ *
+ * - icaltime_null_time()
+ * - icaltime_null_date()
+ * - icaltime_current_time_with_zone()
+ * - icaltime_today()
+ * - icaltime_from_timet_with_zone(time_t tm, int is_date,
+ * icaltimezone *zone)
+ * - icaltime_from_string_with_zone(const char* str, icaltimezone *zone)
+ * - icaltime_from_day_of_year(int doy, int year)
+ * - icaltime_from_week_number(int week_number, int year)
+ *
+ * italtimetype objects can be converted to different formats:
+ *
+ * - icaltime_as_timet(struct icaltimetype tt)
+ * - icaltime_as_timet_with_zone(struct icaltimetype tt,
+ * icaltimezone *zone)
+ * - icaltime_as_ical_string(struct icaltimetype tt)
+ *
+ * Accessor methods include:
+ *
+ * - icaltime_get_timezone(struct icaltimetype t)
+ * - icaltime_get_tzid(struct icaltimetype t)
+ * - icaltime_set_timezone(struct icaltimetype t, const icaltimezone *zone)
+ * - icaltime_day_of_year(struct icaltimetype t)
+ * - icaltime_day_of_week(struct icaltimetype t)
+ * - icaltime_start_doy_of_week(struct icaltimetype t)
+ * - icaltime_week_number(struct icaltimetype t)
+ *
+ * Query methods include:
+ *
+ * - icaltime_is_null_time(struct icaltimetype t)
+ * - icaltime_is_valid_time(struct icaltimetype t)
+ * - icaltime_is_date(struct icaltimetype t)
+ * - icaltime_is_utc(struct icaltimetype t)
+ * - icaltime_is_floating(struct icaltimetype t)
+ *
+ * Modify, compare and utility methods include:
+ *
+ * - icaltime_add(struct icaltimetype t, struct icaldurationtype d)
+ * - icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2)
+ * - icaltime_compare_with_zone(struct icaltimetype a,struct icaltimetype b)
+ * - icaltime_compare(struct icaltimetype a,struct icaltimetype b)
+ * - icaltime_compare_date_only(struct icaltimetype a,
+ * struct icaltimetype b)
+ * - icaltime_adjust(struct icaltimetype *tt, int days, int hours,
+ * int minutes, int seconds);
+ * - icaltime_normalize(struct icaltimetype t);
+ * - icaltime_convert_to_zone(const struct icaltimetype tt,
+ * icaltimezone *zone);
+ */
+
#ifndef ICALTIME_H
@@ -33,14 +97,28 @@
-/* icaltime_span is returned by icalcomponent_get_span() */
+/* An opaque struct representing a timezone. We declare this here to avoid
+ a circular dependancy. */
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+typedef struct _icaltimezone icaltimezone;
+#endif
+
+/** icaltime_span is returned by icalcomponent_get_span() */
struct icaltime_span {
- time_t start; /* in UTC */
- time_t end; /* in UTC */
- int is_busy; /* 1->busy time, 0-> free time */
+ time_t start; /**< in UTC */
+ time_t end; /**< in UTC */
+ int is_busy; /**< 1->busy time, 0-> free time */
};
+typedef struct icaltime_span icaltime_span;
+/*
+ * FIXME
+ *
+ * is_utc is redundant, and might be considered a minor optimization.
+ * It might be deprecated, so you should use icaltime_is_utc() instead.
+ */
struct icaltimetype
{
- int year;
- int month;
+ int year; /**< Actual year, e.g. 2001. */
+ int month; /**< 1 (Jan) to 12 (Dec). */
int day;
@@ -50,95 +128,145 @@ struct icaltimetype
- int is_utc; /* 1-> time is in UTC timezone */
+ int is_utc; /**< 1-> time is in UTC timezone */
- int is_date; /* 1 -> interpret this as date. */
+ int is_date; /**< 1 -> interpret this as date. */
- const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/
+ int is_daylight; /**< 1 -> time is in daylight savings time. */
+
+ const icaltimezone *zone; /**< timezone */
};
-/* Convert seconds past UNIX epoch to a timetype*/
-struct icaltimetype icaltime_from_timet(time_t v, int is_date);
+typedef struct icaltimetype icaltimetype;
-/* Return the time as seconds past the UNIX epoch */
-time_t icaltime_as_timet(struct icaltimetype);
+/** Return a null time, which indicates no time has been set.
+ This time represent the beginning of the epoch */
+struct icaltimetype icaltime_null_time(void);
-/* Return a string represention of the time, in RFC2445 format. The
- string is owned by libical */
-char* icaltime_as_ical_string(struct icaltimetype tt);
+/** Return a null date */
+struct icaltimetype icaltime_null_date(void);
+
+/** Returns the current time in the given timezone, as an icaltimetype. */
+struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone);
+
+/** Returns the current day as an icaltimetype, with is_date set. */
+struct icaltimetype icaltime_today(void);
-/* Like icaltime_from_timet(), except that the input may be in seconds
- past the epoch in floating time. This routine is deprecated */
-struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc);
+/** Convert seconds past UNIX epoch to a timetype*/
+struct icaltimetype icaltime_from_timet(const time_t v, const int is_date);
-/* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */
-int icaltime_as_int(struct icaltimetype);
+/** Convert seconds past UNIX epoch to a timetype, using timezones. */
+struct icaltimetype icaltime_from_timet_with_zone(const time_t tm,
+ const int is_date, const icaltimezone *zone);
-/* create a time from an ISO format string */
+/** create a time from an ISO format string */
struct icaltimetype icaltime_from_string(const char* str);
-/* Routines for handling timezones */
-/* Return the offset of the named zone as seconds. tt is a time
- indicating the date for which you want the offset */
-int icaltime_utc_offset(struct icaltimetype tt, const char* tzid);
+/** create a time from an ISO format string */
+struct icaltimetype icaltime_from_string_with_zone(const char* str,
+ const icaltimezone *zone);
-/* convert tt, of timezone tzid, into a utc time. Does nothing if the
- time is already UTC. */
-struct icaltimetype icaltime_as_utc(struct icaltimetype tt,
- const char* tzid);
+/** Create a new time, given a day of year and a year. */
+struct icaltimetype icaltime_from_day_of_year(const int doy,
+ const int year);
-/* convert tt, a time in UTC, into a time in timezone tzid */
-struct icaltimetype icaltime_as_zone(struct icaltimetype tt,
- const char* tzid);
+/** @brief Contructor (TODO).
+ * Create a new time from a weeknumber and a year. */
+struct icaltimetype icaltime_from_week_number(const int week_number,
+ const int year);
-/* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */
-struct icaltimetype icaltime_null_time(void);
+/** Return the time as seconds past the UNIX epoch */
+time_t icaltime_as_timet(const struct icaltimetype);
+
+/** Return the time as seconds past the UNIX epoch, using timezones. */
+time_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
+ const icaltimezone *zone);
+
+/** Return a string represention of the time, in RFC2445 format. The
+ string is owned by libical */
+const char* icaltime_as_ical_string(const struct icaltimetype tt);
+
+/** @brief Return the timezone */
+const icaltimezone *icaltime_get_timezone(const struct icaltimetype t);
-/* Return true of the time is null. */
-int icaltime_is_null_time(struct icaltimetype t);
+/** @brief Return the tzid, or NULL for a floating time */
+char *icaltime_get_tzid(const struct icaltimetype t);
-/* Returns false if the time is clearly invalid, but is not null. This
+/** @brief Set the timezone */
+struct icaltimetype icaltime_set_timezone(struct icaltimetype *t,
+ const icaltimezone *zone);
+
+/** Return the day of the year of the given time */
+int icaltime_day_of_year(const struct icaltimetype t);
+
+/** Return the day of the week of the given time. Sunday is 1 */
+int icaltime_day_of_week(const struct icaltimetype t);
+
+/** Return the day of the year for the Sunday of the week that the
+ given time is within. */
+int icaltime_start_doy_of_week(const struct icaltimetype t);
+
+/** Return the week number for the week the given time is within */
+int icaltime_week_number(const struct icaltimetype t);
+
+/** Return true of the time is null. */
+int icaltime_is_null_time(const struct icaltimetype t);
+
+/** Returns false if the time is clearly invalid, but is not null. This
is usually the result of creating a new time type buy not clearing
it, or setting one of the flags to an illegal value. */
-int icaltime_is_valid_time(struct icaltimetype t);
+int icaltime_is_valid_time(const struct icaltimetype t);
-/* Reset all of the time components to be in their normal ranges. For
- instance, given a time with minutes=70, the minutes will be reduces
- to 10, and the hour incremented. This allows the caller to do
- arithmetic on times without worrying about overflow or
- underflow. */
-struct icaltimetype icaltime_normalize(struct icaltimetype t);
+/** @brief Returns true if time is of DATE type, false if DATE-TIME */
+int icaltime_is_date(const struct icaltimetype t);
-/* Return the day of the year of the given time */
-short icaltime_day_of_year(struct icaltimetype t);
+/** @brief Returns true if time is relative to UTC zone */
+int icaltime_is_utc(const struct icaltimetype t);
-/* Create a new time, given a day of year and a year. */
-struct icaltimetype icaltime_from_day_of_year(short doy, short year);
+/** @brief Returns true if time is a floating time */
+int icaltime_is_floating(const struct icaltimetype t);
-/* Return the day of the week of the given time. Sunday is 1 */
-short icaltime_day_of_week(struct icaltimetype t);
+/** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
+int icaltime_compare_with_zone(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return the day of the year for the Sunday of the week that the
- given time is within. */
-short icaltime_start_doy_of_week(struct icaltimetype t);
+/** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
+int icaltime_compare(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */
-char* icaltime_as_ctime(struct icaltimetype);
+/** like icaltime_compare, but only use the date parts. */
+int icaltime_compare_date_only(const struct icaltimetype a,
+ const struct icaltimetype b);
-/* Return the week number for the week the given time is within */
-short icaltime_week_number(struct icaltimetype t);
+/** Adds or subtracts a number of days, hours, minutes and seconds. */
+void icaltime_adjust(struct icaltimetype *tt, const int days,
+ const int hours, const int minutes, const int seconds);
-/* Create a new time from a weeknumber and a year. */
-struct icaltimetype icaltime_from_week_number(short week_number, short year);
+/** Normalize the icaltime, so that all fields are within the normal range. */
+struct icaltimetype icaltime_normalize(const struct icaltimetype t);
-/* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
-int icaltime_compare(struct icaltimetype a,struct icaltimetype b);
+/** convert tt, of timezone tzid, into a utc time. Does nothing if the
+ time is already UTC. */
+struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt,
+ icaltimezone *zone);
-/* like icaltime_compare, but only use the date parts. */
-int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b);
+/** Return the number of days in the given month */
+int icaltime_days_in_month(const int month, const int year);
-/* Return the number of days in the given month */
-short icaltime_days_in_month(short month,short year);
+/** @brief calculate an icaltimespan given a start and end time. */
+struct icaltime_span icaltime_span_new(struct icaltimetype dtstart,
+ struct icaltimetype dtend,
+ int is_busy);
-#endif /* !ICALTIME_H */
+/** @brief Returns true if the two spans overlap **/
+int icaltime_span_overlaps(icaltime_span *s1,
+ icaltime_span *s2);
+/** @brief Returns true if the span is totally within the containing
+ * span
+ */
+int icaltime_span_contains(icaltime_span *s,
+ icaltime_span *container);
+
+
+#endif /* !ICALTIME_H */
diff --git a/libical/src/libical/icaltimezone.c b/libical/src/libical/icaltimezone.c
new file mode 100644
index 0000000..fdb6b91
--- a/dev/null
+++ b/libical/src/libical/icaltimezone.c
@@ -0,0 +1,1672 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*======================================================================
+ FILE: icaltimezone.c
+ CREATOR: Damon Chaplin 15 March 2001
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2001, Damon Chaplin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+======================================================================*/
+
+/** @file icaltimezone.c
+ * @brief implementation of timezone handling routines
+ **/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "icalproperty.h"
+#include "icalarray.h"
+#include "icalerror.h"
+#include "icalparser.h"
+#include "icaltimezone.h"
+
+#ifdef WIN32
+#define snprintf _snprintf
+#define PACKAGE_DATA_DIR "/Projects/libical"
+#endif
+
+/** This is the toplevel directory where the timezone data is installed in. */
+#define ZONEINFO_DIRECTORY "/zoneinfo"
+
+/** The prefix we use to uniquely identify TZIDs. */
+#define TZID_PREFIX "/softwarestudio.org/"
+#define TZID_PREFIX_LEN 20
+
+/** This is the filename of the file containing the city names and
+ coordinates of all the builtin timezones. */
+#define ZONES_TAB_FILENAME "zones.tab"
+
+/** This is the number of years of extra coverage we do when expanding
+ the timezone changes. */
+#define ICALTIMEZONE_EXTRA_COVERAGE 5
+
+/** This is the maximum year we will expand to. time_t values only go up to
+ somewhere around 2037. */
+#define ICALTIMEZONE_MAX_YEAR 2035
+
+struct _icaltimezone {
+ char *tzid;
+ /**< The unique ID of this timezone,
+ e.g. "/softwarestudio.org/Olson_20010601_1/Africa/Banjul".
+ This should only be used to identify a VTIMEZONE. It is not
+ meant to be displayed to the user in any form. */
+
+ char *location;
+ /**< The location for the timezone, e.g. "Africa/Accra" for the
+ Olson database. We look for this in the "LOCATION" or
+ "X-LIC-LOCATION" properties of the VTIMEZONE component. It
+ isn't a standard property yet. This will be NULL if no location
+ is found in the VTIMEZONE. */
+
+ char *tznames;
+ /**< This will be set to a combination of the TZNAME properties
+ from the last STANDARD and DAYLIGHT components in the
+ VTIMEZONE, e.g. "EST/EDT". If they both use the same TZNAME,
+ or only one type of component is found, then only one TZNAME
+ will appear, e.g. "AZOT". If no TZNAME is found this will be
+ NULL. */
+
+ double latitude;
+ double longitude;
+ /**< The coordinates of the city, in degrees. */
+
+ icalcomponent *component;
+ /**< The toplevel VTIMEZONE component loaded from the .ics file for this
+ timezone. If we need to regenerate the changes data we need this. */
+
+ icaltimezone *builtin_timezone;
+ /**< If this is not NULL it points to the builtin icaltimezone
+ that the above TZID refers to. This icaltimezone should be used
+ instead when accessing the timezone changes data, so that the
+ expanded timezone changes data is shared between calendar
+ components. */
+
+ int end_year;
+ /**< This is the last year for which we have expanded the data to.
+ If we need to calculate a date past this we need to expand the
+ timezone component data from scratch. */
+
+ icalarray *changes;
+ /**< A dynamically-allocated array of time zone changes, sorted by the
+ time of the change in local time. So we can do fast binary-searches
+ to convert from local time to UTC. */
+};
+
+typedef struct _icaltimezonechange icaltimezonechange;
+
+struct _icaltimezonechange {
+ int utc_offset;
+ /**< The offset to add to UTC to get local time, in seconds. */
+
+ int prev_utc_offset;
+ /**< The offset to add to UTC, before this change, in seconds. */
+
+ int year; /**< Actual year, e.g. 2001. */
+ int month; /**< 1 (Jan) to 12 (Dec). */
+ int day;
+ int hour;
+ int minute;
+ int second;
+ /**< The time that the change came into effect, in UTC.
+ Note that the prev_utc_offset applies to this local time,
+ since we haven't changed to the new offset yet. */
+
+ int is_daylight;
+ /**< Whether this is STANDARD or DAYLIGHT time. */
+};
+
+
+/** An array of icaltimezones for the builtin timezones. */
+static icalarray *builtin_timezones = NULL;
+
+/** This is the special UTC timezone, which isn't in builtin_timezones. */
+static icaltimezone utc_timezone = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+static char* zone_files_directory = NULL;
+
+static void icaltimezone_reset (icaltimezone *zone);
+static char* icaltimezone_get_location_from_vtimezone (icalcomponent *component);
+static char* icaltimezone_get_tznames_from_vtimezone (icalcomponent *component);
+static void icaltimezone_expand_changes (icaltimezone *zone,
+ int end_year);
+static void icaltimezone_expand_vtimezone (icalcomponent *comp,
+ int end_year,
+ icalarray *changes);
+static int icaltimezone_compare_change_fn (const void *elem1,
+ const void *elem2);
+
+static int icaltimezone_find_nearby_change (icaltimezone *zone,
+ icaltimezonechange *change);
+
+static void icaltimezone_adjust_change (icaltimezonechange *tt,
+ int days,
+ int hours,
+ int minutes,
+ int seconds);
+
+static void icaltimezone_init (icaltimezone *zone);
+
+/** Gets the TZID, LOCATION/X-LIC-LOCATION, and TZNAME properties from the
+ VTIMEZONE component and places them in the icaltimezone. It returns 1 on
+ success, or 0 if the TZID can't be found. */
+static int icaltimezone_get_vtimezone_properties (icaltimezone *zone,
+ icalcomponent *component);
+
+
+static void icaltimezone_load_builtin_timezone (icaltimezone *zone);
+
+static void icaltimezone_ensure_coverage (icaltimezone *zone,
+ int end_year);
+
+
+static void icaltimezone_init_builtin_timezones(void);
+
+static void icaltimezone_parse_zone_tab (void);
+
+static char* icaltimezone_load_get_line_fn (char *s,
+ size_t size,
+ void *data);
+
+static void format_utc_offset (int utc_offset,
+ char *buffer);
+
+static char* get_zone_directory(void);
+
+
+/** Creates a new icaltimezone. */
+icaltimezone*
+icaltimezone_new (void)
+{
+ icaltimezone *zone;
+
+ zone = (icaltimezone*) malloc (sizeof (icaltimezone));
+ if (!zone) {
+ icalerror_set_errno (ICAL_NEWFAILED_ERROR);
+ return NULL;
+ }
+
+ icaltimezone_init (zone);
+
+ return zone;
+}
+
+
+/** Frees all memory used for the icaltimezone. */
+void
+icaltimezone_free (icaltimezone *zone,
+ int free_struct)
+{
+ icaltimezone_reset (zone);
+ if (free_struct)
+ free (zone);
+}
+
+
+/** Resets the icaltimezone to the initial state, freeing most of the fields. */
+static void
+icaltimezone_reset (icaltimezone *zone)
+{
+ if (zone->tzid)
+ free (zone->tzid);
+ if (zone->location)
+ free (zone->location);
+ if (zone->tznames)
+ free (zone->tznames);
+ if (zone->component)
+ icalcomponent_free (zone->component);
+ if (zone->changes)
+ icalarray_free (zone->changes);
+
+ icaltimezone_init (zone);
+}
+
+
+/** Initializes an icaltimezone. */
+static void
+icaltimezone_init (icaltimezone *zone)
+{
+ zone->tzid = NULL;
+ zone->location = NULL;
+ zone->tznames = NULL;
+ zone->latitude = 0.0;
+ zone->longitude = 0.0;
+ zone->component = NULL;
+ zone->builtin_timezone = NULL;
+ zone->end_year = 0;
+ zone->changes = NULL;
+}
+
+
+/** Gets the TZID, LOCATION/X-LIC-LOCATION and TZNAME properties of
+ the VTIMEZONE component and stores them in the icaltimezone. It
+ returns 1 on success, or 0 if the TZID can't be found. Note that
+ it expects the zone to be initialized or reset - it doesn't free
+ any old values. */
+static int
+icaltimezone_get_vtimezone_properties (icaltimezone *zone,
+ icalcomponent *component)
+{
+ icalproperty *prop;
+ const char *tzid;
+
+ prop = icalcomponent_get_first_property (component, ICAL_TZID_PROPERTY);
+ if (!prop)
+ return 0;
+
+ /* A VTIMEZONE MUST have a TZID, or a lot of our code won't work. */
+ tzid = icalproperty_get_tzid (prop);
+ if (!tzid)
+ return 0;
+
+ zone->tzid = strdup (tzid);
+ zone->component = component;
+ if ( zone->location != 0 ) free ( zone->location );
+ zone->location = icaltimezone_get_location_from_vtimezone (component);
+ zone->tznames = icaltimezone_get_tznames_from_vtimezone (component);
+
+ return 1;
+}
+
+/** Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE. */
+static char*
+icaltimezone_get_location_from_vtimezone (icalcomponent *component)
+{
+ icalproperty *prop;
+ const char *location;
+ const char *name;
+
+ prop = icalcomponent_get_first_property (component,
+ ICAL_LOCATION_PROPERTY);
+ if (prop) {
+ location = icalproperty_get_location (prop);
+ if (location)
+ return strdup (location);
+ }
+
+ prop = icalcomponent_get_first_property (component, ICAL_X_PROPERTY);
+ while (prop) {
+ name = icalproperty_get_x_name (prop);
+ if (name && !strcmp (name, "X-LIC-LOCATION")) {
+ location = icalproperty_get_x (prop);
+ if (location)
+ return strdup (location);
+ }
+ prop = icalcomponent_get_next_property (component,
+ ICAL_X_PROPERTY);
+ }
+
+ return NULL;
+}
+
+
+/** Gets the TZNAMEs used for the last STANDARD & DAYLIGHT components
+ in a VTIMEZONE. If both STANDARD and DAYLIGHT components use the
+ same TZNAME, it returns that. If they use different TZNAMEs, it
+ formats them like "EST/EDT". The returned string should be freed by
+ the caller. */
+static char*
+icaltimezone_get_tznames_from_vtimezone (icalcomponent *component)
+{
+ icalcomponent *comp;
+ icalcomponent_kind type;
+ icalproperty *prop;
+ struct icaltimetype dtstart;
+ struct icaldatetimeperiodtype rdate;
+ const char *current_tzname;
+ const char *standard_tzname = NULL, *daylight_tzname = NULL;
+ struct icaltimetype standard_max_date, daylight_max_date;
+ struct icaltimetype current_max_date;
+
+ standard_max_date = icaltime_null_time();
+ daylight_max_date = icaltime_null_time();
+
+ /* Step through the STANDARD & DAYLIGHT subcomponents. */
+ comp = icalcomponent_get_first_component (component, ICAL_ANY_COMPONENT);
+ while (comp) {
+ type = icalcomponent_isa (comp);
+ if (type == ICAL_XSTANDARD_COMPONENT
+ || type == ICAL_XDAYLIGHT_COMPONENT) {
+ current_max_date = icaltime_null_time ();
+ current_tzname = NULL;
+
+ /* Step through the properties. We want to find the TZNAME, and
+ the largest DTSTART or RDATE. */
+ prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY);
+ while (prop) {
+ switch (icalproperty_isa (prop)) {
+ case ICAL_TZNAME_PROPERTY:
+ current_tzname = icalproperty_get_tzname (prop);
+ break;
+
+ case ICAL_DTSTART_PROPERTY:
+ dtstart = icalproperty_get_dtstart (prop);
+ if (icaltime_compare (dtstart, current_max_date) > 0)
+ current_max_date = dtstart;
+
+ break;
+
+ case ICAL_RDATE_PROPERTY:
+ rdate = icalproperty_get_rdate (prop);
+ if (icaltime_compare (rdate.time, current_max_date) > 0)
+ current_max_date = rdate.time;
+
+ break;
+
+ default:
+ break;
+ }
+
+ prop = icalcomponent_get_next_property (comp,
+ ICAL_ANY_PROPERTY);
+ }
+
+ if (current_tzname) {
+ if (type == ICAL_XSTANDARD_COMPONENT) {
+ if (!standard_tzname
+ || icaltime_compare (current_max_date,
+ standard_max_date) > 0) {
+ standard_max_date = current_max_date;
+ standard_tzname = current_tzname;
+ }
+ } else {
+ if (!daylight_tzname
+ || icaltime_compare (current_max_date,
+ daylight_max_date) > 0) {
+ daylight_max_date = current_max_date;
+ daylight_tzname = current_tzname;
+ }
+ }
+ }
+ }
+
+ comp = icalcomponent_get_next_component (component,
+ ICAL_ANY_COMPONENT);
+ }
+
+ /* Outlook (2000) places "Standard Time" and "Daylight Time" in the TZNAME
+ strings, which is totally useless. So we return NULL in that case. */
+ if (standard_tzname && !strcmp (standard_tzname, "Standard Time"))
+ return NULL;
+
+ /* If both standard and daylight TZNAMEs were found, if they are the same
+ we return just one, else we format them like "EST/EDT". */
+ if (standard_tzname && daylight_tzname) {
+ unsigned int standard_len, daylight_len;
+ char *tznames;
+
+ if (!strcmp (standard_tzname, daylight_tzname))
+ return strdup (standard_tzname);
+
+ standard_len = strlen (standard_tzname);
+ daylight_len = strlen (daylight_tzname);
+ tznames = malloc (standard_len + daylight_len + 2);
+ strcpy (tznames, standard_tzname);
+ tznames[standard_len] = '/';
+ strcpy (tznames + standard_len + 1, daylight_tzname);
+ return tznames;
+ } else {
+ const char *tznames;
+
+ /* If either of the TZNAMEs was found just return that, else NULL. */
+ tznames = standard_tzname ? standard_tzname : daylight_tzname;
+ return tznames ? strdup (tznames) : NULL;
+ }
+}
+
+
+static void
+icaltimezone_ensure_coverage (icaltimezone *zone,
+ int end_year)
+{
+ /* When we expand timezone changes we always expand at least up to this
+ year, plus ICALTIMEZONE_EXTRA_COVERAGE. */
+ static int icaltimezone_minimum_expansion_year = -1;
+
+ int changes_end_year;
+
+ if (!zone->component)
+ icaltimezone_load_builtin_timezone (zone);
+
+ if (icaltimezone_minimum_expansion_year == -1) {
+ struct icaltimetype today = icaltime_today();
+ icaltimezone_minimum_expansion_year = today.year;
+ }
+
+ changes_end_year = end_year;
+ if (changes_end_year < icaltimezone_minimum_expansion_year)
+ changes_end_year = icaltimezone_minimum_expansion_year;
+
+ changes_end_year += ICALTIMEZONE_EXTRA_COVERAGE;
+
+ if (changes_end_year > ICALTIMEZONE_MAX_YEAR)
+ changes_end_year = ICALTIMEZONE_MAX_YEAR;
+
+ if (!zone->changes || zone->end_year < end_year)
+ icaltimezone_expand_changes (zone, changes_end_year);
+}
+
+
+static void
+icaltimezone_expand_changes (icaltimezone *zone,
+ int end_year)
+{
+ icalarray *changes;
+ icalcomponent *comp;
+
+#if 0
+ printf ("\nExpanding changes for: %s to year: %i\n", zone->tzid, end_year);
+#endif
+
+ changes = icalarray_new (sizeof (icaltimezonechange), 32);
+ if (!changes)
+ return;
+
+ /* Scan the STANDARD and DAYLIGHT subcomponents. */
+ comp = icalcomponent_get_first_component (zone->component,
+ ICAL_ANY_COMPONENT);
+ while (comp) {
+ icaltimezone_expand_vtimezone (comp, end_year, changes);
+ comp = icalcomponent_get_next_component (zone->component,
+ ICAL_ANY_COMPONENT);
+ }
+
+ /* Sort the changes. We may have duplicates but I don't think it will
+ matter. */
+ icalarray_sort (changes, icaltimezone_compare_change_fn);
+
+ if (zone->changes)
+ icalarray_free (zone->changes);
+
+ zone->changes = changes;
+ zone->end_year = end_year;
+}
+
+
+static void
+icaltimezone_expand_vtimezone (icalcomponent *comp,
+ int end_year,
+ icalarray *changes)
+{
+ icaltimezonechange change;
+ icalproperty *prop;
+ struct icaltimetype dtstart, occ;
+ struct icalrecurrencetype rrule;
+ icalrecur_iterator* rrule_iterator;
+ struct icaldatetimeperiodtype rdate;
+ int found_dtstart = 0, found_tzoffsetto = 0, found_tzoffsetfrom = 0;
+ int has_recurrence = 0;
+
+ /* First we check if it is a STANDARD or DAYLIGHT component, and
+ just return if it isn't. */
+ if (icalcomponent_isa (comp) == ICAL_XSTANDARD_COMPONENT)
+ change.is_daylight = 0;
+ else if (icalcomponent_isa (comp) == ICAL_XDAYLIGHT_COMPONENT)
+ change.is_daylight = 1;
+ else
+ return;
+
+ /* Step through each of the properties to find the DTSTART,
+ TZOFFSETFROM and TZOFFSETTO. We can't expand recurrences here
+ since we need these properties before we can do that. */
+ prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY);
+ while (prop) {
+ switch (icalproperty_isa (prop)) {
+ case ICAL_DTSTART_PROPERTY:
+ dtstart = icalproperty_get_dtstart (prop);
+ found_dtstart = 1;
+ break;
+ case ICAL_TZOFFSETTO_PROPERTY:
+ change.utc_offset = icalproperty_get_tzoffsetto (prop);
+ /*printf ("Found TZOFFSETTO: %i\n", change.utc_offset);*/
+ found_tzoffsetto = 1;
+ break;
+ case ICAL_TZOFFSETFROM_PROPERTY:
+ change.prev_utc_offset = icalproperty_get_tzoffsetfrom (prop);
+ /*printf ("Found TZOFFSETFROM: %i\n", change.prev_utc_offset);*/
+ found_tzoffsetfrom = 1;
+ break;
+ case ICAL_RDATE_PROPERTY:
+ case ICAL_RRULE_PROPERTY:
+ has_recurrence = 1;
+ break;
+ default:
+ /* Just ignore any other properties. */
+ break;
+ }
+
+ prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY);
+ }
+
+ /* If we didn't find a DTSTART, TZOFFSETTO and TZOFFSETFROM we have to
+ ignore the component. FIXME: Add an error property? */
+ if (!found_dtstart || !found_tzoffsetto || !found_tzoffsetfrom)
+ return;
+
+#if 0
+ printf ("\n Expanding component DTSTART (Y/M/D): %i/%i/%i %i:%02i:%02i\n",
+ dtstart.year, dtstart.month, dtstart.day,
+ dtstart.hour, dtstart.minute, dtstart.second);
+#endif
+
+ /* If the STANDARD/DAYLIGHT component has no recurrence data, we just add
+ a single change for the DTSTART. */
+ if (!has_recurrence) {
+ change.year = dtstart.year;
+ change.month = dtstart.month;
+ change.day = dtstart.day;
+ change.hour = dtstart.hour;
+ change.minute = dtstart.minute;
+ change.second = dtstart.second;
+
+ /* Convert to UTC. */
+ icaltimezone_adjust_change (&change, 0, 0, 0, -change.prev_utc_offset);
+
+#if 0
+ printf (" Appending single DTSTART (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n",
+ change.year, change.month, change.day,
+ change.hour, change.minute, change.second);
+#endif
+
+ /* Add the change to the array. */
+ icalarray_append (changes, &change);
+ return;
+ }
+
+ /* The component has recurrence data, so we expand that now. */
+ prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY);
+ while (prop) {
+#if 0
+ printf ("Expanding property...\n");
+#endif
+ switch (icalproperty_isa (prop)) {
+ case ICAL_RDATE_PROPERTY:
+ rdate = icalproperty_get_rdate (prop);
+ change.year = rdate.time.year;
+ change.month = rdate.time.month;
+ change.day = rdate.time.day;
+ /* RDATEs with a DATE value inherit the time from
+ the DTSTART. */
+ if (icaltime_is_date(rdate.time)) {
+ change.hour = dtstart.hour;
+ change.minute = dtstart.minute;
+ change.second = dtstart.second;
+ } else {
+ change.hour = rdate.time.hour;
+ change.minute = rdate.time.minute;
+ change.second = rdate.time.second;
+
+ /* The spec was a bit vague about whether RDATEs were in local
+ time or UTC so we support both to be safe. So if it is in
+ UTC we have to add the UTC offset to get a local time. */
+ if (!icaltime_is_utc(rdate.time))
+ icaltimezone_adjust_change (&change, 0, 0, 0,
+ -change.prev_utc_offset);
+ }
+
+#if 0
+ printf (" Appending RDATE element (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n",
+ change.year, change.month, change.day,
+ change.hour, change.minute, change.second);
+#endif
+
+ icalarray_append (changes, &change);
+ break;
+ case ICAL_RRULE_PROPERTY:
+ rrule = icalproperty_get_rrule (prop);
+
+ /* If the rrule UNTIL value is set and is in UTC, we convert it to
+ a local time, since the recurrence code has no way to convert
+ it itself. */
+ if (!icaltime_is_null_time (rrule.until) && rrule.until.is_utc) {
+#if 0
+ printf (" Found RRULE UNTIL in UTC.\n");
+#endif
+
+ /* To convert from UTC to a local time, we use the TZOFFSETFROM
+ since that is the offset from UTC that will be in effect
+ when each of the RRULE occurrences happens. */
+ icaltime_adjust (&rrule.until, 0, 0, 0,
+ change.prev_utc_offset);
+ rrule.until.is_utc = 0;
+ }
+
+ rrule_iterator = icalrecur_iterator_new (rrule, dtstart);
+ for (;;) {
+ occ = icalrecur_iterator_next (rrule_iterator);
+ if (occ.year > end_year || icaltime_is_null_time (occ))
+ break;
+
+ change.year = occ.year;
+ change.month = occ.month;
+ change.day = occ.day;
+ change.hour = occ.hour;
+ change.minute = occ.minute;
+ change.second = occ.second;
+
+#if 0
+ printf (" Appending RRULE element (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n",
+ change.year, change.month, change.day,
+ change.hour, change.minute, change.second);
+#endif
+
+ icaltimezone_adjust_change (&change, 0, 0, 0,
+ -change.prev_utc_offset);
+
+ icalarray_append (changes, &change);
+ }
+
+ icalrecur_iterator_free (rrule_iterator);
+ break;
+ default:
+ break;
+ }
+
+ prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY);
+ }
+}
+
+
+/** A function to compare 2 icaltimezonechange elements, used for qsort(). */
+static int
+icaltimezone_compare_change_fn (const void *elem1,
+ const void *elem2)
+{
+ const icaltimezonechange *change1, *change2;
+ int retval;
+
+ change1 = elem1;
+ change2 = elem2;
+
+ if (change1->year < change2->year)
+ retval = -1;
+ else if (change1->year > change2->year)
+ retval = 1;
+
+ else if (change1->month < change2->month)
+ retval = -1;
+ else if (change1->month > change2->month)
+ retval = 1;
+
+ else if (change1->day < change2->day)
+ retval = -1;
+ else if (change1->day > change2->day)
+ retval = 1;
+
+ else if (change1->hour < change2->hour)
+ retval = -1;
+ else if (change1->hour > change2->hour)
+ retval = 1;
+
+ else if (change1->minute < change2->minute)
+ retval = -1;
+ else if (change1->minute > change2->minute)
+ retval = 1;
+
+ else if (change1->second < change2->second)
+ retval = -1;
+ else if (change1->second > change2->second)
+ retval = 1;
+
+ else
+ retval = 0;
+
+ return retval;
+}
+
+
+
+void
+icaltimezone_convert_time (struct icaltimetype *tt,
+ icaltimezone *from_zone,
+ icaltimezone *to_zone)
+{
+ int utc_offset, is_daylight;
+
+ /* If the time is a DATE value or both timezones are the same, or we are
+ converting a floating time, we don't need to do anything. */
+ if (icaltime_is_date(*tt) || from_zone == to_zone || from_zone == NULL)
+ return;
+
+ /* Convert the time to UTC by getting the UTC offset and subtracting it. */
+ utc_offset = icaltimezone_get_utc_offset (from_zone, tt, NULL);
+ icaltime_adjust (tt, 0, 0, 0, -utc_offset);
+
+ /* Now we convert the time to the new timezone by getting the UTC offset
+ of our UTC time and adding it. */
+ utc_offset = icaltimezone_get_utc_offset_of_utc_time (to_zone, tt,
+ &is_daylight);
+ tt->is_daylight = is_daylight;
+ icaltime_adjust (tt, 0, 0, 0, utc_offset);
+}
+
+
+
+
+/** @deprecated This API wasn't updated when we changed icaltimetype to contain its own
+ timezone. Also, this takes a pointer instead of the struct. */
+/* Calculates the UTC offset of a given local time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int
+icaltimezone_get_utc_offset (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight)
+{
+ icaltimezonechange *zone_change, *prev_zone_change, tt_change, tmp_change;
+ int change_num, step, utc_offset_change, cmp;
+ int change_num_to_use;
+ int want_daylight;
+
+ if (tt == NULL)
+ return 0;
+
+ if (is_daylight)
+ *is_daylight = 0;
+
+ /* For local times and UTC return 0. */
+ if (zone == NULL || zone == &utc_timezone)
+ return 0;
+
+ /* Use the builtin icaltimezone if possible. */
+ if (zone->builtin_timezone)
+ zone = zone->builtin_timezone;
+
+ /* Make sure the changes array is expanded up to the given time. */
+ icaltimezone_ensure_coverage (zone, tt->year);
+
+ if (!zone->changes || zone->changes->num_elements == 0)
+ return 0;
+
+ /* Copy the time parts of the icaltimetype to an icaltimezonechange so we
+ can use our comparison function on it. */
+ tt_change.year = tt->year;
+ tt_change.month = tt->month;
+ tt_change.day = tt->day;
+ tt_change.hour = tt->hour;
+ tt_change.minute = tt->minute;
+ tt_change.second = tt->second;
+
+ /* This should find a change close to the time, either the change before
+ it or the change after it. */
+ change_num = icaltimezone_find_nearby_change (zone, &tt_change);
+
+ /* Sanity check. */
+ icalerror_assert (change_num >= 0,
+ "Negative timezone change index");
+ icalerror_assert (change_num < zone->changes->num_elements,
+ "Timezone change index out of bounds");
+
+ /* Now move backwards or forwards to find the timezone change that applies
+ to tt. It should only have to do 1 or 2 steps. */
+ zone_change = icalarray_element_at (zone->changes, change_num);
+ step = 1;
+ change_num_to_use = -1;
+ for (;;) {
+ /* Copy the change, so we can adjust it. */
+ tmp_change = *zone_change;
+
+ /* If the clock is going backward, check if it is in the region of time
+ that is used twice. If it is, use the change with the daylight
+ setting which matches tt, or use standard if we don't know. */
+ if (tmp_change.utc_offset < tmp_change.prev_utc_offset) {
+ /* If the time change is at 2:00AM local time and the clock is
+ going back to 1:00AM we adjust the change to 1:00AM. We may
+ have the wrong change but we'll figure that out later. */
+ icaltimezone_adjust_change (&tmp_change, 0, 0, 0,
+ tmp_change.utc_offset);
+ } else {
+ icaltimezone_adjust_change (&tmp_change, 0, 0, 0,
+ tmp_change.prev_utc_offset);
+ }
+
+ cmp = icaltimezone_compare_change_fn (&tt_change, &tmp_change);
+
+ /* If the given time is on or after this change, then this change may
+ apply, but we continue as a later change may be the right one.
+ If the given time is before this change, then if we have already
+ found a change which applies we can use that, else we need to step
+ backwards. */
+ if (cmp >= 0)
+ change_num_to_use = change_num;
+ else
+ step = -1;
+
+ /* If we are stepping backwards through the changes and we have found
+ a change that applies, then we know this is the change to use so
+ we exit the loop. */
+ if (step == -1 && change_num_to_use != -1)
+ break;
+
+ change_num += step;
+
+ /* If we go past the start of the changes array, then we have no data
+ for this time so we return a UTC offset of 0. */
+ if (change_num < 0)
+ return 0;
+
+ if (change_num >= zone->changes->num_elements)
+ break;
+
+ zone_change = icalarray_element_at (zone->changes, change_num);
+ }
+
+ /* If we didn't find a change to use, then we have a bug! */
+ icalerror_assert (change_num_to_use != -1,
+ "No applicable timezone change found");
+
+ /* Now we just need to check if the time is in the overlapped region of
+ time when clocks go back. */
+ zone_change = icalarray_element_at (zone->changes, change_num_to_use);
+
+ utc_offset_change = zone_change->utc_offset - zone_change->prev_utc_offset;
+ if (utc_offset_change < 0 && change_num_to_use > 0) {
+ tmp_change = *zone_change;
+ icaltimezone_adjust_change (&tmp_change, 0, 0, 0,
+ tmp_change.prev_utc_offset);
+
+ if (icaltimezone_compare_change_fn (&tt_change, &tmp_change) < 0) {
+ /* The time is in the overlapped region, so we may need to use
+ either the current zone_change or the previous one. If the
+ time has the is_daylight field set we use the matching change,
+ else we use the change with standard time. */
+ prev_zone_change = icalarray_element_at (zone->changes,
+ change_num_to_use - 1);
+
+ /* I was going to add an is_daylight flag to struct icaltimetype,
+ but iCalendar doesn't let us distinguish between standard and
+ daylight time anyway, so there's no point. So we just use the
+ standard time instead. */
+ want_daylight = (tt->is_daylight == 1) ? 1 : 0;
+
+#if 0
+ if (zone_change->is_daylight == prev_zone_change->is_daylight)
+ printf (" **** Same is_daylight setting\n");
+#endif
+
+ if (zone_change->is_daylight != want_daylight
+ && prev_zone_change->is_daylight == want_daylight)
+ zone_change = prev_zone_change;
+ }
+ }
+
+ /* Now we know exactly which timezone change applies to the time, so
+ we can return the UTC offset and whether it is a daylight time. */
+ if (is_daylight)
+ *is_daylight = zone_change->is_daylight;
+ return zone_change->utc_offset;
+}
+
+
+/** @deprecated This API wasn't updated when we changed icaltimetype to contain its own
+ timezone. Also, this takes a pointer instead of the struct. */
+/** Calculates the UTC offset of a given UTC time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int
+icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight)
+{
+ icaltimezonechange *zone_change, tt_change, tmp_change;
+ int change_num, step, change_num_to_use;
+
+ if (is_daylight)
+ *is_daylight = 0;
+
+ /* For local times and UTC return 0. */
+ if (zone == NULL || zone == &utc_timezone)
+ return 0;
+
+ /* Use the builtin icaltimezone if possible. */
+ if (zone->builtin_timezone)
+ zone = zone->builtin_timezone;
+
+ /* Make sure the changes array is expanded up to the given time. */
+ icaltimezone_ensure_coverage (zone, tt->year);
+
+ if (!zone->changes || zone->changes->num_elements == 0)
+ return 0;
+
+ /* Copy the time parts of the icaltimetype to an icaltimezonechange so we
+ can use our comparison function on it. */
+ tt_change.year = tt->year;
+ tt_change.month = tt->month;
+ tt_change.day = tt->day;
+ tt_change.hour = tt->hour;
+ tt_change.minute = tt->minute;
+ tt_change.second = tt->second;
+
+ /* This should find a change close to the time, either the change before
+ it or the change after it. */
+ change_num = icaltimezone_find_nearby_change (zone, &tt_change);
+
+ /* Sanity check. */
+ icalerror_assert (change_num >= 0,
+ "Negative timezone change index");
+ icalerror_assert (change_num < zone->changes->num_elements,
+ "Timezone change index out of bounds");
+
+ /* Now move backwards or forwards to find the timezone change that applies
+ to tt. It should only have to do 1 or 2 steps. */
+ zone_change = icalarray_element_at (zone->changes, change_num);
+ step = 1;
+ change_num_to_use = -1;
+ for (;;) {
+ /* Copy the change and adjust it to UTC. */
+ tmp_change = *zone_change;
+
+ /* If the given time is on or after this change, then this change may
+ apply, but we continue as a later change may be the right one.
+ If the given time is before this change, then if we have already
+ found a change which applies we can use that, else we need to step
+ backwards. */
+ if (icaltimezone_compare_change_fn (&tt_change, &tmp_change) >= 0)
+ change_num_to_use = change_num;
+ else
+ step = -1;
+
+ /* If we are stepping backwards through the changes and we have found
+ a change that applies, then we know this is the change to use so
+ we exit the loop. */
+ if (step == -1 && change_num_to_use != -1)
+ break;
+
+ change_num += step;
+
+ /* If we go past the start of the changes array, then we have no data
+ for this time so we return a UTC offset of 0. */
+ if (change_num < 0)
+ return 0;
+
+ if (change_num >= zone->changes->num_elements)
+ break;
+
+ zone_change = icalarray_element_at (zone->changes, change_num);
+ }
+
+ /* If we didn't find a change to use, then we have a bug! */
+ icalerror_assert (change_num_to_use != -1,
+ "No applicable timezone change found");
+
+ /* Now we know exactly which timezone change applies to the time, so
+ we can return the UTC offset and whether it is a daylight time. */
+ zone_change = icalarray_element_at (zone->changes, change_num_to_use);
+ if (is_daylight)
+ *is_daylight = zone_change->is_daylight;
+
+ return zone_change->utc_offset;
+}
+
+
+/** Returns the index of a timezone change which is close to the time
+ given in change. */
+static int
+icaltimezone_find_nearby_change (icaltimezone *zone,
+ icaltimezonechange *change)
+{
+ icaltimezonechange *zone_change;
+ int lower, upper, middle, cmp;
+
+ /* Do a simple binary search. */
+ lower = middle = 0;
+ upper = zone->changes->num_elements;
+
+ while (lower < upper) {
+ middle = (lower + upper) / 2;
+ zone_change = icalarray_element_at (zone->changes, middle);
+ cmp = icaltimezone_compare_change_fn (change, zone_change);
+ if (cmp == 0)
+ break;
+ else if (cmp < 0)
+ upper = middle;
+ else
+ lower = middle + 1;
+ }
+
+ return middle;
+}
+
+
+
+
+/** Adds (or subtracts) a time from a icaltimezonechange. NOTE: This
+ function is exactly the same as icaltime_adjust() except for the
+ type of the first parameter. */
+static void
+icaltimezone_adjust_change (icaltimezonechange *tt,
+ int days,
+ int hours,
+ int minutes,
+ int seconds)
+{
+ int second, minute, hour, day;
+ int minutes_overflow, hours_overflow, days_overflow;
+ int days_in_month;
+
+ /* Add on the seconds. */
+ second = tt->second + seconds;
+ tt->second = second % 60;
+ minutes_overflow = second / 60;
+ if (tt->second < 0) {
+ tt->second += 60;
+ minutes_overflow--;
+ }
+
+ /* Add on the minutes. */
+ minute = tt->minute + minutes + minutes_overflow;
+ tt->minute = minute % 60;
+ hours_overflow = minute / 60;
+ if (tt->minute < 0) {
+ tt->minute += 60;
+ hours_overflow--;
+ }
+
+ /* Add on the hours. */
+ hour = tt->hour + hours + hours_overflow;
+ tt->hour = hour % 24;
+ days_overflow = hour / 24;
+ if (tt->hour < 0) {
+ tt->hour += 24;
+ days_overflow--;
+ }
+
+ /* Add on the days. */
+ day = tt->day + days + days_overflow;
+ if (day > 0) {
+ for (;;) {
+ days_in_month = icaltime_days_in_month (tt->month, tt->year);
+ if (day <= days_in_month)
+ break;
+
+ tt->month++;
+ if (tt->month >= 13) {
+ tt->year++;
+ tt->month = 1;
+ }
+
+ day -= days_in_month;
+ }
+ } else {
+ while (day <= 0) {
+ if (tt->month == 1) {
+ tt->year--;
+ tt->month = 12;
+ } else {
+ tt->month--;
+ }
+
+ day += icaltime_days_in_month (tt->month, tt->year);
+ }
+ }
+ tt->day = day;
+}
+
+
+char*
+icaltimezone_get_tzid (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return NULL. */
+ if (!zone)
+ return NULL;
+
+ if (!zone->tzid)
+ icaltimezone_load_builtin_timezone (zone);
+
+ return zone->tzid;
+}
+
+
+char*
+icaltimezone_get_location (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return NULL. */
+ if (!zone)
+ return NULL;
+
+ /* Note that for builtin timezones this comes from zones.tab so we don't
+ need to check the timezone is loaded here. */
+ return zone->location;
+}
+
+
+char*
+icaltimezone_get_tznames (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return NULL. */
+ if (!zone)
+ return NULL;
+
+ if (!zone->component)
+ icaltimezone_load_builtin_timezone (zone);
+
+ return zone->tznames;
+}
+
+
+/** Returns the latitude of a builtin timezone. */
+double
+icaltimezone_get_latitude (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return 0. */
+ if (!zone)
+ return 0.0;
+
+ /* Note that for builtin timezones this comes from zones.tab so we don't
+ need to check the timezone is loaded here. */
+ return zone->latitude;
+}
+
+
+/** Returns the longitude of a builtin timezone. */
+double
+icaltimezone_get_longitude (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return 0. */
+ if (!zone)
+ return 0.0;
+
+ /* Note that for builtin timezones this comes from zones.tab so we don't
+ need to check the timezone is loaded here. */
+ return zone->longitude;
+}
+
+
+/** Returns the VTIMEZONE component of a timezone. */
+icalcomponent*
+icaltimezone_get_component (icaltimezone *zone)
+{
+ /* If this is a floating time, without a timezone, return NULL. */
+ if (!zone)
+ return NULL;
+
+ if (!zone->component)
+ icaltimezone_load_builtin_timezone (zone);
+
+ return zone->component;
+}
+
+
+/** Sets the VTIMEZONE component of an icaltimezone, initializing the
+ tzid, location & tzname fields. It returns 1 on success or 0 on
+ failure, i.e. no TZID was found. */
+int
+icaltimezone_set_component (icaltimezone *zone,
+ icalcomponent *comp)
+{
+ icaltimezone_reset (zone);
+ return icaltimezone_get_vtimezone_properties (zone, comp);
+}
+
+
+icalarray*
+icaltimezone_array_new (void)
+{
+ return icalarray_new (sizeof (icaltimezone), 16);
+}
+
+
+void
+icaltimezone_array_append_from_vtimezone (icalarray *timezones,
+ icalcomponent *child)
+{
+ icaltimezone zone;
+
+ icaltimezone_init (&zone);
+ if (icaltimezone_get_vtimezone_properties (&zone, child))
+ icalarray_append (timezones, &zone);
+}
+
+
+void
+icaltimezone_array_free (icalarray *timezones)
+{
+ icaltimezone *zone;
+ int i;
+
+ if ( timezones )
+ {
+ for (i = 0; i < timezones->num_elements; i++) {
+ zone = icalarray_element_at (timezones, i);
+ icaltimezone_free (zone, 0);
+ }
+
+ icalarray_free (timezones);
+ }
+}
+
+
+/*
+ * BUILTIN TIMEZONE HANDLING
+ */
+
+
+/** Returns an icalarray of icaltimezone structs, one for each builtin
+ timezone. This will load and parse the zones.tab file to get the
+ timezone names and their coordinates. It will not load the
+ VTIMEZONE data for any timezones. */
+icalarray*
+icaltimezone_get_builtin_timezones (void)
+{
+ if (!builtin_timezones)
+ icaltimezone_init_builtin_timezones ();
+
+ return builtin_timezones;
+}
+
+/** Release builtin timezone memory */
+void
+icaltimezone_free_builtin_timezones(void)
+{
+ icaltimezone_array_free(builtin_timezones);
+}
+
+
+/** Returns a single builtin timezone, given its Olson city name. */
+icaltimezone*
+icaltimezone_get_builtin_timezone (const char *location)
+{
+ icaltimezone *zone;
+ int lower, upper, middle, cmp;
+ char *zone_location;
+
+ if (!location || !location[0])
+ return NULL;
+
+ if (!strcmp (location, "UTC"))
+ return &utc_timezone;
+
+ if (!builtin_timezones)
+ icaltimezone_init_builtin_timezones ();
+
+ /* Do a simple binary search. */
+ lower = middle = 0;
+ upper = builtin_timezones->num_elements;
+
+ while (lower < upper) {
+ middle = (lower + upper) / 2;
+ zone = icalarray_element_at (builtin_timezones, middle);
+ zone_location = icaltimezone_get_location (zone);
+ cmp = strcmp (location, zone_location);
+ if (cmp == 0)
+ return zone;
+ else if (cmp < 0)
+ upper = middle;
+ else
+ lower = middle + 1;
+ }
+
+ return NULL;
+}
+
+
+/** Returns a single builtin timezone, given its TZID. */
+icaltimezone*
+icaltimezone_get_builtin_timezone_from_tzid (const char *tzid)
+{
+ int num_slashes = 0;
+ const char *p, *zone_tzid;
+ icaltimezone *zone;
+
+ if (!tzid || !tzid[0])
+ return NULL;
+
+ /* Check that the TZID starts with our unique prefix. */
+ if (strncmp (tzid, TZID_PREFIX, TZID_PREFIX_LEN))
+ return NULL;
+
+ /* Get the location, which is after the 3rd '/' character. */
+ p = tzid;
+ for (p = tzid; *p; p++) {
+ if (*p == '/') {
+ num_slashes++;
+ if (num_slashes == 3)
+ break;
+ }
+ }
+
+ if (num_slashes != 3)
+ return NULL;
+
+ p++;
+
+ /* Now we can use the function to get the builtin timezone from the
+ location string. */
+ zone = icaltimezone_get_builtin_timezone (p);
+ if (!zone)
+ return NULL;
+
+ /* Check that the builtin TZID matches exactly. We don't want to return
+ a different version of the VTIMEZONE. */
+ zone_tzid = icaltimezone_get_tzid (zone);
+ if (!strcmp (zone_tzid, tzid))
+ return zone;
+ else
+ return NULL;
+}
+
+
+/** Returns the special UTC timezone. */
+icaltimezone*
+icaltimezone_get_utc_timezone (void)
+{
+ if (!builtin_timezones)
+ icaltimezone_init_builtin_timezones ();
+
+ return &utc_timezone;
+}
+
+
+
+/** This initializes the builtin timezone data, i.e. the
+ builtin_timezones array and the special UTC timezone. It should be
+ called before any code that uses the timezone functions. */
+static void
+icaltimezone_init_builtin_timezones (void)
+{
+ /* Initialize the special UTC timezone. */
+ utc_timezone.tzid = "UTC";
+
+ icaltimezone_parse_zone_tab ();
+}
+
+
+/** This parses the zones.tab file containing the names and locations
+ of the builtin timezones. It creates the builtin_timezones array
+ which is an icalarray of icaltimezone structs. It only fills in the
+ location, latitude and longtude fields; the rest are left
+ blank. The VTIMEZONE component is loaded later if it is needed. The
+ timezones in the zones.tab file are sorted by their name, which is
+ useful for binary searches. */
+static void
+icaltimezone_parse_zone_tab (void)
+{
+ char *filename;
+ FILE *fp;
+ char buf[1024]; /* Used to store each line of zones.tab as it is read. */
+ char location[1024]; /* Stores the city name when parsing buf. */
+ unsigned int filename_len;
+ int latitude_degrees, latitude_minutes, latitude_seconds;
+ int longitude_degrees, longitude_minutes, longitude_seconds;
+ icaltimezone zone;
+
+ icalerror_assert (builtin_timezones == NULL,
+ "Parsing zones.tab file multiple times");
+
+ builtin_timezones = icalarray_new (sizeof (icaltimezone), 32);
+
+ filename_len = strlen (get_zone_directory()) + strlen (ZONES_TAB_FILENAME)
+ + 2;
+
+ filename = (char*) malloc (filename_len);
+ if (!filename) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ snprintf (filename, filename_len, "%s/%s", get_zone_directory(),
+ ZONES_TAB_FILENAME);
+
+ fp = fopen (filename, "r");
+ free (filename);
+ if (!fp) {
+ icalerror_set_errno(ICAL_FILE_ERROR);
+ return;
+ }
+
+ while (fgets (buf, sizeof(buf), fp)) {
+ if (*buf == '#') continue;
+
+ /* The format of each line is: "latitude longitude location". */
+ if (sscanf (buf, "%4d%2d%2d %4d%2d%2d %s",
+ &latitude_degrees, &latitude_minutes,
+ &latitude_seconds,
+ &longitude_degrees, &longitude_minutes,
+ &longitude_seconds,
+ location) != 7) {
+ fprintf (stderr, "Invalid timezone description line: %s\n", buf);
+ continue;
+ }
+
+ icaltimezone_init (&zone);
+ zone.location = strdup (location);
+
+ if (latitude_degrees >= 0)
+ zone.latitude = (double) latitude_degrees
+ + (double) latitude_minutes / 60
+ + (double) latitude_seconds / 3600;
+ else
+ zone.latitude = (double) latitude_degrees
+ - (double) latitude_minutes / 60
+ - (double) latitude_seconds / 3600;
+
+ if (longitude_degrees >= 0)
+ zone.longitude = (double) longitude_degrees
+ + (double) longitude_minutes / 60
+ + (double) longitude_seconds / 3600;
+ else
+ zone.longitude = (double) longitude_degrees
+ - (double) longitude_minutes / 60
+ - (double) longitude_seconds / 3600;
+
+ icalarray_append (builtin_timezones, &zone);
+
+#if 0
+ printf ("Found zone: %s %f %f\n",
+ location, zone.latitude, zone.longitude);
+#endif
+ }
+
+ fclose (fp);
+}
+
+
+/** Loads the builtin VTIMEZONE data for the given timezone. */
+static void
+icaltimezone_load_builtin_timezone (icaltimezone *zone)
+{
+ char *filename;
+ unsigned int filename_len;
+ FILE *fp;
+ icalparser *parser;
+ icalcomponent *comp, *subcomp;
+
+ /* If the location isn't set, it isn't a builtin timezone. */
+ if (!zone->location || !zone->location[0])
+ return;
+
+ filename_len = strlen (get_zone_directory()) + strlen (zone->location) + 6;
+
+ filename = (char*) malloc (filename_len);
+ if (!filename) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ snprintf (filename, filename_len, "%s/%s.ics", get_zone_directory(),
+ zone->location);
+
+ fp = fopen (filename, "r");
+ free (filename);
+ if (!fp) {
+ icalerror_set_errno(ICAL_FILE_ERROR);
+ return;
+ }
+
+
+ /* ##### B.# Sun, 11 Nov 2001 04:04:29 +1100
+ this is where the MALFORMEDDATA error is being set, after the call to 'icalparser_parse'
+ fprintf(stderr, "** WARNING ** %s: %d %s\n", __FILE__, __LINE__, icalerror_strerror(icalerrno));
+ */
+
+ parser = icalparser_new ();
+ icalparser_set_gen_data (parser, fp);
+ comp = icalparser_parse (parser, icaltimezone_load_get_line_fn);
+ icalparser_free (parser);
+ fclose (fp);
+
+
+
+ /* Find the VTIMEZONE component inside the VCALENDAR. There should be 1. */
+ subcomp = icalcomponent_get_first_component (comp,
+ ICAL_VTIMEZONE_COMPONENT);
+ if (!subcomp) {
+ icalerror_set_errno(ICAL_PARSE_ERROR);
+ return;
+ }
+
+ icaltimezone_get_vtimezone_properties (zone, subcomp);
+
+ icalcomponent_remove_component(comp,subcomp);
+
+ icalcomponent_free(comp);
+
+}
+
+
+/** Callback used from icalparser_parse() */
+static char *
+icaltimezone_load_get_line_fn (char *s,
+ size_t size,
+ void *data)
+{
+ return fgets (s, size, (FILE*) data);
+}
+
+
+
+
+/*
+ * DEBUGGING
+ */
+
+/**
+ * This outputs a list of timezone changes for the given timezone to the
+ * given file, up to the maximum year given. We compare this output with the
+ * output from 'vzic --dump-changes' to make sure that we are consistent.
+ * (vzic is the Olson timezone database to VTIMEZONE converter.)
+ *
+ * The output format is:
+ *
+ * Zone-Name [tab] Date [tab] Time [tab] UTC-Offset
+ *
+ * The Date and Time fields specify the time change in UTC.
+ *
+ * The UTC Offset is for local (wall-clock) time. It is the amount of time
+ * to add to UTC to get local time.
+ */
+int
+icaltimezone_dump_changes (icaltimezone *zone,
+ int max_year,
+ FILE *fp)
+{
+ static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+ icaltimezonechange *zone_change;
+ int change_num;
+ char buffer[8];
+
+ /* Make sure the changes array is expanded up to the given time. */
+ icaltimezone_ensure_coverage (zone, max_year);
+
+#if 0
+ printf ("Num changes: %i\n", zone->changes->num_elements);
+#endif
+
+ change_num = 0;
+ for (change_num = 0; change_num < zone->changes->num_elements; change_num++) {
+ zone_change = icalarray_element_at (zone->changes, change_num);
+
+ if (zone_change->year > max_year)
+ break;
+
+ fprintf (fp, "%s\t%2i %s %04i\t%2i:%02i:%02i",
+ zone->location,
+ zone_change->day, months[zone_change->month - 1],
+ zone_change->year,
+ zone_change->hour, zone_change->minute, zone_change->second);
+
+ /* Wall Clock Time offset from UTC. */
+ format_utc_offset (zone_change->utc_offset, buffer);
+ fprintf (fp, "\t%s", buffer);
+
+ fprintf (fp, "\n");
+ }
+ return 1;
+}
+
+
+/** This formats a UTC offset as "+HHMM" or "+HHMMSS".
+ buffer should have space for 8 characters. */
+static void
+format_utc_offset (int utc_offset,
+ char *buffer)
+{
+ char *sign = "+";
+ int hours, minutes, seconds;
+
+ if (utc_offset < 0) {
+ utc_offset = -utc_offset;
+ sign = "-";
+ }
+
+ hours = utc_offset / 3600;
+ minutes = (utc_offset % 3600) / 60;
+ seconds = utc_offset % 60;
+
+ /* Sanity check. Standard timezone offsets shouldn't be much more than 12
+ hours, and daylight saving shouldn't change it by more than a few hours.
+ (The maximum offset is 15 hours 56 minutes at present.) */
+ if (hours < 0 || hours >= 24 || minutes < 0 || minutes >= 60
+ || seconds < 0 || seconds >= 60) {
+ fprintf (stderr, "Warning: Strange timezone offset: H:%i M:%i S:%i\n",
+ hours, minutes, seconds);
+ }
+
+ if (seconds == 0)
+ sprintf (buffer, "%s%02i%02i", sign, hours, minutes);
+ else
+ sprintf (buffer, "%s%02i%02i%02i", sign, hours, minutes, seconds);
+}
+
+static char* get_zone_directory(void)
+{
+ return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory;
+}
+
+void set_zone_directory(char *path)
+{
+ zone_files_directory = malloc(strlen(path)+1);
+ if ( zone_files_directory != NULL )
+ {
+ strcpy(zone_files_directory,path);
+ }
+}
+
+void free_zone_directory(void)
+{
+ if ( zone_files_directory != NULL )
+ {
+ free(zone_files_directory);
+ }
+}
diff --git a/libical/src/libical/icaltimezone.h b/libical/src/libical/icaltimezone.h
new file mode 100644
index 0000000..08af2c1
--- a/dev/null
+++ b/libical/src/libical/icaltimezone.h
@@ -0,0 +1,167 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*======================================================================
+ FILE: icaltimezone.h
+ CREATOR: Damon Chaplin 15 March 2001
+
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2001, Damon Chaplin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+
+======================================================================*/
+/**
+ * @file icaltimezone.h
+ * @brief timezone handling routines
+ */
+
+#ifndef ICALTIMEZONE_H
+#define ICALTIMEZONE_H
+
+#include <stdio.h> /* For FILE* */
+#include "icaltime.h"
+#include "icalarray.h"
+#include "icalcomponent.h"
+
+
+#ifndef ICALTIMEZONE_DEFINED
+#define ICALTIMEZONE_DEFINED
+/** @brief An opaque struct representing a timezone.
+ * We declare this here to avoid a circular dependancy.
+ */
+typedef struct _icaltimezone icaltimezone;
+#endif
+
+/**
+ * @par Creating/Destroying individual icaltimezones.
+ */
+
+/** Creates a new icaltimezone. */
+icaltimezone *icaltimezone_new (void);
+
+/** Frees all memory used for the icaltimezone. Set free_struct to free the
+ icaltimezone struct as well. */
+void icaltimezone_free (icaltimezone *zone,
+ int free_struct);
+
+
+/**
+ * @par Accessing timezones.
+ */
+
+/** Free any builtin timezone information **/
+void icaltimezone_free_builtin_timezones(void);
+
+/** Returns the array of builtin icaltimezones. */
+icalarray* icaltimezone_get_builtin_timezones (void);
+
+/** Returns a single builtin timezone, given its Olson city name. */
+icaltimezone* icaltimezone_get_builtin_timezone (const char *location);
+
+/** Returns a single builtin timezone, given its TZID. */
+icaltimezone* icaltimezone_get_builtin_timezone_from_tzid (const char *tzid);
+
+/** Returns the UTC timezone. */
+icaltimezone* icaltimezone_get_utc_timezone (void);
+
+/** Returns the TZID of a timezone. */
+char* icaltimezone_get_tzid (icaltimezone *zone);
+
+/** Returns the city name of a timezone. */
+char* icaltimezone_get_location (icaltimezone *zone);
+
+/** Returns the TZNAME properties used in the latest STANDARD and DAYLIGHT
+ components. If they are the same it will return just one, e.g. "LMT".
+ If they are different it will format them like "EST/EDT". Note that this
+ may also return NULL. */
+char* icaltimezone_get_tznames (icaltimezone *zone);
+
+/** Returns the latitude of a builtin timezone. */
+double icaltimezone_get_latitude (icaltimezone *zone);
+
+/** Returns the longitude of a builtin timezone. */
+double icaltimezone_get_longitude (icaltimezone *zone);
+
+/** Returns the VTIMEZONE component of a timezone. */
+icalcomponent* icaltimezone_get_component (icaltimezone *zone);
+
+/** Sets the VTIMEZONE component of an icaltimezone, initializing the tzid,
+ location & tzname fields. It returns 1 on success or 0 on failure, i.e.
+ no TZID was found. */
+int icaltimezone_set_component (icaltimezone *zone,
+ icalcomponent *comp);
+
+/**
+ * @par Converting times between timezones.
+ */
+
+void icaltimezone_convert_time (struct icaltimetype *tt,
+ icaltimezone *from_zone,
+ icaltimezone *to_zone);
+
+
+/**
+ * @par Getting offsets from UTC.
+ */
+
+/** Calculates the UTC offset of a given local time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+/** Calculates the UTC offset of a given UTC time in the given
+ timezone. It is the number of seconds to add to UTC to get local
+ time. The is_daylight flag is set to 1 if the time is in
+ daylight-savings time. */
+int icaltimezone_get_utc_offset_of_utc_time (icaltimezone *zone,
+ struct icaltimetype *tt,
+ int *is_daylight);
+
+
+
+/*
+ * Handling arrays of timezones. Mainly for internal use.
+ */
+icalarray* icaltimezone_array_new (void);
+
+void icaltimezone_array_append_from_vtimezone (icalarray *timezones,
+ icalcomponent *child);
+void icaltimezone_array_free (icalarray *timezones);
+
+
+/*
+ * @par Handling the default location the timezone files
+ */
+
+/** Set the directory to look for the zonefiles */
+void set_zone_directory(char *path);
+
+/** Free memory dedicated to the zonefile directory */
+void free_zone_directory(void);
+
+/*
+ * @par Debugging Output.
+ */
+
+/** Dumps information about changes in the timezone up to and including
+ max_year. */
+int icaltimezone_dump_changes (icaltimezone *zone,
+ int max_year,
+ FILE *fp);
+
+#endif /* ICALTIMEZONE_H */
diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c
index 8c67deb..19719f8 100644
--- a/libical/src/libical/icaltypes.c
+++ b/libical/src/libical/icaltypes.c
@@ -37,3 +37,6 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
@@ -41,129 +44,32 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
-void*
-icalattachtype_get_data (struct icalattachtype* type);
-struct icalattachtype*
-icalattachtype_new()
+int icaltriggertype_is_null_trigger(struct icaltriggertype tr)
{
- struct icalattachtype* v;
-
- if ( ( v = (struct icalattachtype*)
- malloc(sizeof(struct icalattachtype))) == 0) {
- errno = ENOMEM;
- return 0;
+ if(icaltime_is_null_time(tr.time) &&
+ icaldurationtype_is_null_duration(tr.duration)){
+ return 1;
}
- v->refcount = 1;
-
- v->binary = 0;
- v->owns_binary = 0;
- v->base64 = 0;
- //fprintf(stderr,"setting base 64 to 0 \n");
-
- v->owns_base64 = 0;
-
- v->url = 0;
-
- return v;
+ return 0;
}
-
-
-void
-icalattachtype_free(struct icalattachtype* v)
-{
- icalerror_check_arg( (v!=0),"v");
- v->refcount--;
-
- if (v->refcount <= 0){
-
- if (v->base64 != 0 && v->owns_base64 != 0){
- int val = v->base64 ;
- if ( val < 255 ) {
- fprintf(stderr,"Possible error in attachment processing (%d)\nPocssible solution: Remove attachment from file.\n",val );
- }
- free(v->base64);
- }
-
- if (v->binary != 0 && v->owns_binary != 0){
- free(v->binary);
- }
-
- if (v->url != 0){
- free(v->url);
- }
-
- free(v);
- }
-}
-
-void icalattachtype_add_reference(struct icalattachtype* v)
-{
- icalerror_check_arg( (v!=0),"v");
- v->refcount++;
-}
-
-void icalattachtype_set_url(struct icalattachtype* v, char* url)
+int icaltriggertype_is_bad_trigger(struct icaltriggertype tr)
{
- icalerror_check_arg( (v!=0),"v");
-
- if (v->url != 0){
- free (v->url);
+ if(icaldurationtype_is_bad_duration(tr.duration)){
+ return 1;
}
- v->url = icalmemory_strdup(url);
-
- /* HACK This routine should do something if icalmemory_strdup returns NULL */
-
-}
-
-char* icalattachtype_get_url(struct icalattachtype* v)
-{
- icalerror_check_arg( (v!=0),"v");
- return v->url;
-}
-
-void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
- int owns)
-{
- //fprintf(stderr,"1setbase64 %d \n", base64 );
- icalerror_check_arg( (v!=0),"v");
- //fprintf(stderr,"setbase64 %d \n", base64 );
- v->base64 = base64;
- v->owns_base64 = !(owns != 0 );
-
-}
-
-char* icalattachtype_get_base64(struct icalattachtype* v)
-{
- icalerror_check_arg( (v!=0),"v");
- return v->base64;
+ return 0;
}
-void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
- int owns)
+struct icaltriggertype icaltriggertype_from_int(const int reltime)
{
- icalerror_check_arg( (v!=0),"v");
+ struct icaltriggertype tr;
- v->binary = binary;
- v->owns_binary = !(owns != 0 );
+ tr.time = icaltime_null_time();
+ tr.duration = icaldurationtype_from_int(reltime);
+ return tr;
}
-void* icalattachtype_get_binary(struct icalattachtype* v)
-{
- icalerror_check_arg( (v!=0),"v");
- return v->binary;
-}
-
-int icaltriggertype_is_null_trigger(struct icaltriggertype tr)
-{
- if(icaltime_is_null_time(tr.time) &&
- icaldurationtype_is_null_duration(tr.duration)){
- return 1;
- }
-
- return 0;
-}
-
struct icaltriggertype icaltriggertype_from_string(const char* str)
@@ -183,3 +89,3 @@ struct icaltriggertype icaltriggertype_from_string(const char* str)
- /* Surpress errors so a failure in icaltime_from_string() does not cause an abort */
+ /* Suppress errors so a failure in icaltime_from_string() does not cause an abort */
es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
@@ -195,3 +101,3 @@ struct icaltriggertype icaltriggertype_from_string(const char* str)
- if(icaldurationtype_as_int(tr.duration) == 0) goto error;
+ if (icaldurationtype_is_bad_duration(tr.duration)) goto error;
}
@@ -205,3 +111,3 @@ struct icaltriggertype icaltriggertype_from_string(const char* str)
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return null_tr;
+ return tr;
@@ -214,3 +120,3 @@ struct icalreqstattype icalreqstattype_from_string(const char* str)
struct icalreqstattype stat;
- int major, minor;
+ short major=0, minor=0;
@@ -224,3 +130,3 @@ struct icalreqstattype icalreqstattype_from_string(const char* str)
- sscanf(str, "%d.%d",&major, &minor);
+ sscanf(str, "%hd.%hd",&major, &minor);
diff --git a/libical/src/libical/icaltypes.h b/libical/src/libical/icaltypes.h
index d61b9f3..1e5c5e0 100644
--- a/libical/src/libical/icaltypes.h
+++ b/libical/src/libical/icaltypes.h
@@ -33,35 +33,2 @@
-/* This type type should probably be an opaque type... */
-struct icalattachtype
-{
- void* binary;
- int owns_binary;
-
- char* base64;
- int owns_base64;
-
- char* url;
-
- int refcount;
-
-};
-
-/* converts base64 to binary, fetches url and stores as binary, or
- just returns data */
-
-struct icalattachtype* icalattachtype_new(void);
-void icalattachtype_add_reference(struct icalattachtype* v);
-void icalattachtype_free(struct icalattachtype* v);
-
-void icalattachtype_set_url(struct icalattachtype* v, char* url);
-char* icalattachtype_get_url(struct icalattachtype* v);
-
-void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
- int owns);
-char* icalattachtype_get_base64(struct icalattachtype* v);
-
-void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
- int owns);
-void* icalattachtype_get_binary(struct icalattachtype* v);
-
struct icalgeotype
@@ -86,2 +53,3 @@ struct icaltriggertype
+struct icaltriggertype icaltriggertype_from_int(const int reltime);
struct icaltriggertype icaltriggertype_from_string(const char* str);
@@ -89,2 +57,3 @@ struct icaltriggertype icaltriggertype_from_string(const char* str);
int icaltriggertype_is_null_trigger(struct icaltriggertype tr);
+int icaltriggertype_is_bad_trigger(struct icaltriggertype tr);
diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c
index eb5476e..4c67136 100644
--- a/libical/src/libical/icalvalue.c
+++ b/libical/src/libical/icalvalue.c
@@ -1,2 +1,3 @@
-/* -*- Mode: C -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vi:set ts=4 sts=4 sw=4 expandtab : */
/*======================================================================
@@ -48,3 +49,6 @@
-int snprintf(char *str, size_t n, char const *fmt, ...);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
@@ -56,6 +60,5 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
-void print_datetime_to_string(char* str, struct icaltimetype *data);
-void print_date_to_string(char* str, struct icaltimetype *data);
-void print_time_to_string(char* str, struct icaltimetype *data);
-void print_recur_to_string(char* str, struct icaltimetype *data);
+void print_datetime_to_string(char* str, const struct icaltimetype *data);
+void print_date_to_string(char* str, const struct icaltimetype *data);
+void print_time_to_string(char* str, const struct icaltimetype *data);
@@ -66,2 +69,5 @@ struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){
+ if (!icalvalue_kind_is_valid(kind))
+ return NULL;
+
if ( ( v = (struct icalvalue_impl*)
@@ -92,6 +98,4 @@ icalvalue_new (icalvalue_kind kind)
-icalvalue* icalvalue_new_clone(icalvalue* value){
-
+icalvalue* icalvalue_new_clone(const icalvalue* old) {
struct icalvalue_impl* new;
- struct icalvalue_impl* old = (struct icalvalue_impl*)value;
@@ -103,3 +107,2 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
-
strcpy(new->id, old->id);
@@ -109,5 +112,2 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
switch (new->kind){
-
- /* The contents of the attach value may or may not be owned by the
- * library. */
case ICAL_ATTACH_VALUE:
@@ -115,5 +115,13 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
{
- /* HACK ugh. I don't feel like impleenting this */
- }
+ /* Hmm. We just ref the attach value, which may not be the right
+ * thing to do. We cannot quite copy the data, anyways, since we
+ * don't know how long it is.
+ */
+ new->data.v_attach = old->data.v_attach;
+ if (new->data.v_attach)
+ icalattach_ref (new->data.v_attach);
+ break;
+ }
+ case ICAL_QUERY_VALUE:
case ICAL_STRING_VALUE:
@@ -148,2 +156,15 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
+ case ICAL_X_VALUE:
+ {
+ if (old->x_value != 0) {
+ new->x_value=icalmemory_strdup(old->x_value);
+
+ if (new->x_value == 0) {
+ return 0;
+ }
+ }
+
+ break;
+ }
+
default:
@@ -160,3 +181,3 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
-char* icalmemory_strdup_and_dequote(const char* str)
+static char* icalmemory_strdup_and_dequote(const char* str)
{
@@ -185,2 +206,3 @@ char* icalmemory_strdup_and_dequote(const char* str)
case 'n':
+ case 'N':
{
@@ -189,10 +211,30 @@ char* icalmemory_strdup_and_dequote(const char* str)
}
- case 'N':
+ case 't':
+ case 'T':
{
- *pout = '\n';
+ *pout = '\t';
+ break;
+ }
+ case 'r':
+ case 'R':
+ {
+ *pout = '\r';
+ break;
+ }
+ case 'b':
+ case 'B':
+ {
+ *pout = '\b';
+ break;
+ }
+ case 'f':
+ case 'F':
+ {
+ *pout = '\f';
break;
}
- case '\\':
- case ',':
case ';':
+ case ',':
+ case '"':
+ case '\\':
{
@@ -219,5 +261,12 @@ char* icalmemory_strdup_and_dequote(const char* str)
+/*
+ * FIXME
+ *
+ * This is a bad API, as it forces callers to specify their own X type.
+ * This function should take care of this by itself.
+ */
+static
icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str)
{
- int e = icalproperty_string_to_enum(str);
+ int e = icalproperty_kind_and_string_to_enum(kind, str);
struct icalvalue_impl *value;
@@ -244,3 +293,2 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
struct icalvalue_impl *value = 0;
- struct icalattachtype *attach = 0;
@@ -255,8 +303,15 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
case ICAL_ATTACH_VALUE:
- attach = icalattachtype_new();
- value = icalvalue_new_attach( attach );
- icalattachtype_free( attach );
- icalattachtype_set_url( value->data.v_attach, str );
- break;
- case ICAL_BINARY_VALUE:
+ {
+ icalattach *attach;
+
+ attach = icalattach_new_from_url (str);
+ if (!attach)
+ break;
+
+ value = icalvalue_new_attach (attach);
+ icalattach_unref (attach);
+ break;
+ }
+
+ case ICAL_BINARY_VALUE:
case ICAL_BOOLEAN_VALUE:
@@ -269,3 +324,3 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
sprintf(temp,"%s Values are not implemented",
- icalparameter_kind_to_string(kind));
+ icalvalue_kind_to_string(kind));
*error = icalproperty_vanew_xlicerror(
@@ -281,15 +336,20 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
case ICAL_TRANSP_VALUE:
- value = icalvalue_new_enum(kind, ICAL_TRANSP_X,str);
+ value = icalvalue_new_enum(kind, (int)ICAL_TRANSP_X,str);
break;
case ICAL_METHOD_VALUE:
- value = icalvalue_new_enum(kind, ICAL_METHOD_X,str);
+ value = icalvalue_new_enum(kind, (int)ICAL_METHOD_X,str);
break;
case ICAL_STATUS_VALUE:
- value = icalvalue_new_enum(kind, ICAL_STATUS_X,str);
+ value = icalvalue_new_enum(kind, (int)ICAL_STATUS_X,str);
break;
case ICAL_ACTION_VALUE:
- value = icalvalue_new_enum(kind, ICAL_ACTION_X,str);
+ value = icalvalue_new_enum(kind, (int)ICAL_ACTION_X,str);
break;
+
+ case ICAL_QUERY_VALUE:
+ value = icalvalue_new_query(str);
+ break;
+
case ICAL_CLASS_VALUE:
- value = icalvalue_new_enum(kind, ICAL_CLASS_X,str);
+ value = icalvalue_new_enum(kind, (int)ICAL_CLASS_X,str);
break;
@@ -298,16 +358,24 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
case ICAL_INTEGER_VALUE:
- {
value = icalvalue_new_integer(atoi(str));
break;
- }
case ICAL_FLOAT_VALUE:
- {
- value = icalvalue_new_float((float )atof(str));
+ value = icalvalue_new_float((float)atof(str));
break;
- }
-
+
case ICAL_UTCOFFSET_VALUE:
{
- value = icalparser_parse_value(kind,str,(icalcomponent*)0);
+ int t,utcoffset, hours, minutes, seconds;
+ /* treat the UTCOFSET string a a decimal number, disassemble its digits
+ and reconstruct it as sections */
+ t = strtol(str,0,10);
+ /* add phantom seconds field */
+ if(abs(t)<9999){t *= 100; }
+ hours = (t/10000);
+ minutes = (t-hours*10000)/100;
+ seconds = (t-hours*10000-minutes*100);
+ utcoffset = hours*3600+minutes*60+seconds;
+
+ value = icalvalue_new_utcoffset(utcoffset);
+
break;
@@ -323,24 +391,15 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
-
case ICAL_STRING_VALUE:
- {
value = icalvalue_new_string(str);
break;
- }
case ICAL_CALADDRESS_VALUE:
- {
value = icalvalue_new_caladdress(str);
break;
- }
case ICAL_URI_VALUE:
- {
value = icalvalue_new_uri(str);
break;
- }
-
case ICAL_GEO_VALUE:
- {
value = 0;
@@ -352,12 +411,11 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
*error = icalproperty_vanew_xlicerror(
- temp,
- icalparameter_new_xlicerrortype(
- ICAL_XLICERRORTYPE_VALUEPARSEERROR),
- 0);
+ temp,
+ icalparameter_new_xlicerrortype(
+ ICAL_XLICERRORTYPE_VALUEPARSEERROR),
+ 0);
}
-
+
/*icalerror_warn("Parsing GEO properties is unimplmeneted");*/
-
+
break;
- }
@@ -393,10 +451,13 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
tt = icaltime_from_string(str);
- p = icalperiodtype_from_string(str);
-
+
if(!icaltime_is_null_time(tt)){
- value = icalvalue_new_datetime(tt);
- } else if (!icalperiodtype_is_null_period(p)){
+ value = icalvalue_new_datetime(tt);
+ break;
+ }
+
+ p = icalperiodtype_from_string(str);
+ if (!icalperiodtype_is_null_period(p)){
value = icalvalue_new_period(p);
}
-
+
break;
@@ -408,5 +469,3 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
- if(icaldurationtype_is_null_duration(dur)){
- value = 0;
- } else {
+ if (!icaldurationtype_is_bad_duration(dur)) { /* failed to parse */
value = icalvalue_new_duration(dur);
@@ -431,3 +490,3 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
struct icaltriggertype tr = icaltriggertype_from_string(str);
- if (!icaltriggertype_is_null_trigger(tr)){
+ if (!icaltriggertype_is_bad_trigger(tr)) {
value = icalvalue_new_trigger(tr);
@@ -446,5 +505,13 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
}
+
+ case ICAL_X_VALUE:
+ {
+ char* dequoted_str = icalmemory_strdup_and_dequote(str);
+ value = icalvalue_new_x(dequoted_str);
+ free(dequoted_str);
+ }
+ break;
+
default:
{
-
if (error != 0 ){
@@ -486,3 +553,3 @@ icalvalue* icalvalue_new_from_string(icalvalue_kind kind,const char* str)
{
- return icalvalue_new_from_string_with_error(kind,str,(icalproperty*)0);
+ return icalvalue_new_from_string_with_error(kind,str,(icalproperty**)0);
}
@@ -492,7 +559,5 @@ icalvalue* icalvalue_new_from_string(icalvalue_kind kind,const char* str)
void
-icalvalue_free (icalvalue* value)
+icalvalue_free (icalvalue* v)
{
- struct icalvalue_impl* v = (struct icalvalue_impl*)value;
-
- icalerror_check_arg_rv((value != 0),"value");
+ icalerror_check_arg_rv((v != 0),"value");
@@ -512,7 +577,10 @@ icalvalue_free (icalvalue* value)
switch (v->kind){
- case ICAL_ATTACH_VALUE:
- icalattachtype_free( v->data.v_attach );
+ case ICAL_BINARY_VALUE:
+ case ICAL_ATTACH_VALUE: {
+ if (v->data.v_attach) {
+ icalattach_unref (v->data.v_attach);
+ v->data.v_attach = NULL;
+ }
+
break;
- case ICAL_BINARY_VALUE: {
- /* HACK ugh. This will be tough to implement */
}
@@ -521,2 +589,3 @@ icalvalue_free (icalvalue* value)
case ICAL_URI_VALUE:
+ case ICAL_QUERY_VALUE:
{
@@ -552,6 +621,4 @@ icalvalue_free (icalvalue* value)
int
-icalvalue_is_valid (icalvalue* value)
+icalvalue_is_valid (const icalvalue* value)
{
- /*struct icalvalue_impl* v = (struct icalvalue_impl*)value;*/
-
if(value == 0){
@@ -563,3 +630,3 @@ icalvalue_is_valid (icalvalue* value)
-char* icalvalue_binary_as_ical_string(icalvalue* value) {
+static char* icalvalue_binary_as_ical_string(const icalvalue* value) {
@@ -577,6 +644,6 @@ char* icalvalue_binary_as_ical_string(icalvalue* value) {
-#ifndef _WIN32
+
#define MAX_INT_DIGITS 12 /* Enough for 2^32 + sign*/
-char* icalvalue_int_as_ical_string(icalvalue* value) {
+static char* icalvalue_int_as_ical_string(const icalvalue* value) {
int data;
@@ -592,22 +659,4 @@ char* icalvalue_int_as_ical_string(icalvalue* value) {
}
-#else
-// snprintf not working on wintendo
-#define MAX_INT_DIGITS 32 /* Enough for 2^32 + sign*/
-char* icalvalue_int_as_ical_string(icalvalue* value) {
-
- int data;
- char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS);
-
- icalerror_check_arg_rz( (value!=0),"value");
-
- data = icalvalue_get_integer(value);
-
- sprintf(str,"%d",data);
-
- return str;
-}
-
-#endif
-char* icalvalue_utcoffset_as_ical_string(icalvalue* value)
+static char* icalvalue_utcoffset_as_ical_string(const icalvalue* value)
{
@@ -631,3 +680,6 @@ char* icalvalue_utcoffset_as_ical_string(icalvalue* value)
- sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s));
+ if (s > 0)
+ sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s));
+ else
+ sprintf(str,"%c%02d%02d",sign,abs(h),abs(m));
@@ -636,3 +688,3 @@ char* icalvalue_utcoffset_as_ical_string(icalvalue* value)
-char* icalvalue_string_as_ical_string(icalvalue* value) {
+static char* icalvalue_string_as_ical_string(const icalvalue* value) {
@@ -641,4 +693,3 @@ char* icalvalue_string_as_ical_string(icalvalue* value) {
icalerror_check_arg_rz( (value!=0),"value");
-
- data = ((struct icalvalue_impl*)value)->data.v_string;
+ data = value->data.v_string;
@@ -652,6 +703,5 @@ char* icalvalue_string_as_ical_string(icalvalue* value) {
-char* icalvalue_recur_as_ical_string(icalvalue* value)
+static char* icalvalue_recur_as_ical_string(const icalvalue* value)
{
- struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
- struct icalrecurrencetype *recur = impl->data.v_recur;
+ struct icalrecurrencetype *recur = value->data.v_recur;
@@ -660,4 +710,9 @@ char* icalvalue_recur_as_ical_string(icalvalue* value)
-char* icalvalue_text_as_ical_string(icalvalue* value) {
+ /* @todo This is not RFC2445 compliant.
+ * The RFC only allows:
+ * TSAFE-CHAR = %x20-21 / %x23-2B / %x2D-39 / %x3C-5B / %x5D-7E / NON-US-ASCII
+ * As such, \t\r\b\f are not allowed, not even escaped
+ */
+static char* icalvalue_text_as_ical_string(const icalvalue* value) {
char *str;
@@ -667,7 +722,4 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
size_t buf_sz;
- int line_length;
-
- line_length = 0;
- buf_sz = strlen(((struct icalvalue_impl*)value)->data.v_string)+1;
+ buf_sz = strlen(value->data.v_string)+1;
@@ -679,3 +731,3 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
- for(p=((struct icalvalue_impl*)value)->data.v_string; *p!=0; p++){
+ for(p=value->data.v_string; *p!=0; p++){
@@ -684,3 +736,2 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\\n");
- line_length+=3;
break;
@@ -690,3 +741,2 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\\t");
- line_length+=3;
break;
@@ -695,3 +745,2 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\\r");
- line_length+=3;
break;
@@ -700,3 +749,2 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\\b");
- line_length+=3;
break;
@@ -705,3 +753,2 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\\f");
- line_length+=3;
break;
@@ -710,6 +757,7 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
case ';':
- case ',':{
+ case ',':
+ case '"':
+ case '\\':{
icalmemory_append_char(&str,&str_p,&buf_sz,'\\');
icalmemory_append_char(&str,&str_p,&buf_sz,*p);
- line_length+=3;
break;
@@ -719,17 +767,4 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_char(&str,&str_p,&buf_sz,*p);
- line_length++;
}
}
-
- if (line_length > 65 && *p == ' '){
- icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
- line_length=0;
- }
-
-
- if (line_length > 75){
- icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
- line_length=0;
- }
-
}
@@ -751,5 +786,6 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
-char* icalvalue_attach_as_ical_string(icalvalue* value) {
-
- struct icalattachtype *a;
+static char*
+icalvalue_attach_as_ical_string(const icalvalue* value)
+{
+ icalattach *a;
char * str;
@@ -760,17 +796,11 @@ char* icalvalue_attach_as_ical_string(icalvalue* value) {
- if (a->binary != 0) {
- return icalvalue_binary_as_ical_string(value);
- } else if (a->base64 != 0) {
- str = (char*)icalmemory_tmp_buffer(strlen(a->base64)+1);
- strcpy(str,a->base64);
+ if (icalattach_get_is_url (a)) {
+ const char *url;
+
+ url = icalattach_get_url (a);
+ str = icalmemory_tmp_buffer (strlen (url) + 1);
+ strcpy (str, url);
return str;
- } else if (a->url != 0){
- icalvalue *v = icalvalue_new_text( a->url );
- char *icalstring = icalvalue_string_as_ical_string(v);
- icalvalue_free( v );
- return icalstring;
- } else {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
+ } else
+ return icalvalue_binary_as_ical_string (value);
}
@@ -778,3 +808,3 @@ char* icalvalue_attach_as_ical_string(icalvalue* value) {
-char* icalvalue_duration_as_ical_string(icalvalue* value) {
+static char* icalvalue_duration_as_ical_string(const icalvalue* value) {
@@ -788,3 +818,3 @@ char* icalvalue_duration_as_ical_string(icalvalue* value) {
-void print_time_to_string(char* str, struct icaltimetype *data)
+void print_time_to_string(char* str, const struct icaltimetype *data)
{
@@ -792,3 +822,3 @@ void print_time_to_string(char* str, struct icaltimetype *data)
- if (data->is_utc == 1){
+ if (icaltime_is_utc(*data)){
sprintf(temp,"%02d%02d%02dZ",data->hour,data->minute,data->second);
@@ -802,3 +832,3 @@ void print_time_to_string(char* str, struct icaltimetype *data)
-void print_date_to_string(char* str, struct icaltimetype *data)
+void print_date_to_string(char* str, const struct icaltimetype *data)
{
@@ -811,3 +841,3 @@ void print_date_to_string(char* str, struct icaltimetype *data)
-char* icalvalue_date_as_ical_string(icalvalue* value) {
+static char* icalvalue_date_as_ical_string(const icalvalue* value) {
@@ -826,3 +856,3 @@ char* icalvalue_date_as_ical_string(icalvalue* value) {
-void print_datetime_to_string(char* str, struct icaltimetype *data)
+void print_datetime_to_string(char* str, const struct icaltimetype *data)
{
@@ -831,6 +861,5 @@ void print_datetime_to_string(char* str, struct icaltimetype *data)
print_time_to_string(str,data);
-
}
-const char* icalvalue_datetime_as_ical_string(icalvalue* value) {
+static const char* icalvalue_datetime_as_ical_string(const icalvalue* value) {
@@ -861,3 +890,3 @@ const char* icalvalue_datetime_as_ical_string(icalvalue* value) {
-char* icalvalue_float_as_ical_string(icalvalue* value) {
+static char* icalvalue_float_as_ical_string(const icalvalue* value) {
@@ -875,3 +904,3 @@ char* icalvalue_float_as_ical_string(icalvalue* value) {
-char* icalvalue_geo_as_ical_string(icalvalue* value) {
+static char* icalvalue_geo_as_ical_string(const icalvalue* value) {
@@ -890,3 +919,3 @@ char* icalvalue_geo_as_ical_string(icalvalue* value) {
-const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
+static const char* icalvalue_datetimeperiod_as_ical_string(const icalvalue* value) {
struct icaldatetimeperiodtype dtp = icalvalue_get_datetimeperiod(value);
@@ -902,3 +931,3 @@ const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
-const char* icalvalue_period_as_ical_string(icalvalue* value) {
+static const char* icalvalue_period_as_ical_string(const icalvalue* value) {
struct icalperiodtype data;
@@ -911,3 +940,3 @@ const char* icalvalue_period_as_ical_string(icalvalue* value) {
-char* icalvalue_trigger_as_ical_string(icalvalue* value) {
+static const char* icalvalue_trigger_as_ical_string(const icalvalue* value) {
@@ -927,8 +956,4 @@ char* icalvalue_trigger_as_ical_string(icalvalue* value) {
const char*
-icalvalue_as_ical_string (icalvalue* value)
+icalvalue_as_ical_string(const icalvalue* value)
{
- struct icalvalue_impl* v = (struct icalvalue_impl*)value;
-
- v=v;
-
if(value == 0){
@@ -937,3 +962,3 @@ icalvalue_as_ical_string (icalvalue* value)
- switch (v->kind){
+ switch (value->kind){
@@ -955,2 +980,5 @@ icalvalue_as_ical_string (icalvalue* value)
+ case ICAL_QUERY_VALUE:
+ return icalvalue_string_as_ical_string(value);
+
case ICAL_STRING_VALUE:
@@ -985,3 +1013,3 @@ icalvalue_as_ical_string (icalvalue* value)
case ICAL_REQUESTSTATUS_VALUE:
- return icalreqstattype_as_string(v->data.v_requeststatus);
+ return icalreqstattype_as_string(value->data.v_requeststatus);
@@ -992,10 +1020,13 @@ icalvalue_as_ical_string (icalvalue* value)
case ICAL_CLASS_VALUE:
- if(v->x_value !=0){
- return icalmemory_tmp_copy(v->x_value);
+ if(value->x_value !=0){
+ return icalmemory_tmp_copy(value->x_value);
}
- return icalproperty_enum_to_string(v->data.v_enum);
+ return icalproperty_enum_to_string(value->data.v_enum);
case ICAL_X_VALUE:
- return icalmemory_tmp_copy(v->x_value);
+ if (value->x_value != 0)
+ return icalmemory_tmp_copy(value->x_value);
+
+ /* FALLTHRU */
@@ -1011,6 +1042,4 @@ icalvalue_as_ical_string (icalvalue* value)
icalvalue_kind
-icalvalue_isa (icalvalue* value)
+icalvalue_isa (const icalvalue* value)
{
- struct icalvalue_impl* v = (struct icalvalue_impl*)value;
-
if(value == 0){
@@ -1019,3 +1048,3 @@ icalvalue_isa (icalvalue* value)
- return v->kind;
+ return value->kind;
}
@@ -1038,3 +1067,3 @@ icalvalue_isa_value (void* value)
-int icalvalue_is_time(icalvalue* a) {
+static int icalvalue_is_time(const icalvalue* a) {
icalvalue_kind kind = icalvalue_isa(a);
@@ -1050,7 +1079,10 @@ int icalvalue_is_time(icalvalue* a) {
+/*
+ * In case of error, this function returns 0. This is partly bogus, as 0 is
+ * not part of the returned enum.
+ * FIXME We should probably add an error value to the enum.
+ */
icalparameter_xliccomparetype
-icalvalue_compare(icalvalue* a, icalvalue *b)
+icalvalue_compare(const icalvalue* a, const icalvalue *b)
{
- struct icalvalue_impl *impla = (struct icalvalue_impl *)a;
- struct icalvalue_impl *implb = (struct icalvalue_impl *)b;
@@ -1068,3 +1100,25 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
case ICAL_ATTACH_VALUE:
- case ICAL_BINARY_VALUE:
+ {
+ if (icalattach_get_is_url(a->data.v_attach) &&
+ icalattach_get_is_url(b->data.v_attach)) {
+ if (strcasecmp(icalattach_get_url(a->data.v_attach),
+ icalattach_get_url(b->data.v_attach)) == 0)
+ return ICAL_XLICCOMPARETYPE_EQUAL;
+ else
+ return ICAL_XLICCOMPARETYPE_NOTEQUAL;
+ }
+ else {
+ if (a->data.v_attach == b->data.v_attach)
+ return ICAL_XLICCOMPARETYPE_EQUAL;
+ else
+ return ICAL_XLICCOMPARETYPE_NOTEQUAL;
+ }
+ }
+ case ICAL_BINARY_VALUE:
+ {
+ if (a->data.v_attach == b->data.v_attach)
+ return ICAL_XLICCOMPARETYPE_EQUAL;
+ else
+ return ICAL_XLICCOMPARETYPE_NOTEQUAL;
+ }
@@ -1081,5 +1135,5 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
{
- if (impla->data.v_float > implb->data.v_float){
+ if (a->data.v_float > b->data.v_float){
return ICAL_XLICCOMPARETYPE_GREATER;
- } else if (impla->data.v_float < implb->data.v_float){
+ } else if (a->data.v_float < b->data.v_float){
return ICAL_XLICCOMPARETYPE_LESS;
@@ -1093,5 +1147,5 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
{
- if (impla->data.v_int > implb->data.v_int){
+ if (a->data.v_int > b->data.v_int){
return ICAL_XLICCOMPARETYPE_GREATER;
- } else if (impla->data.v_int < implb->data.v_int){
+ } else if (a->data.v_int < b->data.v_int){
return ICAL_XLICCOMPARETYPE_LESS;
@@ -1104,8 +1158,8 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
{
- int a = icaldurationtype_as_int(impla->data.v_duration);
- int b = icaldurationtype_as_int(implb->data.v_duration);
+ int dur_a = icaldurationtype_as_int(a->data.v_duration);
+ int dur_b = icaldurationtype_as_int(b->data.v_duration);
- if (a > b){
+ if (dur_a > dur_b){
return ICAL_XLICCOMPARETYPE_GREATER;
- } else if (a < b){
+ } else if (dur_a < dur_b){
return ICAL_XLICCOMPARETYPE_LESS;
@@ -1124,2 +1178,4 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
case ICAL_DATETIMEPERIOD_VALUE:
+ case ICAL_QUERY_VALUE:
+ case ICAL_RECUR_VALUE:
{
@@ -1161,5 +1217,22 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
+ case ICAL_TRANSP_VALUE:
+ {
+ if (icalvalue_get_transp(a) == icalvalue_get_transp(b)){
+ return ICAL_XLICCOMPARETYPE_EQUAL;
+ } else {
+ return ICAL_XLICCOMPARETYPE_NOTEQUAL;
+ }
+ }
+
+ case ICAL_ACTION_VALUE:
+ {
+ if (icalvalue_get_action(a) == icalvalue_get_action(b)){
+ return ICAL_XLICCOMPARETYPE_EQUAL;
+ } else {
+ return ICAL_XLICCOMPARETYPE_NOTEQUAL;
+ }
+ }
+
case ICAL_PERIOD_VALUE:
case ICAL_GEO_VALUE:
- case ICAL_RECUR_VALUE:
case ICAL_NO_VALUE:
@@ -1168,3 +1241,3 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
icalerror_warn("Comparison not implemented for value type");
- return ICAL_XLICCOMPARETYPE_REGEX+1; /* HACK */
+ return 0;
}
@@ -1174,14 +1247,15 @@ icalvalue_compare(icalvalue* a, icalvalue *b)
-/* Examine the value and possiby chage the kind to agree with the value */
+/** Examine the value and possibly change the kind to agree with the
+ * value
+ */
+
void icalvalue_reset_kind(icalvalue* value)
{
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
-
- if( (impl->kind==ICAL_DATETIME_VALUE || impl->kind==ICAL_DATE_VALUE )&&
- !icaltime_is_null_time(impl->data.v_time) ) {
+ if( (value->kind==ICAL_DATETIME_VALUE || value->kind==ICAL_DATE_VALUE )&&
+ !icaltime_is_null_time(value->data.v_time) ) {
- if( impl->data.v_time.is_date == 1){
- impl->kind = ICAL_DATE_VALUE;
+ if(icaltime_is_date(value->data.v_time)){
+ value->kind = ICAL_DATE_VALUE;
} else {
- impl->kind = ICAL_DATETIME_VALUE;
+ value->kind = ICAL_DATETIME_VALUE;
}
@@ -1194,6 +1268,3 @@ void icalvalue_set_parent(icalvalue* value,
{
- struct icalvalue_impl* v = (struct icalvalue_impl*)value;
-
- v->parent = property;
-
+ value->parent = property;
}
@@ -1202,9 +1273,35 @@ icalproperty* icalvalue_get_parent(icalvalue* value)
{
- struct icalvalue_impl* v = (struct icalvalue_impl*)value;
+ return value->parent;
+}
- return v->parent;
-}
+int icalvalue_encode_ical_string(const char *szText, char *szEncText, int nMaxBufferLen)
+{
+ char *ptr;
+ icalvalue *value = 0;
+
+ if ((szText == 0) || (szEncText == 0))
+ return 0;
+
+ value = icalvalue_new_from_string(ICAL_STRING_VALUE, szText);
+
+ if (value == 0)
+ return 0;
+
+ ptr = icalvalue_text_as_ical_string(value);
+ if (ptr == 0)
+ return 0;
+
+ if ((int)strlen(ptr) >= nMaxBufferLen)
+ {
+ icalvalue_free (value);
+ return 0;
+ }
+ strcpy(szEncText, ptr);
+ icalvalue_free ((icalvalue*)value);
+
+ return 1;
+}
@@ -1212,4 +1309 @@ icalproperty* icalvalue_get_parent(icalvalue* value)
types */
-
-
-/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalvalue.h b/libical/src/libical/icalvalue.h
index 6983c23..851e723 100644
--- a/libical/src/libical/icalvalue.h
+++ b/libical/src/libical/icalvalue.h
@@ -9,4 +9,2 @@
-
-
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -42,3 +40,3 @@
/* Defined in icalderivedvalue.h */
-/*typedef void icalvalue;*/
+/*typedef struct icalvalue_impl icalvalue;*/
@@ -46,3 +44,3 @@ icalvalue* icalvalue_new(icalvalue_kind kind);
-icalvalue* icalvalue_new_clone(icalvalue* value);
+icalvalue* icalvalue_new_clone(const icalvalue* value);
@@ -52,7 +50,7 @@ void icalvalue_free(icalvalue* value);
-int icalvalue_is_valid(icalvalue* value);
+int icalvalue_is_valid(const icalvalue* value);
-const char* icalvalue_as_ical_string(icalvalue* value);
+const char* icalvalue_as_ical_string(const icalvalue* value);
-icalvalue_kind icalvalue_isa(icalvalue* value);
+icalvalue_kind icalvalue_isa(const icalvalue* value);
@@ -60,3 +58,3 @@ int icalvalue_isa_value(void*);
-icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b);
+icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalvalue *b);
@@ -67,3 +65,3 @@ icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
-struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
+struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value);
@@ -71,3 +69,3 @@ icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
-struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
+struct icaltriggertype icalvalue_get_trigger(const icalvalue* value);
@@ -76,3 +74,3 @@ void icalvalue_set_datetimeperiod(icalvalue* value,
struct icaldatetimeperiodtype v);
-struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
+struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value);
@@ -81,4 +79,9 @@ struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
icalvalue_kind icalvalue_string_to_kind(const char* str);
-const char* icalvalue_kind_to_string(icalvalue_kind kind);
+const char* icalvalue_kind_to_string(const icalvalue_kind kind);
+
+/** Check validity of a specific icalvalue_kind **/
+int icalvalue_kind_is_valid(const icalvalue_kind kind);
+/** Encode a character string in ical format, esacpe certain characters, etc. */
+int icalvalue_encode_ical_string(const char *szText, char *szEncText, int MaxBufferLen);
diff --git a/libical/src/libical/icalvalueimpl.h b/libical/src/libical/icalvalueimpl.h
index 116535d..d1ba786 100644
--- a/libical/src/libical/icalvalueimpl.h
+++ b/libical/src/libical/icalvalueimpl.h
@@ -37,2 +37,4 @@
#include "icalenums.h"
+#include "icalproperty.h"
+#include "icalderivedvalue.h"
@@ -45,6 +47,6 @@ struct icalvalue_impl {
icalproperty* parent;
- const char* x_value;
+ char* x_value;
union data {
- struct icalattachtype *v_attach;
+ icalattach *v_attach;
/* void *v_binary; */ /* use v_attach */
diff --git a/libical/src/libical/icalversion.h b/libical/src/libical/icalversion.h
index beae8e0..c4b1d15 100644
--- a/libical/src/libical/icalversion.h
+++ b/libical/src/libical/icalversion.h
@@ -4,3 +4,3 @@
#define ICAL_PACKAGE "libical"
-#define ICAL_VERSION "0.23"
+#define ICAL_VERSION "0.24"
diff --git a/libical/src/libical/libical.pro b/libical/src/libical/libical.pro
index 9cc3983..4ef11ef 100644
--- a/libical/src/libical/libical.pro
+++ b/libical/src/libical/libical.pro
@@ -1,68 +1,68 @@
-include(../../../variables.pri)
-
-TEMPLATE = lib
-
-TARGET = ical
-DESTDIR = ../../lib
-
-win32: DEFINES += _WIN32
+######################################################################
+# Automatically generated by qmake (1.07a) Sun Jun 27 22:44:35 2004
+######################################################################
+TEMPLATE = lib
+INCLUDEPATH += .
CONFIG += staticlib
+DESTDIR = ../../lib
+TARGET = ical
+# Input
+HEADERS += astime.h \
+ ical.h \
+ icalarray.h \
+ icalattach.h \
+ icalattachimpl.h \
+ icalcomponent.h \
+ icalderivedparameter.h \
+ icalderivedproperty.h \
+ icalderivedvalue.h \
+ icalduration.h \
+ icalenums.h \
+ icalerror.h \
+ icallangbind.h \
+ icalmemory.h \
+ icalmime.h \
+ icalparameter.h \
+ icalparameterimpl.h \
+ icalparser.h \
+ icalperiod.h \
+ icalproperty.h \
+ icalrecur.h \
+ icalrestriction.h \
+ icaltime.h \
+ icaltimezone.h \
+ icaltypes.h \
+ icalvalue.h \
+ icalvalueimpl.h \
+ icalversion.h \
+ pvl.h \
+ sspm.h
+SOURCES += caldate.c \
+ icalarray.c \
+ icalattach.c \
+ icalcomponent.c \
+ icalderivedparameter.c \
+ icalderivedproperty.c \
+ icalderivedvalue.c \
+ icalduration.c \
+ icalenums.c \
+ icalerror.c \
+ icallangbind.c \
+ icalmemory.c \
+ icalmime.c \
+ icalparameter.c \
+ icalparser.c \
+ icalperiod.c \
+ icalproperty.c \
+ icalrecur.c \
+ icalrestriction.c \
+ icaltime.c \
+ icaltimezone.c \
+ icaltypes.c \
+ icalvalue.c \
+ pvl.c \
+ sspm.c
-HEADERS = \
- icalattendee.h \
- icalcomponent.h \
- icalderivedparameter.h \
- icalderivedproperty.h \
- icalderivedvalue.h \
- icalduration.h \
- icalenums.h \
- icalerror.h \
- icallangbind.h \
- icalmemory.h \
- icalmime.h \
- icalparameter.h \
- icalparameterimpl.h \
- icalparser.h \
- icalperiod.h \
- icalproperty.h \
- icalrecur.h \
- icalrestriction.h \
- icaltime.h \
- icaltypes.h \
- icalvalue.h \
- icalvalueimpl.h \
- icalversion.h \
- icalyacc.h \
- pvl.h \
- sspm.h
-
-SOURCES = icalattendee.c \
- icalcomponent.c \
- icalderivedparameter.c \
- icalderivedproperty.c \
- icalderivedvalue.c \
- icalduration.c \
- icalenums.c \
- icalerror.c \
- icallangbind.c \
- icallexer.c \
- icalmemory.c \
- icalmime.c \
- icalparameter.c \
- icalparser.c \
- icalperiod.c \
- icalproperty.c \
- icalrecur.c \
- icalrestriction.c \
- icaltime.c \
- icaltypes.c \
- icalvalue.c \
- icalyacc.c \
- pvl.c \
- sspm.c \
- vsnprintf.c
-
-INTERFACES =
-INCLUDEPATH += .
+# vsnprintf.c
diff --git a/libical/src/libical/libicalE.pro b/libical/src/libical/libicalE.pro
index 2b9b720..1c79e18 100644
--- a/libical/src/libical/libicalE.pro
+++ b/libical/src/libical/libicalE.pro
@@ -1,5 +1,8 @@
-TEMPLATE = lib
-CONFIG = warn_on staticlib
+######################################################################
+# Automatically generated by qmake (1.07a) Sun Jun 27 22:44:35 2004
+######################################################################
-INCLUDEPATH += .
+TEMPLATE = lib
+INCLUDEPATH += .
+CONFIG += staticlib
OBJECTS_DIR = obj/$(PLATFORM)
@@ -8,59 +11,60 @@ DESTDIR=../../lib/$(PLATFORM)
TARGET = ical
-INTERFACES = \
+# Input
+HEADERS += astime.h \
+ ical.h \
+ icalarray.h \
+ icalattach.h \
+ icalattachimpl.h \
+ icalcomponent.h \
+ icalderivedparameter.h \
+ icalderivedproperty.h \
+ icalderivedvalue.h \
+ icalduration.h \
+ icalenums.h \
+ icalerror.h \
+ icallangbind.h \
+ icalmemory.h \
+ icalmime.h \
+ icalparameter.h \
+ icalparameterimpl.h \
+ icalparser.h \
+ icalperiod.h \
+ icalproperty.h \
+ icalrecur.h \
+ icalrestriction.h \
+ icaltime.h \
+ icaltimezone.h \
+ icaltypes.h \
+ icalvalue.h \
+ icalvalueimpl.h \
+ icalversion.h \
+ pvl.h \
+ sspm.h
+SOURCES += caldate.c \
+ icalarray.c \
+ icalattach.c \
+ icalcomponent.c \
+ icalderivedparameter.c \
+ icalderivedproperty.c \
+ icalderivedvalue.c \
+ icalduration.c \
+ icalenums.c \
+ icalerror.c \
+ icallangbind.c \
+ icalmemory.c \
+ icalmime.c \
+ icalparameter.c \
+ icalparser.c \
+ icalperiod.c \
+ icalproperty.c \
+ icalrecur.c \
+ icalrestriction.c \
+ icaltime.c \
+ icaltimezone.c \
+ icaltypes.c \
+ icalvalue.c \
+ pvl.c \
+ sspm.c
-HEADERS = \
- ical.h \
- icalattendee.h \
- icalcomponent.h \
- icalderivedparameter.h \
- icalderivedproperty.h \
- icalderivedvalue.h \
- icalduration.h \
- icalenums.h \
- icalerror.h \
- icallangbind.h \
- icalmemory.h \
- icalmime.h \
- icalparameter.h \
- icalparameterimpl.h \
- icalparser.h \
- icalperiod.h \
- icalproperty.h \
- icalrecur.h \
- icalrestriction.h \
- icaltime.h \
- icaltypes.h \
- icalvalue.h \
- icalvalueimpl.h \
- icalversion.h \
- icalyacc.h \
- pvl.h \
- sspm.h \
-
-SOURCES = \
- icalattendee.c \
- icalcomponent.c \
- icalderivedparameter.c \
- icalderivedproperty.c \
- icalderivedvalue.c \
- icalduration.c \
- icalenums.c \
- icalerror.c \
- icallangbind.c \
- icallexer.c \
- icalmemory.c \
- icalmime.c \
- icalparameter.c \
- icalparser.c \
- icalperiod.c \
- icalproperty.c \
- icalrecur.c \
- icalrestriction.c \
- icaltime.c \
- icaltypes.c \
- icalvalue.c \
- icalyacc.c \
- pvl.c \
- sspm.c \
- vsnprintf.c \
+# vsnprintf.c
diff --git a/libical/src/libical/pvl.c b/libical/src/libical/pvl.c
index 2a733e8..9c271ce 100644
--- a/libical/src/libical/pvl.c
+++ b/libical/src/libical/pvl.c
@@ -17,5 +17,3 @@
-
-
-/*
+/**
struct pvl_list_t
@@ -30,7 +28,7 @@ typedef struct pvl_list_t
{
- int MAGIC; /* Magic Identifier */
- struct pvl_elem_t *head; /* Head of list */
- struct pvl_elem_t *tail; /* Tail of list */
- int count; /* Number of items in the list */
- struct pvl_elem_t *p; /* Pointer used for iterators */
+ int MAGIC; /**< Magic Identifier */
+ struct pvl_elem_t *head; /**< Head of list */
+ struct pvl_elem_t *tail; /**< Tail of list */
+ int count; /**< Number of items in the list */
+ struct pvl_elem_t *p; /**< Pointer used for iterators */
} pvl_list_t;
@@ -40,4 +38,6 @@ typedef struct pvl_list_t
-/* This global is incremented for each call to pvl_new_element(); it gives each
- * list a unique identifer */
+/**
+ * This global is incremented for each call to pvl_new_element(); it gives each
+ * list a unique identifer
+ */
@@ -47,14 +47,7 @@ int pvl_list_count = 0;
-/*----------------------------------------------------------------------
- Function: pvl_list pvl_newlist()
-
- Purpose:
-
- Creates a new list, clears the pointers and assigns a magic number
-
- Returns:
-
- Pointer to the new list
- 0 if there is no available memory.
- *----------------------------------------------------------------------*/
+/**
+ * @brief Creates a new list, clears the pointers and assigns a magic number
+ *
+ * @return Pointer to the new list, 0 if there is no available memory.
+ */
@@ -91,28 +84,19 @@ pvl_free(pvl_list l)
-/*----------------------------------------------------------------------
- Function: pvl_new_element(void *d, struct pvl_elem_t *next,struct pvl_elem_t *prior)
-
- Purpose:
- Creates a new list element, assigns a magic number, and assigns
- the next and previous pointers.
-
- Passing in the next and previous points may seem odd, but it allos the user
- to set them while keeping the internal data hidden. In nearly all cases,
- the user is the pvl library itself.
-
- Parameters:
-
- d The data item to be stored in the list
- next Pointer value to assign to the member "next"
- prior Pointer value to assign to the member "prior"
-
- Returns:
-
- A pointer to the new element.
- 0 if there is no memory available.
-
- *----------------------------------------------------------------------*/
+/**
+ * @brief Creates a new list element, assigns a magic number, and assigns
+ * the next and previous pointers.
+ *
+ * Passing in the next and previous points may seem odd, but it allos the user
+ * to set them while keeping the internal data hidden. In nearly all cases,
+ * the user is the pvl library itself.
+ *
+ * @param d The data item to be stored in the list
+ * @param next Pointer value to assign to the member "next"
+ * @param prior Pointer value to assign to the member "prior"
+ *
+ * @return A pointer to the new element, 0 if there is no memory available.
+ */
pvl_elem
-pvl_new_element(void *d, pvl_elem next,pvl_elem prior)
+pvl_new_element(void *d, pvl_elem next, pvl_elem prior)
{
@@ -134,21 +118,12 @@ pvl_new_element(void *d, pvl_elem next,pvl_elem prior)
-/*----------------------------------------------------------------------
- Function: pvl_unshift(pvl_list l,void *d)
-
- Purpose:
-
- Add a new element to the from of the list
-
- Parameters:
-
- l The list to add the item to
- d Pointer to the item to add
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Add a new element to the from of the list
+ *
+ * @param L The list to add the item to
+ * @param d Pointer to the item to add
+ */
void
-pvl_unshift(pvl_list l,void *d)
+pvl_unshift(pvl_list L,void *d)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
struct pvl_elem_t *E = pvl_new_element(d,L->head,0);
@@ -174,21 +149,13 @@ pvl_unshift(pvl_list l,void *d)
-/*----------------------------------------------------------------------
- Function: pvl_shift(pvl_list l)
-
- Purpose:
-
- Remove an element from the front of the list
-
- Parameters:
-
- l The list to operate on
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Remove an element from the front of the list
+ *
+ * @param L The list to operate on
+ *
+ * @return the entry on the front of the list
+ */
void*
-pvl_shift(pvl_list l)
+pvl_shift(pvl_list L)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
-
if (L->head == 0)
@@ -198,3 +165,3 @@ pvl_shift(pvl_list l)
- return pvl_remove(l,(void*)L->head);
+ return pvl_remove(L,(void*)L->head);
@@ -202,21 +169,13 @@ pvl_shift(pvl_list l)
-/*----------------------------------------------------------------------
- Function: void pvl_push(pvl_list l,void *d)
-
- Purpose:
-
- Add a new item to the tail of the list
-
- Paramters:
-
- l The list to operate on
- d Pointer to the item to add
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Add a new item to the tail of the list
+ *
+ * @param L The list to operate on
+ * @param d Pointer to the item to add
+ *
+ */
void
-pvl_push(pvl_list l,void *d)
+pvl_push(pvl_list L,void *d)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
struct pvl_elem_t *E = pvl_new_element(d,0,L->tail);
@@ -244,22 +203,11 @@ pvl_push(pvl_list l,void *d)
-/*----------------------------------------------------------------------
- Function: void* pvl_pop(pvl_list l)
-
- Purpose:
-
- Remove an element from the tail of the list
-
- Paramters:
-
- l The list to operate on
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Remove an element from the tail of the list
+ *
+ * @param L The list to operate on
+ */
void*
-pvl_pop(pvl_list l)
+pvl_pop(pvl_list L)
{
-
- struct pvl_list_t *L = (struct pvl_list_t *)l;
-
if ( L->tail == 0)
@@ -269,3 +217,3 @@ pvl_pop(pvl_list l)
- return pvl_remove(l,(void*) L->tail);;
+ return pvl_remove(L,(void*) L->tail);;
@@ -274,25 +222,14 @@ pvl_pop(pvl_list l)
-/*----------------------------------------------------------------------
- Function: void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
-
- Purpose:
-
- Add a new item to a list that is ordered by a comparison function.
- This routine assumes that the list is properly ordered.
-
- l The list to operate on
- f Pointer to a comparison function
- d Pointer to data to pass to the comparison function
-
- Returns:
-
- void
-
- *----------------------------------------------------------------------*/
+/**
+ * Add a new item to a list that is ordered by a comparison function.
+ * This routine assumes that the list is properly ordered.
+ *
+ * @param L The list to operate on
+ * @param f Pointer to a comparison function
+ * @param d Pointer to data to pass to the comparison function
+ */
void
-pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
+pvl_insert_ordered(pvl_list L,pvl_comparef f,void *d)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
-
struct pvl_elem_t *P;
@@ -305,3 +242,3 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
{
- pvl_unshift(l,d);
+ pvl_unshift(L,d);
return;
@@ -313,3 +250,3 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
{
- pvl_unshift(l,d);
+ pvl_unshift(L,d);
return;
@@ -320,3 +257,3 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
{
- pvl_push(l,d);
+ pvl_push(L,d);
return;
@@ -331,3 +268,3 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
{
- pvl_insert_before(l,P,d);
+ pvl_insert_before(L,P,d);
return;
@@ -337,31 +274,17 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
/* badness, choke */
-
+#ifndef lint
assert(0);
-
+#endif
}
-/*----------------------------------------------------------------------
- Function: void pvl_insert_after(pvl_list l,pvl_elem p,void *d)
-
- Purpose:
-
- Add a new item after the referenced element.
-
- Parameters:
-
- l The list to operate on
- p The list element to add the item after
- d Pointer to the item to add.
-
- Returns:
-
- void
-
- *----------------------------------------------------------------------*/
+/**
+ * @brief Add a new item after the referenced element.
+ * @param L The list to operate on
+ * @param P The list element to add the item after
+ * @param d Pointer to the item to add.
+ */
void
-pvl_insert_after(pvl_list l,pvl_elem p,void *d)
+pvl_insert_after(pvl_list L,pvl_elem P,void *d)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
- struct pvl_elem_t *P = (struct pvl_elem_t *)p;
struct pvl_elem_t *E = 0;
@@ -372,3 +295,3 @@ pvl_insert_after(pvl_list l,pvl_elem p,void *d)
{
- pvl_unshift(l,d);
+ pvl_unshift(L,d);
return;
@@ -390,23 +313,13 @@ pvl_insert_after(pvl_list l,pvl_elem p,void *d)
-/*----------------------------------------------------------------------
- Function: void pvl_insert_before(pvl_list l,pvl_elem p,void *d)
-
- Purpose:
-
- Add an item after a referenced item
-
- Parameters:
-
- l The list to operate on
- p The list element to add the item before
- d Pointer to the data to be added.
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Add an item after a referenced item
+ *
+ * @param L The list to operate on
+ * @param P The list element to add the item before
+ * @param d Pointer to the data to be added.
+ */
void
-pvl_insert_before(pvl_list l,pvl_elem p,void *d)
+pvl_insert_before(pvl_list L,pvl_elem P,void *d)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
- struct pvl_elem_t *P = (struct pvl_elem_t *)p;
struct pvl_elem_t *E = 0;
@@ -417,3 +330,3 @@ pvl_insert_before(pvl_list l,pvl_elem p,void *d)
{
- pvl_unshift(l,d);
+ pvl_unshift(L,d);
return;
@@ -435,25 +348,15 @@ pvl_insert_before(pvl_list l,pvl_elem p,void *d)
-/*----------------------------------------------------------------------
- Function: void pvl_remove(pvl_list l,pvl_elem e)
-
- Purpose:
-
- Remove the referenced item from the list
-
- This routine will free the element, but not the data item that the
- element contains.
-
- Parameters:
-
- l The list to operate on
- e The element to remove.
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Remove the referenced item from the list.
+ *
+ * This routine will free the element, but not the data item that the
+ * element contains.
+ *
+ * @param L The list to operate on
+ * @param E The element to remove.
+ */
void*
-pvl_remove(pvl_list l,pvl_elem e)
+pvl_remove(pvl_list L,pvl_elem E)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
- struct pvl_elem_t *E = (struct pvl_elem_t *)e;
void* data;
@@ -506,24 +409,15 @@ pvl_remove(pvl_list l,pvl_elem e)
-/*----------------------------------------------------------------------
- Function: pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v)
-
- Purpose:
-
- Return a pointer to data that satisfies a function
-
- This routine will interate through the entire list and call the
- find function for each item. It will break and return a pointer to the
- data that causes the find function to return 1.
-
- Parameters:
-
- l The list to operate on
- f Pointer to the find function
- v Pointer to constant data to pass into the function
-
- Returns:
-
- Pointer to the element that the find function found.
-
- *----------------------------------------------------------------------*/
+/**
+ * @brief Return a pointer to data that satisfies a function.
+ *
+ * This routine will interate through the entire list and call the
+ * find function for each item. It will break and return a pointer to the
+ * data that causes the find function to return 1.
+ *
+ * @param l The list to operate on
+ * @param f Pointer to the find function
+ * @param v Pointer to constant data to pass into the function
+ *
+ * @return Pointer to the element that the find function found.
+ */
@@ -547,21 +441,13 @@ pvl_find(pvl_list l,pvl_findf f,void* v)
}
-/*----------------------------------------------------------------------
- Function: void* pvl_find_next(pvl_list l,pvl_findf f,void* v)
-
- Purpose:
-
- Like pvl_find(), but continues the search where the last find() or
- find_next() left off
- Parameters:
-
- l The list to operate on
- f Pointer to the find function
- v Pointer to constant data to pass into the function
-
- Returns:
-
- Pointer to the element that the find function found.
-
- *----------------------------------------------------------------------*/
+/**
+ * @brief Like pvl_find(), but continues the search where the last find() or
+ * find_next() left off.
+ *
+ * @param l The list to operate on
+ * @param f Pointer to the find function
+ * @param v Pointer to constant data to pass into the function
+ *
+ * @return Pointer to the element that the find function found.
+ */
@@ -587,13 +473,6 @@ pvl_find_next(pvl_list l,pvl_findf f,void* v)
-/*----------------------------------------------------------------------
- Function: void pvl_clear(pvl_list l)
-
- Purpose:
-
- Remove the all the elements in the list. The does not free the data items
- the elements hold.
-
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Remove the all the elements in the list. The does not free
+ * the data items the elements hold.
+ */
@@ -617,17 +496,10 @@ pvl_clear(pvl_list l)
-/*----------------------------------------------------------------------
- Function: int pvl_count(pvl_list l)
-
- Purpose:
-
- Returns the number of items in the list.
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Returns the number of items in the list.
+ */
int
-pvl_count(pvl_list l)
+pvl_count(pvl_list L)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
-
return L->count;
@@ -636,16 +508,9 @@ pvl_count(pvl_list l)
-/*----------------------------------------------------------------------
- Function: pvl_elem pvl_next(pvl_elem e)
-
- Purpose:
- Returns a pointer to the given element
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Returns a pointer to the given element
+ */
pvl_elem
-pvl_next(pvl_elem e)
+pvl_next(pvl_elem E)
{
- struct pvl_elem_t *E = (struct pvl_elem_t *)e;
-
if (E == 0){
@@ -657,17 +522,10 @@ pvl_next(pvl_elem e)
-/*----------------------------------------------------------------------
- Function: pvl_elem pvl_prior(pvl_elem e)
- Purpose:
-
- Returns a pointer to the element previous to the element given.
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Returns a pointer to the element previous to the element given.
+ */
pvl_elem
-pvl_prior(pvl_elem e)
+pvl_prior(pvl_elem E)
{
- struct pvl_elem_t *E = (struct pvl_elem_t *)e;
-
return (pvl_elem)E->prior;
@@ -675,16 +533,10 @@ pvl_prior(pvl_elem e)
-/*----------------------------------------------------------------------
- Function: pvl_elem pvl_head(pvl_list l )
-
- Purpose:
-
- Returns a pointer to the first item in the list.
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Returns a pointer to the first item in the list.
+ */
+
pvl_elem
-pvl_head(pvl_list l )
+pvl_head(pvl_list L )
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
-
return (pvl_elem)L->head;
@@ -692,15 +544,8 @@ pvl_head(pvl_list l )
-/*----------------------------------------------------------------------
- Function: pvl_elem pvl_tail(pvl_list l)
-
- Purpose:
-
- Returns a pointer to the last item in the list.
-
- Returns:
- *----------------------------------------------------------------------*/
+/**
+ * @brief Returns a pointer to the last item in the list.
+ */
pvl_elem
-pvl_tail(pvl_list l)
+pvl_tail(pvl_list L)
{
- struct pvl_list_t *L = (struct pvl_list_t *)l;
return (pvl_elem)L->tail;
@@ -708,19 +553,7 @@ pvl_tail(pvl_list l)
-/*----------------------------------------------------------------------
- Function:
-
-
- Purpose:
-
-
- Returns:
- *----------------------------------------------------------------------*/
-
#ifndef PVL_USE_MACROS
void*
-pvl_data(pvl_elem e)
+pvl_data(pvl_elem E)
{
- struct pvl_elem_t *E = (struct pvl_elem_t *)e;
-
- if ( e == 0){
+ if ( E == 0){
return 0;
@@ -732,19 +565,9 @@ pvl_data(pvl_elem e)
-/*----------------------------------------------------------------------
- Function: void pvl_apply(pvl_list l,pvl_applyf f, void *v)
-
- Purpose:
-
- Call a function for every item in the list.
-
- Paramters:
-
- l The list to operate on
- f Pointer to the function to call
- v Data to pass to the function on every iteration
-
- Returns:
-
- void
- *----------------------------------------------------------------------*/
+/**
+ * @brief Call a function for every item in the list.
+ *
+ * @param l The list to operate on
+ * @param f Pointer to the function to call
+ * @param v Data to pass to the function on every iteration
+ */
diff --git a/libical/src/libical/pvl.h b/libical/src/libical/pvl.h
index 14a15a1..92ec546 100644
--- a/libical/src/libical/pvl.h
+++ b/libical/src/libical/pvl.h
@@ -12,19 +12,17 @@
-typedef void* pvl_list;
-typedef void* pvl_elem;
+typedef struct pvl_list_t* pvl_list;
+typedef struct pvl_elem_t* pvl_elem;
-/*
- struct pvl_elem_t
+/**
+ * This type is private. Always use pvl_elem instead. The struct would
+ * not even appear in this header except to make code in the USE_MACROS
+ * blocks work
+ */
- This type is private. Always use pvl_elem instead. The struct would
- not even appear in this header except to make code in the USE_MACROS
- blocks work
-
- */
typedef struct pvl_elem_t
{
- int MAGIC; /* Magic Identifier */
- void *d; /* Pointer to data user is storing */
- struct pvl_elem_t *next; /* Next element */
- struct pvl_elem_t *prior; /* prior element */
+ int MAGIC; /**< Magic Identifier */
+ void *d; /**< Pointer to data user is storing */
+ struct pvl_elem_t *next; /**< Next element */
+ struct pvl_elem_t *prior; /**< Prior element */
} pvl_elem_t;
@@ -33,4 +31,6 @@ typedef struct pvl_elem_t
-/* This global is incremented for each call to pvl_new_element(); it gives each
- * list a unique identifer */
+/**
+ * This global is incremented for each call to pvl_new_element(); it gives each
+ * list a unique identifer
+ */
@@ -83,4 +83,7 @@ pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v);
-/* Pass each element in the list to a function */
-typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/
+/**
+ * Pass each element in the list to a function
+ * a is list elem, b is other data
+ */
+typedef void (*pvl_applyf)(void* a, void* b);
void pvl_apply(pvl_list l,pvl_applyf f, void *v);
diff --git a/libical/src/libical/sspm.c b/libical/src/libical/sspm.c
index 2df581b..17f12ee 100644
--- a/libical/src/libical/sspm.c
+++ b/libical/src/libical/sspm.c
@@ -43,10 +43,2 @@
-// Eugen C. <eug@thekompany.com>
-#ifdef _WIN32
-#define strcasecmp _stricmp
-#endif
-// Eugen C. <eug@thekompany.com>
-
-int snprintf(char *str, size_t n, char const *fmt, ...);
-
#ifdef DMALLOC
@@ -55,2 +47,7 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
+
#define TMP_BUF_SIZE 1024
@@ -95,3 +92,3 @@ char* sspm_strdup(char* str){
-struct major_content_type_map
+static struct major_content_type_map
{
@@ -114,3 +111,3 @@ struct major_content_type_map
-struct minor_content_type_map
+static struct minor_content_type_map
{
@@ -243,3 +240,3 @@ char* sspm_value(char* line)
-char *mime_headers[] = {
+static char *mime_headers[] = {
"Content-Type",
@@ -368,3 +365,3 @@ enum line_type {
-enum line_type get_line_type(char* line){
+static enum line_type get_line_type(char* line){
@@ -392,3 +389,3 @@ enum line_type get_line_type(char* line){
-struct sspm_action_map get_action(struct mime_impl *impl,
+static struct sspm_action_map get_action(struct mime_impl *impl,
enum sspm_major_type major,
diff --git a/libical/src/libical/vsnprintf.c b/libical/src/libical/vsnprintf.c
index 88a8c63..982920b 100644
--- a/libical/src/libical/vsnprintf.c
+++ b/libical/src/libical/vsnprintf.c
@@ -1,2 +1,5 @@
-#ifdef __osf__
+#ifndef WIN32
+#include "config.h"
+#endif
+#ifndef HAVE_SNPRINTF
/*
@@ -27,10 +30,10 @@
-#include <sys/types.h>
-#include <stdio.h>
-
-#include <unistd.h>
+#ifndef WIN32
#include <sys/param.h>
#include <sys/mman.h>
+#include <unistd.h>
+#endif
+#include <sys/types.h>
#include <signal.h>
-
+#include <stdio.h>
#include <string.h>
@@ -159,16 +162,5 @@ snprintf(str, n, fmt, va_alist)
-#elif defined ( _WIN32 )
-
-#include <stdio.h>
-#include <stdarg.h>
-
-int snprintf(char *str, size_t n, char const *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
-
- return _snprintf(str, n, fmt, ap);
-}
#else
+
/* ANSI C forbids an empty source file... */