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 @@ | |||
1 | /* | ||
2 | *Copyright (c) 1986-2000, Hiram Clawson | ||
3 | *All rights reserved. | ||
4 | * | ||
5 | *Redistribution and use in source and binary forms, with or | ||
6 | *without modification, are permitted provided that the following | ||
7 | *conditions are met: | ||
8 | * | ||
9 | * Redistributions of source code must retain the above | ||
10 | * copyright notice, this list of conditions and the | ||
11 | * following disclaimer. | ||
12 | * | ||
13 | * Redistributions in binary form must reproduce the | ||
14 | * above copyright notice, this list of conditions and | ||
15 | * the following disclaimer in the documentation and/or | ||
16 | * other materials provided with the distribution. | ||
17 | * | ||
18 | * Neither name of The Museum of Hiram nor the names of | ||
19 | * its contributors may be used to endorse or promote products | ||
20 | * derived from this software without specific prior | ||
21 | * written permission. | ||
22 | * | ||
23 | *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
24 | *CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
25 | *INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
26 | *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
27 | *IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
28 | *INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
29 | *(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
30 | *OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
31 | *HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
32 | *STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
33 | *IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
34 | *THE POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | /** | ||
38 | *@file astime.h | ||
39 | * @brief contains definitions of structures used for time calculations. | ||
40 | */ | ||
41 | |||
42 | #ifndef_astime_h_ | ||
43 | #define _astime_h_ | ||
44 | |||
45 | typedef struct ut_instant { | ||
46 | doublej_date; /**< julian decimal date, 0 = 01 Jan 4713 BC 12 HR UT */ | ||
47 | long year; /**< year, valid range [-4,713, +2,147,483,647] */ | ||
48 | int month; /**< [1-12]*/ | ||
49 | int day; /**< [1-31]*/ | ||
50 | int i_hour; /**< [0-23]*/ | ||
51 | int i_minute; /**< [0-59]*/ | ||
52 | int i_second; /**< [0-59]*/ | ||
53 | double d_hour; /**< [0.0-23.9999] includes minute and second */ | ||
54 | double d_minute; /**< [0.0-59.9999] includes second*/ | ||
55 | double d_second; /**< [0.0-59.9999]*/ | ||
56 | int weekday; /**< [0-6]*/ | ||
57 | int day_of_year; /**< [1-366]*/ | ||
58 | } UTinstant, * UTinstantPtr; | ||
59 | |||
60 | /* Functions in caldate.c*/ | ||
61 | |||
62 | long caldat( UTinstantPtr );/** converts julian date to year,mo,da */ | ||
63 | double juldat( UTinstantPtr );/** returns julian day from year,mo,da */ | ||
64 | |||
65 | #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 @@ | |||
1 | /* | ||
2 | *Copyright (c) 1986-2000, Hiram Clawson | ||
3 | *All rights reserved. | ||
4 | * | ||
5 | *Redistribution and use in source and binary forms, with or | ||
6 | *without modification, are permitted provided that the following | ||
7 | *conditions are met: | ||
8 | * | ||
9 | * Redistributions of source code must retain the above | ||
10 | * copyright notice, this list of conditions and the | ||
11 | * following disclaimer. | ||
12 | * | ||
13 | * Redistributions in binary form must reproduce the | ||
14 | * above copyright notice, this list of conditions and | ||
15 | * the following disclaimer in the documentation and/or | ||
16 | * other materials provided with the distribution. | ||
17 | * | ||
18 | * Neither name of The Museum of Hiram nor the names of | ||
19 | * its contributors may be used to endorse or promote products | ||
20 | * derived from this software without specific prior | ||
21 | * written permission. | ||
22 | * | ||
23 | *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
24 | *CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
25 | *INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
26 | *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
27 | *IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
28 | *INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
29 | *(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
30 | *OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
31 | *HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
32 | *STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
33 | *IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
34 | *THE POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #include "astime.h" /* time structures*/ | ||
38 | |||
39 | /** | ||
40 | *caldat computes the day of the week, the day of the year | ||
41 | *the gregorian (or julian) calendar date and the universal | ||
42 | *time from the julian decimal date. | ||
43 | *for astronomical purposes, The Gregorian calendar reform occurred | ||
44 | *on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar. | ||
45 | |||
46 | * Input:a ut_instant structure pointer, where the j_date element | ||
47 | * has been set. ( = 0 for 01 Jan 4713 B.C. 12 HR UT ) | ||
48 | * | ||
49 | *output: will set all the other elements of the structure. | ||
50 | * As a convienence, the function will also return the year. | ||
51 | * | ||
52 | *Reference: Astronomial formulae for calculators, meeus, p 23 | ||
53 | *from fortran program by F. Espenak - April 1982 Page 277, | ||
54 | *50 Year canon of solar eclipses: 1986-2035 | ||
55 | * | ||
56 | */ | ||
57 | |||
58 | long caldat( date ) | ||
59 | struct ut_instant * date; | ||
60 | { | ||
61 | double frac; | ||
62 | long jd; | ||
63 | long ka; | ||
64 | long kb; | ||
65 | long kc; | ||
66 | long kd; | ||
67 | long ke; | ||
68 | long ialp; | ||
69 | |||
70 | jd = (long) (date->j_date + 0.5);/* integer julian date */ | ||
71 | frac = date->j_date + 0.5 - (double) jd + 1.0e-10; /* day fraction */ | ||
72 | ka = (long) jd; | ||
73 | if ( jd >= 2299161L ) | ||
74 | { | ||
75 | ialp = ( (double) jd - 1867216.25 ) / ( 36524.25 ); | ||
76 | ka = jd + 1L + ialp - ( ialp >> 2 ); | ||
77 | } | ||
78 | kb = ka + 1524L; | ||
79 | kc = ( (double) kb - 122.1 ) / 365.25; | ||
80 | kd = (double) kc * 365.25; | ||
81 | ke = (double) ( kb - kd ) / 30.6001; | ||
82 | date->day = kb - kd - ((long) ( (double) ke * 30.6001 )); | ||
83 | if ( ke > 13L ) | ||
84 | date->month = ke - 13L; | ||
85 | else | ||
86 | date->month = ke - 1L; | ||
87 | if ( (date->month == 2) && (date->day > 28) ) | ||
88 | date->day = 29; | ||
89 | if ( (date->month == 2) && (date->day == 29) && (ke == 3L) ) | ||
90 | date->year = kc - 4716L; | ||
91 | else if ( date->month > 2 ) | ||
92 | date->year = kc - 4716L; | ||
93 | else | ||
94 | date->year = kc - 4715L; | ||
95 | date->i_hour = date->d_hour = frac * 24.0;/* hour */ | ||
96 | date->i_minute = date->d_minute = | ||
97 | ( date->d_hour - (double) date->i_hour ) * 60.0; /* minute */ | ||
98 | date->i_second = date->d_second = | ||
99 | ( date->d_minute - (double) date->i_minute ) * 60.0;/* second */ | ||
100 | date->weekday = (jd + 1L) % 7L;/* day of week */ | ||
101 | if ( date->year == ((date->year >> 2) << 2) ) | ||
102 | date->day_of_year = | ||
103 | ( ( 275 * date->month ) / 9) | ||
104 | - ((date->month + 9) / 12) | ||
105 | + date->day - 30; | ||
106 | else | ||
107 | date->day_of_year = | ||
108 | ( ( 275 * date->month ) / 9) | ||
109 | - (((date->month + 9) / 12) << 1) | ||
110 | + date->day - 30; | ||
111 | return( date->year ); | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | *juldat computes the julian decimal date (j_date) from | ||
116 | *the gregorian (or Julian) calendar date. | ||
117 | *for astronomical purposes, The Gregorian calendar reform occurred | ||
118 | *on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar. | ||
119 | *Input: a ut_instant structure pointer where Day, Month, Year and | ||
120 | * i_hour, i_minute, d_second have been set for the date | ||
121 | * in question. | ||
122 | * | ||
123 | *Output: the j_date and weekday elements of the structure will be set. | ||
124 | * Also, the return value of the function will be the j_date too. | ||
125 | * | ||
126 | *Reference: Astronomial formulae for calculators, meeus, p 23 | ||
127 | *from fortran program by F. Espenak - April 1982 Page 276, | ||
128 | *50 Year canon of solar eclipses: 1986-2035 | ||
129 | */ | ||
130 | |||
131 | double juldat( date ) | ||
132 | struct ut_instant * date; | ||
133 | { | ||
134 | double frac, gyr; | ||
135 | long iy0, im0; | ||
136 | long ia, ib; | ||
137 | long jd; | ||
138 | |||
139 | /* decimal day fraction*/ | ||
140 | frac = (( double)date->i_hour/ 24.0) | ||
141 | + ((double) date->i_minute / 1440.0) | ||
142 | + (date->d_second / 86400.0); | ||
143 | /* convert date to format YYYY.MMDDdd*/ | ||
144 | gyr = (double) date->year | ||
145 | + (0.01 * (double) date->month) | ||
146 | + (0.0001 * (double) date->day) | ||
147 | + (0.0001 * frac) + 1.0e-9; | ||
148 | /* conversion factors */ | ||
149 | if ( date->month <= 2 ) | ||
150 | { | ||
151 | iy0 = date->year - 1L; | ||
152 | im0 = date->month + 12; | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | iy0 = date->year; | ||
157 | im0 = date->month; | ||
158 | } | ||
159 | ia = iy0 / 100L; | ||
160 | ib = 2L - ia + (ia >> 2); | ||
161 | /* calculate julian date*/ | ||
162 | if ( date->year < 0L ) | ||
163 | jd = (long) ((365.25 * (double) iy0) - 0.75) | ||
164 | + (long) (30.6001 * (im0 + 1L) ) | ||
165 | + (long) date->day + 1720994L; | ||
166 | else | ||
167 | jd = (long) (365.25 * (double) iy0) | ||
168 | + (long) (30.6001 * (double) (im0 + 1L)) | ||
169 | + (long) date->day + 1720994L; | ||
170 | if ( gyr >= 1582.1015 ) /* on or after 15 October 1582*/ | ||
171 | jd += ib; | ||
172 | date->j_date = (double) jd + frac + 0.5; | ||
173 | jd = (long) (date->j_date + 0.5); | ||
174 | date->weekday = (jd + 1L) % 7L; | ||
175 | return( date->j_date ); | ||
176 | } /* 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,8 +1,129 @@ | |||
1 | #ifdef __cplusplus | ||
2 | extern "C" { | ||
3 | #endif | ||
4 | /* | ||
5 | $Id$ | ||
6 | */ | ||
7 | /* config.h. Generated by configure. */ | ||
8 | /* config.h.in. Generated from configure.in by autoheader. */ | ||
9 | |||
10 | /* Define to 1 if you have the <assert.h> header file. */ | ||
11 | #define HAVE_ASSERT_H 1 | ||
12 | |||
13 | /* Define to 1 if you have the `gmtime_r' function. */ | ||
14 | #define HAVE_GMTIME_R 1 | ||
15 | |||
16 | /* Define to 1 if you have the <inttypes.h> header file. */ | ||
17 | #define HAVE_INTTYPES_H 1 | ||
18 | |||
19 | /* Define to 1 if you have the `iswspace' function. */ | ||
20 | #define HAVE_ISWSPACE 1 | ||
21 | |||
22 | /* Define to 1 if you have the <memory.h> header file. */ | ||
23 | #define HAVE_MEMORY_H 1 | ||
24 | |||
25 | /* Define if we have pthread. */ | ||
26 | #define HAVE_PTHREAD | ||
27 | |||
28 | /* Define to 1 if you have the <pthread.h> header file. */ | ||
29 | #define HAVE_PTHREAD_H 1 | ||
30 | |||
31 | /* Define to 1 if you have the `snprintf' function. */ | ||
32 | #define HAVE_SNPRINTF 1 | ||
33 | |||
34 | /* Define to 1 if you have the <stdint.h> header file. */ | ||
35 | #define HAVE_STDINT_H 1 | ||
36 | |||
37 | /* Define to 1 if you have the <stdlib.h> header file. */ | ||
38 | #define HAVE_STDLIB_H 1 | ||
39 | |||
40 | /* Define to 1 if you have the `strdup' function. */ | ||
41 | #define HAVE_STRDUP 1 | ||
42 | |||
43 | /* Define to 1 if you have the <strings.h> header file. */ | ||
44 | #define HAVE_STRINGS_H 1 | ||
45 | |||
46 | /* Define to 1 if you have the <string.h> header file. */ | ||
47 | #define HAVE_STRING_H 1 | ||
48 | |||
49 | /* Define to 1 if you have the <sys/stat.h> header file. */ | ||
50 | #define HAVE_SYS_STAT_H 1 | ||
51 | |||
52 | /* Define to 1 if you have the <sys/types.h> header file. */ | ||
53 | #define HAVE_SYS_TYPES_H 1 | ||
54 | |||
55 | /* Define to 1 if you have the <time.h> header file. */ | ||
56 | #define HAVE_TIME_H 1 | ||
57 | |||
58 | /* Define to 1 if you have the <unistd.h> header file. */ | ||
59 | #define HAVE_UNISTD_H 1 | ||
60 | |||
61 | /* Define to 1 if you have the <wctype.h> header file. */ | ||
62 | #define HAVE_WCTYPE_H 1 | ||
63 | |||
64 | /* Define to make icalerror_* calls abort instead of internally signalling an | ||
65 | error */ | ||
66 | #define ICAL_ERRORS_ARE_FATAL 1 | ||
67 | |||
68 | /* Define if we want _REENTRANT */ | ||
69 | /* #undef ICAL_REENTRANT */ | ||
70 | |||
71 | /* Define to terminate lines with " | ||
72 | " instead of " | ||
73 | " */ | ||
74 | #define ICAL_UNIX_NEWLINE 1 | ||
75 | |||
76 | /* Define to 1 if you DO NOT WANT to see deprecated messages */ | ||
77 | #define NO_WARN_DEPRECATED 1 | ||
78 | |||
79 | /* Define to 1 if you DO NO WANT to see the warning messages related to | ||
80 | ICAL_MALFORMEDDATA_ERROR and parsing .ics zoneinfo files */ | ||
81 | #define NO_WARN_ICAL_MALFORMEDDATA_ERROR_HACK 1 | ||
82 | |||
83 | /* Name of package */ | ||
84 | #define PACKAGE "libical" | ||
85 | |||
86 | /* Define to the address where bug reports for this package should be sent. */ | ||
87 | #define PACKAGE_BUGREPORT "" | ||
88 | |||
89 | /* Define to the full name of this package. */ | ||
90 | #define PACKAGE_NAME "" | ||
91 | |||
92 | /* Define to the full name and version of this package. */ | ||
93 | #define PACKAGE_STRING "" | ||
94 | |||
95 | /* Define to the one symbol short name of this package. */ | ||
96 | #define PACKAGE_TARNAME "" | ||
97 | |||
98 | /* Define to the version of this package. */ | ||
99 | #define PACKAGE_VERSION "" | ||
100 | |||
101 | /* Define to 1 if you have the ANSI C header files. */ | ||
102 | #define STDC_HEADERS 1 | ||
103 | |||
104 | /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | ||
105 | /* #undef TM_IN_SYS_TIME */ | ||
106 | |||
107 | /* Version number of package */ | ||
108 | #define VERSION "0.24" | ||
109 | |||
110 | /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a | ||
111 | `char[]'. */ | ||
112 | #define YYTEXT_POINTER 1 | ||
113 | |||
114 | /* Define to empty if `const' does not conform to ANSI C. */ | ||
115 | /* #undef const */ | ||
116 | |||
117 | /* Define to `int' if <sys/types.h> does not define. */ | ||
118 | /* #undef mode_t */ | ||
119 | |||
120 | /* Define to `unsigned' if <sys/types.h> does not define. */ | ||
121 | /* #undef size_t */ | ||
1 | #ifndef ICAL_VERSION_H | 122 | #ifndef ICAL_VERSION_H |
2 | #define ICAL_VERSION_H | 123 | #define ICAL_VERSION_H |
3 | 124 | ||
4 | #define ICAL_PACKAGE "libical" | 125 | #define ICAL_PACKAGE "libical" |
5 | #define ICAL_VERSION "0.23" | 126 | #define ICAL_VERSION "0.24" |
6 | 127 | ||
7 | #endif | 128 | #endif |
8 | /* -*- Mode: C -*- */ | 129 | /* -*- Mode: C -*- */ |
@@ -11,8 +132,6 @@ | |||
11 | CREATOR: eric 02 June 2000 | 132 | CREATOR: eric 02 June 2000 |
12 | 133 | ||
13 | 134 | ||
14 | $Id$ | ||
15 | $Locker$ | ||
16 | 135 | ||
17 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 136 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
18 | 137 | ||
@@ -33,121 +152,249 @@ | |||
33 | 152 | ||
34 | ======================================================================*/ | 153 | ======================================================================*/ |
35 | 154 | ||
155 | /**@file icaltime.h | ||
156 | *@brief struct icaltimetype is a pseudo-object that abstracts time | ||
157 | *handling. | ||
158 | * | ||
159 | *It can represent either a DATE or a DATE-TIME (floating, UTC or in a | ||
160 | *given timezone), and it keeps track internally of its native timezone. | ||
161 | * | ||
162 | *The typical usage is to call the correct constructor specifying the | ||
163 | *desired timezone. If this is not known until a later time, the | ||
164 | *correct behavior is to specify a NULL timezone and call | ||
165 | *icaltime_convert_to_zone() at a later time. | ||
166 | * | ||
167 | *There are several ways to create a new icaltimetype: | ||
168 | * | ||
169 | *- icaltime_null_time() | ||
170 | *- icaltime_null_date() | ||
171 | *- icaltime_current_time_with_zone() | ||
172 | *- icaltime_today() | ||
173 | *- icaltime_from_timet_with_zone(time_t tm, int is_date, | ||
174 | * icaltimezone *zone) | ||
175 | * - icaltime_from_string_with_zone(const char* str, icaltimezone *zone) | ||
176 | *- icaltime_from_day_of_year(int doy, int year) | ||
177 | *- icaltime_from_week_number(int week_number, int year) | ||
178 | * | ||
179 | *italtimetype objects can be converted to different formats: | ||
180 | * | ||
181 | *- icaltime_as_timet(struct icaltimetype tt) | ||
182 | *- icaltime_as_timet_with_zone(struct icaltimetype tt, | ||
183 | * icaltimezone *zone) | ||
184 | *- icaltime_as_ical_string(struct icaltimetype tt) | ||
185 | * | ||
186 | *Accessor methods include: | ||
187 | * | ||
188 | *- icaltime_get_timezone(struct icaltimetype t) | ||
189 | *- icaltime_get_tzid(struct icaltimetype t) | ||
190 | *- icaltime_set_timezone(struct icaltimetype t, const icaltimezone *zone) | ||
191 | *- icaltime_day_of_year(struct icaltimetype t) | ||
192 | *- icaltime_day_of_week(struct icaltimetype t) | ||
193 | *- icaltime_start_doy_of_week(struct icaltimetype t) | ||
194 | *- icaltime_week_number(struct icaltimetype t) | ||
195 | * | ||
196 | *Query methods include: | ||
197 | * | ||
198 | *- icaltime_is_null_time(struct icaltimetype t) | ||
199 | *- icaltime_is_valid_time(struct icaltimetype t) | ||
200 | *- icaltime_is_date(struct icaltimetype t) | ||
201 | *- icaltime_is_utc(struct icaltimetype t) | ||
202 | *- icaltime_is_floating(struct icaltimetype t) | ||
203 | * | ||
204 | *Modify, compare and utility methods include: | ||
205 | * | ||
206 | *- icaltime_add(struct icaltimetype t, struct icaldurationtype d) | ||
207 | *- icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2) | ||
208 | * - icaltime_compare_with_zone(struct icaltimetype a,struct icaltimetype b) | ||
209 | *- icaltime_compare(struct icaltimetype a,struct icaltimetype b) | ||
210 | *- icaltime_compare_date_only(struct icaltimetype a, | ||
211 | * struct icaltimetype b) | ||
212 | *- icaltime_adjust(struct icaltimetype *tt, int days, int hours, | ||
213 | * int minutes, int seconds); | ||
214 | *- icaltime_normalize(struct icaltimetype t); | ||
215 | *- icaltime_convert_to_zone(const struct icaltimetype tt, | ||
216 | * icaltimezone *zone); | ||
217 | */ | ||
218 | |||
36 | #ifndef ICALTIME_H | 219 | #ifndef ICALTIME_H |
37 | #define ICALTIME_H | 220 | #define ICALTIME_H |
38 | 221 | ||
39 | #include <time.h> | 222 | #include <time.h> |
40 | 223 | ||
41 | /* icaltime_span is returned by icalcomponent_get_span() */ | 224 | /* An opaque struct representing a timezone. We declare this here to avoid |
225 | a circular dependancy. */ | ||
226 | #ifndef ICALTIMEZONE_DEFINED | ||
227 | #define ICALTIMEZONE_DEFINED | ||
228 | typedef struct _icaltimezone icaltimezone; | ||
229 | #endif | ||
230 | |||
231 | /** icaltime_span is returned by icalcomponent_get_span() */ | ||
42 | struct icaltime_span { | 232 | struct icaltime_span { |
43 | time_t start; /* in UTC */ | 233 | time_t start; /**< in UTC */ |
44 | time_t end; /* in UTC */ | 234 | time_t end; /**< in UTC */ |
45 | int is_busy; /* 1->busy time, 0-> free time */ | 235 | int is_busy; /**< 1->busy time, 0-> free time */ |
46 | }; | 236 | }; |
47 | 237 | ||
238 | typedef struct icaltime_span icaltime_span; | ||
48 | 239 | ||
240 | /* | ||
241 | *FIXME | ||
242 | * | ||
243 | *is_utc is redundant, and might be considered a minor optimization. | ||
244 | *It might be deprecated, so you should use icaltime_is_utc() instead. | ||
245 | */ | ||
49 | struct icaltimetype | 246 | struct icaltimetype |
50 | { | 247 | { |
51 | int year; | 248 | int year;/**< Actual year, e.g. 2001. */ |
52 | int month; | 249 | int month;/**< 1 (Jan) to 12 (Dec). */ |
53 | int day; | 250 | int day; |
54 | int hour; | 251 | int hour; |
55 | int minute; | 252 | int minute; |
56 | int second; | 253 | int second; |
57 | 254 | ||
58 | int is_utc; /* 1-> time is in UTC timezone */ | 255 | int is_utc; /**< 1-> time is in UTC timezone */ |
59 | 256 | ||
60 | int is_date; /* 1 -> interpret this as date. */ | 257 | int is_date; /**< 1 -> interpret this as date. */ |
61 | 258 | ||
62 | const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/ | 259 | int is_daylight; /**< 1 -> time is in daylight savings time. */ |
260 | |||
261 | const icaltimezone *zone;/**< timezone */ | ||
63 | }; | 262 | }; |
64 | 263 | ||
65 | /* Convert seconds past UNIX epoch to a timetype*/ | 264 | typedef struct icaltimetype icaltimetype; |
66 | struct icaltimetype icaltime_from_timet(time_t v, int is_date); | ||
67 | 265 | ||
68 | /* Return the time as seconds past the UNIX epoch */ | 266 | /** Return a null time, which indicates no time has been set. |
69 | time_t icaltime_as_timet(struct icaltimetype); | 267 | This time represent the beginning of the epoch */ |
268 | struct icaltimetype icaltime_null_time(void); | ||
70 | 269 | ||
71 | /* Return a string represention of the time, in RFC2445 format. The | 270 | /** Return a null date */ |
72 | string is owned by libical */ | 271 | struct icaltimetype icaltime_null_date(void); |
73 | char* icaltime_as_ical_string(struct icaltimetype tt); | ||
74 | 272 | ||
75 | /* Like icaltime_from_timet(), except that the input may be in seconds | 273 | /** Returns the current time in the given timezone, as an icaltimetype. */ |
76 | past the epoch in floating time. This routine is deprecated */ | 274 | struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone); |
77 | struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc); | ||
78 | 275 | ||
79 | /* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */ | 276 | /** Returns the current day as an icaltimetype, with is_date set. */ |
80 | int icaltime_as_int(struct icaltimetype); | 277 | struct icaltimetype icaltime_today(void); |
81 | 278 | ||
82 | /* create a time from an ISO format string */ | 279 | /** Convert seconds past UNIX epoch to a timetype*/ |
280 | struct icaltimetype icaltime_from_timet(const time_t v, const int is_date); | ||
281 | |||
282 | /** Convert seconds past UNIX epoch to a timetype, using timezones. */ | ||
283 | struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, | ||
284 | const int is_date, const icaltimezone *zone); | ||
285 | |||
286 | /** create a time from an ISO format string */ | ||
83 | struct icaltimetype icaltime_from_string(const char* str); | 287 | struct icaltimetype icaltime_from_string(const char* str); |
84 | 288 | ||
85 | /* Routines for handling timezones */ | 289 | /** create a time from an ISO format string */ |
86 | /* Return the offset of the named zone as seconds. tt is a time | 290 | struct icaltimetype icaltime_from_string_with_zone(const char* str, |
87 | indicating the date for which you want the offset */ | 291 | const icaltimezone *zone); |
88 | int icaltime_utc_offset(struct icaltimetype tt, const char* tzid); | ||
89 | 292 | ||
90 | /* convert tt, of timezone tzid, into a utc time. Does nothing if the | 293 | /** Create a new time, given a day of year and a year. */ |
91 | time is already UTC. */ | 294 | struct icaltimetype icaltime_from_day_of_year(const int doy, |
92 | struct icaltimetype icaltime_as_utc(struct icaltimetype tt, | 295 | const int year); |
93 | const char* tzid); | ||
94 | 296 | ||
95 | /* convert tt, a time in UTC, into a time in timezone tzid */ | 297 | /**@brief Contructor (TODO). |
96 | struct icaltimetype icaltime_as_zone(struct icaltimetype tt, | 298 | * Create a new time from a weeknumber and a year. */ |
97 | const char* tzid); | 299 | struct icaltimetype icaltime_from_week_number(const int week_number, |
300 | const int year); | ||
98 | 301 | ||
99 | /* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */ | 302 | /** Return the time as seconds past the UNIX epoch */ |
100 | struct icaltimetype icaltime_null_time(void); | 303 | time_t icaltime_as_timet(const struct icaltimetype); |
304 | |||
305 | /** Return the time as seconds past the UNIX epoch, using timezones. */ | ||
306 | time_t icaltime_as_timet_with_zone(const struct icaltimetype tt, | ||
307 | const icaltimezone *zone); | ||
308 | |||
309 | /** Return a string represention of the time, in RFC2445 format. The | ||
310 | string is owned by libical */ | ||
311 | const char* icaltime_as_ical_string(const struct icaltimetype tt); | ||
312 | |||
313 | /** @brief Return the timezone */ | ||
314 | const icaltimezone *icaltime_get_timezone(const struct icaltimetype t); | ||
315 | |||
316 | /** @brief Return the tzid, or NULL for a floating time */ | ||
317 | char *icaltime_get_tzid(const struct icaltimetype t); | ||
318 | |||
319 | /** @brief Set the timezone */ | ||
320 | struct icaltimetype icaltime_set_timezone(struct icaltimetype *t, | ||
321 | const icaltimezone *zone); | ||
101 | 322 | ||
102 | /* Return true of the time is null. */ | 323 | /** Return the day of the year of the given time */ |
103 | int icaltime_is_null_time(struct icaltimetype t); | 324 | int icaltime_day_of_year(const struct icaltimetype t); |
104 | 325 | ||
105 | /* Returns false if the time is clearly invalid, but is not null. This | 326 | /** Return the day of the week of the given time. Sunday is 1 */ |
327 | int icaltime_day_of_week(const struct icaltimetype t); | ||
328 | |||
329 | /** Return the day of the year for the Sunday of the week that the | ||
330 | given time is within. */ | ||
331 | int icaltime_start_doy_of_week(const struct icaltimetype t); | ||
332 | |||
333 | /** Return the week number for the week the given time is within */ | ||
334 | int icaltime_week_number(const struct icaltimetype t); | ||
335 | |||
336 | /** Return true of the time is null. */ | ||
337 | int icaltime_is_null_time(const struct icaltimetype t); | ||
338 | |||
339 | /** Returns false if the time is clearly invalid, but is not null. This | ||
106 | is usually the result of creating a new time type buy not clearing | 340 | is usually the result of creating a new time type buy not clearing |
107 | it, or setting one of the flags to an illegal value. */ | 341 | it, or setting one of the flags to an illegal value. */ |
108 | int icaltime_is_valid_time(struct icaltimetype t); | 342 | int icaltime_is_valid_time(const struct icaltimetype t); |
109 | 343 | ||
110 | /* Reset all of the time components to be in their normal ranges. For | 344 | /** @brief Returns true if time is of DATE type, false if DATE-TIME */ |
111 | instance, given a time with minutes=70, the minutes will be reduces | 345 | int icaltime_is_date(const struct icaltimetype t); |
112 | to 10, and the hour incremented. This allows the caller to do | ||
113 | arithmetic on times without worrying about overflow or | ||
114 | underflow. */ | ||
115 | struct icaltimetype icaltime_normalize(struct icaltimetype t); | ||
116 | 346 | ||
117 | /* Return the day of the year of the given time */ | 347 | /** @brief Returns true if time is relative to UTC zone */ |
118 | short icaltime_day_of_year(struct icaltimetype t); | 348 | int icaltime_is_utc(const struct icaltimetype t); |
119 | 349 | ||
120 | /* Create a new time, given a day of year and a year. */ | 350 | /** @brief Returns true if time is a floating time */ |
121 | struct icaltimetype icaltime_from_day_of_year(short doy, short year); | 351 | int icaltime_is_floating(const struct icaltimetype t); |
122 | 352 | ||
123 | /* Return the day of the week of the given time. Sunday is 1 */ | 353 | /** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ |
124 | short icaltime_day_of_week(struct icaltimetype t); | 354 | int icaltime_compare_with_zone(const struct icaltimetype a, |
355 | const struct icaltimetype b); | ||
125 | 356 | ||
126 | /* Return the day of the year for the Sunday of the week that the | 357 | /** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ |
127 | given time is within. */ | 358 | int icaltime_compare(const struct icaltimetype a, |
128 | short icaltime_start_doy_of_week(struct icaltimetype t); | 359 | const struct icaltimetype b); |
129 | 360 | ||
130 | /* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */ | 361 | /** like icaltime_compare, but only use the date parts. */ |
131 | char* icaltime_as_ctime(struct icaltimetype); | 362 | int icaltime_compare_date_only(const struct icaltimetype a, |
363 | const struct icaltimetype b); | ||
132 | 364 | ||
133 | /* Return the week number for the week the given time is within */ | 365 | /** Adds or subtracts a number of days, hours, minutes and seconds. */ |
134 | short icaltime_week_number(struct icaltimetype t); | 366 | void icaltime_adjust(struct icaltimetype *tt, const int days, |
367 | const int hours, const int minutes, const int seconds); | ||
135 | 368 | ||
136 | /* Create a new time from a weeknumber and a year. */ | 369 | /** Normalize the icaltime, so that all fields are within the normal range. */ |
137 | struct icaltimetype icaltime_from_week_number(short week_number, short year); | 370 | struct icaltimetype icaltime_normalize(const struct icaltimetype t); |
138 | 371 | ||
139 | /* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ | 372 | /** convert tt, of timezone tzid, into a utc time. Does nothing if the |
140 | int icaltime_compare(struct icaltimetype a,struct icaltimetype b); | 373 | time is already UTC. */ |
374 | struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, | ||
375 | icaltimezone *zone); | ||
141 | 376 | ||
142 | /* like icaltime_compare, but only use the date parts. */ | 377 | /** Return the number of days in the given month */ |
143 | int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b); | 378 | int icaltime_days_in_month(const int month, const int year); |
144 | 379 | ||
145 | /* Return the number of days in the given month */ | ||
146 | short icaltime_days_in_month(short month,short year); | ||
147 | 380 | ||
381 | /** @brief calculate an icaltimespan given a start and end time. */ | ||
382 | struct icaltime_span icaltime_span_new(struct icaltimetype dtstart, | ||
383 | struct icaltimetype dtend, | ||
384 | int is_busy); | ||
148 | 385 | ||
149 | #endif /* !ICALTIME_H */ | 386 | /** @brief Returns true if the two spans overlap **/ |
387 | int icaltime_span_overlaps(icaltime_span *s1, | ||
388 | icaltime_span *s2); | ||
150 | 389 | ||
390 | /** @brief Returns true if the span is totally within the containing | ||
391 | * span | ||
392 | */ | ||
393 | int icaltime_span_contains(icaltime_span *s, | ||
394 | icaltime_span *container); | ||
395 | |||
396 | |||
397 | #endif /* !ICALTIME_H */ | ||
151 | 398 | ||
152 | 399 | ||
153 | /* -*- Mode: C -*- */ | 400 | /* -*- Mode: C -*- */ |
@@ -156,8 +403,6 @@ short icaltime_days_in_month(short month,short year); | |||
156 | CREATOR: eric 26 Jan 2001 | 403 | CREATOR: eric 26 Jan 2001 |
157 | 404 | ||
158 | 405 | ||
159 | $Id$ | ||
160 | $Locker$ | ||
161 | 406 | ||
162 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 407 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
163 | 408 | ||
@@ -196,8 +441,10 @@ struct icaldurationtype icaldurationtype_from_int(int t); | |||
196 | struct icaldurationtype icaldurationtype_from_string(const char*); | 441 | struct icaldurationtype icaldurationtype_from_string(const char*); |
197 | int icaldurationtype_as_int(struct icaldurationtype duration); | 442 | int icaldurationtype_as_int(struct icaldurationtype duration); |
198 | char* icaldurationtype_as_ical_string(struct icaldurationtype d); | 443 | char* icaldurationtype_as_ical_string(struct icaldurationtype d); |
199 | struct icaldurationtype icaldurationtype_null_duration(); | 444 | struct icaldurationtype icaldurationtype_null_duration(void); |
445 | struct icaldurationtype icaldurationtype_bad_duration(void); | ||
200 | int icaldurationtype_is_null_duration(struct icaldurationtype d); | 446 | int icaldurationtype_is_null_duration(struct icaldurationtype d); |
447 | int icaldurationtype_is_bad_duration(struct icaldurationtype d); | ||
201 | 448 | ||
202 | struct icaltimetype icaltime_add(struct icaltimetype t, | 449 | struct icaltimetype icaltime_add(struct icaltimetype t, |
203 | struct icaldurationtype d); | 450 | struct icaldurationtype d); |
@@ -215,8 +462,6 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1, | |||
215 | CREATOR: eric 26 Jan 2001 | 462 | CREATOR: eric 26 Jan 2001 |
216 | 463 | ||
217 | 464 | ||
218 | $Id$ | ||
219 | $Locker$ | ||
220 | 465 | ||
221 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 466 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
222 | 467 | ||
@@ -251,12 +496,12 @@ struct icalperiodtype | |||
251 | struct icalperiodtype icalperiodtype_from_string (const char* str); | 496 | struct icalperiodtype icalperiodtype_from_string (const char* str); |
252 | 497 | ||
253 | const char* icalperiodtype_as_ical_string(struct icalperiodtype p); | 498 | const char* icalperiodtype_as_ical_string(struct icalperiodtype p); |
254 | struct icalperiodtype icalperiodtype_null_period(); | ||
255 | int icalperiodtype_is_null_period(struct icalperiodtype p); | ||
256 | int icalperiodtype_is_valid_period(struct icalperiodtype p); | ||
257 | 499 | ||
500 | struct icalperiodtype icalperiodtype_null_period(void); | ||
258 | 501 | ||
502 | int icalperiodtype_is_null_period(struct icalperiodtype p); | ||
259 | 503 | ||
504 | int icalperiodtype_is_valid_period(struct icalperiodtype p); | ||
260 | 505 | ||
261 | #endif /* !ICALTIME_H */ | 506 | #endif /* !ICALTIME_H */ |
262 | 507 | ||
@@ -307,6 +552,7 @@ typedef enum icalcomponent_kind { | |||
307 | ICAL_VTODO_COMPONENT, | 552 | ICAL_VTODO_COMPONENT, |
308 | ICAL_VJOURNAL_COMPONENT, | 553 | ICAL_VJOURNAL_COMPONENT, |
309 | ICAL_VCALENDAR_COMPONENT, | 554 | ICAL_VCALENDAR_COMPONENT, |
555 | ICAL_VAGENDA_COMPONENT, | ||
310 | ICAL_VFREEBUSY_COMPONENT, | 556 | ICAL_VFREEBUSY_COMPONENT, |
311 | ICAL_VALARM_COMPONENT, | 557 | ICAL_VALARM_COMPONENT, |
312 | ICAL_XAUDIOALARM_COMPONENT, | 558 | ICAL_XAUDIOALARM_COMPONENT, |
@@ -362,11 +608,17 @@ typedef enum icalrequeststatus { | |||
362 | ICAL_3_12_UNKCOMP_STATUS, | 608 | ICAL_3_12_UNKCOMP_STATUS, |
363 | ICAL_3_13_BADCOMP_STATUS, | 609 | ICAL_3_13_BADCOMP_STATUS, |
364 | ICAL_3_14_NOCAP_STATUS, | 610 | ICAL_3_14_NOCAP_STATUS, |
611 | ICAL_3_15_INVCOMMAND, | ||
365 | ICAL_4_0_BUSY_STATUS, | 612 | ICAL_4_0_BUSY_STATUS, |
613 | ICAL_4_1_STORE_ACCESS_DENIED, | ||
614 | ICAL_4_2_STORE_FAILED, | ||
615 | ICAL_4_3_STORE_NOT_FOUND, | ||
366 | ICAL_5_0_MAYBE_STATUS, | 616 | ICAL_5_0_MAYBE_STATUS, |
367 | ICAL_5_1_UNAVAIL_STATUS, | 617 | ICAL_5_1_UNAVAIL_STATUS, |
368 | ICAL_5_2_NOSERVICE_STATUS, | 618 | ICAL_5_2_NOSERVICE_STATUS, |
369 | ICAL_5_3_NOSCHED_STATUS | 619 | ICAL_5_3_NOSCHED_STATUS, |
620 | ICAL_6_1_CONTAINER_NOT_FOUND, | ||
621 | ICAL_9_0_UNRECOGNIZED_COMMAND | ||
370 | } icalrequeststatus; | 622 | } icalrequeststatus; |
371 | 623 | ||
372 | 624 | ||
@@ -374,6 +626,7 @@ const char* icalenum_reqstat_desc(icalrequeststatus stat); | |||
374 | short icalenum_reqstat_major(icalrequeststatus stat); | 626 | short icalenum_reqstat_major(icalrequeststatus stat); |
375 | short icalenum_reqstat_minor(icalrequeststatus stat); | 627 | short icalenum_reqstat_minor(icalrequeststatus stat); |
376 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor); | 628 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor); |
629 | char* icalenum_reqstat_code(icalrequeststatus stat); | ||
377 | 630 | ||
378 | /*********************************************************************** | 631 | /*********************************************************************** |
379 | * Conversion functions | 632 | * Conversion functions |
@@ -448,39 +701,6 @@ icalrequeststatus icalenum_num_to_reqstat(short major, short minor); | |||
448 | #include <time.h> | 701 | #include <time.h> |
449 | 702 | ||
450 | 703 | ||
451 | /* This type type should probably be an opaque type... */ | ||
452 | struct icalattachtype | ||
453 | { | ||
454 | void* binary; | ||
455 | int owns_binary; | ||
456 | |||
457 | char* base64; | ||
458 | int owns_base64; | ||
459 | |||
460 | char* url; | ||
461 | |||
462 | int refcount; | ||
463 | |||
464 | }; | ||
465 | |||
466 | /* converts base64 to binary, fetches url and stores as binary, or | ||
467 | just returns data */ | ||
468 | |||
469 | struct icalattachtype* icalattachtype_new(void); | ||
470 | void icalattachtype_add_reference(struct icalattachtype* v); | ||
471 | void icalattachtype_free(struct icalattachtype* v); | ||
472 | |||
473 | void icalattachtype_set_url(struct icalattachtype* v, char* url); | ||
474 | char* icalattachtype_get_url(struct icalattachtype* v); | ||
475 | |||
476 | void icalattachtype_set_base64(struct icalattachtype* v, char* base64, | ||
477 | int owns); | ||
478 | char* icalattachtype_get_base64(struct icalattachtype* v); | ||
479 | |||
480 | void icalattachtype_set_binary(struct icalattachtype* v, char* binary, | ||
481 | int owns); | ||
482 | void* icalattachtype_get_binary(struct icalattachtype* v); | ||
483 | |||
484 | struct icalgeotype | 704 | struct icalgeotype |
485 | { | 705 | { |
486 | float lat; | 706 | float lat; |
@@ -501,9 +721,11 @@ struct icaltriggertype | |||
501 | struct icaldurationtype duration; | 721 | struct icaldurationtype duration; |
502 | }; | 722 | }; |
503 | 723 | ||
724 | struct icaltriggertype icaltriggertype_from_int(const int reltime); | ||
504 | struct icaltriggertype icaltriggertype_from_string(const char* str); | 725 | struct icaltriggertype icaltriggertype_from_string(const char* str); |
505 | 726 | ||
506 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr); | 727 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr); |
728 | int icaltriggertype_is_bad_trigger(struct icaltriggertype tr); | ||
507 | 729 | ||
508 | /* struct icalreqstattype. This struct contains two string pointers, | 730 | /* struct icalreqstattype. This struct contains two string pointers, |
509 | but don't try to free either of them. The "desc" string is a pointer | 731 | but don't try to free either of them. The "desc" string is a pointer |
@@ -571,10 +793,17 @@ void icaltimezonetype_free(struct icaltimezonetype tzt); | |||
571 | 793 | ||
572 | The Mozilla Public License Version 1.0. You may obtain a copy of | 794 | The Mozilla Public License Version 1.0. You may obtain a copy of |
573 | the License at http://www.mozilla.org/MPL/ | 795 | the License at http://www.mozilla.org/MPL/ |
796 | */ | ||
797 | |||
798 | /** | ||
799 | @file icalrecur.h | ||
800 | @brief Routines for dealing with recurring time | ||
574 | 801 | ||
575 | How to use: | 802 | How to use: |
576 | 803 | ||
577 | 1) Get a rule and a start time from a component | 804 | 1) Get a rule and a start time from a component |
805 | |||
806 | @code | ||
578 | icalproperty rrule; | 807 | icalproperty rrule; |
579 | struct icalrecurrencetype recur; | 808 | struct icalrecurrencetype recur; |
580 | struct icaltimetype dtstart; | 809 | struct icaltimetype dtstart; |
@@ -582,35 +811,45 @@ How to use: | |||
582 | rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); | 811 | rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); |
583 | recur = icalproperty_get_rrule(rrule); | 812 | recur = icalproperty_get_rrule(rrule); |
584 | start = icalproperty_get_dtstart(dtstart); | 813 | start = icalproperty_get_dtstart(dtstart); |
814 | @endcode | ||
585 | 815 | ||
586 | Or, just make them up: | 816 | Or, just make them up: |
817 | |||
818 | @code | ||
587 | recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE"); | 819 | recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE"); |
588 | dtstart = icaltime_from_string("19970101T123000") | 820 | dtstart = icaltime_from_string("19970101T123000") |
821 | @endcode | ||
589 | 822 | ||
590 | 2) Create an iterator | 823 | 2) Create an iterator |
824 | |||
825 | @code | ||
591 | icalrecur_iterator* ritr; | 826 | icalrecur_iterator* ritr; |
592 | ritr = icalrecur_iterator_new(recur,start); | 827 | ritr = icalrecur_iterator_new(recur,start); |
828 | @endcode | ||
593 | 829 | ||
594 | 3) Iterator over the occurrences | 830 | 3) Iterator over the occurrences |
831 | |||
832 | @code | ||
595 | struct icaltimetype next; | 833 | struct icaltimetype next; |
596 | while (next = icalrecur_iterator_next(ritr) | 834 | while (next = icalrecur_iterator_next(ritr) |
597 | && !icaltime_is_null_time(next){ | 835 | && !icaltime_is_null_time(next){ |
598 | Do something with next | 836 | Do something with next |
599 | } | 837 | } |
838 | @endcode | ||
600 | 839 | ||
601 | Note that that the time returned by icalrecur_iterator_next is in | 840 | Note that that the time returned by icalrecur_iterator_next is in |
602 | whatever timezone that dtstart is in. | 841 | whatever timezone that dtstart is in. |
603 | 842 | ||
604 | ======================================================================*/ | 843 | */ |
605 | 844 | ||
606 | #ifndef ICALRECUR_H | 845 | #ifndef ICALRECUR_H |
607 | #define ICALRECUR_H | 846 | #define ICALRECUR_H |
608 | 847 | ||
609 | #include <time.h> | 848 | #include <time.h> |
610 | 849 | ||
611 | /*********************************************************************** | 850 | /* |
612 | * Recurrance enumerations | 851 | * Recurrance enumerations |
613 | **********************************************************************/ | 852 | */ |
614 | 853 | ||
615 | typedef enum icalrecurrencetype_frequency | 854 | typedef enum icalrecurrencetype_frequency |
616 | { | 855 | { |
@@ -647,7 +886,9 @@ enum { | |||
647 | 886 | ||
648 | 887 | ||
649 | 888 | ||
650 | /********************** Recurrence type routines **************/ | 889 | /** |
890 | * Recurrence type routines | ||
891 | */ | ||
651 | 892 | ||
652 | /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of | 893 | /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of |
653 | the values and fields in struct icalrecurrencetype */ | 894 | the values and fields in struct icalrecurrencetype */ |
@@ -662,7 +903,7 @@ enum { | |||
662 | #define ICAL_BY_MONTH_SIZE 13 | 903 | #define ICAL_BY_MONTH_SIZE 13 |
663 | #define ICAL_BY_SETPOS_SIZE 367 | 904 | #define ICAL_BY_SETPOS_SIZE 367 |
664 | 905 | ||
665 | /* Main struct for holding digested recurrence rules */ | 906 | /** Main struct for holding digested recurrence rules */ |
666 | struct icalrecurrencetype | 907 | struct icalrecurrencetype |
667 | { | 908 | { |
668 | icalrecurrencetype_frequency freq; | 909 | icalrecurrencetype_frequency freq; |
@@ -699,43 +940,49 @@ struct icalrecurrencetype | |||
699 | 940 | ||
700 | void icalrecurrencetype_clear(struct icalrecurrencetype *r); | 941 | void icalrecurrencetype_clear(struct icalrecurrencetype *r); |
701 | 942 | ||
702 | /* The 'day' element of the by_day array is encoded to allow | 943 | /** |
703 | representation of both the day of the week ( Monday, Tueday), but also | 944 | * Array Encoding |
704 | the Nth day of the week ( First tuesday of the month, last thursday of | 945 | * |
705 | the year) These routines decode the day values */ | 946 | * The 'day' element of the by_day array is encoded to allow |
947 | * representation of both the day of the week ( Monday, Tueday), but also | ||
948 | * the Nth day of the week ( First tuesday of the month, last thursday of | ||
949 | * the year) These routines decode the day values | ||
950 | */ | ||
706 | 951 | ||
707 | /* 1 == Monday, etc. */ | 952 | /** 1 == Monday, etc. */ |
708 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); | 953 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); |
709 | 954 | ||
710 | /* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ | 955 | /** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ |
711 | short icalrecurrencetype_day_position(short day); | 956 | int icalrecurrencetype_day_position(short day); |
712 | 957 | ||
713 | 958 | ||
714 | /*********************************************************************** | 959 | /** Recurrance rule parser */ |
715 | * Recurrance rule parser | ||
716 | **********************************************************************/ | ||
717 | 960 | ||
718 | /* Convert between strings ans recurrencetype structures. */ | 961 | /** Convert between strings and recurrencetype structures. */ |
719 | struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); | 962 | struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); |
720 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); | 963 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); |
721 | 964 | ||
722 | 965 | ||
723 | /********** recurrence iteration routines ********************/ | 966 | /** Recurrence iteration routines */ |
724 | 967 | ||
725 | typedef void icalrecur_iterator; | 968 | typedef struct icalrecur_iterator_impl icalrecur_iterator; |
726 | 969 | ||
727 | /* Create a new recurrence rule iterator */ | 970 | /** Create a new recurrence rule iterator */ |
728 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | 971 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, |
729 | struct icaltimetype dtstart); | 972 | struct icaltimetype dtstart); |
730 | 973 | ||
731 | /* Get the next occurrence from an iterator */ | 974 | /** Get the next occurrence from an iterator */ |
732 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); | 975 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); |
733 | 976 | ||
734 | /* Free the iterator */ | 977 | void icalrecur_iterator_decrement_count(icalrecur_iterator*); |
978 | |||
979 | /** Free the iterator */ | ||
735 | void icalrecur_iterator_free(icalrecur_iterator*); | 980 | void icalrecur_iterator_free(icalrecur_iterator*); |
736 | 981 | ||
737 | /* Fills array up with at most 'count' time_t values, each | 982 | /** |
738 | representing an occurrence time in seconds past the POSIX epoch */ | 983 | * Fills array up with at most 'count' time_t values, each |
984 | * representing an occurrence time in seconds past the POSIX epoch | ||
985 | */ | ||
739 | int icalrecur_expand_recurrence(char* rule, time_t start, | 986 | int icalrecur_expand_recurrence(char* rule, time_t start, |
740 | int count, time_t* array); | 987 | int count, time_t* array); |
741 | 988 | ||
@@ -743,12 +990,70 @@ int icalrecur_expand_recurrence(char* rule, time_t start, | |||
743 | #endif | 990 | #endif |
744 | /* -*- Mode: C -*- */ | 991 | /* -*- Mode: C -*- */ |
745 | /*====================================================================== | 992 | /*====================================================================== |
993 | FILE: icalattach.h | ||
994 | CREATOR: acampi 28 May 02 | ||
995 | |||
996 | |||
997 | (C) COPYRIGHT 2002, Andrea Campi | ||
998 | |||
999 | This program is free software; you can redistribute it and/or modify | ||
1000 | it under the terms of either: | ||
1001 | |||
1002 | The LGPL as published by the Free Software Foundation, version | ||
1003 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1004 | |||
1005 | Or: | ||
1006 | |||
1007 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
1008 | the License at http://www.mozilla.org/MPL/ | ||
1009 | |||
1010 | The original code is icalattach.h | ||
1011 | |||
1012 | ======================================================================*/ | ||
1013 | |||
1014 | #ifndef ICALATTACH_H | ||
1015 | #define ICALATTACH_H | ||
1016 | |||
1017 | |||
1018 | typedef struct icalattach_impl icalattach; | ||
1019 | |||
1020 | typedef void (* icalattach_free_fn_t) (unsigned char *data, void *user_data); | ||
1021 | |||
1022 | icalattach *icalattach_new_from_url (const char *url); | ||
1023 | icalattach *icalattach_new_from_data (unsigned char *data, | ||
1024 | icalattach_free_fn_t free_fn, void *free_fn_data); | ||
1025 | |||
1026 | void icalattach_ref (icalattach *attach); | ||
1027 | void icalattach_unref (icalattach *attach); | ||
1028 | |||
1029 | int icalattach_get_is_url (icalattach *attach); | ||
1030 | const char *icalattach_get_url (icalattach *attach); | ||
1031 | unsigned char *icalattach_get_data (icalattach *attach); | ||
1032 | |||
1033 | struct icalattachtype* icalattachtype_new(void); | ||
1034 | void icalattachtype_add_reference(struct icalattachtype* v); | ||
1035 | void icalattachtype_free(struct icalattachtype* v); | ||
1036 | |||
1037 | void icalattachtype_set_url(struct icalattachtype* v, char* url); | ||
1038 | char* icalattachtype_get_url(struct icalattachtype* v); | ||
1039 | |||
1040 | void icalattachtype_set_base64(struct icalattachtype* v, char* base64, | ||
1041 | int owns); | ||
1042 | char* icalattachtype_get_base64(struct icalattachtype* v); | ||
1043 | |||
1044 | void icalattachtype_set_binary(struct icalattachtype* v, char* binary, | ||
1045 | int owns); | ||
1046 | void* icalattachtype_get_binary(struct icalattachtype* v); | ||
1047 | |||
1048 | |||
1049 | |||
1050 | #endif /* !ICALATTACH_H */ | ||
1051 | /* -*- Mode: C -*- */ | ||
1052 | /*====================================================================== | ||
746 | FILE: icalvalue.h | 1053 | FILE: icalvalue.h |
747 | CREATOR: eric 20 March 1999 | 1054 | CREATOR: eric 20 March 1999 |
748 | 1055 | ||
749 | 1056 | ||
750 | $Id$ | ||
751 | $Locker$ | ||
752 | 1057 | ||
753 | 1058 | ||
754 | 1059 | ||
@@ -773,62 +1078,62 @@ int icalrecur_expand_recurrence(char* rule, time_t start, | |||
773 | #define ICALDERIVEDVALUE_H | 1078 | #define ICALDERIVEDVALUE_H |
774 | 1079 | ||
775 | 1080 | ||
776 | typedef void icalvalue; | 1081 | typedef struct icalvalue_impl icalvalue; |
777 | 1082 | ||
778 | 1083 | ||
779 | 1084 | ||
780 | void icalvalue_set_x(icalvalue* value, const char* v); | 1085 | void icalvalue_set_x(icalvalue* value, const char* v); |
781 | icalvalue* icalvalue_new_x(const char* v); | 1086 | icalvalue* icalvalue_new_x(const char* v); |
782 | const char* icalvalue_get_x(icalvalue* value); | 1087 | const char* icalvalue_get_x(const icalvalue* value); |
783 | |||
784 | icalvalue* icalvalue_new_attach (struct icalattachtype* v); | ||
785 | void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v); | ||
786 | struct icalattachtype* icalvalue_get_attach(icalvalue* value); | ||
787 | 1088 | ||
788 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); | 1089 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); |
789 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); | 1090 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); |
790 | struct icalrecurrencetype icalvalue_get_recur(icalvalue* value); | 1091 | struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); |
791 | 1092 | ||
792 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); | 1093 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); |
793 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); | 1094 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); |
794 | struct icaltriggertype icalvalue_get_trigger(icalvalue* value); | 1095 | struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); |
795 | 1096 | ||
796 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); | 1097 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); |
797 | void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); | 1098 | void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); |
798 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value); | 1099 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); |
1100 | |||
1101 | icalvalue *icalvalue_new_attach (icalattach *attach); | ||
1102 | void icalvalue_set_attach (icalvalue *value, icalattach *attach); | ||
1103 | icalattach *icalvalue_get_attach (const icalvalue *value); | ||
799 | 1104 | ||
800 | void icalvalue_reset_kind(icalvalue* value); | 1105 | void icalvalue_reset_kind(icalvalue* value); |
801 | 1106 | ||
802 | /* Everything below this line is machine generated. Do not edit. */ | ||
803 | typedef enum icalvalue_kind { | 1107 | typedef enum icalvalue_kind { |
804 | ICAL_ANY_VALUE=5000, | 1108 | ICAL_ANY_VALUE=5000, |
805 | ICAL_QUERY_VALUE=5001, | 1109 | ICAL_QUERY_VALUE=5001, |
806 | ICAL_TRIGGER_VALUE=5002, | 1110 | ICAL_DATE_VALUE=5002, |
807 | ICAL_STATUS_VALUE=5003, | 1111 | ICAL_ATTACH_VALUE=5003, |
808 | ICAL_TRANSP_VALUE=5004, | 1112 | ICAL_GEO_VALUE=5004, |
809 | ICAL_CLASS_VALUE=5005, | 1113 | ICAL_STATUS_VALUE=5005, |
810 | ICAL_DATE_VALUE=5006, | 1114 | ICAL_TRANSP_VALUE=5006, |
811 | ICAL_STRING_VALUE=5007, | 1115 | ICAL_STRING_VALUE=5007, |
812 | ICAL_INTEGER_VALUE=5008, | 1116 | ICAL_TEXT_VALUE=5008, |
813 | ICAL_PERIOD_VALUE=5009, | 1117 | ICAL_REQUESTSTATUS_VALUE=5009, |
814 | ICAL_TEXT_VALUE=5010, | 1118 | ICAL_BINARY_VALUE=5010, |
815 | ICAL_DURATION_VALUE=5011, | 1119 | ICAL_PERIOD_VALUE=5011, |
816 | ICAL_BOOLEAN_VALUE=5012, | 1120 | ICAL_FLOAT_VALUE=5012, |
817 | ICAL_URI_VALUE=5013, | 1121 | ICAL_DATETIMEPERIOD_VALUE=5013, |
818 | ICAL_DATETIMEPERIOD_VALUE=5014, | 1122 | ICAL_INTEGER_VALUE=5014, |
819 | ICAL_GEO_VALUE=5015, | 1123 | ICAL_CLASS_VALUE=5015, |
820 | ICAL_DATETIME_VALUE=5016, | 1124 | ICAL_URI_VALUE=5016, |
821 | ICAL_UTCOFFSET_VALUE=5017, | 1125 | ICAL_DURATION_VALUE=5017, |
822 | ICAL_ATTACH_VALUE=5018, | 1126 | ICAL_BOOLEAN_VALUE=5018, |
823 | ICAL_ACTION_VALUE=5019, | 1127 | ICAL_X_VALUE=5019, |
824 | ICAL_CALADDRESS_VALUE=5020, | 1128 | ICAL_CALADDRESS_VALUE=5020, |
825 | ICAL_X_VALUE=5021, | 1129 | ICAL_TRIGGER_VALUE=5021, |
826 | ICAL_FLOAT_VALUE=5022, | 1130 | ICAL_XLICCLASS_VALUE=5022, |
827 | ICAL_REQUESTSTATUS_VALUE=5023, | 1131 | ICAL_RECUR_VALUE=5023, |
828 | ICAL_METHOD_VALUE=5024, | 1132 | ICAL_ACTION_VALUE=5024, |
829 | ICAL_BINARY_VALUE=5025, | 1133 | ICAL_DATETIME_VALUE=5025, |
830 | ICAL_RECUR_VALUE=5026, | 1134 | ICAL_UTCOFFSET_VALUE=5026, |
831 | ICAL_NO_VALUE=5027 | 1135 | ICAL_METHOD_VALUE=5027, |
1136 | ICAL_NO_VALUE=5028 | ||
832 | } icalvalue_kind ; | 1137 | } icalvalue_kind ; |
833 | 1138 | ||
834 | #define ICALPROPERTY_FIRST_ENUM 10000 | 1139 | #define ICALPROPERTY_FIRST_ENUM 10000 |
@@ -886,138 +1191,178 @@ typedef enum icalproperty_status { | |||
886 | typedef enum icalproperty_transp { | 1191 | typedef enum icalproperty_transp { |
887 | ICAL_TRANSP_X = 10038, | 1192 | ICAL_TRANSP_X = 10038, |
888 | ICAL_TRANSP_OPAQUE = 10039, | 1193 | ICAL_TRANSP_OPAQUE = 10039, |
889 | ICAL_TRANSP_TRANSPARENT = 10040, | 1194 | ICAL_TRANSP_OPAQUENOCONFLICT = 10040, |
890 | ICAL_TRANSP_NONE = 10041 | 1195 | ICAL_TRANSP_TRANSPARENT = 10041, |
1196 | ICAL_TRANSP_TRANSPARENTNOCONFLICT = 10042, | ||
1197 | ICAL_TRANSP_NONE = 10043 | ||
891 | } icalproperty_transp; | 1198 | } icalproperty_transp; |
892 | 1199 | ||
893 | #define ICALPROPERTY_LAST_ENUM 10042 | 1200 | typedef enum icalproperty_xlicclass { |
1201 | ICAL_XLICCLASS_X = 10044, | ||
1202 | ICAL_XLICCLASS_PUBLISHNEW = 10045, | ||
1203 | ICAL_XLICCLASS_PUBLISHUPDATE = 10046, | ||
1204 | ICAL_XLICCLASS_PUBLISHFREEBUSY = 10047, | ||
1205 | ICAL_XLICCLASS_REQUESTNEW = 10048, | ||
1206 | ICAL_XLICCLASS_REQUESTUPDATE = 10049, | ||
1207 | ICAL_XLICCLASS_REQUESTRESCHEDULE = 10050, | ||
1208 | ICAL_XLICCLASS_REQUESTDELEGATE = 10051, | ||
1209 | ICAL_XLICCLASS_REQUESTNEWORGANIZER = 10052, | ||
1210 | ICAL_XLICCLASS_REQUESTFORWARD = 10053, | ||
1211 | ICAL_XLICCLASS_REQUESTSTATUS = 10054, | ||
1212 | ICAL_XLICCLASS_REQUESTFREEBUSY = 10055, | ||
1213 | ICAL_XLICCLASS_REPLYACCEPT = 10056, | ||
1214 | ICAL_XLICCLASS_REPLYDECLINE = 10057, | ||
1215 | ICAL_XLICCLASS_REPLYDELEGATE = 10058, | ||
1216 | ICAL_XLICCLASS_REPLYCRASHERACCEPT = 10059, | ||
1217 | ICAL_XLICCLASS_REPLYCRASHERDECLINE = 10060, | ||
1218 | ICAL_XLICCLASS_ADDINSTANCE = 10061, | ||
1219 | ICAL_XLICCLASS_CANCELEVENT = 10062, | ||
1220 | ICAL_XLICCLASS_CANCELINSTANCE = 10063, | ||
1221 | ICAL_XLICCLASS_CANCELALL = 10064, | ||
1222 | ICAL_XLICCLASS_REFRESH = 10065, | ||
1223 | ICAL_XLICCLASS_COUNTER = 10066, | ||
1224 | ICAL_XLICCLASS_DECLINECOUNTER = 10067, | ||
1225 | ICAL_XLICCLASS_MALFORMED = 10068, | ||
1226 | ICAL_XLICCLASS_OBSOLETE = 10069, | ||
1227 | ICAL_XLICCLASS_MISSEQUENCED = 10070, | ||
1228 | ICAL_XLICCLASS_UNKNOWN = 10071, | ||
1229 | ICAL_XLICCLASS_NONE = 10072 | ||
1230 | } icalproperty_xlicclass; | ||
1231 | |||
1232 | #define ICALPROPERTY_LAST_ENUM 10073 | ||
894 | 1233 | ||
895 | 1234 | ||
896 | /* QUERY */ | 1235 | /* QUERY */ |
897 | icalvalue* icalvalue_new_query(const char* v); | 1236 | icalvalue* icalvalue_new_query(const char* v); |
898 | const char* icalvalue_get_query(icalvalue* value); | 1237 | const char* icalvalue_get_query(const icalvalue* value); |
899 | void icalvalue_set_query(icalvalue* value, const char* v); | 1238 | void icalvalue_set_query(icalvalue* value, const char* v); |
900 | 1239 | ||
901 | 1240 | ||
1241 | /* DATE */ | ||
1242 | icalvalue* icalvalue_new_date(struct icaltimetype v); | ||
1243 | struct icaltimetype icalvalue_get_date(const icalvalue* value); | ||
1244 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v); | ||
1245 | |||
1246 | |||
1247 | /* GEO */ | ||
1248 | icalvalue* icalvalue_new_geo(struct icalgeotype v); | ||
1249 | struct icalgeotype icalvalue_get_geo(const icalvalue* value); | ||
1250 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); | ||
1251 | |||
1252 | |||
902 | /* STATUS */ | 1253 | /* STATUS */ |
903 | icalvalue* icalvalue_new_status(enum icalproperty_status v); | 1254 | icalvalue* icalvalue_new_status(enum icalproperty_status v); |
904 | enum icalproperty_status icalvalue_get_status(icalvalue* value); | 1255 | enum icalproperty_status icalvalue_get_status(const icalvalue* value); |
905 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v); | 1256 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v); |
906 | 1257 | ||
907 | 1258 | ||
908 | /* TRANSP */ | 1259 | /* TRANSP */ |
909 | icalvalue* icalvalue_new_transp(enum icalproperty_transp v); | 1260 | icalvalue* icalvalue_new_transp(enum icalproperty_transp v); |
910 | enum icalproperty_transp icalvalue_get_transp(icalvalue* value); | 1261 | enum icalproperty_transp icalvalue_get_transp(const icalvalue* value); |
911 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v); | 1262 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v); |
912 | 1263 | ||
913 | 1264 | ||
914 | /* CLASS */ | 1265 | /* STRING */ |
915 | icalvalue* icalvalue_new_class(enum icalproperty_class v); | 1266 | icalvalue* icalvalue_new_string(const char* v); |
916 | enum icalproperty_class icalvalue_get_class(icalvalue* value); | 1267 | const char* icalvalue_get_string(const icalvalue* value); |
917 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); | 1268 | void icalvalue_set_string(icalvalue* value, const char* v); |
918 | 1269 | ||
919 | 1270 | ||
920 | /* DATE */ | 1271 | /* TEXT */ |
921 | icalvalue* icalvalue_new_date(struct icaltimetype v); | 1272 | icalvalue* icalvalue_new_text(const char* v); |
922 | struct icaltimetype icalvalue_get_date(icalvalue* value); | 1273 | const char* icalvalue_get_text(const icalvalue* value); |
923 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v); | 1274 | void icalvalue_set_text(icalvalue* value, const char* v); |
924 | 1275 | ||
925 | 1276 | ||
926 | /* STRING */ | 1277 | /* REQUEST-STATUS */ |
927 | icalvalue* icalvalue_new_string(const char* v); | 1278 | icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v); |
928 | const char* icalvalue_get_string(icalvalue* value); | 1279 | struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value); |
929 | void icalvalue_set_string(icalvalue* value, const char* v); | 1280 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v); |
930 | 1281 | ||
931 | 1282 | ||
932 | /* INTEGER */ | 1283 | /* BINARY */ |
933 | icalvalue* icalvalue_new_integer(int v); | 1284 | icalvalue* icalvalue_new_binary(const char* v); |
934 | int icalvalue_get_integer(icalvalue* value); | 1285 | const char* icalvalue_get_binary(const icalvalue* value); |
935 | void icalvalue_set_integer(icalvalue* value, int v); | 1286 | void icalvalue_set_binary(icalvalue* value, const char* v); |
936 | 1287 | ||
937 | 1288 | ||
938 | /* PERIOD */ | 1289 | /* PERIOD */ |
939 | icalvalue* icalvalue_new_period(struct icalperiodtype v); | 1290 | icalvalue* icalvalue_new_period(struct icalperiodtype v); |
940 | struct icalperiodtype icalvalue_get_period(icalvalue* value); | 1291 | struct icalperiodtype icalvalue_get_period(const icalvalue* value); |
941 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v); | 1292 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v); |
942 | 1293 | ||
943 | 1294 | ||
944 | /* TEXT */ | 1295 | /* FLOAT */ |
945 | icalvalue* icalvalue_new_text(const char* v); | 1296 | icalvalue* icalvalue_new_float(float v); |
946 | const char* icalvalue_get_text(icalvalue* value); | 1297 | float icalvalue_get_float(const icalvalue* value); |
947 | void icalvalue_set_text(icalvalue* value, const char* v); | 1298 | void icalvalue_set_float(icalvalue* value, float v); |
948 | 1299 | ||
949 | 1300 | ||
950 | /* DURATION */ | 1301 | /* INTEGER */ |
951 | icalvalue* icalvalue_new_duration(struct icaldurationtype v); | 1302 | icalvalue* icalvalue_new_integer(int v); |
952 | struct icaldurationtype icalvalue_get_duration(icalvalue* value); | 1303 | int icalvalue_get_integer(const icalvalue* value); |
953 | void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v); | 1304 | void icalvalue_set_integer(icalvalue* value, int v); |
954 | 1305 | ||
955 | 1306 | ||
956 | /* BOOLEAN */ | 1307 | /* CLASS */ |
957 | icalvalue* icalvalue_new_boolean(int v); | 1308 | icalvalue* icalvalue_new_class(enum icalproperty_class v); |
958 | int icalvalue_get_boolean(icalvalue* value); | 1309 | enum icalproperty_class icalvalue_get_class(const icalvalue* value); |
959 | void icalvalue_set_boolean(icalvalue* value, int v); | 1310 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); |
960 | 1311 | ||
961 | 1312 | ||
962 | /* URI */ | 1313 | /* URI */ |
963 | icalvalue* icalvalue_new_uri(const char* v); | 1314 | icalvalue* icalvalue_new_uri(const char* v); |
964 | const char* icalvalue_get_uri(icalvalue* value); | 1315 | const char* icalvalue_get_uri(const icalvalue* value); |
965 | void icalvalue_set_uri(icalvalue* value, const char* v); | 1316 | void icalvalue_set_uri(icalvalue* value, const char* v); |
966 | 1317 | ||
967 | 1318 | ||
968 | /* GEO */ | 1319 | /* DURATION */ |
969 | icalvalue* icalvalue_new_geo(struct icalgeotype v); | 1320 | icalvalue* icalvalue_new_duration(struct icaldurationtype v); |
970 | struct icalgeotype icalvalue_get_geo(icalvalue* value); | 1321 | struct icaldurationtype icalvalue_get_duration(const icalvalue* value); |
971 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); | 1322 | void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v); |
972 | 1323 | ||
973 | 1324 | ||
974 | /* DATE-TIME */ | 1325 | /* BOOLEAN */ |
975 | icalvalue* icalvalue_new_datetime(struct icaltimetype v); | 1326 | icalvalue* icalvalue_new_boolean(int v); |
976 | struct icaltimetype icalvalue_get_datetime(icalvalue* value); | 1327 | int icalvalue_get_boolean(const icalvalue* value); |
977 | void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); | 1328 | void icalvalue_set_boolean(icalvalue* value, int v); |
978 | 1329 | ||
979 | 1330 | ||
980 | /* UTC-OFFSET */ | 1331 | /* CAL-ADDRESS */ |
981 | icalvalue* icalvalue_new_utcoffset(int v); | 1332 | icalvalue* icalvalue_new_caladdress(const char* v); |
982 | int icalvalue_get_utcoffset(icalvalue* value); | 1333 | const char* icalvalue_get_caladdress(const icalvalue* value); |
983 | void icalvalue_set_utcoffset(icalvalue* value, int v); | 1334 | void icalvalue_set_caladdress(icalvalue* value, const char* v); |
1335 | |||
1336 | |||
1337 | /* X-LIC-CLASS */ | ||
1338 | icalvalue* icalvalue_new_xlicclass(enum icalproperty_xlicclass v); | ||
1339 | enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value); | ||
1340 | void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v); | ||
984 | 1341 | ||
985 | 1342 | ||
986 | /* ACTION */ | 1343 | /* ACTION */ |
987 | icalvalue* icalvalue_new_action(enum icalproperty_action v); | 1344 | icalvalue* icalvalue_new_action(enum icalproperty_action v); |
988 | enum icalproperty_action icalvalue_get_action(icalvalue* value); | 1345 | enum icalproperty_action icalvalue_get_action(const icalvalue* value); |
989 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v); | 1346 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v); |
990 | 1347 | ||
991 | 1348 | ||
992 | /* CAL-ADDRESS */ | 1349 | /* DATE-TIME */ |
993 | icalvalue* icalvalue_new_caladdress(const char* v); | 1350 | icalvalue* icalvalue_new_datetime(struct icaltimetype v); |
994 | const char* icalvalue_get_caladdress(icalvalue* value); | 1351 | struct icaltimetype icalvalue_get_datetime(const icalvalue* value); |
995 | void icalvalue_set_caladdress(icalvalue* value, const char* v); | 1352 | void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); |
996 | |||
997 | |||
998 | /* FLOAT */ | ||
999 | icalvalue* icalvalue_new_float(float v); | ||
1000 | float icalvalue_get_float(icalvalue* value); | ||
1001 | void icalvalue_set_float(icalvalue* value, float v); | ||
1002 | 1353 | ||
1003 | 1354 | ||
1004 | /* REQUEST-STATUS */ | 1355 | /* UTC-OFFSET */ |
1005 | icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v); | 1356 | icalvalue* icalvalue_new_utcoffset(int v); |
1006 | struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value); | 1357 | int icalvalue_get_utcoffset(const icalvalue* value); |
1007 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v); | 1358 | void icalvalue_set_utcoffset(icalvalue* value, int v); |
1008 | 1359 | ||
1009 | 1360 | ||
1010 | /* METHOD */ | 1361 | /* METHOD */ |
1011 | icalvalue* icalvalue_new_method(enum icalproperty_method v); | 1362 | icalvalue* icalvalue_new_method(enum icalproperty_method v); |
1012 | enum icalproperty_method icalvalue_get_method(icalvalue* value); | 1363 | enum icalproperty_method icalvalue_get_method(const icalvalue* value); |
1013 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v); | 1364 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v); |
1014 | 1365 | ||
1015 | |||
1016 | /* BINARY */ | ||
1017 | icalvalue* icalvalue_new_binary(const char* v); | ||
1018 | const char* icalvalue_get_binary(icalvalue* value); | ||
1019 | void icalvalue_set_binary(icalvalue* value, const char* v); | ||
1020 | |||
1021 | #endif /*ICALVALUE_H*/ | 1366 | #endif /*ICALVALUE_H*/ |
1022 | /* -*- Mode: C -*- */ | 1367 | /* -*- Mode: C -*- */ |
1023 | /*====================================================================== | 1368 | /*====================================================================== |
@@ -1025,8 +1370,6 @@ void icalvalue_set_binary(icalvalue* value, const char* v); | |||
1025 | CREATOR: eric 20 March 1999 | 1370 | CREATOR: eric 20 March 1999 |
1026 | 1371 | ||
1027 | 1372 | ||
1028 | $Id$ | ||
1029 | $Locker$ | ||
1030 | 1373 | ||
1031 | 1374 | ||
1032 | 1375 | ||
@@ -1051,12 +1394,11 @@ void icalvalue_set_binary(icalvalue* value, const char* v); | |||
1051 | #define ICALDERIVEDPARAMETER_H | 1394 | #define ICALDERIVEDPARAMETER_H |
1052 | 1395 | ||
1053 | 1396 | ||
1054 | typedef void icalparameter; | 1397 | typedef struct icalparameter_impl icalparameter; |
1055 | 1398 | ||
1056 | const char* icalparameter_enum_to_string(int e); | 1399 | const char* icalparameter_enum_to_string(int e); |
1057 | int icalparameter_string_to_enum(const char* str); | 1400 | int icalparameter_string_to_enum(const char* str); |
1058 | 1401 | ||
1059 | /* Everything below this line is machine generated. Do not edit. */ | ||
1060 | typedef enum icalparameter_kind { | 1402 | typedef enum icalparameter_kind { |
1061 | ICAL_ANY_PARAMETER = 0, | 1403 | ICAL_ANY_PARAMETER = 0, |
1062 | ICAL_ALTREP_PARAMETER, | 1404 | ICAL_ALTREP_PARAMETER, |
@@ -1135,7 +1477,7 @@ typedef enum icalparameter_range { | |||
1135 | typedef enum icalparameter_related { | 1477 | typedef enum icalparameter_related { |
1136 | ICAL_RELATED_X = 20030, | 1478 | ICAL_RELATED_X = 20030, |
1137 | ICAL_RELATED_START = 20031, | 1479 | ICAL_RELATED_START = 20031, |
1138 | ICAL_RELATED_END = 20032, | 1480 | ICAL_RELATED_END = 20032, |
1139 | ICAL_RELATED_NONE = 20033 | 1481 | ICAL_RELATED_NONE = 20033 |
1140 | } icalparameter_related; | 1482 | } icalparameter_related; |
1141 | 1483 | ||
@@ -1191,147 +1533,294 @@ typedef enum icalparameter_xliccomparetype { | |||
1191 | ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070, | 1533 | ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070, |
1192 | ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071, | 1534 | ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071, |
1193 | ICAL_XLICCOMPARETYPE_REGEX = 20072, | 1535 | ICAL_XLICCOMPARETYPE_REGEX = 20072, |
1194 | ICAL_XLICCOMPARETYPE_NONE = 20073 | 1536 | ICAL_XLICCOMPARETYPE_ISNULL = 20073, |
1537 | ICAL_XLICCOMPARETYPE_ISNOTNULL = 20074, | ||
1538 | ICAL_XLICCOMPARETYPE_NONE = 20075 | ||
1195 | } icalparameter_xliccomparetype; | 1539 | } icalparameter_xliccomparetype; |
1196 | 1540 | ||
1197 | typedef enum icalparameter_xlicerrortype { | 1541 | typedef enum icalparameter_xlicerrortype { |
1198 | ICAL_XLICERRORTYPE_X = 20074, | 1542 | ICAL_XLICERRORTYPE_X = 20076, |
1199 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075, | 1543 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20077, |
1200 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076, | 1544 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20078, |
1201 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077, | 1545 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20079, |
1202 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078, | 1546 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20080, |
1203 | ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079, | 1547 | ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20081, |
1204 | ICAL_XLICERRORTYPE_INVALIDITIP = 20080, | 1548 | ICAL_XLICERRORTYPE_INVALIDITIP = 20082, |
1205 | ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081, | 1549 | ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20083, |
1206 | ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082, | 1550 | ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20084, |
1207 | ICAL_XLICERRORTYPE_NONE = 20083 | 1551 | ICAL_XLICERRORTYPE_VCALPROPPARSEERROR = 20085, |
1552 | ICAL_XLICERRORTYPE_NONE = 20086 | ||
1208 | } icalparameter_xlicerrortype; | 1553 | } icalparameter_xlicerrortype; |
1209 | 1554 | ||
1210 | #define ICALPARAMETER_LAST_ENUM 20084 | 1555 | #define ICALPARAMETER_LAST_ENUM 20087 |
1211 | 1556 | ||
1212 | /* DELEGATED-FROM */ | 1557 | /* LANGUAGE */ |
1213 | icalparameter* icalparameter_new_delegatedfrom(const char* v); | 1558 | icalparameter* icalparameter_new_language(const char* v); |
1214 | const char* icalparameter_get_delegatedfrom(icalparameter* value); | 1559 | const char* icalparameter_get_language(const icalparameter* value); |
1215 | void icalparameter_set_delegatedfrom(icalparameter* value, const char* v); | 1560 | void icalparameter_set_language(icalparameter* value, const char* v); |
1216 | |||
1217 | /* DELEGATED-TO */ | ||
1218 | icalparameter* icalparameter_new_delegatedto(const char* v); | ||
1219 | const char* icalparameter_get_delegatedto(icalparameter* value); | ||
1220 | void icalparameter_set_delegatedto(icalparameter* value, const char* v); | ||
1221 | |||
1222 | /* RANGE */ | ||
1223 | icalparameter* icalparameter_new_range(icalparameter_range v); | ||
1224 | icalparameter_range icalparameter_get_range(icalparameter* value); | ||
1225 | void icalparameter_set_range(icalparameter* value, icalparameter_range v); | ||
1226 | |||
1227 | /* ENCODING */ | ||
1228 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v); | ||
1229 | icalparameter_encoding icalparameter_get_encoding(icalparameter* value); | ||
1230 | void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v); | ||
1231 | |||
1232 | /* RSVP */ | ||
1233 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v); | ||
1234 | icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value); | ||
1235 | void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v); | ||
1236 | 1561 | ||
1237 | /* PARTSTAT */ | 1562 | /* DIR */ |
1238 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v); | 1563 | icalparameter* icalparameter_new_dir(const char* v); |
1239 | icalparameter_partstat icalparameter_get_partstat(icalparameter* value); | 1564 | const char* icalparameter_get_dir(const icalparameter* value); |
1240 | void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v); | 1565 | void icalparameter_set_dir(icalparameter* value, const char* v); |
1241 | 1566 | ||
1242 | /* RELTYPE */ | 1567 | /* RELTYPE */ |
1243 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v); | 1568 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v); |
1244 | icalparameter_reltype icalparameter_get_reltype(icalparameter* value); | 1569 | icalparameter_reltype icalparameter_get_reltype(const icalparameter* value); |
1245 | void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v); | 1570 | void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v); |
1246 | 1571 | ||
1247 | /* CUTYPE */ | ||
1248 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v); | ||
1249 | icalparameter_cutype icalparameter_get_cutype(icalparameter* value); | ||
1250 | void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v); | ||
1251 | |||
1252 | /* MEMBER */ | ||
1253 | icalparameter* icalparameter_new_member(const char* v); | ||
1254 | const char* icalparameter_get_member(icalparameter* value); | ||
1255 | void icalparameter_set_member(icalparameter* value, const char* v); | ||
1256 | |||
1257 | /* FMTTYPE */ | 1572 | /* FMTTYPE */ |
1258 | icalparameter* icalparameter_new_fmttype(const char* v); | 1573 | icalparameter* icalparameter_new_fmttype(const char* v); |
1259 | const char* icalparameter_get_fmttype(icalparameter* value); | 1574 | const char* icalparameter_get_fmttype(const icalparameter* value); |
1260 | void icalparameter_set_fmttype(icalparameter* value, const char* v); | 1575 | void icalparameter_set_fmttype(icalparameter* value, const char* v); |
1261 | 1576 | ||
1262 | /* SENT-BY */ | 1577 | /* TZID */ |
1263 | icalparameter* icalparameter_new_sentby(const char* v); | 1578 | icalparameter* icalparameter_new_tzid(const char* v); |
1264 | const char* icalparameter_get_sentby(icalparameter* value); | 1579 | const char* icalparameter_get_tzid(const icalparameter* value); |
1265 | void icalparameter_set_sentby(icalparameter* value, const char* v); | 1580 | void icalparameter_set_tzid(icalparameter* value, const char* v); |
1581 | |||
1582 | /* RANGE */ | ||
1583 | icalparameter* icalparameter_new_range(icalparameter_range v); | ||
1584 | icalparameter_range icalparameter_get_range(const icalparameter* value); | ||
1585 | void icalparameter_set_range(icalparameter* value, icalparameter_range v); | ||
1586 | |||
1587 | /* DELEGATED-TO */ | ||
1588 | icalparameter* icalparameter_new_delegatedto(const char* v); | ||
1589 | const char* icalparameter_get_delegatedto(const icalparameter* value); | ||
1590 | void icalparameter_set_delegatedto(icalparameter* value, const char* v); | ||
1591 | |||
1592 | /* CN */ | ||
1593 | icalparameter* icalparameter_new_cn(const char* v); | ||
1594 | const char* icalparameter_get_cn(const icalparameter* value); | ||
1595 | void icalparameter_set_cn(icalparameter* value, const char* v); | ||
1266 | 1596 | ||
1267 | /* VALUE */ | 1597 | /* VALUE */ |
1268 | icalparameter* icalparameter_new_value(icalparameter_value v); | 1598 | icalparameter* icalparameter_new_value(icalparameter_value v); |
1269 | icalparameter_value icalparameter_get_value(icalparameter* value); | 1599 | icalparameter_value icalparameter_get_value(const icalparameter* value); |
1270 | void icalparameter_set_value(icalparameter* value, icalparameter_value v); | 1600 | void icalparameter_set_value(icalparameter* value, icalparameter_value v); |
1271 | 1601 | ||
1272 | /* ALTREP */ | 1602 | /* X-LIC-COMPARETYPE */ |
1273 | icalparameter* icalparameter_new_altrep(const char* v); | 1603 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v); |
1274 | const char* icalparameter_get_altrep(icalparameter* value); | 1604 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* value); |
1275 | void icalparameter_set_altrep(icalparameter* value, const char* v); | 1605 | void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v); |
1276 | 1606 | ||
1277 | /* DIR */ | 1607 | /* X */ |
1278 | icalparameter* icalparameter_new_dir(const char* v); | 1608 | icalparameter* icalparameter_new_x(const char* v); |
1279 | const char* icalparameter_get_dir(icalparameter* value); | 1609 | const char* icalparameter_get_x(const icalparameter* value); |
1280 | void icalparameter_set_dir(icalparameter* value, const char* v); | 1610 | void icalparameter_set_x(icalparameter* value, const char* v); |
1281 | 1611 | ||
1282 | /* RELATED */ | 1612 | /* SENT-BY */ |
1283 | icalparameter* icalparameter_new_related(icalparameter_related v); | 1613 | icalparameter* icalparameter_new_sentby(const char* v); |
1284 | icalparameter_related icalparameter_get_related(icalparameter* value); | 1614 | const char* icalparameter_get_sentby(const icalparameter* value); |
1285 | void icalparameter_set_related(icalparameter* value, icalparameter_related v); | 1615 | void icalparameter_set_sentby(icalparameter* value, const char* v); |
1286 | 1616 | ||
1287 | /* CN */ | 1617 | /* MEMBER */ |
1288 | icalparameter* icalparameter_new_cn(const char* v); | 1618 | icalparameter* icalparameter_new_member(const char* v); |
1289 | const char* icalparameter_get_cn(icalparameter* value); | 1619 | const char* icalparameter_get_member(const icalparameter* value); |
1290 | void icalparameter_set_cn(icalparameter* value, const char* v); | 1620 | void icalparameter_set_member(icalparameter* value, const char* v); |
1621 | |||
1622 | /* RSVP */ | ||
1623 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v); | ||
1624 | icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* value); | ||
1625 | void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v); | ||
1626 | |||
1627 | /* CUTYPE */ | ||
1628 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v); | ||
1629 | icalparameter_cutype icalparameter_get_cutype(const icalparameter* value); | ||
1630 | void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v); | ||
1291 | 1631 | ||
1292 | /* X-LIC-ERRORTYPE */ | 1632 | /* X-LIC-ERRORTYPE */ |
1293 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v); | 1633 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v); |
1294 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value); | 1634 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* value); |
1295 | void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v); | 1635 | void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v); |
1296 | 1636 | ||
1297 | /* X */ | 1637 | /* RELATED */ |
1298 | icalparameter* icalparameter_new_x(const char* v); | 1638 | icalparameter* icalparameter_new_related(icalparameter_related v); |
1299 | const char* icalparameter_get_x(icalparameter* value); | 1639 | icalparameter_related icalparameter_get_related(const icalparameter* value); |
1300 | void icalparameter_set_x(icalparameter* value, const char* v); | 1640 | void icalparameter_set_related(icalparameter* value, icalparameter_related v); |
1301 | 1641 | ||
1302 | /* LANGUAGE */ | 1642 | /* ENCODING */ |
1303 | icalparameter* icalparameter_new_language(const char* v); | 1643 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v); |
1304 | const char* icalparameter_get_language(icalparameter* value); | 1644 | icalparameter_encoding icalparameter_get_encoding(const icalparameter* value); |
1305 | void icalparameter_set_language(icalparameter* value, const char* v); | 1645 | void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v); |
1306 | 1646 | ||
1307 | /* ROLE */ | 1647 | /* ALTREP */ |
1308 | icalparameter* icalparameter_new_role(icalparameter_role v); | 1648 | icalparameter* icalparameter_new_altrep(const char* v); |
1309 | icalparameter_role icalparameter_get_role(icalparameter* value); | 1649 | const char* icalparameter_get_altrep(const icalparameter* value); |
1310 | void icalparameter_set_role(icalparameter* value, icalparameter_role v); | 1650 | void icalparameter_set_altrep(icalparameter* value, const char* v); |
1311 | 1651 | ||
1312 | /* X-LIC-COMPARETYPE */ | 1652 | /* DELEGATED-FROM */ |
1313 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v); | 1653 | icalparameter* icalparameter_new_delegatedfrom(const char* v); |
1314 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value); | 1654 | const char* icalparameter_get_delegatedfrom(const icalparameter* value); |
1315 | void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v); | 1655 | void icalparameter_set_delegatedfrom(icalparameter* value, const char* v); |
1316 | 1656 | ||
1317 | /* FBTYPE */ | 1657 | /* FBTYPE */ |
1318 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v); | 1658 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v); |
1319 | icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value); | 1659 | icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* value); |
1320 | void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v); | 1660 | void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v); |
1321 | 1661 | ||
1322 | /* TZID */ | 1662 | /* ROLE */ |
1323 | icalparameter* icalparameter_new_tzid(const char* v); | 1663 | icalparameter* icalparameter_new_role(icalparameter_role v); |
1324 | const char* icalparameter_get_tzid(icalparameter* value); | 1664 | icalparameter_role icalparameter_get_role(const icalparameter* value); |
1325 | void icalparameter_set_tzid(icalparameter* value, const char* v); | 1665 | void icalparameter_set_role(icalparameter* value, icalparameter_role v); |
1666 | |||
1667 | /* PARTSTAT */ | ||
1668 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v); | ||
1669 | icalparameter_partstat icalparameter_get_partstat(const icalparameter* value); | ||
1670 | void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v); | ||
1326 | 1671 | ||
1327 | #endif /*ICALPARAMETER_H*/ | 1672 | #endif /*ICALPARAMETER_H*/ |
1328 | 1673 | ||
1674 | /* Everything below this line is machine generated. Do not edit. */ | ||
1675 | /* -*- Mode: C -*- */ | ||
1676 | /*====================================================================== | ||
1677 | FILE: icalvalue.h | ||
1678 | CREATOR: eric 20 March 1999 | ||
1679 | |||
1680 | |||
1681 | |||
1682 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
1683 | |||
1684 | This program is free software; you can redistribute it and/or modify | ||
1685 | it under the terms of either: | ||
1686 | |||
1687 | The LGPL as published by the Free Software Foundation, version | ||
1688 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1689 | |||
1690 | Or: | ||
1691 | |||
1692 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
1693 | the License at http://www.mozilla.org/MPL/ | ||
1694 | |||
1695 | The original code is icalvalue.h | ||
1696 | |||
1697 | ======================================================================*/ | ||
1698 | |||
1699 | #ifndef ICALVALUE_H | ||
1700 | #define ICALVALUE_H | ||
1701 | |||
1702 | #include <time.h> | ||
1703 | |||
1704 | /* Defined in icalderivedvalue.h */ | ||
1705 | /*typedef struct icalvalue_impl icalvalue;*/ | ||
1706 | |||
1707 | icalvalue* icalvalue_new(icalvalue_kind kind); | ||
1708 | |||
1709 | icalvalue* icalvalue_new_clone(const icalvalue* value); | ||
1710 | |||
1711 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str); | ||
1712 | |||
1713 | void icalvalue_free(icalvalue* value); | ||
1714 | |||
1715 | int icalvalue_is_valid(const icalvalue* value); | ||
1716 | |||
1717 | const char* icalvalue_as_ical_string(const icalvalue* value); | ||
1718 | |||
1719 | icalvalue_kind icalvalue_isa(const icalvalue* value); | ||
1720 | |||
1721 | int icalvalue_isa_value(void*); | ||
1722 | |||
1723 | icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalvalue *b); | ||
1724 | |||
1725 | |||
1726 | /* Special, non autogenerated value accessors */ | ||
1727 | |||
1728 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); | ||
1729 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); | ||
1730 | struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); | ||
1731 | |||
1732 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); | ||
1733 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); | ||
1734 | struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); | ||
1735 | |||
1736 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); | ||
1737 | void icalvalue_set_datetimeperiod(icalvalue* value, | ||
1738 | struct icaldatetimeperiodtype v); | ||
1739 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); | ||
1740 | |||
1741 | /* Convert enumerations */ | ||
1742 | |||
1743 | icalvalue_kind icalvalue_string_to_kind(const char* str); | ||
1744 | const char* icalvalue_kind_to_string(const icalvalue_kind kind); | ||
1745 | |||
1746 | /** Check validity of a specific icalvalue_kind **/ | ||
1747 | int icalvalue_kind_is_valid(const icalvalue_kind kind); | ||
1748 | |||
1749 | /** Encode a character string in ical format, esacpe certain characters, etc. */ | ||
1750 | int icalvalue_encode_ical_string(const char *szText, char *szEncText, int MaxBufferLen); | ||
1751 | |||
1752 | #endif /*ICALVALUE_H*/ | ||
1753 | /* -*- Mode: C -*- */ | ||
1754 | /*====================================================================== | ||
1755 | FILE: icalparam.h | ||
1756 | CREATOR: eric 20 March 1999 | ||
1757 | |||
1758 | |||
1759 | |||
1760 | |||
1761 | |||
1762 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
1763 | |||
1764 | This program is free software; you can redistribute it and/or modify | ||
1765 | it under the terms of either: | ||
1766 | |||
1767 | The LGPL as published by the Free Software Foundation, version | ||
1768 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1769 | |||
1770 | Or: | ||
1771 | |||
1772 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
1773 | the License at http://www.mozilla.org/MPL/ | ||
1774 | |||
1775 | The original code is icalparam.h | ||
1776 | |||
1777 | ======================================================================*/ | ||
1778 | |||
1779 | #ifndef ICALPARAM_H | ||
1780 | #define ICALPARAM_H | ||
1781 | |||
1782 | |||
1783 | /* Declared in icalderivedparameter.h */ | ||
1784 | /*typedef struct icalparameter_impl icalparameter;*/ | ||
1785 | |||
1786 | icalparameter* icalparameter_new(icalparameter_kind kind); | ||
1787 | icalparameter* icalparameter_new_clone(icalparameter* p); | ||
1788 | |||
1789 | /* Create from string of form "PARAMNAME=VALUE" */ | ||
1790 | icalparameter* icalparameter_new_from_string(const char* value); | ||
1791 | |||
1792 | /* Create from just the value, the part after the "=" */ | ||
1793 | icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value); | ||
1794 | |||
1795 | void icalparameter_free(icalparameter* parameter); | ||
1796 | |||
1797 | char* icalparameter_as_ical_string(icalparameter* parameter); | ||
1798 | |||
1799 | int icalparameter_is_valid(icalparameter* parameter); | ||
1800 | |||
1801 | icalparameter_kind icalparameter_isa(icalparameter* parameter); | ||
1802 | |||
1803 | int icalparameter_isa_parameter(void* param); | ||
1804 | |||
1805 | /* Acess the name of an X parameer */ | ||
1806 | void icalparameter_set_xname (icalparameter* param, const char* v); | ||
1807 | const char* icalparameter_get_xname(icalparameter* param); | ||
1808 | void icalparameter_set_xvalue (icalparameter* param, const char* v); | ||
1809 | const char* icalparameter_get_xvalue(icalparameter* param); | ||
1810 | |||
1811 | /* Convert enumerations */ | ||
1812 | |||
1813 | const char* icalparameter_kind_to_string(icalparameter_kind kind); | ||
1814 | icalparameter_kind icalparameter_string_to_kind(const char* string); | ||
1815 | |||
1816 | |||
1817 | |||
1818 | #endif | ||
1329 | /* -*- Mode: C -*- | 1819 | /* -*- Mode: C -*- |
1330 | ====================================================================== | 1820 | ====================================================================== |
1331 | FILE: icalderivedproperties.{c,h} | 1821 | FILE: icalderivedproperties.{c,h} |
1332 | CREATOR: eric 09 May 1999 | 1822 | CREATOR: eric 09 May 1999 |
1333 | 1823 | ||
1334 | $Id$ | ||
1335 | 1824 | ||
1336 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 1825 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
1337 | ======================================================================*/ | 1826 | ======================================================================*/ |
@@ -1342,22 +1831,28 @@ void icalparameter_set_tzid(icalparameter* value, const char* v); | |||
1342 | 1831 | ||
1343 | #include <time.h> | 1832 | #include <time.h> |
1344 | 1833 | ||
1345 | typedef void icalproperty; | 1834 | typedef struct icalproperty_impl icalproperty; |
1346 | 1835 | ||
1347 | |||
1348 | /* Everything below this line is machine generated. Do not edit. */ | ||
1349 | typedef enum icalproperty_kind { | 1836 | typedef enum icalproperty_kind { |
1350 | ICAL_ANY_PROPERTY = 0, | 1837 | ICAL_ANY_PROPERTY = 0, |
1351 | ICAL_ACTION_PROPERTY, | 1838 | ICAL_ACTION_PROPERTY, |
1839 | ICAL_ALLOWCONFLICT_PROPERTY, | ||
1352 | ICAL_ATTACH_PROPERTY, | 1840 | ICAL_ATTACH_PROPERTY, |
1353 | ICAL_ATTENDEE_PROPERTY, | 1841 | ICAL_ATTENDEE_PROPERTY, |
1842 | ICAL_CALID_PROPERTY, | ||
1843 | ICAL_CALMASTER_PROPERTY, | ||
1354 | ICAL_CALSCALE_PROPERTY, | 1844 | ICAL_CALSCALE_PROPERTY, |
1845 | ICAL_CARID_PROPERTY, | ||
1355 | ICAL_CATEGORIES_PROPERTY, | 1846 | ICAL_CATEGORIES_PROPERTY, |
1356 | ICAL_CLASS_PROPERTY, | 1847 | ICAL_CLASS_PROPERTY, |
1357 | ICAL_COMMENT_PROPERTY, | 1848 | ICAL_COMMENT_PROPERTY, |
1358 | ICAL_COMPLETED_PROPERTY, | 1849 | ICAL_COMPLETED_PROPERTY, |
1359 | ICAL_CONTACT_PROPERTY, | 1850 | ICAL_CONTACT_PROPERTY, |
1360 | ICAL_CREATED_PROPERTY, | 1851 | ICAL_CREATED_PROPERTY, |
1852 | ICAL_DECREED_PROPERTY, | ||
1853 | ICAL_DEFAULTCHARSET_PROPERTY, | ||
1854 | ICAL_DEFAULTLOCALE_PROPERTY, | ||
1855 | ICAL_DEFAULTTZID_PROPERTY, | ||
1361 | ICAL_DESCRIPTION_PROPERTY, | 1856 | ICAL_DESCRIPTION_PROPERTY, |
1362 | ICAL_DTEND_PROPERTY, | 1857 | ICAL_DTEND_PROPERTY, |
1363 | ICAL_DTSTAMP_PROPERTY, | 1858 | ICAL_DTSTAMP_PROPERTY, |
@@ -1365,6 +1860,7 @@ typedef enum icalproperty_kind { | |||
1365 | ICAL_DUE_PROPERTY, | 1860 | ICAL_DUE_PROPERTY, |
1366 | ICAL_DURATION_PROPERTY, | 1861 | ICAL_DURATION_PROPERTY, |
1367 | ICAL_EXDATE_PROPERTY, | 1862 | ICAL_EXDATE_PROPERTY, |
1863 | ICAL_EXPAND_PROPERTY, | ||
1368 | ICAL_EXRULE_PROPERTY, | 1864 | ICAL_EXRULE_PROPERTY, |
1369 | ICAL_FREEBUSY_PROPERTY, | 1865 | ICAL_FREEBUSY_PROPERTY, |
1370 | ICAL_GEO_PROPERTY, | 1866 | ICAL_GEO_PROPERTY, |
@@ -1374,6 +1870,7 @@ typedef enum icalproperty_kind { | |||
1374 | ICAL_MAXRESULTSSIZE_PROPERTY, | 1870 | ICAL_MAXRESULTSSIZE_PROPERTY, |
1375 | ICAL_METHOD_PROPERTY, | 1871 | ICAL_METHOD_PROPERTY, |
1376 | ICAL_ORGANIZER_PROPERTY, | 1872 | ICAL_ORGANIZER_PROPERTY, |
1873 | ICAL_OWNER_PROPERTY, | ||
1377 | ICAL_PERCENTCOMPLETE_PROPERTY, | 1874 | ICAL_PERCENTCOMPLETE_PROPERTY, |
1378 | ICAL_PRIORITY_PROPERTY, | 1875 | ICAL_PRIORITY_PROPERTY, |
1379 | ICAL_PRODID_PROPERTY, | 1876 | ICAL_PRODID_PROPERTY, |
@@ -1382,6 +1879,7 @@ typedef enum icalproperty_kind { | |||
1382 | ICAL_RDATE_PROPERTY, | 1879 | ICAL_RDATE_PROPERTY, |
1383 | ICAL_RECURRENCEID_PROPERTY, | 1880 | ICAL_RECURRENCEID_PROPERTY, |
1384 | ICAL_RELATEDTO_PROPERTY, | 1881 | ICAL_RELATEDTO_PROPERTY, |
1882 | ICAL_RELCALID_PROPERTY, | ||
1385 | ICAL_REPEAT_PROPERTY, | 1883 | ICAL_REPEAT_PROPERTY, |
1386 | ICAL_REQUESTSTATUS_PROPERTY, | 1884 | ICAL_REQUESTSTATUS_PROPERTY, |
1387 | ICAL_RESOURCES_PROPERTY, | 1885 | ICAL_RESOURCES_PROPERTY, |
@@ -1402,6 +1900,7 @@ typedef enum icalproperty_kind { | |||
1402 | ICAL_URL_PROPERTY, | 1900 | ICAL_URL_PROPERTY, |
1403 | ICAL_VERSION_PROPERTY, | 1901 | ICAL_VERSION_PROPERTY, |
1404 | ICAL_X_PROPERTY, | 1902 | ICAL_X_PROPERTY, |
1903 | ICAL_XLICCLASS_PROPERTY, | ||
1405 | ICAL_XLICCLUSTERCOUNT_PROPERTY, | 1904 | ICAL_XLICCLUSTERCOUNT_PROPERTY, |
1406 | ICAL_XLICERROR_PROPERTY, | 1905 | ICAL_XLICERROR_PROPERTY, |
1407 | ICAL_XLICMIMECHARSET_PROPERTY, | 1906 | ICAL_XLICMIMECHARSET_PROPERTY, |
@@ -1413,472 +1912,385 @@ typedef enum icalproperty_kind { | |||
1413 | ICAL_NO_PROPERTY | 1912 | ICAL_NO_PROPERTY |
1414 | } icalproperty_kind; | 1913 | } icalproperty_kind; |
1415 | 1914 | ||
1416 | icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...); | ||
1417 | 1915 | ||
1418 | /* ACTION */ | 1916 | /* ACTION */ |
1419 | icalproperty* icalproperty_new_action(enum icalproperty_action v); | 1917 | icalproperty* icalproperty_new_action(enum icalproperty_action v); |
1420 | void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v); | 1918 | void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v); |
1421 | enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...); | 1919 | enum icalproperty_action icalproperty_get_action(const icalproperty* prop);icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...); |
1920 | |||
1921 | /* ALLOW-CONFLICT */ | ||
1922 | icalproperty* icalproperty_new_allowconflict(const char* v); | ||
1923 | void icalproperty_set_allowconflict(icalproperty* prop, const char* v); | ||
1924 | const char* icalproperty_get_allowconflict(const icalproperty* prop);icalproperty* icalproperty_vanew_allowconflict(const char* v, ...); | ||
1422 | 1925 | ||
1423 | /* ATTACH */ | 1926 | /* ATTACH */ |
1424 | icalproperty* icalproperty_new_attach(struct icalattachtype* v); | 1927 | icalproperty* icalproperty_new_attach(icalattach * v); |
1425 | void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v); | 1928 | void icalproperty_set_attach(icalproperty* prop, icalattach * v); |
1426 | struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...); | 1929 | icalattach * icalproperty_get_attach(const icalproperty* prop);icalproperty* icalproperty_vanew_attach(icalattach * v, ...); |
1427 | 1930 | ||
1428 | /* ATTENDEE */ | 1931 | /* ATTENDEE */ |
1429 | icalproperty* icalproperty_new_attendee(const char* v); | 1932 | icalproperty* icalproperty_new_attendee(const char* v); |
1430 | void icalproperty_set_attendee(icalproperty* prop, const char* v); | 1933 | void icalproperty_set_attendee(icalproperty* prop, const char* v); |
1431 | const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...); | 1934 | const char* icalproperty_get_attendee(const icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...); |
1935 | |||
1936 | /* CALID */ | ||
1937 | icalproperty* icalproperty_new_calid(const char* v); | ||
1938 | void icalproperty_set_calid(icalproperty* prop, const char* v); | ||
1939 | const char* icalproperty_get_calid(const icalproperty* prop);icalproperty* icalproperty_vanew_calid(const char* v, ...); | ||
1940 | |||
1941 | /* CALMASTER */ | ||
1942 | icalproperty* icalproperty_new_calmaster(const char* v); | ||
1943 | void icalproperty_set_calmaster(icalproperty* prop, const char* v); | ||
1944 | const char* icalproperty_get_calmaster(const icalproperty* prop);icalproperty* icalproperty_vanew_calmaster(const char* v, ...); | ||
1432 | 1945 | ||
1433 | /* CALSCALE */ | 1946 | /* CALSCALE */ |
1434 | icalproperty* icalproperty_new_calscale(const char* v); | 1947 | icalproperty* icalproperty_new_calscale(const char* v); |
1435 | void icalproperty_set_calscale(icalproperty* prop, const char* v); | 1948 | void icalproperty_set_calscale(icalproperty* prop, const char* v); |
1436 | const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...); | 1949 | const char* icalproperty_get_calscale(const icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...); |
1950 | |||
1951 | /* CARID */ | ||
1952 | icalproperty* icalproperty_new_carid(const char* v); | ||
1953 | void icalproperty_set_carid(icalproperty* prop, const char* v); | ||
1954 | const char* icalproperty_get_carid(const icalproperty* prop);icalproperty* icalproperty_vanew_carid(const char* v, ...); | ||
1437 | 1955 | ||
1438 | /* CATEGORIES */ | 1956 | /* CATEGORIES */ |
1439 | icalproperty* icalproperty_new_categories(const char* v); | 1957 | icalproperty* icalproperty_new_categories(const char* v); |
1440 | void icalproperty_set_categories(icalproperty* prop, const char* v); | 1958 | void icalproperty_set_categories(icalproperty* prop, const char* v); |
1441 | const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...); | 1959 | const char* icalproperty_get_categories(const icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...); |
1442 | 1960 | ||
1443 | /* CLASS */ | 1961 | /* CLASS */ |
1444 | icalproperty* icalproperty_new_class(const char* v); | 1962 | icalproperty* icalproperty_new_class(enum icalproperty_class v); |
1445 | void icalproperty_set_class(icalproperty* prop, const char* v); | 1963 | void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v); |
1446 | const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...); | 1964 | enum icalproperty_class icalproperty_get_class(const icalproperty* prop);icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...); |
1447 | 1965 | ||
1448 | /* COMMENT */ | 1966 | /* COMMENT */ |
1449 | icalproperty* icalproperty_new_comment(const char* v); | 1967 | icalproperty* icalproperty_new_comment(const char* v); |
1450 | void icalproperty_set_comment(icalproperty* prop, const char* v); | 1968 | void icalproperty_set_comment(icalproperty* prop, const char* v); |
1451 | const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); | 1969 | const char* icalproperty_get_comment(const icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...); |
1452 | 1970 | ||
1453 | /* COMPLETED */ | 1971 | /* COMPLETED */ |
1454 | icalproperty* icalproperty_new_completed(struct icaltimetype v); | 1972 | icalproperty* icalproperty_new_completed(struct icaltimetype v); |
1455 | void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v); | 1973 | void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v); |
1456 | struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...); | 1974 | struct icaltimetype icalproperty_get_completed(const icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); |
1457 | 1975 | ||
1458 | /* CONTACT */ | 1976 | /* CONTACT */ |
1459 | icalproperty* icalproperty_new_contact(const char* v); | 1977 | icalproperty* icalproperty_new_contact(const char* v); |
1460 | void icalproperty_set_contact(icalproperty* prop, const char* v); | 1978 | void icalproperty_set_contact(icalproperty* prop, const char* v); |
1461 | const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...); | 1979 | const char* icalproperty_get_contact(const icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...); |
1462 | 1980 | ||
1463 | /* CREATED */ | 1981 | /* CREATED */ |
1464 | icalproperty* icalproperty_new_created(struct icaltimetype v); | 1982 | icalproperty* icalproperty_new_created(struct icaltimetype v); |
1465 | void icalproperty_set_created(icalproperty* prop, struct icaltimetype v); | 1983 | void icalproperty_set_created(icalproperty* prop, struct icaltimetype v); |
1466 | struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...); | 1984 | struct icaltimetype icalproperty_get_created(const icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...); |
1985 | |||
1986 | /* DECREED */ | ||
1987 | icalproperty* icalproperty_new_decreed(const char* v); | ||
1988 | void icalproperty_set_decreed(icalproperty* prop, const char* v); | ||
1989 | const char* icalproperty_get_decreed(const icalproperty* prop);icalproperty* icalproperty_vanew_decreed(const char* v, ...); | ||
1990 | |||
1991 | /* DEFAULT-CHARSET */ | ||
1992 | icalproperty* icalproperty_new_defaultcharset(const char* v); | ||
1993 | void icalproperty_set_defaultcharset(icalproperty* prop, const char* v); | ||
1994 | const char* icalproperty_get_defaultcharset(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...); | ||
1995 | |||
1996 | /* DEFAULT-LOCALE */ | ||
1997 | icalproperty* icalproperty_new_defaultlocale(const char* v); | ||
1998 | void icalproperty_set_defaultlocale(icalproperty* prop, const char* v); | ||
1999 | const char* icalproperty_get_defaultlocale(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...); | ||
2000 | |||
2001 | /* DEFAULT-TZID */ | ||
2002 | icalproperty* icalproperty_new_defaulttzid(const char* v); | ||
2003 | void icalproperty_set_defaulttzid(icalproperty* prop, const char* v); | ||
2004 | const char* icalproperty_get_defaulttzid(const icalproperty* prop);icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...); | ||
1467 | 2005 | ||
1468 | /* DESCRIPTION */ | 2006 | /* DESCRIPTION */ |
1469 | icalproperty* icalproperty_new_description(const char* v); | 2007 | icalproperty* icalproperty_new_description(const char* v); |
1470 | void icalproperty_set_description(icalproperty* prop, const char* v); | 2008 | void icalproperty_set_description(icalproperty* prop, const char* v); |
1471 | const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...); | 2009 | const char* icalproperty_get_description(const icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...); |
1472 | 2010 | ||
1473 | /* DTEND */ | 2011 | /* DTEND */ |
1474 | icalproperty* icalproperty_new_dtend(struct icaltimetype v); | 2012 | icalproperty* icalproperty_new_dtend(struct icaltimetype v); |
1475 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v); | 2013 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v); |
1476 | struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...); | 2014 | struct icaltimetype icalproperty_get_dtend(const icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...); |
1477 | 2015 | ||
1478 | /* DTSTAMP */ | 2016 | /* DTSTAMP */ |
1479 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v); | 2017 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v); |
1480 | void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v); | 2018 | void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v); |
1481 | struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...); | 2019 | struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...); |
1482 | 2020 | ||
1483 | /* DTSTART */ | 2021 | /* DTSTART */ |
1484 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v); | 2022 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v); |
1485 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v); | 2023 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v); |
1486 | struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...); | 2024 | struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...); |
1487 | 2025 | ||
1488 | /* DUE */ | 2026 | /* DUE */ |
1489 | icalproperty* icalproperty_new_due(struct icaltimetype v); | 2027 | icalproperty* icalproperty_new_due(struct icaltimetype v); |
1490 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v); | 2028 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v); |
1491 | struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...); | 2029 | struct icaltimetype icalproperty_get_due(const icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...); |
1492 | 2030 | ||
1493 | /* DURATION */ | 2031 | /* DURATION */ |
1494 | icalproperty* icalproperty_new_duration(struct icaldurationtype v); | 2032 | icalproperty* icalproperty_new_duration(struct icaldurationtype v); |
1495 | void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v); | 2033 | void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v); |
1496 | struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...); | 2034 | struct icaldurationtype icalproperty_get_duration(const icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...); |
1497 | 2035 | ||
1498 | /* EXDATE */ | 2036 | /* EXDATE */ |
1499 | icalproperty* icalproperty_new_exdate(struct icaltimetype v); | 2037 | icalproperty* icalproperty_new_exdate(struct icaltimetype v); |
1500 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v); | 2038 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v); |
1501 | struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); | 2039 | struct icaltimetype icalproperty_get_exdate(const icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...); |
2040 | |||
2041 | /* EXPAND */ | ||
2042 | icalproperty* icalproperty_new_expand(int v); | ||
2043 | void icalproperty_set_expand(icalproperty* prop, int v); | ||
2044 | int icalproperty_get_expand(const icalproperty* prop);icalproperty* icalproperty_vanew_expand(int v, ...); | ||
1502 | 2045 | ||
1503 | /* EXRULE */ | 2046 | /* EXRULE */ |
1504 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); | 2047 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); |
1505 | void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v); | 2048 | void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v); |
1506 | struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...); | 2049 | struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); |
1507 | 2050 | ||
1508 | /* FREEBUSY */ | 2051 | /* FREEBUSY */ |
1509 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v); | 2052 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v); |
1510 | void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v); | 2053 | void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v); |
1511 | struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); | 2054 | struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...); |
1512 | 2055 | ||
1513 | /* GEO */ | 2056 | /* GEO */ |
1514 | icalproperty* icalproperty_new_geo(struct icalgeotype v); | 2057 | icalproperty* icalproperty_new_geo(struct icalgeotype v); |
1515 | void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); | 2058 | void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); |
1516 | struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); | 2059 | struct icalgeotype icalproperty_get_geo(const icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); |
1517 | 2060 | ||
1518 | /* LAST-MODIFIED */ | 2061 | /* LAST-MODIFIED */ |
1519 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); | 2062 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); |
1520 | void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v); | 2063 | void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v); |
1521 | struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...); | 2064 | struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); |
1522 | 2065 | ||
1523 | /* LOCATION */ | 2066 | /* LOCATION */ |
1524 | icalproperty* icalproperty_new_location(const char* v); | 2067 | icalproperty* icalproperty_new_location(const char* v); |
1525 | void icalproperty_set_location(icalproperty* prop, const char* v); | 2068 | void icalproperty_set_location(icalproperty* prop, const char* v); |
1526 | const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...); | 2069 | const char* icalproperty_get_location(const icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...); |
1527 | 2070 | ||
1528 | /* MAXRESULTS */ | 2071 | /* MAXRESULTS */ |
1529 | icalproperty* icalproperty_new_maxresults(int v); | 2072 | icalproperty* icalproperty_new_maxresults(int v); |
1530 | void icalproperty_set_maxresults(icalproperty* prop, int v); | 2073 | void icalproperty_set_maxresults(icalproperty* prop, int v); |
1531 | int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...); | 2074 | int icalproperty_get_maxresults(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...); |
1532 | 2075 | ||
1533 | /* MAXRESULTSSIZE */ | 2076 | /* MAXRESULTSSIZE */ |
1534 | icalproperty* icalproperty_new_maxresultssize(int v); | 2077 | icalproperty* icalproperty_new_maxresultssize(int v); |
1535 | void icalproperty_set_maxresultssize(icalproperty* prop, int v); | 2078 | void icalproperty_set_maxresultssize(icalproperty* prop, int v); |
1536 | int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...); | 2079 | int icalproperty_get_maxresultssize(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...); |
1537 | 2080 | ||
1538 | /* METHOD */ | 2081 | /* METHOD */ |
1539 | icalproperty* icalproperty_new_method(enum icalproperty_method v); | 2082 | icalproperty* icalproperty_new_method(enum icalproperty_method v); |
1540 | void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v); | 2083 | void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v); |
1541 | enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...); | 2084 | enum icalproperty_method icalproperty_get_method(const icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...); |
1542 | 2085 | ||
1543 | /* ORGANIZER */ | 2086 | /* ORGANIZER */ |
1544 | icalproperty* icalproperty_new_organizer(const char* v); | 2087 | icalproperty* icalproperty_new_organizer(const char* v); |
1545 | void icalproperty_set_organizer(icalproperty* prop, const char* v); | 2088 | void icalproperty_set_organizer(icalproperty* prop, const char* v); |
1546 | const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...); | 2089 | const char* icalproperty_get_organizer(const icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...); |
2090 | |||
2091 | /* OWNER */ | ||
2092 | icalproperty* icalproperty_new_owner(const char* v); | ||
2093 | void icalproperty_set_owner(icalproperty* prop, const char* v); | ||
2094 | const char* icalproperty_get_owner(const icalproperty* prop);icalproperty* icalproperty_vanew_owner(const char* v, ...); | ||
1547 | 2095 | ||
1548 | /* PERCENT-COMPLETE */ | 2096 | /* PERCENT-COMPLETE */ |
1549 | icalproperty* icalproperty_new_percentcomplete(int v); | 2097 | icalproperty* icalproperty_new_percentcomplete(int v); |
1550 | void icalproperty_set_percentcomplete(icalproperty* prop, int v); | 2098 | void icalproperty_set_percentcomplete(icalproperty* prop, int v); |
1551 | int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...); | 2099 | int icalproperty_get_percentcomplete(const icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...); |
1552 | 2100 | ||
1553 | /* PRIORITY */ | 2101 | /* PRIORITY */ |
1554 | icalproperty* icalproperty_new_priority(int v); | 2102 | icalproperty* icalproperty_new_priority(int v); |
1555 | void icalproperty_set_priority(icalproperty* prop, int v); | 2103 | void icalproperty_set_priority(icalproperty* prop, int v); |
1556 | int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...); | 2104 | int icalproperty_get_priority(const icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...); |
1557 | 2105 | ||
1558 | /* PRODID */ | 2106 | /* PRODID */ |
1559 | icalproperty* icalproperty_new_prodid(const char* v); | 2107 | icalproperty* icalproperty_new_prodid(const char* v); |
1560 | void icalproperty_set_prodid(icalproperty* prop, const char* v); | 2108 | void icalproperty_set_prodid(icalproperty* prop, const char* v); |
1561 | const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...); | 2109 | const char* icalproperty_get_prodid(const icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...); |
1562 | 2110 | ||
1563 | /* QUERY */ | 2111 | /* QUERY */ |
1564 | icalproperty* icalproperty_new_query(const char* v); | 2112 | icalproperty* icalproperty_new_query(const char* v); |
1565 | void icalproperty_set_query(icalproperty* prop, const char* v); | 2113 | void icalproperty_set_query(icalproperty* prop, const char* v); |
1566 | const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...); | 2114 | const char* icalproperty_get_query(const icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...); |
1567 | 2115 | ||
1568 | /* QUERYNAME */ | 2116 | /* QUERYNAME */ |
1569 | icalproperty* icalproperty_new_queryname(const char* v); | 2117 | icalproperty* icalproperty_new_queryname(const char* v); |
1570 | void icalproperty_set_queryname(icalproperty* prop, const char* v); | 2118 | void icalproperty_set_queryname(icalproperty* prop, const char* v); |
1571 | const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...); | 2119 | const char* icalproperty_get_queryname(const icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...); |
1572 | 2120 | ||
1573 | /* RDATE */ | 2121 | /* RDATE */ |
1574 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v); | 2122 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v); |
1575 | void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v); | 2123 | void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v); |
1576 | struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...); | 2124 | struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...); |
1577 | 2125 | ||
1578 | /* RECURRENCE-ID */ | 2126 | /* RECURRENCE-ID */ |
1579 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v); | 2127 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v); |
1580 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v); | 2128 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v); |
1581 | struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...); | 2129 | struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...); |
1582 | 2130 | ||
1583 | /* RELATED-TO */ | 2131 | /* RELATED-TO */ |
1584 | icalproperty* icalproperty_new_relatedto(const char* v); | 2132 | icalproperty* icalproperty_new_relatedto(const char* v); |
1585 | void icalproperty_set_relatedto(icalproperty* prop, const char* v); | 2133 | void icalproperty_set_relatedto(icalproperty* prop, const char* v); |
1586 | const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...); | 2134 | const char* icalproperty_get_relatedto(const icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...); |
2135 | |||
2136 | /* RELCALID */ | ||
2137 | icalproperty* icalproperty_new_relcalid(const char* v); | ||
2138 | void icalproperty_set_relcalid(icalproperty* prop, const char* v); | ||
2139 | const char* icalproperty_get_relcalid(const icalproperty* prop);icalproperty* icalproperty_vanew_relcalid(const char* v, ...); | ||
1587 | 2140 | ||
1588 | /* REPEAT */ | 2141 | /* REPEAT */ |
1589 | icalproperty* icalproperty_new_repeat(int v); | 2142 | icalproperty* icalproperty_new_repeat(int v); |
1590 | void icalproperty_set_repeat(icalproperty* prop, int v); | 2143 | void icalproperty_set_repeat(icalproperty* prop, int v); |
1591 | int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...); | 2144 | int icalproperty_get_repeat(const icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...); |
1592 | 2145 | ||
1593 | /* REQUEST-STATUS */ | 2146 | /* REQUEST-STATUS */ |
1594 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v); | 2147 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v); |
1595 | void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v); | 2148 | void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v); |
1596 | struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...); | 2149 | struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...); |
1597 | 2150 | ||
1598 | /* RESOURCES */ | 2151 | /* RESOURCES */ |
1599 | icalproperty* icalproperty_new_resources(const char* v); | 2152 | icalproperty* icalproperty_new_resources(const char* v); |
1600 | void icalproperty_set_resources(icalproperty* prop, const char* v); | 2153 | void icalproperty_set_resources(icalproperty* prop, const char* v); |
1601 | const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...); | 2154 | const char* icalproperty_get_resources(const icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...); |
1602 | 2155 | ||
1603 | /* RRULE */ | 2156 | /* RRULE */ |
1604 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v); | 2157 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v); |
1605 | void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v); | 2158 | void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v); |
1606 | struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...); | 2159 | struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...); |
1607 | 2160 | ||
1608 | /* SCOPE */ | 2161 | /* SCOPE */ |
1609 | icalproperty* icalproperty_new_scope(const char* v); | 2162 | icalproperty* icalproperty_new_scope(const char* v); |
1610 | void icalproperty_set_scope(icalproperty* prop, const char* v); | 2163 | void icalproperty_set_scope(icalproperty* prop, const char* v); |
1611 | const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...); | 2164 | const char* icalproperty_get_scope(const icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...); |
1612 | 2165 | ||
1613 | /* SEQUENCE */ | 2166 | /* SEQUENCE */ |
1614 | icalproperty* icalproperty_new_sequence(int v); | 2167 | icalproperty* icalproperty_new_sequence(int v); |
1615 | void icalproperty_set_sequence(icalproperty* prop, int v); | 2168 | void icalproperty_set_sequence(icalproperty* prop, int v); |
1616 | int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...); | 2169 | int icalproperty_get_sequence(const icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...); |
1617 | 2170 | ||
1618 | /* STATUS */ | 2171 | /* STATUS */ |
1619 | icalproperty* icalproperty_new_status(enum icalproperty_status v); | 2172 | icalproperty* icalproperty_new_status(enum icalproperty_status v); |
1620 | void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v); | 2173 | void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v); |
1621 | enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...); | 2174 | enum icalproperty_status icalproperty_get_status(const icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...); |
1622 | 2175 | ||
1623 | /* SUMMARY */ | 2176 | /* SUMMARY */ |
1624 | icalproperty* icalproperty_new_summary(const char* v); | 2177 | icalproperty* icalproperty_new_summary(const char* v); |
1625 | void icalproperty_set_summary(icalproperty* prop, const char* v); | 2178 | void icalproperty_set_summary(icalproperty* prop, const char* v); |
1626 | const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...); | 2179 | const char* icalproperty_get_summary(const icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...); |
1627 | 2180 | ||
1628 | /* TARGET */ | 2181 | /* TARGET */ |
1629 | icalproperty* icalproperty_new_target(const char* v); | 2182 | icalproperty* icalproperty_new_target(const char* v); |
1630 | void icalproperty_set_target(icalproperty* prop, const char* v); | 2183 | void icalproperty_set_target(icalproperty* prop, const char* v); |
1631 | const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...); | 2184 | const char* icalproperty_get_target(const icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...); |
1632 | 2185 | ||
1633 | /* TRANSP */ | 2186 | /* TRANSP */ |
1634 | icalproperty* icalproperty_new_transp(const char* v); | 2187 | icalproperty* icalproperty_new_transp(enum icalproperty_transp v); |
1635 | void icalproperty_set_transp(icalproperty* prop, const char* v); | 2188 | void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v); |
1636 | const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...); | 2189 | enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop);icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...); |
1637 | 2190 | ||
1638 | /* TRIGGER */ | 2191 | /* TRIGGER */ |
1639 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v); | 2192 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v); |
1640 | void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v); | 2193 | void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v); |
1641 | struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...); | 2194 | struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...); |
1642 | 2195 | ||
1643 | /* TZID */ | 2196 | /* TZID */ |
1644 | icalproperty* icalproperty_new_tzid(const char* v); | 2197 | icalproperty* icalproperty_new_tzid(const char* v); |
1645 | void icalproperty_set_tzid(icalproperty* prop, const char* v); | 2198 | void icalproperty_set_tzid(icalproperty* prop, const char* v); |
1646 | const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...); | 2199 | const char* icalproperty_get_tzid(const icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...); |
1647 | 2200 | ||
1648 | /* TZNAME */ | 2201 | /* TZNAME */ |
1649 | icalproperty* icalproperty_new_tzname(const char* v); | 2202 | icalproperty* icalproperty_new_tzname(const char* v); |
1650 | void icalproperty_set_tzname(icalproperty* prop, const char* v); | 2203 | void icalproperty_set_tzname(icalproperty* prop, const char* v); |
1651 | const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...); | 2204 | const char* icalproperty_get_tzname(const icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...); |
1652 | 2205 | ||
1653 | /* TZOFFSETFROM */ | 2206 | /* TZOFFSETFROM */ |
1654 | icalproperty* icalproperty_new_tzoffsetfrom(int v); | 2207 | icalproperty* icalproperty_new_tzoffsetfrom(int v); |
1655 | void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v); | 2208 | void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v); |
1656 | int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); | 2209 | int icalproperty_get_tzoffsetfrom(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...); |
1657 | 2210 | ||
1658 | /* TZOFFSETTO */ | 2211 | /* TZOFFSETTO */ |
1659 | icalproperty* icalproperty_new_tzoffsetto(int v); | 2212 | icalproperty* icalproperty_new_tzoffsetto(int v); |
1660 | void icalproperty_set_tzoffsetto(icalproperty* prop, int v); | 2213 | void icalproperty_set_tzoffsetto(icalproperty* prop, int v); |
1661 | int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...); | 2214 | int icalproperty_get_tzoffsetto(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); |
1662 | 2215 | ||
1663 | /* TZURL */ | 2216 | /* TZURL */ |
1664 | icalproperty* icalproperty_new_tzurl(const char* v); | 2217 | icalproperty* icalproperty_new_tzurl(const char* v); |
1665 | void icalproperty_set_tzurl(icalproperty* prop, const char* v); | 2218 | void icalproperty_set_tzurl(icalproperty* prop, const char* v); |
1666 | const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...); | 2219 | const char* icalproperty_get_tzurl(const icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...); |
1667 | 2220 | ||
1668 | /* UID */ | 2221 | /* UID */ |
1669 | icalproperty* icalproperty_new_uid(const char* v); | 2222 | icalproperty* icalproperty_new_uid(const char* v); |
1670 | void icalproperty_set_uid(icalproperty* prop, const char* v); | 2223 | void icalproperty_set_uid(icalproperty* prop, const char* v); |
1671 | const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...); | 2224 | const char* icalproperty_get_uid(const icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...); |
1672 | 2225 | ||
1673 | /* URL */ | 2226 | /* URL */ |
1674 | icalproperty* icalproperty_new_url(const char* v); | 2227 | icalproperty* icalproperty_new_url(const char* v); |
1675 | void icalproperty_set_url(icalproperty* prop, const char* v); | 2228 | void icalproperty_set_url(icalproperty* prop, const char* v); |
1676 | const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...); | 2229 | const char* icalproperty_get_url(const icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...); |
1677 | 2230 | ||
1678 | /* VERSION */ | 2231 | /* VERSION */ |
1679 | icalproperty* icalproperty_new_version(const char* v); | 2232 | icalproperty* icalproperty_new_version(const char* v); |
1680 | void icalproperty_set_version(icalproperty* prop, const char* v); | 2233 | void icalproperty_set_version(icalproperty* prop, const char* v); |
1681 | const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...); | 2234 | const char* icalproperty_get_version(const icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...); |
1682 | 2235 | ||
1683 | /* X */ | 2236 | /* X */ |
1684 | icalproperty* icalproperty_new_x(const char* v); | 2237 | icalproperty* icalproperty_new_x(const char* v); |
1685 | void icalproperty_set_x(icalproperty* prop, const char* v); | 2238 | void icalproperty_set_x(icalproperty* prop, const char* v); |
1686 | const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...); | 2239 | const char* icalproperty_get_x(const icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...); |
2240 | |||
2241 | /* X-LIC-CLASS */ | ||
2242 | icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v); | ||
2243 | void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v); | ||
2244 | enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...); | ||
1687 | 2245 | ||
1688 | /* X-LIC-CLUSTERCOUNT */ | 2246 | /* X-LIC-CLUSTERCOUNT */ |
1689 | icalproperty* icalproperty_new_xlicclustercount(const char* v); | 2247 | icalproperty* icalproperty_new_xlicclustercount(const char* v); |
1690 | void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v); | 2248 | void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v); |
1691 | const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...); | 2249 | const char* icalproperty_get_xlicclustercount(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...); |
1692 | 2250 | ||
1693 | /* X-LIC-ERROR */ | 2251 | /* X-LIC-ERROR */ |
1694 | icalproperty* icalproperty_new_xlicerror(const char* v); | 2252 | icalproperty* icalproperty_new_xlicerror(const char* v); |
1695 | void icalproperty_set_xlicerror(icalproperty* prop, const char* v); | 2253 | void icalproperty_set_xlicerror(icalproperty* prop, const char* v); |
1696 | const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...); | 2254 | const char* icalproperty_get_xlicerror(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...); |
1697 | 2255 | ||
1698 | /* X-LIC-MIMECHARSET */ | 2256 | /* X-LIC-MIMECHARSET */ |
1699 | icalproperty* icalproperty_new_xlicmimecharset(const char* v); | 2257 | icalproperty* icalproperty_new_xlicmimecharset(const char* v); |
1700 | void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v); | 2258 | void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v); |
1701 | const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...); | 2259 | const char* icalproperty_get_xlicmimecharset(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...); |
1702 | 2260 | ||
1703 | /* X-LIC-MIMECID */ | 2261 | /* X-LIC-MIMECID */ |
1704 | icalproperty* icalproperty_new_xlicmimecid(const char* v); | 2262 | icalproperty* icalproperty_new_xlicmimecid(const char* v); |
1705 | void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v); | 2263 | void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v); |
1706 | const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...); | 2264 | const char* icalproperty_get_xlicmimecid(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...); |
1707 | 2265 | ||
1708 | /* X-LIC-MIMECONTENTTYPE */ | 2266 | /* X-LIC-MIMECONTENTTYPE */ |
1709 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v); | 2267 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v); |
1710 | void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v); | 2268 | void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v); |
1711 | const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...); | 2269 | const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...); |
1712 | 2270 | ||
1713 | /* X-LIC-MIMEENCODING */ | 2271 | /* X-LIC-MIMEENCODING */ |
1714 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v); | 2272 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v); |
1715 | void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v); | 2273 | void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v); |
1716 | const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...); | 2274 | const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...); |
1717 | 2275 | ||
1718 | /* X-LIC-MIMEFILENAME */ | 2276 | /* X-LIC-MIMEFILENAME */ |
1719 | icalproperty* icalproperty_new_xlicmimefilename(const char* v); | 2277 | icalproperty* icalproperty_new_xlicmimefilename(const char* v); |
1720 | void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v); | 2278 | void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v); |
1721 | const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...); | 2279 | const char* icalproperty_get_xlicmimefilename(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...); |
1722 | 2280 | ||
1723 | /* X-LIC-MIMEOPTINFO */ | 2281 | /* X-LIC-MIMEOPTINFO */ |
1724 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v); | 2282 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v); |
1725 | void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v); | 2283 | void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v); |
1726 | const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop); | 2284 | const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...); |
1727 | |||
1728 | #endif /*ICALPROPERTY_H*/ | ||
1729 | /* -*- Mode: C -*- */ | ||
1730 | /*====================================================================== | ||
1731 | FILE: icalvalue.h | ||
1732 | CREATOR: eric 20 March 1999 | ||
1733 | |||
1734 | |||
1735 | $Id$ | ||
1736 | $Locker$ | ||
1737 | |||
1738 | |||
1739 | |||
1740 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
1741 | |||
1742 | This program is free software; you can redistribute it and/or modify | ||
1743 | it under the terms of either: | ||
1744 | |||
1745 | The LGPL as published by the Free Software Foundation, version | ||
1746 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1747 | |||
1748 | Or: | ||
1749 | |||
1750 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
1751 | the License at http://www.mozilla.org/MPL/ | ||
1752 | |||
1753 | The original code is icalvalue.h | ||
1754 | |||
1755 | ======================================================================*/ | ||
1756 | |||
1757 | #ifndef ICALVALUE_H | ||
1758 | #define ICALVALUE_H | ||
1759 | |||
1760 | #include <time.h> | ||
1761 | |||
1762 | /* Defined in icalderivedvalue.h */ | ||
1763 | /*typedef void icalvalue;*/ | ||
1764 | |||
1765 | icalvalue* icalvalue_new(icalvalue_kind kind); | ||
1766 | |||
1767 | icalvalue* icalvalue_new_clone(icalvalue* value); | ||
1768 | |||
1769 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str); | ||
1770 | |||
1771 | void icalvalue_free(icalvalue* value); | ||
1772 | |||
1773 | int icalvalue_is_valid(icalvalue* value); | ||
1774 | |||
1775 | const char* icalvalue_as_ical_string(icalvalue* value); | ||
1776 | |||
1777 | icalvalue_kind icalvalue_isa(icalvalue* value); | ||
1778 | |||
1779 | int icalvalue_isa_value(void*); | ||
1780 | |||
1781 | icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b); | ||
1782 | |||
1783 | |||
1784 | /* Special, non autogenerated value accessors */ | ||
1785 | |||
1786 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); | ||
1787 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); | ||
1788 | struct icalrecurrencetype icalvalue_get_recur(icalvalue* value); | ||
1789 | |||
1790 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); | ||
1791 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); | ||
1792 | struct icaltriggertype icalvalue_get_trigger(icalvalue* value); | ||
1793 | |||
1794 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); | ||
1795 | void icalvalue_set_datetimeperiod(icalvalue* value, | ||
1796 | struct icaldatetimeperiodtype v); | ||
1797 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value); | ||
1798 | |||
1799 | /* Convert enumerations */ | ||
1800 | |||
1801 | icalvalue_kind icalvalue_string_to_kind(const char* str); | ||
1802 | const char* icalvalue_kind_to_string(icalvalue_kind kind); | ||
1803 | |||
1804 | |||
1805 | #endif /*ICALVALUE_H*/ | ||
1806 | /* -*- Mode: C -*- */ | ||
1807 | /*====================================================================== | ||
1808 | FILE: icalparam.h | ||
1809 | CREATOR: eric 20 March 1999 | ||
1810 | |||
1811 | |||
1812 | $Id$ | ||
1813 | $Locker$ | ||
1814 | |||
1815 | |||
1816 | |||
1817 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
1818 | |||
1819 | This program is free software; you can redistribute it and/or modify | ||
1820 | it under the terms of either: | ||
1821 | |||
1822 | The LGPL as published by the Free Software Foundation, version | ||
1823 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1824 | |||
1825 | Or: | ||
1826 | |||
1827 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
1828 | the License at http://www.mozilla.org/MPL/ | ||
1829 | |||
1830 | The original code is icalparam.h | ||
1831 | |||
1832 | ======================================================================*/ | ||
1833 | |||
1834 | #ifndef ICALPARAM_H | ||
1835 | #define ICALPARAM_H | ||
1836 | |||
1837 | |||
1838 | /* Declared in icalderivedparameter.h */ | ||
1839 | /*typedef void icalparameter;*/ | ||
1840 | 2285 | ||
1841 | icalparameter* icalparameter_new(icalparameter_kind kind); | ||
1842 | icalparameter* icalparameter_new_clone(icalparameter* p); | ||
1843 | |||
1844 | /* Create from string of form "PARAMNAME=VALUE" */ | ||
1845 | icalparameter* icalparameter_new_from_string(const char* value); | ||
1846 | |||
1847 | /* Create from just the value, the part after the "=" */ | ||
1848 | icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value); | ||
1849 | |||
1850 | void icalparameter_free(icalparameter* parameter); | ||
1851 | |||
1852 | char* icalparameter_as_ical_string(icalparameter* parameter); | ||
1853 | |||
1854 | int icalparameter_is_valid(icalparameter* parameter); | ||
1855 | |||
1856 | icalparameter_kind icalparameter_isa(icalparameter* parameter); | ||
1857 | |||
1858 | int icalparameter_isa_parameter(void* param); | ||
1859 | |||
1860 | /* Acess the name of an X parameer */ | ||
1861 | void icalparameter_set_xname (icalparameter* param, const char* v); | ||
1862 | const char* icalparameter_get_xname(icalparameter* param); | ||
1863 | void icalparameter_set_xvalue (icalparameter* param, const char* v); | ||
1864 | const char* icalparameter_get_xvalue(icalparameter* param); | ||
1865 | |||
1866 | /* Convert enumerations */ | ||
1867 | 2286 | ||
1868 | const char* icalparameter_kind_to_string(icalparameter_kind kind); | 2287 | #endif /*ICALPROPERTY_H*/ |
1869 | icalparameter_kind icalparameter_string_to_kind(const char* string); | ||
1870 | |||
1871 | |||
1872 | |||
1873 | #endif | ||
1874 | /* -*- Mode: C -*- */ | 2288 | /* -*- Mode: C -*- */ |
1875 | /*====================================================================== | 2289 | /*====================================================================== |
1876 | FILE: icalproperty.h | 2290 | FILE: icalproperty.h |
1877 | CREATOR: eric 20 March 1999 | 2291 | CREATOR: eric 20 March 1999 |
1878 | 2292 | ||
1879 | 2293 | ||
1880 | $Id$ | ||
1881 | $Locker$ | ||
1882 | 2294 | ||
1883 | 2295 | ||
1884 | 2296 | ||
@@ -1904,12 +2316,12 @@ icalparameter_kind icalparameter_string_to_kind(const char* string); | |||
1904 | #define ICALPROPERTY_H | 2316 | #define ICALPROPERTY_H |
1905 | 2317 | ||
1906 | #include <time.h> | 2318 | #include <time.h> |
1907 | 2319 | #include <stdarg.h> /* for va_... */ | |
1908 | 2320 | ||
1909 | 2321 | ||
1910 | 2322 | ||
1911 | /* Actually in icalderivedproperty.h: | 2323 | /* Actually in icalderivedproperty.h: |
1912 | typedef void icalproperty; */ | 2324 | typedef struct icalproperty_impl icalproperty; */ |
1913 | 2325 | ||
1914 | 2326 | ||
1915 | icalproperty* icalproperty_new(icalproperty_kind kind); | 2327 | icalproperty* icalproperty_new(icalproperty_kind kind); |
@@ -1925,6 +2337,7 @@ void icalproperty_free(icalproperty* prop); | |||
1925 | icalproperty_kind icalproperty_isa(icalproperty* property); | 2337 | icalproperty_kind icalproperty_isa(icalproperty* property); |
1926 | int icalproperty_isa_property(void* property); | 2338 | int icalproperty_isa_property(void* property); |
1927 | 2339 | ||
2340 | void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); | ||
1928 | void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter); | 2341 | void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter); |
1929 | void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter); | 2342 | void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter); |
1930 | void icalproperty_set_parameter_from_string(icalproperty* prop, | 2343 | void icalproperty_set_parameter_from_string(icalproperty* prop, |
@@ -1935,7 +2348,18 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop, | |||
1935 | void icalproperty_remove_parameter(icalproperty* prop, | 2348 | void icalproperty_remove_parameter(icalproperty* prop, |
1936 | icalparameter_kind kind); | 2349 | icalparameter_kind kind); |
1937 | 2350 | ||
1938 | int icalproperty_count_parameters(icalproperty* prop); | 2351 | void icalproperty_remove_parameter_by_kind(icalproperty* prop, |
2352 | icalparameter_kind kind); | ||
2353 | |||
2354 | void icalproperty_remove_parameter_by_name(icalproperty* prop, | ||
2355 | const char *name); | ||
2356 | |||
2357 | void icalproperty_remove_parameter_by_ref(icalproperty* prop, | ||
2358 | icalparameter *param); | ||
2359 | |||
2360 | |||
2361 | |||
2362 | int icalproperty_count_parameters(const icalproperty* prop); | ||
1939 | 2363 | ||
1940 | /* Iterate through the parameters */ | 2364 | /* Iterate through the parameters */ |
1941 | icalparameter* icalproperty_get_first_parameter(icalproperty* prop, | 2365 | icalparameter* icalproperty_get_first_parameter(icalproperty* prop, |
@@ -1946,33 +2370,39 @@ icalparameter* icalproperty_get_next_parameter(icalproperty* prop, | |||
1946 | void icalproperty_set_value(icalproperty* prop, icalvalue* value); | 2370 | void icalproperty_set_value(icalproperty* prop, icalvalue* value); |
1947 | void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind); | 2371 | void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind); |
1948 | 2372 | ||
1949 | icalvalue* icalproperty_get_value(icalproperty* prop); | 2373 | icalvalue* icalproperty_get_value(const icalproperty* prop); |
1950 | const char* icalproperty_get_value_as_string(icalproperty* prop); | 2374 | const char* icalproperty_get_value_as_string(const icalproperty* prop); |
1951 | 2375 | ||
1952 | /* Deal with X properties */ | 2376 | /* Deal with X properties */ |
1953 | 2377 | ||
1954 | void icalproperty_set_x_name(icalproperty* prop, const char* name); | 2378 | void icalproperty_set_x_name(icalproperty* prop, const char* name); |
1955 | const char* icalproperty_get_x_name(icalproperty* prop); | 2379 | const char* icalproperty_get_x_name(icalproperty* prop); |
1956 | 2380 | ||
1957 | /* Return the name of the property -- the type name converted to a | 2381 | /** Return the name of the property -- the type name converted to a |
1958 | string, or the value of _get_x_name if the type is and X property */ | 2382 | * string, or the value of _get_x_name if the type is and X |
1959 | const char* icalproperty_get_name (icalproperty* prop); | 2383 | * property |
2384 | */ | ||
2385 | const char* icalproperty_get_property_name (const icalproperty* prop); | ||
1960 | 2386 | ||
1961 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value); | 2387 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value); |
1962 | 2388 | ||
1963 | /* Convert kinds to string and get default value type */ | 2389 | /* Convert kinds to string and get default value type */ |
1964 | 2390 | ||
1965 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind); | 2391 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind); |
1966 | icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind); | 2392 | icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind); |
1967 | const char* icalproperty_kind_to_string(icalproperty_kind kind); | 2393 | const char* icalproperty_kind_to_string(icalproperty_kind kind); |
1968 | icalproperty_kind icalproperty_string_to_kind(const char* string); | 2394 | icalproperty_kind icalproperty_string_to_kind(const char* string); |
1969 | 2395 | ||
2396 | /** Check validity of a specific icalproperty_kind **/ | ||
2397 | int icalproperty_kind_is_valid(const icalproperty_kind kind); | ||
2398 | |||
1970 | icalproperty_method icalproperty_string_to_method(const char* str); | 2399 | icalproperty_method icalproperty_string_to_method(const char* str); |
1971 | const char* icalproperty_method_to_string(icalproperty_method method); | 2400 | const char* icalproperty_method_to_string(icalproperty_method method); |
1972 | 2401 | ||
1973 | 2402 | ||
1974 | const char* icalproperty_enum_to_string(int e); | 2403 | const char* icalproperty_enum_to_string(int e); |
1975 | int icalproperty_string_to_enum(const char* str); | 2404 | int icalproperty_string_to_enum(const char* str); |
2405 | int icalproperty_kind_and_string_to_enum(const int kind, const char* str); | ||
1976 | 2406 | ||
1977 | const char* icalproperty_status_to_string(icalproperty_status); | 2407 | const char* icalproperty_status_to_string(icalproperty_status); |
1978 | icalproperty_status icalproperty_string_to_status(const char* string); | 2408 | icalproperty_status icalproperty_string_to_status(const char* string); |
@@ -1983,68 +2413,6 @@ int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e); | |||
1983 | 2413 | ||
1984 | 2414 | ||
1985 | #endif /*ICALPROPERTY_H*/ | 2415 | #endif /*ICALPROPERTY_H*/ |
1986 | /* -*- Mode: C -*- */ | ||
1987 | /*====================================================================== | ||
1988 | FILE: icalattendee.h | ||
1989 | CREATOR: eric 8 Mar 01 | ||
1990 | |||
1991 | |||
1992 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
1993 | |||
1994 | This program is free software; you can redistribute it and/or modify | ||
1995 | it under the terms of either: | ||
1996 | |||
1997 | The LGPL as published by the Free Software Foundation, version | ||
1998 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
1999 | |||
2000 | Or: | ||
2001 | |||
2002 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
2003 | the License at http://www.mozilla.org/MPL/ | ||
2004 | |||
2005 | The original code is icaltypes.h | ||
2006 | |||
2007 | ======================================================================*/ | ||
2008 | |||
2009 | #ifndef ICALATTENDEE_H | ||
2010 | #define ICALATTENDEE_H | ||
2011 | |||
2012 | #include <time.h> | ||
2013 | |||
2014 | struct icalorganizertype { | ||
2015 | const char* value; | ||
2016 | const char* common_name; | ||
2017 | const char* dir; | ||
2018 | const char* sentby; | ||
2019 | const char* language; | ||
2020 | |||
2021 | }; | ||
2022 | |||
2023 | /* Create a copy of the given organizer. Libical will not own the | ||
2024 | memory for the strings in the copy; the call must free them */ | ||
2025 | struct icalorganizertype icalorganizertype_new_clone(struct icalorganizertype a); | ||
2026 | |||
2027 | |||
2028 | struct icalattendeetype { | ||
2029 | const char* cuid; /* Cal user id, contents of the property value */ | ||
2030 | /*icalparameter_cutype cutype;*/ | ||
2031 | const char* member; | ||
2032 | /*icalparameter_role role;*/ | ||
2033 | int rsvp; | ||
2034 | const char* delto; | ||
2035 | const char* delfrom; | ||
2036 | const char* sentby; | ||
2037 | const char* cn; | ||
2038 | const char* dir; | ||
2039 | const char* language; | ||
2040 | }; | ||
2041 | |||
2042 | /* Create a copy of the given attendee. Libical will not own the | ||
2043 | memory for the strings in the copy; the call must free them */ | ||
2044 | struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a); | ||
2045 | |||
2046 | |||
2047 | #endif /* !ICALATTENDEE_H */ | ||
2048 | /*====================================================================== | 2416 | /*====================================================================== |
2049 | FILE: pvl.h | 2417 | FILE: pvl.h |
2050 | CREATOR: eric November, 1995 | 2418 | CREATOR: eric November, 1995 |
@@ -2057,29 +2425,29 @@ struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a); | |||
2057 | #ifndef __PVL_H__ | 2425 | #ifndef __PVL_H__ |
2058 | #define __PVL_H__ | 2426 | #define __PVL_H__ |
2059 | 2427 | ||
2060 | typedef void* pvl_list; | 2428 | typedef struct pvl_list_t* pvl_list; |
2061 | typedef void* pvl_elem; | 2429 | typedef struct pvl_elem_t* pvl_elem; |
2062 | 2430 | ||
2063 | /* | 2431 | /** |
2064 | struct pvl_elem_t | 2432 | * This type is private. Always use pvl_elem instead. The struct would |
2065 | 2433 | * not even appear in this header except to make code in the USE_MACROS | |
2066 | This type is private. Always use pvl_elem instead. The struct would | 2434 | * blocks work |
2067 | not even appear in this header except to make code in the USE_MACROS | 2435 | */ |
2068 | blocks work | ||
2069 | 2436 | ||
2070 | */ | ||
2071 | typedef struct pvl_elem_t | 2437 | typedef struct pvl_elem_t |
2072 | { | 2438 | { |
2073 | int MAGIC; /* Magic Identifier */ | 2439 | int MAGIC; /**< Magic Identifier */ |
2074 | void *d; /* Pointer to data user is storing */ | 2440 | void *d; /**< Pointer to data user is storing */ |
2075 | struct pvl_elem_t *next;/* Next element */ | 2441 | struct pvl_elem_t *next;/**< Next element */ |
2076 | struct pvl_elem_t *prior;/* prior element */ | 2442 | struct pvl_elem_t *prior;/**< Prior element */ |
2077 | } pvl_elem_t; | 2443 | } pvl_elem_t; |
2078 | 2444 | ||
2079 | 2445 | ||
2080 | 2446 | ||
2081 | /* This global is incremented for each call to pvl_new_element(); it gives each | 2447 | /** |
2082 | * list a unique identifer */ | 2448 | * This global is incremented for each call to pvl_new_element(); it gives each |
2449 | * list a unique identifer | ||
2450 | */ | ||
2083 | 2451 | ||
2084 | extern int pvl_elem_count; | 2452 | extern int pvl_elem_count; |
2085 | extern int pvl_list_count; | 2453 | extern int pvl_list_count; |
@@ -2128,8 +2496,11 @@ typedef int (*pvl_findf)(void* a, void* b); /*a is list elem, b is other data*/ | |||
2128 | pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v); | 2496 | pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v); |
2129 | pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v); | 2497 | pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v); |
2130 | 2498 | ||
2131 | /* Pass each element in the list to a function */ | 2499 | /** |
2132 | typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/ | 2500 | * Pass each element in the list to a function |
2501 | * a is list elem, b is other data | ||
2502 | */ | ||
2503 | typedef void (*pvl_applyf)(void* a, void* b); | ||
2133 | void pvl_apply(pvl_list l,pvl_applyf f, void *v); | 2504 | void pvl_apply(pvl_list l,pvl_applyf f, void *v); |
2134 | 2505 | ||
2135 | 2506 | ||
@@ -2139,6 +2510,67 @@ void pvl_apply(pvl_list l,pvl_applyf f, void *v); | |||
2139 | 2510 | ||
2140 | 2511 | ||
2141 | 2512 | ||
2513 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | ||
2514 | /*====================================================================== | ||
2515 | FILE: icalarray.h | ||
2516 | CREATOR: Damon Chaplin 07 March 2001 | ||
2517 | |||
2518 | |||
2519 | |||
2520 | (C) COPYRIGHT 2001, Ximian, Inc. | ||
2521 | |||
2522 | This program is free software; you can redistribute it and/or modify | ||
2523 | it under the terms of either: | ||
2524 | |||
2525 | The LGPL as published by the Free Software Foundation, version | ||
2526 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
2527 | |||
2528 | Or: | ||
2529 | |||
2530 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
2531 | the License at http://www.mozilla.org/MPL/ | ||
2532 | |||
2533 | |||
2534 | ======================================================================*/ | ||
2535 | |||
2536 | |||
2537 | #ifndef ICALARRAY_H | ||
2538 | #define ICALARRAY_H | ||
2539 | |||
2540 | /** @file icalarray.h | ||
2541 | * | ||
2542 | * @brief An array of arbitrarily-sized elements which grows | ||
2543 | * dynamically as elements are added. | ||
2544 | */ | ||
2545 | |||
2546 | typedef struct _icalarray icalarray; | ||
2547 | struct _icalarray { | ||
2548 | unsigned int element_size; | ||
2549 | unsigned int increment_size; | ||
2550 | unsigned int num_elements; | ||
2551 | unsigned int space_allocated; | ||
2552 | void *data; | ||
2553 | }; | ||
2554 | |||
2555 | |||
2556 | |||
2557 | icalarray *icalarray_new (int element_size, | ||
2558 | int increment_size); | ||
2559 | void icalarray_free (icalarray*array); | ||
2560 | |||
2561 | void icalarray_append (icalarray*array, | ||
2562 | void *element); | ||
2563 | void icalarray_remove_element_at (icalarray*array, | ||
2564 | int position); | ||
2565 | |||
2566 | void *icalarray_element_at (icalarray*array, | ||
2567 | int position); | ||
2568 | |||
2569 | void icalarray_sort (icalarray*array, | ||
2570 | int (*compare) (const void *, const void *)); | ||
2571 | |||
2572 | |||
2573 | #endif /* ICALARRAY_H */ | ||
2142 | /* -*- Mode: C -*- */ | 2574 | /* -*- Mode: C -*- */ |
2143 | /*====================================================================== | 2575 | /*====================================================================== |
2144 | FILE: icalcomponent.h | 2576 | FILE: icalcomponent.h |
@@ -2166,7 +2598,16 @@ void pvl_apply(pvl_list l,pvl_applyf f, void *v); | |||
2166 | #define ICALCOMPONENT_H | 2598 | #define ICALCOMPONENT_H |
2167 | 2599 | ||
2168 | 2600 | ||
2169 | typedef void icalcomponent; | 2601 | typedef struct icalcomponent_impl icalcomponent; |
2602 | |||
2603 | #ifndef ICALTIMEZONE_DEFINED | ||
2604 | #define ICALTIMEZONE_DEFINED | ||
2605 | /** @brief An opaque struct representing a timezone. | ||
2606 | * We declare this here to avoid a circular dependancy. | ||
2607 | */ | ||
2608 | typedef struct _icaltimezone icaltimezone; | ||
2609 | #endif | ||
2610 | |||
2170 | 2611 | ||
2171 | /* This is exposed so that callers will not have to allocate and | 2612 | /* This is exposed so that callers will not have to allocate and |
2172 | deallocate iterators. Pretend that you can't see it. */ | 2613 | deallocate iterators. Pretend that you can't see it. */ |
@@ -2187,7 +2628,7 @@ char* icalcomponent_as_ical_string(icalcomponent* component); | |||
2187 | 2628 | ||
2188 | int icalcomponent_is_valid(icalcomponent* component); | 2629 | int icalcomponent_is_valid(icalcomponent* component); |
2189 | 2630 | ||
2190 | icalcomponent_kind icalcomponent_isa(icalcomponent* component); | 2631 | icalcomponent_kind icalcomponent_isa(const icalcomponent* component); |
2191 | 2632 | ||
2192 | int icalcomponent_isa_component (void* component); | 2633 | int icalcomponent_isa_component (void* component); |
2193 | 2634 | ||
@@ -2233,6 +2674,14 @@ void icalcomponent_remove_component(icalcomponent* parent, | |||
2233 | int icalcomponent_count_components(icalcomponent* component, | 2674 | int icalcomponent_count_components(icalcomponent* component, |
2234 | icalcomponent_kind kind); | 2675 | icalcomponent_kind kind); |
2235 | 2676 | ||
2677 | /** | ||
2678 | This takes 2 VCALENDAR components and merges the second one into the first, | ||
2679 | resolving any problems with conflicting TZIDs. comp_to_merge will no | ||
2680 | longer exist after calling this function. */ | ||
2681 | void icalcomponent_merge_component(icalcomponent* comp, | ||
2682 | icalcomponent* comp_to_merge); | ||
2683 | |||
2684 | |||
2236 | /* Iteration Routines. There are two forms of iterators, internal and | 2685 | /* Iteration Routines. There are two forms of iterators, internal and |
2237 | external. The internal ones came first, and are almost completely | 2686 | external. The internal ones came first, and are almost completely |
2238 | sufficient, but they fail badly when you want to construct a loop that | 2687 | sufficient, but they fail badly when you want to construct a loop that |
@@ -2257,16 +2706,20 @@ icalcomponent* icalcompiter_prior(icalcompiter* i); | |||
2257 | icalcomponent* icalcompiter_deref(icalcompiter* i); | 2706 | icalcomponent* icalcompiter_deref(icalcompiter* i); |
2258 | 2707 | ||
2259 | 2708 | ||
2709 | /* Working with embedded error properties */ | ||
2260 | 2710 | ||
2261 | 2711 | ||
2712 | /* Check the component against itip rules and insert error properties*/ | ||
2262 | /* Working with embedded error properties */ | 2713 | /* Working with embedded error properties */ |
2714 | int icalcomponent_check_restrictions(icalcomponent* comp); | ||
2263 | 2715 | ||
2716 | /** Count embedded errors. */ | ||
2264 | int icalcomponent_count_errors(icalcomponent* component); | 2717 | int icalcomponent_count_errors(icalcomponent* component); |
2265 | 2718 | ||
2266 | /* Remove all X-LIC-ERROR properties*/ | 2719 | /** Remove all X-LIC-ERROR properties*/ |
2267 | void icalcomponent_strip_errors(icalcomponent* component); | 2720 | void icalcomponent_strip_errors(icalcomponent* component); |
2268 | 2721 | ||
2269 | /* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ | 2722 | /** Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ |
2270 | void icalcomponent_convert_errors(icalcomponent* component); | 2723 | void icalcomponent_convert_errors(icalcomponent* component); |
2271 | 2724 | ||
2272 | /* Internal operations. They are private, and you should not be using them. */ | 2725 | /* Internal operations. They are private, and you should not be using them. */ |
@@ -2274,7 +2727,9 @@ icalcomponent* icalcomponent_get_parent(icalcomponent* component); | |||
2274 | void icalcomponent_set_parent(icalcomponent* component, | 2727 | void icalcomponent_set_parent(icalcomponent* component, |
2275 | icalcomponent* parent); | 2728 | icalcomponent* parent); |
2276 | 2729 | ||
2277 | /* Kind conversion routiens */ | 2730 | /* Kind conversion routines */ |
2731 | |||
2732 | int icalcomponent_kind_is_valid(const icalcomponent_kind kind); | ||
2278 | 2733 | ||
2279 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); | 2734 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); |
2280 | 2735 | ||
@@ -2287,11 +2742,11 @@ If the code was in an OO language, the remaining routines would be | |||
2287 | members of classes derived from icalcomponent. Don't call them on the | 2742 | members of classes derived from icalcomponent. Don't call them on the |
2288 | wrong component subtypes. */ | 2743 | wrong component subtypes. */ |
2289 | 2744 | ||
2290 | /* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or | 2745 | /** For VCOMPONENT: Return a reference to the first VEVENT, VTODO or |
2291 | VJOURNAL */ | 2746 | VJOURNAL */ |
2292 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); | 2747 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); |
2293 | 2748 | ||
2294 | /* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end | 2749 | /** For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end |
2295 | times of an event in UTC */ | 2750 | times of an event in UTC */ |
2296 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); | 2751 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); |
2297 | 2752 | ||
@@ -2313,6 +2768,9 @@ struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp); | |||
2313 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); | 2768 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); |
2314 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); | 2769 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); |
2315 | 2770 | ||
2771 | struct icaltimetype icalcomponent_get_due(icalcomponent* comp); | ||
2772 | void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v); | ||
2773 | |||
2316 | void icalcomponent_set_duration(icalcomponent* comp, | 2774 | void icalcomponent_set_duration(icalcomponent* comp, |
2317 | struct icaldurationtype v); | 2775 | struct icaldurationtype v); |
2318 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); | 2776 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); |
@@ -2323,7 +2781,6 @@ icalproperty_method icalcomponent_get_method(icalcomponent* comp); | |||
2323 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); | 2781 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); |
2324 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); | 2782 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); |
2325 | 2783 | ||
2326 | |||
2327 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); | 2784 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); |
2328 | const char* icalcomponent_get_summary(icalcomponent* comp); | 2785 | const char* icalcomponent_get_summary(icalcomponent* comp); |
2329 | 2786 | ||
@@ -2333,27 +2790,48 @@ const char* icalcomponent_get_comment(icalcomponent* comp); | |||
2333 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); | 2790 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); |
2334 | const char* icalcomponent_get_uid(icalcomponent* comp); | 2791 | const char* icalcomponent_get_uid(icalcomponent* comp); |
2335 | 2792 | ||
2793 | void icalcomponent_set_relcalid(icalcomponent* comp, const char* v); | ||
2794 | const char* icalcomponent_get_relcalid(icalcomponent* comp); | ||
2795 | |||
2336 | void icalcomponent_set_recurrenceid(icalcomponent* comp, | 2796 | void icalcomponent_set_recurrenceid(icalcomponent* comp, |
2337 | struct icaltimetype v); | 2797 | struct icaltimetype v); |
2338 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); | 2798 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); |
2339 | 2799 | ||
2800 | void icalcomponent_set_description(icalcomponent* comp, const char* v); | ||
2801 | const char* icalcomponent_get_description(icalcomponent* comp); | ||
2340 | 2802 | ||
2341 | void icalcomponent_set_organizer(icalcomponent* comp, | 2803 | void icalcomponent_set_location(icalcomponent* comp, const char* v); |
2342 | struct icalorganizertype org); | 2804 | const char* icalcomponent_get_location(icalcomponent* comp); |
2343 | struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp); | ||
2344 | 2805 | ||
2806 | void icalcomponent_set_sequence(icalcomponent* comp, int v); | ||
2807 | int icalcomponent_get_sequence(icalcomponent* comp); | ||
2345 | 2808 | ||
2346 | void icalcomponent_add_attendee(icalcomponent *comp, | 2809 | void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v); |
2347 | struct icalattendeetype attendee); | 2810 | enum icalproperty_status icalcomponent_get_status(icalcomponent* comp); |
2348 | 2811 | ||
2349 | int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid); | ||
2350 | 2812 | ||
2351 | /* Get the Nth attendee. Out of range indices return an attendee | 2813 | /** Calls the given function for each TZID parameter found in the |
2352 | with cuid == 0 */ | 2814 | component, and any subcomponents. */ |
2353 | struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp, | 2815 | void icalcomponent_foreach_tzid(icalcomponent* comp, |
2354 | int index); | 2816 | void (*callback)(icalparameter *param, void *data), |
2817 | void *callback_data); | ||
2355 | 2818 | ||
2819 | /** Returns the icaltimezone in the component corresponding to the | ||
2820 | TZID, or NULL if it can't be found. */ | ||
2821 | icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, | ||
2822 | const char *tzid); | ||
2356 | 2823 | ||
2824 | int icalproperty_recurrence_is_excluded(icalcomponent *comp, | ||
2825 | struct icaltimetype *dtstart, | ||
2826 | struct icaltimetype *recurtime); | ||
2827 | |||
2828 | void icalcomponent_foreach_recurrence(icalcomponent* comp, | ||
2829 | struct icaltimetype start, | ||
2830 | struct icaltimetype end, | ||
2831 | void (*callback)(icalcomponent *comp, | ||
2832 | struct icaltime_span *span, | ||
2833 | void *data), | ||
2834 | void *callback_data); | ||
2357 | 2835 | ||
2358 | 2836 | ||
2359 | /*************** Type Specific routines ***************/ | 2837 | /*************** Type Specific routines ***************/ |
@@ -2367,19 +2845,177 @@ icalcomponent* icalcomponent_new_vfreebusy(); | |||
2367 | icalcomponent* icalcomponent_new_vtimezone(); | 2845 | icalcomponent* icalcomponent_new_vtimezone(); |
2368 | icalcomponent* icalcomponent_new_xstandard(); | 2846 | icalcomponent* icalcomponent_new_xstandard(); |
2369 | icalcomponent* icalcomponent_new_xdaylight(); | 2847 | icalcomponent* icalcomponent_new_xdaylight(); |
2848 | icalcomponent* icalcomponent_new_vagenda(); | ||
2849 | icalcomponent* icalcomponent_new_vquery(); | ||
2370 | 2850 | ||
2851 | #endif /* !ICALCOMPONENT_H */ | ||
2852 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | ||
2853 | /*====================================================================== | ||
2854 | FILE: icaltimezone.h | ||
2855 | CREATOR: Damon Chaplin 15 March 2001 | ||
2371 | 2856 | ||
2372 | 2857 | ||
2373 | #endif /* !ICALCOMPONENT_H */ | ||
2374 | 2858 | ||
2859 | (C) COPYRIGHT 2001, Damon Chaplin | ||
2860 | |||
2861 | This program is free software; you can redistribute it and/or modify | ||
2862 | it under the terms of either: | ||
2863 | |||
2864 | The LGPL as published by the Free Software Foundation, version | ||
2865 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
2866 | |||
2867 | Or: | ||
2868 | |||
2869 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
2870 | the License at http://www.mozilla.org/MPL/ | ||
2871 | |||
2872 | |||
2873 | ======================================================================*/ | ||
2874 | /** | ||
2875 | * @file icaltimezone.h | ||
2876 | * @brief timezone handling routines | ||
2877 | */ | ||
2878 | |||
2879 | #ifndef ICALTIMEZONE_H | ||
2880 | #define ICALTIMEZONE_H | ||
2881 | |||
2882 | #include <stdio.h> /* For FILE* */ | ||
2883 | |||
2884 | |||
2885 | #ifndef ICALTIMEZONE_DEFINED | ||
2886 | #define ICALTIMEZONE_DEFINED | ||
2887 | /** @brief An opaque struct representing a timezone. | ||
2888 | * We declare this here to avoid a circular dependancy. | ||
2889 | */ | ||
2890 | typedef struct _icaltimezone icaltimezone; | ||
2891 | #endif | ||
2892 | |||
2893 | /** | ||
2894 | * @par Creating/Destroying individual icaltimezones. | ||
2895 | */ | ||
2896 | |||
2897 | /** Creates a new icaltimezone. */ | ||
2898 | icaltimezone *icaltimezone_new (void); | ||
2899 | |||
2900 | /** Frees all memory used for the icaltimezone. Set free_struct to free the | ||
2901 | icaltimezone struct as well. */ | ||
2902 | void icaltimezone_free (icaltimezone *zone, | ||
2903 | int free_struct); | ||
2904 | |||
2905 | |||
2906 | /** | ||
2907 | * @par Accessing timezones. | ||
2908 | */ | ||
2909 | |||
2910 | /** Free any builtin timezone information **/ | ||
2911 | void icaltimezone_free_builtin_timezones(void); | ||
2912 | |||
2913 | /** Returns the array of builtin icaltimezones. */ | ||
2914 | icalarray* icaltimezone_get_builtin_timezones(void); | ||
2375 | 2915 | ||
2916 | /** Returns a single builtin timezone, given its Olson city name. */ | ||
2917 | icaltimezone* icaltimezone_get_builtin_timezone(const char *location); | ||
2376 | 2918 | ||
2919 | /** Returns a single builtin timezone, given its TZID. */ | ||
2920 | icaltimezone* icaltimezone_get_builtin_timezone_from_tzid (const char *tzid); | ||
2921 | |||
2922 | /** Returns the UTC timezone. */ | ||
2923 | icaltimezone* icaltimezone_get_utc_timezone(void); | ||
2924 | |||
2925 | /** Returns the TZID of a timezone. */ | ||
2926 | char* icaltimezone_get_tzid (icaltimezone*zone); | ||
2927 | |||
2928 | /** Returns the city name of a timezone. */ | ||
2929 | char* icaltimezone_get_location (icaltimezone*zone); | ||
2930 | |||
2931 | /** Returns the TZNAME properties used in the latest STANDARD and DAYLIGHT | ||
2932 | components. If they are the same it will return just one, e.g. "LMT". | ||
2933 | If they are different it will format them like "EST/EDT". Note that this | ||
2934 | may also return NULL. */ | ||
2935 | char* icaltimezone_get_tznames (icaltimezone*zone); | ||
2936 | |||
2937 | /** Returns the latitude of a builtin timezone. */ | ||
2938 | double icaltimezone_get_latitude (icaltimezone*zone); | ||
2939 | |||
2940 | /** Returns the longitude of a builtin timezone. */ | ||
2941 | double icaltimezone_get_longitude (icaltimezone*zone); | ||
2942 | |||
2943 | /** Returns the VTIMEZONE component of a timezone. */ | ||
2944 | icalcomponent* icaltimezone_get_component (icaltimezone*zone); | ||
2945 | |||
2946 | /** Sets the VTIMEZONE component of an icaltimezone, initializing the tzid, | ||
2947 | location & tzname fields. It returns 1 on success or 0 on failure, i.e. | ||
2948 | no TZID was found. */ | ||
2949 | int icaltimezone_set_component (icaltimezone*zone, | ||
2950 | icalcomponent*comp); | ||
2951 | |||
2952 | /** | ||
2953 | * @par Converting times between timezones. | ||
2954 | */ | ||
2955 | |||
2956 | void icaltimezone_convert_time (struct icaltimetype *tt, | ||
2957 | icaltimezone*from_zone, | ||
2958 | icaltimezone*to_zone); | ||
2959 | |||
2960 | |||
2961 | /** | ||
2962 | * @par Getting offsets from UTC. | ||
2963 | */ | ||
2964 | |||
2965 | /** Calculates the UTC offset of a given local time in the given | ||
2966 | timezone. It is the number of seconds to add to UTC to get local | ||
2967 | time. The is_daylight flag is set to 1 if the time is in | ||
2968 | daylight-savings time. */ | ||
2969 | int icaltimezone_get_utc_offset (icaltimezone*zone, | ||
2970 | struct icaltimetype *tt, | ||
2971 | int *is_daylight); | ||
2972 | |||
2973 | /** Calculates the UTC offset of a given UTC time in the given | ||
2974 | timezone. It is the number of seconds to add to UTC to get local | ||
2975 | time. The is_daylight flag is set to 1 if the time is in | ||
2976 | daylight-savings time. */ | ||
2977 | int icaltimezone_get_utc_offset_of_utc_time (icaltimezone*zone, | ||
2978 | struct icaltimetype *tt, | ||
2979 | int *is_daylight); | ||
2980 | |||
2981 | |||
2982 | |||
2983 | /* | ||
2984 | * Handling arrays of timezones. Mainly for internal use. | ||
2985 | */ | ||
2986 | icalarray* icaltimezone_array_new (void); | ||
2987 | |||
2988 | void icaltimezone_array_append_from_vtimezone (icalarray *timezones, | ||
2989 | icalcomponent *child); | ||
2990 | void icaltimezone_array_free (icalarray*timezones); | ||
2991 | |||
2992 | |||
2993 | /* | ||
2994 | * @par Handling the default location the timezone files | ||
2995 | */ | ||
2996 | |||
2997 | /** Set the directory to look for the zonefiles */ | ||
2998 | void set_zone_directory(char *path); | ||
2999 | |||
3000 | /** Free memory dedicated to the zonefile directory */ | ||
3001 | void free_zone_directory(void); | ||
3002 | |||
3003 | /* | ||
3004 | * @par Debugging Output. | ||
3005 | */ | ||
3006 | |||
3007 | /** Dumps information about changes in the timezone up to and including | ||
3008 | max_year. */ | ||
3009 | int icaltimezone_dump_changes (icaltimezone*zone, | ||
3010 | int max_year, | ||
3011 | FILE *fp); | ||
3012 | |||
3013 | #endif /* ICALTIMEZONE_H */ | ||
2377 | /* -*- Mode: C -*- */ | 3014 | /* -*- Mode: C -*- */ |
2378 | /*====================================================================== | 3015 | /*====================================================================== |
2379 | FILE: icalparser.h | 3016 | FILE: icalparser.h |
2380 | CREATOR: eric 20 April 1999 | 3017 | CREATOR: eric 20 April 1999 |
2381 | 3018 | ||
2382 | $Id$ | ||
2383 | 3019 | ||
2384 | 3020 | ||
2385 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 3021 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
@@ -2406,16 +3042,17 @@ icalcomponent* icalcomponent_new_xdaylight(); | |||
2406 | 3042 | ||
2407 | #include <stdio.h> /* For FILE* */ | 3043 | #include <stdio.h> /* For FILE* */ |
2408 | 3044 | ||
2409 | typedef void* icalparser; | 3045 | typedef struct icalparser_impl icalparser; |
2410 | 3046 | ||
2411 | 3047 | ||
2412 | /*********************************************************************** | 3048 | /** |
2413 | * Line-oriented parsing. | 3049 | * @file icalparser.h |
3050 | * @brief Line-oriented parsing. | ||
2414 | * | 3051 | * |
2415 | * Create a new parser via icalparse_new_parser, then add ines one at | 3052 | * Create a new parser via icalparse_new_parser, then add lines one at |
2416 | * a time with icalparse_add_line(). icalparser_add_line() will return | 3053 | * a time with icalparse_add_line(). icalparser_add_line() will return |
2417 | * non-zero when it has finished with a component. | 3054 | * non-zero when it has finished with a component. |
2418 | ***********************************************************************/ | 3055 | */ |
2419 | 3056 | ||
2420 | typedef enum icalparser_state { | 3057 | typedef enum icalparser_state { |
2421 | ICALPARSER_ERROR, | 3058 | ICALPARSER_ERROR, |
@@ -2432,18 +3069,20 @@ icalparser_state icalparser_get_state(icalparser* parser); | |||
2432 | void icalparser_free(icalparser* parser); | 3069 | void icalparser_free(icalparser* parser); |
2433 | 3070 | ||
2434 | 3071 | ||
2435 | /*********************************************************************** | 3072 | /** |
2436 | * Message oriented parsing. icalparser_parse takes a string that | 3073 | * Message oriented parsing. icalparser_parse takes a string that |
2437 | * holds the text ( in RFC 2445 format ) and returns a pointer to an | 3074 | * holds the text ( in RFC 2445 format ) and returns a pointer to an |
2438 | * icalcomponent. The caller owns the memory. line_gen_func is a | 3075 | * icalcomponent. The caller owns the memory. line_gen_func is a |
2439 | * pointer to a function that returns one content line per invocation | 3076 | * pointer to a function that returns one content line per invocation |
2440 | **********************************************************************/ | 3077 | */ |
2441 | 3078 | ||
2442 | icalcomponent* icalparser_parse(icalparser *parser, | 3079 | icalcomponent* icalparser_parse(icalparser *parser, |
2443 | char* (*line_gen_func)(char *s, size_t size, void *d)); | 3080 | char* (*line_gen_func)(char *s, size_t size, void *d)); |
2444 | 3081 | ||
2445 | /* Set the data that icalparser_parse will give to the line_gen_func | 3082 | /** |
2446 | as the parameter 'd'*/ | 3083 | Set the data that icalparser_parse will give to the line_gen_func |
3084 | as the parameter 'd' | ||
3085 | */ | ||
2447 | void icalparser_set_gen_data(icalparser* parser, void* data); | 3086 | void icalparser_set_gen_data(icalparser* parser, void* data); |
2448 | 3087 | ||
2449 | 3088 | ||
@@ -2454,14 +3093,14 @@ icalcomponent* icalparser_parse_string(const char* str); | |||
2454 | * Parser support functions | 3093 | * Parser support functions |
2455 | ***********************************************************************/ | 3094 | ***********************************************************************/ |
2456 | 3095 | ||
2457 | /* Use the flex/bison parser to turn a string into a value type */ | 3096 | /** Use the flex/bison parser to turn a string into a value type */ |
2458 | icalvalue* icalparser_parse_value(icalvalue_kind kind, | 3097 | icalvalue* icalparser_parse_value(icalvalue_kind kind, |
2459 | const char* str, icalcomponent** errors); | 3098 | const char* str, icalcomponent** errors); |
2460 | 3099 | ||
2461 | /* Given a line generator function, return a single iCal content line.*/ | 3100 | /** Given a line generator function, return a single iCal content line.*/ |
2462 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); | 3101 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); |
2463 | 3102 | ||
2464 | char* string_line_generator(char *out, size_t buf_size, void *d); | 3103 | char* icalparser_string_line_generator(char *out, size_t buf_size, void *d); |
2465 | 3104 | ||
2466 | #endif /* !ICALPARSE_H */ | 3105 | #endif /* !ICALPARSE_H */ |
2467 | /* -*- Mode: C -*- */ | 3106 | /* -*- Mode: C -*- */ |
@@ -2470,8 +3109,6 @@ char* string_line_generator(char *out, size_t buf_size, void *d); | |||
2470 | CREATOR: eric 30 June 1999 | 3109 | CREATOR: eric 30 June 1999 |
2471 | 3110 | ||
2472 | 3111 | ||
2473 | $Id$ | ||
2474 | $Locker$ | ||
2475 | 3112 | ||
2476 | This program is free software; you can redistribute it and/or modify | 3113 | This program is free software; you can redistribute it and/or modify |
2477 | it under the terms of either: | 3114 | it under the terms of either: |
@@ -2492,8 +3129,11 @@ char* string_line_generator(char *out, size_t buf_size, void *d); | |||
2492 | #ifndef ICALMEMORY_H | 3129 | #ifndef ICALMEMORY_H |
2493 | #define ICALMEMORY_H | 3130 | #define ICALMEMORY_H |
2494 | 3131 | ||
3132 | #ifndef WIN32 | ||
2495 | #include <sys/types.h> /* for size_t */ | 3133 | #include <sys/types.h> /* for size_t */ |
2496 | 3134 | #else | |
3135 | #include <stddef.h> | ||
3136 | #endif | ||
2497 | 3137 | ||
2498 | /* Tmp buffers are managed by ical. References can be returned to the | 3138 | /* Tmp buffers are managed by ical. References can be returned to the |
2499 | caller, although the caller will not own the memory. */ | 3139 | caller, although the caller will not own the memory. */ |
@@ -2501,11 +3141,11 @@ char* string_line_generator(char *out, size_t buf_size, void *d); | |||
2501 | void* icalmemory_tmp_buffer(size_t size); | 3141 | void* icalmemory_tmp_buffer(size_t size); |
2502 | char* icalmemory_tmp_copy(const char* str); | 3142 | char* icalmemory_tmp_copy(const char* str); |
2503 | 3143 | ||
2504 | /* Add an externally allocated buffer to the ring. */ | 3144 | /** Add an externally allocated buffer to the ring. */ |
2505 | void icalmemory_add_tmp_buffer(void*); | 3145 | void icalmemory_add_tmp_buffer(void*); |
2506 | 3146 | ||
2507 | 3147 | ||
2508 | /* Free all memory used in the ring */ | 3148 | /** Free all memory used in the ring */ |
2509 | void icalmemory_free_ring(void); | 3149 | void icalmemory_free_ring(void); |
2510 | 3150 | ||
2511 | /* Non-tmp buffers must be freed. These are mostly wrappers around | 3151 | /* Non-tmp buffers must be freed. These are mostly wrappers around |
@@ -2516,7 +3156,8 @@ void* icalmemory_new_buffer(size_t size); | |||
2516 | void* icalmemory_resize_buffer(void* buf, size_t size); | 3156 | void* icalmemory_resize_buffer(void* buf, size_t size); |
2517 | void icalmemory_free_buffer(void* buf); | 3157 | void icalmemory_free_buffer(void* buf); |
2518 | 3158 | ||
2519 | /* icalmemory_append_string will copy the string 'string' to the | 3159 | /** |
3160 | icalmemory_append_string will copy the string 'string' to the | ||
2520 | buffer 'buf' starting at position 'pos', reallocing 'buf' if it is | 3161 | buffer 'buf' starting at position 'pos', reallocing 'buf' if it is |
2521 | too small. 'buf_size' is the size of 'buf' and will be changed if | 3162 | too small. 'buf_size' is the size of 'buf' and will be changed if |
2522 | 'buf' is reallocated. 'pos' will point to the last byte of the new | 3163 | 'buf' is reallocated. 'pos' will point to the last byte of the new |
@@ -2532,12 +3173,12 @@ void icalmemory_free_buffer(void* buf); | |||
2532 | void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, | 3173 | void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, |
2533 | const char* string); | 3174 | const char* string); |
2534 | 3175 | ||
2535 | /* icalmemory_append_char is similar, but is appends a character instead of a string */ | 3176 | /** icalmemory_append_char is similar, but is appends a character instead of a string */ |
2536 | void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, | 3177 | void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, |
2537 | char ch); | 3178 | char ch); |
2538 | 3179 | ||
2539 | /* A wrapper around strdup. Partly to trap calls to strdup, partly | 3180 | /** A wrapper around strdup. Partly to trap calls to strdup, partly |
2540 | because in -ansi, gcc on Red Hat claims that strudup is undeclared */ | 3181 | because in -ansi, gcc on Red Hat claims that strdup is undeclared */ |
2541 | char* icalmemory_strdup(const char *s); | 3182 | char* icalmemory_strdup(const char *s); |
2542 | 3183 | ||
2543 | #endif /* !ICALMEMORY_H */ | 3184 | #endif /* !ICALMEMORY_H */ |
@@ -2549,7 +3190,6 @@ char* icalmemory_strdup(const char *s); | |||
2549 | FILE: icalerror.h | 3190 | FILE: icalerror.h |
2550 | CREATOR: eric 09 May 1999 | 3191 | CREATOR: eric 09 May 1999 |
2551 | 3192 | ||
2552 | $Id$ | ||
2553 | 3193 | ||
2554 | 3194 | ||
2555 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 3195 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
@@ -2578,13 +3218,12 @@ char* icalmemory_strdup(const char *s); | |||
2578 | 3218 | ||
2579 | 3219 | ||
2580 | #ifdef HAVE_CONFIG_H | 3220 | #ifdef HAVE_CONFIG_H |
2581 | #include "config.h" | ||
2582 | #endif | 3221 | #endif |
2583 | 3222 | ||
2584 | #define ICAL_SETERROR_ISFUNC | 3223 | #define ICAL_SETERROR_ISFUNC |
2585 | 3224 | ||
2586 | 3225 | ||
2587 | /* This routine is called before any error is triggered. It is called | 3226 | /** This routine is called before any error is triggered. It is called |
2588 | by icalerror_set_errno, so it does not appear in all of the macros | 3227 | by icalerror_set_errno, so it does not appear in all of the macros |
2589 | below */ | 3228 | below */ |
2590 | void icalerror_stop_here(void); | 3229 | void icalerror_stop_here(void); |
@@ -2592,7 +3231,7 @@ void icalerror_stop_here(void); | |||
2592 | void icalerror_crash_here(void); | 3231 | void icalerror_crash_here(void); |
2593 | 3232 | ||
2594 | typedef enum icalerrorenum { | 3233 | typedef enum icalerrorenum { |
2595 | 3234 | ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */ | |
2596 | ICAL_BADARG_ERROR, | 3235 | ICAL_BADARG_ERROR, |
2597 | ICAL_NEWFAILED_ERROR, | 3236 | ICAL_NEWFAILED_ERROR, |
2598 | ICAL_ALLOCATION_ERROR, | 3237 | ICAL_ALLOCATION_ERROR, |
@@ -2602,15 +3241,18 @@ typedef enum icalerrorenum { | |||
2602 | ICAL_FILE_ERROR, | 3241 | ICAL_FILE_ERROR, |
2603 | ICAL_USAGE_ERROR, | 3242 | ICAL_USAGE_ERROR, |
2604 | ICAL_UNIMPLEMENTED_ERROR, | 3243 | ICAL_UNIMPLEMENTED_ERROR, |
2605 | ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/ | 3244 | ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ |
2606 | ICAL_NO_ERROR | ||
2607 | 3245 | ||
2608 | } icalerrorenum; | 3246 | } icalerrorenum; |
2609 | 3247 | ||
2610 | /* The libical error enumeration, like errno*/ | 3248 | icalerrorenum * icalerrno_return(void); |
2611 | extern icalerrorenum icalerrno; | 3249 | #define icalerrno (*(icalerrno_return())) |
2612 | 3250 | ||
2613 | /* If true, libicl aborts after a call to icalerror_set_error*/ | 3251 | /** If true, libicl aborts after a call to icalerror_set_error |
3252 | * | ||
3253 | * @warning NOT THREAD SAFE -- recommended that you do not change | ||
3254 | * this in a multithreaded program. | ||
3255 | */ | ||
2614 | extern int icalerror_errors_are_fatal; | 3256 | extern int icalerror_errors_are_fatal; |
2615 | 3257 | ||
2616 | /* Warning messages */ | 3258 | /* Warning messages */ |
@@ -2623,6 +3265,7 @@ extern int icalerror_errors_are_fatal; | |||
2623 | 3265 | ||
2624 | 3266 | ||
2625 | void icalerror_clear_errno(void); | 3267 | void icalerror_clear_errno(void); |
3268 | void _icalerror_set_errno(icalerrorenum); | ||
2626 | 3269 | ||
2627 | /* Make an individual error fatal or non-fatal. */ | 3270 | /* Make an individual error fatal or non-fatal. */ |
2628 | typedef enum icalerrorstate { | 3271 | typedef enum icalerrorstate { |
@@ -2647,7 +3290,7 @@ if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ | |||
2647 | assert(0); \ | 3290 | assert(0); \ |
2648 | } | 3291 | } |
2649 | #else | 3292 | #else |
2650 | void icalerror_set_errno(icalerrorenum); | 3293 | void icalerror_set_errno(icalerrorenum x); |
2651 | #endif | 3294 | #endif |
2652 | 3295 | ||
2653 | #ifdef ICAL_ERRORS_ARE_FATAL | 3296 | #ifdef ICAL_ERRORS_ARE_FATAL |
@@ -2705,7 +3348,6 @@ void icalerror_restore(const char* error, icalerrorstate es); | |||
2705 | FILE: icalrestriction.h | 3348 | FILE: icalrestriction.h |
2706 | CREATOR: eric 24 April 1999 | 3349 | CREATOR: eric 24 April 1999 |
2707 | 3350 | ||
2708 | $Id$ | ||
2709 | 3351 | ||
2710 | 3352 | ||
2711 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 3353 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
@@ -2766,8 +3408,6 @@ int icalrestriction_check(icalcomponent* comp); | |||
2766 | FILE: sspm.h Mime Parser | 3408 | FILE: sspm.h Mime Parser |
2767 | CREATOR: eric 25 June 2000 | 3409 | CREATOR: eric 25 June 2000 |
2768 | 3410 | ||
2769 | $Id$ | ||
2770 | $Locker$ | ||
2771 | 3411 | ||
2772 | The contents of this file are subject to the Mozilla Public License | 3412 | The contents of this file are subject to the Mozilla Public License |
2773 | Version 1.0 (the "License"); you may not use this file except in | 3413 | Version 1.0 (the "License"); you may not use this file except in |
@@ -2910,8 +3550,6 @@ int sspm_write_mime(struct sspm_part *parts,size_t num_parts, | |||
2910 | CREATOR: eric 26 July 2000 | 3550 | CREATOR: eric 26 July 2000 |
2911 | 3551 | ||
2912 | 3552 | ||
2913 | $Id$ | ||
2914 | $Locker$ | ||
2915 | 3553 | ||
2916 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 3554 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
2917 | 3555 | ||
@@ -2952,8 +3590,6 @@ char* icalmime_as_mime_string(char* component); | |||
2952 | 3590 | ||
2953 | DESCRIPTION: | 3591 | DESCRIPTION: |
2954 | 3592 | ||
2955 | $Id$ | ||
2956 | $Locker$ | ||
2957 | 3593 | ||
2958 | (C) COPYRIGHT 1999 Eric Busboom | 3594 | (C) COPYRIGHT 1999 Eric Busboom |
2959 | http://www.softwarestudio.org | 3595 | http://www.softwarestudio.org |
@@ -2988,9 +3624,17 @@ icalcomponent* icallangbind_get_first_component(icalcomponent *c, | |||
2988 | icalcomponent* icallangbind_get_next_component(icalcomponent *c, | 3624 | icalcomponent* icallangbind_get_next_component(icalcomponent *c, |
2989 | const char* comp); | 3625 | const char* comp); |
2990 | 3626 | ||
3627 | icalparameter* icallangbind_get_first_parameter(icalproperty *prop); | ||
3628 | |||
3629 | icalparameter* icallangbind_get_next_parameter(icalproperty *prop); | ||
2991 | 3630 | ||
2992 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep); | 3631 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep); |
2993 | 3632 | ||
2994 | 3633 | ||
2995 | int icallangbind_string_to_open_flag(const char* str); | 3634 | int icallangbind_string_to_open_flag(const char* str); |
3635 | |||
3636 | const char* icallangbind_quote_as_ical(const char* str); | ||
2996 | #endif /*__ICALLANGBIND_H__*/ | 3637 | #endif /*__ICALLANGBIND_H__*/ |
3638 | #ifdef __cplusplus | ||
3639 | }; | ||
3640 | #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 @@ | |||
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- | ||
2 | ====================================================================== | ||
3 | FILE: icalarray.c | ||
4 | CREATOR: Damon Chaplin 07 March 2001 | ||
5 | |||
6 | $Id$ | ||
7 | $Locker$ | ||
8 | |||
9 | (C) COPYRIGHT 2001, Ximian, Inc. | ||
10 | |||
11 | This program is free software; you can redistribute it and/or modify | ||
12 | it under the terms of either: | ||
13 | |||
14 | The LGPL as published by the Free Software Foundation, version | ||
15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
16 | |||
17 | Or: | ||
18 | |||
19 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
20 | the License at http://www.mozilla.org/MPL/ | ||
21 | |||
22 | |||
23 | ======================================================================*/ | ||
24 | |||
25 | /** @file icalarray.c | ||
26 | * | ||
27 | * @brief An array of arbitrarily-sized elements which grows | ||
28 | * dynamically as elements are added. | ||
29 | */ | ||
30 | |||
31 | #ifdef HAVE_CONFIG_H | ||
32 | #include "config.h" | ||
33 | #endif | ||
34 | |||
35 | #include <stdlib.h> | ||
36 | #include <string.h> | ||
37 | |||
38 | #include "icalarray.h" | ||
39 | #include "icalerror.h" | ||
40 | |||
41 | |||
42 | static void icalarray_expand (icalarray*array, | ||
43 | int space_needed); | ||
44 | |||
45 | /** @brief Constructor | ||
46 | */ | ||
47 | |||
48 | icalarray* | ||
49 | icalarray_new (int element_size, | ||
50 | int increment_size) | ||
51 | { | ||
52 | icalarray *array; | ||
53 | |||
54 | array = (icalarray*) malloc (sizeof (icalarray)); | ||
55 | if (!array) { | ||
56 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
57 | return NULL; | ||
58 | } | ||
59 | |||
60 | array->element_size = element_size; | ||
61 | array->increment_size = increment_size; | ||
62 | array->num_elements = 0; | ||
63 | array->space_allocated = 0; | ||
64 | array->data = NULL; | ||
65 | |||
66 | return array; | ||
67 | } | ||
68 | |||
69 | /** @brief Destructor | ||
70 | */ | ||
71 | |||
72 | void | ||
73 | icalarray_free (icalarray*array) | ||
74 | { | ||
75 | if (array->data) | ||
76 | free (array->data); | ||
77 | free (array); | ||
78 | } | ||
79 | |||
80 | |||
81 | void | ||
82 | icalarray_append (icalarray*array, | ||
83 | void *element) | ||
84 | { | ||
85 | if (array->num_elements >= array->space_allocated) | ||
86 | icalarray_expand (array, 1); | ||
87 | |||
88 | memcpy ((char *)(array->data) + ( array->num_elements * array->element_size ), element, | ||
89 | array->element_size); | ||
90 | array->num_elements++; | ||
91 | } | ||
92 | |||
93 | |||
94 | void* | ||
95 | icalarray_element_at (icalarray*array, | ||
96 | int position) | ||
97 | { | ||
98 | assert (position >= 0); | ||
99 | assert (position < array->num_elements); | ||
100 | |||
101 | return (char *)(array->data) + (position * array->element_size); | ||
102 | } | ||
103 | |||
104 | |||
105 | void | ||
106 | icalarray_remove_element_at (icalarray*array, | ||
107 | int position) | ||
108 | { | ||
109 | void *dest; | ||
110 | int elements_to_move; | ||
111 | |||
112 | assert (position >= 0); | ||
113 | assert (position < array->num_elements); | ||
114 | |||
115 | dest = (char *)array->data + (position * array->element_size); | ||
116 | elements_to_move = array->num_elements - position - 1; | ||
117 | |||
118 | if (elements_to_move > 0) | ||
119 | memmove (dest, (char *)dest + array->element_size, | ||
120 | elements_to_move * array->element_size); | ||
121 | |||
122 | array->num_elements--; | ||
123 | } | ||
124 | |||
125 | |||
126 | void | ||
127 | icalarray_sort (icalarray*array, | ||
128 | int (*compare) (const void *, | ||
129 | const void *)) | ||
130 | { | ||
131 | qsort (array->data, array->num_elements, array->element_size, compare); | ||
132 | } | ||
133 | |||
134 | |||
135 | static void | ||
136 | icalarray_expand (icalarray*array, | ||
137 | int space_needed) | ||
138 | { | ||
139 | int new_space_allocated; | ||
140 | void *new_data; | ||
141 | |||
142 | new_space_allocated = array->space_allocated + array->increment_size; | ||
143 | |||
144 | if (space_needed > array->increment_size) | ||
145 | new_space_allocated += space_needed; | ||
146 | |||
147 | /* | ||
148 | new_data = realloc (array->data, | ||
149 | new_space_allocated * array->element_size); | ||
150 | */ | ||
151 | new_data = malloc(new_space_allocated * array->element_size); | ||
152 | memcpy(new_data,array->data,array->element_size*array->space_allocated); | ||
153 | free(array->data); | ||
154 | |||
155 | if (new_data) { | ||
156 | array->data = new_data; | ||
157 | array->space_allocated = new_space_allocated; | ||
158 | } else { | ||
159 | icalerror_set_errno(ICAL_ALLOCATION_ERROR); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
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 @@ | |||
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalarray.h | ||
4 | CREATOR: Damon Chaplin 07 March 2001 | ||
5 | |||
6 | |||
7 | $Id$ | ||
8 | $Locker$ | ||
9 | |||
10 | (C) COPYRIGHT 2001, Ximian, Inc. | ||
11 | |||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of either: | ||
14 | |||
15 | The LGPL as published by the Free Software Foundation, version | ||
16 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
17 | |||
18 | Or: | ||
19 | |||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
21 | the License at http://www.mozilla.org/MPL/ | ||
22 | |||
23 | |||
24 | ======================================================================*/ | ||
25 | |||
26 | |||
27 | #ifndef ICALARRAY_H | ||
28 | #define ICALARRAY_H | ||
29 | |||
30 | /** @file icalarray.h | ||
31 | * | ||
32 | * @brief An array of arbitrarily-sized elements which grows | ||
33 | * dynamically as elements are added. | ||
34 | */ | ||
35 | |||
36 | typedef struct _icalarray icalarray; | ||
37 | struct _icalarray { | ||
38 | unsigned int element_size; | ||
39 | unsigned int increment_size; | ||
40 | unsigned int num_elements; | ||
41 | unsigned int space_allocated; | ||
42 | void *data; | ||
43 | }; | ||
44 | |||
45 | |||
46 | |||
47 | icalarray *icalarray_new (int element_size, | ||
48 | int increment_size); | ||
49 | void icalarray_free (icalarray*array); | ||
50 | |||
51 | void icalarray_append (icalarray*array, | ||
52 | void *element); | ||
53 | void icalarray_remove_element_at (icalarray*array, | ||
54 | int position); | ||
55 | |||
56 | void *icalarray_element_at (icalarray*array, | ||
57 | int position); | ||
58 | |||
59 | void icalarray_sort (icalarray*array, | ||
60 | int (*compare) (const void *, const void *)); | ||
61 | |||
62 | |||
63 | #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 @@ | |||
1 | /* -*- Mode: C -*- | ||
2 | ====================================================================== | ||
3 | FILE: icalattach.c | ||
4 | CREATOR: acampi 28 May 02 | ||
5 | |||
6 | $Id$ | ||
7 | $Locker$ | ||
8 | |||
9 | |||
10 | (C) COPYRIGHT 2000, Andrea Campi | ||
11 | |||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of either: | ||
14 | |||
15 | The LGPL as published by the Free Software Foundation, version | ||
16 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
17 | |||
18 | Or: | ||
19 | |||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
21 | the License at http://www.mozilla.org/MPL/ | ||
22 | |||
23 | The original code is icaltypes.c | ||
24 | |||
25 | ======================================================================*/ | ||
26 | #ifdef HAVE_CONFIG_H | ||
27 | #include "config.h" | ||
28 | #endif | ||
29 | |||
30 | #include "icaltypes.h" | ||
31 | #include "icalerror.h" | ||
32 | #include "icalmemory.h" | ||
33 | #include "icalattachimpl.h" | ||
34 | #include <stdlib.h> /* for malloc and abs() */ | ||
35 | #include <errno.h> /* for errno */ | ||
36 | #include <string.h> /* for icalmemory_strdup */ | ||
37 | #include <assert.h> | ||
38 | |||
39 | icalattach * | ||
40 | icalattach_new_from_url (const char *url) | ||
41 | { | ||
42 | icalattach *attach; | ||
43 | char *url_copy; | ||
44 | |||
45 | icalerror_check_arg_rz ((url != NULL), "url"); | ||
46 | |||
47 | if ((attach = malloc (sizeof (icalattach))) == NULL) { | ||
48 | errno = ENOMEM; | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | if ((url_copy = strdup (url)) == NULL) { | ||
53 | free (attach); | ||
54 | errno = ENOMEM; | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
58 | attach->refcount = 1; | ||
59 | attach->is_url = 1; | ||
60 | attach->u.url.url = url_copy; | ||
61 | |||
62 | return attach; | ||
63 | } | ||
64 | |||
65 | icalattach * | ||
66 | icalattach_new_from_data (unsigned char *data, icalattach_free_fn_t free_fn, | ||
67 | void *free_fn_data) | ||
68 | { | ||
69 | icalattach *attach; | ||
70 | |||
71 | icalerror_check_arg_rz ((data != NULL), "data"); | ||
72 | |||
73 | if ((attach = malloc (sizeof (icalattach))) == NULL) { | ||
74 | errno = ENOMEM; | ||
75 | return NULL; | ||
76 | } | ||
77 | |||
78 | attach->refcount = 1; | ||
79 | attach->is_url = 0; | ||
80 | attach->u.data.data = data; | ||
81 | attach->u.data.free_fn = free_fn; | ||
82 | attach->u.data.free_fn_data = free_fn_data; | ||
83 | |||
84 | return attach; | ||
85 | } | ||
86 | |||
87 | void | ||
88 | icalattach_ref (icalattach *attach) | ||
89 | { | ||
90 | icalerror_check_arg_rv ((attach != NULL), "attach"); | ||
91 | icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0"); | ||
92 | |||
93 | attach->refcount++; | ||
94 | } | ||
95 | |||
96 | void | ||
97 | icalattach_unref (icalattach *attach) | ||
98 | { | ||
99 | icalerror_check_arg_rv ((attach != NULL), "attach"); | ||
100 | icalerror_check_arg_rv ((attach->refcount > 0), "attach->refcount > 0"); | ||
101 | |||
102 | attach->refcount--; | ||
103 | |||
104 | if (attach->refcount != 0) | ||
105 | return; | ||
106 | |||
107 | if (attach->is_url) | ||
108 | free (attach->u.url.url); | ||
109 | else if (attach->u.data.free_fn) | ||
110 | (* attach->u.data.free_fn) (attach->u.data.data, attach->u.data.free_fn_data); | ||
111 | |||
112 | free (attach); | ||
113 | } | ||
114 | |||
115 | int | ||
116 | icalattach_get_is_url (icalattach *attach) | ||
117 | { | ||
118 | icalerror_check_arg_rz ((attach != NULL), "attach"); | ||
119 | |||
120 | return attach->is_url ? 1 : 0; | ||
121 | } | ||
122 | |||
123 | const char * | ||
124 | icalattach_get_url (icalattach *attach) | ||
125 | { | ||
126 | icalerror_check_arg_rz ((attach != NULL), "attach"); | ||
127 | icalerror_check_arg_rz ((attach->is_url), "attach->is_url"); | ||
128 | |||
129 | return attach->u.url.url; | ||
130 | } | ||
131 | |||
132 | unsigned char * | ||
133 | icalattach_get_data (icalattach *attach) | ||
134 | { | ||
135 | icalerror_check_arg_rz ((attach != NULL), "attach"); | ||
136 | icalerror_check_arg_rz ((!attach->is_url), "!attach->is_url"); | ||
137 | |||
138 | return attach->u.data.data; | ||
139 | } | ||
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 @@ | |||
1 | /* -*- Mode: C -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalattach.h | ||
4 | CREATOR: acampi 28 May 02 | ||
5 | |||
6 | |||
7 | (C) COPYRIGHT 2002, Andrea Campi | ||
8 | |||
9 | This program is free software; you can redistribute it and/or modify | ||
10 | it under the terms of either: | ||
11 | |||
12 | The LGPL as published by the Free Software Foundation, version | ||
13 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
14 | |||
15 | Or: | ||
16 | |||
17 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
18 | the License at http://www.mozilla.org/MPL/ | ||
19 | |||
20 | The original code is icalattach.h | ||
21 | |||
22 | ======================================================================*/ | ||
23 | |||
24 | #ifndef ICALATTACH_H | ||
25 | #define ICALATTACH_H | ||
26 | |||
27 | |||
28 | typedef struct icalattach_impl icalattach; | ||
29 | |||
30 | typedef void (* icalattach_free_fn_t) (unsigned char *data, void *user_data); | ||
31 | |||
32 | icalattach *icalattach_new_from_url (const char *url); | ||
33 | icalattach *icalattach_new_from_data (unsigned char *data, | ||
34 | icalattach_free_fn_t free_fn, void *free_fn_data); | ||
35 | |||
36 | void icalattach_ref (icalattach *attach); | ||
37 | void icalattach_unref (icalattach *attach); | ||
38 | |||
39 | int icalattach_get_is_url (icalattach *attach); | ||
40 | const char *icalattach_get_url (icalattach *attach); | ||
41 | unsigned char *icalattach_get_data (icalattach *attach); | ||
42 | |||
43 | struct icalattachtype* icalattachtype_new(void); | ||
44 | void icalattachtype_add_reference(struct icalattachtype* v); | ||
45 | void icalattachtype_free(struct icalattachtype* v); | ||
46 | |||
47 | void icalattachtype_set_url(struct icalattachtype* v, char* url); | ||
48 | char* icalattachtype_get_url(struct icalattachtype* v); | ||
49 | |||
50 | void icalattachtype_set_base64(struct icalattachtype* v, char* base64, | ||
51 | int owns); | ||
52 | char* icalattachtype_get_base64(struct icalattachtype* v); | ||
53 | |||
54 | void icalattachtype_set_binary(struct icalattachtype* v, char* binary, | ||
55 | int owns); | ||
56 | void* icalattachtype_get_binary(struct icalattachtype* v); | ||
57 | |||
58 | |||
59 | |||
60 | #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 @@ | |||
1 | /* -*- Mode: C -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalattachimpl.h | ||
4 | CREATOR: acampi 28 May 02 | ||
5 | |||
6 | $Id$ | ||
7 | |||
8 | |||
9 | (C) COPYRIGHT 2000, Andrea Campi | ||
10 | |||
11 | This program is free software; you can redistribute it and/or modify | ||
12 | it under the terms of either: | ||
13 | |||
14 | The LGPL as published by the Free Software Foundation, version | ||
15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
16 | |||
17 | Or: | ||
18 | |||
19 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
20 | the License at http://www.mozilla.org/MPL/ | ||
21 | |||
22 | The original code is icalattachimpl.h | ||
23 | |||
24 | |||
25 | ======================================================================*/ | ||
26 | |||
27 | #ifdef HAVE_CONFIG_H | ||
28 | #include <config.h> | ||
29 | #endif | ||
30 | |||
31 | #ifndef ICALATTACHIMPL_H | ||
32 | #define ICALATTACHIMPL_H | ||
33 | |||
34 | #include "icalattach.h" | ||
35 | |||
36 | /* Private structure for ATTACH values */ | ||
37 | struct icalattach_impl { | ||
38 | /* Reference count */ | ||
39 | int refcount; | ||
40 | |||
41 | union { | ||
42 | /* URL attachment data */ | ||
43 | struct { | ||
44 | char *url; | ||
45 | } url; | ||
46 | |||
47 | /* Inline data */ | ||
48 | struct { | ||
49 | unsigned char *data; | ||
50 | icalattach_free_fn_t free_fn; | ||
51 | void *free_fn_data; | ||
52 | } data; | ||
53 | } u; | ||
54 | |||
55 | /* TRUE if URL, FALSE if inline data */ | ||
56 | unsigned int is_url : 1; | ||
57 | }; | ||
58 | |||
59 | #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 | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | $Id$ | 5 | $Id$ |
6 | 6 | ||
7 | |||
8 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 7 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
9 | 8 | ||
10 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
@@ -33,18 +32,20 @@ | |||
33 | #include "icalmemory.h" | 32 | #include "icalmemory.h" |
34 | #include "icalenums.h" | 33 | #include "icalenums.h" |
35 | #include "icaltime.h" | 34 | #include "icaltime.h" |
35 | #include "icalarray.h" | ||
36 | #include "icaltimezone.h" | ||
36 | #include "icalduration.h" | 37 | #include "icalduration.h" |
37 | #include "icalperiod.h" | 38 | #include "icalperiod.h" |
38 | #include "icalparser.h" | 39 | #include "icalparser.h" |
40 | #include "icalrestriction.h" | ||
39 | 41 | ||
40 | #include <stdlib.h> /* for malloc */ | 42 | #include <stdlib.h> /* for malloc */ |
41 | #include <stdarg.h> /* for va_list, etc */ | 43 | #include <stdarg.h> /* for va_list, etc */ |
42 | #include <errno.h> | 44 | #include <errno.h> |
43 | #include <assert.h> | 45 | #include <assert.h> |
44 | #include <stdio.h> /* for fprintf */ | 46 | #include <stdio.h> /* for fprintf */ |
45 | #include <string.h> | 47 | #include <string.h> /* for strdup */ |
46 | 48 | #include <limits.h> /* for INT_MAX */ | |
47 | #define MAX_TMP 1024 | ||
48 | 49 | ||
49 | struct icalcomponent_impl | 50 | struct icalcomponent_impl |
50 | { | 51 | { |
@@ -56,18 +57,42 @@ struct icalcomponent_impl | |||
56 | pvl_list components; | 57 | pvl_list components; |
57 | pvl_elem component_iterator; | 58 | pvl_elem component_iterator; |
58 | icalcomponent* parent; | 59 | icalcomponent* parent; |
60 | |||
61 | /** An array of icaltimezone structs. We use this so we can do fast | ||
62 | lookup of timezones using binary searches. timezones_sorted is | ||
63 | set to 0 whenever we add a timezone, so we remember to sort the | ||
64 | array before doing a binary search. */ | ||
65 | icalarray* timezones; | ||
66 | int timezones_sorted; | ||
59 | }; | 67 | }; |
60 | 68 | ||
61 | /* icalproperty functions that only components get to use */ | 69 | /* icalproperty functions that only components get to use */ |
62 | void icalproperty_set_parent(icalproperty* property, | 70 | void icalproperty_set_parent(icalproperty* property, |
63 | icalcomponent* component); | 71 | icalcomponent* component); |
64 | icalcomponent* icalproperty_get_parent(icalproperty* property); | 72 | icalcomponent* icalproperty_get_parent(icalproperty* property); |
65 | void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args); | 73 | void icalcomponent_add_children(icalcomponent *impl,va_list args); |
66 | icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind); | 74 | static icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind); |
67 | int icalcomponent_property_sorter(void *a, void *b); | 75 | |
68 | 76 | static void icalcomponent_merge_vtimezone (icalcomponent *comp, | |
69 | 77 | icalcomponent *vtimezone, | |
70 | void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args) | 78 | icalarray *tzids_to_rename); |
79 | static void icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, | ||
80 | icalcomponent *vtimezone, | ||
81 | icalproperty *tzid_prop, | ||
82 | const char *tzid, | ||
83 | icalarray *tzids_to_rename); | ||
84 | static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid); | ||
85 | static void icalcomponent_rename_tzids(icalcomponent* comp, | ||
86 | icalarray* rename_table); | ||
87 | static void icalcomponent_rename_tzids_callback(icalparameter *param, | ||
88 | void *data); | ||
89 | static int icalcomponent_compare_vtimezones (icalcomponent*vtimezone1, | ||
90 | icalcomponent*vtimezone2); | ||
91 | static int icalcomponent_compare_timezone_fn (const void*elem1, | ||
92 | const void*elem2); | ||
93 | |||
94 | |||
95 | void icalcomponent_add_children(icalcomponent *impl, va_list args) | ||
71 | { | 96 | { |
72 | void* vp; | 97 | void* vp; |
73 | 98 | ||
@@ -77,25 +102,23 @@ void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args) | |||
77 | icalproperty_isa_property(vp) != 0 ) ; | 102 | icalproperty_isa_property(vp) != 0 ) ; |
78 | 103 | ||
79 | if (icalcomponent_isa_component(vp) != 0 ){ | 104 | if (icalcomponent_isa_component(vp) != 0 ){ |
80 | 105 | icalcomponent_add_component(impl, (icalcomponent*)vp); | |
81 | icalcomponent_add_component((icalcomponent*)impl, | ||
82 | (icalcomponent*)vp); | ||
83 | 106 | ||
84 | } else if (icalproperty_isa_property(vp) != 0 ){ | 107 | } else if (icalproperty_isa_property(vp) != 0 ){ |
85 | 108 | icalcomponent_add_property(impl, (icalproperty*)vp); | |
86 | icalcomponent_add_property((icalcomponent*)impl, | ||
87 | (icalproperty*)vp); | ||
88 | } | 109 | } |
89 | } | 110 | } |
90 | } | 111 | } |
91 | 112 | ||
92 | icalcomponent* | 113 | static icalcomponent* |
93 | icalcomponent_new_impl (icalcomponent_kind kind) | 114 | icalcomponent_new_impl (icalcomponent_kind kind) |
94 | { | 115 | { |
95 | struct icalcomponent_impl* comp; | 116 | icalcomponent* comp; |
96 | 117 | ||
97 | if ( ( comp = (struct icalcomponent_impl*) | 118 | if (!icalcomponent_kind_is_valid(kind)) |
98 | malloc(sizeof(struct icalcomponent_impl))) == 0) { | 119 | return NULL; |
120 | |||
121 | if ( ( comp = (icalcomponent*) malloc(sizeof(icalcomponent))) == 0) { | ||
99 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 122 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); |
100 | return 0; | 123 | return 0; |
101 | } | 124 | } |
@@ -109,22 +132,28 @@ icalcomponent_new_impl (icalcomponent_kind kind) | |||
109 | comp->component_iterator = 0; | 132 | comp->component_iterator = 0; |
110 | comp->x_name = 0; | 133 | comp->x_name = 0; |
111 | comp->parent = 0; | 134 | comp->parent = 0; |
135 | comp->timezones = NULL; | ||
136 | comp->timezones_sorted = 1; | ||
112 | 137 | ||
113 | return comp; | 138 | return comp; |
114 | } | 139 | } |
115 | 140 | ||
141 | /** @brief Constructor | ||
142 | */ | ||
116 | icalcomponent* | 143 | icalcomponent* |
117 | icalcomponent_new (icalcomponent_kind kind) | 144 | icalcomponent_new (icalcomponent_kind kind) |
118 | { | 145 | { |
119 | return (icalcomponent*)icalcomponent_new_impl(kind); | 146 | return icalcomponent_new_impl(kind); |
120 | } | 147 | } |
121 | 148 | ||
149 | /** @brief Constructor | ||
150 | */ | ||
122 | icalcomponent* | 151 | icalcomponent* |
123 | icalcomponent_vanew (icalcomponent_kind kind, ...) | 152 | icalcomponent_vanew (icalcomponent_kind kind, ...) |
124 | { | 153 | { |
125 | va_list args; | 154 | va_list args; |
126 | 155 | ||
127 | struct icalcomponent_impl *impl = icalcomponent_new_impl(kind); | 156 | icalcomponent *impl = icalcomponent_new_impl(kind); |
128 | 157 | ||
129 | if (impl == 0){ | 158 | if (impl == 0){ |
130 | return 0; | 159 | return 0; |
@@ -134,23 +163,26 @@ icalcomponent_vanew (icalcomponent_kind kind, ...) | |||
134 | icalcomponent_add_children(impl, args); | 163 | icalcomponent_add_children(impl, args); |
135 | va_end(args); | 164 | va_end(args); |
136 | 165 | ||
137 | return (icalcomponent*) impl; | 166 | return impl; |
138 | } | 167 | } |
139 | 168 | ||
169 | /** @brief Constructor | ||
170 | */ | ||
140 | icalcomponent* icalcomponent_new_from_string(char* str) | 171 | icalcomponent* icalcomponent_new_from_string(char* str) |
141 | { | 172 | { |
142 | return icalparser_parse_string(str); | 173 | return icalparser_parse_string(str); |
143 | } | 174 | } |
144 | 175 | ||
145 | icalcomponent* icalcomponent_new_clone(icalcomponent* component) | 176 | /** @brief Constructor |
177 | */ | ||
178 | icalcomponent* icalcomponent_new_clone(icalcomponent* old) | ||
146 | { | 179 | { |
147 | struct icalcomponent_impl *old = (struct icalcomponent_impl*)component; | 180 | icalcomponent *new; |
148 | struct icalcomponent_impl *new; | ||
149 | icalproperty *p; | 181 | icalproperty *p; |
150 | icalcomponent *c; | 182 | icalcomponent *c; |
151 | pvl_elem itr; | 183 | pvl_elem itr; |
152 | 184 | ||
153 | icalerror_check_arg_rz( (component!=0), "component"); | 185 | icalerror_check_arg_rz( (old!=0), "component"); |
154 | 186 | ||
155 | new = icalcomponent_new_impl(old->kind); | 187 | new = icalcomponent_new_impl(old->kind); |
156 | 188 | ||
@@ -180,15 +212,15 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component) | |||
180 | 212 | ||
181 | } | 213 | } |
182 | 214 | ||
183 | 215 | /*** @brief Destructor | |
216 | */ | ||
184 | void | 217 | void |
185 | icalcomponent_free (icalcomponent* component) | 218 | icalcomponent_free (icalcomponent* c) |
186 | { | 219 | { |
187 | icalproperty* prop; | 220 | icalproperty* prop; |
188 | icalcomponent* comp; | 221 | icalcomponent* comp; |
189 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | ||
190 | 222 | ||
191 | icalerror_check_arg_rv( (component!=0), "component"); | 223 | icalerror_check_arg_rv( (c!=0), "component"); |
192 | 224 | ||
193 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR | 225 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR |
194 | icalerror_assert( (c->parent ==0),"Tried to free a component that is still attached to a parent component"); | 226 | icalerror_assert( (c->parent ==0),"Tried to free a component that is still attached to a parent component"); |
@@ -198,19 +230,22 @@ icalcomponent_free (icalcomponent* component) | |||
198 | } | 230 | } |
199 | #endif | 231 | #endif |
200 | 232 | ||
201 | if(component != 0 ){ | 233 | if(c != 0 ){ |
202 | 234 | ||
203 | while( (prop=pvl_pop(c->properties)) != 0){ | 235 | if ( c->properties != 0 ) |
204 | assert(prop != 0); | 236 | { |
205 | icalproperty_set_parent(prop,0); | 237 | while( (prop=pvl_pop(c->properties)) != 0){ |
206 | icalproperty_free(prop); | 238 | assert(prop != 0); |
207 | } | 239 | icalproperty_set_parent(prop,0); |
208 | 240 | icalproperty_free(prop); | |
209 | pvl_free(c->properties); | 241 | } |
242 | pvl_free(c->properties); | ||
243 | } | ||
244 | |||
210 | 245 | ||
211 | while( (comp=pvl_data(pvl_head(c->components))) != 0){ | 246 | while( (comp=pvl_data(pvl_head(c->components))) != 0){ |
212 | assert(comp!=0); | 247 | assert(comp!=0); |
213 | icalcomponent_remove_component(component,comp); | 248 | icalcomponent_remove_component(c,comp); |
214 | icalcomponent_free(comp); | 249 | icalcomponent_free(comp); |
215 | } | 250 | } |
216 | 251 | ||
@@ -220,6 +255,9 @@ icalcomponent_free (icalcomponent* component) | |||
220 | free(c->x_name); | 255 | free(c->x_name); |
221 | } | 256 | } |
222 | 257 | ||
258 | if (c->timezones) | ||
259 | icaltimezone_array_free (c->timezones); | ||
260 | |||
223 | c->kind = ICAL_NO_COMPONENT; | 261 | c->kind = ICAL_NO_COMPONENT; |
224 | c->properties = 0; | 262 | c->properties = 0; |
225 | c->property_iterator = 0; | 263 | c->property_iterator = 0; |
@@ -227,36 +265,41 @@ icalcomponent_free (icalcomponent* component) | |||
227 | c->component_iterator = 0; | 265 | c->component_iterator = 0; |
228 | c->x_name = 0; | 266 | c->x_name = 0; |
229 | c->id[0] = 'X'; | 267 | c->id[0] = 'X'; |
268 | c->timezones = NULL; | ||
230 | 269 | ||
231 | free(c); | 270 | free(c); |
232 | } | 271 | } |
233 | } | 272 | } |
234 | 273 | ||
235 | char* | 274 | char* |
236 | icalcomponent_as_ical_string (icalcomponent* component) | 275 | icalcomponent_as_ical_string (icalcomponent* impl) |
237 | { | 276 | { |
238 | char* buf, *out_buf; | 277 | char* buf, *out_buf; |
239 | const char* tmp_buf; | 278 | const char* tmp_buf; |
240 | size_t buf_size = 1024; | 279 | size_t buf_size = 1024; |
241 | char* buf_ptr = 0; | 280 | char* buf_ptr = 0; |
242 | pvl_elem itr; | 281 | pvl_elem itr; |
243 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
244 | 282 | ||
283 | /* WIN32 automatically adds the \r, Anybody else need it? | ||
245 | #ifdef ICAL_UNIX_NEWLINE | 284 | #ifdef ICAL_UNIX_NEWLINE |
285 | */ | ||
246 | char newline[] = "\n"; | 286 | char newline[] = "\n"; |
287 | /* | ||
247 | #else | 288 | #else |
248 | char newline[] = "\n"; | 289 | char newline[] = "\r\n"; |
249 | #endif | 290 | #endif |
291 | */ | ||
292 | |||
250 | icalcomponent *c; | 293 | icalcomponent *c; |
251 | icalproperty *p; | 294 | icalproperty *p; |
252 | icalcomponent_kind kind = icalcomponent_isa(component); | 295 | icalcomponent_kind kind = icalcomponent_isa(impl); |
253 | 296 | ||
254 | const char* kind_string; | 297 | const char* kind_string; |
255 | 298 | ||
256 | buf = icalmemory_new_buffer(buf_size); | 299 | buf = icalmemory_new_buffer(buf_size); |
257 | buf_ptr = buf; | 300 | buf_ptr = buf; |
258 | 301 | ||
259 | icalerror_check_arg_rz( (component!=0), "component"); | 302 | icalerror_check_arg_rz( (impl!=0), "component"); |
260 | icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT"); | 303 | icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT"); |
261 | 304 | ||
262 | kind_string = icalcomponent_kind_to_string(kind); | 305 | kind_string = icalcomponent_kind_to_string(kind); |
@@ -267,13 +310,12 @@ icalcomponent_as_ical_string (icalcomponent* component) | |||
267 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); | 310 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); |
268 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); | 311 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); |
269 | 312 | ||
270 | 313 | ||
314 | |||
271 | for( itr = pvl_head(impl->properties); | 315 | for( itr = pvl_head(impl->properties); |
272 | itr != 0; | 316 | itr != 0; |
273 | itr = pvl_next(itr)) | 317 | itr = pvl_next(itr)) |
274 | { | 318 | { |
275 | // printf("3333calcomponent_as_ical_string System Timezone2: %s %s \n", *tzname, getenv("TZ") ); | ||
276 | |||
277 | p = (icalproperty*)pvl_data(itr); | 319 | p = (icalproperty*)pvl_data(itr); |
278 | 320 | ||
279 | icalerror_assert((p!=0),"Got a null property"); | 321 | icalerror_assert((p!=0),"Got a null property"); |
@@ -286,19 +328,19 @@ icalcomponent_as_ical_string (icalcomponent* component) | |||
286 | for( itr = pvl_head(impl->components); | 328 | for( itr = pvl_head(impl->components); |
287 | itr != 0; | 329 | itr != 0; |
288 | itr = pvl_next(itr)) | 330 | itr = pvl_next(itr)) |
289 | { | 331 | { |
290 | |||
291 | c = (icalcomponent*)pvl_data(itr); | 332 | c = (icalcomponent*)pvl_data(itr); |
292 | 333 | ||
293 | tmp_buf = icalcomponent_as_ical_string(c); | 334 | tmp_buf = icalcomponent_as_ical_string(c); |
335 | |||
294 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); | 336 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); |
295 | 337 | ||
296 | } | 338 | } |
297 | 339 | ||
298 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:"); //tzset(); | 340 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:"); |
299 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, | 341 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, |
300 | icalcomponent_kind_to_string(kind)); | 342 | icalcomponent_kind_to_string(kind)); |
301 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); //tzset(); | 343 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); |
302 | 344 | ||
303 | out_buf = icalmemory_tmp_copy(buf); | 345 | out_buf = icalmemory_tmp_copy(buf); |
304 | free(buf); | 346 | free(buf); |
@@ -310,11 +352,8 @@ icalcomponent_as_ical_string (icalcomponent* component) | |||
310 | int | 352 | int |
311 | icalcomponent_is_valid (icalcomponent* component) | 353 | icalcomponent_is_valid (icalcomponent* component) |
312 | { | 354 | { |
313 | struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; | 355 | if ( (strcmp(component->id,"comp") == 0) && |
314 | 356 | component->kind != ICAL_NO_COMPONENT){ | |
315 | |||
316 | if ( (strcmp(impl->id,"comp") == 0) && | ||
317 | impl->kind != ICAL_NO_COMPONENT){ | ||
318 | return 1; | 357 | return 1; |
319 | } else { | 358 | } else { |
320 | return 0; | 359 | return 0; |
@@ -324,14 +363,13 @@ icalcomponent_is_valid (icalcomponent* component) | |||
324 | 363 | ||
325 | 364 | ||
326 | icalcomponent_kind | 365 | icalcomponent_kind |
327 | icalcomponent_isa (icalcomponent* component) | 366 | icalcomponent_isa (const icalcomponent* component) |
328 | { | 367 | { |
329 | struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; | 368 | icalerror_check_arg_rx( (component!=0), "component", ICAL_NO_COMPONENT); |
330 | icalerror_check_arg_rz( (component!=0), "component"); | ||
331 | 369 | ||
332 | if(component != 0) | 370 | if(component != 0) |
333 | { | 371 | { |
334 | return impl->kind; | 372 | return component->kind; |
335 | } | 373 | } |
336 | 374 | ||
337 | return ICAL_NO_COMPONENT; | 375 | return ICAL_NO_COMPONENT; |
@@ -341,7 +379,7 @@ icalcomponent_isa (icalcomponent* component) | |||
341 | int | 379 | int |
342 | icalcomponent_isa_component (void* component) | 380 | icalcomponent_isa_component (void* component) |
343 | { | 381 | { |
344 | struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; | 382 | icalcomponent *impl = component; |
345 | 383 | ||
346 | icalerror_check_arg_rz( (component!=0), "component"); | 384 | icalerror_check_arg_rz( (component!=0), "component"); |
347 | 385 | ||
@@ -353,63 +391,32 @@ icalcomponent_isa_component (void* component) | |||
353 | 391 | ||
354 | } | 392 | } |
355 | 393 | ||
356 | int icalcomponent_property_sorter(void *a, void *b) | ||
357 | { | ||
358 | icalproperty_kind kinda, kindb; | ||
359 | const char *ksa, *ksb; | ||
360 | |||
361 | kinda = icalproperty_isa((icalproperty*)a); | ||
362 | kindb = icalproperty_isa((icalproperty*)b); | ||
363 | |||
364 | ksa = icalproperty_kind_to_string(kinda); | ||
365 | ksb = icalproperty_kind_to_string(kindb); | ||
366 | |||
367 | return strcmp(ksa,ksb); | ||
368 | } | ||
369 | |||
370 | |||
371 | void | 394 | void |
372 | icalcomponent_add_property (icalcomponent* component, icalproperty* property) | 395 | icalcomponent_add_property (icalcomponent* component, icalproperty* property) |
373 | { | 396 | { |
374 | struct icalcomponent_impl *impl; | ||
375 | |||
376 | icalerror_check_arg_rv( (component!=0), "component"); | 397 | icalerror_check_arg_rv( (component!=0), "component"); |
377 | icalerror_check_arg_rv( (property!=0), "property"); | 398 | icalerror_check_arg_rv( (property!=0), "property"); |
378 | 399 | ||
379 | impl = (struct icalcomponent_impl*)component; | ||
380 | |||
381 | 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"); | 400 | 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"); |
382 | 401 | ||
383 | icalproperty_set_parent(property,component); | 402 | icalproperty_set_parent(property,component); |
384 | 403 | ||
385 | #ifdef ICAL_INSERT_ORDERED | 404 | pvl_push(component->properties,property); |
386 | pvl_insert_ordered(impl->properties, | ||
387 | icalcomponent_property_sorter,property); | ||
388 | #else | ||
389 | pvl_push(impl->properties,property); | ||
390 | #endif | ||
391 | |||
392 | } | 405 | } |
393 | 406 | ||
394 | 407 | ||
395 | void | 408 | void |
396 | icalcomponent_remove_property (icalcomponent* component, icalproperty* property) | 409 | icalcomponent_remove_property (icalcomponent* component, icalproperty* property) |
397 | { | 410 | { |
398 | struct icalcomponent_impl *impl; | ||
399 | pvl_elem itr, next_itr; | 411 | pvl_elem itr, next_itr; |
400 | struct icalproperty_impl *pimpl; | ||
401 | 412 | ||
402 | icalerror_check_arg_rv( (component!=0), "component"); | 413 | icalerror_check_arg_rv( (component!=0), "component"); |
403 | icalerror_check_arg_rv( (property!=0), "property"); | 414 | icalerror_check_arg_rv( (property!=0), "property"); |
404 | 415 | ||
405 | impl = (struct icalcomponent_impl*)component; | ||
406 | |||
407 | pimpl = (struct icalproperty_impl*)property; | ||
408 | |||
409 | icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component"); | 416 | icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component"); |
410 | 417 | ||
411 | 418 | ||
412 | for( itr = pvl_head(impl->properties); | 419 | for( itr = pvl_head(component->properties); |
413 | itr != 0; | 420 | itr != 0; |
414 | itr = next_itr) | 421 | itr = next_itr) |
415 | { | 422 | { |
@@ -417,11 +424,11 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property) | |||
417 | 424 | ||
418 | if( pvl_data(itr) == (void*)property ){ | 425 | if( pvl_data(itr) == (void*)property ){ |
419 | 426 | ||
420 | if (impl->property_iterator == itr){ | 427 | if (component->property_iterator == itr){ |
421 | impl->property_iterator = pvl_next(itr); | 428 | component->property_iterator = pvl_next(itr); |
422 | } | 429 | } |
423 | 430 | ||
424 | pvl_remove( impl->properties, itr); | 431 | pvl_remove( component->properties, itr); |
425 | icalproperty_set_parent(property,0); | 432 | icalproperty_set_parent(property,0); |
426 | } | 433 | } |
427 | } | 434 | } |
@@ -433,11 +440,10 @@ icalcomponent_count_properties (icalcomponent* component, | |||
433 | { | 440 | { |
434 | int count=0; | 441 | int count=0; |
435 | pvl_elem itr; | 442 | pvl_elem itr; |
436 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
437 | 443 | ||
438 | icalerror_check_arg_rz( (component!=0), "component"); | 444 | icalerror_check_arg_rz( (component!=0), "component"); |
439 | 445 | ||
440 | for( itr = pvl_head(impl->properties); | 446 | for( itr = pvl_head(component->properties); |
441 | itr != 0; | 447 | itr != 0; |
442 | itr = pvl_next(itr)) | 448 | itr = pvl_next(itr)) |
443 | { | 449 | { |
@@ -454,23 +460,19 @@ icalcomponent_count_properties (icalcomponent* component, | |||
454 | 460 | ||
455 | icalproperty* icalcomponent_get_current_property (icalcomponent* component) | 461 | icalproperty* icalcomponent_get_current_property (icalcomponent* component) |
456 | { | 462 | { |
457 | |||
458 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | ||
459 | icalerror_check_arg_rz( (component!=0),"component"); | 463 | icalerror_check_arg_rz( (component!=0),"component"); |
460 | 464 | ||
461 | if ((c->property_iterator==0)){ | 465 | if ((component->property_iterator==0)){ |
462 | return 0; | 466 | return 0; |
463 | } | 467 | } |
464 | 468 | ||
465 | return (icalproperty*) pvl_data(c->property_iterator); | 469 | return (icalproperty*) pvl_data(component->property_iterator); |
466 | |||
467 | } | 470 | } |
468 | 471 | ||
469 | icalproperty* | 472 | icalproperty* |
470 | icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind kind) | 473 | icalcomponent_get_first_property (icalcomponent* c, icalproperty_kind kind) |
471 | { | 474 | { |
472 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 475 | icalerror_check_arg_rz( (c!=0),"component"); |
473 | icalerror_check_arg_rz( (component!=0),"component"); | ||
474 | 476 | ||
475 | for( c->property_iterator = pvl_head(c->properties); | 477 | for( c->property_iterator = pvl_head(c->properties); |
476 | c->property_iterator != 0; | 478 | c->property_iterator != 0; |
@@ -487,10 +489,9 @@ icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind ki | |||
487 | } | 489 | } |
488 | 490 | ||
489 | icalproperty* | 491 | icalproperty* |
490 | icalcomponent_get_next_property (icalcomponent* component, icalproperty_kind kind) | 492 | icalcomponent_get_next_property (icalcomponent* c, icalproperty_kind kind) |
491 | { | 493 | { |
492 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 494 | icalerror_check_arg_rz( (c!=0),"component"); |
493 | icalerror_check_arg_rz( (component!=0),"component"); | ||
494 | 495 | ||
495 | if (c->property_iterator == 0){ | 496 | if (c->property_iterator == 0){ |
496 | return 0; | 497 | return 0; |
@@ -519,37 +520,57 @@ icalcomponent_get_properties (icalcomponent* component, icalproperty_kind kind); | |||
519 | void | 520 | void |
520 | icalcomponent_add_component (icalcomponent* parent, icalcomponent* child) | 521 | icalcomponent_add_component (icalcomponent* parent, icalcomponent* child) |
521 | { | 522 | { |
522 | struct icalcomponent_impl *impl, *cimpl; | ||
523 | |||
524 | icalerror_check_arg_rv( (parent!=0), "parent"); | 523 | icalerror_check_arg_rv( (parent!=0), "parent"); |
525 | icalerror_check_arg_rv( (child!=0), "child"); | 524 | icalerror_check_arg_rv( (child!=0), "child"); |
526 | 525 | ||
527 | impl = (struct icalcomponent_impl*)parent; | 526 | if (child->parent !=0) { |
528 | cimpl = (struct icalcomponent_impl*)child; | ||
529 | |||
530 | if (cimpl->parent !=0) { | ||
531 | icalerror_set_errno(ICAL_USAGE_ERROR); | 527 | icalerror_set_errno(ICAL_USAGE_ERROR); |
532 | } | 528 | } |
533 | 529 | ||
534 | cimpl->parent = parent; | 530 | child->parent = parent; |
531 | |||
532 | pvl_push(parent->components,child); | ||
535 | 533 | ||
536 | pvl_push(impl->components,child); | 534 | /* If the new component is a VTIMEZONE, add it to our array. */ |
535 | if (child->kind == ICAL_VTIMEZONE_COMPONENT) { | ||
536 | /* FIXME: Currently we are also creating this array when loading in | ||
537 | a builtin VTIMEZONE, when we don't need it. */ | ||
538 | if (!parent->timezones) | ||
539 | parent->timezones = icaltimezone_array_new (); | ||
540 | |||
541 | icaltimezone_array_append_from_vtimezone (parent->timezones, child); | ||
542 | |||
543 | /* Flag that we need to sort it before doing any binary searches. */ | ||
544 | parent->timezones_sorted = 0; | ||
545 | } | ||
537 | } | 546 | } |
538 | 547 | ||
539 | 548 | ||
540 | void | 549 | void |
541 | icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) | 550 | icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) |
542 | { | 551 | { |
543 | struct icalcomponent_impl *impl,*cimpl; | ||
544 | pvl_elem itr, next_itr; | 552 | pvl_elem itr, next_itr; |
545 | 553 | ||
546 | icalerror_check_arg_rv( (parent!=0), "parent"); | 554 | icalerror_check_arg_rv( (parent!=0), "parent"); |
547 | icalerror_check_arg_rv( (child!=0), "child"); | 555 | icalerror_check_arg_rv( (child!=0), "child"); |
548 | 556 | ||
549 | impl = (struct icalcomponent_impl*)parent; | 557 | /* If the component is a VTIMEZONE, remove it from our array as well. */ |
550 | cimpl = (struct icalcomponent_impl*)child; | 558 | if (child->kind == ICAL_VTIMEZONE_COMPONENT) { |
551 | 559 | icaltimezone *zone; | |
552 | for( itr = pvl_head(impl->components); | 560 | int i, num_elements; |
561 | |||
562 | num_elements = parent->timezones ? parent->timezones->num_elements : 0; | ||
563 | for (i = 0; i < num_elements; i++) { | ||
564 | zone = icalarray_element_at (parent->timezones, i); | ||
565 | if (icaltimezone_get_component (zone) == child) { | ||
566 | icaltimezone_free (zone, 0); | ||
567 | icalarray_remove_element_at (parent->timezones, i); | ||
568 | break; | ||
569 | } | ||
570 | } | ||
571 | } | ||
572 | |||
573 | for( itr = pvl_head(parent->components); | ||
553 | itr != 0; | 574 | itr != 0; |
554 | itr = next_itr) | 575 | itr = next_itr) |
555 | { | 576 | { |
@@ -557,16 +578,16 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) | |||
557 | 578 | ||
558 | if( pvl_data(itr) == (void*)child ){ | 579 | if( pvl_data(itr) == (void*)child ){ |
559 | 580 | ||
560 | if (impl->component_iterator == itr){ | 581 | if (parent->component_iterator == itr){ |
561 | /* Don't let the current iterator become invalid */ | 582 | /* Don't let the current iterator become invalid */ |
562 | 583 | ||
563 | /* HACK. The semantics for this are troubling. */ | 584 | /* HACK. The semantics for this are troubling. */ |
564 | impl->component_iterator = | 585 | parent->component_iterator = |
565 | pvl_next(impl->component_iterator); | 586 | pvl_next(parent->component_iterator); |
566 | 587 | ||
567 | } | 588 | } |
568 | pvl_remove( impl->components, itr); | 589 | pvl_remove( parent->components, itr); |
569 | cimpl->parent = 0; | 590 | child->parent = 0; |
570 | break; | 591 | break; |
571 | } | 592 | } |
572 | } | 593 | } |
@@ -579,11 +600,10 @@ icalcomponent_count_components (icalcomponent* component, | |||
579 | { | 600 | { |
580 | int count=0; | 601 | int count=0; |
581 | pvl_elem itr; | 602 | pvl_elem itr; |
582 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
583 | 603 | ||
584 | icalerror_check_arg_rz( (component!=0), "component"); | 604 | icalerror_check_arg_rz( (component!=0), "component"); |
585 | 605 | ||
586 | for( itr = pvl_head(impl->components); | 606 | for( itr = pvl_head(component->components); |
587 | itr != 0; | 607 | itr != 0; |
588 | itr = pvl_next(itr)) | 608 | itr = pvl_next(itr)) |
589 | { | 609 | { |
@@ -599,24 +619,20 @@ icalcomponent_count_components (icalcomponent* component, | |||
599 | icalcomponent* | 619 | icalcomponent* |
600 | icalcomponent_get_current_component(icalcomponent* component) | 620 | icalcomponent_get_current_component(icalcomponent* component) |
601 | { | 621 | { |
602 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | ||
603 | |||
604 | icalerror_check_arg_rz( (component!=0),"component"); | 622 | icalerror_check_arg_rz( (component!=0),"component"); |
605 | 623 | ||
606 | if (c->component_iterator == 0){ | 624 | if (component->component_iterator == 0){ |
607 | return 0; | 625 | return 0; |
608 | } | 626 | } |
609 | 627 | ||
610 | return (icalcomponent*) pvl_data(c->component_iterator); | 628 | return (icalcomponent*) pvl_data(component->component_iterator); |
611 | } | 629 | } |
612 | 630 | ||
613 | icalcomponent* | 631 | icalcomponent* |
614 | icalcomponent_get_first_component (icalcomponent* component, | 632 | icalcomponent_get_first_component (icalcomponent* c, |
615 | icalcomponent_kind kind) | 633 | icalcomponent_kind kind) |
616 | { | 634 | { |
617 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 635 | icalerror_check_arg_rz( (c!=0),"component"); |
618 | |||
619 | icalerror_check_arg_rz( (component!=0),"component"); | ||
620 | 636 | ||
621 | for( c->component_iterator = pvl_head(c->components); | 637 | for( c->component_iterator = pvl_head(c->components); |
622 | c->component_iterator != 0; | 638 | c->component_iterator != 0; |
@@ -635,11 +651,9 @@ icalcomponent_get_first_component (icalcomponent* component, | |||
635 | 651 | ||
636 | 652 | ||
637 | icalcomponent* | 653 | icalcomponent* |
638 | icalcomponent_get_next_component (icalcomponent* component, icalcomponent_kind kind) | 654 | icalcomponent_get_next_component (icalcomponent* c, icalcomponent_kind kind) |
639 | { | 655 | { |
640 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 656 | icalerror_check_arg_rz( (c!=0),"component"); |
641 | |||
642 | icalerror_check_arg_rz( (component!=0),"component"); | ||
643 | 657 | ||
644 | if (c->component_iterator == 0){ | 658 | if (c->component_iterator == 0){ |
645 | return 0; | 659 | return 0; |
@@ -673,83 +687,52 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c) | |||
673 | if(kind == ICAL_VEVENT_COMPONENT || | 687 | if(kind == ICAL_VEVENT_COMPONENT || |
674 | kind == ICAL_VTODO_COMPONENT || | 688 | kind == ICAL_VTODO_COMPONENT || |
675 | kind == ICAL_VJOURNAL_COMPONENT || | 689 | kind == ICAL_VJOURNAL_COMPONENT || |
676 | kind == ICAL_VFREEBUSY_COMPONENT ){ | 690 | kind == ICAL_VFREEBUSY_COMPONENT || |
691 | kind == ICAL_VQUERY_COMPONENT || | ||
692 | kind == ICAL_VAGENDA_COMPONENT){ | ||
677 | return comp; | 693 | return comp; |
678 | } | 694 | } |
679 | } | 695 | } |
680 | return 0; | 696 | return 0; |
681 | } | 697 | } |
682 | 698 | ||
683 | time_t icalcomponent_convert_time(icalproperty *p) | ||
684 | { | ||
685 | struct icaltimetype sict; | ||
686 | time_t convt; | ||
687 | icalproperty *tzp; | ||
688 | |||
689 | |||
690 | /* Though it says _dtstart, it will work for dtend too */ | ||
691 | sict = icalproperty_get_dtstart(p); | ||
692 | |||
693 | tzp = icalproperty_get_first_parameter(p,ICAL_TZID_PARAMETER); | ||
694 | |||
695 | if (sict.is_utc == 1 && tzp != 0){ | ||
696 | icalerror_warn("icalcomponent_get_span: component has a UTC DTSTART with a timezone specified "); | ||
697 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
698 | return 0; | ||
699 | } | ||
700 | 699 | ||
701 | if(sict.is_utc == 1){ | 700 | /**@brief Get the timespan covered by this component, in UTC |
702 | /* _as_timet will use gmtime() to do the conversion */ | 701 | *(deprecated) |
703 | convt = icaltime_as_timet(sict); | 702 | * |
704 | 703 | * see icalcomponent_foreach_recurrence() for a better way to | |
705 | #ifdef TEST_CONVERT_TIME | 704 | * extract spans from an component. |
706 | printf("convert time: use as_timet:\n %s\n %s", | 705 | * |
707 | icalproperty_as_ical_string(p), ctime(&convt)); | 706 | *This method can be called on either a VCALENDAR or any real |
708 | #endif | 707 | *component. If the VCALENDAR contains no real component, but |
709 | 708 | *contains a VTIMEZONE, we return that span instead. | |
710 | } else if (sict.is_utc == 0 && tzp == 0 ) { | 709 | *This might not be a desirable behavior; we keep it for now |
711 | time_t offset; | 710 | *for backward compatibility, but it might be deprecated at a |
712 | 711 | *future time. | |
713 | /* _as_timet will use localtime() to do the conversion */ | 712 | * |
714 | convt = icaltime_as_timet(sict); | 713 | *FIXME this API needs to be clarified. DTEND is defined as the |
715 | offset = icaltime_utc_offset(sict,0); | 714 | *first available time after the end of this event, so the span |
716 | convt += offset; | 715 | *should actually end 1 second before DTEND. |
717 | 716 | */ | |
718 | #ifdef TEST_CONVERT_TIME | 717 | |
719 | printf("convert time: use as_timet and adjust:\n %s\n %s", | 718 | icaltime_span icalcomponent_get_span(icalcomponent* comp) |
720 | icalproperty_as_ical_string(p), ctime(&convt)); | ||
721 | #endif | ||
722 | } else { | ||
723 | /* Convert the time to UTC for the named timezone*/ | ||
724 | const char* timezone = icalparameter_get_tzid(tzp); | ||
725 | convt = icaltime_as_timet(icaltime_as_utc(sict,timezone)); | ||
726 | |||
727 | #ifdef TEST_CONVERT_TIME | ||
728 | printf("convert time: use _as_utc:\n %s\n %s", | ||
729 | icalproperty_as_ical_string(p), ctime(&convt)); | ||
730 | #endif | ||
731 | } | ||
732 | |||
733 | return convt; | ||
734 | } | ||
735 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp) | ||
736 | { | 719 | { |
737 | icalcomponent *inner; | 720 | icalcomponent *inner; |
738 | icalproperty *p, *duration; | ||
739 | icalcomponent_kind kind; | 721 | icalcomponent_kind kind; |
740 | struct icaltime_span span; | 722 | icaltime_span span; |
741 | struct icaltimetype start; | 723 | struct icaltimetype start, end; |
742 | 724 | ||
743 | span.start = 0; | 725 | span.start = 0; |
744 | span.end = 0; | 726 | span.end = 0; |
745 | span.is_busy= 1; | 727 | span.is_busy= 1; |
746 | 728 | ||
747 | /* initial Error checking */ | 729 | /* initial Error checking */ |
730 | if (comp == NULL) { | ||
731 | return span; | ||
732 | } | ||
748 | 733 | ||
749 | /* icalerror_check_arg_rz( (comp!=0),"comp");*/ | 734 | /* FIXME this might go away */ |
750 | |||
751 | kind = icalcomponent_isa(comp); | 735 | kind = icalcomponent_isa(comp); |
752 | |||
753 | if(kind == ICAL_VCALENDAR_COMPONENT){ | 736 | if(kind == ICAL_VCALENDAR_COMPONENT){ |
754 | inner = icalcomponent_get_first_real_component(comp); | 737 | inner = icalcomponent_get_first_real_component(comp); |
755 | 738 | ||
@@ -781,67 +764,329 @@ struct icaltime_span icalcomponent_get_span(icalcomponent* comp) | |||
781 | 764 | ||
782 | } | 765 | } |
783 | 766 | ||
767 | /* Get to work. starting with DTSTART */ | ||
768 | start = icalcomponent_get_dtstart(comp); | ||
769 | if (icaltime_is_null_time(start)) { | ||
770 | return span; | ||
771 | } | ||
772 | span.start = icaltime_as_timet_with_zone(start, | ||
773 | icaltimezone_get_utc_timezone()); | ||
784 | 774 | ||
775 | /* The end time could be specified as either a DTEND or a DURATION */ | ||
776 | /* icalcomponent_get_dtend takes care of these cases. */ | ||
777 | end = icalcomponent_get_dtend(comp); | ||
778 | if (icaltime_is_null_time(end)) { | ||
779 | if (!icaltime_is_date(start)) { | ||
780 | /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION | ||
781 | it takes no time */ | ||
782 | span.start = 0; | ||
783 | return span; | ||
784 | } else { | ||
785 | end = start; | ||
786 | } | ||
787 | } | ||
785 | 788 | ||
786 | /* Get to work. starting with DTSTART */ | 789 | span.end = icaltime_as_timet_with_zone(end, |
790 | icaltimezone_get_utc_timezone()); | ||
791 | if (icaltime_is_date(start)) { | ||
792 | /* Until the end of the day*/ | ||
793 | span.end += 60*60*24 - 1; | ||
794 | } | ||
787 | 795 | ||
788 | p = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY); | 796 | return span; |
789 | 797 | ||
790 | if (p ==0 ) { | 798 | } |
791 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 799 | |
792 | /*icalerror_warn("icalcomponent_get_span: component has no DTSTART time");*/ | 800 | /** |
793 | return span; | 801 | * Decide if this recurrance is acceptable |
802 | * | ||
803 | * @param comp A valid icalcomponent. | ||
804 | * @param dtstart The base dtstart value for this component. | ||
805 | * @param recurtime The time to test against. | ||
806 | * | ||
807 | * @return true if the recurrence value is excluded, false otherwise. | ||
808 | * | ||
809 | * This function decides if a specific recurrence value is | ||
810 | * excluded by EXRULE or EXDATE properties. | ||
811 | * | ||
812 | * It's not the most efficient code. You might get better performance | ||
813 | * if you assume that recurtime is always increasing for each | ||
814 | * call. Then you could: | ||
815 | * | ||
816 | * - sort the EXDATE values | ||
817 | * - save the state of each EXRULE iterator for the next call. | ||
818 | * | ||
819 | * In this case though you don't need to worry how you call this | ||
820 | * function. It will always return the correct result. | ||
821 | */ | ||
822 | |||
823 | int icalproperty_recurrence_is_excluded(icalcomponent *comp, | ||
824 | struct icaltimetype *dtstart, | ||
825 | struct icaltimetype *recurtime) { | ||
826 | icalproperty *exdate, *exrule; | ||
827 | |||
828 | if (comp == NULL || | ||
829 | dtstart == NULL || | ||
830 | recurtime == NULL || | ||
831 | icaltime_is_null_time(*recurtime)) | ||
832 | /* BAD DATA */ | ||
833 | return 1; | ||
834 | |||
835 | /** first test against the exdate values **/ | ||
836 | for (exdate = icalcomponent_get_first_property(comp,ICAL_EXDATE_PROPERTY); | ||
837 | exdate != NULL; | ||
838 | exdate = icalcomponent_get_next_property(comp,ICAL_EXDATE_PROPERTY)) { | ||
839 | |||
840 | struct icaltimetype exdatetime = icalproperty_get_exdate(exdate); | ||
841 | |||
842 | if (icaltime_compare(*recurtime, exdatetime) == 0) { | ||
843 | /** MATCHED **/ | ||
844 | return 1; | ||
845 | } | ||
846 | } | ||
847 | |||
848 | /** Now test against the EXRULEs **/ | ||
849 | for (exrule = icalcomponent_get_first_property(comp,ICAL_EXRULE_PROPERTY); | ||
850 | exdate != NULL; | ||
851 | exdate = icalcomponent_get_next_property(comp,ICAL_EXRULE_PROPERTY)) { | ||
852 | |||
853 | struct icalrecurrencetype recur = icalproperty_get_exrule(exrule); | ||
854 | icalrecur_iterator *exrule_itr = icalrecur_iterator_new(recur, *dtstart); | ||
855 | struct icaltimetype exrule_time; | ||
856 | |||
857 | while (1) { | ||
858 | int result; | ||
859 | exrule_time = icalrecur_iterator_next(exrule_itr); | ||
860 | |||
861 | if (icaltime_is_null_time(exrule_time)) | ||
862 | break; | ||
863 | |||
864 | result = icaltime_compare(*recurtime, exrule_time); | ||
865 | if (result == 0) { | ||
866 | icalrecur_iterator_free(exrule_itr); | ||
867 | return 1; /** MATCH **/ | ||
868 | } | ||
869 | if (result == 1) | ||
870 | break; /** exrule_time > recurtime **/ | ||
794 | } | 871 | } |
795 | 872 | ||
873 | icalrecur_iterator_free(exrule_itr); | ||
874 | } | ||
796 | 875 | ||
797 | start = icalproperty_get_dtstart(p); | 876 | return 0; /** no matches **/ |
877 | } | ||
798 | 878 | ||
799 | icalerror_clear_errno(); | 879 | /** |
880 | * @brief Return the busy status based on the TRANSP property. | ||
881 | * | ||
882 | * @param comp A valid icalcomponent. | ||
883 | * | ||
884 | * @return 1 if the event is a busy item, 0 if it is not. | ||
885 | */ | ||
800 | 886 | ||
801 | span.start = icalcomponent_convert_time(p); | 887 | static int icalcomponent_is_busy(icalcomponent *comp) { |
888 | icalproperty *transp; | ||
889 | enum icalproperty_status status; | ||
890 | int ret = 1; | ||
802 | 891 | ||
803 | #ifdef TEST_CONVERT_TIME | 892 | /** @todo check access control here, converting busy->free if the |
804 | printf("convert time:\n %s %s", | 893 | permissions do not allow access... */ |
805 | icalproperty_as_ical_string(p), ctime(&span.start)); | ||
806 | #endif | ||
807 | 894 | ||
808 | if(icalerrno != ICAL_NO_ERROR){ | 895 | /* Is this a busy time? Check the TRANSP property */ |
809 | span.start = 0; | 896 | transp = icalcomponent_get_first_property(comp, ICAL_TRANSP_PROPERTY); |
810 | return span; | 897 | |
898 | if (transp) { | ||
899 | icalvalue *transp_val = icalproperty_get_value(transp); | ||
900 | |||
901 | switch (icalvalue_get_transp(transp_val)) { | ||
902 | case ICAL_TRANSP_OPAQUE: | ||
903 | case ICAL_TRANSP_OPAQUENOCONFLICT: | ||
904 | case ICAL_TRANSP_NONE: | ||
905 | ret = 1; | ||
906 | break; | ||
907 | case ICAL_TRANSP_TRANSPARENT: | ||
908 | case ICAL_TRANSP_TRANSPARENTNOCONFLICT: | ||
909 | ret = 0; | ||
910 | break; | ||
911 | default: | ||
912 | ret = 0; | ||
913 | break; | ||
811 | } | 914 | } |
915 | } | ||
916 | status = icalcomponent_get_status(comp); | ||
917 | if (ret && status) { | ||
918 | switch (status) { | ||
919 | case ICAL_STATUS_CANCELLED: | ||
920 | case ICAL_STATUS_TENTATIVE: | ||
921 | ret = 0; | ||
922 | break; | ||
923 | default: | ||
924 | break; | ||
925 | } | ||
926 | } | ||
927 | return(ret); | ||
928 | } | ||
812 | 929 | ||
813 | /* The end time could be specified as either a DTEND or a DURATION */ | ||
814 | p = icalcomponent_get_first_property(inner, ICAL_DTEND_PROPERTY); | ||
815 | duration = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY); | ||
816 | 930 | ||
817 | if (p==0 && duration == 0 && start.is_date != 1) { | ||
818 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
819 | /*icalerror_warn("icalcomponent_get_span: component has neither DTEND nor DURATION time");*/ | ||
820 | span.start = 0; | ||
821 | return span; | ||
822 | } | ||
823 | 931 | ||
824 | if (p!=0){ | ||
825 | span.end = icalcomponent_convert_time(p); | ||
826 | } else if (start.is_date == 1) { | ||
827 | /* Duration is all day */ | ||
828 | span.end = span.start + 60*60*24; | ||
829 | } else { | ||
830 | /* Use the duration */ | ||
831 | struct icaldurationtype dur; | ||
832 | time_t durt; | ||
833 | |||
834 | |||
835 | dur = icalproperty_get_duration(duration); | ||
836 | 932 | ||
837 | durt = icaldurationtype_as_int(dur); | 933 | /** |
838 | span.end = span.start+durt; | 934 | * @brief cycle through all recurrances of an event |
935 | * | ||
936 | * @param comp A valid VEVENT component | ||
937 | * @param start Ignore timespans before this | ||
938 | * @param end Ignore timespans after this | ||
939 | * @param callback Function called for each timespan within the range | ||
940 | * @param callback_data Pointer passed back to the callback function | ||
941 | * | ||
942 | * This function will call the specified callback function for once | ||
943 | * for the base value of DTSTART, and foreach recurring date/time | ||
944 | * value. | ||
945 | * | ||
946 | * It will filter out events that are specified as an EXDATE or an EXRULE. | ||
947 | * | ||
948 | * @todo We do not filter out duplicate RRULES/RDATES | ||
949 | * @todo We do not handle RDATEs with explicit periods | ||
950 | */ | ||
951 | |||
952 | void icalcomponent_foreach_recurrence(icalcomponent* comp, | ||
953 | struct icaltimetype start, | ||
954 | struct icaltimetype end, | ||
955 | void (*callback)(icalcomponent *comp, | ||
956 | struct icaltime_span *span, | ||
957 | void *data), | ||
958 | void *callback_data) | ||
959 | { | ||
960 | struct icaltimetype dtstart, dtend; | ||
961 | icaltime_span recurspan, basespan, limit_span; | ||
962 | time_t limit_start, limit_end; | ||
963 | int dtduration; | ||
964 | icalproperty *rrule, *rdate; | ||
965 | struct icaldurationtype dur; | ||
966 | pvl_elem property_iterator;/* for saving the iterator */ | ||
967 | |||
968 | if (comp == NULL || callback == NULL) | ||
969 | return; | ||
970 | |||
971 | dtstart = icalcomponent_get_dtstart(comp); | ||
972 | |||
973 | if (icaltime_is_null_time(dtstart)) | ||
974 | return; | ||
975 | |||
976 | |||
977 | /* The end time could be specified as either a DTEND or a DURATION */ | ||
978 | /* icalcomponent_get_dtend takes care of these cases. */ | ||
979 | dtend = icalcomponent_get_dtend(comp); | ||
980 | |||
981 | /* Now set up the base span for this item, corresponding to the | ||
982 | base DTSTART and DTEND */ | ||
983 | basespan = icaltime_span_new(dtstart, dtend, 1); | ||
984 | |||
985 | basespan.is_busy = icalcomponent_is_busy(comp); | ||
986 | |||
987 | |||
988 | /** Calculate the ceiling and floor values.. **/ | ||
989 | limit_start = icaltime_as_timet_with_zone(start, icaltimezone_get_utc_timezone()); | ||
990 | if (!icaltime_is_null_time(end)) | ||
991 | limit_end = icaltime_as_timet_with_zone(end, icaltimezone_get_utc_timezone()); | ||
992 | else | ||
993 | limit_end = INT_MAX; /* max 32 bit time_t */ | ||
994 | |||
995 | limit_span.start = limit_start; | ||
996 | limit_span.end = limit_end; | ||
997 | |||
998 | |||
999 | /* Do the callback for the initial DTSTART entry */ | ||
1000 | |||
1001 | if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &dtstart)) { | ||
1002 | /** call callback action **/ | ||
1003 | if (icaltime_span_overlaps(&basespan, &limit_span)) | ||
1004 | (*callback) (comp, &basespan, callback_data); | ||
1005 | } | ||
1006 | |||
1007 | recurspan = basespan; | ||
1008 | dtduration = basespan.end - basespan.start; | ||
1009 | |||
1010 | /* Now cycle through the rrule entries */ | ||
1011 | for (rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); | ||
1012 | rrule != NULL; | ||
1013 | rrule = icalcomponent_get_next_property(comp,ICAL_RRULE_PROPERTY)) { | ||
1014 | |||
1015 | struct icalrecurrencetype recur = icalproperty_get_rrule(rrule); | ||
1016 | icalrecur_iterator *rrule_itr = icalrecur_iterator_new(recur, dtstart); | ||
1017 | struct icaltimetype rrule_time = icalrecur_iterator_next(rrule_itr); | ||
1018 | /** note that icalrecur_iterator_next always returns dtstart | ||
1019 | the first time.. **/ | ||
1020 | |||
1021 | while (1) { | ||
1022 | rrule_time = icalrecur_iterator_next(rrule_itr); | ||
1023 | |||
1024 | if (icaltime_is_null_time(rrule_time)) | ||
1025 | break; | ||
1026 | |||
1027 | dur = icaltime_subtract(rrule_time, dtstart); | ||
1028 | |||
1029 | recurspan.start = basespan.start + icaldurationtype_as_int(dur); | ||
1030 | recurspan.end = recurspan.start + dtduration; | ||
1031 | |||
1032 | /** save the iterator ICK! **/ | ||
1033 | property_iterator = comp->property_iterator; | ||
1034 | |||
1035 | if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rrule_time)) { | ||
1036 | /** call callback action **/ | ||
1037 | if (icaltime_span_overlaps(&recurspan, &limit_span)) | ||
1038 | (*callback) (comp, &recurspan, callback_data); | ||
1039 | } | ||
1040 | comp->property_iterator = property_iterator; | ||
1041 | } /* end of iteration over a specific RRULE */ | ||
1042 | |||
1043 | icalrecur_iterator_free(rrule_itr); | ||
1044 | } /* end of RRULE loop */ | ||
1045 | |||
1046 | |||
1047 | /** Now process RDATE entries **/ | ||
1048 | for (rdate = icalcomponent_get_first_property(comp,ICAL_RDATE_PROPERTY); | ||
1049 | rdate != NULL; | ||
1050 | rdate = icalcomponent_get_next_property(comp,ICAL_RDATE_PROPERTY)) { | ||
1051 | |||
1052 | struct icaldatetimeperiodtype rdate_period = icalproperty_get_rdate(rdate); | ||
1053 | |||
1054 | /** RDATES can specify raw datetimes, periods, or dates. | ||
1055 | we only support raw datetimes for now.. | ||
1056 | |||
1057 | @todo Add support for other types **/ | ||
1058 | |||
1059 | if (icaltime_is_null_time(rdate_period.time)) | ||
1060 | continue; | ||
1061 | |||
1062 | dur = icaltime_subtract(rdate_period.time, dtstart); | ||
1063 | |||
1064 | recurspan.start = basespan.start + icaldurationtype_as_int(dur); | ||
1065 | recurspan.end = recurspan.start + dtduration; | ||
1066 | |||
1067 | /** save the iterator ICK! **/ | ||
1068 | property_iterator = comp->property_iterator; | ||
1069 | |||
1070 | if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rdate_period.time)) { | ||
1071 | /** call callback action **/ | ||
1072 | (*callback) (comp, &recurspan, callback_data); | ||
839 | } | 1073 | } |
1074 | comp->property_iterator = property_iterator; | ||
1075 | } | ||
1076 | } | ||
1077 | |||
840 | 1078 | ||
841 | return span; | ||
842 | 1079 | ||
1080 | int icalcomponent_check_restrictions(icalcomponent* comp){ | ||
1081 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1082 | return icalrestriction_check(comp); | ||
843 | } | 1083 | } |
844 | 1084 | ||
1085 | /** @brief returns the number of errors encountered parsing the data | ||
1086 | * | ||
1087 | * This function counts the number times the X-LIC-ERROR occurs | ||
1088 | * in the data structure. | ||
1089 | */ | ||
845 | 1090 | ||
846 | int icalcomponent_count_errors(icalcomponent* component) | 1091 | int icalcomponent_count_errors(icalcomponent* component) |
847 | { | 1092 | { |
@@ -849,9 +1094,8 @@ int icalcomponent_count_errors(icalcomponent* component) | |||
849 | icalproperty *p; | 1094 | icalproperty *p; |
850 | icalcomponent *c; | 1095 | icalcomponent *c; |
851 | pvl_elem itr; | 1096 | pvl_elem itr; |
852 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
853 | 1097 | ||
854 | for( itr = pvl_head(impl->properties); | 1098 | for( itr = pvl_head(component->properties); |
855 | itr != 0; | 1099 | itr != 0; |
856 | itr = pvl_next(itr)) | 1100 | itr = pvl_next(itr)) |
857 | { | 1101 | { |
@@ -864,7 +1108,7 @@ int icalcomponent_count_errors(icalcomponent* component) | |||
864 | } | 1108 | } |
865 | 1109 | ||
866 | 1110 | ||
867 | for( itr = pvl_head(impl->components); | 1111 | for( itr = pvl_head(component->components); |
868 | itr != 0; | 1112 | itr != 0; |
869 | itr = pvl_next(itr)) | 1113 | itr = pvl_next(itr)) |
870 | { | 1114 | { |
@@ -883,9 +1127,8 @@ void icalcomponent_strip_errors(icalcomponent* component) | |||
883 | icalproperty *p; | 1127 | icalproperty *p; |
884 | icalcomponent *c; | 1128 | icalcomponent *c; |
885 | pvl_elem itr, next_itr; | 1129 | pvl_elem itr, next_itr; |
886 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
887 | 1130 | ||
888 | for( itr = pvl_head(impl->properties); | 1131 | for( itr = pvl_head(component->properties); |
889 | itr != 0; | 1132 | itr != 0; |
890 | itr = next_itr) | 1133 | itr = next_itr) |
891 | { | 1134 | { |
@@ -898,7 +1141,7 @@ void icalcomponent_strip_errors(icalcomponent* component) | |||
898 | } | 1141 | } |
899 | } | 1142 | } |
900 | 1143 | ||
901 | for( itr = pvl_head(impl->components); | 1144 | for( itr = pvl_head(component->components); |
902 | itr != 0; | 1145 | itr != 0; |
903 | itr = pvl_next(itr)) | 1146 | itr = pvl_next(itr)) |
904 | { | 1147 | { |
@@ -952,6 +1195,7 @@ void icalcomponent_convert_errors(icalcomponent* component) | |||
952 | } | 1195 | } |
953 | 1196 | ||
954 | default: { | 1197 | default: { |
1198 | break; | ||
955 | } | 1199 | } |
956 | } | 1200 | } |
957 | if (rst.code != ICAL_UNKNOWN_STATUS){ | 1201 | if (rst.code != ICAL_UNKNOWN_STATUS){ |
@@ -976,16 +1220,12 @@ void icalcomponent_convert_errors(icalcomponent* component) | |||
976 | 1220 | ||
977 | icalcomponent* icalcomponent_get_parent(icalcomponent* component) | 1221 | icalcomponent* icalcomponent_get_parent(icalcomponent* component) |
978 | { | 1222 | { |
979 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 1223 | return component->parent; |
980 | |||
981 | return c->parent; | ||
982 | } | 1224 | } |
983 | 1225 | ||
984 | void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent) | 1226 | void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent) |
985 | { | 1227 | { |
986 | struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; | 1228 | component->parent = parent; |
987 | |||
988 | c->parent = parent; | ||
989 | } | 1229 | } |
990 | 1230 | ||
991 | icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0}; | 1231 | icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0}; |
@@ -1004,6 +1244,7 @@ static struct icalcomponent_kind_map component_map[] = | |||
1004 | { ICAL_VTODO_COMPONENT, "VTODO" }, | 1244 | { ICAL_VTODO_COMPONENT, "VTODO" }, |
1005 | { ICAL_VJOURNAL_COMPONENT, "VJOURNAL" }, | 1245 | { ICAL_VJOURNAL_COMPONENT, "VJOURNAL" }, |
1006 | { ICAL_VCALENDAR_COMPONENT, "VCALENDAR" }, | 1246 | { ICAL_VCALENDAR_COMPONENT, "VCALENDAR" }, |
1247 | { ICAL_VAGENDA_COMPONENT, "VAGENDA" }, | ||
1007 | { ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" }, | 1248 | { ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" }, |
1008 | { ICAL_VTIMEZONE_COMPONENT, "VTIMEZONE" }, | 1249 | { ICAL_VTIMEZONE_COMPONENT, "VTIMEZONE" }, |
1009 | { ICAL_VALARM_COMPONENT, "VALARM" }, | 1250 | { ICAL_VALARM_COMPONENT, "VALARM" }, |
@@ -1028,6 +1269,16 @@ static struct icalcomponent_kind_map component_map[] = | |||
1028 | }; | 1269 | }; |
1029 | 1270 | ||
1030 | 1271 | ||
1272 | int icalcomponent_kind_is_valid(const icalcomponent_kind kind) | ||
1273 | { | ||
1274 | int i = 0; | ||
1275 | do { | ||
1276 | if (component_map[i].kind == kind) | ||
1277 | return 1; | ||
1278 | } while (component_map[i++].kind != ICAL_NO_COMPONENT); | ||
1279 | |||
1280 | return 0; | ||
1281 | } | ||
1031 | 1282 | ||
1032 | const char* icalcomponent_kind_to_string(icalcomponent_kind kind) | 1283 | const char* icalcomponent_kind_to_string(icalcomponent_kind kind) |
1033 | { | 1284 | { |
@@ -1065,15 +1316,15 @@ icalcomponent_kind icalcomponent_string_to_kind(const char* string) | |||
1065 | icalcompiter | 1316 | icalcompiter |
1066 | icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind) | 1317 | icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind) |
1067 | { | 1318 | { |
1068 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | 1319 | icalcompiter itr; |
1069 | icalcompiter itr = icalcompiter_null; | ||
1070 | pvl_elem i; | 1320 | pvl_elem i; |
1071 | 1321 | ||
1072 | itr.kind = kind; | 1322 | itr.kind = kind; |
1323 | itr.iter = NULL; | ||
1073 | 1324 | ||
1074 | icalerror_check_arg_re( (component!=0),"component",icalcompiter_null); | 1325 | icalerror_check_arg_re(component!=0,"component",icalcompiter_null); |
1075 | 1326 | ||
1076 | for( i = pvl_head(impl->components); i != 0; i = pvl_next(itr.iter)) { | 1327 | for( i = pvl_head(component->components); i != 0; i = pvl_next(i)) { |
1077 | 1328 | ||
1078 | icalcomponent *c = (icalcomponent*) pvl_data(i); | 1329 | icalcomponent *c = (icalcomponent*) pvl_data(i); |
1079 | 1330 | ||
@@ -1091,15 +1342,14 @@ icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind) | |||
1091 | icalcompiter | 1342 | icalcompiter |
1092 | icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind) | 1343 | icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind) |
1093 | { | 1344 | { |
1094 | struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; | ||
1095 | icalcompiter itr; | 1345 | icalcompiter itr; |
1096 | pvl_elem i; | 1346 | pvl_elem i; |
1097 | 1347 | ||
1098 | itr.kind = kind; | 1348 | itr.kind = kind; |
1099 | 1349 | ||
1100 | icalerror_check_arg_re( (component!=0),"component",icalcompiter_null); | 1350 | icalerror_check_arg_re(component!=0,"component",icalcompiter_null); |
1101 | 1351 | ||
1102 | for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) { | 1352 | for( i = pvl_tail(component->components); i != 0; i = pvl_prior(i)) { |
1103 | 1353 | ||
1104 | icalcomponent *c = (icalcomponent*) pvl_data(i); | 1354 | icalcomponent *c = (icalcomponent*) pvl_data(i); |
1105 | 1355 | ||
@@ -1180,140 +1430,231 @@ icalcomponent* icalcomponent_get_inner(icalcomponent* comp) | |||
1180 | } | 1430 | } |
1181 | } | 1431 | } |
1182 | 1432 | ||
1433 | /** @brief sets the METHOD property to the given method | ||
1434 | */ | ||
1183 | 1435 | ||
1184 | void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v) | 1436 | void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method) |
1185 | { | 1437 | { |
1438 | icalproperty *prop | ||
1439 | = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY); | ||
1186 | 1440 | ||
1187 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1441 | |
1442 | if (prop == 0){ | ||
1443 | prop = icalproperty_new_method(method); | ||
1444 | icalcomponent_add_property(comp, prop); | ||
1445 | } | ||
1446 | |||
1447 | icalproperty_set_method(prop,method); | ||
1448 | |||
1449 | } | ||
1450 | |||
1451 | /** @brief returns the METHOD property | ||
1452 | */ | ||
1453 | |||
1454 | icalproperty_method icalcomponent_get_method(icalcomponent* comp) | ||
1455 | { | ||
1188 | icalproperty *prop | 1456 | icalproperty *prop |
1189 | = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY); | 1457 | = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY); |
1190 | 1458 | ||
1459 | if (prop == 0){ | ||
1460 | return ICAL_METHOD_NONE; | ||
1461 | } | ||
1462 | |||
1463 | return icalproperty_get_method(prop); | ||
1464 | } | ||
1465 | |||
1466 | #define ICALSETUPSET(p_kind) \ | ||
1467 | icalcomponent *inner; \ | ||
1468 | icalproperty *prop; \ | ||
1469 | icalerror_check_arg_rv(comp!=0,"comp");\ | ||
1470 | inner = icalcomponent_get_inner(comp); \ | ||
1471 | if(inner == 0){\ | ||
1472 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);\ | ||
1473 | return;\ | ||
1474 | }\ | ||
1475 | prop = icalcomponent_get_first_property(inner, p_kind); | ||
1476 | |||
1477 | |||
1478 | /**@brief Set DTSTART property to given icaltime | ||
1479 | * | ||
1480 | *This method respects the icaltime type (DATE vs DATE-TIME) and | ||
1481 | *timezone (or lack thereof). | ||
1482 | */ | ||
1483 | void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v) | ||
1484 | { | ||
1485 | char *tzid; | ||
1486 | ICALSETUPSET(ICAL_DTSTART_PROPERTY); | ||
1191 | 1487 | ||
1192 | if (prop == 0){ | 1488 | if (prop == 0){ |
1193 | prop = icalproperty_new_dtstart(v); | 1489 | prop = icalproperty_new_dtstart(v); |
1194 | icalcomponent_add_property(inner, prop); | 1490 | icalcomponent_add_property(inner, prop); |
1491 | } else { | ||
1492 | icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); | ||
1195 | } | 1493 | } |
1196 | 1494 | ||
1197 | icalproperty_set_dtstart(prop,v); | 1495 | icalproperty_set_dtstart(prop,v); |
1198 | 1496 | ||
1497 | if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) { | ||
1498 | icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid)); | ||
1499 | } | ||
1199 | } | 1500 | } |
1200 | 1501 | ||
1502 | /**@brief Get a DATE or DATE-TIME property as an icaltime | ||
1503 | * | ||
1504 | *If the property is a DATE-TIME with a timezone parameter and a | ||
1505 | *corresponding VTIMEZONE is present in the component, the | ||
1506 | *returned component will already be in the correct timezone; | ||
1507 | *otherwise the caller is responsible for converting it. | ||
1508 | * | ||
1509 | *FIXME this is useless until we can flag the failure | ||
1510 | */ | ||
1511 | static struct icaltimetype | ||
1512 | icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop) { | ||
1513 | |||
1514 | icalparameter *param; | ||
1515 | struct icaltimetyperet; | ||
1516 | |||
1517 | ret = icalvalue_get_datetime(icalproperty_get_value(prop)); | ||
1518 | |||
1519 | if ((param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER)) | ||
1520 | != NULL) { | ||
1521 | const char *tzid = icalparameter_get_tzid(param); | ||
1522 | icaltimezone *tz; | ||
1523 | |||
1524 | if ((tz = icalcomponent_get_timezone(comp, tzid)) != NULL) { | ||
1525 | icaltime_set_timezone(&ret, tz); | ||
1526 | } | ||
1527 | } | ||
1528 | |||
1529 | return ret; | ||
1530 | } | ||
1201 | 1531 | ||
1532 | /**@brief Get DTSTART property as an icaltime | ||
1533 | * | ||
1534 | *If DTSTART is a DATE-TIME with a timezone parameter and a | ||
1535 | *corresponding VTIMEZONE is present in the component, the | ||
1536 | *returned component will already be in the correct timezone; | ||
1537 | *otherwise the caller is responsible for converting it. | ||
1538 | * | ||
1539 | *FIXME this is useless until we can flag the failure | ||
1540 | */ | ||
1202 | struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp) | 1541 | struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp) |
1203 | { | 1542 | { |
1204 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1543 | icalcomponent *inner = icalcomponent_get_inner(comp); |
1205 | icalproperty *prop | 1544 | icalproperty *prop; |
1206 | = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY); | ||
1207 | 1545 | ||
1546 | prop = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY); | ||
1208 | if (prop == 0){ | 1547 | if (prop == 0){ |
1209 | return icaltime_null_time(); | 1548 | return icaltime_null_time(); |
1210 | } | 1549 | } |
1211 | |||
1212 | return icalproperty_get_dtstart(prop); | ||
1213 | } | ||
1214 | 1550 | ||
1551 | return icalcomponent_get_datetime(comp, prop); | ||
1552 | } | ||
1215 | 1553 | ||
1554 | /**@brief Get DTEND property as an icaltime | ||
1555 | * | ||
1556 | *If a DTEND property is not present but a DURATION is, we use | ||
1557 | *that to determine the proper end. | ||
1558 | * | ||
1559 | *If DTSTART is a DATE-TIME with a timezone parameter and a | ||
1560 | *corresponding VTIMEZONE is present in the component, the | ||
1561 | *returned component will already be in the correct timezone; | ||
1562 | *otherwise the caller is responsible for converting it. | ||
1563 | * | ||
1564 | *FIXME this is useless until we can flag the failure | ||
1565 | */ | ||
1216 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp) | 1566 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp) |
1217 | { | 1567 | { |
1218 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1568 | icalcomponent *inner = icalcomponent_get_inner(comp); |
1219 | |||
1220 | icalproperty *end_prop | 1569 | icalproperty *end_prop |
1221 | = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY); | 1570 | = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY); |
1222 | |||
1223 | icalproperty *dur_prop | 1571 | icalproperty *dur_prop |
1224 | = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY); | 1572 | = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY); |
1573 | struct icaltimetyperet = icaltime_null_time(); | ||
1225 | 1574 | ||
1226 | 1575 | if ( end_prop != 0) { | |
1227 | if( end_prop == 0 && dur_prop == 0){ | 1576 | ret = icalcomponent_get_datetime(comp, end_prop); |
1228 | return icaltime_null_time(); | ||
1229 | } else if ( end_prop != 0) { | ||
1230 | return icalproperty_get_dtend(end_prop); | ||
1231 | } else if ( dur_prop != 0) { | 1577 | } else if ( dur_prop != 0) { |
1232 | 1578 | ||
1233 | struct icaltimetype start = | 1579 | struct icaltimetype start = |
1234 | icalcomponent_get_dtstart(inner); | 1580 | icalcomponent_get_dtstart(inner); |
1235 | struct icaldurationtype duration = | 1581 | struct icaldurationtype duration = |
1236 | icalproperty_get_duration(dur_prop); | 1582 | icalproperty_get_duration(dur_prop); |
1237 | |||
1238 | struct icaltimetype end = icaltime_add(start,duration); | ||
1239 | 1583 | ||
1240 | return end; | 1584 | struct icaltimetype end = icaltime_add(start,duration); |
1241 | |||
1242 | } else { | ||
1243 | /* Error, both duration and dtend have been specified */ | ||
1244 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1245 | return icaltime_null_time(); | ||
1246 | 1585 | ||
1586 | ret = end; | ||
1247 | } | 1587 | } |
1248 | |||
1249 | } | ||
1250 | 1588 | ||
1589 | return ret; | ||
1590 | } | ||
1251 | 1591 | ||
1592 | /**@brief Set DTEND property to given icaltime | ||
1593 | * | ||
1594 | *This method respects the icaltime type (DATE vs DATE-TIME) and | ||
1595 | *timezone (or lack thereof). | ||
1596 | * | ||
1597 | *This also checks that a DURATION property isn't already there, | ||
1598 | *and returns an error if it is. It's the caller's responsibility | ||
1599 | *to remove it. | ||
1600 | */ | ||
1252 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v) | 1601 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v) |
1253 | { | 1602 | { |
1254 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1603 | char *tzid; |
1255 | 1604 | ICALSETUPSET(ICAL_DTEND_PROPERTY); | |
1256 | icalproperty *end_prop | ||
1257 | = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY); | ||
1258 | |||
1259 | icalproperty *dur_prop | ||
1260 | = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY); | ||
1261 | |||
1262 | 1605 | ||
1263 | if( end_prop == 0 && dur_prop == 0){ | 1606 | if (icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY) |
1264 | end_prop = icalproperty_new_dtend(v); | 1607 | != NULL) { |
1265 | icalcomponent_add_property(inner,end_prop); | 1608 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
1266 | } else if ( end_prop != 0) { | 1609 | return; |
1267 | icalproperty_set_dtend(end_prop,v); | 1610 | } |
1268 | } else if ( dur_prop != 0) { | ||
1269 | struct icaltimetype start = | ||
1270 | icalcomponent_get_dtstart(inner); | ||
1271 | |||
1272 | struct icaltimetype end = | ||
1273 | icalcomponent_get_dtend(inner); | ||
1274 | 1611 | ||
1275 | struct icaldurationtype dur | 1612 | if (prop == 0) { |
1276 | = icaltime_subtract(end,start); | 1613 | prop = icalproperty_new_dtend(v); |
1614 | icalcomponent_add_property(inner, prop); | ||
1615 | } else { | ||
1616 | icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); | ||
1617 | } | ||
1277 | 1618 | ||
1278 | icalproperty_set_duration(dur_prop,dur); | 1619 | icalproperty_set_dtend(prop,v); |
1279 | 1620 | ||
1280 | } else { | 1621 | if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) { |
1281 | /* Error, both duration and dtend have been specified */ | 1622 | icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid)); |
1282 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1283 | } | 1623 | } |
1284 | } | 1624 | } |
1285 | 1625 | ||
1626 | /**@brief Set DURATION property to given icalduration | ||
1627 | * | ||
1628 | *This method respects the icaltime type (DATE vs DATE-TIME) and | ||
1629 | *timezone (or lack thereof). | ||
1630 | * | ||
1631 | *This also checks that a DTEND property isn't already there, | ||
1632 | *and returns an error if it is. It's the caller's responsibility | ||
1633 | *to remove it. | ||
1634 | */ | ||
1286 | void icalcomponent_set_duration(icalcomponent* comp, | 1635 | void icalcomponent_set_duration(icalcomponent* comp, |
1287 | struct icaldurationtype v) | 1636 | struct icaldurationtype v) |
1288 | { | 1637 | { |
1289 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1638 | ICALSETUPSET(ICAL_DURATION_PROPERTY); |
1290 | |||
1291 | icalproperty *end_prop | ||
1292 | = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY); | ||
1293 | |||
1294 | icalproperty *dur_prop | ||
1295 | = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY); | ||
1296 | |||
1297 | |||
1298 | if( end_prop == 0 && dur_prop == 0){ | ||
1299 | dur_prop = icalproperty_new_duration(v); | ||
1300 | icalcomponent_add_property(inner, dur_prop); | ||
1301 | } else if ( end_prop != 0) { | ||
1302 | struct icaltimetype start = | ||
1303 | icalcomponent_get_dtstart(inner); | ||
1304 | |||
1305 | struct icaltimetype new_end = icaltime_add(start,v); | ||
1306 | 1639 | ||
1307 | icalproperty_set_dtend(end_prop,new_end); | 1640 | if (icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY) != NULL) { |
1641 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1642 | return; | ||
1643 | } | ||
1308 | 1644 | ||
1309 | } else if ( dur_prop != 0) { | 1645 | if (prop == 0) { |
1310 | icalproperty_set_duration(dur_prop,v); | 1646 | prop = icalproperty_new_duration(v); |
1647 | icalcomponent_add_property(inner, prop); | ||
1311 | } else { | 1648 | } else { |
1312 | /* Error, both duration and dtend have been specified */ | 1649 | icalproperty_set_duration(prop,v); |
1313 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1314 | } | 1650 | } |
1315 | } | 1651 | } |
1316 | 1652 | ||
1653 | /**@brief Get DURATION property as an icalduration | ||
1654 | * | ||
1655 | *If a DURATION property is not present but a DTEND is, we use | ||
1656 | *that to determine the proper end. | ||
1657 | */ | ||
1317 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp) | 1658 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp) |
1318 | { | 1659 | { |
1319 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1660 | icalcomponent *inner = icalcomponent_get_inner(comp); |
@@ -1324,131 +1665,329 @@ struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp) | |||
1324 | icalproperty *dur_prop | 1665 | icalproperty *dur_prop |
1325 | = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY); | 1666 | = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY); |
1326 | 1667 | ||
1327 | struct icaldurationtype null_duration; | 1668 | struct icaldurationtype ret = icaldurationtype_null_duration(); |
1328 | memset(&null_duration,0,sizeof(struct icaldurationtype)); | ||
1329 | 1669 | ||
1670 | if ( dur_prop != 0 && end_prop == 0) { | ||
1671 | ret = icalproperty_get_duration(dur_prop); | ||
1330 | 1672 | ||
1331 | if( end_prop == 0 && dur_prop == 0){ | 1673 | } else if ( end_prop != 0 && dur_prop == 0) { |
1332 | return null_duration; | 1674 | /** |
1333 | } else if ( end_prop != 0) { | 1675 | * FIXME |
1676 | * We assume DTSTART and DTEND are not in different time zones. | ||
1677 | * Does the standard actually guarantee this? | ||
1678 | */ | ||
1334 | struct icaltimetype start = | 1679 | struct icaltimetype start = |
1335 | icalcomponent_get_dtstart(inner); | 1680 | icalcomponent_get_dtstart(inner); |
1336 | time_t startt = icaltime_as_timet(start); | ||
1337 | |||
1338 | struct icaltimetype end = | 1681 | struct icaltimetype end = |
1339 | icalcomponent_get_dtend(inner); | 1682 | icalcomponent_get_dtend(inner); |
1340 | time_t endt = icaltime_as_timet(end); | 1683 | |
1341 | 1684 | ret = icaltime_subtract(end, start); | |
1342 | return icaldurationtype_from_int(endt-startt); | ||
1343 | } else if ( dur_prop != 0) { | ||
1344 | return icalproperty_get_duration(dur_prop); | ||
1345 | } else { | 1685 | } else { |
1346 | /* Error, both duration and dtend have been specified */ | 1686 | /* Error, both duration and dtend have been specified */ |
1347 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 1687 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
1348 | return null_duration; | ||
1349 | } | 1688 | } |
1689 | return ret; | ||
1350 | } | 1690 | } |
1351 | 1691 | ||
1352 | void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method) | 1692 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v) |
1353 | { | 1693 | { |
1354 | icalproperty *prop | ||
1355 | = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY); | ||
1356 | 1694 | ||
1695 | ICALSETUPSET(ICAL_DTSTAMP_PROPERTY); | ||
1357 | 1696 | ||
1358 | if (prop == 0){ | 1697 | if (prop == 0){ |
1359 | prop = icalproperty_new_method(method); | 1698 | prop = icalproperty_new_dtstamp(v); |
1360 | icalcomponent_add_property(comp, prop); | 1699 | icalcomponent_add_property(inner, prop); |
1361 | } | 1700 | } |
1362 | 1701 | ||
1363 | icalproperty_set_method(prop,method); | 1702 | icalproperty_set_dtstamp(prop,v); |
1364 | 1703 | ||
1365 | } | 1704 | } |
1366 | 1705 | ||
1367 | icalproperty_method icalcomponent_get_method(icalcomponent* comp) | 1706 | |
1707 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp) | ||
1368 | { | 1708 | { |
1709 | icalcomponent *inner = icalcomponent_get_inner(comp); | ||
1369 | icalproperty *prop | 1710 | icalproperty *prop |
1370 | = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY); | 1711 | = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY); |
1371 | 1712 | ||
1372 | if (prop == 0){ | 1713 | if (prop == 0){ |
1373 | return ICAL_METHOD_NONE; | 1714 | return icaltime_null_time(); |
1374 | } | 1715 | } |
1375 | 1716 | ||
1376 | return icalproperty_get_method(prop); | 1717 | return icalproperty_get_dtstamp(prop); |
1377 | } | 1718 | } |
1378 | 1719 | ||
1379 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v) | 1720 | |
1721 | void icalcomponent_set_summary(icalcomponent* comp, const char* v) | ||
1722 | { | ||
1723 | ICALSETUPSET(ICAL_SUMMARY_PROPERTY) | ||
1724 | |||
1725 | if (prop == 0){ | ||
1726 | prop = icalproperty_new_summary(v); | ||
1727 | icalcomponent_add_property(inner, prop); | ||
1728 | } | ||
1729 | |||
1730 | icalproperty_set_summary(prop,v); | ||
1731 | } | ||
1732 | |||
1733 | |||
1734 | const char* icalcomponent_get_summary(icalcomponent* comp) | ||
1380 | { | 1735 | { |
1736 | icalcomponent *inner; | ||
1737 | icalproperty *prop; | ||
1738 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1381 | 1739 | ||
1382 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1740 | inner = icalcomponent_get_inner(comp); |
1383 | icalproperty *prop | 1741 | |
1384 | = icalcomponent_get_first_property(inner, ICAL_DTSTAMP_PROPERTY); | 1742 | if(inner == 0){ |
1743 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1744 | return 0; | ||
1745 | } | ||
1385 | 1746 | ||
1747 | prop= icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY); | ||
1386 | 1748 | ||
1387 | if (prop == 0){ | 1749 | if (prop == 0){ |
1388 | prop = icalproperty_new_dtstamp(v); | 1750 | return 0; |
1389 | icalcomponent_add_property(inner, prop); | ||
1390 | } | 1751 | } |
1391 | 1752 | ||
1392 | icalproperty_set_dtstamp(prop,v); | 1753 | return icalproperty_get_summary(prop); |
1393 | 1754 | ||
1394 | } | 1755 | } |
1395 | 1756 | ||
1396 | 1757 | void icalcomponent_set_comment(icalcomponent* comp, const char* v) | |
1397 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp) | ||
1398 | { | 1758 | { |
1399 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1759 | ICALSETUPSET(ICAL_COMMENT_PROPERTY); |
1400 | icalproperty *prop | ||
1401 | = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY); | ||
1402 | 1760 | ||
1403 | if (prop == 0){ | 1761 | if (prop == 0){ |
1404 | return icaltime_null_time(); | 1762 | prop = icalproperty_new_comment(v); |
1763 | icalcomponent_add_property(inner, prop); | ||
1405 | } | 1764 | } |
1406 | 1765 | ||
1407 | return icalproperty_get_dtstamp(prop); | 1766 | icalproperty_set_summary(prop,v); |
1767 | |||
1408 | } | 1768 | } |
1769 | const char* icalcomponent_get_comment(icalcomponent* comp){ | ||
1770 | icalcomponent *inner; | ||
1771 | icalproperty *prop; | ||
1772 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1409 | 1773 | ||
1774 | inner = icalcomponent_get_inner(comp); | ||
1410 | 1775 | ||
1411 | void icalcomponent_set_summary(icalcomponent* comp, const char* v) | 1776 | if(inner == 0){ |
1777 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1778 | return 0; | ||
1779 | } | ||
1780 | |||
1781 | prop= icalcomponent_get_first_property(inner,ICAL_COMMENT_PROPERTY); | ||
1782 | |||
1783 | if (prop == 0){ | ||
1784 | return 0; | ||
1785 | } | ||
1786 | |||
1787 | return icalproperty_get_comment(prop); | ||
1788 | } | ||
1789 | |||
1790 | void icalcomponent_set_uid(icalcomponent* comp, const char* v) | ||
1412 | { | 1791 | { |
1413 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1792 | ICALSETUPSET(ICAL_UID_PROPERTY); |
1414 | icalproperty *prop | ||
1415 | = icalcomponent_get_first_property(inner, ICAL_SUMMARY_PROPERTY); | ||
1416 | 1793 | ||
1417 | if (prop == 0){ | 1794 | if (prop == 0){ |
1418 | prop = icalproperty_new_summary(v); | 1795 | prop = icalproperty_new_uid(v); |
1419 | icalcomponent_add_property(inner, prop); | 1796 | icalcomponent_add_property(inner, prop); |
1420 | } | 1797 | } |
1421 | 1798 | ||
1422 | icalproperty_set_summary(prop,v); | 1799 | icalproperty_set_summary(prop,v); |
1800 | |||
1423 | } | 1801 | } |
1802 | const char* icalcomponent_get_uid(icalcomponent* comp){ | ||
1803 | icalcomponent *inner; | ||
1804 | icalproperty *prop; | ||
1805 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1424 | 1806 | ||
1807 | inner = icalcomponent_get_inner(comp); | ||
1425 | 1808 | ||
1426 | const char* icalcomponent_get_summary(icalcomponent* comp) | 1809 | if(inner == 0){ |
1427 | { | 1810 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
1428 | icalcomponent *inner = icalcomponent_get_inner(comp); | 1811 | return 0; |
1429 | icalproperty *prop | 1812 | } |
1430 | = icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY); | 1813 | |
1814 | prop= icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY); | ||
1431 | 1815 | ||
1432 | if (prop == 0){ | 1816 | if (prop == 0){ |
1433 | return 0; | 1817 | return 0; |
1434 | } | 1818 | } |
1435 | 1819 | ||
1436 | return icalproperty_get_summary(prop); | 1820 | return icalproperty_get_uid(prop); |
1821 | } | ||
1437 | 1822 | ||
1823 | void icalcomponent_set_recurrenceid(icalcomponent* comp, struct icaltimetype v) | ||
1824 | { | ||
1825 | ICALSETUPSET(ICAL_RECURRENCEID_PROPERTY); | ||
1826 | |||
1827 | if (prop == 0){ | ||
1828 | prop = icalproperty_new_recurrenceid(v); | ||
1829 | icalcomponent_add_property(inner, prop); | ||
1830 | } | ||
1831 | |||
1832 | icalproperty_set_recurrenceid(prop,v); | ||
1438 | } | 1833 | } |
1834 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp) | ||
1835 | { | ||
1836 | icalcomponent *inner; | ||
1837 | icalproperty *prop; | ||
1838 | if (comp == 0) { | ||
1839 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
1840 | return icaltime_null_time(); | ||
1841 | } | ||
1439 | 1842 | ||
1440 | void icalcomponent_set_comment(icalcomponent* comp, const char* v); | 1843 | inner = icalcomponent_get_inner(comp); |
1441 | const char* icalcomponent_get_comment(icalcomponent* comp); | ||
1442 | 1844 | ||
1443 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); | 1845 | if(inner == 0){ |
1444 | const char* icalcomponent_get_uid(icalcomponent* comp); | 1846 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
1847 | return icaltime_null_time(); | ||
1848 | } | ||
1445 | 1849 | ||
1446 | void icalcomponent_set_recurrenceid(icalcomponent* comp, | 1850 | prop= icalcomponent_get_first_property(inner, ICAL_RECURRENCEID_PROPERTY); |
1447 | struct icaltimetype v); | ||
1448 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); | ||
1449 | 1851 | ||
1852 | if (prop == 0){ | ||
1853 | return icaltime_null_time(); | ||
1854 | } | ||
1855 | |||
1856 | return icalproperty_get_recurrenceid(prop); | ||
1857 | } | ||
1858 | |||
1859 | void icalcomponent_set_description(icalcomponent* comp, const char* v) | ||
1860 | { | ||
1861 | ICALSETUPSET(ICAL_DESCRIPTION_PROPERTY); | ||
1862 | |||
1863 | if (prop == 0){ | ||
1864 | prop = icalproperty_new_description(v); | ||
1865 | icalcomponent_add_property(inner, prop); | ||
1866 | } | ||
1867 | |||
1868 | icalproperty_set_description(prop,v); | ||
1869 | } | ||
1870 | const char* icalcomponent_get_description(icalcomponent* comp) | ||
1871 | { | ||
1872 | icalcomponent *inner; | ||
1873 | icalproperty *prop; | ||
1874 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1875 | |||
1876 | inner = icalcomponent_get_inner(comp); | ||
1877 | |||
1878 | if(inner == 0){ | ||
1879 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1880 | return 0; | ||
1881 | } | ||
1882 | |||
1883 | prop= icalcomponent_get_first_property(inner,ICAL_DESCRIPTION_PROPERTY); | ||
1884 | |||
1885 | if (prop == 0){ | ||
1886 | return 0; | ||
1887 | } | ||
1888 | |||
1889 | return icalproperty_get_description(prop); | ||
1890 | } | ||
1891 | |||
1892 | void icalcomponent_set_location(icalcomponent* comp, const char* v) | ||
1893 | { | ||
1894 | ICALSETUPSET(ICAL_LOCATION_PROPERTY) | ||
1895 | |||
1896 | if (prop == 0){ | ||
1897 | prop = icalproperty_new_location(v); | ||
1898 | icalcomponent_add_property(inner, prop); | ||
1899 | } | ||
1900 | |||
1901 | icalproperty_set_location(prop,v); | ||
1902 | } | ||
1903 | const char* icalcomponent_get_location(icalcomponent* comp) | ||
1904 | { | ||
1905 | icalcomponent *inner; | ||
1906 | icalproperty *prop; | ||
1907 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1908 | |||
1909 | inner = icalcomponent_get_inner(comp); | ||
1910 | |||
1911 | if(inner == 0){ | ||
1912 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1913 | return 0; | ||
1914 | } | ||
1915 | |||
1916 | prop= icalcomponent_get_first_property(inner,ICAL_LOCATION_PROPERTY); | ||
1450 | 1917 | ||
1918 | if (prop == 0){ | ||
1919 | return 0; | ||
1920 | } | ||
1921 | |||
1922 | return icalproperty_get_location(prop); | ||
1923 | } | ||
1924 | |||
1925 | void icalcomponent_set_sequence(icalcomponent* comp, int v) | ||
1926 | { | ||
1927 | ICALSETUPSET(ICAL_SEQUENCE_PROPERTY); | ||
1928 | |||
1929 | if (prop == 0){ | ||
1930 | prop = icalproperty_new_sequence(v); | ||
1931 | icalcomponent_add_property(inner, prop); | ||
1932 | } | ||
1933 | |||
1934 | icalproperty_set_sequence(prop,v); | ||
1935 | |||
1936 | } | ||
1937 | int icalcomponent_get_sequence(icalcomponent* comp){ | ||
1938 | icalcomponent *inner; | ||
1939 | icalproperty *prop; | ||
1940 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1941 | |||
1942 | inner = icalcomponent_get_inner(comp); | ||
1943 | |||
1944 | if(inner == 0){ | ||
1945 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1946 | return 0; | ||
1947 | } | ||
1948 | |||
1949 | prop= icalcomponent_get_first_property(inner,ICAL_SEQUENCE_PROPERTY); | ||
1950 | |||
1951 | if (prop == 0){ | ||
1952 | return 0; | ||
1953 | } | ||
1954 | |||
1955 | return icalproperty_get_sequence(prop); | ||
1956 | } | ||
1957 | |||
1958 | |||
1959 | void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v) | ||
1960 | { | ||
1961 | ICALSETUPSET(ICAL_STATUS_PROPERTY); | ||
1962 | |||
1963 | if (prop == 0){ | ||
1964 | prop = icalproperty_new_status(v); | ||
1965 | icalcomponent_add_property(inner, prop); | ||
1966 | } | ||
1967 | |||
1968 | icalproperty_set_status(prop,v); | ||
1969 | |||
1970 | } | ||
1971 | enum icalproperty_status icalcomponent_get_status(icalcomponent* comp){ | ||
1972 | icalcomponent *inner; | ||
1973 | icalproperty *prop; | ||
1974 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
1975 | |||
1976 | inner = icalcomponent_get_inner(comp); | ||
1977 | |||
1978 | if(inner == 0){ | ||
1979 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
1980 | return 0; | ||
1981 | } | ||
1451 | 1982 | ||
1983 | prop= icalcomponent_get_first_property(inner,ICAL_STATUS_PROPERTY); | ||
1984 | |||
1985 | if (prop == 0){ | ||
1986 | return 0; | ||
1987 | } | ||
1988 | |||
1989 | return icalproperty_get_status(prop); | ||
1990 | } | ||
1452 | 1991 | ||
1453 | icalcomponent* icalcomponent_new_vcalendar() | 1992 | icalcomponent* icalcomponent_new_vcalendar() |
1454 | { | 1993 | { |
@@ -1486,3 +2025,571 @@ icalcomponent* icalcomponent_new_xdaylight() | |||
1486 | { | 2025 | { |
1487 | return icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT); | 2026 | return icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT); |
1488 | } | 2027 | } |
2028 | icalcomponent* icalcomponent_new_vagenda() | ||
2029 | { | ||
2030 | return icalcomponent_new(ICAL_VAGENDA_COMPONENT); | ||
2031 | } | ||
2032 | icalcomponent* icalcomponent_new_vquery() | ||
2033 | { | ||
2034 | return icalcomponent_new(ICAL_VQUERY_COMPONENT); | ||
2035 | } | ||
2036 | |||
2037 | /* | ||
2038 | * Timezone stuff. | ||
2039 | */ | ||
2040 | |||
2041 | |||
2042 | /** | ||
2043 | * This takes 2 VCALENDAR components and merges the second one into the first, | ||
2044 | * resolving any problems with conflicting TZIDs. comp_to_merge will no | ||
2045 | * longer exist after calling this function. | ||
2046 | */ | ||
2047 | void icalcomponent_merge_component(icalcomponent* comp, | ||
2048 | icalcomponent* comp_to_merge) | ||
2049 | { | ||
2050 | icalcomponent *subcomp, *next_subcomp; | ||
2051 | icalarray *tzids_to_rename; | ||
2052 | int i; | ||
2053 | |||
2054 | /* Check that both components are VCALENDAR components. */ | ||
2055 | assert (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT); | ||
2056 | assert (icalcomponent_isa(comp_to_merge) == ICAL_VCALENDAR_COMPONENT); | ||
2057 | |||
2058 | /* Step through each subcomponent of comp_to_merge, looking for VTIMEZONEs. | ||
2059 | For each VTIMEZONE found, check if we need to add it to comp and if we | ||
2060 | need to rename it and all TZID references to it. */ | ||
2061 | tzids_to_rename = icalarray_new (sizeof (char*), 16); | ||
2062 | subcomp = icalcomponent_get_first_component (comp_to_merge, | ||
2063 | ICAL_VTIMEZONE_COMPONENT); | ||
2064 | while (subcomp) { | ||
2065 | next_subcomp = icalcomponent_get_next_component (comp_to_merge, | ||
2066 | ICAL_VTIMEZONE_COMPONENT); | ||
2067 | /* This will add the VTIMEZONE to comp, if necessary, and also update | ||
2068 | the array of TZIDs we need to rename. */ | ||
2069 | icalcomponent_merge_vtimezone (comp, subcomp, tzids_to_rename); | ||
2070 | /* FIXME: Handle possible NEWFAILED error. */ | ||
2071 | |||
2072 | subcomp = next_subcomp; | ||
2073 | } | ||
2074 | |||
2075 | /* If we need to do any renaming of TZIDs, do it now. */ | ||
2076 | if (tzids_to_rename->num_elements != 0) { | ||
2077 | icalcomponent_rename_tzids (comp_to_merge, tzids_to_rename); | ||
2078 | |||
2079 | /* Now free the tzids_to_rename array. */ | ||
2080 | for (i = 0; i < tzids_to_rename->num_elements; i++) { | ||
2081 | free (icalarray_element_at (tzids_to_rename, i)); | ||
2082 | } | ||
2083 | icalarray_free (tzids_to_rename); | ||
2084 | } | ||
2085 | |||
2086 | /* Now move all the components from comp_to_merge to comp, excluding | ||
2087 | VTIMEZONE components. */ | ||
2088 | subcomp = icalcomponent_get_first_component (comp_to_merge, | ||
2089 | ICAL_ANY_COMPONENT); | ||
2090 | while (subcomp) { | ||
2091 | next_subcomp = icalcomponent_get_next_component (comp_to_merge, | ||
2092 | ICAL_ANY_COMPONENT); | ||
2093 | if (icalcomponent_isa(subcomp) != ICAL_VTIMEZONE_COMPONENT) { | ||
2094 | icalcomponent_remove_component (comp_to_merge, subcomp); | ||
2095 | icalcomponent_add_component (comp, subcomp); | ||
2096 | } | ||
2097 | subcomp = next_subcomp; | ||
2098 | } | ||
2099 | |||
2100 | /* Free comp_to_merge. We have moved most of the subcomponents over to | ||
2101 | comp now. */ | ||
2102 | icalcomponent_free (comp_to_merge); | ||
2103 | } | ||
2104 | |||
2105 | |||
2106 | static void icalcomponent_merge_vtimezone (icalcomponent *comp, | ||
2107 | icalcomponent *vtimezone, | ||
2108 | icalarray *tzids_to_rename) | ||
2109 | { | ||
2110 | icalproperty *tzid_prop; | ||
2111 | const char *tzid; | ||
2112 | char *tzid_copy; | ||
2113 | icaltimezone *existing_vtimezone; | ||
2114 | |||
2115 | /* Get the TZID of the VTIMEZONE. */ | ||
2116 | tzid_prop = icalcomponent_get_first_property (vtimezone, ICAL_TZID_PROPERTY); | ||
2117 | if (!tzid_prop) | ||
2118 | return; | ||
2119 | |||
2120 | tzid = icalproperty_get_tzid (tzid_prop); | ||
2121 | if (!tzid) | ||
2122 | return; | ||
2123 | |||
2124 | /* See if there is already a VTIMEZONE in comp with the same TZID. */ | ||
2125 | existing_vtimezone = icalcomponent_get_timezone (comp, tzid); | ||
2126 | |||
2127 | /* If there is no existing VTIMEZONE with the same TZID, we can just move | ||
2128 | the VTIMEZONE to comp and return. */ | ||
2129 | if (!existing_vtimezone) { | ||
2130 | icalcomponent_remove_component (icalcomponent_get_parent (vtimezone), | ||
2131 | vtimezone); | ||
2132 | icalcomponent_add_component (comp, vtimezone); | ||
2133 | return; | ||
2134 | } | ||
2135 | |||
2136 | /* If the TZID has a '/' prefix, then we don't have to worry about the | ||
2137 | clashing TZIDs, as they are supposed to be exactly the same VTIMEZONE. */ | ||
2138 | if (tzid[0] == '/') | ||
2139 | return; | ||
2140 | |||
2141 | /* Now we have two VTIMEZONEs with the same TZID (which isn't a globally | ||
2142 | unique one), so we compare the VTIMEZONE components to see if they are | ||
2143 | the same. If they are, we don't need to do anything. We make a copy of | ||
2144 | the tzid, since the parameter may get modified in these calls. */ | ||
2145 | tzid_copy = strdup (tzid); | ||
2146 | if (!tzid_copy) { | ||
2147 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
2148 | return; | ||
2149 | } | ||
2150 | |||
2151 | if (!icalcomponent_compare_vtimezones (comp, vtimezone)) { | ||
2152 | /* FIXME: Handle possible NEWFAILED error. */ | ||
2153 | |||
2154 | /* Now we have two different VTIMEZONEs with the same TZID. */ | ||
2155 | icalcomponent_handle_conflicting_vtimezones (comp, vtimezone, tzid_prop, | ||
2156 | tzid_copy, tzids_to_rename); | ||
2157 | } | ||
2158 | free (tzid_copy); | ||
2159 | } | ||
2160 | |||
2161 | |||
2162 | static void | ||
2163 | icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp, | ||
2164 | icalcomponent *vtimezone, | ||
2165 | icalproperty *tzid_prop, | ||
2166 | const char *tzid, | ||
2167 | icalarray *tzids_to_rename) | ||
2168 | { | ||
2169 | int i, suffix, max_suffix = 0, num_elements; | ||
2170 | unsigned int tzid_len; | ||
2171 | char *tzid_copy, *new_tzid, suffix_buf[32]; | ||
2172 | |||
2173 | /* Find the length of the TZID without any trailing digits. */ | ||
2174 | tzid_len = icalcomponent_get_tzid_prefix_len (tzid); | ||
2175 | |||
2176 | /* Step through each of the VTIMEZONEs in comp. We may already have the | ||
2177 | clashing VTIMEZONE in the calendar, but it may have been renamed | ||
2178 | (i.e. a unique number added on the end of the TZID, e.g. 'London2'). | ||
2179 | So we compare the new VTIMEZONE with any VTIMEZONEs that have the | ||
2180 | same prefix (e.g. 'London'). If it matches any of those, we have to | ||
2181 | rename the TZIDs to that TZID, else we rename to a new TZID, using | ||
2182 | the biggest numeric suffix found + 1. */ | ||
2183 | num_elements = comp->timezones ? comp->timezones->num_elements : 0; | ||
2184 | for (i = 0; i < num_elements; i++) { | ||
2185 | icaltimezone *zone; | ||
2186 | char *existing_tzid, *existing_tzid_copy; | ||
2187 | unsigned int existing_tzid_len; | ||
2188 | |||
2189 | zone = icalarray_element_at (comp->timezones, i); | ||
2190 | existing_tzid = icaltimezone_get_tzid (zone); | ||
2191 | |||
2192 | /* Find the length of the TZID without any trailing digits. */ | ||
2193 | existing_tzid_len = icalcomponent_get_tzid_prefix_len (existing_tzid); | ||
2194 | |||
2195 | /* Check if we have the same prefix. */ | ||
2196 | if (tzid_len == existing_tzid_len | ||
2197 | && !strncmp (tzid, existing_tzid, tzid_len)) { | ||
2198 | /* Compare the VTIMEZONEs. */ | ||
2199 | if (icalcomponent_compare_vtimezones (icaltimezone_get_component (zone), | ||
2200 | vtimezone)) { | ||
2201 | /* The VTIMEZONEs match, so we can use the existing VTIMEZONE. But | ||
2202 | we have to rename TZIDs to this TZID. */ | ||
2203 | tzid_copy = strdup (tzid); | ||
2204 | existing_tzid_copy = strdup (existing_tzid); | ||
2205 | if (!tzid_copy || !existing_tzid_copy) { | ||
2206 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
2207 | } else { | ||
2208 | icalarray_append (tzids_to_rename, tzid_copy); | ||
2209 | icalarray_append (tzids_to_rename, existing_tzid_copy); | ||
2210 | } | ||
2211 | return; | ||
2212 | } else { | ||
2213 | /* FIXME: Handle possible NEWFAILED error. */ | ||
2214 | |||
2215 | /* Convert the suffix to an integer and remember the maximum numeric | ||
2216 | suffix found. */ | ||
2217 | suffix = atoi (existing_tzid + existing_tzid_len); | ||
2218 | if (max_suffix < suffix) | ||
2219 | max_suffix = suffix; | ||
2220 | } | ||
2221 | } | ||
2222 | } | ||
2223 | |||
2224 | /* We didn't find a VTIMEZONE that matched, so we have to rename the TZID, | ||
2225 | using the maximum numerical suffix found + 1. */ | ||
2226 | tzid_copy = strdup (tzid); | ||
2227 | sprintf (suffix_buf, "%i", max_suffix + 1); | ||
2228 | new_tzid = malloc (tzid_len + strlen (suffix_buf) + 1); | ||
2229 | if (!new_tzid || !tzid_copy) { | ||
2230 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
2231 | return; | ||
2232 | } | ||
2233 | |||
2234 | strncpy (new_tzid, tzid, tzid_len); | ||
2235 | strcpy (new_tzid + tzid_len, suffix_buf); | ||
2236 | icalarray_append (tzids_to_rename, tzid_copy); | ||
2237 | icalarray_append (tzids_to_rename, new_tzid); | ||
2238 | } | ||
2239 | |||
2240 | |||
2241 | /* Returns the length of the TZID, without any trailing digits. */ | ||
2242 | static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid) | ||
2243 | { | ||
2244 | int len; | ||
2245 | const char *p; | ||
2246 | |||
2247 | len = strlen (tzid); | ||
2248 | p = tzid + len - 1; | ||
2249 | while (len > 0 && *p >= '0' && *p <= '9') { | ||
2250 | p--; | ||
2251 | len--; | ||
2252 | } | ||
2253 | |||
2254 | return len; | ||
2255 | } | ||
2256 | |||
2257 | |||
2258 | /** | ||
2259 | * Renames all references to the given TZIDs to a new name. rename_table | ||
2260 | * contains pairs of strings - a current TZID, and the new TZID to rename it | ||
2261 | * to. | ||
2262 | */ | ||
2263 | static void icalcomponent_rename_tzids(icalcomponent* comp, | ||
2264 | icalarray* rename_table) | ||
2265 | { | ||
2266 | icalcomponent_foreach_tzid (comp, icalcomponent_rename_tzids_callback, | ||
2267 | rename_table); | ||
2268 | } | ||
2269 | |||
2270 | |||
2271 | static void icalcomponent_rename_tzids_callback(icalparameter *param, void *data) | ||
2272 | { | ||
2273 | icalarray *rename_table = data; | ||
2274 | const char *tzid; | ||
2275 | int i; | ||
2276 | |||
2277 | tzid = icalparameter_get_tzid (param); | ||
2278 | if (!tzid) | ||
2279 | return; | ||
2280 | |||
2281 | /* Step through the rename table to see if the current TZID matches | ||
2282 | any of the ones we want to rename. */ | ||
2283 | for (i = 0; i < rename_table->num_elements - 1; i += 2) { | ||
2284 | if (!strcmp (tzid, icalarray_element_at (rename_table, i))) { | ||
2285 | icalparameter_set_tzid (param, icalarray_element_at (rename_table, i + 1)); | ||
2286 | break; | ||
2287 | } | ||
2288 | } | ||
2289 | } | ||
2290 | |||
2291 | |||
2292 | /** | ||
2293 | * Calls the given function for each TZID parameter found in the component. | ||
2294 | */ | ||
2295 | void icalcomponent_foreach_tzid(icalcomponent* comp, | ||
2296 | void (*callback)(icalparameter *param, void *data), | ||
2297 | void *callback_data) | ||
2298 | { | ||
2299 | icalproperty *prop; | ||
2300 | icalproperty_kind kind; | ||
2301 | icalparameter *param; | ||
2302 | icalcomponent *subcomp; | ||
2303 | |||
2304 | /* First look for any TZID parameters used in this component itself. */ | ||
2305 | prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); | ||
2306 | while (prop) { | ||
2307 | kind = icalproperty_isa (prop); | ||
2308 | |||
2309 | /* These are the only properties that can have a TZID. Note that | ||
2310 | COMPLETED, CREATED, DTSTAMP & LASTMODIFIED must be in UTC. */ | ||
2311 | if (kind == ICAL_DTSTART_PROPERTY || kind == ICAL_DTEND_PROPERTY | ||
2312 | || kind == ICAL_DUE_PROPERTY || kind == ICAL_EXDATE_PROPERTY | ||
2313 | || kind == ICAL_RDATE_PROPERTY) { | ||
2314 | param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER); | ||
2315 | if (param) | ||
2316 | (*callback) (param, callback_data); | ||
2317 | } | ||
2318 | |||
2319 | prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY); | ||
2320 | } | ||
2321 | |||
2322 | /* Now recursively check child components. */ | ||
2323 | subcomp = icalcomponent_get_first_component (comp, ICAL_ANY_COMPONENT); | ||
2324 | while (subcomp) { | ||
2325 | icalcomponent_foreach_tzid (subcomp, callback, callback_data); | ||
2326 | subcomp = icalcomponent_get_next_component (comp, ICAL_ANY_COMPONENT); | ||
2327 | } | ||
2328 | } | ||
2329 | |||
2330 | |||
2331 | |||
2332 | /** | ||
2333 | * Returns the icaltimezone from the component corresponding to the given | ||
2334 | * TZID, or NULL if the component does not have a corresponding VTIMEZONE. | ||
2335 | */ | ||
2336 | icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, const char *tzid) | ||
2337 | { | ||
2338 | icaltimezone *zone; | ||
2339 | int lower, upper, middle, cmp; | ||
2340 | char *zone_tzid; | ||
2341 | |||
2342 | if (!comp->timezones) | ||
2343 | return NULL; | ||
2344 | |||
2345 | /* Sort the array if necessary (by the TZID string). */ | ||
2346 | if (!comp->timezones_sorted) { | ||
2347 | icalarray_sort (comp->timezones, icalcomponent_compare_timezone_fn); | ||
2348 | comp->timezones_sorted = 1; | ||
2349 | } | ||
2350 | |||
2351 | /* Do a simple binary search. */ | ||
2352 | lower = middle = 0; | ||
2353 | upper = comp->timezones->num_elements; | ||
2354 | |||
2355 | while (lower < upper) { | ||
2356 | middle = (lower + upper) >> 1; | ||
2357 | zone = icalarray_element_at (comp->timezones, middle); | ||
2358 | zone_tzid = icaltimezone_get_tzid (zone); | ||
2359 | cmp = strcmp (tzid, zone_tzid); | ||
2360 | if (cmp == 0) | ||
2361 | return zone; | ||
2362 | else if (cmp < 0) | ||
2363 | upper = middle; | ||
2364 | else | ||
2365 | lower = middle + 1; | ||
2366 | } | ||
2367 | |||
2368 | return NULL; | ||
2369 | } | ||
2370 | |||
2371 | |||
2372 | /** | ||
2373 | * A function to compare 2 icaltimezone elements, used for qsort(). | ||
2374 | */ | ||
2375 | static int icalcomponent_compare_timezone_fn (const void*elem1, | ||
2376 | const void*elem2) | ||
2377 | { | ||
2378 | icaltimezone *zone1, *zone2; | ||
2379 | const char *zone1_tzid, *zone2_tzid; | ||
2380 | |||
2381 | zone1 = (icaltimezone*) elem1; | ||
2382 | zone2 = (icaltimezone*) elem2; | ||
2383 | |||
2384 | zone1_tzid = icaltimezone_get_tzid (zone1); | ||
2385 | zone2_tzid = icaltimezone_get_tzid (zone2); | ||
2386 | |||
2387 | return strcmp (zone1_tzid, zone2_tzid); | ||
2388 | } | ||
2389 | |||
2390 | |||
2391 | /** | ||
2392 | * Compares 2 VTIMEZONE components to see if they match, ignoring their TZIDs. | ||
2393 | * It returns 1 if they match, 0 if they don't, or -1 on error. | ||
2394 | */ | ||
2395 | static int icalcomponent_compare_vtimezones (icalcomponent*vtimezone1, | ||
2396 | icalcomponent*vtimezone2) | ||
2397 | { | ||
2398 | icalproperty *prop1, *prop2; | ||
2399 | const char *tzid1, *tzid2; | ||
2400 | char *tzid2_copy, *string1, *string2; | ||
2401 | int cmp; | ||
2402 | |||
2403 | /* Get the TZID property of the first VTIMEZONE. */ | ||
2404 | prop1 = icalcomponent_get_first_property (vtimezone1, ICAL_TZID_PROPERTY); | ||
2405 | if (!prop1) | ||
2406 | return -1; | ||
2407 | |||
2408 | tzid1 = icalproperty_get_tzid (prop1); | ||
2409 | if (!tzid1) | ||
2410 | return -1; | ||
2411 | |||
2412 | /* Get the TZID property of the second VTIMEZONE. */ | ||
2413 | prop2 = icalcomponent_get_first_property (vtimezone2, ICAL_TZID_PROPERTY); | ||
2414 | if (!prop2) | ||
2415 | return -1; | ||
2416 | |||
2417 | tzid2 = icalproperty_get_tzid (prop2); | ||
2418 | if (!tzid2) | ||
2419 | return -1; | ||
2420 | |||
2421 | /* Copy the second TZID, and set the property to the same as the first | ||
2422 | TZID, since we don't care if these match of not. */ | ||
2423 | tzid2_copy = strdup (tzid2); | ||
2424 | if (!tzid2_copy) { | ||
2425 | icalerror_set_errno (ICAL_NEWFAILED_ERROR); | ||
2426 | return 0; | ||
2427 | } | ||
2428 | |||
2429 | icalproperty_set_tzid (prop2, tzid1); | ||
2430 | |||
2431 | /* Now convert both VTIMEZONEs to strings and compare them. */ | ||
2432 | string1 = icalcomponent_as_ical_string (vtimezone1); | ||
2433 | if (!string1) { | ||
2434 | free (tzid2_copy); | ||
2435 | return -1; | ||
2436 | } | ||
2437 | |||
2438 | string2 = icalcomponent_as_ical_string (vtimezone2); | ||
2439 | if (!string2) { | ||
2440 | free (string1); | ||
2441 | free (tzid2_copy); | ||
2442 | return -1; | ||
2443 | } | ||
2444 | |||
2445 | cmp = strcmp (string1, string2); | ||
2446 | |||
2447 | free (string1); | ||
2448 | free (string2); | ||
2449 | |||
2450 | /* Now reset the second TZID. */ | ||
2451 | icalproperty_set_tzid (prop2, tzid2_copy); | ||
2452 | free (tzid2_copy); | ||
2453 | |||
2454 | return (cmp == 0) ? 1 : 0; | ||
2455 | } | ||
2456 | |||
2457 | |||
2458 | |||
2459 | |||
2460 | |||
2461 | |||
2462 | /** | ||
2463 | * @brief set the RELCALID property of a component. | ||
2464 | * | ||
2465 | * @param comp Valid calendar component. | ||
2466 | * @param v Relcalid URL value | ||
2467 | */ | ||
2468 | |||
2469 | void icalcomponent_set_relcalid(icalcomponent* comp, const char* v) | ||
2470 | { | ||
2471 | ICALSETUPSET(ICAL_RELCALID_PROPERTY); | ||
2472 | |||
2473 | if (prop == 0){ | ||
2474 | prop = icalproperty_new_relcalid(v); | ||
2475 | icalcomponent_add_property(inner, prop); | ||
2476 | } | ||
2477 | |||
2478 | icalproperty_set_relcalid(prop,v); | ||
2479 | |||
2480 | } | ||
2481 | |||
2482 | |||
2483 | /** | ||
2484 | * @brief get the RELCALID property of a component. | ||
2485 | * | ||
2486 | * @param comp Valid calendar component. | ||
2487 | */ | ||
2488 | |||
2489 | const char* icalcomponent_get_relcalid(icalcomponent* comp){ | ||
2490 | icalcomponent *inner; | ||
2491 | icalproperty *prop; | ||
2492 | icalerror_check_arg_rz(comp!=0,"comp"); | ||
2493 | |||
2494 | inner = icalcomponent_get_inner(comp); | ||
2495 | |||
2496 | if(inner == 0){ | ||
2497 | return 0; | ||
2498 | } | ||
2499 | |||
2500 | prop= icalcomponent_get_first_property(inner,ICAL_RELCALID_PROPERTY); | ||
2501 | |||
2502 | if (prop == 0){ | ||
2503 | return 0; | ||
2504 | } | ||
2505 | |||
2506 | return icalproperty_get_relcalid(prop); | ||
2507 | } | ||
2508 | |||
2509 | |||
2510 | /** @brief Return the time a TODO task is DUE. | ||
2511 | * | ||
2512 | * @param comp Valid calendar component. | ||
2513 | * | ||
2514 | * Uses the DUE: property if it exists, otherwise we calculate the DUE | ||
2515 | * value by adding the task's duration to the DTSTART time | ||
2516 | */ | ||
2517 | |||
2518 | struct icaltimetype icalcomponent_get_due(icalcomponent* comp) | ||
2519 | { | ||
2520 | icalcomponent *inner = icalcomponent_get_inner(comp); | ||
2521 | |||
2522 | icalproperty *due_prop | ||
2523 | = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY); | ||
2524 | |||
2525 | icalproperty *dur_prop | ||
2526 | = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY); | ||
2527 | |||
2528 | if( due_prop == 0 && dur_prop == 0){ | ||
2529 | return icaltime_null_time(); | ||
2530 | } else if ( due_prop != 0) { | ||
2531 | return icalproperty_get_due(due_prop); | ||
2532 | } else if ( dur_prop != 0) { | ||
2533 | |||
2534 | struct icaltimetype start = | ||
2535 | icalcomponent_get_dtstart(inner); | ||
2536 | struct icaldurationtype duration = | ||
2537 | icalproperty_get_duration(dur_prop); | ||
2538 | |||
2539 | struct icaltimetype due = icaltime_add(start,duration); | ||
2540 | |||
2541 | return due; | ||
2542 | |||
2543 | } else { | ||
2544 | /* Error, both duration and due have been specified */ | ||
2545 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
2546 | return icaltime_null_time(); | ||
2547 | |||
2548 | } | ||
2549 | |||
2550 | } | ||
2551 | |||
2552 | /** @brief Set the due date of a VTODO task. | ||
2553 | * | ||
2554 | * @param comp Valid VTODO component. | ||
2555 | * @param v Valid due date time. | ||
2556 | * | ||
2557 | * - If no duration or due properties then set the DUE property. | ||
2558 | * - If a DUE property is already set, then reset it to the value v. | ||
2559 | * - If a DURATION property is already set, then calculate the new | ||
2560 | * duration based on the supplied value of v. | ||
2561 | */ | ||
2562 | |||
2563 | void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v) | ||
2564 | { | ||
2565 | icalcomponent *inner = icalcomponent_get_inner(comp); | ||
2566 | |||
2567 | icalproperty *due_prop | ||
2568 | = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY); | ||
2569 | |||
2570 | icalproperty *dur_prop | ||
2571 | = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY); | ||
2572 | |||
2573 | |||
2574 | if( due_prop == 0 && dur_prop == 0){ | ||
2575 | due_prop = icalproperty_new_due(v); | ||
2576 | icalcomponent_add_property(inner,due_prop); | ||
2577 | } else if ( due_prop != 0) { | ||
2578 | icalproperty_set_due(due_prop,v); | ||
2579 | } else if ( dur_prop != 0) { | ||
2580 | struct icaltimetype start = | ||
2581 | icalcomponent_get_dtstart(inner); | ||
2582 | |||
2583 | struct icaltimetype due = | ||
2584 | icalcomponent_get_due(inner); | ||
2585 | |||
2586 | struct icaldurationtype dur | ||
2587 | = icaltime_subtract(due,start); | ||
2588 | |||
2589 | icalproperty_set_duration(dur_prop,dur); | ||
2590 | |||
2591 | } else { | ||
2592 | /* Error, both duration and due have been specified */ | ||
2593 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
2594 | } | ||
2595 | } | ||
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 | |||
@@ -27,10 +27,18 @@ | |||
27 | #include "icalproperty.h" | 27 | #include "icalproperty.h" |
28 | #include "icalvalue.h" | 28 | #include "icalvalue.h" |
29 | #include "icalenums.h" /* defines icalcomponent_kind */ | 29 | #include "icalenums.h" /* defines icalcomponent_kind */ |
30 | #include "icalattendee.h" | ||
31 | #include "pvl.h" | 30 | #include "pvl.h" |
32 | 31 | ||
33 | typedef void icalcomponent; | 32 | typedef struct icalcomponent_impl icalcomponent; |
33 | |||
34 | #ifndef ICALTIMEZONE_DEFINED | ||
35 | #define ICALTIMEZONE_DEFINED | ||
36 | /** @brief An opaque struct representing a timezone. | ||
37 | * We declare this here to avoid a circular dependancy. | ||
38 | */ | ||
39 | typedef struct _icaltimezone icaltimezone; | ||
40 | #endif | ||
41 | |||
34 | 42 | ||
35 | /* This is exposed so that callers will not have to allocate and | 43 | /* This is exposed so that callers will not have to allocate and |
36 | deallocate iterators. Pretend that you can't see it. */ | 44 | deallocate iterators. Pretend that you can't see it. */ |
@@ -51,7 +59,7 @@ char* icalcomponent_as_ical_string(icalcomponent* component); | |||
51 | 59 | ||
52 | int icalcomponent_is_valid(icalcomponent* component); | 60 | int icalcomponent_is_valid(icalcomponent* component); |
53 | 61 | ||
54 | icalcomponent_kind icalcomponent_isa(icalcomponent* component); | 62 | icalcomponent_kind icalcomponent_isa(const icalcomponent* component); |
55 | 63 | ||
56 | int icalcomponent_isa_component (void* component); | 64 | int icalcomponent_isa_component (void* component); |
57 | 65 | ||
@@ -97,6 +105,14 @@ void icalcomponent_remove_component(icalcomponent* parent, | |||
97 | int icalcomponent_count_components(icalcomponent* component, | 105 | int icalcomponent_count_components(icalcomponent* component, |
98 | icalcomponent_kind kind); | 106 | icalcomponent_kind kind); |
99 | 107 | ||
108 | /** | ||
109 | This takes 2 VCALENDAR components and merges the second one into the first, | ||
110 | resolving any problems with conflicting TZIDs. comp_to_merge will no | ||
111 | longer exist after calling this function. */ | ||
112 | void icalcomponent_merge_component(icalcomponent* comp, | ||
113 | icalcomponent* comp_to_merge); | ||
114 | |||
115 | |||
100 | /* Iteration Routines. There are two forms of iterators, internal and | 116 | /* Iteration Routines. There are two forms of iterators, internal and |
101 | external. The internal ones came first, and are almost completely | 117 | external. The internal ones came first, and are almost completely |
102 | sufficient, but they fail badly when you want to construct a loop that | 118 | sufficient, but they fail badly when you want to construct a loop that |
@@ -121,16 +137,20 @@ icalcomponent* icalcompiter_prior(icalcompiter* i); | |||
121 | icalcomponent* icalcompiter_deref(icalcompiter* i); | 137 | icalcomponent* icalcompiter_deref(icalcompiter* i); |
122 | 138 | ||
123 | 139 | ||
140 | /* Working with embedded error properties */ | ||
124 | 141 | ||
125 | 142 | ||
143 | /* Check the component against itip rules and insert error properties*/ | ||
126 | /* Working with embedded error properties */ | 144 | /* Working with embedded error properties */ |
145 | int icalcomponent_check_restrictions(icalcomponent* comp); | ||
127 | 146 | ||
147 | /** Count embedded errors. */ | ||
128 | int icalcomponent_count_errors(icalcomponent* component); | 148 | int icalcomponent_count_errors(icalcomponent* component); |
129 | 149 | ||
130 | /* Remove all X-LIC-ERROR properties*/ | 150 | /** Remove all X-LIC-ERROR properties*/ |
131 | void icalcomponent_strip_errors(icalcomponent* component); | 151 | void icalcomponent_strip_errors(icalcomponent* component); |
132 | 152 | ||
133 | /* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ | 153 | /** Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ |
134 | void icalcomponent_convert_errors(icalcomponent* component); | 154 | void icalcomponent_convert_errors(icalcomponent* component); |
135 | 155 | ||
136 | /* Internal operations. They are private, and you should not be using them. */ | 156 | /* Internal operations. They are private, and you should not be using them. */ |
@@ -138,7 +158,9 @@ icalcomponent* icalcomponent_get_parent(icalcomponent* component); | |||
138 | void icalcomponent_set_parent(icalcomponent* component, | 158 | void icalcomponent_set_parent(icalcomponent* component, |
139 | icalcomponent* parent); | 159 | icalcomponent* parent); |
140 | 160 | ||
141 | /* Kind conversion routiens */ | 161 | /* Kind conversion routines */ |
162 | |||
163 | int icalcomponent_kind_is_valid(const icalcomponent_kind kind); | ||
142 | 164 | ||
143 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); | 165 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); |
144 | 166 | ||
@@ -151,11 +173,11 @@ If the code was in an OO language, the remaining routines would be | |||
151 | members of classes derived from icalcomponent. Don't call them on the | 173 | members of classes derived from icalcomponent. Don't call them on the |
152 | wrong component subtypes. */ | 174 | wrong component subtypes. */ |
153 | 175 | ||
154 | /* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or | 176 | /** For VCOMPONENT: Return a reference to the first VEVENT, VTODO or |
155 | VJOURNAL */ | 177 | VJOURNAL */ |
156 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); | 178 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); |
157 | 179 | ||
158 | /* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end | 180 | /** For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end |
159 | times of an event in UTC */ | 181 | times of an event in UTC */ |
160 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); | 182 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); |
161 | 183 | ||
@@ -177,6 +199,9 @@ struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp); | |||
177 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); | 199 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); |
178 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); | 200 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); |
179 | 201 | ||
202 | struct icaltimetype icalcomponent_get_due(icalcomponent* comp); | ||
203 | void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v); | ||
204 | |||
180 | void icalcomponent_set_duration(icalcomponent* comp, | 205 | void icalcomponent_set_duration(icalcomponent* comp, |
181 | struct icaldurationtype v); | 206 | struct icaldurationtype v); |
182 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); | 207 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); |
@@ -187,7 +212,6 @@ icalproperty_method icalcomponent_get_method(icalcomponent* comp); | |||
187 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); | 212 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); |
188 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); | 213 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); |
189 | 214 | ||
190 | |||
191 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); | 215 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); |
192 | const char* icalcomponent_get_summary(icalcomponent* comp); | 216 | const char* icalcomponent_get_summary(icalcomponent* comp); |
193 | 217 | ||
@@ -197,27 +221,48 @@ const char* icalcomponent_get_comment(icalcomponent* comp); | |||
197 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); | 221 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); |
198 | const char* icalcomponent_get_uid(icalcomponent* comp); | 222 | const char* icalcomponent_get_uid(icalcomponent* comp); |
199 | 223 | ||
224 | void icalcomponent_set_relcalid(icalcomponent* comp, const char* v); | ||
225 | const char* icalcomponent_get_relcalid(icalcomponent* comp); | ||
226 | |||
200 | void icalcomponent_set_recurrenceid(icalcomponent* comp, | 227 | void icalcomponent_set_recurrenceid(icalcomponent* comp, |
201 | struct icaltimetype v); | 228 | struct icaltimetype v); |
202 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); | 229 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); |
203 | 230 | ||
231 | void icalcomponent_set_description(icalcomponent* comp, const char* v); | ||
232 | const char* icalcomponent_get_description(icalcomponent* comp); | ||
204 | 233 | ||
205 | void icalcomponent_set_organizer(icalcomponent* comp, | 234 | void icalcomponent_set_location(icalcomponent* comp, const char* v); |
206 | struct icalorganizertype org); | 235 | const char* icalcomponent_get_location(icalcomponent* comp); |
207 | struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp); | ||
208 | 236 | ||
237 | void icalcomponent_set_sequence(icalcomponent* comp, int v); | ||
238 | int icalcomponent_get_sequence(icalcomponent* comp); | ||
209 | 239 | ||
210 | void icalcomponent_add_attendee(icalcomponent *comp, | 240 | void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v); |
211 | struct icalattendeetype attendee); | 241 | enum icalproperty_status icalcomponent_get_status(icalcomponent* comp); |
212 | 242 | ||
213 | int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid); | ||
214 | 243 | ||
215 | /* Get the Nth attendee. Out of range indices return an attendee | 244 | /** Calls the given function for each TZID parameter found in the |
216 | with cuid == 0 */ | 245 | component, and any subcomponents. */ |
217 | struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp, | 246 | void icalcomponent_foreach_tzid(icalcomponent* comp, |
218 | int index); | 247 | void (*callback)(icalparameter *param, void *data), |
248 | void *callback_data); | ||
219 | 249 | ||
250 | /** Returns the icaltimezone in the component corresponding to the | ||
251 | TZID, or NULL if it can't be found. */ | ||
252 | icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, | ||
253 | const char *tzid); | ||
220 | 254 | ||
255 | int icalproperty_recurrence_is_excluded(icalcomponent *comp, | ||
256 | struct icaltimetype *dtstart, | ||
257 | struct icaltimetype *recurtime); | ||
258 | |||
259 | void icalcomponent_foreach_recurrence(icalcomponent* comp, | ||
260 | struct icaltimetype start, | ||
261 | struct icaltimetype end, | ||
262 | void (*callback)(icalcomponent *comp, | ||
263 | struct icaltime_span *span, | ||
264 | void *data), | ||
265 | void *callback_data); | ||
221 | 266 | ||
222 | 267 | ||
223 | /*************** Type Specific routines ***************/ | 268 | /*************** Type Specific routines ***************/ |
@@ -231,10 +276,7 @@ icalcomponent* icalcomponent_new_vfreebusy(); | |||
231 | icalcomponent* icalcomponent_new_vtimezone(); | 276 | icalcomponent* icalcomponent_new_vtimezone(); |
232 | icalcomponent* icalcomponent_new_xstandard(); | 277 | icalcomponent* icalcomponent_new_xstandard(); |
233 | icalcomponent* icalcomponent_new_xdaylight(); | 278 | icalcomponent* icalcomponent_new_xdaylight(); |
234 | 279 | icalcomponent* icalcomponent_new_vagenda(); | |
235 | 280 | icalcomponent* icalcomponent_new_vquery(); | |
236 | 281 | ||
237 | #endif /* !ICALCOMPONENT_H */ | 282 | #endif /* !ICALCOMPONENT_H */ |
238 | |||
239 | |||
240 | |||
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 | |||
@@ -55,45 +55,6 @@ struct icalparameter_kind_map { | |||
55 | 55 | ||
56 | }; | 56 | }; |
57 | 57 | ||
58 | extern struct icalparameter_kind_map parameter_map[]; | ||
59 | |||
60 | |||
61 | const char* icalparameter_kind_to_string(icalparameter_kind kind) | ||
62 | { | ||
63 | int i; | ||
64 | |||
65 | for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { | ||
66 | if (parameter_map[i].kind == kind) { | ||
67 | return parameter_map[i].name; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | return 0; | ||
72 | |||
73 | } | ||
74 | |||
75 | icalparameter_kind icalparameter_string_to_kind(const char* string) | ||
76 | { | ||
77 | int i; | ||
78 | |||
79 | if (string ==0 ) { | ||
80 | return ICAL_NO_PARAMETER; | ||
81 | } | ||
82 | |||
83 | for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { | ||
84 | |||
85 | if (strcmp(parameter_map[i].name, string) == 0) { | ||
86 | return parameter_map[i].kind; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | if(strncmp(string,"X-",2)==0){ | ||
91 | return ICAL_X_PARAMETER; | ||
92 | } | ||
93 | |||
94 | return ICAL_NO_PARAMETER; | ||
95 | } | ||
96 | |||
97 | /* This map associates the enumerations for the VALUE parameter with | 58 | /* This map associates the enumerations for the VALUE parameter with |
98 | the kinds of VALUEs. */ | 59 | the kinds of VALUEs. */ |
99 | 60 | ||
@@ -102,24 +63,6 @@ struct icalparameter_value_kind_map { | |||
102 | icalvalue_kind kind; | 63 | icalvalue_kind kind; |
103 | }; | 64 | }; |
104 | 65 | ||
105 | extern struct icalparameter_value_kind_map value_kind_map[]; | ||
106 | |||
107 | |||
108 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value) | ||
109 | { | ||
110 | int i; | ||
111 | |||
112 | for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) { | ||
113 | |||
114 | if (value_kind_map[i].value == value) { | ||
115 | return value_kind_map[i].kind; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | return ICAL_NO_VALUE; | ||
120 | } | ||
121 | |||
122 | |||
123 | /* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */ | 66 | /* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */ |
124 | 67 | ||
125 | struct icalparameter_map { | 68 | struct icalparameter_map { |
@@ -129,87 +72,8 @@ struct icalparameter_map { | |||
129 | }; | 72 | }; |
130 | 73 | ||
131 | 74 | ||
132 | extern struct icalparameter_map icalparameter_map[]; | ||
133 | |||
134 | |||
135 | const char* icalparameter_enum_to_string(int e) | ||
136 | { | ||
137 | int i; | ||
138 | |||
139 | icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e"); | ||
140 | icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e"); | ||
141 | |||
142 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ | ||
143 | if(e == icalparameter_map[i].enumeration){ | ||
144 | return icalparameter_map[i].str; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | int icalparameter_string_to_enum(const char* str) | ||
152 | { | ||
153 | int i; | ||
154 | |||
155 | icalerror_check_arg_rz(str != 0,"str"); | ||
156 | |||
157 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ | ||
158 | if(strcmp(str,icalparameter_map[i].str) == 0) { | ||
159 | return icalparameter_map[i].enumeration; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | 75 | ||
166 | icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val) | 76 | static struct icalparameter_value_kind_map value_kind_map[15] = { |
167 | { | ||
168 | |||
169 | struct icalparameter_impl* param=0; | ||
170 | int found_kind = 0; | ||
171 | int i; | ||
172 | |||
173 | icalerror_check_arg_rz((val!=0),"val"); | ||
174 | |||
175 | /* Search through the parameter map to find a matching kind */ | ||
176 | |||
177 | param = icalparameter_new_impl(kind); | ||
178 | |||
179 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ | ||
180 | if(kind == icalparameter_map[i].kind) { | ||
181 | found_kind = 1; | ||
182 | if(strcmp(val,icalparameter_map[i].str) == 0) { | ||
183 | |||
184 | param->data = (int)icalparameter_map[i].enumeration; | ||
185 | return param; | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | |||
190 | if(found_kind == 1){ | ||
191 | /* The kind was in the parameter map, but the string did not | ||
192 | match, so assume that it is an alternate value, like an | ||
193 | X-value.*/ | ||
194 | |||
195 | icalparameter_set_xvalue(param, val); | ||
196 | |||
197 | } else { | ||
198 | |||
199 | /* If the kind was not found, then it must be a string type */ | ||
200 | |||
201 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val); | ||
202 | |||
203 | } | ||
204 | |||
205 | return param; | ||
206 | } | ||
207 | |||
208 | |||
209 | |||
210 | |||
211 | /* Everything below this line is machine generated. Do not edit. */ | ||
212 | struct icalparameter_value_kind_map value_kind_map[] = { | ||
213 | {ICAL_VALUE_BINARY,ICAL_BINARY_VALUE}, | 77 | {ICAL_VALUE_BINARY,ICAL_BINARY_VALUE}, |
214 | {ICAL_VALUE_BOOLEAN,ICAL_BOOLEAN_VALUE}, | 78 | {ICAL_VALUE_BOOLEAN,ICAL_BOOLEAN_VALUE}, |
215 | {ICAL_VALUE_DATE,ICAL_DATE_VALUE}, | 79 | {ICAL_VALUE_DATE,ICAL_DATE_VALUE}, |
@@ -227,7 +91,7 @@ struct icalparameter_value_kind_map value_kind_map[] = { | |||
227 | {ICAL_VALUE_NONE,ICAL_NO_VALUE} | 91 | {ICAL_VALUE_NONE,ICAL_NO_VALUE} |
228 | }; | 92 | }; |
229 | 93 | ||
230 | static struct icalparameter_kind_map parameter_map[] = { | 94 | static struct icalparameter_kind_map parameter_map[24] = { |
231 | {ICAL_ALTREP_PARAMETER,"ALTREP"}, | 95 | {ICAL_ALTREP_PARAMETER,"ALTREP"}, |
232 | {ICAL_CN_PARAMETER,"CN"}, | 96 | {ICAL_CN_PARAMETER,"CN"}, |
233 | {ICAL_CUTYPE_PARAMETER,"CUTYPE"}, | 97 | {ICAL_CUTYPE_PARAMETER,"CUTYPE"}, |
@@ -277,7 +141,7 @@ static struct icalparameter_map icalparameter_map[] = { | |||
277 | {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"}, | 141 | {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"}, |
278 | {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"}, | 142 | {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"}, |
279 | {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"}, | 143 | {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"}, |
280 | {ICAL_RELATED_PARAMETER,ICAL_RELATED_END ,"END "}, | 144 | {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"}, |
281 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"}, | 145 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"}, |
282 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"}, | 146 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"}, |
283 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"}, | 147 | {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"}, |
@@ -308,6 +172,8 @@ static struct icalparameter_map icalparameter_map[] = { | |||
308 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"}, | 172 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"}, |
309 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"}, | 173 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"}, |
310 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"}, | 174 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"}, |
175 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNULL,"ISNULL"}, | ||
176 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNOTNULL,"ISNOTNULL"}, | ||
311 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT-PARSE-ERROR"}, | 177 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT-PARSE-ERROR"}, |
312 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY-PARSE-ERROR"}, | 178 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY-PARSE-ERROR"}, |
313 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER-NAME-PARSE-ERROR"}, | 179 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER-NAME-PARSE-ERROR"}, |
@@ -316,20 +182,21 @@ static struct icalparameter_map icalparameter_map[] = { | |||
316 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID-ITIP"}, | 182 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID-ITIP"}, |
317 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR,"UNKNOWN-VCAL-PROP-ERROR"}, | 183 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR,"UNKNOWN-VCAL-PROP-ERROR"}, |
318 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME-PARSE-ERROR"}, | 184 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME-PARSE-ERROR"}, |
185 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VCALPROPPARSEERROR,"VCAL-PROP-PARSE-ERROR"}, | ||
319 | {ICAL_NO_PARAMETER,0,""}}; | 186 | {ICAL_NO_PARAMETER,0,""}}; |
320 | 187 | ||
321 | /* DELEGATED-FROM */ | 188 | /* LANGUAGE */ |
322 | icalparameter* icalparameter_new_delegatedfrom(const char* v) | 189 | icalparameter* icalparameter_new_language(const char* v) |
323 | { | 190 | { |
324 | struct icalparameter_impl *impl; | 191 | struct icalparameter_impl *impl; |
325 | icalerror_clear_errno(); | 192 | icalerror_clear_errno(); |
326 | icalerror_check_arg_rz( (v!=0),"v"); | 193 | icalerror_check_arg_rz( (v!=0),"v"); |
327 | impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER); | 194 | impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER); |
328 | if (impl == 0) { | 195 | if (impl == 0) { |
329 | return 0; | 196 | return 0; |
330 | } | 197 | } |
331 | 198 | ||
332 | icalparameter_set_delegatedfrom((icalparameter*) impl,v); | 199 | icalparameter_set_language((icalparameter*) impl,v); |
333 | if (icalerrno != ICAL_NO_ERROR) { | 200 | if (icalerrno != ICAL_NO_ERROR) { |
334 | icalparameter_free((icalparameter*) impl); | 201 | icalparameter_free((icalparameter*) impl); |
335 | return 0; | 202 | return 0; |
@@ -338,14 +205,14 @@ icalparameter* icalparameter_new_delegatedfrom(const char* v) | |||
338 | return (icalparameter*) impl; | 205 | return (icalparameter*) impl; |
339 | } | 206 | } |
340 | 207 | ||
341 | const char* icalparameter_get_delegatedfrom(icalparameter* param) | 208 | const char* icalparameter_get_language(const icalparameter* param) |
342 | { | 209 | { |
343 | icalerror_clear_errno(); | 210 | icalerror_clear_errno(); |
344 | icalerror_check_arg_rz( (param!=0), "param"); | 211 | icalerror_check_arg_rz( (param!=0), "param"); |
345 | return (const char*)((struct icalparameter_impl*)param)->string; | 212 | return param->string; |
346 | } | 213 | } |
347 | 214 | ||
348 | void icalparameter_set_delegatedfrom(icalparameter* param, const char* v) | 215 | void icalparameter_set_language(icalparameter* param, const char* v) |
349 | { | 216 | { |
350 | icalerror_check_arg_rv( (v!=0),"v"); | 217 | icalerror_check_arg_rv( (v!=0),"v"); |
351 | icalerror_check_arg_rv( (param!=0), "param"); | 218 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -354,18 +221,18 @@ void icalparameter_set_delegatedfrom(icalparameter* param, const char* v) | |||
354 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 221 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
355 | } | 222 | } |
356 | 223 | ||
357 | /* DELEGATED-TO */ | 224 | /* DIR */ |
358 | icalparameter* icalparameter_new_delegatedto(const char* v) | 225 | icalparameter* icalparameter_new_dir(const char* v) |
359 | { | 226 | { |
360 | struct icalparameter_impl *impl; | 227 | struct icalparameter_impl *impl; |
361 | icalerror_clear_errno(); | 228 | icalerror_clear_errno(); |
362 | icalerror_check_arg_rz( (v!=0),"v"); | 229 | icalerror_check_arg_rz( (v!=0),"v"); |
363 | impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER); | 230 | impl = icalparameter_new_impl(ICAL_DIR_PARAMETER); |
364 | if (impl == 0) { | 231 | if (impl == 0) { |
365 | return 0; | 232 | return 0; |
366 | } | 233 | } |
367 | 234 | ||
368 | icalparameter_set_delegatedto((icalparameter*) impl,v); | 235 | icalparameter_set_dir((icalparameter*) impl,v); |
369 | if (icalerrno != ICAL_NO_ERROR) { | 236 | if (icalerrno != ICAL_NO_ERROR) { |
370 | icalparameter_free((icalparameter*) impl); | 237 | icalparameter_free((icalparameter*) impl); |
371 | return 0; | 238 | return 0; |
@@ -374,14 +241,14 @@ icalparameter* icalparameter_new_delegatedto(const char* v) | |||
374 | return (icalparameter*) impl; | 241 | return (icalparameter*) impl; |
375 | } | 242 | } |
376 | 243 | ||
377 | const char* icalparameter_get_delegatedto(icalparameter* param) | 244 | const char* icalparameter_get_dir(const icalparameter* param) |
378 | { | 245 | { |
379 | icalerror_clear_errno(); | 246 | icalerror_clear_errno(); |
380 | icalerror_check_arg_rz( (param!=0), "param"); | 247 | icalerror_check_arg_rz( (param!=0), "param"); |
381 | return (const char*)((struct icalparameter_impl*)param)->string; | 248 | return param->string; |
382 | } | 249 | } |
383 | 250 | ||
384 | void icalparameter_set_delegatedto(icalparameter* param, const char* v) | 251 | void icalparameter_set_dir(icalparameter* param, const char* v) |
385 | { | 252 | { |
386 | icalerror_check_arg_rv( (v!=0),"v"); | 253 | icalerror_check_arg_rv( (v!=0),"v"); |
387 | icalerror_check_arg_rv( (param!=0), "param"); | 254 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -390,19 +257,19 @@ void icalparameter_set_delegatedto(icalparameter* param, const char* v) | |||
390 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 257 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
391 | } | 258 | } |
392 | 259 | ||
393 | /* RANGE */ | 260 | /* RELTYPE */ |
394 | icalparameter* icalparameter_new_range(icalparameter_range v) | 261 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v) |
395 | { | 262 | { |
396 | struct icalparameter_impl *impl; | 263 | struct icalparameter_impl *impl; |
397 | icalerror_clear_errno(); | 264 | icalerror_clear_errno(); |
398 | icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v"); | 265 | icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v"); |
399 | icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v"); | 266 | icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v"); |
400 | impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER); | 267 | impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER); |
401 | if (impl == 0) { | 268 | if (impl == 0) { |
402 | return 0; | 269 | return 0; |
403 | } | 270 | } |
404 | 271 | ||
405 | icalparameter_set_range((icalparameter*) impl,v); | 272 | icalparameter_set_reltype((icalparameter*) impl,v); |
406 | if (icalerrno != ICAL_NO_ERROR) { | 273 | if (icalerrno != ICAL_NO_ERROR) { |
407 | icalparameter_free((icalparameter*) impl); | 274 | icalparameter_free((icalparameter*) impl); |
408 | return 0; | 275 | return 0; |
@@ -411,37 +278,39 @@ icalparameter* icalparameter_new_range(icalparameter_range v) | |||
411 | return (icalparameter*) impl; | 278 | return (icalparameter*) impl; |
412 | } | 279 | } |
413 | 280 | ||
414 | icalparameter_range icalparameter_get_range(icalparameter* param) | 281 | icalparameter_reltype icalparameter_get_reltype(const icalparameter* param) |
415 | { | 282 | { |
416 | icalerror_clear_errno(); | 283 | icalerror_clear_errno(); |
417 | icalerror_check_arg( (param!=0), "param"); | 284 | icalerror_check_arg( (param!=0), "param"); |
285 | if (param->string != 0){ | ||
286 | return ICAL_RELTYPE_X; | ||
287 | } | ||
418 | 288 | ||
419 | return (icalparameter_range)((struct icalparameter_impl*)param)->data; | 289 | return (icalparameter_reltype)(param->data); |
420 | } | 290 | } |
421 | 291 | ||
422 | void icalparameter_set_range(icalparameter* param, icalparameter_range v) | 292 | void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v) |
423 | { | 293 | { |
424 | icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v"); | 294 | icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v"); |
425 | icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v"); | 295 | icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v"); |
426 | icalerror_check_arg_rv( (param!=0), "param"); | 296 | icalerror_check_arg_rv( (param!=0), "param"); |
427 | icalerror_clear_errno(); | 297 | icalerror_clear_errno(); |
428 | 298 | ||
429 | ((struct icalparameter_impl*)param)->data = (int)v; | 299 | ((struct icalparameter_impl*)param)->data = (int)v; |
430 | } | 300 | } |
431 | 301 | ||
432 | /* ENCODING */ | 302 | /* FMTTYPE */ |
433 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v) | 303 | icalparameter* icalparameter_new_fmttype(const char* v) |
434 | { | 304 | { |
435 | struct icalparameter_impl *impl; | 305 | struct icalparameter_impl *impl; |
436 | icalerror_clear_errno(); | 306 | icalerror_clear_errno(); |
437 | icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v"); | 307 | icalerror_check_arg_rz( (v!=0),"v"); |
438 | icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v"); | 308 | impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER); |
439 | impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER); | ||
440 | if (impl == 0) { | 309 | if (impl == 0) { |
441 | return 0; | 310 | return 0; |
442 | } | 311 | } |
443 | 312 | ||
444 | icalparameter_set_encoding((icalparameter*) impl,v); | 313 | icalparameter_set_fmttype((icalparameter*) impl,v); |
445 | if (icalerrno != ICAL_NO_ERROR) { | 314 | if (icalerrno != ICAL_NO_ERROR) { |
446 | icalparameter_free((icalparameter*) impl); | 315 | icalparameter_free((icalparameter*) impl); |
447 | return 0; | 316 | return 0; |
@@ -450,40 +319,71 @@ icalparameter* icalparameter_new_encoding(icalparameter_encoding v) | |||
450 | return (icalparameter*) impl; | 319 | return (icalparameter*) impl; |
451 | } | 320 | } |
452 | 321 | ||
453 | icalparameter_encoding icalparameter_get_encoding(icalparameter* param) | 322 | const char* icalparameter_get_fmttype(const icalparameter* param) |
454 | { | 323 | { |
455 | icalerror_clear_errno(); | 324 | icalerror_clear_errno(); |
456 | icalerror_check_arg( (param!=0), "param"); | 325 | icalerror_check_arg_rz( (param!=0), "param"); |
457 | if ( ((struct icalparameter_impl*)param)->string != 0){ | 326 | return param->string; |
458 | return ICAL_ENCODING_X; | 327 | } |
459 | } | ||
460 | 328 | ||
461 | return (icalparameter_encoding)((struct icalparameter_impl*)param)->data; | 329 | void icalparameter_set_fmttype(icalparameter* param, const char* v) |
330 | { | ||
331 | icalerror_check_arg_rv( (v!=0),"v"); | ||
332 | icalerror_check_arg_rv( (param!=0), "param"); | ||
333 | icalerror_clear_errno(); | ||
334 | |||
335 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | ||
462 | } | 336 | } |
463 | 337 | ||
464 | void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v) | 338 | /* TZID */ |
339 | icalparameter* icalparameter_new_tzid(const char* v) | ||
465 | { | 340 | { |
466 | icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v"); | 341 | struct icalparameter_impl *impl; |
467 | icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v"); | 342 | icalerror_clear_errno(); |
343 | icalerror_check_arg_rz( (v!=0),"v"); | ||
344 | impl = icalparameter_new_impl(ICAL_TZID_PARAMETER); | ||
345 | if (impl == 0) { | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | icalparameter_set_tzid((icalparameter*) impl,v); | ||
350 | if (icalerrno != ICAL_NO_ERROR) { | ||
351 | icalparameter_free((icalparameter*) impl); | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | return (icalparameter*) impl; | ||
356 | } | ||
357 | |||
358 | const char* icalparameter_get_tzid(const icalparameter* param) | ||
359 | { | ||
360 | icalerror_clear_errno(); | ||
361 | icalerror_check_arg_rz( (param!=0), "param"); | ||
362 | return param->string; | ||
363 | } | ||
364 | |||
365 | void icalparameter_set_tzid(icalparameter* param, const char* v) | ||
366 | { | ||
367 | icalerror_check_arg_rv( (v!=0),"v"); | ||
468 | icalerror_check_arg_rv( (param!=0), "param"); | 368 | icalerror_check_arg_rv( (param!=0), "param"); |
469 | icalerror_clear_errno(); | 369 | icalerror_clear_errno(); |
470 | 370 | ||
471 | ((struct icalparameter_impl*)param)->data = (int)v; | 371 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
472 | } | 372 | } |
473 | 373 | ||
474 | /* RSVP */ | 374 | /* RANGE */ |
475 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v) | 375 | icalparameter* icalparameter_new_range(icalparameter_range v) |
476 | { | 376 | { |
477 | struct icalparameter_impl *impl; | 377 | struct icalparameter_impl *impl; |
478 | icalerror_clear_errno(); | 378 | icalerror_clear_errno(); |
479 | icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v"); | 379 | icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v"); |
480 | icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v"); | 380 | icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v"); |
481 | impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER); | 381 | impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER); |
482 | if (impl == 0) { | 382 | if (impl == 0) { |
483 | return 0; | 383 | return 0; |
484 | } | 384 | } |
485 | 385 | ||
486 | icalparameter_set_rsvp((icalparameter*) impl,v); | 386 | icalparameter_set_range((icalparameter*) impl,v); |
487 | if (icalerrno != ICAL_NO_ERROR) { | 387 | if (icalerrno != ICAL_NO_ERROR) { |
488 | icalparameter_free((icalparameter*) impl); | 388 | icalparameter_free((icalparameter*) impl); |
489 | return 0; | 389 | return 0; |
@@ -492,37 +392,36 @@ icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v) | |||
492 | return (icalparameter*) impl; | 392 | return (icalparameter*) impl; |
493 | } | 393 | } |
494 | 394 | ||
495 | icalparameter_rsvp icalparameter_get_rsvp(icalparameter* param) | 395 | icalparameter_range icalparameter_get_range(const icalparameter* param) |
496 | { | 396 | { |
497 | icalerror_clear_errno(); | 397 | icalerror_clear_errno(); |
498 | icalerror_check_arg( (param!=0), "param"); | 398 | icalerror_check_arg( (param!=0), "param"); |
499 | 399 | ||
500 | return (icalparameter_rsvp)((struct icalparameter_impl*)param)->data; | 400 | return (icalparameter_range)(param->data); |
501 | } | 401 | } |
502 | 402 | ||
503 | void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v) | 403 | void icalparameter_set_range(icalparameter* param, icalparameter_range v) |
504 | { | 404 | { |
505 | icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v"); | 405 | icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v"); |
506 | icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v"); | 406 | icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v"); |
507 | icalerror_check_arg_rv( (param!=0), "param"); | 407 | icalerror_check_arg_rv( (param!=0), "param"); |
508 | icalerror_clear_errno(); | 408 | icalerror_clear_errno(); |
509 | 409 | ||
510 | ((struct icalparameter_impl*)param)->data = (int)v; | 410 | ((struct icalparameter_impl*)param)->data = (int)v; |
511 | } | 411 | } |
512 | 412 | ||
513 | /* PARTSTAT */ | 413 | /* DELEGATED-TO */ |
514 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v) | 414 | icalparameter* icalparameter_new_delegatedto(const char* v) |
515 | { | 415 | { |
516 | struct icalparameter_impl *impl; | 416 | struct icalparameter_impl *impl; |
517 | icalerror_clear_errno(); | 417 | icalerror_clear_errno(); |
518 | icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v"); | 418 | icalerror_check_arg_rz( (v!=0),"v"); |
519 | icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v"); | 419 | impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER); |
520 | impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER); | ||
521 | if (impl == 0) { | 420 | if (impl == 0) { |
522 | return 0; | 421 | return 0; |
523 | } | 422 | } |
524 | 423 | ||
525 | icalparameter_set_partstat((icalparameter*) impl,v); | 424 | icalparameter_set_delegatedto((icalparameter*) impl,v); |
526 | if (icalerrno != ICAL_NO_ERROR) { | 425 | if (icalerrno != ICAL_NO_ERROR) { |
527 | icalparameter_free((icalparameter*) impl); | 426 | icalparameter_free((icalparameter*) impl); |
528 | return 0; | 427 | return 0; |
@@ -531,40 +430,71 @@ icalparameter* icalparameter_new_partstat(icalparameter_partstat v) | |||
531 | return (icalparameter*) impl; | 430 | return (icalparameter*) impl; |
532 | } | 431 | } |
533 | 432 | ||
534 | icalparameter_partstat icalparameter_get_partstat(icalparameter* param) | 433 | const char* icalparameter_get_delegatedto(const icalparameter* param) |
535 | { | 434 | { |
536 | icalerror_clear_errno(); | 435 | icalerror_clear_errno(); |
537 | icalerror_check_arg( (param!=0), "param"); | 436 | icalerror_check_arg_rz( (param!=0), "param"); |
538 | if ( ((struct icalparameter_impl*)param)->string != 0){ | 437 | return param->string; |
539 | return ICAL_PARTSTAT_X; | 438 | } |
540 | } | ||
541 | 439 | ||
542 | return (icalparameter_partstat)((struct icalparameter_impl*)param)->data; | 440 | void icalparameter_set_delegatedto(icalparameter* param, const char* v) |
441 | { | ||
442 | icalerror_check_arg_rv( (v!=0),"v"); | ||
443 | icalerror_check_arg_rv( (param!=0), "param"); | ||
444 | icalerror_clear_errno(); | ||
445 | |||
446 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | ||
543 | } | 447 | } |
544 | 448 | ||
545 | void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v) | 449 | /* CN */ |
450 | icalparameter* icalparameter_new_cn(const char* v) | ||
546 | { | 451 | { |
547 | icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v"); | 452 | struct icalparameter_impl *impl; |
548 | icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v"); | 453 | icalerror_clear_errno(); |
454 | icalerror_check_arg_rz( (v!=0),"v"); | ||
455 | impl = icalparameter_new_impl(ICAL_CN_PARAMETER); | ||
456 | if (impl == 0) { | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | icalparameter_set_cn((icalparameter*) impl,v); | ||
461 | if (icalerrno != ICAL_NO_ERROR) { | ||
462 | icalparameter_free((icalparameter*) impl); | ||
463 | return 0; | ||
464 | } | ||
465 | |||
466 | return (icalparameter*) impl; | ||
467 | } | ||
468 | |||
469 | const char* icalparameter_get_cn(const icalparameter* param) | ||
470 | { | ||
471 | icalerror_clear_errno(); | ||
472 | icalerror_check_arg_rz( (param!=0), "param"); | ||
473 | return param->string; | ||
474 | } | ||
475 | |||
476 | void icalparameter_set_cn(icalparameter* param, const char* v) | ||
477 | { | ||
478 | icalerror_check_arg_rv( (v!=0),"v"); | ||
549 | icalerror_check_arg_rv( (param!=0), "param"); | 479 | icalerror_check_arg_rv( (param!=0), "param"); |
550 | icalerror_clear_errno(); | 480 | icalerror_clear_errno(); |
551 | 481 | ||
552 | ((struct icalparameter_impl*)param)->data = (int)v; | 482 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
553 | } | 483 | } |
554 | 484 | ||
555 | /* RELTYPE */ | 485 | /* VALUE */ |
556 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v) | 486 | icalparameter* icalparameter_new_value(icalparameter_value v) |
557 | { | 487 | { |
558 | struct icalparameter_impl *impl; | 488 | struct icalparameter_impl *impl; |
559 | icalerror_clear_errno(); | 489 | icalerror_clear_errno(); |
560 | icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v"); | 490 | icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v"); |
561 | icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v"); | 491 | icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v"); |
562 | impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER); | 492 | impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER); |
563 | if (impl == 0) { | 493 | if (impl == 0) { |
564 | return 0; | 494 | return 0; |
565 | } | 495 | } |
566 | 496 | ||
567 | icalparameter_set_reltype((icalparameter*) impl,v); | 497 | icalparameter_set_value((icalparameter*) impl,v); |
568 | if (icalerrno != ICAL_NO_ERROR) { | 498 | if (icalerrno != ICAL_NO_ERROR) { |
569 | icalparameter_free((icalparameter*) impl); | 499 | icalparameter_free((icalparameter*) impl); |
570 | return 0; | 500 | return 0; |
@@ -573,40 +503,40 @@ icalparameter* icalparameter_new_reltype(icalparameter_reltype v) | |||
573 | return (icalparameter*) impl; | 503 | return (icalparameter*) impl; |
574 | } | 504 | } |
575 | 505 | ||
576 | icalparameter_reltype icalparameter_get_reltype(icalparameter* param) | 506 | icalparameter_value icalparameter_get_value(const icalparameter* param) |
577 | { | 507 | { |
578 | icalerror_clear_errno(); | 508 | icalerror_clear_errno(); |
579 | icalerror_check_arg( (param!=0), "param"); | 509 | icalerror_check_arg( (param!=0), "param"); |
580 | if ( ((struct icalparameter_impl*)param)->string != 0){ | 510 | if (param->string != 0){ |
581 | return ICAL_RELTYPE_X; | 511 | return ICAL_VALUE_X; |
582 | } | 512 | } |
583 | 513 | ||
584 | return (icalparameter_reltype)((struct icalparameter_impl*)param)->data; | 514 | return (icalparameter_value)(param->data); |
585 | } | 515 | } |
586 | 516 | ||
587 | void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v) | 517 | void icalparameter_set_value(icalparameter* param, icalparameter_value v) |
588 | { | 518 | { |
589 | icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v"); | 519 | icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v"); |
590 | icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v"); | 520 | icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v"); |
591 | icalerror_check_arg_rv( (param!=0), "param"); | 521 | icalerror_check_arg_rv( (param!=0), "param"); |
592 | icalerror_clear_errno(); | 522 | icalerror_clear_errno(); |
593 | 523 | ||
594 | ((struct icalparameter_impl*)param)->data = (int)v; | 524 | ((struct icalparameter_impl*)param)->data = (int)v; |
595 | } | 525 | } |
596 | 526 | ||
597 | /* CUTYPE */ | 527 | /* X-LIC-COMPARETYPE */ |
598 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v) | 528 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v) |
599 | { | 529 | { |
600 | struct icalparameter_impl *impl; | 530 | struct icalparameter_impl *impl; |
601 | icalerror_clear_errno(); | 531 | icalerror_clear_errno(); |
602 | icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v"); | 532 | icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v"); |
603 | icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v"); | 533 | icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v"); |
604 | impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER); | 534 | impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER); |
605 | if (impl == 0) { | 535 | if (impl == 0) { |
606 | return 0; | 536 | return 0; |
607 | } | 537 | } |
608 | 538 | ||
609 | icalparameter_set_cutype((icalparameter*) impl,v); | 539 | icalparameter_set_xliccomparetype((icalparameter*) impl,v); |
610 | if (icalerrno != ICAL_NO_ERROR) { | 540 | if (icalerrno != ICAL_NO_ERROR) { |
611 | icalparameter_free((icalparameter*) impl); | 541 | icalparameter_free((icalparameter*) impl); |
612 | return 0; | 542 | return 0; |
@@ -615,39 +545,36 @@ icalparameter* icalparameter_new_cutype(icalparameter_cutype v) | |||
615 | return (icalparameter*) impl; | 545 | return (icalparameter*) impl; |
616 | } | 546 | } |
617 | 547 | ||
618 | icalparameter_cutype icalparameter_get_cutype(icalparameter* param) | 548 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* param) |
619 | { | 549 | { |
620 | icalerror_clear_errno(); | 550 | icalerror_clear_errno(); |
621 | icalerror_check_arg( (param!=0), "param"); | 551 | icalerror_check_arg( (param!=0), "param"); |
622 | if ( ((struct icalparameter_impl*)param)->string != 0){ | ||
623 | return ICAL_CUTYPE_X; | ||
624 | } | ||
625 | 552 | ||
626 | return (icalparameter_cutype)((struct icalparameter_impl*)param)->data; | 553 | return (icalparameter_xliccomparetype)(param->data); |
627 | } | 554 | } |
628 | 555 | ||
629 | void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v) | 556 | void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v) |
630 | { | 557 | { |
631 | icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v"); | 558 | icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v"); |
632 | icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v"); | 559 | icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v"); |
633 | icalerror_check_arg_rv( (param!=0), "param"); | 560 | icalerror_check_arg_rv( (param!=0), "param"); |
634 | icalerror_clear_errno(); | 561 | icalerror_clear_errno(); |
635 | 562 | ||
636 | ((struct icalparameter_impl*)param)->data = (int)v; | 563 | ((struct icalparameter_impl*)param)->data = (int)v; |
637 | } | 564 | } |
638 | 565 | ||
639 | /* MEMBER */ | 566 | /* X */ |
640 | icalparameter* icalparameter_new_member(const char* v) | 567 | icalparameter* icalparameter_new_x(const char* v) |
641 | { | 568 | { |
642 | struct icalparameter_impl *impl; | 569 | struct icalparameter_impl *impl; |
643 | icalerror_clear_errno(); | 570 | icalerror_clear_errno(); |
644 | icalerror_check_arg_rz( (v!=0),"v"); | 571 | icalerror_check_arg_rz( (v!=0),"v"); |
645 | impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER); | 572 | impl = icalparameter_new_impl(ICAL_X_PARAMETER); |
646 | if (impl == 0) { | 573 | if (impl == 0) { |
647 | return 0; | 574 | return 0; |
648 | } | 575 | } |
649 | 576 | ||
650 | icalparameter_set_member((icalparameter*) impl,v); | 577 | icalparameter_set_x((icalparameter*) impl,v); |
651 | if (icalerrno != ICAL_NO_ERROR) { | 578 | if (icalerrno != ICAL_NO_ERROR) { |
652 | icalparameter_free((icalparameter*) impl); | 579 | icalparameter_free((icalparameter*) impl); |
653 | return 0; | 580 | return 0; |
@@ -656,14 +583,14 @@ icalparameter* icalparameter_new_member(const char* v) | |||
656 | return (icalparameter*) impl; | 583 | return (icalparameter*) impl; |
657 | } | 584 | } |
658 | 585 | ||
659 | const char* icalparameter_get_member(icalparameter* param) | 586 | const char* icalparameter_get_x(const icalparameter* param) |
660 | { | 587 | { |
661 | icalerror_clear_errno(); | 588 | icalerror_clear_errno(); |
662 | icalerror_check_arg_rz( (param!=0), "param"); | 589 | icalerror_check_arg_rz( (param!=0), "param"); |
663 | return (const char*)((struct icalparameter_impl*)param)->string; | 590 | return param->string; |
664 | } | 591 | } |
665 | 592 | ||
666 | void icalparameter_set_member(icalparameter* param, const char* v) | 593 | void icalparameter_set_x(icalparameter* param, const char* v) |
667 | { | 594 | { |
668 | icalerror_check_arg_rv( (v!=0),"v"); | 595 | icalerror_check_arg_rv( (v!=0),"v"); |
669 | icalerror_check_arg_rv( (param!=0), "param"); | 596 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -672,18 +599,18 @@ void icalparameter_set_member(icalparameter* param, const char* v) | |||
672 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 599 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
673 | } | 600 | } |
674 | 601 | ||
675 | /* FMTTYPE */ | 602 | /* SENT-BY */ |
676 | icalparameter* icalparameter_new_fmttype(const char* v) | 603 | icalparameter* icalparameter_new_sentby(const char* v) |
677 | { | 604 | { |
678 | struct icalparameter_impl *impl; | 605 | struct icalparameter_impl *impl; |
679 | icalerror_clear_errno(); | 606 | icalerror_clear_errno(); |
680 | icalerror_check_arg_rz( (v!=0),"v"); | 607 | icalerror_check_arg_rz( (v!=0),"v"); |
681 | impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER); | 608 | impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER); |
682 | if (impl == 0) { | 609 | if (impl == 0) { |
683 | return 0; | 610 | return 0; |
684 | } | 611 | } |
685 | 612 | ||
686 | icalparameter_set_fmttype((icalparameter*) impl,v); | 613 | icalparameter_set_sentby((icalparameter*) impl,v); |
687 | if (icalerrno != ICAL_NO_ERROR) { | 614 | if (icalerrno != ICAL_NO_ERROR) { |
688 | icalparameter_free((icalparameter*) impl); | 615 | icalparameter_free((icalparameter*) impl); |
689 | return 0; | 616 | return 0; |
@@ -692,14 +619,14 @@ icalparameter* icalparameter_new_fmttype(const char* v) | |||
692 | return (icalparameter*) impl; | 619 | return (icalparameter*) impl; |
693 | } | 620 | } |
694 | 621 | ||
695 | const char* icalparameter_get_fmttype(icalparameter* param) | 622 | const char* icalparameter_get_sentby(const icalparameter* param) |
696 | { | 623 | { |
697 | icalerror_clear_errno(); | 624 | icalerror_clear_errno(); |
698 | icalerror_check_arg_rz( (param!=0), "param"); | 625 | icalerror_check_arg_rz( (param!=0), "param"); |
699 | return (const char*)((struct icalparameter_impl*)param)->string; | 626 | return param->string; |
700 | } | 627 | } |
701 | 628 | ||
702 | void icalparameter_set_fmttype(icalparameter* param, const char* v) | 629 | void icalparameter_set_sentby(icalparameter* param, const char* v) |
703 | { | 630 | { |
704 | icalerror_check_arg_rv( (v!=0),"v"); | 631 | icalerror_check_arg_rv( (v!=0),"v"); |
705 | icalerror_check_arg_rv( (param!=0), "param"); | 632 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -708,18 +635,18 @@ void icalparameter_set_fmttype(icalparameter* param, const char* v) | |||
708 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 635 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
709 | } | 636 | } |
710 | 637 | ||
711 | /* SENT-BY */ | 638 | /* MEMBER */ |
712 | icalparameter* icalparameter_new_sentby(const char* v) | 639 | icalparameter* icalparameter_new_member(const char* v) |
713 | { | 640 | { |
714 | struct icalparameter_impl *impl; | 641 | struct icalparameter_impl *impl; |
715 | icalerror_clear_errno(); | 642 | icalerror_clear_errno(); |
716 | icalerror_check_arg_rz( (v!=0),"v"); | 643 | icalerror_check_arg_rz( (v!=0),"v"); |
717 | impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER); | 644 | impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER); |
718 | if (impl == 0) { | 645 | if (impl == 0) { |
719 | return 0; | 646 | return 0; |
720 | } | 647 | } |
721 | 648 | ||
722 | icalparameter_set_sentby((icalparameter*) impl,v); | 649 | icalparameter_set_member((icalparameter*) impl,v); |
723 | if (icalerrno != ICAL_NO_ERROR) { | 650 | if (icalerrno != ICAL_NO_ERROR) { |
724 | icalparameter_free((icalparameter*) impl); | 651 | icalparameter_free((icalparameter*) impl); |
725 | return 0; | 652 | return 0; |
@@ -728,14 +655,14 @@ icalparameter* icalparameter_new_sentby(const char* v) | |||
728 | return (icalparameter*) impl; | 655 | return (icalparameter*) impl; |
729 | } | 656 | } |
730 | 657 | ||
731 | const char* icalparameter_get_sentby(icalparameter* param) | 658 | const char* icalparameter_get_member(const icalparameter* param) |
732 | { | 659 | { |
733 | icalerror_clear_errno(); | 660 | icalerror_clear_errno(); |
734 | icalerror_check_arg_rz( (param!=0), "param"); | 661 | icalerror_check_arg_rz( (param!=0), "param"); |
735 | return (const char*)((struct icalparameter_impl*)param)->string; | 662 | return param->string; |
736 | } | 663 | } |
737 | 664 | ||
738 | void icalparameter_set_sentby(icalparameter* param, const char* v) | 665 | void icalparameter_set_member(icalparameter* param, const char* v) |
739 | { | 666 | { |
740 | icalerror_check_arg_rv( (v!=0),"v"); | 667 | icalerror_check_arg_rv( (v!=0),"v"); |
741 | icalerror_check_arg_rv( (param!=0), "param"); | 668 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -744,19 +671,19 @@ void icalparameter_set_sentby(icalparameter* param, const char* v) | |||
744 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 671 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
745 | } | 672 | } |
746 | 673 | ||
747 | /* VALUE */ | 674 | /* RSVP */ |
748 | icalparameter* icalparameter_new_value(icalparameter_value v) | 675 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v) |
749 | { | 676 | { |
750 | struct icalparameter_impl *impl; | 677 | struct icalparameter_impl *impl; |
751 | icalerror_clear_errno(); | 678 | icalerror_clear_errno(); |
752 | icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v"); | 679 | icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v"); |
753 | icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v"); | 680 | icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v"); |
754 | impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER); | 681 | impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER); |
755 | if (impl == 0) { | 682 | if (impl == 0) { |
756 | return 0; | 683 | return 0; |
757 | } | 684 | } |
758 | 685 | ||
759 | icalparameter_set_value((icalparameter*) impl,v); | 686 | icalparameter_set_rsvp((icalparameter*) impl,v); |
760 | if (icalerrno != ICAL_NO_ERROR) { | 687 | if (icalerrno != ICAL_NO_ERROR) { |
761 | icalparameter_free((icalparameter*) impl); | 688 | icalparameter_free((icalparameter*) impl); |
762 | return 0; | 689 | return 0; |
@@ -765,39 +692,37 @@ icalparameter* icalparameter_new_value(icalparameter_value v) | |||
765 | return (icalparameter*) impl; | 692 | return (icalparameter*) impl; |
766 | } | 693 | } |
767 | 694 | ||
768 | icalparameter_value icalparameter_get_value(icalparameter* param) | 695 | icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* param) |
769 | { | 696 | { |
770 | icalerror_clear_errno(); | 697 | icalerror_clear_errno(); |
771 | icalerror_check_arg( (param!=0), "param"); | 698 | icalerror_check_arg( (param!=0), "param"); |
772 | if ( ((struct icalparameter_impl*)param)->string != 0){ | ||
773 | return ICAL_VALUE_X; | ||
774 | } | ||
775 | 699 | ||
776 | return (icalparameter_value)((struct icalparameter_impl*)param)->data; | 700 | return (icalparameter_rsvp)(param->data); |
777 | } | 701 | } |
778 | 702 | ||
779 | void icalparameter_set_value(icalparameter* param, icalparameter_value v) | 703 | void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v) |
780 | { | 704 | { |
781 | icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v"); | 705 | icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v"); |
782 | icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v"); | 706 | icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v"); |
783 | icalerror_check_arg_rv( (param!=0), "param"); | 707 | icalerror_check_arg_rv( (param!=0), "param"); |
784 | icalerror_clear_errno(); | 708 | icalerror_clear_errno(); |
785 | 709 | ||
786 | ((struct icalparameter_impl*)param)->data = (int)v; | 710 | ((struct icalparameter_impl*)param)->data = (int)v; |
787 | } | 711 | } |
788 | 712 | ||
789 | /* ALTREP */ | 713 | /* CUTYPE */ |
790 | icalparameter* icalparameter_new_altrep(const char* v) | 714 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v) |
791 | { | 715 | { |
792 | struct icalparameter_impl *impl; | 716 | struct icalparameter_impl *impl; |
793 | icalerror_clear_errno(); | 717 | icalerror_clear_errno(); |
794 | icalerror_check_arg_rz( (v!=0),"v"); | 718 | icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v"); |
795 | impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER); | 719 | icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v"); |
720 | impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER); | ||
796 | if (impl == 0) { | 721 | if (impl == 0) { |
797 | return 0; | 722 | return 0; |
798 | } | 723 | } |
799 | 724 | ||
800 | icalparameter_set_altrep((icalparameter*) impl,v); | 725 | icalparameter_set_cutype((icalparameter*) impl,v); |
801 | if (icalerrno != ICAL_NO_ERROR) { | 726 | if (icalerrno != ICAL_NO_ERROR) { |
802 | icalparameter_free((icalparameter*) impl); | 727 | icalparameter_free((icalparameter*) impl); |
803 | return 0; | 728 | return 0; |
@@ -806,34 +731,40 @@ icalparameter* icalparameter_new_altrep(const char* v) | |||
806 | return (icalparameter*) impl; | 731 | return (icalparameter*) impl; |
807 | } | 732 | } |
808 | 733 | ||
809 | const char* icalparameter_get_altrep(icalparameter* param) | 734 | icalparameter_cutype icalparameter_get_cutype(const icalparameter* param) |
810 | { | 735 | { |
811 | icalerror_clear_errno(); | 736 | icalerror_clear_errno(); |
812 | icalerror_check_arg_rz( (param!=0), "param"); | 737 | icalerror_check_arg( (param!=0), "param"); |
813 | return (const char*)((struct icalparameter_impl*)param)->string; | 738 | if (param->string != 0){ |
739 | return ICAL_CUTYPE_X; | ||
740 | } | ||
741 | |||
742 | return (icalparameter_cutype)(param->data); | ||
814 | } | 743 | } |
815 | 744 | ||
816 | void icalparameter_set_altrep(icalparameter* param, const char* v) | 745 | void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v) |
817 | { | 746 | { |
818 | icalerror_check_arg_rv( (v!=0),"v"); | 747 | icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v"); |
748 | icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v"); | ||
819 | icalerror_check_arg_rv( (param!=0), "param"); | 749 | icalerror_check_arg_rv( (param!=0), "param"); |
820 | icalerror_clear_errno(); | 750 | icalerror_clear_errno(); |
821 | 751 | ||
822 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 752 | ((struct icalparameter_impl*)param)->data = (int)v; |
823 | } | 753 | } |
824 | 754 | ||
825 | /* DIR */ | 755 | /* X-LIC-ERRORTYPE */ |
826 | icalparameter* icalparameter_new_dir(const char* v) | 756 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v) |
827 | { | 757 | { |
828 | struct icalparameter_impl *impl; | 758 | struct icalparameter_impl *impl; |
829 | icalerror_clear_errno(); | 759 | icalerror_clear_errno(); |
830 | icalerror_check_arg_rz( (v!=0),"v"); | 760 | icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v"); |
831 | impl = icalparameter_new_impl(ICAL_DIR_PARAMETER); | 761 | icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v"); |
762 | impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER); | ||
832 | if (impl == 0) { | 763 | if (impl == 0) { |
833 | return 0; | 764 | return 0; |
834 | } | 765 | } |
835 | 766 | ||
836 | icalparameter_set_dir((icalparameter*) impl,v); | 767 | icalparameter_set_xlicerrortype((icalparameter*) impl,v); |
837 | if (icalerrno != ICAL_NO_ERROR) { | 768 | if (icalerrno != ICAL_NO_ERROR) { |
838 | icalparameter_free((icalparameter*) impl); | 769 | icalparameter_free((icalparameter*) impl); |
839 | return 0; | 770 | return 0; |
@@ -842,20 +773,22 @@ icalparameter* icalparameter_new_dir(const char* v) | |||
842 | return (icalparameter*) impl; | 773 | return (icalparameter*) impl; |
843 | } | 774 | } |
844 | 775 | ||
845 | const char* icalparameter_get_dir(icalparameter* param) | 776 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* param) |
846 | { | 777 | { |
847 | icalerror_clear_errno(); | 778 | icalerror_clear_errno(); |
848 | icalerror_check_arg_rz( (param!=0), "param"); | 779 | icalerror_check_arg( (param!=0), "param"); |
849 | return (const char*)((struct icalparameter_impl*)param)->string; | 780 | |
781 | return (icalparameter_xlicerrortype)(param->data); | ||
850 | } | 782 | } |
851 | 783 | ||
852 | void icalparameter_set_dir(icalparameter* param, const char* v) | 784 | void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v) |
853 | { | 785 | { |
854 | icalerror_check_arg_rv( (v!=0),"v"); | 786 | icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v"); |
787 | icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v"); | ||
855 | icalerror_check_arg_rv( (param!=0), "param"); | 788 | icalerror_check_arg_rv( (param!=0), "param"); |
856 | icalerror_clear_errno(); | 789 | icalerror_clear_errno(); |
857 | 790 | ||
858 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 791 | ((struct icalparameter_impl*)param)->data = (int)v; |
859 | } | 792 | } |
860 | 793 | ||
861 | /* RELATED */ | 794 | /* RELATED */ |
@@ -879,12 +812,12 @@ icalparameter* icalparameter_new_related(icalparameter_related v) | |||
879 | return (icalparameter*) impl; | 812 | return (icalparameter*) impl; |
880 | } | 813 | } |
881 | 814 | ||
882 | icalparameter_related icalparameter_get_related(icalparameter* param) | 815 | icalparameter_related icalparameter_get_related(const icalparameter* param) |
883 | { | 816 | { |
884 | icalerror_clear_errno(); | 817 | icalerror_clear_errno(); |
885 | icalerror_check_arg( (param!=0), "param"); | 818 | icalerror_check_arg( (param!=0), "param"); |
886 | 819 | ||
887 | return (icalparameter_related)((struct icalparameter_impl*)param)->data; | 820 | return (icalparameter_related)(param->data); |
888 | } | 821 | } |
889 | 822 | ||
890 | void icalparameter_set_related(icalparameter* param, icalparameter_related v) | 823 | void icalparameter_set_related(icalparameter* param, icalparameter_related v) |
@@ -897,18 +830,19 @@ void icalparameter_set_related(icalparameter* param, icalparameter_related v) | |||
897 | ((struct icalparameter_impl*)param)->data = (int)v; | 830 | ((struct icalparameter_impl*)param)->data = (int)v; |
898 | } | 831 | } |
899 | 832 | ||
900 | /* CN */ | 833 | /* ENCODING */ |
901 | icalparameter* icalparameter_new_cn(const char* v) | 834 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v) |
902 | { | 835 | { |
903 | struct icalparameter_impl *impl; | 836 | struct icalparameter_impl *impl; |
904 | icalerror_clear_errno(); | 837 | icalerror_clear_errno(); |
905 | icalerror_check_arg_rz( (v!=0),"v"); | 838 | icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v"); |
906 | impl = icalparameter_new_impl(ICAL_CN_PARAMETER); | 839 | icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v"); |
840 | impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER); | ||
907 | if (impl == 0) { | 841 | if (impl == 0) { |
908 | return 0; | 842 | return 0; |
909 | } | 843 | } |
910 | 844 | ||
911 | icalparameter_set_cn((icalparameter*) impl,v); | 845 | icalparameter_set_encoding((icalparameter*) impl,v); |
912 | if (icalerrno != ICAL_NO_ERROR) { | 846 | if (icalerrno != ICAL_NO_ERROR) { |
913 | icalparameter_free((icalparameter*) impl); | 847 | icalparameter_free((icalparameter*) impl); |
914 | return 0; | 848 | return 0; |
@@ -917,35 +851,39 @@ icalparameter* icalparameter_new_cn(const char* v) | |||
917 | return (icalparameter*) impl; | 851 | return (icalparameter*) impl; |
918 | } | 852 | } |
919 | 853 | ||
920 | const char* icalparameter_get_cn(icalparameter* param) | 854 | icalparameter_encoding icalparameter_get_encoding(const icalparameter* param) |
921 | { | 855 | { |
922 | icalerror_clear_errno(); | 856 | icalerror_clear_errno(); |
923 | icalerror_check_arg_rz( (param!=0), "param"); | 857 | icalerror_check_arg( (param!=0), "param"); |
924 | return (const char*)((struct icalparameter_impl*)param)->string; | 858 | if (param->string != 0){ |
859 | return ICAL_ENCODING_X; | ||
860 | } | ||
861 | |||
862 | return (icalparameter_encoding)(param->data); | ||
925 | } | 863 | } |
926 | 864 | ||
927 | void icalparameter_set_cn(icalparameter* param, const char* v) | 865 | void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v) |
928 | { | 866 | { |
929 | icalerror_check_arg_rv( (v!=0),"v"); | 867 | icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v"); |
868 | icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v"); | ||
930 | icalerror_check_arg_rv( (param!=0), "param"); | 869 | icalerror_check_arg_rv( (param!=0), "param"); |
931 | icalerror_clear_errno(); | 870 | icalerror_clear_errno(); |
932 | 871 | ||
933 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 872 | ((struct icalparameter_impl*)param)->data = (int)v; |
934 | } | 873 | } |
935 | 874 | ||
936 | /* X-LIC-ERRORTYPE */ | 875 | /* ALTREP */ |
937 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v) | 876 | icalparameter* icalparameter_new_altrep(const char* v) |
938 | { | 877 | { |
939 | struct icalparameter_impl *impl; | 878 | struct icalparameter_impl *impl; |
940 | icalerror_clear_errno(); | 879 | icalerror_clear_errno(); |
941 | icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v"); | 880 | icalerror_check_arg_rz( (v!=0),"v"); |
942 | icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v"); | 881 | impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER); |
943 | impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER); | ||
944 | if (impl == 0) { | 882 | if (impl == 0) { |
945 | return 0; | 883 | return 0; |
946 | } | 884 | } |
947 | 885 | ||
948 | icalparameter_set_xlicerrortype((icalparameter*) impl,v); | 886 | icalparameter_set_altrep((icalparameter*) impl,v); |
949 | if (icalerrno != ICAL_NO_ERROR) { | 887 | if (icalerrno != ICAL_NO_ERROR) { |
950 | icalparameter_free((icalparameter*) impl); | 888 | icalparameter_free((icalparameter*) impl); |
951 | return 0; | 889 | return 0; |
@@ -954,36 +892,34 @@ icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v) | |||
954 | return (icalparameter*) impl; | 892 | return (icalparameter*) impl; |
955 | } | 893 | } |
956 | 894 | ||
957 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* param) | 895 | const char* icalparameter_get_altrep(const icalparameter* param) |
958 | { | 896 | { |
959 | icalerror_clear_errno(); | 897 | icalerror_clear_errno(); |
960 | icalerror_check_arg( (param!=0), "param"); | 898 | icalerror_check_arg_rz( (param!=0), "param"); |
961 | 899 | return param->string; | |
962 | return (icalparameter_xlicerrortype)((struct icalparameter_impl*)param)->data; | ||
963 | } | 900 | } |
964 | 901 | ||
965 | void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v) | 902 | void icalparameter_set_altrep(icalparameter* param, const char* v) |
966 | { | 903 | { |
967 | icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v"); | 904 | icalerror_check_arg_rv( (v!=0),"v"); |
968 | icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v"); | ||
969 | icalerror_check_arg_rv( (param!=0), "param"); | 905 | icalerror_check_arg_rv( (param!=0), "param"); |
970 | icalerror_clear_errno(); | 906 | icalerror_clear_errno(); |
971 | 907 | ||
972 | ((struct icalparameter_impl*)param)->data = (int)v; | 908 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
973 | } | 909 | } |
974 | 910 | ||
975 | /* X */ | 911 | /* DELEGATED-FROM */ |
976 | icalparameter* icalparameter_new_x(const char* v) | 912 | icalparameter* icalparameter_new_delegatedfrom(const char* v) |
977 | { | 913 | { |
978 | struct icalparameter_impl *impl; | 914 | struct icalparameter_impl *impl; |
979 | icalerror_clear_errno(); | 915 | icalerror_clear_errno(); |
980 | icalerror_check_arg_rz( (v!=0),"v"); | 916 | icalerror_check_arg_rz( (v!=0),"v"); |
981 | impl = icalparameter_new_impl(ICAL_X_PARAMETER); | 917 | impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER); |
982 | if (impl == 0) { | 918 | if (impl == 0) { |
983 | return 0; | 919 | return 0; |
984 | } | 920 | } |
985 | 921 | ||
986 | icalparameter_set_x((icalparameter*) impl,v); | 922 | icalparameter_set_delegatedfrom((icalparameter*) impl,v); |
987 | if (icalerrno != ICAL_NO_ERROR) { | 923 | if (icalerrno != ICAL_NO_ERROR) { |
988 | icalparameter_free((icalparameter*) impl); | 924 | icalparameter_free((icalparameter*) impl); |
989 | return 0; | 925 | return 0; |
@@ -992,14 +928,14 @@ icalparameter* icalparameter_new_x(const char* v) | |||
992 | return (icalparameter*) impl; | 928 | return (icalparameter*) impl; |
993 | } | 929 | } |
994 | 930 | ||
995 | const char* icalparameter_get_x(icalparameter* param) | 931 | const char* icalparameter_get_delegatedfrom(const icalparameter* param) |
996 | { | 932 | { |
997 | icalerror_clear_errno(); | 933 | icalerror_clear_errno(); |
998 | icalerror_check_arg_rz( (param!=0), "param"); | 934 | icalerror_check_arg_rz( (param!=0), "param"); |
999 | return (const char*)((struct icalparameter_impl*)param)->string; | 935 | return param->string; |
1000 | } | 936 | } |
1001 | 937 | ||
1002 | void icalparameter_set_x(icalparameter* param, const char* v) | 938 | void icalparameter_set_delegatedfrom(icalparameter* param, const char* v) |
1003 | { | 939 | { |
1004 | icalerror_check_arg_rv( (v!=0),"v"); | 940 | icalerror_check_arg_rv( (v!=0),"v"); |
1005 | icalerror_check_arg_rv( (param!=0), "param"); | 941 | icalerror_check_arg_rv( (param!=0), "param"); |
@@ -1008,18 +944,19 @@ void icalparameter_set_x(icalparameter* param, const char* v) | |||
1008 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 944 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); |
1009 | } | 945 | } |
1010 | 946 | ||
1011 | /* LANGUAGE */ | 947 | /* FBTYPE */ |
1012 | icalparameter* icalparameter_new_language(const char* v) | 948 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v) |
1013 | { | 949 | { |
1014 | struct icalparameter_impl *impl; | 950 | struct icalparameter_impl *impl; |
1015 | icalerror_clear_errno(); | 951 | icalerror_clear_errno(); |
1016 | icalerror_check_arg_rz( (v!=0),"v"); | 952 | icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v"); |
1017 | impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER); | 953 | icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v"); |
954 | impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER); | ||
1018 | if (impl == 0) { | 955 | if (impl == 0) { |
1019 | return 0; | 956 | return 0; |
1020 | } | 957 | } |
1021 | 958 | ||
1022 | icalparameter_set_language((icalparameter*) impl,v); | 959 | icalparameter_set_fbtype((icalparameter*) impl,v); |
1023 | if (icalerrno != ICAL_NO_ERROR) { | 960 | if (icalerrno != ICAL_NO_ERROR) { |
1024 | icalparameter_free((icalparameter*) impl); | 961 | icalparameter_free((icalparameter*) impl); |
1025 | return 0; | 962 | return 0; |
@@ -1028,20 +965,25 @@ icalparameter* icalparameter_new_language(const char* v) | |||
1028 | return (icalparameter*) impl; | 965 | return (icalparameter*) impl; |
1029 | } | 966 | } |
1030 | 967 | ||
1031 | const char* icalparameter_get_language(icalparameter* param) | 968 | icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* param) |
1032 | { | 969 | { |
1033 | icalerror_clear_errno(); | 970 | icalerror_clear_errno(); |
1034 | icalerror_check_arg_rz( (param!=0), "param"); | 971 | icalerror_check_arg( (param!=0), "param"); |
1035 | return (const char*)((struct icalparameter_impl*)param)->string; | 972 | if (param->string != 0){ |
973 | return ICAL_FBTYPE_X; | ||
974 | } | ||
975 | |||
976 | return (icalparameter_fbtype)(param->data); | ||
1036 | } | 977 | } |
1037 | 978 | ||
1038 | void icalparameter_set_language(icalparameter* param, const char* v) | 979 | void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v) |
1039 | { | 980 | { |
1040 | icalerror_check_arg_rv( (v!=0),"v"); | 981 | icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v"); |
982 | icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v"); | ||
1041 | icalerror_check_arg_rv( (param!=0), "param"); | 983 | icalerror_check_arg_rv( (param!=0), "param"); |
1042 | icalerror_clear_errno(); | 984 | icalerror_clear_errno(); |
1043 | 985 | ||
1044 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 986 | ((struct icalparameter_impl*)param)->data = (int)v; |
1045 | } | 987 | } |
1046 | 988 | ||
1047 | /* ROLE */ | 989 | /* ROLE */ |
@@ -1065,15 +1007,15 @@ icalparameter* icalparameter_new_role(icalparameter_role v) | |||
1065 | return (icalparameter*) impl; | 1007 | return (icalparameter*) impl; |
1066 | } | 1008 | } |
1067 | 1009 | ||
1068 | icalparameter_role icalparameter_get_role(icalparameter* param) | 1010 | icalparameter_role icalparameter_get_role(const icalparameter* param) |
1069 | { | 1011 | { |
1070 | icalerror_clear_errno(); | 1012 | icalerror_clear_errno(); |
1071 | icalerror_check_arg( (param!=0), "param"); | 1013 | icalerror_check_arg( (param!=0), "param"); |
1072 | if ( ((struct icalparameter_impl*)param)->string != 0){ | 1014 | if (param->string != 0){ |
1073 | return ICAL_ROLE_X; | 1015 | return ICAL_ROLE_X; |
1074 | } | 1016 | } |
1075 | 1017 | ||
1076 | return (icalparameter_role)((struct icalparameter_impl*)param)->data; | 1018 | return (icalparameter_role)(param->data); |
1077 | } | 1019 | } |
1078 | 1020 | ||
1079 | void icalparameter_set_role(icalparameter* param, icalparameter_role v) | 1021 | void icalparameter_set_role(icalparameter* param, icalparameter_role v) |
@@ -1086,19 +1028,19 @@ void icalparameter_set_role(icalparameter* param, icalparameter_role v) | |||
1086 | ((struct icalparameter_impl*)param)->data = (int)v; | 1028 | ((struct icalparameter_impl*)param)->data = (int)v; |
1087 | } | 1029 | } |
1088 | 1030 | ||
1089 | /* X-LIC-COMPARETYPE */ | 1031 | /* PARTSTAT */ |
1090 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v) | 1032 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v) |
1091 | { | 1033 | { |
1092 | struct icalparameter_impl *impl; | 1034 | struct icalparameter_impl *impl; |
1093 | icalerror_clear_errno(); | 1035 | icalerror_clear_errno(); |
1094 | icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v"); | 1036 | icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v"); |
1095 | icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v"); | 1037 | icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v"); |
1096 | impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER); | 1038 | impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER); |
1097 | if (impl == 0) { | 1039 | if (impl == 0) { |
1098 | return 0; | 1040 | return 0; |
1099 | } | 1041 | } |
1100 | 1042 | ||
1101 | icalparameter_set_xliccomparetype((icalparameter*) impl,v); | 1043 | icalparameter_set_partstat((icalparameter*) impl,v); |
1102 | if (icalerrno != ICAL_NO_ERROR) { | 1044 | if (icalerrno != ICAL_NO_ERROR) { |
1103 | icalparameter_free((icalparameter*) impl); | 1045 | icalparameter_free((icalparameter*) impl); |
1104 | return 0; | 1046 | return 0; |
@@ -1107,99 +1049,154 @@ icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v | |||
1107 | return (icalparameter*) impl; | 1049 | return (icalparameter*) impl; |
1108 | } | 1050 | } |
1109 | 1051 | ||
1110 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* param) | 1052 | icalparameter_partstat icalparameter_get_partstat(const icalparameter* param) |
1111 | { | 1053 | { |
1112 | icalerror_clear_errno(); | 1054 | icalerror_clear_errno(); |
1113 | icalerror_check_arg( (param!=0), "param"); | 1055 | icalerror_check_arg( (param!=0), "param"); |
1056 | if (param->string != 0){ | ||
1057 | return ICAL_PARTSTAT_X; | ||
1058 | } | ||
1114 | 1059 | ||
1115 | return (icalparameter_xliccomparetype)((struct icalparameter_impl*)param)->data; | 1060 | return (icalparameter_partstat)(param->data); |
1116 | } | 1061 | } |
1117 | 1062 | ||
1118 | void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v) | 1063 | void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v) |
1119 | { | 1064 | { |
1120 | icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v"); | 1065 | icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v"); |
1121 | icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v"); | 1066 | icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v"); |
1122 | icalerror_check_arg_rv( (param!=0), "param"); | 1067 | icalerror_check_arg_rv( (param!=0), "param"); |
1123 | icalerror_clear_errno(); | 1068 | icalerror_clear_errno(); |
1124 | 1069 | ||
1125 | ((struct icalparameter_impl*)param)->data = (int)v; | 1070 | ((struct icalparameter_impl*)param)->data = (int)v; |
1126 | } | 1071 | } |
1127 | 1072 | ||
1128 | /* FBTYPE */ | 1073 | |
1129 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v) | 1074 | const char* icalparameter_kind_to_string(icalparameter_kind kind) |
1130 | { | 1075 | { |
1131 | struct icalparameter_impl *impl; | 1076 | int i; |
1132 | icalerror_clear_errno(); | ||
1133 | icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v"); | ||
1134 | icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v"); | ||
1135 | impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER); | ||
1136 | if (impl == 0) { | ||
1137 | return 0; | ||
1138 | } | ||
1139 | 1077 | ||
1140 | icalparameter_set_fbtype((icalparameter*) impl,v); | 1078 | for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { |
1141 | if (icalerrno != ICAL_NO_ERROR) { | 1079 | if (parameter_map[i].kind == kind) { |
1142 | icalparameter_free((icalparameter*) impl); | 1080 | return parameter_map[i].name; |
1143 | return 0; | 1081 | } |
1144 | } | 1082 | } |
1083 | |||
1084 | return 0; | ||
1145 | 1085 | ||
1146 | return (icalparameter*) impl; | ||
1147 | } | 1086 | } |
1148 | 1087 | ||
1149 | icalparameter_fbtype icalparameter_get_fbtype(icalparameter* param) | 1088 | icalparameter_kind icalparameter_string_to_kind(const char* string) |
1150 | { | 1089 | { |
1151 | icalerror_clear_errno(); | 1090 | int i; |
1152 | icalerror_check_arg( (param!=0), "param"); | 1091 | |
1153 | if ( ((struct icalparameter_impl*)param)->string != 0){ | 1092 | if (string ==0 ) { |
1154 | return ICAL_FBTYPE_X; | 1093 | return ICAL_NO_PARAMETER; |
1155 | } | 1094 | } |
1095 | |||
1096 | for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { | ||
1097 | |||
1098 | if (strcmp(parameter_map[i].name, string) == 0) { | ||
1099 | return parameter_map[i].kind; | ||
1100 | } | ||
1101 | } | ||
1156 | 1102 | ||
1157 | return (icalparameter_fbtype)((struct icalparameter_impl*)param)->data; | 1103 | if(strncmp(string,"X-",2)==0){ |
1104 | return ICAL_X_PARAMETER; | ||
1105 | } | ||
1106 | |||
1107 | return ICAL_NO_PARAMETER; | ||
1158 | } | 1108 | } |
1159 | 1109 | ||
1160 | void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v) | 1110 | |
1111 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value) | ||
1161 | { | 1112 | { |
1162 | icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v"); | 1113 | int i; |
1163 | icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v"); | 1114 | |
1164 | icalerror_check_arg_rv( (param!=0), "param"); | 1115 | for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) { |
1165 | icalerror_clear_errno(); | 1116 | |
1166 | 1117 | if (value_kind_map[i].value == value) { | |
1167 | ((struct icalparameter_impl*)param)->data = (int)v; | 1118 | return value_kind_map[i].kind; |
1119 | } | ||
1120 | } | ||
1121 | |||
1122 | return ICAL_NO_VALUE; | ||
1168 | } | 1123 | } |
1169 | 1124 | ||
1170 | /* TZID */ | 1125 | |
1171 | icalparameter* icalparameter_new_tzid(const char* v) | 1126 | const char* icalparameter_enum_to_string(int e) |
1172 | { | 1127 | { |
1173 | struct icalparameter_impl *impl; | 1128 | int i; |
1174 | icalerror_clear_errno(); | ||
1175 | icalerror_check_arg_rz( (v!=0),"v"); | ||
1176 | impl = icalparameter_new_impl(ICAL_TZID_PARAMETER); | ||
1177 | if (impl == 0) { | ||
1178 | return 0; | ||
1179 | } | ||
1180 | 1129 | ||
1181 | icalparameter_set_tzid((icalparameter*) impl,v); | 1130 | icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e"); |
1182 | if (icalerrno != ICAL_NO_ERROR) { | 1131 | icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e"); |
1183 | icalparameter_free((icalparameter*) impl); | ||
1184 | return 0; | ||
1185 | } | ||
1186 | 1132 | ||
1187 | return (icalparameter*) impl; | 1133 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ |
1134 | if(e == icalparameter_map[i].enumeration){ | ||
1135 | return icalparameter_map[i].str; | ||
1136 | } | ||
1137 | } | ||
1138 | |||
1139 | return 0; | ||
1188 | } | 1140 | } |
1189 | 1141 | ||
1190 | const char* icalparameter_get_tzid(icalparameter* param) | 1142 | int icalparameter_string_to_enum(const char* str) |
1191 | { | 1143 | { |
1192 | icalerror_clear_errno(); | 1144 | int i; |
1193 | icalerror_check_arg_rz( (param!=0), "param"); | 1145 | |
1194 | return (const char*)((struct icalparameter_impl*)param)->string; | 1146 | icalerror_check_arg_rz(str != 0,"str"); |
1147 | |||
1148 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ | ||
1149 | if(strcmp(str,icalparameter_map[i].str) == 0) { | ||
1150 | return icalparameter_map[i].enumeration; | ||
1151 | } | ||
1152 | } | ||
1153 | |||
1154 | return 0; | ||
1195 | } | 1155 | } |
1196 | 1156 | ||
1197 | void icalparameter_set_tzid(icalparameter* param, const char* v) | 1157 | icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val) |
1198 | { | 1158 | { |
1199 | icalerror_check_arg_rv( (v!=0),"v"); | 1159 | |
1200 | icalerror_check_arg_rv( (param!=0), "param"); | 1160 | struct icalparameter_impl* param=0; |
1201 | icalerror_clear_errno(); | 1161 | int found_kind = 0; |
1202 | 1162 | int i; | |
1203 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); | 1163 | |
1164 | icalerror_check_arg_rz((val!=0),"val"); | ||
1165 | |||
1166 | /* Search through the parameter map to find a matching kind */ | ||
1167 | |||
1168 | param = icalparameter_new_impl(kind); | ||
1169 | |||
1170 | for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){ | ||
1171 | if(kind == icalparameter_map[i].kind) { | ||
1172 | found_kind = 1; | ||
1173 | if(strcmp(val,icalparameter_map[i].str) == 0) { | ||
1174 | |||
1175 | param->data = (int)icalparameter_map[i].enumeration; | ||
1176 | return param; | ||
1177 | } | ||
1178 | } | ||
1179 | } | ||
1180 | |||
1181 | if(found_kind == 1){ | ||
1182 | /* The kind was in the parameter map, but the string did not | ||
1183 | match, so assume that it is an alternate value, like an | ||
1184 | X-value.*/ | ||
1185 | |||
1186 | icalparameter_set_xvalue(param, val); | ||
1187 | |||
1188 | } else { | ||
1189 | |||
1190 | /* If the kind was not found, then it must be a string type */ | ||
1191 | |||
1192 | ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val); | ||
1193 | |||
1194 | } | ||
1195 | |||
1196 | return param; | ||
1204 | } | 1197 | } |
1205 | 1198 | ||
1199 | |||
1200 | |||
1201 | |||
1202 | /* 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 | |||
@@ -30,12 +30,11 @@ | |||
30 | #define ICALDERIVEDPARAMETER_H | 30 | #define ICALDERIVEDPARAMETER_H |
31 | 31 | ||
32 | 32 | ||
33 | typedef void icalparameter; | 33 | typedef struct icalparameter_impl icalparameter; |
34 | 34 | ||
35 | const char* icalparameter_enum_to_string(int e); | 35 | const char* icalparameter_enum_to_string(int e); |
36 | int icalparameter_string_to_enum(const char* str); | 36 | int icalparameter_string_to_enum(const char* str); |
37 | 37 | ||
38 | /* Everything below this line is machine generated. Do not edit. */ | ||
39 | typedef enum icalparameter_kind { | 38 | typedef enum icalparameter_kind { |
40 | ICAL_ANY_PARAMETER = 0, | 39 | ICAL_ANY_PARAMETER = 0, |
41 | ICAL_ALTREP_PARAMETER, | 40 | ICAL_ALTREP_PARAMETER, |
@@ -114,7 +113,7 @@ typedef enum icalparameter_range { | |||
114 | typedef enum icalparameter_related { | 113 | typedef enum icalparameter_related { |
115 | ICAL_RELATED_X = 20030, | 114 | ICAL_RELATED_X = 20030, |
116 | ICAL_RELATED_START = 20031, | 115 | ICAL_RELATED_START = 20031, |
117 | ICAL_RELATED_END = 20032, | 116 | ICAL_RELATED_END = 20032, |
118 | ICAL_RELATED_NONE = 20033 | 117 | ICAL_RELATED_NONE = 20033 |
119 | } icalparameter_related; | 118 | } icalparameter_related; |
120 | 119 | ||
@@ -170,138 +169,142 @@ typedef enum icalparameter_xliccomparetype { | |||
170 | ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070, | 169 | ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070, |
171 | ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071, | 170 | ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071, |
172 | ICAL_XLICCOMPARETYPE_REGEX = 20072, | 171 | ICAL_XLICCOMPARETYPE_REGEX = 20072, |
173 | ICAL_XLICCOMPARETYPE_NONE = 20073 | 172 | ICAL_XLICCOMPARETYPE_ISNULL = 20073, |
173 | ICAL_XLICCOMPARETYPE_ISNOTNULL = 20074, | ||
174 | ICAL_XLICCOMPARETYPE_NONE = 20075 | ||
174 | } icalparameter_xliccomparetype; | 175 | } icalparameter_xliccomparetype; |
175 | 176 | ||
176 | typedef enum icalparameter_xlicerrortype { | 177 | typedef enum icalparameter_xlicerrortype { |
177 | ICAL_XLICERRORTYPE_X = 20074, | 178 | ICAL_XLICERRORTYPE_X = 20076, |
178 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075, | 179 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20077, |
179 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076, | 180 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20078, |
180 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077, | 181 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20079, |
181 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078, | 182 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20080, |
182 | ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079, | 183 | ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20081, |
183 | ICAL_XLICERRORTYPE_INVALIDITIP = 20080, | 184 | ICAL_XLICERRORTYPE_INVALIDITIP = 20082, |
184 | ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081, | 185 | ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20083, |
185 | ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082, | 186 | ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20084, |
186 | ICAL_XLICERRORTYPE_NONE = 20083 | 187 | ICAL_XLICERRORTYPE_VCALPROPPARSEERROR = 20085, |
188 | ICAL_XLICERRORTYPE_NONE = 20086 | ||
187 | } icalparameter_xlicerrortype; | 189 | } icalparameter_xlicerrortype; |
188 | 190 | ||
189 | #define ICALPARAMETER_LAST_ENUM 20084 | 191 | #define ICALPARAMETER_LAST_ENUM 20087 |
190 | |||
191 | /* DELEGATED-FROM */ | ||
192 | icalparameter* icalparameter_new_delegatedfrom(const char* v); | ||
193 | const char* icalparameter_get_delegatedfrom(icalparameter* value); | ||
194 | void icalparameter_set_delegatedfrom(icalparameter* value, const char* v); | ||
195 | |||
196 | /* DELEGATED-TO */ | ||
197 | icalparameter* icalparameter_new_delegatedto(const char* v); | ||
198 | const char* icalparameter_get_delegatedto(icalparameter* value); | ||
199 | void icalparameter_set_delegatedto(icalparameter* value, const char* v); | ||
200 | |||
201 | /* RANGE */ | ||
202 | icalparameter* icalparameter_new_range(icalparameter_range v); | ||
203 | icalparameter_range icalparameter_get_range(icalparameter* value); | ||
204 | void icalparameter_set_range(icalparameter* value, icalparameter_range v); | ||
205 | 192 | ||
206 | /* ENCODING */ | 193 | /* LANGUAGE */ |
207 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v); | 194 | icalparameter* icalparameter_new_language(const char* v); |
208 | icalparameter_encoding icalparameter_get_encoding(icalparameter* value); | 195 | const char* icalparameter_get_language(const icalparameter* value); |
209 | void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v); | 196 | void icalparameter_set_language(icalparameter* value, const char* v); |
210 | |||
211 | /* RSVP */ | ||
212 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v); | ||
213 | icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value); | ||
214 | void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v); | ||
215 | 197 | ||
216 | /* PARTSTAT */ | 198 | /* DIR */ |
217 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v); | 199 | icalparameter* icalparameter_new_dir(const char* v); |
218 | icalparameter_partstat icalparameter_get_partstat(icalparameter* value); | 200 | const char* icalparameter_get_dir(const icalparameter* value); |
219 | void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v); | 201 | void icalparameter_set_dir(icalparameter* value, const char* v); |
220 | 202 | ||
221 | /* RELTYPE */ | 203 | /* RELTYPE */ |
222 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v); | 204 | icalparameter* icalparameter_new_reltype(icalparameter_reltype v); |
223 | icalparameter_reltype icalparameter_get_reltype(icalparameter* value); | 205 | icalparameter_reltype icalparameter_get_reltype(const icalparameter* value); |
224 | void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v); | 206 | void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v); |
225 | 207 | ||
226 | /* CUTYPE */ | ||
227 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v); | ||
228 | icalparameter_cutype icalparameter_get_cutype(icalparameter* value); | ||
229 | void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v); | ||
230 | |||
231 | /* MEMBER */ | ||
232 | icalparameter* icalparameter_new_member(const char* v); | ||
233 | const char* icalparameter_get_member(icalparameter* value); | ||
234 | void icalparameter_set_member(icalparameter* value, const char* v); | ||
235 | |||
236 | /* FMTTYPE */ | 208 | /* FMTTYPE */ |
237 | icalparameter* icalparameter_new_fmttype(const char* v); | 209 | icalparameter* icalparameter_new_fmttype(const char* v); |
238 | const char* icalparameter_get_fmttype(icalparameter* value); | 210 | const char* icalparameter_get_fmttype(const icalparameter* value); |
239 | void icalparameter_set_fmttype(icalparameter* value, const char* v); | 211 | void icalparameter_set_fmttype(icalparameter* value, const char* v); |
240 | 212 | ||
241 | /* SENT-BY */ | 213 | /* TZID */ |
242 | icalparameter* icalparameter_new_sentby(const char* v); | 214 | icalparameter* icalparameter_new_tzid(const char* v); |
243 | const char* icalparameter_get_sentby(icalparameter* value); | 215 | const char* icalparameter_get_tzid(const icalparameter* value); |
244 | void icalparameter_set_sentby(icalparameter* value, const char* v); | 216 | void icalparameter_set_tzid(icalparameter* value, const char* v); |
217 | |||
218 | /* RANGE */ | ||
219 | icalparameter* icalparameter_new_range(icalparameter_range v); | ||
220 | icalparameter_range icalparameter_get_range(const icalparameter* value); | ||
221 | void icalparameter_set_range(icalparameter* value, icalparameter_range v); | ||
222 | |||
223 | /* DELEGATED-TO */ | ||
224 | icalparameter* icalparameter_new_delegatedto(const char* v); | ||
225 | const char* icalparameter_get_delegatedto(const icalparameter* value); | ||
226 | void icalparameter_set_delegatedto(icalparameter* value, const char* v); | ||
227 | |||
228 | /* CN */ | ||
229 | icalparameter* icalparameter_new_cn(const char* v); | ||
230 | const char* icalparameter_get_cn(const icalparameter* value); | ||
231 | void icalparameter_set_cn(icalparameter* value, const char* v); | ||
245 | 232 | ||
246 | /* VALUE */ | 233 | /* VALUE */ |
247 | icalparameter* icalparameter_new_value(icalparameter_value v); | 234 | icalparameter* icalparameter_new_value(icalparameter_value v); |
248 | icalparameter_value icalparameter_get_value(icalparameter* value); | 235 | icalparameter_value icalparameter_get_value(const icalparameter* value); |
249 | void icalparameter_set_value(icalparameter* value, icalparameter_value v); | 236 | void icalparameter_set_value(icalparameter* value, icalparameter_value v); |
250 | 237 | ||
251 | /* ALTREP */ | 238 | /* X-LIC-COMPARETYPE */ |
252 | icalparameter* icalparameter_new_altrep(const char* v); | 239 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v); |
253 | const char* icalparameter_get_altrep(icalparameter* value); | 240 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* value); |
254 | void icalparameter_set_altrep(icalparameter* value, const char* v); | 241 | void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v); |
255 | 242 | ||
256 | /* DIR */ | 243 | /* X */ |
257 | icalparameter* icalparameter_new_dir(const char* v); | 244 | icalparameter* icalparameter_new_x(const char* v); |
258 | const char* icalparameter_get_dir(icalparameter* value); | 245 | const char* icalparameter_get_x(const icalparameter* value); |
259 | void icalparameter_set_dir(icalparameter* value, const char* v); | 246 | void icalparameter_set_x(icalparameter* value, const char* v); |
260 | 247 | ||
261 | /* RELATED */ | 248 | /* SENT-BY */ |
262 | icalparameter* icalparameter_new_related(icalparameter_related v); | 249 | icalparameter* icalparameter_new_sentby(const char* v); |
263 | icalparameter_related icalparameter_get_related(icalparameter* value); | 250 | const char* icalparameter_get_sentby(const icalparameter* value); |
264 | void icalparameter_set_related(icalparameter* value, icalparameter_related v); | 251 | void icalparameter_set_sentby(icalparameter* value, const char* v); |
265 | 252 | ||
266 | /* CN */ | 253 | /* MEMBER */ |
267 | icalparameter* icalparameter_new_cn(const char* v); | 254 | icalparameter* icalparameter_new_member(const char* v); |
268 | const char* icalparameter_get_cn(icalparameter* value); | 255 | const char* icalparameter_get_member(const icalparameter* value); |
269 | void icalparameter_set_cn(icalparameter* value, const char* v); | 256 | void icalparameter_set_member(icalparameter* value, const char* v); |
257 | |||
258 | /* RSVP */ | ||
259 | icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v); | ||
260 | icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* value); | ||
261 | void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v); | ||
262 | |||
263 | /* CUTYPE */ | ||
264 | icalparameter* icalparameter_new_cutype(icalparameter_cutype v); | ||
265 | icalparameter_cutype icalparameter_get_cutype(const icalparameter* value); | ||
266 | void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v); | ||
270 | 267 | ||
271 | /* X-LIC-ERRORTYPE */ | 268 | /* X-LIC-ERRORTYPE */ |
272 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v); | 269 | icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v); |
273 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value); | 270 | icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* value); |
274 | void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v); | 271 | void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v); |
275 | 272 | ||
276 | /* X */ | 273 | /* RELATED */ |
277 | icalparameter* icalparameter_new_x(const char* v); | 274 | icalparameter* icalparameter_new_related(icalparameter_related v); |
278 | const char* icalparameter_get_x(icalparameter* value); | 275 | icalparameter_related icalparameter_get_related(const icalparameter* value); |
279 | void icalparameter_set_x(icalparameter* value, const char* v); | 276 | void icalparameter_set_related(icalparameter* value, icalparameter_related v); |
280 | 277 | ||
281 | /* LANGUAGE */ | 278 | /* ENCODING */ |
282 | icalparameter* icalparameter_new_language(const char* v); | 279 | icalparameter* icalparameter_new_encoding(icalparameter_encoding v); |
283 | const char* icalparameter_get_language(icalparameter* value); | 280 | icalparameter_encoding icalparameter_get_encoding(const icalparameter* value); |
284 | void icalparameter_set_language(icalparameter* value, const char* v); | 281 | void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v); |
285 | 282 | ||
286 | /* ROLE */ | 283 | /* ALTREP */ |
287 | icalparameter* icalparameter_new_role(icalparameter_role v); | 284 | icalparameter* icalparameter_new_altrep(const char* v); |
288 | icalparameter_role icalparameter_get_role(icalparameter* value); | 285 | const char* icalparameter_get_altrep(const icalparameter* value); |
289 | void icalparameter_set_role(icalparameter* value, icalparameter_role v); | 286 | void icalparameter_set_altrep(icalparameter* value, const char* v); |
290 | 287 | ||
291 | /* X-LIC-COMPARETYPE */ | 288 | /* DELEGATED-FROM */ |
292 | icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v); | 289 | icalparameter* icalparameter_new_delegatedfrom(const char* v); |
293 | icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value); | 290 | const char* icalparameter_get_delegatedfrom(const icalparameter* value); |
294 | void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v); | 291 | void icalparameter_set_delegatedfrom(icalparameter* value, const char* v); |
295 | 292 | ||
296 | /* FBTYPE */ | 293 | /* FBTYPE */ |
297 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v); | 294 | icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v); |
298 | icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value); | 295 | icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* value); |
299 | void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v); | 296 | void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v); |
300 | 297 | ||
301 | /* TZID */ | 298 | /* ROLE */ |
302 | icalparameter* icalparameter_new_tzid(const char* v); | 299 | icalparameter* icalparameter_new_role(icalparameter_role v); |
303 | const char* icalparameter_get_tzid(icalparameter* value); | 300 | icalparameter_role icalparameter_get_role(const icalparameter* value); |
304 | void icalparameter_set_tzid(icalparameter* value, const char* v); | 301 | void icalparameter_set_role(icalparameter* value, icalparameter_role v); |
302 | |||
303 | /* PARTSTAT */ | ||
304 | icalparameter* icalparameter_new_partstat(icalparameter_partstat v); | ||
305 | icalparameter_partstat icalparameter_get_partstat(const icalparameter* value); | ||
306 | void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v); | ||
305 | 307 | ||
306 | #endif /*ICALPARAMETER_H*/ | 308 | #endif /*ICALPARAMETER_H*/ |
307 | 309 | ||
310 | /* 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 | |||
@@ -43,10 +43,9 @@ | |||
43 | #include <stdio.h> /* for printf */ | 43 | #include <stdio.h> /* for printf */ |
44 | #include <stdarg.h> /* for va_list, va_start, etc. */ | 44 | #include <stdarg.h> /* for va_list, va_start, etc. */ |
45 | 45 | ||
46 | #define TMP_BUF_SIZE 1024 | ||
47 | |||
48 | struct icalproperty_impl* | 46 | struct icalproperty_impl* |
49 | icalproperty_new_impl (icalproperty_kind kind); | 47 | icalproperty_new_impl (icalproperty_kind kind); |
48 | void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); | ||
50 | 49 | ||
51 | /* This map associates the property kinds with the string | 50 | /* This map associates the property kinds with the string |
52 | representation of the property name and the kind of VALUE that the | 51 | representation of the property name and the kind of VALUE that the |
@@ -59,76 +58,6 @@ struct icalproperty_map { | |||
59 | 58 | ||
60 | }; | 59 | }; |
61 | 60 | ||
62 | extern struct icalproperty_map property_map[]; | ||
63 | extern void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); | ||
64 | const char* icalproperty_kind_to_string(icalproperty_kind kind) | ||
65 | { | ||
66 | int i; | ||
67 | |||
68 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
69 | if (property_map[i].kind == kind) { | ||
70 | return property_map[i].name; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | return 0; | ||
75 | |||
76 | } | ||
77 | |||
78 | |||
79 | icalproperty_kind icalproperty_string_to_kind(const char* string) | ||
80 | { | ||
81 | int i; | ||
82 | |||
83 | if (string ==0 ) { | ||
84 | return ICAL_NO_PROPERTY; | ||
85 | } | ||
86 | |||
87 | |||
88 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
89 | if (strcmp(property_map[i].name, string) == 0) { | ||
90 | return property_map[i].kind; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | if(strncmp(string,"X-",2)==0){ | ||
95 | return ICAL_X_PROPERTY; | ||
96 | } | ||
97 | |||
98 | |||
99 | return ICAL_NO_PROPERTY; | ||
100 | } | ||
101 | |||
102 | |||
103 | icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind) | ||
104 | { | ||
105 | int i; | ||
106 | |||
107 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
108 | if ( property_map[i].value == kind ) { | ||
109 | return property_map[i].kind; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return ICAL_NO_VALUE; | ||
114 | } | ||
115 | |||
116 | |||
117 | |||
118 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind) | ||
119 | { | ||
120 | int i; | ||
121 | |||
122 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
123 | if ( property_map[i].kind == kind ) { | ||
124 | return property_map[i].value; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | return ICAL_NO_VALUE; | ||
129 | } | ||
130 | |||
131 | |||
132 | /* This map associates the property enumerations with the king of | 61 | /* This map associates the property enumerations with the king of |
133 | property that they are used in and the string representation of the | 62 | property that they are used in and the string representation of the |
134 | enumeration */ | 63 | enumeration */ |
@@ -139,127 +68,27 @@ struct icalproperty_enum_map { | |||
139 | const char* str; | 68 | const char* str; |
140 | }; | 69 | }; |
141 | 70 | ||
142 | extern struct icalproperty_enum_map enum_map[]; | ||
143 | |||
144 | |||
145 | const char* icalproperty_enum_to_string(int e) | ||
146 | { | ||
147 | icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e"); | ||
148 | icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e"); | ||
149 | |||
150 | return enum_map[e-ICALPROPERTY_FIRST_ENUM].str; | ||
151 | } | ||
152 | |||
153 | int icalproperty_string_to_enum(const char* str) | ||
154 | { | ||
155 | int i; | ||
156 | |||
157 | icalerror_check_arg_rz(str!=0,"str") | ||
158 | |||
159 | while(*str == ' '){ | ||
160 | str++; | ||
161 | } | ||
162 | |||
163 | for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
164 | if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) { | ||
165 | return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e) | ||
173 | { | ||
174 | int i; | ||
175 | |||
176 | |||
177 | for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
178 | if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e && | ||
179 | enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){ | ||
180 | return 1; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | |||
188 | const char* icalproperty_method_to_string(icalproperty_method method) | ||
189 | { | ||
190 | icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method"); | ||
191 | icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method"); | ||
192 | |||
193 | return enum_map[method-ICALPROPERTY_FIRST_ENUM].str; | ||
194 | } | ||
195 | |||
196 | icalproperty_method icalproperty_string_to_method(const char* str) | ||
197 | { | ||
198 | int i; | ||
199 | |||
200 | icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE) | ||
201 | |||
202 | while(*str == ' '){ | ||
203 | str++; | ||
204 | } | ||
205 | |||
206 | for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM; | ||
207 | i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM; | ||
208 | i++) { | ||
209 | if ( strcmp(enum_map[i].str, str) == 0) { | ||
210 | return (icalproperty_method)enum_map[i].prop_enum; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | return ICAL_METHOD_NONE; | ||
215 | } | ||
216 | |||
217 | |||
218 | const char* icalenum_status_to_string(icalproperty_status status) | ||
219 | { | ||
220 | icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status"); | ||
221 | icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status"); | ||
222 | |||
223 | return enum_map[status-ICALPROPERTY_FIRST_ENUM].str; | ||
224 | } | ||
225 | |||
226 | icalproperty_status icalenum_string_to_status(const char* str) | ||
227 | { | ||
228 | int i; | ||
229 | |||
230 | icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE) | ||
231 | |||
232 | while(*str == ' '){ | ||
233 | str++; | ||
234 | } | ||
235 | |||
236 | for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM; | ||
237 | i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM; | ||
238 | i++) { | ||
239 | if ( strcmp(enum_map[i].str, str) == 0) { | ||
240 | return (icalproperty_method)enum_map[i].prop_enum; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | return ICAL_STATUS_NONE; | ||
245 | |||
246 | } | ||
247 | |||
248 | |||
249 | 71 | ||
250 | /* Everything below this line is machine generated. Do not edit. */ | 72 | static struct icalproperty_map property_map[77] = { |
251 | static struct icalproperty_map property_map[] = { | ||
252 | {ICAL_ACTION_PROPERTY,"ACTION",ICAL_ACTION_VALUE}, | 73 | {ICAL_ACTION_PROPERTY,"ACTION",ICAL_ACTION_VALUE}, |
74 | {ICAL_ALLOWCONFLICT_PROPERTY,"ALLOW-CONFLICT",ICAL_TEXT_VALUE}, | ||
253 | {ICAL_ANY_PROPERTY,"ANY",ICAL_NO_VALUE}, | 75 | {ICAL_ANY_PROPERTY,"ANY",ICAL_NO_VALUE}, |
254 | {ICAL_ATTACH_PROPERTY,"ATTACH",ICAL_ATTACH_VALUE}, | 76 | {ICAL_ATTACH_PROPERTY,"ATTACH",ICAL_ATTACH_VALUE}, |
255 | {ICAL_ATTENDEE_PROPERTY,"ATTENDEE",ICAL_CALADDRESS_VALUE}, | 77 | {ICAL_ATTENDEE_PROPERTY,"ATTENDEE",ICAL_CALADDRESS_VALUE}, |
78 | {ICAL_CALID_PROPERTY,"CALID",ICAL_TEXT_VALUE}, | ||
79 | {ICAL_CALMASTER_PROPERTY,"CALMASTER",ICAL_TEXT_VALUE}, | ||
256 | {ICAL_CALSCALE_PROPERTY,"CALSCALE",ICAL_TEXT_VALUE}, | 80 | {ICAL_CALSCALE_PROPERTY,"CALSCALE",ICAL_TEXT_VALUE}, |
81 | {ICAL_CARID_PROPERTY,"CARID",ICAL_TEXT_VALUE}, | ||
257 | {ICAL_CATEGORIES_PROPERTY,"CATEGORIES",ICAL_TEXT_VALUE}, | 82 | {ICAL_CATEGORIES_PROPERTY,"CATEGORIES",ICAL_TEXT_VALUE}, |
258 | {ICAL_CLASS_PROPERTY,"CLASS",ICAL_TEXT_VALUE}, | 83 | {ICAL_CLASS_PROPERTY,"CLASS",ICAL_CLASS_VALUE}, |
259 | {ICAL_COMMENT_PROPERTY,"COMMENT",ICAL_TEXT_VALUE}, | 84 | {ICAL_COMMENT_PROPERTY,"COMMENT",ICAL_TEXT_VALUE}, |
260 | {ICAL_COMPLETED_PROPERTY,"COMPLETED",ICAL_DATETIME_VALUE}, | 85 | {ICAL_COMPLETED_PROPERTY,"COMPLETED",ICAL_DATETIME_VALUE}, |
261 | {ICAL_CONTACT_PROPERTY,"CONTACT",ICAL_TEXT_VALUE}, | 86 | {ICAL_CONTACT_PROPERTY,"CONTACT",ICAL_TEXT_VALUE}, |
262 | {ICAL_CREATED_PROPERTY,"CREATED",ICAL_DATETIME_VALUE}, | 87 | {ICAL_CREATED_PROPERTY,"CREATED",ICAL_DATETIME_VALUE}, |
88 | {ICAL_DECREED_PROPERTY,"DECREED",ICAL_TEXT_VALUE}, | ||
89 | {ICAL_DEFAULTCHARSET_PROPERTY,"DEFAULT-CHARSET",ICAL_TEXT_VALUE}, | ||
90 | {ICAL_DEFAULTLOCALE_PROPERTY,"DEFAULT-LOCALE",ICAL_TEXT_VALUE}, | ||
91 | {ICAL_DEFAULTTZID_PROPERTY,"DEFAULT-TZID",ICAL_TEXT_VALUE}, | ||
263 | {ICAL_DESCRIPTION_PROPERTY,"DESCRIPTION",ICAL_TEXT_VALUE}, | 92 | {ICAL_DESCRIPTION_PROPERTY,"DESCRIPTION",ICAL_TEXT_VALUE}, |
264 | {ICAL_DTEND_PROPERTY,"DTEND",ICAL_DATETIME_VALUE}, | 93 | {ICAL_DTEND_PROPERTY,"DTEND",ICAL_DATETIME_VALUE}, |
265 | {ICAL_DTSTAMP_PROPERTY,"DTSTAMP",ICAL_DATETIME_VALUE}, | 94 | {ICAL_DTSTAMP_PROPERTY,"DTSTAMP",ICAL_DATETIME_VALUE}, |
@@ -267,6 +96,7 @@ static struct icalproperty_map property_map[] = { | |||
267 | {ICAL_DUE_PROPERTY,"DUE",ICAL_DATETIME_VALUE}, | 96 | {ICAL_DUE_PROPERTY,"DUE",ICAL_DATETIME_VALUE}, |
268 | {ICAL_DURATION_PROPERTY,"DURATION",ICAL_DURATION_VALUE}, | 97 | {ICAL_DURATION_PROPERTY,"DURATION",ICAL_DURATION_VALUE}, |
269 | {ICAL_EXDATE_PROPERTY,"EXDATE",ICAL_DATETIME_VALUE}, | 98 | {ICAL_EXDATE_PROPERTY,"EXDATE",ICAL_DATETIME_VALUE}, |
99 | {ICAL_EXPAND_PROPERTY,"EXPAND",ICAL_INTEGER_VALUE}, | ||
270 | {ICAL_EXRULE_PROPERTY,"EXRULE",ICAL_RECUR_VALUE}, | 100 | {ICAL_EXRULE_PROPERTY,"EXRULE",ICAL_RECUR_VALUE}, |
271 | {ICAL_FREEBUSY_PROPERTY,"FREEBUSY",ICAL_PERIOD_VALUE}, | 101 | {ICAL_FREEBUSY_PROPERTY,"FREEBUSY",ICAL_PERIOD_VALUE}, |
272 | {ICAL_GEO_PROPERTY,"GEO",ICAL_GEO_VALUE}, | 102 | {ICAL_GEO_PROPERTY,"GEO",ICAL_GEO_VALUE}, |
@@ -276,6 +106,7 @@ static struct icalproperty_map property_map[] = { | |||
276 | {ICAL_MAXRESULTSSIZE_PROPERTY,"MAXRESULTSSIZE",ICAL_INTEGER_VALUE}, | 106 | {ICAL_MAXRESULTSSIZE_PROPERTY,"MAXRESULTSSIZE",ICAL_INTEGER_VALUE}, |
277 | {ICAL_METHOD_PROPERTY,"METHOD",ICAL_METHOD_VALUE}, | 107 | {ICAL_METHOD_PROPERTY,"METHOD",ICAL_METHOD_VALUE}, |
278 | {ICAL_ORGANIZER_PROPERTY,"ORGANIZER",ICAL_CALADDRESS_VALUE}, | 108 | {ICAL_ORGANIZER_PROPERTY,"ORGANIZER",ICAL_CALADDRESS_VALUE}, |
109 | {ICAL_OWNER_PROPERTY,"OWNER",ICAL_TEXT_VALUE}, | ||
279 | {ICAL_PERCENTCOMPLETE_PROPERTY,"PERCENT-COMPLETE",ICAL_INTEGER_VALUE}, | 110 | {ICAL_PERCENTCOMPLETE_PROPERTY,"PERCENT-COMPLETE",ICAL_INTEGER_VALUE}, |
280 | {ICAL_PRIORITY_PROPERTY,"PRIORITY",ICAL_INTEGER_VALUE}, | 111 | {ICAL_PRIORITY_PROPERTY,"PRIORITY",ICAL_INTEGER_VALUE}, |
281 | {ICAL_PRODID_PROPERTY,"PRODID",ICAL_TEXT_VALUE}, | 112 | {ICAL_PRODID_PROPERTY,"PRODID",ICAL_TEXT_VALUE}, |
@@ -284,6 +115,7 @@ static struct icalproperty_map property_map[] = { | |||
284 | {ICAL_RDATE_PROPERTY,"RDATE",ICAL_DATETIMEPERIOD_VALUE}, | 115 | {ICAL_RDATE_PROPERTY,"RDATE",ICAL_DATETIMEPERIOD_VALUE}, |
285 | {ICAL_RECURRENCEID_PROPERTY,"RECURRENCE-ID",ICAL_DATETIME_VALUE}, | 116 | {ICAL_RECURRENCEID_PROPERTY,"RECURRENCE-ID",ICAL_DATETIME_VALUE}, |
286 | {ICAL_RELATEDTO_PROPERTY,"RELATED-TO",ICAL_TEXT_VALUE}, | 117 | {ICAL_RELATEDTO_PROPERTY,"RELATED-TO",ICAL_TEXT_VALUE}, |
118 | {ICAL_RELCALID_PROPERTY,"RELCALID",ICAL_TEXT_VALUE}, | ||
287 | {ICAL_REPEAT_PROPERTY,"REPEAT",ICAL_INTEGER_VALUE}, | 119 | {ICAL_REPEAT_PROPERTY,"REPEAT",ICAL_INTEGER_VALUE}, |
288 | {ICAL_REQUESTSTATUS_PROPERTY,"REQUEST-STATUS",ICAL_REQUESTSTATUS_VALUE}, | 120 | {ICAL_REQUESTSTATUS_PROPERTY,"REQUEST-STATUS",ICAL_REQUESTSTATUS_VALUE}, |
289 | {ICAL_RESOURCES_PROPERTY,"RESOURCES",ICAL_TEXT_VALUE}, | 121 | {ICAL_RESOURCES_PROPERTY,"RESOURCES",ICAL_TEXT_VALUE}, |
@@ -293,7 +125,7 @@ static struct icalproperty_map property_map[] = { | |||
293 | {ICAL_STATUS_PROPERTY,"STATUS",ICAL_STATUS_VALUE}, | 125 | {ICAL_STATUS_PROPERTY,"STATUS",ICAL_STATUS_VALUE}, |
294 | {ICAL_SUMMARY_PROPERTY,"SUMMARY",ICAL_TEXT_VALUE}, | 126 | {ICAL_SUMMARY_PROPERTY,"SUMMARY",ICAL_TEXT_VALUE}, |
295 | {ICAL_TARGET_PROPERTY,"TARGET",ICAL_CALADDRESS_VALUE}, | 127 | {ICAL_TARGET_PROPERTY,"TARGET",ICAL_CALADDRESS_VALUE}, |
296 | {ICAL_TRANSP_PROPERTY,"TRANSP",ICAL_TEXT_VALUE}, | 128 | {ICAL_TRANSP_PROPERTY,"TRANSP",ICAL_TRANSP_VALUE}, |
297 | {ICAL_TRIGGER_PROPERTY,"TRIGGER",ICAL_TRIGGER_VALUE}, | 129 | {ICAL_TRIGGER_PROPERTY,"TRIGGER",ICAL_TRIGGER_VALUE}, |
298 | {ICAL_TZID_PROPERTY,"TZID",ICAL_TEXT_VALUE}, | 130 | {ICAL_TZID_PROPERTY,"TZID",ICAL_TEXT_VALUE}, |
299 | {ICAL_TZNAME_PROPERTY,"TZNAME",ICAL_TEXT_VALUE}, | 131 | {ICAL_TZNAME_PROPERTY,"TZNAME",ICAL_TEXT_VALUE}, |
@@ -303,7 +135,8 @@ static struct icalproperty_map property_map[] = { | |||
303 | {ICAL_UID_PROPERTY,"UID",ICAL_TEXT_VALUE}, | 135 | {ICAL_UID_PROPERTY,"UID",ICAL_TEXT_VALUE}, |
304 | {ICAL_URL_PROPERTY,"URL",ICAL_URI_VALUE}, | 136 | {ICAL_URL_PROPERTY,"URL",ICAL_URI_VALUE}, |
305 | {ICAL_VERSION_PROPERTY,"VERSION",ICAL_TEXT_VALUE}, | 137 | {ICAL_VERSION_PROPERTY,"VERSION",ICAL_TEXT_VALUE}, |
306 | {ICAL_X_PROPERTY,"X",ICAL_TEXT_VALUE}, | 138 | {ICAL_X_PROPERTY,"X",ICAL_X_VALUE}, |
139 | {ICAL_XLICCLASS_PROPERTY,"X-LIC-CLASS",ICAL_XLICCLASS_VALUE}, | ||
307 | {ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT",ICAL_STRING_VALUE}, | 140 | {ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT",ICAL_STRING_VALUE}, |
308 | {ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR",ICAL_TEXT_VALUE}, | 141 | {ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR",ICAL_TEXT_VALUE}, |
309 | {ICAL_XLICMIMECHARSET_PROPERTY,"X-LIC-MIMECHARSET",ICAL_STRING_VALUE}, | 142 | {ICAL_XLICMIMECHARSET_PROPERTY,"X-LIC-MIMECHARSET",ICAL_STRING_VALUE}, |
@@ -314,7 +147,7 @@ static struct icalproperty_map property_map[] = { | |||
314 | {ICAL_XLICMIMEOPTINFO_PROPERTY,"X-LIC-MIMEOPTINFO",ICAL_STRING_VALUE}, | 147 | {ICAL_XLICMIMEOPTINFO_PROPERTY,"X-LIC-MIMEOPTINFO",ICAL_STRING_VALUE}, |
315 | {ICAL_NO_PROPERTY,"",ICAL_NO_VALUE}}; | 148 | {ICAL_NO_PROPERTY,"",ICAL_NO_VALUE}}; |
316 | 149 | ||
317 | static struct icalproperty_enum_map enum_map[] = { | 150 | static struct icalproperty_enum_map enum_map[75] = { |
318 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_X,"" }, /*10000*/ | 151 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_X,"" }, /*10000*/ |
319 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_AUDIO,"AUDIO" }, /*10001*/ | 152 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_AUDIO,"AUDIO" }, /*10001*/ |
320 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_DISPLAY,"DISPLAY" }, /*10002*/ | 153 | {ICAL_ACTION_PROPERTY,ICAL_ACTION_DISPLAY,"DISPLAY" }, /*10002*/ |
@@ -355,8 +188,39 @@ static struct icalproperty_enum_map enum_map[] = { | |||
355 | {ICAL_STATUS_PROPERTY,ICAL_STATUS_NONE,"" }, /*10037*/ | 188 | {ICAL_STATUS_PROPERTY,ICAL_STATUS_NONE,"" }, /*10037*/ |
356 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_X,"" }, /*10038*/ | 189 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_X,"" }, /*10038*/ |
357 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUE,"OPAQUE" }, /*10039*/ | 190 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUE,"OPAQUE" }, /*10039*/ |
358 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENT,"TRANSPARENT" }, /*10040*/ | 191 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUENOCONFLICT,"OPAQUE-NOCONFLICT" }, /*10040*/ |
359 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_NONE,"" }, /*10041*/ | 192 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENT,"TRANSPARENT" }, /*10041*/ |
193 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENTNOCONFLICT,"TRANSPARENT-NOCONFLICT" }, /*10042*/ | ||
194 | {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_NONE,"" }, /*10043*/ | ||
195 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_X,"" }, /*10044*/ | ||
196 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHNEW,"PUBLISH-NEW" }, /*10045*/ | ||
197 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHUPDATE,"PUBLISH-UPDATE" }, /*10046*/ | ||
198 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_PUBLISHFREEBUSY,"PUBLISH-FREEBUSY" }, /*10047*/ | ||
199 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTNEW,"REQUEST-NEW" }, /*10048*/ | ||
200 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTUPDATE,"REQUEST-UPDATE" }, /*10049*/ | ||
201 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTRESCHEDULE,"REQUEST-RESCHEDULE" }, /*10050*/ | ||
202 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTDELEGATE,"REQUEST-DELEGATE" }, /*10051*/ | ||
203 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTNEWORGANIZER,"REQUEST-NEW-ORGANIZER" }, /*10052*/ | ||
204 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTFORWARD,"REQUEST-FORWARD" }, /*10053*/ | ||
205 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTSTATUS,"REQUEST-STATUS" }, /*10054*/ | ||
206 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REQUESTFREEBUSY,"REQUEST-FREEBUSY" }, /*10055*/ | ||
207 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYACCEPT,"REPLY-ACCEPT" }, /*10056*/ | ||
208 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYDECLINE,"REPLY-DECLINE" }, /*10057*/ | ||
209 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYDELEGATE,"REPLY-DELEGATE" }, /*10058*/ | ||
210 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYCRASHERACCEPT,"REPLY-CRASHER-ACCEPT" }, /*10059*/ | ||
211 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REPLYCRASHERDECLINE,"REPLY-CRASHER-DECLINE" }, /*10060*/ | ||
212 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_ADDINSTANCE,"ADD-INSTANCE" }, /*10061*/ | ||
213 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELEVENT,"CANCEL-EVENT" }, /*10062*/ | ||
214 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELINSTANCE,"CANCEL-INSTANCE" }, /*10063*/ | ||
215 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_CANCELALL,"CANCEL-ALL" }, /*10064*/ | ||
216 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_REFRESH,"REFRESH" }, /*10065*/ | ||
217 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_COUNTER,"COUNTER" }, /*10066*/ | ||
218 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_DECLINECOUNTER,"DECLINECOUNTER" }, /*10067*/ | ||
219 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_MALFORMED,"MALFORMED" }, /*10068*/ | ||
220 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_OBSOLETE,"OBSOLETE" }, /*10069*/ | ||
221 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_MISSEQUENCED,"MISSEQUENCED" }, /*10070*/ | ||
222 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_UNKNOWN,"UNKNOWN" }, /*10071*/ | ||
223 | {ICAL_XLICCLASS_PROPERTY,ICAL_XLICCLASS_NONE,"" }, /*10072*/ | ||
360 | {ICAL_NO_PROPERTY,0,""} | 224 | {ICAL_NO_PROPERTY,0,""} |
361 | }; | 225 | }; |
362 | 226 | ||
@@ -369,6 +233,7 @@ icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...){ | |||
369 | va_end(args); | 233 | va_end(args); |
370 | return (icalproperty*)impl; | 234 | return (icalproperty*)impl; |
371 | } | 235 | } |
236 | |||
372 | /* ACTION */ | 237 | /* ACTION */ |
373 | icalproperty* icalproperty_new_action(enum icalproperty_action v) { | 238 | icalproperty* icalproperty_new_action(enum icalproperty_action v) { |
374 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY); | 239 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY); |
@@ -381,11 +246,40 @@ void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v){ | |||
381 | icalerror_check_arg_rv( (prop!=0),"prop"); | 246 | icalerror_check_arg_rv( (prop!=0),"prop"); |
382 | icalproperty_set_value(prop,icalvalue_new_action(v)); | 247 | icalproperty_set_value(prop,icalvalue_new_action(v)); |
383 | } | 248 | } |
384 | enum icalproperty_action icalproperty_get_action(icalproperty* prop){ | 249 | enum icalproperty_action icalproperty_get_action(const icalproperty* prop){ |
385 | icalerror_check_arg( (prop!=0),"prop"); | 250 | icalerror_check_arg( (prop!=0),"prop"); |
386 | return icalvalue_get_action(icalproperty_get_value(prop)); | 251 | return icalvalue_get_action(icalproperty_get_value(prop)); |
387 | } | 252 | } |
388 | icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...){ | 253 | icalproperty* icalproperty_vanew_allowconflict(const char* v, ...){ |
254 | va_list args; | ||
255 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
256 | |||
257 | icalproperty_set_allowconflict((icalproperty*)impl,v); | ||
258 | va_start(args,v); | ||
259 | icalproperty_add_parameters(impl, args); | ||
260 | va_end(args); | ||
261 | return (icalproperty*)impl; | ||
262 | } | ||
263 | |||
264 | /* ALLOW-CONFLICT */ | ||
265 | icalproperty* icalproperty_new_allowconflict(const char* v) { | ||
266 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ALLOWCONFLICT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
267 | |||
268 | icalproperty_set_allowconflict((icalproperty*)impl,v); | ||
269 | return (icalproperty*)impl; | ||
270 | } | ||
271 | |||
272 | void icalproperty_set_allowconflict(icalproperty* prop, const char* v){ | ||
273 | icalerror_check_arg_rv( (v!=0),"v"); | ||
274 | |||
275 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
276 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
277 | } | ||
278 | const char* icalproperty_get_allowconflict(const icalproperty* prop){ | ||
279 | icalerror_check_arg( (prop!=0),"prop"); | ||
280 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
281 | } | ||
282 | icalproperty* icalproperty_vanew_attach(icalattach * v, ...){ | ||
389 | va_list args; | 283 | va_list args; |
390 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 284 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
391 | 285 | ||
@@ -395,21 +289,22 @@ icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...){ | |||
395 | va_end(args); | 289 | va_end(args); |
396 | return (icalproperty*)impl; | 290 | return (icalproperty*)impl; |
397 | } | 291 | } |
292 | |||
398 | /* ATTACH */ | 293 | /* ATTACH */ |
399 | icalproperty* icalproperty_new_attach(struct icalattachtype* v) { | 294 | icalproperty* icalproperty_new_attach(icalattach * v) { |
400 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 295 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
401 | 296 | ||
402 | icalproperty_set_attach((icalproperty*)impl,v); | 297 | icalproperty_set_attach((icalproperty*)impl,v); |
403 | return (icalproperty*)impl; | 298 | return (icalproperty*)impl; |
404 | } | 299 | } |
405 | 300 | ||
406 | void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v){ | 301 | void icalproperty_set_attach(icalproperty* prop, icalattach * v){ |
407 | icalerror_check_arg_rv( (v!=0),"v"); | 302 | icalerror_check_arg_rv( (v!=0),"v"); |
408 | 303 | ||
409 | icalerror_check_arg_rv( (prop!=0),"prop"); | 304 | icalerror_check_arg_rv( (prop!=0),"prop"); |
410 | icalproperty_set_value(prop,icalvalue_new_attach(v)); | 305 | icalproperty_set_value(prop,icalvalue_new_attach(v)); |
411 | } | 306 | } |
412 | struct icalattachtype* icalproperty_get_attach(icalproperty* prop){ | 307 | icalattach * icalproperty_get_attach(const icalproperty* prop){ |
413 | icalerror_check_arg( (prop!=0),"prop"); | 308 | icalerror_check_arg( (prop!=0),"prop"); |
414 | return icalvalue_get_attach(icalproperty_get_value(prop)); | 309 | return icalvalue_get_attach(icalproperty_get_value(prop)); |
415 | } | 310 | } |
@@ -423,6 +318,7 @@ icalproperty* icalproperty_vanew_attendee(const char* v, ...){ | |||
423 | va_end(args); | 318 | va_end(args); |
424 | return (icalproperty*)impl; | 319 | return (icalproperty*)impl; |
425 | } | 320 | } |
321 | |||
426 | /* ATTENDEE */ | 322 | /* ATTENDEE */ |
427 | icalproperty* icalproperty_new_attendee(const char* v) { | 323 | icalproperty* icalproperty_new_attendee(const char* v) { |
428 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 324 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -437,10 +333,68 @@ void icalproperty_set_attendee(icalproperty* prop, const char* v){ | |||
437 | icalerror_check_arg_rv( (prop!=0),"prop"); | 333 | icalerror_check_arg_rv( (prop!=0),"prop"); |
438 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); | 334 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); |
439 | } | 335 | } |
440 | const char* icalproperty_get_attendee(icalproperty* prop){ | 336 | const char* icalproperty_get_attendee(const icalproperty* prop){ |
441 | icalerror_check_arg( (prop!=0),"prop"); | 337 | icalerror_check_arg( (prop!=0),"prop"); |
442 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); | 338 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); |
443 | } | 339 | } |
340 | icalproperty* icalproperty_vanew_calid(const char* v, ...){ | ||
341 | va_list args; | ||
342 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
343 | |||
344 | icalproperty_set_calid((icalproperty*)impl,v); | ||
345 | va_start(args,v); | ||
346 | icalproperty_add_parameters(impl, args); | ||
347 | va_end(args); | ||
348 | return (icalproperty*)impl; | ||
349 | } | ||
350 | |||
351 | /* CALID */ | ||
352 | icalproperty* icalproperty_new_calid(const char* v) { | ||
353 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
354 | |||
355 | icalproperty_set_calid((icalproperty*)impl,v); | ||
356 | return (icalproperty*)impl; | ||
357 | } | ||
358 | |||
359 | void icalproperty_set_calid(icalproperty* prop, const char* v){ | ||
360 | icalerror_check_arg_rv( (v!=0),"v"); | ||
361 | |||
362 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
363 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
364 | } | ||
365 | const char* icalproperty_get_calid(const icalproperty* prop){ | ||
366 | icalerror_check_arg( (prop!=0),"prop"); | ||
367 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
368 | } | ||
369 | icalproperty* icalproperty_vanew_calmaster(const char* v, ...){ | ||
370 | va_list args; | ||
371 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
372 | |||
373 | icalproperty_set_calmaster((icalproperty*)impl,v); | ||
374 | va_start(args,v); | ||
375 | icalproperty_add_parameters(impl, args); | ||
376 | va_end(args); | ||
377 | return (icalproperty*)impl; | ||
378 | } | ||
379 | |||
380 | /* CALMASTER */ | ||
381 | icalproperty* icalproperty_new_calmaster(const char* v) { | ||
382 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALMASTER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
383 | |||
384 | icalproperty_set_calmaster((icalproperty*)impl,v); | ||
385 | return (icalproperty*)impl; | ||
386 | } | ||
387 | |||
388 | void icalproperty_set_calmaster(icalproperty* prop, const char* v){ | ||
389 | icalerror_check_arg_rv( (v!=0),"v"); | ||
390 | |||
391 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
392 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
393 | } | ||
394 | const char* icalproperty_get_calmaster(const icalproperty* prop){ | ||
395 | icalerror_check_arg( (prop!=0),"prop"); | ||
396 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
397 | } | ||
444 | icalproperty* icalproperty_vanew_calscale(const char* v, ...){ | 398 | icalproperty* icalproperty_vanew_calscale(const char* v, ...){ |
445 | va_list args; | 399 | va_list args; |
446 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 400 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -451,6 +405,7 @@ icalproperty* icalproperty_vanew_calscale(const char* v, ...){ | |||
451 | va_end(args); | 405 | va_end(args); |
452 | return (icalproperty*)impl; | 406 | return (icalproperty*)impl; |
453 | } | 407 | } |
408 | |||
454 | /* CALSCALE */ | 409 | /* CALSCALE */ |
455 | icalproperty* icalproperty_new_calscale(const char* v) { | 410 | icalproperty* icalproperty_new_calscale(const char* v) { |
456 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 411 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -465,7 +420,36 @@ void icalproperty_set_calscale(icalproperty* prop, const char* v){ | |||
465 | icalerror_check_arg_rv( (prop!=0),"prop"); | 420 | icalerror_check_arg_rv( (prop!=0),"prop"); |
466 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 421 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
467 | } | 422 | } |
468 | const char* icalproperty_get_calscale(icalproperty* prop){ | 423 | const char* icalproperty_get_calscale(const icalproperty* prop){ |
424 | icalerror_check_arg( (prop!=0),"prop"); | ||
425 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
426 | } | ||
427 | icalproperty* icalproperty_vanew_carid(const char* v, ...){ | ||
428 | va_list args; | ||
429 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
430 | |||
431 | icalproperty_set_carid((icalproperty*)impl,v); | ||
432 | va_start(args,v); | ||
433 | icalproperty_add_parameters(impl, args); | ||
434 | va_end(args); | ||
435 | return (icalproperty*)impl; | ||
436 | } | ||
437 | |||
438 | /* CARID */ | ||
439 | icalproperty* icalproperty_new_carid(const char* v) { | ||
440 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CARID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
441 | |||
442 | icalproperty_set_carid((icalproperty*)impl,v); | ||
443 | return (icalproperty*)impl; | ||
444 | } | ||
445 | |||
446 | void icalproperty_set_carid(icalproperty* prop, const char* v){ | ||
447 | icalerror_check_arg_rv( (v!=0),"v"); | ||
448 | |||
449 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
450 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
451 | } | ||
452 | const char* icalproperty_get_carid(const icalproperty* prop){ | ||
469 | icalerror_check_arg( (prop!=0),"prop"); | 453 | icalerror_check_arg( (prop!=0),"prop"); |
470 | return icalvalue_get_text(icalproperty_get_value(prop)); | 454 | return icalvalue_get_text(icalproperty_get_value(prop)); |
471 | } | 455 | } |
@@ -479,6 +463,7 @@ icalproperty* icalproperty_vanew_categories(const char* v, ...){ | |||
479 | va_end(args); | 463 | va_end(args); |
480 | return (icalproperty*)impl; | 464 | return (icalproperty*)impl; |
481 | } | 465 | } |
466 | |||
482 | /* CATEGORIES */ | 467 | /* CATEGORIES */ |
483 | icalproperty* icalproperty_new_categories(const char* v) { | 468 | icalproperty* icalproperty_new_categories(const char* v) { |
484 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 469 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -493,37 +478,35 @@ void icalproperty_set_categories(icalproperty* prop, const char* v){ | |||
493 | icalerror_check_arg_rv( (prop!=0),"prop"); | 478 | icalerror_check_arg_rv( (prop!=0),"prop"); |
494 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 479 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
495 | } | 480 | } |
496 | const char* icalproperty_get_categories(icalproperty* prop){ | 481 | const char* icalproperty_get_categories(const icalproperty* prop){ |
497 | icalerror_check_arg( (prop!=0),"prop"); | 482 | icalerror_check_arg( (prop!=0),"prop"); |
498 | return icalvalue_get_text(icalproperty_get_value(prop)); | 483 | return icalvalue_get_text(icalproperty_get_value(prop)); |
499 | } | 484 | } |
500 | icalproperty* icalproperty_vanew_class(const char* v, ...){ | 485 | icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...){ |
501 | va_list args; | 486 | va_list args; |
502 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 487 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); |
503 | |||
504 | icalproperty_set_class((icalproperty*)impl,v); | 488 | icalproperty_set_class((icalproperty*)impl,v); |
505 | va_start(args,v); | 489 | va_start(args,v); |
506 | icalproperty_add_parameters(impl, args); | 490 | icalproperty_add_parameters(impl, args); |
507 | va_end(args); | 491 | va_end(args); |
508 | return (icalproperty*)impl; | 492 | return (icalproperty*)impl; |
509 | } | 493 | } |
510 | /* CLASS */ | ||
511 | icalproperty* icalproperty_new_class(const char* v) { | ||
512 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
513 | 494 | ||
495 | /* CLASS */ | ||
496 | icalproperty* icalproperty_new_class(enum icalproperty_class v) { | ||
497 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); | ||
514 | icalproperty_set_class((icalproperty*)impl,v); | 498 | icalproperty_set_class((icalproperty*)impl,v); |
515 | return (icalproperty*)impl; | 499 | return (icalproperty*)impl; |
516 | } | 500 | } |
517 | 501 | ||
518 | void icalproperty_set_class(icalproperty* prop, const char* v){ | 502 | void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v){ |
519 | icalerror_check_arg_rv( (v!=0),"v"); | 503 | |
520 | |||
521 | icalerror_check_arg_rv( (prop!=0),"prop"); | 504 | icalerror_check_arg_rv( (prop!=0),"prop"); |
522 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 505 | icalproperty_set_value(prop,icalvalue_new_class(v)); |
523 | } | 506 | } |
524 | const char* icalproperty_get_class(icalproperty* prop){ | 507 | enum icalproperty_class icalproperty_get_class(const icalproperty* prop){ |
525 | icalerror_check_arg( (prop!=0),"prop"); | 508 | icalerror_check_arg( (prop!=0),"prop"); |
526 | return icalvalue_get_text(icalproperty_get_value(prop)); | 509 | return icalvalue_get_class(icalproperty_get_value(prop)); |
527 | } | 510 | } |
528 | icalproperty* icalproperty_vanew_comment(const char* v, ...){ | 511 | icalproperty* icalproperty_vanew_comment(const char* v, ...){ |
529 | va_list args; | 512 | va_list args; |
@@ -535,6 +518,7 @@ icalproperty* icalproperty_vanew_comment(const char* v, ...){ | |||
535 | va_end(args); | 518 | va_end(args); |
536 | return (icalproperty*)impl; | 519 | return (icalproperty*)impl; |
537 | } | 520 | } |
521 | |||
538 | /* COMMENT */ | 522 | /* COMMENT */ |
539 | icalproperty* icalproperty_new_comment(const char* v) { | 523 | icalproperty* icalproperty_new_comment(const char* v) { |
540 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 524 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -549,7 +533,7 @@ void icalproperty_set_comment(icalproperty* prop, const char* v){ | |||
549 | icalerror_check_arg_rv( (prop!=0),"prop"); | 533 | icalerror_check_arg_rv( (prop!=0),"prop"); |
550 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 534 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
551 | } | 535 | } |
552 | const char* icalproperty_get_comment(icalproperty* prop){ | 536 | const char* icalproperty_get_comment(const icalproperty* prop){ |
553 | icalerror_check_arg( (prop!=0),"prop"); | 537 | icalerror_check_arg( (prop!=0),"prop"); |
554 | return icalvalue_get_text(icalproperty_get_value(prop)); | 538 | return icalvalue_get_text(icalproperty_get_value(prop)); |
555 | } | 539 | } |
@@ -562,6 +546,7 @@ icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...){ | |||
562 | va_end(args); | 546 | va_end(args); |
563 | return (icalproperty*)impl; | 547 | return (icalproperty*)impl; |
564 | } | 548 | } |
549 | |||
565 | /* COMPLETED */ | 550 | /* COMPLETED */ |
566 | icalproperty* icalproperty_new_completed(struct icaltimetype v) { | 551 | icalproperty* icalproperty_new_completed(struct icaltimetype v) { |
567 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY); | 552 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY); |
@@ -574,7 +559,7 @@ void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v){ | |||
574 | icalerror_check_arg_rv( (prop!=0),"prop"); | 559 | icalerror_check_arg_rv( (prop!=0),"prop"); |
575 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 560 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); |
576 | } | 561 | } |
577 | struct icaltimetype icalproperty_get_completed(icalproperty* prop){ | 562 | struct icaltimetype icalproperty_get_completed(const icalproperty* prop){ |
578 | icalerror_check_arg( (prop!=0),"prop"); | 563 | icalerror_check_arg( (prop!=0),"prop"); |
579 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 564 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
580 | } | 565 | } |
@@ -588,6 +573,7 @@ icalproperty* icalproperty_vanew_contact(const char* v, ...){ | |||
588 | va_end(args); | 573 | va_end(args); |
589 | return (icalproperty*)impl; | 574 | return (icalproperty*)impl; |
590 | } | 575 | } |
576 | |||
591 | /* CONTACT */ | 577 | /* CONTACT */ |
592 | icalproperty* icalproperty_new_contact(const char* v) { | 578 | icalproperty* icalproperty_new_contact(const char* v) { |
593 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 579 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -602,7 +588,7 @@ void icalproperty_set_contact(icalproperty* prop, const char* v){ | |||
602 | icalerror_check_arg_rv( (prop!=0),"prop"); | 588 | icalerror_check_arg_rv( (prop!=0),"prop"); |
603 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 589 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
604 | } | 590 | } |
605 | const char* icalproperty_get_contact(icalproperty* prop){ | 591 | const char* icalproperty_get_contact(const icalproperty* prop){ |
606 | icalerror_check_arg( (prop!=0),"prop"); | 592 | icalerror_check_arg( (prop!=0),"prop"); |
607 | return icalvalue_get_text(icalproperty_get_value(prop)); | 593 | return icalvalue_get_text(icalproperty_get_value(prop)); |
608 | } | 594 | } |
@@ -615,6 +601,7 @@ icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...){ | |||
615 | va_end(args); | 601 | va_end(args); |
616 | return (icalproperty*)impl; | 602 | return (icalproperty*)impl; |
617 | } | 603 | } |
604 | |||
618 | /* CREATED */ | 605 | /* CREATED */ |
619 | icalproperty* icalproperty_new_created(struct icaltimetype v) { | 606 | icalproperty* icalproperty_new_created(struct icaltimetype v) { |
620 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY); | 607 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY); |
@@ -627,10 +614,126 @@ void icalproperty_set_created(icalproperty* prop, struct icaltimetype v){ | |||
627 | icalerror_check_arg_rv( (prop!=0),"prop"); | 614 | icalerror_check_arg_rv( (prop!=0),"prop"); |
628 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 615 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); |
629 | } | 616 | } |
630 | struct icaltimetype icalproperty_get_created(icalproperty* prop){ | 617 | struct icaltimetype icalproperty_get_created(const icalproperty* prop){ |
631 | icalerror_check_arg( (prop!=0),"prop"); | 618 | icalerror_check_arg( (prop!=0),"prop"); |
632 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 619 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
633 | } | 620 | } |
621 | icalproperty* icalproperty_vanew_decreed(const char* v, ...){ | ||
622 | va_list args; | ||
623 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
624 | |||
625 | icalproperty_set_decreed((icalproperty*)impl,v); | ||
626 | va_start(args,v); | ||
627 | icalproperty_add_parameters(impl, args); | ||
628 | va_end(args); | ||
629 | return (icalproperty*)impl; | ||
630 | } | ||
631 | |||
632 | /* DECREED */ | ||
633 | icalproperty* icalproperty_new_decreed(const char* v) { | ||
634 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DECREED_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
635 | |||
636 | icalproperty_set_decreed((icalproperty*)impl,v); | ||
637 | return (icalproperty*)impl; | ||
638 | } | ||
639 | |||
640 | void icalproperty_set_decreed(icalproperty* prop, const char* v){ | ||
641 | icalerror_check_arg_rv( (v!=0),"v"); | ||
642 | |||
643 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
644 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
645 | } | ||
646 | const char* icalproperty_get_decreed(const icalproperty* prop){ | ||
647 | icalerror_check_arg( (prop!=0),"prop"); | ||
648 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
649 | } | ||
650 | icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...){ | ||
651 | va_list args; | ||
652 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
653 | |||
654 | icalproperty_set_defaultcharset((icalproperty*)impl,v); | ||
655 | va_start(args,v); | ||
656 | icalproperty_add_parameters(impl, args); | ||
657 | va_end(args); | ||
658 | return (icalproperty*)impl; | ||
659 | } | ||
660 | |||
661 | /* DEFAULT-CHARSET */ | ||
662 | icalproperty* icalproperty_new_defaultcharset(const char* v) { | ||
663 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTCHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
664 | |||
665 | icalproperty_set_defaultcharset((icalproperty*)impl,v); | ||
666 | return (icalproperty*)impl; | ||
667 | } | ||
668 | |||
669 | void icalproperty_set_defaultcharset(icalproperty* prop, const char* v){ | ||
670 | icalerror_check_arg_rv( (v!=0),"v"); | ||
671 | |||
672 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
673 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
674 | } | ||
675 | const char* icalproperty_get_defaultcharset(const icalproperty* prop){ | ||
676 | icalerror_check_arg( (prop!=0),"prop"); | ||
677 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
678 | } | ||
679 | icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...){ | ||
680 | va_list args; | ||
681 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
682 | |||
683 | icalproperty_set_defaultlocale((icalproperty*)impl,v); | ||
684 | va_start(args,v); | ||
685 | icalproperty_add_parameters(impl, args); | ||
686 | va_end(args); | ||
687 | return (icalproperty*)impl; | ||
688 | } | ||
689 | |||
690 | /* DEFAULT-LOCALE */ | ||
691 | icalproperty* icalproperty_new_defaultlocale(const char* v) { | ||
692 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTLOCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
693 | |||
694 | icalproperty_set_defaultlocale((icalproperty*)impl,v); | ||
695 | return (icalproperty*)impl; | ||
696 | } | ||
697 | |||
698 | void icalproperty_set_defaultlocale(icalproperty* prop, const char* v){ | ||
699 | icalerror_check_arg_rv( (v!=0),"v"); | ||
700 | |||
701 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
702 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
703 | } | ||
704 | const char* icalproperty_get_defaultlocale(const icalproperty* prop){ | ||
705 | icalerror_check_arg( (prop!=0),"prop"); | ||
706 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
707 | } | ||
708 | icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...){ | ||
709 | va_list args; | ||
710 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
711 | |||
712 | icalproperty_set_defaulttzid((icalproperty*)impl,v); | ||
713 | va_start(args,v); | ||
714 | icalproperty_add_parameters(impl, args); | ||
715 | va_end(args); | ||
716 | return (icalproperty*)impl; | ||
717 | } | ||
718 | |||
719 | /* DEFAULT-TZID */ | ||
720 | icalproperty* icalproperty_new_defaulttzid(const char* v) { | ||
721 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DEFAULTTZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
722 | |||
723 | icalproperty_set_defaulttzid((icalproperty*)impl,v); | ||
724 | return (icalproperty*)impl; | ||
725 | } | ||
726 | |||
727 | void icalproperty_set_defaulttzid(icalproperty* prop, const char* v){ | ||
728 | icalerror_check_arg_rv( (v!=0),"v"); | ||
729 | |||
730 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
731 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
732 | } | ||
733 | const char* icalproperty_get_defaulttzid(const icalproperty* prop){ | ||
734 | icalerror_check_arg( (prop!=0),"prop"); | ||
735 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
736 | } | ||
634 | icalproperty* icalproperty_vanew_description(const char* v, ...){ | 737 | icalproperty* icalproperty_vanew_description(const char* v, ...){ |
635 | va_list args; | 738 | va_list args; |
636 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 739 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -641,6 +744,7 @@ icalproperty* icalproperty_vanew_description(const char* v, ...){ | |||
641 | va_end(args); | 744 | va_end(args); |
642 | return (icalproperty*)impl; | 745 | return (icalproperty*)impl; |
643 | } | 746 | } |
747 | |||
644 | /* DESCRIPTION */ | 748 | /* DESCRIPTION */ |
645 | icalproperty* icalproperty_new_description(const char* v) { | 749 | icalproperty* icalproperty_new_description(const char* v) { |
646 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 750 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -655,7 +759,7 @@ void icalproperty_set_description(icalproperty* prop, const char* v){ | |||
655 | icalerror_check_arg_rv( (prop!=0),"prop"); | 759 | icalerror_check_arg_rv( (prop!=0),"prop"); |
656 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 760 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
657 | } | 761 | } |
658 | const char* icalproperty_get_description(icalproperty* prop){ | 762 | const char* icalproperty_get_description(const icalproperty* prop){ |
659 | icalerror_check_arg( (prop!=0),"prop"); | 763 | icalerror_check_arg( (prop!=0),"prop"); |
660 | return icalvalue_get_text(icalproperty_get_value(prop)); | 764 | return icalvalue_get_text(icalproperty_get_value(prop)); |
661 | } | 765 | } |
@@ -668,6 +772,7 @@ icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...){ | |||
668 | va_end(args); | 772 | va_end(args); |
669 | return (icalproperty*)impl; | 773 | return (icalproperty*)impl; |
670 | } | 774 | } |
775 | |||
671 | /* DTEND */ | 776 | /* DTEND */ |
672 | icalproperty* icalproperty_new_dtend(struct icaltimetype v) { | 777 | icalproperty* icalproperty_new_dtend(struct icaltimetype v) { |
673 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY); | 778 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY); |
@@ -676,11 +781,16 @@ icalproperty* icalproperty_new_dtend(struct icaltimetype v) { | |||
676 | } | 781 | } |
677 | 782 | ||
678 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v){ | 783 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v){ |
784 | icalvalue *value; | ||
679 | 785 | ||
680 | icalerror_check_arg_rv( (prop!=0),"prop"); | 786 | icalerror_check_arg_rv( (prop!=0),"prop"); |
681 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 787 | if (v.is_date) |
788 | value = icalvalue_new_date(v); | ||
789 | else | ||
790 | value = icalvalue_new_datetime(v); | ||
791 | icalproperty_set_value(prop,value); | ||
682 | } | 792 | } |
683 | struct icaltimetype icalproperty_get_dtend(icalproperty* prop){ | 793 | struct icaltimetype icalproperty_get_dtend(const icalproperty* prop){ |
684 | icalerror_check_arg( (prop!=0),"prop"); | 794 | icalerror_check_arg( (prop!=0),"prop"); |
685 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 795 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
686 | } | 796 | } |
@@ -693,6 +803,7 @@ icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...){ | |||
693 | va_end(args); | 803 | va_end(args); |
694 | return (icalproperty*)impl; | 804 | return (icalproperty*)impl; |
695 | } | 805 | } |
806 | |||
696 | /* DTSTAMP */ | 807 | /* DTSTAMP */ |
697 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v) { | 808 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v) { |
698 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY); | 809 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY); |
@@ -705,7 +816,7 @@ void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v){ | |||
705 | icalerror_check_arg_rv( (prop!=0),"prop"); | 816 | icalerror_check_arg_rv( (prop!=0),"prop"); |
706 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 817 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); |
707 | } | 818 | } |
708 | struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop){ | 819 | struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop){ |
709 | icalerror_check_arg( (prop!=0),"prop"); | 820 | icalerror_check_arg( (prop!=0),"prop"); |
710 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 821 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
711 | } | 822 | } |
@@ -718,6 +829,7 @@ icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...){ | |||
718 | va_end(args); | 829 | va_end(args); |
719 | return (icalproperty*)impl; | 830 | return (icalproperty*)impl; |
720 | } | 831 | } |
832 | |||
721 | /* DTSTART */ | 833 | /* DTSTART */ |
722 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v) { | 834 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v) { |
723 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY); | 835 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY); |
@@ -726,11 +838,16 @@ icalproperty* icalproperty_new_dtstart(struct icaltimetype v) { | |||
726 | } | 838 | } |
727 | 839 | ||
728 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v){ | 840 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v){ |
841 | icalvalue *value; | ||
729 | 842 | ||
730 | icalerror_check_arg_rv( (prop!=0),"prop"); | 843 | icalerror_check_arg_rv( (prop!=0),"prop"); |
731 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 844 | if (v.is_date) |
845 | value = icalvalue_new_date(v); | ||
846 | else | ||
847 | value = icalvalue_new_datetime(v); | ||
848 | icalproperty_set_value(prop,value); | ||
732 | } | 849 | } |
733 | struct icaltimetype icalproperty_get_dtstart(icalproperty* prop){ | 850 | struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop){ |
734 | icalerror_check_arg( (prop!=0),"prop"); | 851 | icalerror_check_arg( (prop!=0),"prop"); |
735 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 852 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
736 | } | 853 | } |
@@ -743,6 +860,7 @@ icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...){ | |||
743 | va_end(args); | 860 | va_end(args); |
744 | return (icalproperty*)impl; | 861 | return (icalproperty*)impl; |
745 | } | 862 | } |
863 | |||
746 | /* DUE */ | 864 | /* DUE */ |
747 | icalproperty* icalproperty_new_due(struct icaltimetype v) { | 865 | icalproperty* icalproperty_new_due(struct icaltimetype v) { |
748 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY); | 866 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY); |
@@ -751,11 +869,16 @@ icalproperty* icalproperty_new_due(struct icaltimetype v) { | |||
751 | } | 869 | } |
752 | 870 | ||
753 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v){ | 871 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v){ |
872 | icalvalue *value; | ||
754 | 873 | ||
755 | icalerror_check_arg_rv( (prop!=0),"prop"); | 874 | icalerror_check_arg_rv( (prop!=0),"prop"); |
756 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 875 | if (v.is_date) |
876 | value = icalvalue_new_date(v); | ||
877 | else | ||
878 | value = icalvalue_new_datetime(v); | ||
879 | icalproperty_set_value(prop,value); | ||
757 | } | 880 | } |
758 | struct icaltimetype icalproperty_get_due(icalproperty* prop){ | 881 | struct icaltimetype icalproperty_get_due(const icalproperty* prop){ |
759 | icalerror_check_arg( (prop!=0),"prop"); | 882 | icalerror_check_arg( (prop!=0),"prop"); |
760 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 883 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
761 | } | 884 | } |
@@ -768,6 +891,7 @@ icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...){ | |||
768 | va_end(args); | 891 | va_end(args); |
769 | return (icalproperty*)impl; | 892 | return (icalproperty*)impl; |
770 | } | 893 | } |
894 | |||
771 | /* DURATION */ | 895 | /* DURATION */ |
772 | icalproperty* icalproperty_new_duration(struct icaldurationtype v) { | 896 | icalproperty* icalproperty_new_duration(struct icaldurationtype v) { |
773 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY); | 897 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY); |
@@ -780,7 +904,7 @@ void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v){ | |||
780 | icalerror_check_arg_rv( (prop!=0),"prop"); | 904 | icalerror_check_arg_rv( (prop!=0),"prop"); |
781 | icalproperty_set_value(prop,icalvalue_new_duration(v)); | 905 | icalproperty_set_value(prop,icalvalue_new_duration(v)); |
782 | } | 906 | } |
783 | struct icaldurationtype icalproperty_get_duration(icalproperty* prop){ | 907 | struct icaldurationtype icalproperty_get_duration(const icalproperty* prop){ |
784 | icalerror_check_arg( (prop!=0),"prop"); | 908 | icalerror_check_arg( (prop!=0),"prop"); |
785 | return icalvalue_get_duration(icalproperty_get_value(prop)); | 909 | return icalvalue_get_duration(icalproperty_get_value(prop)); |
786 | } | 910 | } |
@@ -793,6 +917,7 @@ icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...){ | |||
793 | va_end(args); | 917 | va_end(args); |
794 | return (icalproperty*)impl; | 918 | return (icalproperty*)impl; |
795 | } | 919 | } |
920 | |||
796 | /* EXDATE */ | 921 | /* EXDATE */ |
797 | icalproperty* icalproperty_new_exdate(struct icaltimetype v) { | 922 | icalproperty* icalproperty_new_exdate(struct icaltimetype v) { |
798 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY); | 923 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY); |
@@ -801,14 +926,45 @@ icalproperty* icalproperty_new_exdate(struct icaltimetype v) { | |||
801 | } | 926 | } |
802 | 927 | ||
803 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v){ | 928 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v){ |
929 | icalvalue *value; | ||
804 | 930 | ||
805 | icalerror_check_arg_rv( (prop!=0),"prop"); | 931 | icalerror_check_arg_rv( (prop!=0),"prop"); |
806 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 932 | if (v.is_date) |
933 | value = icalvalue_new_date(v); | ||
934 | else | ||
935 | value = icalvalue_new_datetime(v); | ||
936 | icalproperty_set_value(prop,value); | ||
807 | } | 937 | } |
808 | struct icaltimetype icalproperty_get_exdate(icalproperty* prop){ | 938 | struct icaltimetype icalproperty_get_exdate(const icalproperty* prop){ |
809 | icalerror_check_arg( (prop!=0),"prop"); | 939 | icalerror_check_arg( (prop!=0),"prop"); |
810 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 940 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
811 | } | 941 | } |
942 | icalproperty* icalproperty_vanew_expand(int v, ...){ | ||
943 | va_list args; | ||
944 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXPAND_PROPERTY); | ||
945 | icalproperty_set_expand((icalproperty*)impl,v); | ||
946 | va_start(args,v); | ||
947 | icalproperty_add_parameters(impl, args); | ||
948 | va_end(args); | ||
949 | return (icalproperty*)impl; | ||
950 | } | ||
951 | |||
952 | /* EXPAND */ | ||
953 | icalproperty* icalproperty_new_expand(int v) { | ||
954 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXPAND_PROPERTY); | ||
955 | icalproperty_set_expand((icalproperty*)impl,v); | ||
956 | return (icalproperty*)impl; | ||
957 | } | ||
958 | |||
959 | void icalproperty_set_expand(icalproperty* prop, int v){ | ||
960 | |||
961 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
962 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | ||
963 | } | ||
964 | int icalproperty_get_expand(const icalproperty* prop){ | ||
965 | icalerror_check_arg( (prop!=0),"prop"); | ||
966 | return icalvalue_get_integer(icalproperty_get_value(prop)); | ||
967 | } | ||
812 | icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){ | 968 | icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){ |
813 | va_list args; | 969 | va_list args; |
814 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); | 970 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); |
@@ -818,6 +974,7 @@ icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){ | |||
818 | va_end(args); | 974 | va_end(args); |
819 | return (icalproperty*)impl; | 975 | return (icalproperty*)impl; |
820 | } | 976 | } |
977 | |||
821 | /* EXRULE */ | 978 | /* EXRULE */ |
822 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v) { | 979 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v) { |
823 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); | 980 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); |
@@ -830,7 +987,7 @@ void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v){ | |||
830 | icalerror_check_arg_rv( (prop!=0),"prop"); | 987 | icalerror_check_arg_rv( (prop!=0),"prop"); |
831 | icalproperty_set_value(prop,icalvalue_new_recur(v)); | 988 | icalproperty_set_value(prop,icalvalue_new_recur(v)); |
832 | } | 989 | } |
833 | struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop){ | 990 | struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop){ |
834 | icalerror_check_arg( (prop!=0),"prop"); | 991 | icalerror_check_arg( (prop!=0),"prop"); |
835 | return icalvalue_get_recur(icalproperty_get_value(prop)); | 992 | return icalvalue_get_recur(icalproperty_get_value(prop)); |
836 | } | 993 | } |
@@ -843,6 +1000,7 @@ icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...){ | |||
843 | va_end(args); | 1000 | va_end(args); |
844 | return (icalproperty*)impl; | 1001 | return (icalproperty*)impl; |
845 | } | 1002 | } |
1003 | |||
846 | /* FREEBUSY */ | 1004 | /* FREEBUSY */ |
847 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v) { | 1005 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v) { |
848 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY); | 1006 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY); |
@@ -855,7 +1013,7 @@ void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v){ | |||
855 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1013 | icalerror_check_arg_rv( (prop!=0),"prop"); |
856 | icalproperty_set_value(prop,icalvalue_new_period(v)); | 1014 | icalproperty_set_value(prop,icalvalue_new_period(v)); |
857 | } | 1015 | } |
858 | struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop){ | 1016 | struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop){ |
859 | icalerror_check_arg( (prop!=0),"prop"); | 1017 | icalerror_check_arg( (prop!=0),"prop"); |
860 | return icalvalue_get_period(icalproperty_get_value(prop)); | 1018 | return icalvalue_get_period(icalproperty_get_value(prop)); |
861 | } | 1019 | } |
@@ -868,6 +1026,7 @@ icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...){ | |||
868 | va_end(args); | 1026 | va_end(args); |
869 | return (icalproperty*)impl; | 1027 | return (icalproperty*)impl; |
870 | } | 1028 | } |
1029 | |||
871 | /* GEO */ | 1030 | /* GEO */ |
872 | icalproperty* icalproperty_new_geo(struct icalgeotype v) { | 1031 | icalproperty* icalproperty_new_geo(struct icalgeotype v) { |
873 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY); | 1032 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY); |
@@ -880,7 +1039,7 @@ void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v){ | |||
880 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1039 | icalerror_check_arg_rv( (prop!=0),"prop"); |
881 | icalproperty_set_value(prop,icalvalue_new_geo(v)); | 1040 | icalproperty_set_value(prop,icalvalue_new_geo(v)); |
882 | } | 1041 | } |
883 | struct icalgeotype icalproperty_get_geo(icalproperty* prop){ | 1042 | struct icalgeotype icalproperty_get_geo(const icalproperty* prop){ |
884 | icalerror_check_arg( (prop!=0),"prop"); | 1043 | icalerror_check_arg( (prop!=0),"prop"); |
885 | return icalvalue_get_geo(icalproperty_get_value(prop)); | 1044 | return icalvalue_get_geo(icalproperty_get_value(prop)); |
886 | } | 1045 | } |
@@ -893,6 +1052,7 @@ icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...){ | |||
893 | va_end(args); | 1052 | va_end(args); |
894 | return (icalproperty*)impl; | 1053 | return (icalproperty*)impl; |
895 | } | 1054 | } |
1055 | |||
896 | /* LAST-MODIFIED */ | 1056 | /* LAST-MODIFIED */ |
897 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) { | 1057 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) { |
898 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY); | 1058 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY); |
@@ -905,7 +1065,7 @@ void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v){ | |||
905 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1065 | icalerror_check_arg_rv( (prop!=0),"prop"); |
906 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 1066 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); |
907 | } | 1067 | } |
908 | struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop){ | 1068 | struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop){ |
909 | icalerror_check_arg( (prop!=0),"prop"); | 1069 | icalerror_check_arg( (prop!=0),"prop"); |
910 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 1070 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
911 | } | 1071 | } |
@@ -919,6 +1079,7 @@ icalproperty* icalproperty_vanew_location(const char* v, ...){ | |||
919 | va_end(args); | 1079 | va_end(args); |
920 | return (icalproperty*)impl; | 1080 | return (icalproperty*)impl; |
921 | } | 1081 | } |
1082 | |||
922 | /* LOCATION */ | 1083 | /* LOCATION */ |
923 | icalproperty* icalproperty_new_location(const char* v) { | 1084 | icalproperty* icalproperty_new_location(const char* v) { |
924 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1085 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -933,7 +1094,7 @@ void icalproperty_set_location(icalproperty* prop, const char* v){ | |||
933 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1094 | icalerror_check_arg_rv( (prop!=0),"prop"); |
934 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1095 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
935 | } | 1096 | } |
936 | const char* icalproperty_get_location(icalproperty* prop){ | 1097 | const char* icalproperty_get_location(const icalproperty* prop){ |
937 | icalerror_check_arg( (prop!=0),"prop"); | 1098 | icalerror_check_arg( (prop!=0),"prop"); |
938 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1099 | return icalvalue_get_text(icalproperty_get_value(prop)); |
939 | } | 1100 | } |
@@ -946,6 +1107,7 @@ icalproperty* icalproperty_vanew_maxresults(int v, ...){ | |||
946 | va_end(args); | 1107 | va_end(args); |
947 | return (icalproperty*)impl; | 1108 | return (icalproperty*)impl; |
948 | } | 1109 | } |
1110 | |||
949 | /* MAXRESULTS */ | 1111 | /* MAXRESULTS */ |
950 | icalproperty* icalproperty_new_maxresults(int v) { | 1112 | icalproperty* icalproperty_new_maxresults(int v) { |
951 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTS_PROPERTY); | 1113 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTS_PROPERTY); |
@@ -958,7 +1120,7 @@ void icalproperty_set_maxresults(icalproperty* prop, int v){ | |||
958 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1120 | icalerror_check_arg_rv( (prop!=0),"prop"); |
959 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1121 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
960 | } | 1122 | } |
961 | int icalproperty_get_maxresults(icalproperty* prop){ | 1123 | int icalproperty_get_maxresults(const icalproperty* prop){ |
962 | icalerror_check_arg( (prop!=0),"prop"); | 1124 | icalerror_check_arg( (prop!=0),"prop"); |
963 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1125 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
964 | } | 1126 | } |
@@ -971,6 +1133,7 @@ icalproperty* icalproperty_vanew_maxresultssize(int v, ...){ | |||
971 | va_end(args); | 1133 | va_end(args); |
972 | return (icalproperty*)impl; | 1134 | return (icalproperty*)impl; |
973 | } | 1135 | } |
1136 | |||
974 | /* MAXRESULTSSIZE */ | 1137 | /* MAXRESULTSSIZE */ |
975 | icalproperty* icalproperty_new_maxresultssize(int v) { | 1138 | icalproperty* icalproperty_new_maxresultssize(int v) { |
976 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTSSIZE_PROPERTY); | 1139 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTSSIZE_PROPERTY); |
@@ -983,7 +1146,7 @@ void icalproperty_set_maxresultssize(icalproperty* prop, int v){ | |||
983 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1146 | icalerror_check_arg_rv( (prop!=0),"prop"); |
984 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1147 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
985 | } | 1148 | } |
986 | int icalproperty_get_maxresultssize(icalproperty* prop){ | 1149 | int icalproperty_get_maxresultssize(const icalproperty* prop){ |
987 | icalerror_check_arg( (prop!=0),"prop"); | 1150 | icalerror_check_arg( (prop!=0),"prop"); |
988 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1151 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
989 | } | 1152 | } |
@@ -996,6 +1159,7 @@ icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...){ | |||
996 | va_end(args); | 1159 | va_end(args); |
997 | return (icalproperty*)impl; | 1160 | return (icalproperty*)impl; |
998 | } | 1161 | } |
1162 | |||
999 | /* METHOD */ | 1163 | /* METHOD */ |
1000 | icalproperty* icalproperty_new_method(enum icalproperty_method v) { | 1164 | icalproperty* icalproperty_new_method(enum icalproperty_method v) { |
1001 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY); | 1165 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY); |
@@ -1008,7 +1172,7 @@ void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v){ | |||
1008 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1172 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1009 | icalproperty_set_value(prop,icalvalue_new_method(v)); | 1173 | icalproperty_set_value(prop,icalvalue_new_method(v)); |
1010 | } | 1174 | } |
1011 | enum icalproperty_method icalproperty_get_method(icalproperty* prop){ | 1175 | enum icalproperty_method icalproperty_get_method(const icalproperty* prop){ |
1012 | icalerror_check_arg( (prop!=0),"prop"); | 1176 | icalerror_check_arg( (prop!=0),"prop"); |
1013 | return icalvalue_get_method(icalproperty_get_value(prop)); | 1177 | return icalvalue_get_method(icalproperty_get_value(prop)); |
1014 | } | 1178 | } |
@@ -1022,6 +1186,7 @@ icalproperty* icalproperty_vanew_organizer(const char* v, ...){ | |||
1022 | va_end(args); | 1186 | va_end(args); |
1023 | return (icalproperty*)impl; | 1187 | return (icalproperty*)impl; |
1024 | } | 1188 | } |
1189 | |||
1025 | /* ORGANIZER */ | 1190 | /* ORGANIZER */ |
1026 | icalproperty* icalproperty_new_organizer(const char* v) { | 1191 | icalproperty* icalproperty_new_organizer(const char* v) { |
1027 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1192 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1036,10 +1201,39 @@ void icalproperty_set_organizer(icalproperty* prop, const char* v){ | |||
1036 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1201 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1037 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); | 1202 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); |
1038 | } | 1203 | } |
1039 | const char* icalproperty_get_organizer(icalproperty* prop){ | 1204 | const char* icalproperty_get_organizer(const icalproperty* prop){ |
1040 | icalerror_check_arg( (prop!=0),"prop"); | 1205 | icalerror_check_arg( (prop!=0),"prop"); |
1041 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); | 1206 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); |
1042 | } | 1207 | } |
1208 | icalproperty* icalproperty_vanew_owner(const char* v, ...){ | ||
1209 | va_list args; | ||
1210 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
1211 | |||
1212 | icalproperty_set_owner((icalproperty*)impl,v); | ||
1213 | va_start(args,v); | ||
1214 | icalproperty_add_parameters(impl, args); | ||
1215 | va_end(args); | ||
1216 | return (icalproperty*)impl; | ||
1217 | } | ||
1218 | |||
1219 | /* OWNER */ | ||
1220 | icalproperty* icalproperty_new_owner(const char* v) { | ||
1221 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_OWNER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
1222 | |||
1223 | icalproperty_set_owner((icalproperty*)impl,v); | ||
1224 | return (icalproperty*)impl; | ||
1225 | } | ||
1226 | |||
1227 | void icalproperty_set_owner(icalproperty* prop, const char* v){ | ||
1228 | icalerror_check_arg_rv( (v!=0),"v"); | ||
1229 | |||
1230 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
1231 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
1232 | } | ||
1233 | const char* icalproperty_get_owner(const icalproperty* prop){ | ||
1234 | icalerror_check_arg( (prop!=0),"prop"); | ||
1235 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
1236 | } | ||
1043 | icalproperty* icalproperty_vanew_percentcomplete(int v, ...){ | 1237 | icalproperty* icalproperty_vanew_percentcomplete(int v, ...){ |
1044 | va_list args; | 1238 | va_list args; |
1045 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); | 1239 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); |
@@ -1049,6 +1243,7 @@ icalproperty* icalproperty_vanew_percentcomplete(int v, ...){ | |||
1049 | va_end(args); | 1243 | va_end(args); |
1050 | return (icalproperty*)impl; | 1244 | return (icalproperty*)impl; |
1051 | } | 1245 | } |
1246 | |||
1052 | /* PERCENT-COMPLETE */ | 1247 | /* PERCENT-COMPLETE */ |
1053 | icalproperty* icalproperty_new_percentcomplete(int v) { | 1248 | icalproperty* icalproperty_new_percentcomplete(int v) { |
1054 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); | 1249 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); |
@@ -1061,7 +1256,7 @@ void icalproperty_set_percentcomplete(icalproperty* prop, int v){ | |||
1061 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1256 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1062 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1257 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
1063 | } | 1258 | } |
1064 | int icalproperty_get_percentcomplete(icalproperty* prop){ | 1259 | int icalproperty_get_percentcomplete(const icalproperty* prop){ |
1065 | icalerror_check_arg( (prop!=0),"prop"); | 1260 | icalerror_check_arg( (prop!=0),"prop"); |
1066 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1261 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
1067 | } | 1262 | } |
@@ -1074,6 +1269,7 @@ icalproperty* icalproperty_vanew_priority(int v, ...){ | |||
1074 | va_end(args); | 1269 | va_end(args); |
1075 | return (icalproperty*)impl; | 1270 | return (icalproperty*)impl; |
1076 | } | 1271 | } |
1272 | |||
1077 | /* PRIORITY */ | 1273 | /* PRIORITY */ |
1078 | icalproperty* icalproperty_new_priority(int v) { | 1274 | icalproperty* icalproperty_new_priority(int v) { |
1079 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY); | 1275 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY); |
@@ -1086,7 +1282,7 @@ void icalproperty_set_priority(icalproperty* prop, int v){ | |||
1086 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1282 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1087 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1283 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
1088 | } | 1284 | } |
1089 | int icalproperty_get_priority(icalproperty* prop){ | 1285 | int icalproperty_get_priority(const icalproperty* prop){ |
1090 | icalerror_check_arg( (prop!=0),"prop"); | 1286 | icalerror_check_arg( (prop!=0),"prop"); |
1091 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1287 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
1092 | } | 1288 | } |
@@ -1100,6 +1296,7 @@ icalproperty* icalproperty_vanew_prodid(const char* v, ...){ | |||
1100 | va_end(args); | 1296 | va_end(args); |
1101 | return (icalproperty*)impl; | 1297 | return (icalproperty*)impl; |
1102 | } | 1298 | } |
1299 | |||
1103 | /* PRODID */ | 1300 | /* PRODID */ |
1104 | icalproperty* icalproperty_new_prodid(const char* v) { | 1301 | icalproperty* icalproperty_new_prodid(const char* v) { |
1105 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1302 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1114,7 +1311,7 @@ void icalproperty_set_prodid(icalproperty* prop, const char* v){ | |||
1114 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1311 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1115 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1312 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1116 | } | 1313 | } |
1117 | const char* icalproperty_get_prodid(icalproperty* prop){ | 1314 | const char* icalproperty_get_prodid(const icalproperty* prop){ |
1118 | icalerror_check_arg( (prop!=0),"prop"); | 1315 | icalerror_check_arg( (prop!=0),"prop"); |
1119 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1316 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1120 | } | 1317 | } |
@@ -1128,6 +1325,7 @@ icalproperty* icalproperty_vanew_query(const char* v, ...){ | |||
1128 | va_end(args); | 1325 | va_end(args); |
1129 | return (icalproperty*)impl; | 1326 | return (icalproperty*)impl; |
1130 | } | 1327 | } |
1328 | |||
1131 | /* QUERY */ | 1329 | /* QUERY */ |
1132 | icalproperty* icalproperty_new_query(const char* v) { | 1330 | icalproperty* icalproperty_new_query(const char* v) { |
1133 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1331 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1142,7 +1340,7 @@ void icalproperty_set_query(icalproperty* prop, const char* v){ | |||
1142 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1340 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1143 | icalproperty_set_value(prop,icalvalue_new_query(v)); | 1341 | icalproperty_set_value(prop,icalvalue_new_query(v)); |
1144 | } | 1342 | } |
1145 | const char* icalproperty_get_query(icalproperty* prop){ | 1343 | const char* icalproperty_get_query(const icalproperty* prop){ |
1146 | icalerror_check_arg( (prop!=0),"prop"); | 1344 | icalerror_check_arg( (prop!=0),"prop"); |
1147 | return icalvalue_get_query(icalproperty_get_value(prop)); | 1345 | return icalvalue_get_query(icalproperty_get_value(prop)); |
1148 | } | 1346 | } |
@@ -1156,6 +1354,7 @@ icalproperty* icalproperty_vanew_queryname(const char* v, ...){ | |||
1156 | va_end(args); | 1354 | va_end(args); |
1157 | return (icalproperty*)impl; | 1355 | return (icalproperty*)impl; |
1158 | } | 1356 | } |
1357 | |||
1159 | /* QUERYNAME */ | 1358 | /* QUERYNAME */ |
1160 | icalproperty* icalproperty_new_queryname(const char* v) { | 1359 | icalproperty* icalproperty_new_queryname(const char* v) { |
1161 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1360 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1170,7 +1369,7 @@ void icalproperty_set_queryname(icalproperty* prop, const char* v){ | |||
1170 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1369 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1171 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1370 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1172 | } | 1371 | } |
1173 | const char* icalproperty_get_queryname(icalproperty* prop){ | 1372 | const char* icalproperty_get_queryname(const icalproperty* prop){ |
1174 | icalerror_check_arg( (prop!=0),"prop"); | 1373 | icalerror_check_arg( (prop!=0),"prop"); |
1175 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1374 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1176 | } | 1375 | } |
@@ -1183,6 +1382,7 @@ icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...){ | |||
1183 | va_end(args); | 1382 | va_end(args); |
1184 | return (icalproperty*)impl; | 1383 | return (icalproperty*)impl; |
1185 | } | 1384 | } |
1385 | |||
1186 | /* RDATE */ | 1386 | /* RDATE */ |
1187 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v) { | 1387 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v) { |
1188 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY); | 1388 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY); |
@@ -1195,7 +1395,7 @@ void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v) | |||
1195 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1395 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1196 | icalproperty_set_value(prop,icalvalue_new_datetimeperiod(v)); | 1396 | icalproperty_set_value(prop,icalvalue_new_datetimeperiod(v)); |
1197 | } | 1397 | } |
1198 | struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop){ | 1398 | struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop){ |
1199 | icalerror_check_arg( (prop!=0),"prop"); | 1399 | icalerror_check_arg( (prop!=0),"prop"); |
1200 | return icalvalue_get_datetimeperiod(icalproperty_get_value(prop)); | 1400 | return icalvalue_get_datetimeperiod(icalproperty_get_value(prop)); |
1201 | } | 1401 | } |
@@ -1208,6 +1408,7 @@ icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...){ | |||
1208 | va_end(args); | 1408 | va_end(args); |
1209 | return (icalproperty*)impl; | 1409 | return (icalproperty*)impl; |
1210 | } | 1410 | } |
1411 | |||
1211 | /* RECURRENCE-ID */ | 1412 | /* RECURRENCE-ID */ |
1212 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) { | 1413 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) { |
1213 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY); | 1414 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY); |
@@ -1216,11 +1417,16 @@ icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) { | |||
1216 | } | 1417 | } |
1217 | 1418 | ||
1218 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v){ | 1419 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v){ |
1420 | icalvalue *value; | ||
1219 | 1421 | ||
1220 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1422 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1221 | icalproperty_set_value(prop,icalvalue_new_datetime(v)); | 1423 | if (v.is_date) |
1424 | value = icalvalue_new_date(v); | ||
1425 | else | ||
1426 | value = icalvalue_new_datetime(v); | ||
1427 | icalproperty_set_value(prop,value); | ||
1222 | } | 1428 | } |
1223 | struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop){ | 1429 | struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop){ |
1224 | icalerror_check_arg( (prop!=0),"prop"); | 1430 | icalerror_check_arg( (prop!=0),"prop"); |
1225 | return icalvalue_get_datetime(icalproperty_get_value(prop)); | 1431 | return icalvalue_get_datetime(icalproperty_get_value(prop)); |
1226 | } | 1432 | } |
@@ -1234,6 +1440,7 @@ icalproperty* icalproperty_vanew_relatedto(const char* v, ...){ | |||
1234 | va_end(args); | 1440 | va_end(args); |
1235 | return (icalproperty*)impl; | 1441 | return (icalproperty*)impl; |
1236 | } | 1442 | } |
1443 | |||
1237 | /* RELATED-TO */ | 1444 | /* RELATED-TO */ |
1238 | icalproperty* icalproperty_new_relatedto(const char* v) { | 1445 | icalproperty* icalproperty_new_relatedto(const char* v) { |
1239 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1446 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1248,7 +1455,36 @@ void icalproperty_set_relatedto(icalproperty* prop, const char* v){ | |||
1248 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1455 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1249 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1456 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1250 | } | 1457 | } |
1251 | const char* icalproperty_get_relatedto(icalproperty* prop){ | 1458 | const char* icalproperty_get_relatedto(const icalproperty* prop){ |
1459 | icalerror_check_arg( (prop!=0),"prop"); | ||
1460 | return icalvalue_get_text(icalproperty_get_value(prop)); | ||
1461 | } | ||
1462 | icalproperty* icalproperty_vanew_relcalid(const char* v, ...){ | ||
1463 | va_list args; | ||
1464 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
1465 | |||
1466 | icalproperty_set_relcalid((icalproperty*)impl,v); | ||
1467 | va_start(args,v); | ||
1468 | icalproperty_add_parameters(impl, args); | ||
1469 | va_end(args); | ||
1470 | return (icalproperty*)impl; | ||
1471 | } | ||
1472 | |||
1473 | /* RELCALID */ | ||
1474 | icalproperty* icalproperty_new_relcalid(const char* v) { | ||
1475 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELCALID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
1476 | |||
1477 | icalproperty_set_relcalid((icalproperty*)impl,v); | ||
1478 | return (icalproperty*)impl; | ||
1479 | } | ||
1480 | |||
1481 | void icalproperty_set_relcalid(icalproperty* prop, const char* v){ | ||
1482 | icalerror_check_arg_rv( (v!=0),"v"); | ||
1483 | |||
1484 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
1485 | icalproperty_set_value(prop,icalvalue_new_text(v)); | ||
1486 | } | ||
1487 | const char* icalproperty_get_relcalid(const icalproperty* prop){ | ||
1252 | icalerror_check_arg( (prop!=0),"prop"); | 1488 | icalerror_check_arg( (prop!=0),"prop"); |
1253 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1489 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1254 | } | 1490 | } |
@@ -1261,6 +1497,7 @@ icalproperty* icalproperty_vanew_repeat(int v, ...){ | |||
1261 | va_end(args); | 1497 | va_end(args); |
1262 | return (icalproperty*)impl; | 1498 | return (icalproperty*)impl; |
1263 | } | 1499 | } |
1500 | |||
1264 | /* REPEAT */ | 1501 | /* REPEAT */ |
1265 | icalproperty* icalproperty_new_repeat(int v) { | 1502 | icalproperty* icalproperty_new_repeat(int v) { |
1266 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY); | 1503 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY); |
@@ -1273,7 +1510,7 @@ void icalproperty_set_repeat(icalproperty* prop, int v){ | |||
1273 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1510 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1274 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1511 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
1275 | } | 1512 | } |
1276 | int icalproperty_get_repeat(icalproperty* prop){ | 1513 | int icalproperty_get_repeat(const icalproperty* prop){ |
1277 | icalerror_check_arg( (prop!=0),"prop"); | 1514 | icalerror_check_arg( (prop!=0),"prop"); |
1278 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1515 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
1279 | } | 1516 | } |
@@ -1286,6 +1523,7 @@ icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...){ | |||
1286 | va_end(args); | 1523 | va_end(args); |
1287 | return (icalproperty*)impl; | 1524 | return (icalproperty*)impl; |
1288 | } | 1525 | } |
1526 | |||
1289 | /* REQUEST-STATUS */ | 1527 | /* REQUEST-STATUS */ |
1290 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v) { | 1528 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v) { |
1291 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY); | 1529 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY); |
@@ -1298,7 +1536,7 @@ void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v | |||
1298 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1536 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1299 | icalproperty_set_value(prop,icalvalue_new_requeststatus(v)); | 1537 | icalproperty_set_value(prop,icalvalue_new_requeststatus(v)); |
1300 | } | 1538 | } |
1301 | struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop){ | 1539 | struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop){ |
1302 | icalerror_check_arg( (prop!=0),"prop"); | 1540 | icalerror_check_arg( (prop!=0),"prop"); |
1303 | return icalvalue_get_requeststatus(icalproperty_get_value(prop)); | 1541 | return icalvalue_get_requeststatus(icalproperty_get_value(prop)); |
1304 | } | 1542 | } |
@@ -1312,6 +1550,7 @@ icalproperty* icalproperty_vanew_resources(const char* v, ...){ | |||
1312 | va_end(args); | 1550 | va_end(args); |
1313 | return (icalproperty*)impl; | 1551 | return (icalproperty*)impl; |
1314 | } | 1552 | } |
1553 | |||
1315 | /* RESOURCES */ | 1554 | /* RESOURCES */ |
1316 | icalproperty* icalproperty_new_resources(const char* v) { | 1555 | icalproperty* icalproperty_new_resources(const char* v) { |
1317 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1556 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1326,7 +1565,7 @@ void icalproperty_set_resources(icalproperty* prop, const char* v){ | |||
1326 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1565 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1327 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1566 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1328 | } | 1567 | } |
1329 | const char* icalproperty_get_resources(icalproperty* prop){ | 1568 | const char* icalproperty_get_resources(const icalproperty* prop){ |
1330 | icalerror_check_arg( (prop!=0),"prop"); | 1569 | icalerror_check_arg( (prop!=0),"prop"); |
1331 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1570 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1332 | } | 1571 | } |
@@ -1339,6 +1578,7 @@ icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...){ | |||
1339 | va_end(args); | 1578 | va_end(args); |
1340 | return (icalproperty*)impl; | 1579 | return (icalproperty*)impl; |
1341 | } | 1580 | } |
1581 | |||
1342 | /* RRULE */ | 1582 | /* RRULE */ |
1343 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v) { | 1583 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v) { |
1344 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY); | 1584 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY); |
@@ -1351,7 +1591,7 @@ void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v){ | |||
1351 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1591 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1352 | icalproperty_set_value(prop,icalvalue_new_recur(v)); | 1592 | icalproperty_set_value(prop,icalvalue_new_recur(v)); |
1353 | } | 1593 | } |
1354 | struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop){ | 1594 | struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop){ |
1355 | icalerror_check_arg( (prop!=0),"prop"); | 1595 | icalerror_check_arg( (prop!=0),"prop"); |
1356 | return icalvalue_get_recur(icalproperty_get_value(prop)); | 1596 | return icalvalue_get_recur(icalproperty_get_value(prop)); |
1357 | } | 1597 | } |
@@ -1365,6 +1605,7 @@ icalproperty* icalproperty_vanew_scope(const char* v, ...){ | |||
1365 | va_end(args); | 1605 | va_end(args); |
1366 | return (icalproperty*)impl; | 1606 | return (icalproperty*)impl; |
1367 | } | 1607 | } |
1608 | |||
1368 | /* SCOPE */ | 1609 | /* SCOPE */ |
1369 | icalproperty* icalproperty_new_scope(const char* v) { | 1610 | icalproperty* icalproperty_new_scope(const char* v) { |
1370 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1611 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1379,7 +1620,7 @@ void icalproperty_set_scope(icalproperty* prop, const char* v){ | |||
1379 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1620 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1380 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1621 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1381 | } | 1622 | } |
1382 | const char* icalproperty_get_scope(icalproperty* prop){ | 1623 | const char* icalproperty_get_scope(const icalproperty* prop){ |
1383 | icalerror_check_arg( (prop!=0),"prop"); | 1624 | icalerror_check_arg( (prop!=0),"prop"); |
1384 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1625 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1385 | } | 1626 | } |
@@ -1392,6 +1633,7 @@ icalproperty* icalproperty_vanew_sequence(int v, ...){ | |||
1392 | va_end(args); | 1633 | va_end(args); |
1393 | return (icalproperty*)impl; | 1634 | return (icalproperty*)impl; |
1394 | } | 1635 | } |
1636 | |||
1395 | /* SEQUENCE */ | 1637 | /* SEQUENCE */ |
1396 | icalproperty* icalproperty_new_sequence(int v) { | 1638 | icalproperty* icalproperty_new_sequence(int v) { |
1397 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY); | 1639 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY); |
@@ -1404,7 +1646,7 @@ void icalproperty_set_sequence(icalproperty* prop, int v){ | |||
1404 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1646 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1405 | icalproperty_set_value(prop,icalvalue_new_integer(v)); | 1647 | icalproperty_set_value(prop,icalvalue_new_integer(v)); |
1406 | } | 1648 | } |
1407 | int icalproperty_get_sequence(icalproperty* prop){ | 1649 | int icalproperty_get_sequence(const icalproperty* prop){ |
1408 | icalerror_check_arg( (prop!=0),"prop"); | 1650 | icalerror_check_arg( (prop!=0),"prop"); |
1409 | return icalvalue_get_integer(icalproperty_get_value(prop)); | 1651 | return icalvalue_get_integer(icalproperty_get_value(prop)); |
1410 | } | 1652 | } |
@@ -1417,6 +1659,7 @@ icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...){ | |||
1417 | va_end(args); | 1659 | va_end(args); |
1418 | return (icalproperty*)impl; | 1660 | return (icalproperty*)impl; |
1419 | } | 1661 | } |
1662 | |||
1420 | /* STATUS */ | 1663 | /* STATUS */ |
1421 | icalproperty* icalproperty_new_status(enum icalproperty_status v) { | 1664 | icalproperty* icalproperty_new_status(enum icalproperty_status v) { |
1422 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY); | 1665 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY); |
@@ -1429,7 +1672,7 @@ void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v){ | |||
1429 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1672 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1430 | icalproperty_set_value(prop,icalvalue_new_status(v)); | 1673 | icalproperty_set_value(prop,icalvalue_new_status(v)); |
1431 | } | 1674 | } |
1432 | enum icalproperty_status icalproperty_get_status(icalproperty* prop){ | 1675 | enum icalproperty_status icalproperty_get_status(const icalproperty* prop){ |
1433 | icalerror_check_arg( (prop!=0),"prop"); | 1676 | icalerror_check_arg( (prop!=0),"prop"); |
1434 | return icalvalue_get_status(icalproperty_get_value(prop)); | 1677 | return icalvalue_get_status(icalproperty_get_value(prop)); |
1435 | } | 1678 | } |
@@ -1443,6 +1686,7 @@ icalproperty* icalproperty_vanew_summary(const char* v, ...){ | |||
1443 | va_end(args); | 1686 | va_end(args); |
1444 | return (icalproperty*)impl; | 1687 | return (icalproperty*)impl; |
1445 | } | 1688 | } |
1689 | |||
1446 | /* SUMMARY */ | 1690 | /* SUMMARY */ |
1447 | icalproperty* icalproperty_new_summary(const char* v) { | 1691 | icalproperty* icalproperty_new_summary(const char* v) { |
1448 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1692 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1457,7 +1701,7 @@ void icalproperty_set_summary(icalproperty* prop, const char* v){ | |||
1457 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1701 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1458 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1702 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1459 | } | 1703 | } |
1460 | const char* icalproperty_get_summary(icalproperty* prop){ | 1704 | const char* icalproperty_get_summary(const icalproperty* prop){ |
1461 | icalerror_check_arg( (prop!=0),"prop"); | 1705 | icalerror_check_arg( (prop!=0),"prop"); |
1462 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1706 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1463 | } | 1707 | } |
@@ -1471,6 +1715,7 @@ icalproperty* icalproperty_vanew_target(const char* v, ...){ | |||
1471 | va_end(args); | 1715 | va_end(args); |
1472 | return (icalproperty*)impl; | 1716 | return (icalproperty*)impl; |
1473 | } | 1717 | } |
1718 | |||
1474 | /* TARGET */ | 1719 | /* TARGET */ |
1475 | icalproperty* icalproperty_new_target(const char* v) { | 1720 | icalproperty* icalproperty_new_target(const char* v) { |
1476 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1721 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1485,37 +1730,35 @@ void icalproperty_set_target(icalproperty* prop, const char* v){ | |||
1485 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1730 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1486 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); | 1731 | icalproperty_set_value(prop,icalvalue_new_caladdress(v)); |
1487 | } | 1732 | } |
1488 | const char* icalproperty_get_target(icalproperty* prop){ | 1733 | const char* icalproperty_get_target(const icalproperty* prop){ |
1489 | icalerror_check_arg( (prop!=0),"prop"); | 1734 | icalerror_check_arg( (prop!=0),"prop"); |
1490 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); | 1735 | return icalvalue_get_caladdress(icalproperty_get_value(prop)); |
1491 | } | 1736 | } |
1492 | icalproperty* icalproperty_vanew_transp(const char* v, ...){ | 1737 | icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...){ |
1493 | va_list args; | 1738 | va_list args; |
1494 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1739 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); |
1495 | |||
1496 | icalproperty_set_transp((icalproperty*)impl,v); | 1740 | icalproperty_set_transp((icalproperty*)impl,v); |
1497 | va_start(args,v); | 1741 | va_start(args,v); |
1498 | icalproperty_add_parameters(impl, args); | 1742 | icalproperty_add_parameters(impl, args); |
1499 | va_end(args); | 1743 | va_end(args); |
1500 | return (icalproperty*)impl; | 1744 | return (icalproperty*)impl; |
1501 | } | 1745 | } |
1502 | /* TRANSP */ | ||
1503 | icalproperty* icalproperty_new_transp(const char* v) { | ||
1504 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | ||
1505 | 1746 | ||
1747 | /* TRANSP */ | ||
1748 | icalproperty* icalproperty_new_transp(enum icalproperty_transp v) { | ||
1749 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); | ||
1506 | icalproperty_set_transp((icalproperty*)impl,v); | 1750 | icalproperty_set_transp((icalproperty*)impl,v); |
1507 | return (icalproperty*)impl; | 1751 | return (icalproperty*)impl; |
1508 | } | 1752 | } |
1509 | 1753 | ||
1510 | void icalproperty_set_transp(icalproperty* prop, const char* v){ | 1754 | void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v){ |
1511 | icalerror_check_arg_rv( (v!=0),"v"); | 1755 | |
1512 | |||
1513 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1756 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1514 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1757 | icalproperty_set_value(prop,icalvalue_new_transp(v)); |
1515 | } | 1758 | } |
1516 | const char* icalproperty_get_transp(icalproperty* prop){ | 1759 | enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop){ |
1517 | icalerror_check_arg( (prop!=0),"prop"); | 1760 | icalerror_check_arg( (prop!=0),"prop"); |
1518 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1761 | return icalvalue_get_transp(icalproperty_get_value(prop)); |
1519 | } | 1762 | } |
1520 | icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...){ | 1763 | icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...){ |
1521 | va_list args; | 1764 | va_list args; |
@@ -1526,6 +1769,7 @@ icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...){ | |||
1526 | va_end(args); | 1769 | va_end(args); |
1527 | return (icalproperty*)impl; | 1770 | return (icalproperty*)impl; |
1528 | } | 1771 | } |
1772 | |||
1529 | /* TRIGGER */ | 1773 | /* TRIGGER */ |
1530 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v) { | 1774 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v) { |
1531 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY); | 1775 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY); |
@@ -1538,7 +1782,7 @@ void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v){ | |||
1538 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1782 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1539 | icalproperty_set_value(prop,icalvalue_new_trigger(v)); | 1783 | icalproperty_set_value(prop,icalvalue_new_trigger(v)); |
1540 | } | 1784 | } |
1541 | struct icaltriggertype icalproperty_get_trigger(icalproperty* prop){ | 1785 | struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop){ |
1542 | icalerror_check_arg( (prop!=0),"prop"); | 1786 | icalerror_check_arg( (prop!=0),"prop"); |
1543 | return icalvalue_get_trigger(icalproperty_get_value(prop)); | 1787 | return icalvalue_get_trigger(icalproperty_get_value(prop)); |
1544 | } | 1788 | } |
@@ -1552,6 +1796,7 @@ icalproperty* icalproperty_vanew_tzid(const char* v, ...){ | |||
1552 | va_end(args); | 1796 | va_end(args); |
1553 | return (icalproperty*)impl; | 1797 | return (icalproperty*)impl; |
1554 | } | 1798 | } |
1799 | |||
1555 | /* TZID */ | 1800 | /* TZID */ |
1556 | icalproperty* icalproperty_new_tzid(const char* v) { | 1801 | icalproperty* icalproperty_new_tzid(const char* v) { |
1557 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1802 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1566,7 +1811,7 @@ void icalproperty_set_tzid(icalproperty* prop, const char* v){ | |||
1566 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1811 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1567 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1812 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1568 | } | 1813 | } |
1569 | const char* icalproperty_get_tzid(icalproperty* prop){ | 1814 | const char* icalproperty_get_tzid(const icalproperty* prop){ |
1570 | icalerror_check_arg( (prop!=0),"prop"); | 1815 | icalerror_check_arg( (prop!=0),"prop"); |
1571 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1816 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1572 | } | 1817 | } |
@@ -1580,6 +1825,7 @@ icalproperty* icalproperty_vanew_tzname(const char* v, ...){ | |||
1580 | va_end(args); | 1825 | va_end(args); |
1581 | return (icalproperty*)impl; | 1826 | return (icalproperty*)impl; |
1582 | } | 1827 | } |
1828 | |||
1583 | /* TZNAME */ | 1829 | /* TZNAME */ |
1584 | icalproperty* icalproperty_new_tzname(const char* v) { | 1830 | icalproperty* icalproperty_new_tzname(const char* v) { |
1585 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1831 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1594,7 +1840,7 @@ void icalproperty_set_tzname(icalproperty* prop, const char* v){ | |||
1594 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1840 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1595 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1841 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1596 | } | 1842 | } |
1597 | const char* icalproperty_get_tzname(icalproperty* prop){ | 1843 | const char* icalproperty_get_tzname(const icalproperty* prop){ |
1598 | icalerror_check_arg( (prop!=0),"prop"); | 1844 | icalerror_check_arg( (prop!=0),"prop"); |
1599 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1845 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1600 | } | 1846 | } |
@@ -1607,6 +1853,7 @@ icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...){ | |||
1607 | va_end(args); | 1853 | va_end(args); |
1608 | return (icalproperty*)impl; | 1854 | return (icalproperty*)impl; |
1609 | } | 1855 | } |
1856 | |||
1610 | /* TZOFFSETFROM */ | 1857 | /* TZOFFSETFROM */ |
1611 | icalproperty* icalproperty_new_tzoffsetfrom(int v) { | 1858 | icalproperty* icalproperty_new_tzoffsetfrom(int v) { |
1612 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY); | 1859 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY); |
@@ -1619,7 +1866,7 @@ void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v){ | |||
1619 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1866 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1620 | icalproperty_set_value(prop,icalvalue_new_utcoffset(v)); | 1867 | icalproperty_set_value(prop,icalvalue_new_utcoffset(v)); |
1621 | } | 1868 | } |
1622 | int icalproperty_get_tzoffsetfrom(icalproperty* prop){ | 1869 | int icalproperty_get_tzoffsetfrom(const icalproperty* prop){ |
1623 | icalerror_check_arg( (prop!=0),"prop"); | 1870 | icalerror_check_arg( (prop!=0),"prop"); |
1624 | return icalvalue_get_utcoffset(icalproperty_get_value(prop)); | 1871 | return icalvalue_get_utcoffset(icalproperty_get_value(prop)); |
1625 | } | 1872 | } |
@@ -1632,6 +1879,7 @@ icalproperty* icalproperty_vanew_tzoffsetto(int v, ...){ | |||
1632 | va_end(args); | 1879 | va_end(args); |
1633 | return (icalproperty*)impl; | 1880 | return (icalproperty*)impl; |
1634 | } | 1881 | } |
1882 | |||
1635 | /* TZOFFSETTO */ | 1883 | /* TZOFFSETTO */ |
1636 | icalproperty* icalproperty_new_tzoffsetto(int v) { | 1884 | icalproperty* icalproperty_new_tzoffsetto(int v) { |
1637 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY); | 1885 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY); |
@@ -1644,7 +1892,7 @@ void icalproperty_set_tzoffsetto(icalproperty* prop, int v){ | |||
1644 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1892 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1645 | icalproperty_set_value(prop,icalvalue_new_utcoffset(v)); | 1893 | icalproperty_set_value(prop,icalvalue_new_utcoffset(v)); |
1646 | } | 1894 | } |
1647 | int icalproperty_get_tzoffsetto(icalproperty* prop){ | 1895 | int icalproperty_get_tzoffsetto(const icalproperty* prop){ |
1648 | icalerror_check_arg( (prop!=0),"prop"); | 1896 | icalerror_check_arg( (prop!=0),"prop"); |
1649 | return icalvalue_get_utcoffset(icalproperty_get_value(prop)); | 1897 | return icalvalue_get_utcoffset(icalproperty_get_value(prop)); |
1650 | } | 1898 | } |
@@ -1658,6 +1906,7 @@ icalproperty* icalproperty_vanew_tzurl(const char* v, ...){ | |||
1658 | va_end(args); | 1906 | va_end(args); |
1659 | return (icalproperty*)impl; | 1907 | return (icalproperty*)impl; |
1660 | } | 1908 | } |
1909 | |||
1661 | /* TZURL */ | 1910 | /* TZURL */ |
1662 | icalproperty* icalproperty_new_tzurl(const char* v) { | 1911 | icalproperty* icalproperty_new_tzurl(const char* v) { |
1663 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1912 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1672,7 +1921,7 @@ void icalproperty_set_tzurl(icalproperty* prop, const char* v){ | |||
1672 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1921 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1673 | icalproperty_set_value(prop,icalvalue_new_uri(v)); | 1922 | icalproperty_set_value(prop,icalvalue_new_uri(v)); |
1674 | } | 1923 | } |
1675 | const char* icalproperty_get_tzurl(icalproperty* prop){ | 1924 | const char* icalproperty_get_tzurl(const icalproperty* prop){ |
1676 | icalerror_check_arg( (prop!=0),"prop"); | 1925 | icalerror_check_arg( (prop!=0),"prop"); |
1677 | return icalvalue_get_uri(icalproperty_get_value(prop)); | 1926 | return icalvalue_get_uri(icalproperty_get_value(prop)); |
1678 | } | 1927 | } |
@@ -1686,6 +1935,7 @@ icalproperty* icalproperty_vanew_uid(const char* v, ...){ | |||
1686 | va_end(args); | 1935 | va_end(args); |
1687 | return (icalproperty*)impl; | 1936 | return (icalproperty*)impl; |
1688 | } | 1937 | } |
1938 | |||
1689 | /* UID */ | 1939 | /* UID */ |
1690 | icalproperty* icalproperty_new_uid(const char* v) { | 1940 | icalproperty* icalproperty_new_uid(const char* v) { |
1691 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1941 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1700,7 +1950,7 @@ void icalproperty_set_uid(icalproperty* prop, const char* v){ | |||
1700 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1950 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1701 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 1951 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1702 | } | 1952 | } |
1703 | const char* icalproperty_get_uid(icalproperty* prop){ | 1953 | const char* icalproperty_get_uid(const icalproperty* prop){ |
1704 | icalerror_check_arg( (prop!=0),"prop"); | 1954 | icalerror_check_arg( (prop!=0),"prop"); |
1705 | return icalvalue_get_text(icalproperty_get_value(prop)); | 1955 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1706 | } | 1956 | } |
@@ -1714,6 +1964,7 @@ icalproperty* icalproperty_vanew_url(const char* v, ...){ | |||
1714 | va_end(args); | 1964 | va_end(args); |
1715 | return (icalproperty*)impl; | 1965 | return (icalproperty*)impl; |
1716 | } | 1966 | } |
1967 | |||
1717 | /* URL */ | 1968 | /* URL */ |
1718 | icalproperty* icalproperty_new_url(const char* v) { | 1969 | icalproperty* icalproperty_new_url(const char* v) { |
1719 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1970 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1728,7 +1979,7 @@ void icalproperty_set_url(icalproperty* prop, const char* v){ | |||
1728 | icalerror_check_arg_rv( (prop!=0),"prop"); | 1979 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1729 | icalproperty_set_value(prop,icalvalue_new_uri(v)); | 1980 | icalproperty_set_value(prop,icalvalue_new_uri(v)); |
1730 | } | 1981 | } |
1731 | const char* icalproperty_get_url(icalproperty* prop){ | 1982 | const char* icalproperty_get_url(const icalproperty* prop){ |
1732 | icalerror_check_arg( (prop!=0),"prop"); | 1983 | icalerror_check_arg( (prop!=0),"prop"); |
1733 | return icalvalue_get_uri(icalproperty_get_value(prop)); | 1984 | return icalvalue_get_uri(icalproperty_get_value(prop)); |
1734 | } | 1985 | } |
@@ -1742,6 +1993,7 @@ icalproperty* icalproperty_vanew_version(const char* v, ...){ | |||
1742 | va_end(args); | 1993 | va_end(args); |
1743 | return (icalproperty*)impl; | 1994 | return (icalproperty*)impl; |
1744 | } | 1995 | } |
1996 | |||
1745 | /* VERSION */ | 1997 | /* VERSION */ |
1746 | icalproperty* icalproperty_new_version(const char* v) { | 1998 | icalproperty* icalproperty_new_version(const char* v) { |
1747 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 1999 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1756,7 +2008,7 @@ void icalproperty_set_version(icalproperty* prop, const char* v){ | |||
1756 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2008 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1757 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 2009 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1758 | } | 2010 | } |
1759 | const char* icalproperty_get_version(icalproperty* prop){ | 2011 | const char* icalproperty_get_version(const icalproperty* prop){ |
1760 | icalerror_check_arg( (prop!=0),"prop"); | 2012 | icalerror_check_arg( (prop!=0),"prop"); |
1761 | return icalvalue_get_text(icalproperty_get_value(prop)); | 2013 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1762 | } | 2014 | } |
@@ -1770,6 +2022,7 @@ icalproperty* icalproperty_vanew_x(const char* v, ...){ | |||
1770 | va_end(args); | 2022 | va_end(args); |
1771 | return (icalproperty*)impl; | 2023 | return (icalproperty*)impl; |
1772 | } | 2024 | } |
2025 | |||
1773 | /* X */ | 2026 | /* X */ |
1774 | icalproperty* icalproperty_new_x(const char* v) { | 2027 | icalproperty* icalproperty_new_x(const char* v) { |
1775 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2028 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1782,11 +2035,37 @@ void icalproperty_set_x(icalproperty* prop, const char* v){ | |||
1782 | icalerror_check_arg_rv( (v!=0),"v"); | 2035 | icalerror_check_arg_rv( (v!=0),"v"); |
1783 | 2036 | ||
1784 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2037 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1785 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 2038 | icalproperty_set_value(prop,icalvalue_new_x(v)); |
1786 | } | 2039 | } |
1787 | const char* icalproperty_get_x(icalproperty* prop){ | 2040 | const char* icalproperty_get_x(const icalproperty* prop){ |
1788 | icalerror_check_arg( (prop!=0),"prop"); | 2041 | icalerror_check_arg( (prop!=0),"prop"); |
1789 | return icalvalue_get_text(icalproperty_get_value(prop)); | 2042 | return icalvalue_get_x(icalproperty_get_value(prop)); |
2043 | } | ||
2044 | icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...){ | ||
2045 | va_list args; | ||
2046 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLASS_PROPERTY); | ||
2047 | icalproperty_set_xlicclass((icalproperty*)impl,v); | ||
2048 | va_start(args,v); | ||
2049 | icalproperty_add_parameters(impl, args); | ||
2050 | va_end(args); | ||
2051 | return (icalproperty*)impl; | ||
2052 | } | ||
2053 | |||
2054 | /* X-LIC-CLASS */ | ||
2055 | icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v) { | ||
2056 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLASS_PROPERTY); | ||
2057 | icalproperty_set_xlicclass((icalproperty*)impl,v); | ||
2058 | return (icalproperty*)impl; | ||
2059 | } | ||
2060 | |||
2061 | void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v){ | ||
2062 | |||
2063 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
2064 | icalproperty_set_value(prop,icalvalue_new_xlicclass(v)); | ||
2065 | } | ||
2066 | enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop){ | ||
2067 | icalerror_check_arg( (prop!=0),"prop"); | ||
2068 | return icalvalue_get_xlicclass(icalproperty_get_value(prop)); | ||
1790 | } | 2069 | } |
1791 | icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){ | 2070 | icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){ |
1792 | va_list args; | 2071 | va_list args; |
@@ -1798,6 +2077,7 @@ icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){ | |||
1798 | va_end(args); | 2077 | va_end(args); |
1799 | return (icalproperty*)impl; | 2078 | return (icalproperty*)impl; |
1800 | } | 2079 | } |
2080 | |||
1801 | /* X-LIC-CLUSTERCOUNT */ | 2081 | /* X-LIC-CLUSTERCOUNT */ |
1802 | icalproperty* icalproperty_new_xlicclustercount(const char* v) { | 2082 | icalproperty* icalproperty_new_xlicclustercount(const char* v) { |
1803 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2083 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1812,7 +2092,7 @@ void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v){ | |||
1812 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2092 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1813 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2093 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1814 | } | 2094 | } |
1815 | const char* icalproperty_get_xlicclustercount(icalproperty* prop){ | 2095 | const char* icalproperty_get_xlicclustercount(const icalproperty* prop){ |
1816 | icalerror_check_arg( (prop!=0),"prop"); | 2096 | icalerror_check_arg( (prop!=0),"prop"); |
1817 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2097 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1818 | } | 2098 | } |
@@ -1826,6 +2106,7 @@ icalproperty* icalproperty_vanew_xlicerror(const char* v, ...){ | |||
1826 | va_end(args); | 2106 | va_end(args); |
1827 | return (icalproperty*)impl; | 2107 | return (icalproperty*)impl; |
1828 | } | 2108 | } |
2109 | |||
1829 | /* X-LIC-ERROR */ | 2110 | /* X-LIC-ERROR */ |
1830 | icalproperty* icalproperty_new_xlicerror(const char* v) { | 2111 | icalproperty* icalproperty_new_xlicerror(const char* v) { |
1831 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2112 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1840,7 +2121,7 @@ void icalproperty_set_xlicerror(icalproperty* prop, const char* v){ | |||
1840 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2121 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1841 | icalproperty_set_value(prop,icalvalue_new_text(v)); | 2122 | icalproperty_set_value(prop,icalvalue_new_text(v)); |
1842 | } | 2123 | } |
1843 | const char* icalproperty_get_xlicerror(icalproperty* prop){ | 2124 | const char* icalproperty_get_xlicerror(const icalproperty* prop){ |
1844 | icalerror_check_arg( (prop!=0),"prop"); | 2125 | icalerror_check_arg( (prop!=0),"prop"); |
1845 | return icalvalue_get_text(icalproperty_get_value(prop)); | 2126 | return icalvalue_get_text(icalproperty_get_value(prop)); |
1846 | } | 2127 | } |
@@ -1854,6 +2135,7 @@ icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...){ | |||
1854 | va_end(args); | 2135 | va_end(args); |
1855 | return (icalproperty*)impl; | 2136 | return (icalproperty*)impl; |
1856 | } | 2137 | } |
2138 | |||
1857 | /* X-LIC-MIMECHARSET */ | 2139 | /* X-LIC-MIMECHARSET */ |
1858 | icalproperty* icalproperty_new_xlicmimecharset(const char* v) { | 2140 | icalproperty* icalproperty_new_xlicmimecharset(const char* v) { |
1859 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2141 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1868,7 +2150,7 @@ void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v){ | |||
1868 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2150 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1869 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2151 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1870 | } | 2152 | } |
1871 | const char* icalproperty_get_xlicmimecharset(icalproperty* prop){ | 2153 | const char* icalproperty_get_xlicmimecharset(const icalproperty* prop){ |
1872 | icalerror_check_arg( (prop!=0),"prop"); | 2154 | icalerror_check_arg( (prop!=0),"prop"); |
1873 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2155 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1874 | } | 2156 | } |
@@ -1882,6 +2164,7 @@ icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...){ | |||
1882 | va_end(args); | 2164 | va_end(args); |
1883 | return (icalproperty*)impl; | 2165 | return (icalproperty*)impl; |
1884 | } | 2166 | } |
2167 | |||
1885 | /* X-LIC-MIMECID */ | 2168 | /* X-LIC-MIMECID */ |
1886 | icalproperty* icalproperty_new_xlicmimecid(const char* v) { | 2169 | icalproperty* icalproperty_new_xlicmimecid(const char* v) { |
1887 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2170 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1896,7 +2179,7 @@ void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v){ | |||
1896 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2179 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1897 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2180 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1898 | } | 2181 | } |
1899 | const char* icalproperty_get_xlicmimecid(icalproperty* prop){ | 2182 | const char* icalproperty_get_xlicmimecid(const icalproperty* prop){ |
1900 | icalerror_check_arg( (prop!=0),"prop"); | 2183 | icalerror_check_arg( (prop!=0),"prop"); |
1901 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2184 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1902 | } | 2185 | } |
@@ -1910,6 +2193,7 @@ icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...){ | |||
1910 | va_end(args); | 2193 | va_end(args); |
1911 | return (icalproperty*)impl; | 2194 | return (icalproperty*)impl; |
1912 | } | 2195 | } |
2196 | |||
1913 | /* X-LIC-MIMECONTENTTYPE */ | 2197 | /* X-LIC-MIMECONTENTTYPE */ |
1914 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v) { | 2198 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v) { |
1915 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2199 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1924,7 +2208,7 @@ void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v){ | |||
1924 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2208 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1925 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2209 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1926 | } | 2210 | } |
1927 | const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop){ | 2211 | const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop){ |
1928 | icalerror_check_arg( (prop!=0),"prop"); | 2212 | icalerror_check_arg( (prop!=0),"prop"); |
1929 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2213 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1930 | } | 2214 | } |
@@ -1938,6 +2222,7 @@ icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...){ | |||
1938 | va_end(args); | 2222 | va_end(args); |
1939 | return (icalproperty*)impl; | 2223 | return (icalproperty*)impl; |
1940 | } | 2224 | } |
2225 | |||
1941 | /* X-LIC-MIMEENCODING */ | 2226 | /* X-LIC-MIMEENCODING */ |
1942 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v) { | 2227 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v) { |
1943 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2228 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1952,7 +2237,7 @@ void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v){ | |||
1952 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2237 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1953 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2238 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1954 | } | 2239 | } |
1955 | const char* icalproperty_get_xlicmimeencoding(icalproperty* prop){ | 2240 | const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop){ |
1956 | icalerror_check_arg( (prop!=0),"prop"); | 2241 | icalerror_check_arg( (prop!=0),"prop"); |
1957 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2242 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1958 | } | 2243 | } |
@@ -1966,6 +2251,7 @@ icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...){ | |||
1966 | va_end(args); | 2251 | va_end(args); |
1967 | return (icalproperty*)impl; | 2252 | return (icalproperty*)impl; |
1968 | } | 2253 | } |
2254 | |||
1969 | /* X-LIC-MIMEFILENAME */ | 2255 | /* X-LIC-MIMEFILENAME */ |
1970 | icalproperty* icalproperty_new_xlicmimefilename(const char* v) { | 2256 | icalproperty* icalproperty_new_xlicmimefilename(const char* v) { |
1971 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2257 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -1980,7 +2266,7 @@ void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v){ | |||
1980 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2266 | icalerror_check_arg_rv( (prop!=0),"prop"); |
1981 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2267 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
1982 | } | 2268 | } |
1983 | const char* icalproperty_get_xlicmimefilename(icalproperty* prop){ | 2269 | const char* icalproperty_get_xlicmimefilename(const icalproperty* prop){ |
1984 | icalerror_check_arg( (prop!=0),"prop"); | 2270 | icalerror_check_arg( (prop!=0),"prop"); |
1985 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2271 | return icalvalue_get_string(icalproperty_get_value(prop)); |
1986 | } | 2272 | } |
@@ -1994,6 +2280,7 @@ icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...){ | |||
1994 | va_end(args); | 2280 | va_end(args); |
1995 | return (icalproperty*)impl; | 2281 | return (icalproperty*)impl; |
1996 | } | 2282 | } |
2283 | |||
1997 | /* X-LIC-MIMEOPTINFO */ | 2284 | /* X-LIC-MIMEOPTINFO */ |
1998 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v) { | 2285 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v) { |
1999 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); | 2286 | struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); |
@@ -2008,7 +2295,220 @@ void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v){ | |||
2008 | icalerror_check_arg_rv( (prop!=0),"prop"); | 2295 | icalerror_check_arg_rv( (prop!=0),"prop"); |
2009 | icalproperty_set_value(prop,icalvalue_new_string(v)); | 2296 | icalproperty_set_value(prop,icalvalue_new_string(v)); |
2010 | } | 2297 | } |
2011 | const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop){ | 2298 | const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop){ |
2012 | icalerror_check_arg( (prop!=0),"prop"); | 2299 | icalerror_check_arg( (prop!=0),"prop"); |
2013 | return icalvalue_get_string(icalproperty_get_value(prop)); | 2300 | return icalvalue_get_string(icalproperty_get_value(prop)); |
2014 | } | 2301 | } |
2302 | |||
2303 | int icalproperty_kind_is_valid(const icalproperty_kind kind) | ||
2304 | { | ||
2305 | int i = 0; | ||
2306 | do { | ||
2307 | if (property_map[i].kind == kind) | ||
2308 | return 1; | ||
2309 | } while (property_map[i++].kind != ICAL_NO_PROPERTY); | ||
2310 | |||
2311 | return 0; | ||
2312 | } | ||
2313 | |||
2314 | const char* icalproperty_kind_to_string(icalproperty_kind kind) | ||
2315 | { | ||
2316 | int i; | ||
2317 | |||
2318 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
2319 | if (property_map[i].kind == kind) { | ||
2320 | return property_map[i].name; | ||
2321 | } | ||
2322 | } | ||
2323 | |||
2324 | return 0; | ||
2325 | |||
2326 | } | ||
2327 | |||
2328 | |||
2329 | icalproperty_kind icalproperty_string_to_kind(const char* string) | ||
2330 | { | ||
2331 | int i; | ||
2332 | |||
2333 | if (string ==0 ) { | ||
2334 | return ICAL_NO_PROPERTY; | ||
2335 | } | ||
2336 | |||
2337 | |||
2338 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
2339 | if (strcmp(property_map[i].name, string) == 0) { | ||
2340 | return property_map[i].kind; | ||
2341 | } | ||
2342 | } | ||
2343 | |||
2344 | if(strncmp(string,"X-",2)==0){ | ||
2345 | return ICAL_X_PROPERTY; | ||
2346 | } | ||
2347 | |||
2348 | |||
2349 | return ICAL_NO_PROPERTY; | ||
2350 | } | ||
2351 | |||
2352 | |||
2353 | icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind) | ||
2354 | { | ||
2355 | int i; | ||
2356 | |||
2357 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
2358 | if ( property_map[i].value == kind ) { | ||
2359 | return property_map[i].kind; | ||
2360 | } | ||
2361 | } | ||
2362 | |||
2363 | return ICAL_NO_PROPERTY; | ||
2364 | } | ||
2365 | |||
2366 | |||
2367 | |||
2368 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind) | ||
2369 | { | ||
2370 | int i; | ||
2371 | |||
2372 | for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { | ||
2373 | if ( property_map[i].kind == kind ) { | ||
2374 | return property_map[i].value; | ||
2375 | } | ||
2376 | } | ||
2377 | |||
2378 | return ICAL_NO_VALUE; | ||
2379 | } | ||
2380 | |||
2381 | |||
2382 | const char* icalproperty_enum_to_string(int e) | ||
2383 | { | ||
2384 | icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e"); | ||
2385 | icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e"); | ||
2386 | |||
2387 | return enum_map[e-ICALPROPERTY_FIRST_ENUM].str; | ||
2388 | } | ||
2389 | |||
2390 | int icalproperty_kind_and_string_to_enum(const int kind, const char* str) | ||
2391 | { | ||
2392 | icalproperty_kind pkind; | ||
2393 | int i; | ||
2394 | |||
2395 | icalerror_check_arg_rz(str!=0,"str") | ||
2396 | |||
2397 | if ((pkind = icalproperty_value_kind_to_kind(kind)) == ICAL_NO_VALUE) | ||
2398 | return 0; | ||
2399 | |||
2400 | while(*str == ' '){ | ||
2401 | str++; | ||
2402 | } | ||
2403 | |||
2404 | for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
2405 | if (enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == pkind) | ||
2406 | break; | ||
2407 | } | ||
2408 | if (i == ICALPROPERTY_LAST_ENUM) | ||
2409 | return 0; | ||
2410 | |||
2411 | for (; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
2412 | if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) { | ||
2413 | return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum; | ||
2414 | } | ||
2415 | } | ||
2416 | |||
2417 | return 0; | ||
2418 | } | ||
2419 | |||
2420 | /** @deprecated please use icalproperty_kind_and_string_to_enum instead */ | ||
2421 | int icalproperty_string_to_enum(const char* str) | ||
2422 | { | ||
2423 | int i; | ||
2424 | |||
2425 | icalerror_check_arg_rz(str!=0,"str") | ||
2426 | |||
2427 | while(*str == ' '){ | ||
2428 | str++; | ||
2429 | } | ||
2430 | |||
2431 | for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
2432 | if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) { | ||
2433 | return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum; | ||
2434 | } | ||
2435 | } | ||
2436 | |||
2437 | return 0; | ||
2438 | } | ||
2439 | |||
2440 | int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e) | ||
2441 | { | ||
2442 | int i; | ||
2443 | |||
2444 | |||
2445 | for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) { | ||
2446 | if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e && | ||
2447 | enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){ | ||
2448 | return 1; | ||
2449 | } | ||
2450 | } | ||
2451 | |||
2452 | return 0; | ||
2453 | } | ||
2454 | |||
2455 | |||
2456 | const char* icalproperty_method_to_string(icalproperty_method method) | ||
2457 | { | ||
2458 | icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method"); | ||
2459 | icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method"); | ||
2460 | |||
2461 | return enum_map[method-ICALPROPERTY_FIRST_ENUM].str; | ||
2462 | } | ||
2463 | |||
2464 | icalproperty_method icalproperty_string_to_method(const char* str) | ||
2465 | { | ||
2466 | int i; | ||
2467 | |||
2468 | icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE) | ||
2469 | |||
2470 | while(*str == ' '){ | ||
2471 | str++; | ||
2472 | } | ||
2473 | |||
2474 | for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM; | ||
2475 | i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM; | ||
2476 | i++) { | ||
2477 | if ( strcmp(enum_map[i].str, str) == 0) { | ||
2478 | return (icalproperty_method)enum_map[i].prop_enum; | ||
2479 | } | ||
2480 | } | ||
2481 | |||
2482 | return ICAL_METHOD_NONE; | ||
2483 | } | ||
2484 | |||
2485 | |||
2486 | const char* icalenum_status_to_string(icalproperty_status status) | ||
2487 | { | ||
2488 | icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status"); | ||
2489 | icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status"); | ||
2490 | |||
2491 | return enum_map[status-ICALPROPERTY_FIRST_ENUM].str; | ||
2492 | } | ||
2493 | |||
2494 | icalproperty_status icalenum_string_to_status(const char* str) | ||
2495 | { | ||
2496 | int i; | ||
2497 | |||
2498 | icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE) | ||
2499 | |||
2500 | while(*str == ' '){ | ||
2501 | str++; | ||
2502 | } | ||
2503 | |||
2504 | for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM; | ||
2505 | i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM; | ||
2506 | i++) { | ||
2507 | if ( strcmp(enum_map[i].str, str) == 0) { | ||
2508 | return (icalproperty_status)enum_map[i].prop_enum; | ||
2509 | } | ||
2510 | } | ||
2511 | |||
2512 | return ICAL_STATUS_NONE; | ||
2513 | |||
2514 | } | ||
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 | |||
@@ -17,22 +17,28 @@ | |||
17 | #include "icalderivedvalue.h" | 17 | #include "icalderivedvalue.h" |
18 | #include "icalrecur.h" | 18 | #include "icalrecur.h" |
19 | 19 | ||
20 | typedef void icalproperty; | 20 | typedef struct icalproperty_impl icalproperty; |
21 | 21 | ||
22 | |||
23 | /* Everything below this line is machine generated. Do not edit. */ | ||
24 | typedef enum icalproperty_kind { | 22 | typedef enum icalproperty_kind { |
25 | ICAL_ANY_PROPERTY = 0, | 23 | ICAL_ANY_PROPERTY = 0, |
26 | ICAL_ACTION_PROPERTY, | 24 | ICAL_ACTION_PROPERTY, |
25 | ICAL_ALLOWCONFLICT_PROPERTY, | ||
27 | ICAL_ATTACH_PROPERTY, | 26 | ICAL_ATTACH_PROPERTY, |
28 | ICAL_ATTENDEE_PROPERTY, | 27 | ICAL_ATTENDEE_PROPERTY, |
28 | ICAL_CALID_PROPERTY, | ||
29 | ICAL_CALMASTER_PROPERTY, | ||
29 | ICAL_CALSCALE_PROPERTY, | 30 | ICAL_CALSCALE_PROPERTY, |
31 | ICAL_CARID_PROPERTY, | ||
30 | ICAL_CATEGORIES_PROPERTY, | 32 | ICAL_CATEGORIES_PROPERTY, |
31 | ICAL_CLASS_PROPERTY, | 33 | ICAL_CLASS_PROPERTY, |
32 | ICAL_COMMENT_PROPERTY, | 34 | ICAL_COMMENT_PROPERTY, |
33 | ICAL_COMPLETED_PROPERTY, | 35 | ICAL_COMPLETED_PROPERTY, |
34 | ICAL_CONTACT_PROPERTY, | 36 | ICAL_CONTACT_PROPERTY, |
35 | ICAL_CREATED_PROPERTY, | 37 | ICAL_CREATED_PROPERTY, |
38 | ICAL_DECREED_PROPERTY, | ||
39 | ICAL_DEFAULTCHARSET_PROPERTY, | ||
40 | ICAL_DEFAULTLOCALE_PROPERTY, | ||
41 | ICAL_DEFAULTTZID_PROPERTY, | ||
36 | ICAL_DESCRIPTION_PROPERTY, | 42 | ICAL_DESCRIPTION_PROPERTY, |
37 | ICAL_DTEND_PROPERTY, | 43 | ICAL_DTEND_PROPERTY, |
38 | ICAL_DTSTAMP_PROPERTY, | 44 | ICAL_DTSTAMP_PROPERTY, |
@@ -40,6 +46,7 @@ typedef enum icalproperty_kind { | |||
40 | ICAL_DUE_PROPERTY, | 46 | ICAL_DUE_PROPERTY, |
41 | ICAL_DURATION_PROPERTY, | 47 | ICAL_DURATION_PROPERTY, |
42 | ICAL_EXDATE_PROPERTY, | 48 | ICAL_EXDATE_PROPERTY, |
49 | ICAL_EXPAND_PROPERTY, | ||
43 | ICAL_EXRULE_PROPERTY, | 50 | ICAL_EXRULE_PROPERTY, |
44 | ICAL_FREEBUSY_PROPERTY, | 51 | ICAL_FREEBUSY_PROPERTY, |
45 | ICAL_GEO_PROPERTY, | 52 | ICAL_GEO_PROPERTY, |
@@ -49,6 +56,7 @@ typedef enum icalproperty_kind { | |||
49 | ICAL_MAXRESULTSSIZE_PROPERTY, | 56 | ICAL_MAXRESULTSSIZE_PROPERTY, |
50 | ICAL_METHOD_PROPERTY, | 57 | ICAL_METHOD_PROPERTY, |
51 | ICAL_ORGANIZER_PROPERTY, | 58 | ICAL_ORGANIZER_PROPERTY, |
59 | ICAL_OWNER_PROPERTY, | ||
52 | ICAL_PERCENTCOMPLETE_PROPERTY, | 60 | ICAL_PERCENTCOMPLETE_PROPERTY, |
53 | ICAL_PRIORITY_PROPERTY, | 61 | ICAL_PRIORITY_PROPERTY, |
54 | ICAL_PRODID_PROPERTY, | 62 | ICAL_PRODID_PROPERTY, |
@@ -57,6 +65,7 @@ typedef enum icalproperty_kind { | |||
57 | ICAL_RDATE_PROPERTY, | 65 | ICAL_RDATE_PROPERTY, |
58 | ICAL_RECURRENCEID_PROPERTY, | 66 | ICAL_RECURRENCEID_PROPERTY, |
59 | ICAL_RELATEDTO_PROPERTY, | 67 | ICAL_RELATEDTO_PROPERTY, |
68 | ICAL_RELCALID_PROPERTY, | ||
60 | ICAL_REPEAT_PROPERTY, | 69 | ICAL_REPEAT_PROPERTY, |
61 | ICAL_REQUESTSTATUS_PROPERTY, | 70 | ICAL_REQUESTSTATUS_PROPERTY, |
62 | ICAL_RESOURCES_PROPERTY, | 71 | ICAL_RESOURCES_PROPERTY, |
@@ -77,6 +86,7 @@ typedef enum icalproperty_kind { | |||
77 | ICAL_URL_PROPERTY, | 86 | ICAL_URL_PROPERTY, |
78 | ICAL_VERSION_PROPERTY, | 87 | ICAL_VERSION_PROPERTY, |
79 | ICAL_X_PROPERTY, | 88 | ICAL_X_PROPERTY, |
89 | ICAL_XLICCLASS_PROPERTY, | ||
80 | ICAL_XLICCLUSTERCOUNT_PROPERTY, | 90 | ICAL_XLICCLUSTERCOUNT_PROPERTY, |
81 | ICAL_XLICERROR_PROPERTY, | 91 | ICAL_XLICERROR_PROPERTY, |
82 | ICAL_XLICMIMECHARSET_PROPERTY, | 92 | ICAL_XLICMIMECHARSET_PROPERTY, |
@@ -88,316 +98,376 @@ typedef enum icalproperty_kind { | |||
88 | ICAL_NO_PROPERTY | 98 | ICAL_NO_PROPERTY |
89 | } icalproperty_kind; | 99 | } icalproperty_kind; |
90 | 100 | ||
91 | icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...); | ||
92 | 101 | ||
93 | /* ACTION */ | 102 | /* ACTION */ |
94 | icalproperty* icalproperty_new_action(enum icalproperty_action v); | 103 | icalproperty* icalproperty_new_action(enum icalproperty_action v); |
95 | void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v); | 104 | void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v); |
96 | enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...); | 105 | enum icalproperty_action icalproperty_get_action(const icalproperty* prop);icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...); |
106 | |||
107 | /* ALLOW-CONFLICT */ | ||
108 | icalproperty* icalproperty_new_allowconflict(const char* v); | ||
109 | void icalproperty_set_allowconflict(icalproperty* prop, const char* v); | ||
110 | const char* icalproperty_get_allowconflict(const icalproperty* prop);icalproperty* icalproperty_vanew_allowconflict(const char* v, ...); | ||
97 | 111 | ||
98 | /* ATTACH */ | 112 | /* ATTACH */ |
99 | icalproperty* icalproperty_new_attach(struct icalattachtype* v); | 113 | icalproperty* icalproperty_new_attach(icalattach * v); |
100 | void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v); | 114 | void icalproperty_set_attach(icalproperty* prop, icalattach * v); |
101 | struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...); | 115 | icalattach * icalproperty_get_attach(const icalproperty* prop);icalproperty* icalproperty_vanew_attach(icalattach * v, ...); |
102 | 116 | ||
103 | /* ATTENDEE */ | 117 | /* ATTENDEE */ |
104 | icalproperty* icalproperty_new_attendee(const char* v); | 118 | icalproperty* icalproperty_new_attendee(const char* v); |
105 | void icalproperty_set_attendee(icalproperty* prop, const char* v); | 119 | void icalproperty_set_attendee(icalproperty* prop, const char* v); |
106 | const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...); | 120 | const char* icalproperty_get_attendee(const icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...); |
121 | |||
122 | /* CALID */ | ||
123 | icalproperty* icalproperty_new_calid(const char* v); | ||
124 | void icalproperty_set_calid(icalproperty* prop, const char* v); | ||
125 | const char* icalproperty_get_calid(const icalproperty* prop);icalproperty* icalproperty_vanew_calid(const char* v, ...); | ||
126 | |||
127 | /* CALMASTER */ | ||
128 | icalproperty* icalproperty_new_calmaster(const char* v); | ||
129 | void icalproperty_set_calmaster(icalproperty* prop, const char* v); | ||
130 | const char* icalproperty_get_calmaster(const icalproperty* prop);icalproperty* icalproperty_vanew_calmaster(const char* v, ...); | ||
107 | 131 | ||
108 | /* CALSCALE */ | 132 | /* CALSCALE */ |
109 | icalproperty* icalproperty_new_calscale(const char* v); | 133 | icalproperty* icalproperty_new_calscale(const char* v); |
110 | void icalproperty_set_calscale(icalproperty* prop, const char* v); | 134 | void icalproperty_set_calscale(icalproperty* prop, const char* v); |
111 | const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...); | 135 | const char* icalproperty_get_calscale(const icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...); |
136 | |||
137 | /* CARID */ | ||
138 | icalproperty* icalproperty_new_carid(const char* v); | ||
139 | void icalproperty_set_carid(icalproperty* prop, const char* v); | ||
140 | const char* icalproperty_get_carid(const icalproperty* prop);icalproperty* icalproperty_vanew_carid(const char* v, ...); | ||
112 | 141 | ||
113 | /* CATEGORIES */ | 142 | /* CATEGORIES */ |
114 | icalproperty* icalproperty_new_categories(const char* v); | 143 | icalproperty* icalproperty_new_categories(const char* v); |
115 | void icalproperty_set_categories(icalproperty* prop, const char* v); | 144 | void icalproperty_set_categories(icalproperty* prop, const char* v); |
116 | const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...); | 145 | const char* icalproperty_get_categories(const icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...); |
117 | 146 | ||
118 | /* CLASS */ | 147 | /* CLASS */ |
119 | icalproperty* icalproperty_new_class(const char* v); | 148 | icalproperty* icalproperty_new_class(enum icalproperty_class v); |
120 | void icalproperty_set_class(icalproperty* prop, const char* v); | 149 | void icalproperty_set_class(icalproperty* prop, enum icalproperty_class v); |
121 | const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...); | 150 | enum icalproperty_class icalproperty_get_class(const icalproperty* prop);icalproperty* icalproperty_vanew_class(enum icalproperty_class v, ...); |
122 | 151 | ||
123 | /* COMMENT */ | 152 | /* COMMENT */ |
124 | icalproperty* icalproperty_new_comment(const char* v); | 153 | icalproperty* icalproperty_new_comment(const char* v); |
125 | void icalproperty_set_comment(icalproperty* prop, const char* v); | 154 | void icalproperty_set_comment(icalproperty* prop, const char* v); |
126 | const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); | 155 | const char* icalproperty_get_comment(const icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...); |
127 | 156 | ||
128 | /* COMPLETED */ | 157 | /* COMPLETED */ |
129 | icalproperty* icalproperty_new_completed(struct icaltimetype v); | 158 | icalproperty* icalproperty_new_completed(struct icaltimetype v); |
130 | void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v); | 159 | void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v); |
131 | struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...); | 160 | struct icaltimetype icalproperty_get_completed(const icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); |
132 | 161 | ||
133 | /* CONTACT */ | 162 | /* CONTACT */ |
134 | icalproperty* icalproperty_new_contact(const char* v); | 163 | icalproperty* icalproperty_new_contact(const char* v); |
135 | void icalproperty_set_contact(icalproperty* prop, const char* v); | 164 | void icalproperty_set_contact(icalproperty* prop, const char* v); |
136 | const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...); | 165 | const char* icalproperty_get_contact(const icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...); |
137 | 166 | ||
138 | /* CREATED */ | 167 | /* CREATED */ |
139 | icalproperty* icalproperty_new_created(struct icaltimetype v); | 168 | icalproperty* icalproperty_new_created(struct icaltimetype v); |
140 | void icalproperty_set_created(icalproperty* prop, struct icaltimetype v); | 169 | void icalproperty_set_created(icalproperty* prop, struct icaltimetype v); |
141 | struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...); | 170 | struct icaltimetype icalproperty_get_created(const icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...); |
171 | |||
172 | /* DECREED */ | ||
173 | icalproperty* icalproperty_new_decreed(const char* v); | ||
174 | void icalproperty_set_decreed(icalproperty* prop, const char* v); | ||
175 | const char* icalproperty_get_decreed(const icalproperty* prop);icalproperty* icalproperty_vanew_decreed(const char* v, ...); | ||
176 | |||
177 | /* DEFAULT-CHARSET */ | ||
178 | icalproperty* icalproperty_new_defaultcharset(const char* v); | ||
179 | void icalproperty_set_defaultcharset(icalproperty* prop, const char* v); | ||
180 | const char* icalproperty_get_defaultcharset(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultcharset(const char* v, ...); | ||
181 | |||
182 | /* DEFAULT-LOCALE */ | ||
183 | icalproperty* icalproperty_new_defaultlocale(const char* v); | ||
184 | void icalproperty_set_defaultlocale(icalproperty* prop, const char* v); | ||
185 | const char* icalproperty_get_defaultlocale(const icalproperty* prop);icalproperty* icalproperty_vanew_defaultlocale(const char* v, ...); | ||
186 | |||
187 | /* DEFAULT-TZID */ | ||
188 | icalproperty* icalproperty_new_defaulttzid(const char* v); | ||
189 | void icalproperty_set_defaulttzid(icalproperty* prop, const char* v); | ||
190 | const char* icalproperty_get_defaulttzid(const icalproperty* prop);icalproperty* icalproperty_vanew_defaulttzid(const char* v, ...); | ||
142 | 191 | ||
143 | /* DESCRIPTION */ | 192 | /* DESCRIPTION */ |
144 | icalproperty* icalproperty_new_description(const char* v); | 193 | icalproperty* icalproperty_new_description(const char* v); |
145 | void icalproperty_set_description(icalproperty* prop, const char* v); | 194 | void icalproperty_set_description(icalproperty* prop, const char* v); |
146 | const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...); | 195 | const char* icalproperty_get_description(const icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...); |
147 | 196 | ||
148 | /* DTEND */ | 197 | /* DTEND */ |
149 | icalproperty* icalproperty_new_dtend(struct icaltimetype v); | 198 | icalproperty* icalproperty_new_dtend(struct icaltimetype v); |
150 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v); | 199 | void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v); |
151 | struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...); | 200 | struct icaltimetype icalproperty_get_dtend(const icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...); |
152 | 201 | ||
153 | /* DTSTAMP */ | 202 | /* DTSTAMP */ |
154 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v); | 203 | icalproperty* icalproperty_new_dtstamp(struct icaltimetype v); |
155 | void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v); | 204 | void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v); |
156 | struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...); | 205 | struct icaltimetype icalproperty_get_dtstamp(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...); |
157 | 206 | ||
158 | /* DTSTART */ | 207 | /* DTSTART */ |
159 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v); | 208 | icalproperty* icalproperty_new_dtstart(struct icaltimetype v); |
160 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v); | 209 | void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v); |
161 | struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...); | 210 | struct icaltimetype icalproperty_get_dtstart(const icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...); |
162 | 211 | ||
163 | /* DUE */ | 212 | /* DUE */ |
164 | icalproperty* icalproperty_new_due(struct icaltimetype v); | 213 | icalproperty* icalproperty_new_due(struct icaltimetype v); |
165 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v); | 214 | void icalproperty_set_due(icalproperty* prop, struct icaltimetype v); |
166 | struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...); | 215 | struct icaltimetype icalproperty_get_due(const icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...); |
167 | 216 | ||
168 | /* DURATION */ | 217 | /* DURATION */ |
169 | icalproperty* icalproperty_new_duration(struct icaldurationtype v); | 218 | icalproperty* icalproperty_new_duration(struct icaldurationtype v); |
170 | void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v); | 219 | void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v); |
171 | struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...); | 220 | struct icaldurationtype icalproperty_get_duration(const icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...); |
172 | 221 | ||
173 | /* EXDATE */ | 222 | /* EXDATE */ |
174 | icalproperty* icalproperty_new_exdate(struct icaltimetype v); | 223 | icalproperty* icalproperty_new_exdate(struct icaltimetype v); |
175 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v); | 224 | void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v); |
176 | struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); | 225 | struct icaltimetype icalproperty_get_exdate(const icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...); |
226 | |||
227 | /* EXPAND */ | ||
228 | icalproperty* icalproperty_new_expand(int v); | ||
229 | void icalproperty_set_expand(icalproperty* prop, int v); | ||
230 | int icalproperty_get_expand(const icalproperty* prop);icalproperty* icalproperty_vanew_expand(int v, ...); | ||
177 | 231 | ||
178 | /* EXRULE */ | 232 | /* EXRULE */ |
179 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); | 233 | icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); |
180 | void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v); | 234 | void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v); |
181 | struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...); | 235 | struct icalrecurrencetype icalproperty_get_exrule(const icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); |
182 | 236 | ||
183 | /* FREEBUSY */ | 237 | /* FREEBUSY */ |
184 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v); | 238 | icalproperty* icalproperty_new_freebusy(struct icalperiodtype v); |
185 | void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v); | 239 | void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v); |
186 | struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); | 240 | struct icalperiodtype icalproperty_get_freebusy(const icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...); |
187 | 241 | ||
188 | /* GEO */ | 242 | /* GEO */ |
189 | icalproperty* icalproperty_new_geo(struct icalgeotype v); | 243 | icalproperty* icalproperty_new_geo(struct icalgeotype v); |
190 | void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); | 244 | void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); |
191 | struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); | 245 | struct icalgeotype icalproperty_get_geo(const icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); |
192 | 246 | ||
193 | /* LAST-MODIFIED */ | 247 | /* LAST-MODIFIED */ |
194 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); | 248 | icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); |
195 | void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v); | 249 | void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v); |
196 | struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...); | 250 | struct icaltimetype icalproperty_get_lastmodified(const icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); |
197 | 251 | ||
198 | /* LOCATION */ | 252 | /* LOCATION */ |
199 | icalproperty* icalproperty_new_location(const char* v); | 253 | icalproperty* icalproperty_new_location(const char* v); |
200 | void icalproperty_set_location(icalproperty* prop, const char* v); | 254 | void icalproperty_set_location(icalproperty* prop, const char* v); |
201 | const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...); | 255 | const char* icalproperty_get_location(const icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...); |
202 | 256 | ||
203 | /* MAXRESULTS */ | 257 | /* MAXRESULTS */ |
204 | icalproperty* icalproperty_new_maxresults(int v); | 258 | icalproperty* icalproperty_new_maxresults(int v); |
205 | void icalproperty_set_maxresults(icalproperty* prop, int v); | 259 | void icalproperty_set_maxresults(icalproperty* prop, int v); |
206 | int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...); | 260 | int icalproperty_get_maxresults(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...); |
207 | 261 | ||
208 | /* MAXRESULTSSIZE */ | 262 | /* MAXRESULTSSIZE */ |
209 | icalproperty* icalproperty_new_maxresultssize(int v); | 263 | icalproperty* icalproperty_new_maxresultssize(int v); |
210 | void icalproperty_set_maxresultssize(icalproperty* prop, int v); | 264 | void icalproperty_set_maxresultssize(icalproperty* prop, int v); |
211 | int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...); | 265 | int icalproperty_get_maxresultssize(const icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...); |
212 | 266 | ||
213 | /* METHOD */ | 267 | /* METHOD */ |
214 | icalproperty* icalproperty_new_method(enum icalproperty_method v); | 268 | icalproperty* icalproperty_new_method(enum icalproperty_method v); |
215 | void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v); | 269 | void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v); |
216 | enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...); | 270 | enum icalproperty_method icalproperty_get_method(const icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...); |
217 | 271 | ||
218 | /* ORGANIZER */ | 272 | /* ORGANIZER */ |
219 | icalproperty* icalproperty_new_organizer(const char* v); | 273 | icalproperty* icalproperty_new_organizer(const char* v); |
220 | void icalproperty_set_organizer(icalproperty* prop, const char* v); | 274 | void icalproperty_set_organizer(icalproperty* prop, const char* v); |
221 | const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...); | 275 | const char* icalproperty_get_organizer(const icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...); |
276 | |||
277 | /* OWNER */ | ||
278 | icalproperty* icalproperty_new_owner(const char* v); | ||
279 | void icalproperty_set_owner(icalproperty* prop, const char* v); | ||
280 | const char* icalproperty_get_owner(const icalproperty* prop);icalproperty* icalproperty_vanew_owner(const char* v, ...); | ||
222 | 281 | ||
223 | /* PERCENT-COMPLETE */ | 282 | /* PERCENT-COMPLETE */ |
224 | icalproperty* icalproperty_new_percentcomplete(int v); | 283 | icalproperty* icalproperty_new_percentcomplete(int v); |
225 | void icalproperty_set_percentcomplete(icalproperty* prop, int v); | 284 | void icalproperty_set_percentcomplete(icalproperty* prop, int v); |
226 | int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...); | 285 | int icalproperty_get_percentcomplete(const icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...); |
227 | 286 | ||
228 | /* PRIORITY */ | 287 | /* PRIORITY */ |
229 | icalproperty* icalproperty_new_priority(int v); | 288 | icalproperty* icalproperty_new_priority(int v); |
230 | void icalproperty_set_priority(icalproperty* prop, int v); | 289 | void icalproperty_set_priority(icalproperty* prop, int v); |
231 | int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...); | 290 | int icalproperty_get_priority(const icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...); |
232 | 291 | ||
233 | /* PRODID */ | 292 | /* PRODID */ |
234 | icalproperty* icalproperty_new_prodid(const char* v); | 293 | icalproperty* icalproperty_new_prodid(const char* v); |
235 | void icalproperty_set_prodid(icalproperty* prop, const char* v); | 294 | void icalproperty_set_prodid(icalproperty* prop, const char* v); |
236 | const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...); | 295 | const char* icalproperty_get_prodid(const icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...); |
237 | 296 | ||
238 | /* QUERY */ | 297 | /* QUERY */ |
239 | icalproperty* icalproperty_new_query(const char* v); | 298 | icalproperty* icalproperty_new_query(const char* v); |
240 | void icalproperty_set_query(icalproperty* prop, const char* v); | 299 | void icalproperty_set_query(icalproperty* prop, const char* v); |
241 | const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...); | 300 | const char* icalproperty_get_query(const icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...); |
242 | 301 | ||
243 | /* QUERYNAME */ | 302 | /* QUERYNAME */ |
244 | icalproperty* icalproperty_new_queryname(const char* v); | 303 | icalproperty* icalproperty_new_queryname(const char* v); |
245 | void icalproperty_set_queryname(icalproperty* prop, const char* v); | 304 | void icalproperty_set_queryname(icalproperty* prop, const char* v); |
246 | const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...); | 305 | const char* icalproperty_get_queryname(const icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...); |
247 | 306 | ||
248 | /* RDATE */ | 307 | /* RDATE */ |
249 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v); | 308 | icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v); |
250 | void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v); | 309 | void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v); |
251 | struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...); | 310 | struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...); |
252 | 311 | ||
253 | /* RECURRENCE-ID */ | 312 | /* RECURRENCE-ID */ |
254 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v); | 313 | icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v); |
255 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v); | 314 | void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v); |
256 | struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...); | 315 | struct icaltimetype icalproperty_get_recurrenceid(const icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...); |
257 | 316 | ||
258 | /* RELATED-TO */ | 317 | /* RELATED-TO */ |
259 | icalproperty* icalproperty_new_relatedto(const char* v); | 318 | icalproperty* icalproperty_new_relatedto(const char* v); |
260 | void icalproperty_set_relatedto(icalproperty* prop, const char* v); | 319 | void icalproperty_set_relatedto(icalproperty* prop, const char* v); |
261 | const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...); | 320 | const char* icalproperty_get_relatedto(const icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...); |
321 | |||
322 | /* RELCALID */ | ||
323 | icalproperty* icalproperty_new_relcalid(const char* v); | ||
324 | void icalproperty_set_relcalid(icalproperty* prop, const char* v); | ||
325 | const char* icalproperty_get_relcalid(const icalproperty* prop);icalproperty* icalproperty_vanew_relcalid(const char* v, ...); | ||
262 | 326 | ||
263 | /* REPEAT */ | 327 | /* REPEAT */ |
264 | icalproperty* icalproperty_new_repeat(int v); | 328 | icalproperty* icalproperty_new_repeat(int v); |
265 | void icalproperty_set_repeat(icalproperty* prop, int v); | 329 | void icalproperty_set_repeat(icalproperty* prop, int v); |
266 | int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...); | 330 | int icalproperty_get_repeat(const icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...); |
267 | 331 | ||
268 | /* REQUEST-STATUS */ | 332 | /* REQUEST-STATUS */ |
269 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v); | 333 | icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v); |
270 | void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v); | 334 | void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v); |
271 | struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...); | 335 | struct icalreqstattype icalproperty_get_requeststatus(const icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...); |
272 | 336 | ||
273 | /* RESOURCES */ | 337 | /* RESOURCES */ |
274 | icalproperty* icalproperty_new_resources(const char* v); | 338 | icalproperty* icalproperty_new_resources(const char* v); |
275 | void icalproperty_set_resources(icalproperty* prop, const char* v); | 339 | void icalproperty_set_resources(icalproperty* prop, const char* v); |
276 | const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...); | 340 | const char* icalproperty_get_resources(const icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...); |
277 | 341 | ||
278 | /* RRULE */ | 342 | /* RRULE */ |
279 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v); | 343 | icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v); |
280 | void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v); | 344 | void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v); |
281 | struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...); | 345 | struct icalrecurrencetype icalproperty_get_rrule(const icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...); |
282 | 346 | ||
283 | /* SCOPE */ | 347 | /* SCOPE */ |
284 | icalproperty* icalproperty_new_scope(const char* v); | 348 | icalproperty* icalproperty_new_scope(const char* v); |
285 | void icalproperty_set_scope(icalproperty* prop, const char* v); | 349 | void icalproperty_set_scope(icalproperty* prop, const char* v); |
286 | const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...); | 350 | const char* icalproperty_get_scope(const icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...); |
287 | 351 | ||
288 | /* SEQUENCE */ | 352 | /* SEQUENCE */ |
289 | icalproperty* icalproperty_new_sequence(int v); | 353 | icalproperty* icalproperty_new_sequence(int v); |
290 | void icalproperty_set_sequence(icalproperty* prop, int v); | 354 | void icalproperty_set_sequence(icalproperty* prop, int v); |
291 | int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...); | 355 | int icalproperty_get_sequence(const icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...); |
292 | 356 | ||
293 | /* STATUS */ | 357 | /* STATUS */ |
294 | icalproperty* icalproperty_new_status(enum icalproperty_status v); | 358 | icalproperty* icalproperty_new_status(enum icalproperty_status v); |
295 | void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v); | 359 | void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v); |
296 | enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...); | 360 | enum icalproperty_status icalproperty_get_status(const icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...); |
297 | 361 | ||
298 | /* SUMMARY */ | 362 | /* SUMMARY */ |
299 | icalproperty* icalproperty_new_summary(const char* v); | 363 | icalproperty* icalproperty_new_summary(const char* v); |
300 | void icalproperty_set_summary(icalproperty* prop, const char* v); | 364 | void icalproperty_set_summary(icalproperty* prop, const char* v); |
301 | const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...); | 365 | const char* icalproperty_get_summary(const icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...); |
302 | 366 | ||
303 | /* TARGET */ | 367 | /* TARGET */ |
304 | icalproperty* icalproperty_new_target(const char* v); | 368 | icalproperty* icalproperty_new_target(const char* v); |
305 | void icalproperty_set_target(icalproperty* prop, const char* v); | 369 | void icalproperty_set_target(icalproperty* prop, const char* v); |
306 | const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...); | 370 | const char* icalproperty_get_target(const icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...); |
307 | 371 | ||
308 | /* TRANSP */ | 372 | /* TRANSP */ |
309 | icalproperty* icalproperty_new_transp(const char* v); | 373 | icalproperty* icalproperty_new_transp(enum icalproperty_transp v); |
310 | void icalproperty_set_transp(icalproperty* prop, const char* v); | 374 | void icalproperty_set_transp(icalproperty* prop, enum icalproperty_transp v); |
311 | const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...); | 375 | enum icalproperty_transp icalproperty_get_transp(const icalproperty* prop);icalproperty* icalproperty_vanew_transp(enum icalproperty_transp v, ...); |
312 | 376 | ||
313 | /* TRIGGER */ | 377 | /* TRIGGER */ |
314 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v); | 378 | icalproperty* icalproperty_new_trigger(struct icaltriggertype v); |
315 | void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v); | 379 | void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v); |
316 | struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...); | 380 | struct icaltriggertype icalproperty_get_trigger(const icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...); |
317 | 381 | ||
318 | /* TZID */ | 382 | /* TZID */ |
319 | icalproperty* icalproperty_new_tzid(const char* v); | 383 | icalproperty* icalproperty_new_tzid(const char* v); |
320 | void icalproperty_set_tzid(icalproperty* prop, const char* v); | 384 | void icalproperty_set_tzid(icalproperty* prop, const char* v); |
321 | const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...); | 385 | const char* icalproperty_get_tzid(const icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...); |
322 | 386 | ||
323 | /* TZNAME */ | 387 | /* TZNAME */ |
324 | icalproperty* icalproperty_new_tzname(const char* v); | 388 | icalproperty* icalproperty_new_tzname(const char* v); |
325 | void icalproperty_set_tzname(icalproperty* prop, const char* v); | 389 | void icalproperty_set_tzname(icalproperty* prop, const char* v); |
326 | const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...); | 390 | const char* icalproperty_get_tzname(const icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...); |
327 | 391 | ||
328 | /* TZOFFSETFROM */ | 392 | /* TZOFFSETFROM */ |
329 | icalproperty* icalproperty_new_tzoffsetfrom(int v); | 393 | icalproperty* icalproperty_new_tzoffsetfrom(int v); |
330 | void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v); | 394 | void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v); |
331 | int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); | 395 | int icalproperty_get_tzoffsetfrom(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...); |
332 | 396 | ||
333 | /* TZOFFSETTO */ | 397 | /* TZOFFSETTO */ |
334 | icalproperty* icalproperty_new_tzoffsetto(int v); | 398 | icalproperty* icalproperty_new_tzoffsetto(int v); |
335 | void icalproperty_set_tzoffsetto(icalproperty* prop, int v); | 399 | void icalproperty_set_tzoffsetto(icalproperty* prop, int v); |
336 | int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...); | 400 | int icalproperty_get_tzoffsetto(const icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); |
337 | 401 | ||
338 | /* TZURL */ | 402 | /* TZURL */ |
339 | icalproperty* icalproperty_new_tzurl(const char* v); | 403 | icalproperty* icalproperty_new_tzurl(const char* v); |
340 | void icalproperty_set_tzurl(icalproperty* prop, const char* v); | 404 | void icalproperty_set_tzurl(icalproperty* prop, const char* v); |
341 | const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...); | 405 | const char* icalproperty_get_tzurl(const icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...); |
342 | 406 | ||
343 | /* UID */ | 407 | /* UID */ |
344 | icalproperty* icalproperty_new_uid(const char* v); | 408 | icalproperty* icalproperty_new_uid(const char* v); |
345 | void icalproperty_set_uid(icalproperty* prop, const char* v); | 409 | void icalproperty_set_uid(icalproperty* prop, const char* v); |
346 | const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...); | 410 | const char* icalproperty_get_uid(const icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...); |
347 | 411 | ||
348 | /* URL */ | 412 | /* URL */ |
349 | icalproperty* icalproperty_new_url(const char* v); | 413 | icalproperty* icalproperty_new_url(const char* v); |
350 | void icalproperty_set_url(icalproperty* prop, const char* v); | 414 | void icalproperty_set_url(icalproperty* prop, const char* v); |
351 | const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...); | 415 | const char* icalproperty_get_url(const icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...); |
352 | 416 | ||
353 | /* VERSION */ | 417 | /* VERSION */ |
354 | icalproperty* icalproperty_new_version(const char* v); | 418 | icalproperty* icalproperty_new_version(const char* v); |
355 | void icalproperty_set_version(icalproperty* prop, const char* v); | 419 | void icalproperty_set_version(icalproperty* prop, const char* v); |
356 | const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...); | 420 | const char* icalproperty_get_version(const icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...); |
357 | 421 | ||
358 | /* X */ | 422 | /* X */ |
359 | icalproperty* icalproperty_new_x(const char* v); | 423 | icalproperty* icalproperty_new_x(const char* v); |
360 | void icalproperty_set_x(icalproperty* prop, const char* v); | 424 | void icalproperty_set_x(icalproperty* prop, const char* v); |
361 | const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...); | 425 | const char* icalproperty_get_x(const icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...); |
426 | |||
427 | /* X-LIC-CLASS */ | ||
428 | icalproperty* icalproperty_new_xlicclass(enum icalproperty_xlicclass v); | ||
429 | void icalproperty_set_xlicclass(icalproperty* prop, enum icalproperty_xlicclass v); | ||
430 | enum icalproperty_xlicclass icalproperty_get_xlicclass(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclass(enum icalproperty_xlicclass v, ...); | ||
362 | 431 | ||
363 | /* X-LIC-CLUSTERCOUNT */ | 432 | /* X-LIC-CLUSTERCOUNT */ |
364 | icalproperty* icalproperty_new_xlicclustercount(const char* v); | 433 | icalproperty* icalproperty_new_xlicclustercount(const char* v); |
365 | void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v); | 434 | void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v); |
366 | const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...); | 435 | const char* icalproperty_get_xlicclustercount(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...); |
367 | 436 | ||
368 | /* X-LIC-ERROR */ | 437 | /* X-LIC-ERROR */ |
369 | icalproperty* icalproperty_new_xlicerror(const char* v); | 438 | icalproperty* icalproperty_new_xlicerror(const char* v); |
370 | void icalproperty_set_xlicerror(icalproperty* prop, const char* v); | 439 | void icalproperty_set_xlicerror(icalproperty* prop, const char* v); |
371 | const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...); | 440 | const char* icalproperty_get_xlicerror(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...); |
372 | 441 | ||
373 | /* X-LIC-MIMECHARSET */ | 442 | /* X-LIC-MIMECHARSET */ |
374 | icalproperty* icalproperty_new_xlicmimecharset(const char* v); | 443 | icalproperty* icalproperty_new_xlicmimecharset(const char* v); |
375 | void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v); | 444 | void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v); |
376 | const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...); | 445 | const char* icalproperty_get_xlicmimecharset(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...); |
377 | 446 | ||
378 | /* X-LIC-MIMECID */ | 447 | /* X-LIC-MIMECID */ |
379 | icalproperty* icalproperty_new_xlicmimecid(const char* v); | 448 | icalproperty* icalproperty_new_xlicmimecid(const char* v); |
380 | void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v); | 449 | void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v); |
381 | const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...); | 450 | const char* icalproperty_get_xlicmimecid(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...); |
382 | 451 | ||
383 | /* X-LIC-MIMECONTENTTYPE */ | 452 | /* X-LIC-MIMECONTENTTYPE */ |
384 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v); | 453 | icalproperty* icalproperty_new_xlicmimecontenttype(const char* v); |
385 | void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v); | 454 | void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v); |
386 | const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...); | 455 | const char* icalproperty_get_xlicmimecontenttype(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...); |
387 | 456 | ||
388 | /* X-LIC-MIMEENCODING */ | 457 | /* X-LIC-MIMEENCODING */ |
389 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v); | 458 | icalproperty* icalproperty_new_xlicmimeencoding(const char* v); |
390 | void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v); | 459 | void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v); |
391 | const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...); | 460 | const char* icalproperty_get_xlicmimeencoding(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...); |
392 | 461 | ||
393 | /* X-LIC-MIMEFILENAME */ | 462 | /* X-LIC-MIMEFILENAME */ |
394 | icalproperty* icalproperty_new_xlicmimefilename(const char* v); | 463 | icalproperty* icalproperty_new_xlicmimefilename(const char* v); |
395 | void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v); | 464 | void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v); |
396 | const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...); | 465 | const char* icalproperty_get_xlicmimefilename(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...); |
397 | 466 | ||
398 | /* X-LIC-MIMEOPTINFO */ | 467 | /* X-LIC-MIMEOPTINFO */ |
399 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v); | 468 | icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v); |
400 | void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v); | 469 | void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v); |
401 | const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop); | 470 | const char* icalproperty_get_xlicmimeoptinfo(const icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...); |
471 | |||
402 | 472 | ||
403 | #endif /*ICALPROPERTY_H*/ | 473 | #endif /*ICALPROPERTY_H*/ |
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 | |||
@@ -47,10 +47,6 @@ | |||
47 | #include <stdlib.h> /* for atoi and atof */ | 47 | #include <stdlib.h> /* for atoi and atof */ |
48 | #include <limits.h> /* for SHRT_MAX */ | 48 | #include <limits.h> /* for SHRT_MAX */ |
49 | 49 | ||
50 | |||
51 | |||
52 | #define TMP_BUF_SIZE 1024 | ||
53 | |||
54 | struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind); | 50 | struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind); |
55 | 51 | ||
56 | /* This map associates each of the value types with its string | 52 | /* This map associates each of the value types with its string |
@@ -60,326 +56,194 @@ struct icalvalue_kind_map { | |||
60 | char name[20]; | 56 | char name[20]; |
61 | }; | 57 | }; |
62 | 58 | ||
63 | extern struct icalvalue_kind_map value_map[]; | 59 | static struct icalvalue_kind_map value_map[28]={ |
64 | 60 | {ICAL_QUERY_VALUE,"QUERY"}, | |
65 | const char* icalvalue_kind_to_string(icalvalue_kind kind) | 61 | {ICAL_DATE_VALUE,"DATE"}, |
66 | { | 62 | {ICAL_ATTACH_VALUE,"ATTACH"}, |
67 | int i; | 63 | {ICAL_GEO_VALUE,"GEO"}, |
68 | 64 | {ICAL_STATUS_VALUE,"STATUS"}, | |
69 | for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) { | 65 | {ICAL_TRANSP_VALUE,"TRANSP"}, |
70 | if (value_map[i].kind == kind) { | 66 | {ICAL_STRING_VALUE,"STRING"}, |
71 | return value_map[i].name; | 67 | {ICAL_TEXT_VALUE,"TEXT"}, |
72 | } | 68 | {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"}, |
73 | } | 69 | {ICAL_BINARY_VALUE,"BINARY"}, |
74 | 70 | {ICAL_PERIOD_VALUE,"PERIOD"}, | |
75 | return 0; | 71 | {ICAL_FLOAT_VALUE,"FLOAT"}, |
76 | } | 72 | {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"}, |
77 | 73 | {ICAL_INTEGER_VALUE,"INTEGER"}, | |
78 | icalvalue_kind icalvalue_string_to_kind(const char* str) | 74 | {ICAL_CLASS_VALUE,"CLASS"}, |
79 | { | 75 | {ICAL_URI_VALUE,"URI"}, |
80 | int i; | 76 | {ICAL_DURATION_VALUE,"DURATION"}, |
81 | 77 | {ICAL_BOOLEAN_VALUE,"BOOLEAN"}, | |
82 | for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) { | 78 | {ICAL_X_VALUE,"X"}, |
83 | if (strcmp(value_map[i].name,str) == 0) { | 79 | {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"}, |
84 | return value_map[i].kind; | 80 | {ICAL_TRIGGER_VALUE,"TRIGGER"}, |
85 | } | 81 | {ICAL_XLICCLASS_VALUE,"X-LIC-CLASS"}, |
86 | } | 82 | {ICAL_RECUR_VALUE,"RECUR"}, |
87 | 83 | {ICAL_ACTION_VALUE,"ACTION"}, | |
88 | return value_map[i].kind; | 84 | {ICAL_DATETIME_VALUE,"DATE-TIME"}, |
85 | {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"}, | ||
86 | {ICAL_METHOD_VALUE,"METHOD"}, | ||
87 | {ICAL_NO_VALUE,""} | ||
88 | }; | ||
89 | 89 | ||
90 | } | ||
91 | 90 | ||
92 | icalvalue* icalvalue_new_x (const char* v){ | 91 | icalvalue* icalvalue_new_query (const char* v){ |
93 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE); | 92 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE); |
94 | icalerror_check_arg_rz( (v!=0),"v"); | 93 | icalerror_check_arg_rz( (v!=0),"v"); |
95 | 94 | ||
96 | icalvalue_set_x((icalvalue*)impl,v); | 95 | icalvalue_set_query((icalvalue*)impl,v); |
97 | return (icalvalue*)impl; | 96 | return (icalvalue*)impl; |
98 | } | 97 | } |
99 | void icalvalue_set_x(icalvalue* value, const char* v) { | 98 | void icalvalue_set_query(icalvalue* value, const char* v) { |
100 | struct icalvalue_impl* impl; | 99 | struct icalvalue_impl* impl; |
101 | icalerror_check_arg_rv( (value!=0),"value"); | 100 | icalerror_check_arg_rv( (value!=0),"value"); |
102 | icalerror_check_arg_rv( (v!=0),"v"); | 101 | icalerror_check_arg_rv( (v!=0),"v"); |
103 | 102 | ||
103 | icalerror_check_value_type(value, ICAL_QUERY_VALUE); | ||
104 | impl = (struct icalvalue_impl*)value; | 104 | impl = (struct icalvalue_impl*)value; |
105 | if(impl->x_value!=0) {free((void*)impl->x_value);} | 105 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} |
106 | 106 | ||
107 | impl->x_value = icalmemory_strdup(v); | ||
108 | 107 | ||
109 | if (impl->x_value == 0){ | 108 | impl->data.v_string = icalmemory_strdup(v); |
109 | |||
110 | if (impl->data.v_string == 0){ | ||
110 | errno = ENOMEM; | 111 | errno = ENOMEM; |
111 | } | 112 | } |
112 | 113 | ||
113 | } | 114 | |
114 | const char* icalvalue_get_x(icalvalue* value) { | 115 | icalvalue_reset_kind(impl); |
116 | } | ||
117 | const char* icalvalue_get_query(const icalvalue* value) { | ||
115 | 118 | ||
116 | icalerror_check_arg( (value!=0),"value"); | 119 | icalerror_check_arg( (value!=0),"value"); |
117 | icalerror_check_value_type(value, ICAL_X_VALUE); | 120 | icalerror_check_value_type(value, ICAL_QUERY_VALUE); |
118 | return ((struct icalvalue_impl*)value)->x_value; | 121 | return ((struct icalvalue_impl*)value)->data.v_string; |
119 | } | 122 | } |
120 | 123 | ||
121 | /* Attachment is a special case, so it is not auto generated. */ | ||
122 | icalvalue* | ||
123 | icalvalue_new_attach (struct icalattachtype *v) | ||
124 | { | ||
125 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE); | ||
126 | |||
127 | icalvalue_set_attach((icalvalue*)impl,v); | ||
128 | 124 | ||
125 | |||
126 | icalvalue* icalvalue_new_date (struct icaltimetype v){ | ||
127 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE); | ||
128 | |||
129 | icalvalue_set_date((icalvalue*)impl,v); | ||
129 | return (icalvalue*)impl; | 130 | return (icalvalue*)impl; |
130 | } | 131 | } |
131 | 132 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v) { | |
132 | void | ||
133 | icalvalue_set_attach(icalvalue* value, struct icalattachtype *v) | ||
134 | { | ||
135 | struct icalvalue_impl* impl; | 133 | struct icalvalue_impl* impl; |
136 | |||
137 | icalerror_check_arg_rv( (value!=0),"value"); | 134 | icalerror_check_arg_rv( (value!=0),"value"); |
138 | icalerror_check_value_type(value, ICAL_ATTACH_VALUE); | 135 | |
139 | 136 | icalerror_check_value_type(value, ICAL_DATE_VALUE); | |
140 | impl = (struct icalvalue_impl*)value; | 137 | impl = (struct icalvalue_impl*)value; |
141 | 138 | ||
142 | if (impl->data.v_attach != 0){ | ||
143 | icalattachtype_free(impl->data.v_attach); | ||
144 | } | ||
145 | 139 | ||
146 | impl->data.v_attach = v; | 140 | impl->data.v_time = v; |
147 | icalattachtype_add_reference(v); | 141 | |
142 | icalvalue_reset_kind(impl); | ||
148 | } | 143 | } |
144 | struct icaltimetype icalvalue_get_date(const icalvalue* value) { | ||
149 | 145 | ||
150 | struct icalattachtype* | ||
151 | icalvalue_get_attach(icalvalue* value) | ||
152 | { | ||
153 | icalerror_check_arg( (value!=0),"value"); | 146 | icalerror_check_arg( (value!=0),"value"); |
154 | icalerror_check_value_type(value, ICAL_ATTACH_VALUE); | 147 | icalerror_check_value_type(value, ICAL_DATE_VALUE); |
155 | 148 | return ((struct icalvalue_impl*)value)->data.v_time; | |
156 | return ((struct icalvalue_impl*)value)->data.v_attach; | ||
157 | } | 149 | } |
158 | 150 | ||
159 | 151 | ||
160 | /* Recur is a special case, so it is not auto generated. */ | ||
161 | icalvalue* | ||
162 | icalvalue_new_recur (struct icalrecurrencetype v) | ||
163 | { | ||
164 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE); | ||
165 | |||
166 | icalvalue_set_recur((icalvalue*)impl,v); | ||
167 | 152 | ||
153 | icalvalue* icalvalue_new_geo (struct icalgeotype v){ | ||
154 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE); | ||
155 | |||
156 | icalvalue_set_geo((icalvalue*)impl,v); | ||
168 | return (icalvalue*)impl; | 157 | return (icalvalue*)impl; |
169 | } | 158 | } |
170 | 159 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) { | |
171 | void | ||
172 | icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v) | ||
173 | { | ||
174 | struct icalvalue_impl* impl; | 160 | struct icalvalue_impl* impl; |
175 | |||
176 | icalerror_check_arg_rv( (value!=0),"value"); | 161 | icalerror_check_arg_rv( (value!=0),"value"); |
177 | icalerror_check_value_type(value, ICAL_RECUR_VALUE); | 162 | |
178 | 163 | icalerror_check_value_type(value, ICAL_GEO_VALUE); | |
179 | impl = (struct icalvalue_impl*)value; | 164 | impl = (struct icalvalue_impl*)value; |
180 | 165 | ||
181 | if (impl->data.v_recur != 0){ | ||
182 | free(impl->data.v_recur); | ||
183 | impl->data.v_recur = 0; | ||
184 | } | ||
185 | 166 | ||
186 | impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); | 167 | impl->data.v_geo = v; |
187 | 168 | ||
188 | if (impl->data.v_recur == 0){ | 169 | icalvalue_reset_kind(impl); |
189 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
190 | return; | ||
191 | } else { | ||
192 | memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype)); | ||
193 | } | ||
194 | |||
195 | } | 170 | } |
171 | struct icalgeotype icalvalue_get_geo(const icalvalue* value) { | ||
196 | 172 | ||
197 | struct icalrecurrencetype | ||
198 | icalvalue_get_recur(icalvalue* value) | ||
199 | { | ||
200 | icalerror_check_arg( (value!=0),"value"); | 173 | icalerror_check_arg( (value!=0),"value"); |
201 | icalerror_check_value_type(value, ICAL_RECUR_VALUE); | 174 | icalerror_check_value_type(value, ICAL_GEO_VALUE); |
202 | 175 | return ((struct icalvalue_impl*)value)->data.v_geo; | |
203 | return *(((struct icalvalue_impl*)value)->data.v_recur); | ||
204 | } | 176 | } |
205 | 177 | ||
206 | 178 | ||
207 | 179 | ||
208 | 180 | icalvalue* icalvalue_new_status (enum icalproperty_status v){ | |
209 | icalvalue* | 181 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE); |
210 | icalvalue_new_trigger (struct icaltriggertype v) | 182 | |
211 | { | 183 | icalvalue_set_status((icalvalue*)impl,v); |
212 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE); | ||
213 | |||
214 | icalvalue_set_trigger((icalvalue*)impl,v); | ||
215 | |||
216 | return (icalvalue*)impl; | 184 | return (icalvalue*)impl; |
217 | } | 185 | } |
218 | 186 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) { | |
219 | void | ||
220 | icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v) | ||
221 | { | ||
222 | struct icalvalue_impl* impl; | 187 | struct icalvalue_impl* impl; |
223 | |||
224 | icalerror_check_arg_rv( (value!=0),"value"); | 188 | icalerror_check_arg_rv( (value!=0),"value"); |
225 | 189 | ||
190 | icalerror_check_value_type(value, ICAL_STATUS_VALUE); | ||
226 | impl = (struct icalvalue_impl*)value; | 191 | impl = (struct icalvalue_impl*)value; |
227 | 192 | ||
228 | if(!icaltime_is_null_time(v.time)){ | ||
229 | icalvalue_set_datetime((icalvalue*)impl,v.time); | ||
230 | impl->kind = ICAL_DATETIME_VALUE; | ||
231 | } else { | ||
232 | icalvalue_set_duration((icalvalue*)impl,v.duration); | ||
233 | impl->kind = ICAL_DURATION_VALUE; | ||
234 | } | ||
235 | 193 | ||
236 | } | 194 | impl->data.v_enum = v; |
237 | 195 | ||
238 | struct icaltriggertype | 196 | icalvalue_reset_kind(impl); |
239 | icalvalue_get_trigger(icalvalue* value) | 197 | } |
240 | { | 198 | enum icalproperty_status icalvalue_get_status(const icalvalue* value) { |
241 | struct icalvalue_impl *impl = (struct icalvalue_impl*)value; | ||
242 | struct icaltriggertype tr; | ||
243 | 199 | ||
244 | icalerror_check_arg( (value!=0),"value"); | 200 | icalerror_check_arg( (value!=0),"value"); |
245 | icalerror_check_arg( (value!=0),"value"); | 201 | icalerror_check_value_type(value, ICAL_STATUS_VALUE); |
246 | 202 | return ((struct icalvalue_impl*)value)->data.v_enum; | |
247 | if(impl->kind == ICAL_DATETIME_VALUE){ | ||
248 | tr.duration = icaldurationtype_from_int(0); | ||
249 | tr.time = impl->data.v_time; | ||
250 | } else if(impl->kind == ICAL_DURATION_VALUE){ | ||
251 | tr.time = icaltime_null_time(); | ||
252 | tr.duration = impl->data.v_duration; | ||
253 | } else { | ||
254 | tr.duration = icaldurationtype_from_int(0); | ||
255 | tr.time = icaltime_null_time(); | ||
256 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
257 | } | ||
258 | |||
259 | return tr; | ||
260 | } | 203 | } |
261 | 204 | ||
262 | /* DATE-TIME-PERIOD is a special case, and is not auto generated */ | ||
263 | |||
264 | icalvalue* | ||
265 | icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v) | ||
266 | { | ||
267 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE); | ||
268 | 205 | ||
269 | icalvalue_set_datetimeperiod((icalvalue*)impl,v); | ||
270 | 206 | ||
207 | icalvalue* icalvalue_new_transp (enum icalproperty_transp v){ | ||
208 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE); | ||
209 | |||
210 | icalvalue_set_transp((icalvalue*)impl,v); | ||
271 | return (icalvalue*)impl; | 211 | return (icalvalue*)impl; |
272 | } | 212 | } |
273 | 213 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) { | |
274 | void | 214 | struct icalvalue_impl* impl; |
275 | icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v) | ||
276 | { | ||
277 | struct icalvalue_impl* impl = (struct icalvalue_impl*)value; | ||
278 | |||
279 | icalerror_check_arg_rv( (value!=0),"value"); | 215 | icalerror_check_arg_rv( (value!=0),"value"); |
280 | 216 | ||
281 | icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); | 217 | icalerror_check_value_type(value, ICAL_TRANSP_VALUE); |
218 | impl = (struct icalvalue_impl*)value; | ||
282 | 219 | ||
283 | if(!icaltime_is_null_time(v.time)){ | ||
284 | if(!icaltime_is_valid_time(v.time)){ | ||
285 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
286 | return; | ||
287 | } | ||
288 | impl->kind = ICAL_DATETIME_VALUE; | ||
289 | icalvalue_set_datetime(impl,v.time); | ||
290 | } else if (!icalperiodtype_is_null_period(v.period)) { | ||
291 | if(!icalperiodtype_is_valid_period(v.period)){ | ||
292 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
293 | return; | ||
294 | } | ||
295 | impl->kind = ICAL_PERIOD_VALUE; | ||
296 | icalvalue_set_period(impl,v.period); | ||
297 | } else { | ||
298 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
299 | } | ||
300 | } | ||
301 | 220 | ||
302 | struct icaldatetimeperiodtype | 221 | impl->data.v_enum = v; |
303 | icalvalue_get_datetimeperiod(icalvalue* value) | ||
304 | { | ||
305 | struct icaldatetimeperiodtype dtp; | ||
306 | |||
307 | struct icalvalue_impl* impl = (struct icalvalue_impl*)value; | ||
308 | icalerror_check_arg( (value!=0),"value"); | ||
309 | icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); | ||
310 | |||
311 | if(impl->kind == ICAL_DATETIME_VALUE){ | ||
312 | dtp.period = icalperiodtype_null_period(); | ||
313 | dtp.time = impl->data.v_time; | ||
314 | } else if(impl->kind == ICAL_PERIOD_VALUE) { | ||
315 | dtp.period = impl->data.v_period; | ||
316 | dtp.time = icaltime_null_time(); | ||
317 | } else { | ||
318 | dtp.period = icalperiodtype_null_period(); | ||
319 | dtp.time = icaltime_null_time(); | ||
320 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
321 | } | ||
322 | 222 | ||
323 | return dtp; | 223 | icalvalue_reset_kind(impl); |
324 | } | 224 | } |
225 | enum icalproperty_transp icalvalue_get_transp(const icalvalue* value) { | ||
325 | 226 | ||
227 | icalerror_check_arg( (value!=0),"value"); | ||
228 | icalerror_check_value_type(value, ICAL_TRANSP_VALUE); | ||
229 | return ((struct icalvalue_impl*)value)->data.v_enum; | ||
230 | } | ||
326 | 231 | ||
327 | 232 | ||
328 | 233 | ||
329 | 234 | icalvalue* icalvalue_new_string (const char* v){ | |
330 | 235 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE); | |
331 | |||
332 | |||
333 | |||
334 | /* The remaining interfaces are 'new', 'set' and 'get' for each of the value | ||
335 | types */ | ||
336 | |||
337 | |||
338 | /* Everything below this line is machine generated. Do not edit. */ | ||
339 | static struct icalvalue_kind_map value_map[]={ | ||
340 | {ICAL_QUERY_VALUE,"QUERY"}, | ||
341 | {ICAL_TRIGGER_VALUE,"TRIGGER"}, | ||
342 | {ICAL_STATUS_VALUE,"STATUS"}, | ||
343 | {ICAL_TRANSP_VALUE,"TRANSP"}, | ||
344 | {ICAL_CLASS_VALUE,"CLASS"}, | ||
345 | {ICAL_DATE_VALUE,"DATE"}, | ||
346 | {ICAL_STRING_VALUE,"STRING"}, | ||
347 | {ICAL_INTEGER_VALUE,"INTEGER"}, | ||
348 | {ICAL_PERIOD_VALUE,"PERIOD"}, | ||
349 | {ICAL_TEXT_VALUE,"TEXT"}, | ||
350 | {ICAL_DURATION_VALUE,"DURATION"}, | ||
351 | {ICAL_BOOLEAN_VALUE,"BOOLEAN"}, | ||
352 | {ICAL_URI_VALUE,"URI"}, | ||
353 | {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"}, | ||
354 | {ICAL_GEO_VALUE,"GEO"}, | ||
355 | {ICAL_DATETIME_VALUE,"DATE-TIME"}, | ||
356 | {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"}, | ||
357 | {ICAL_ATTACH_VALUE,"ATTACH"}, | ||
358 | {ICAL_ACTION_VALUE,"ACTION"}, | ||
359 | {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"}, | ||
360 | {ICAL_X_VALUE,"X"}, | ||
361 | {ICAL_FLOAT_VALUE,"FLOAT"}, | ||
362 | {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"}, | ||
363 | {ICAL_METHOD_VALUE,"METHOD"}, | ||
364 | {ICAL_BINARY_VALUE,"BINARY"}, | ||
365 | {ICAL_RECUR_VALUE,"RECUR"}, | ||
366 | {ICAL_NO_VALUE,""} | ||
367 | }; | ||
368 | |||
369 | |||
370 | icalvalue* icalvalue_new_query (const char* v){ | ||
371 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE); | ||
372 | icalerror_check_arg_rz( (v!=0),"v"); | 236 | icalerror_check_arg_rz( (v!=0),"v"); |
373 | 237 | ||
374 | icalvalue_set_query((icalvalue*)impl,v); | 238 | icalvalue_set_string((icalvalue*)impl,v); |
375 | return (icalvalue*)impl; | 239 | return (icalvalue*)impl; |
376 | } | 240 | } |
377 | void icalvalue_set_query(icalvalue* value, const char* v) { | 241 | void icalvalue_set_string(icalvalue* value, const char* v) { |
378 | struct icalvalue_impl* impl; | 242 | struct icalvalue_impl* impl; |
379 | icalerror_check_arg_rv( (value!=0),"value"); | 243 | icalerror_check_arg_rv( (value!=0),"value"); |
380 | icalerror_check_arg_rv( (v!=0),"v"); | 244 | icalerror_check_arg_rv( (v!=0),"v"); |
381 | 245 | ||
382 | icalerror_check_value_type(value, ICAL_QUERY_VALUE); | 246 | icalerror_check_value_type(value, ICAL_STRING_VALUE); |
383 | impl = (struct icalvalue_impl*)value; | 247 | impl = (struct icalvalue_impl*)value; |
384 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | 248 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} |
385 | 249 | ||
@@ -393,154 +257,162 @@ void icalvalue_set_query(icalvalue* value, const char* v) { | |||
393 | 257 | ||
394 | icalvalue_reset_kind(impl); | 258 | icalvalue_reset_kind(impl); |
395 | } | 259 | } |
396 | const char* icalvalue_get_query(icalvalue* value) { | 260 | const char* icalvalue_get_string(const icalvalue* value) { |
397 | 261 | ||
398 | icalerror_check_arg( (value!=0),"value"); | 262 | icalerror_check_arg( (value!=0),"value"); |
399 | icalerror_check_value_type(value, ICAL_QUERY_VALUE); | 263 | icalerror_check_value_type(value, ICAL_STRING_VALUE); |
400 | return ((struct icalvalue_impl*)value)->data.v_string; | 264 | return ((struct icalvalue_impl*)value)->data.v_string; |
401 | } | 265 | } |
402 | 266 | ||
403 | 267 | ||
404 | 268 | ||
405 | icalvalue* icalvalue_new_status (enum icalproperty_status v){ | 269 | icalvalue* icalvalue_new_text (const char* v){ |
406 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE); | 270 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE); |
407 | 271 | icalerror_check_arg_rz( (v!=0),"v"); | |
408 | icalvalue_set_status((icalvalue*)impl,v); | 272 | |
273 | icalvalue_set_text((icalvalue*)impl,v); | ||
409 | return (icalvalue*)impl; | 274 | return (icalvalue*)impl; |
410 | } | 275 | } |
411 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) { | 276 | void icalvalue_set_text(icalvalue* value, const char* v) { |
412 | struct icalvalue_impl* impl; | 277 | struct icalvalue_impl* impl; |
413 | icalerror_check_arg_rv( (value!=0),"value"); | 278 | icalerror_check_arg_rv( (value!=0),"value"); |
414 | 279 | icalerror_check_arg_rv( (v!=0),"v"); | |
415 | icalerror_check_value_type(value, ICAL_STATUS_VALUE); | 280 | |
281 | icalerror_check_value_type(value, ICAL_TEXT_VALUE); | ||
416 | impl = (struct icalvalue_impl*)value; | 282 | impl = (struct icalvalue_impl*)value; |
283 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | ||
417 | 284 | ||
418 | 285 | ||
419 | impl->data.v_enum = v; | 286 | impl->data.v_string = icalmemory_strdup(v); |
287 | |||
288 | if (impl->data.v_string == 0){ | ||
289 | errno = ENOMEM; | ||
290 | } | ||
291 | |||
420 | 292 | ||
421 | icalvalue_reset_kind(impl); | 293 | icalvalue_reset_kind(impl); |
422 | } | 294 | } |
423 | enum icalproperty_status icalvalue_get_status(icalvalue* value) { | 295 | const char* icalvalue_get_text(const icalvalue* value) { |
424 | 296 | ||
425 | icalerror_check_arg( (value!=0),"value"); | 297 | icalerror_check_arg( (value!=0),"value"); |
426 | icalerror_check_value_type(value, ICAL_STATUS_VALUE); | 298 | icalerror_check_value_type(value, ICAL_TEXT_VALUE); |
427 | return ((struct icalvalue_impl*)value)->data.v_enum; | 299 | return ((struct icalvalue_impl*)value)->data.v_string; |
428 | } | 300 | } |
429 | 301 | ||
430 | 302 | ||
431 | 303 | ||
432 | icalvalue* icalvalue_new_transp (enum icalproperty_transp v){ | 304 | icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){ |
433 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE); | 305 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE); |
434 | 306 | ||
435 | icalvalue_set_transp((icalvalue*)impl,v); | 307 | icalvalue_set_requeststatus((icalvalue*)impl,v); |
436 | return (icalvalue*)impl; | 308 | return (icalvalue*)impl; |
437 | } | 309 | } |
438 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) { | 310 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) { |
439 | struct icalvalue_impl* impl; | 311 | struct icalvalue_impl* impl; |
440 | icalerror_check_arg_rv( (value!=0),"value"); | 312 | icalerror_check_arg_rv( (value!=0),"value"); |
441 | 313 | ||
442 | icalerror_check_value_type(value, ICAL_TRANSP_VALUE); | 314 | icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE); |
443 | impl = (struct icalvalue_impl*)value; | 315 | impl = (struct icalvalue_impl*)value; |
444 | 316 | ||
445 | 317 | ||
446 | impl->data.v_enum = v; | 318 | impl->data.v_requeststatus = v; |
447 | 319 | ||
448 | icalvalue_reset_kind(impl); | 320 | icalvalue_reset_kind(impl); |
449 | } | 321 | } |
450 | enum icalproperty_transp icalvalue_get_transp(icalvalue* value) { | 322 | struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value) { |
451 | 323 | ||
452 | icalerror_check_arg( (value!=0),"value"); | 324 | icalerror_check_arg( (value!=0),"value"); |
453 | icalerror_check_value_type(value, ICAL_TRANSP_VALUE); | 325 | icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE); |
454 | return ((struct icalvalue_impl*)value)->data.v_enum; | 326 | return ((struct icalvalue_impl*)value)->data.v_requeststatus; |
455 | } | 327 | } |
456 | 328 | ||
457 | 329 | ||
458 | 330 | ||
459 | icalvalue* icalvalue_new_class (enum icalproperty_class v){ | 331 | icalvalue* icalvalue_new_binary (const char* v){ |
460 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE); | 332 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE); |
461 | 333 | icalerror_check_arg_rz( (v!=0),"v"); | |
462 | icalvalue_set_class((icalvalue*)impl,v); | 334 | |
335 | icalvalue_set_binary((icalvalue*)impl,v); | ||
463 | return (icalvalue*)impl; | 336 | return (icalvalue*)impl; |
464 | } | 337 | } |
465 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) { | 338 | void icalvalue_set_binary(icalvalue* value, const char* v) { |
466 | struct icalvalue_impl* impl; | 339 | struct icalvalue_impl* impl; |
467 | icalerror_check_arg_rv( (value!=0),"value"); | 340 | icalerror_check_arg_rv( (value!=0),"value"); |
468 | 341 | icalerror_check_arg_rv( (v!=0),"v"); | |
469 | icalerror_check_value_type(value, ICAL_CLASS_VALUE); | 342 | |
343 | icalerror_check_value_type(value, ICAL_BINARY_VALUE); | ||
470 | impl = (struct icalvalue_impl*)value; | 344 | impl = (struct icalvalue_impl*)value; |
345 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | ||
471 | 346 | ||
472 | 347 | ||
473 | impl->data.v_enum = v; | 348 | impl->data.v_string = icalmemory_strdup(v); |
349 | |||
350 | if (impl->data.v_string == 0){ | ||
351 | errno = ENOMEM; | ||
352 | } | ||
353 | |||
474 | 354 | ||
475 | icalvalue_reset_kind(impl); | 355 | icalvalue_reset_kind(impl); |
476 | } | 356 | } |
477 | enum icalproperty_class icalvalue_get_class(icalvalue* value) { | 357 | const char* icalvalue_get_binary(const icalvalue* value) { |
478 | 358 | ||
479 | icalerror_check_arg( (value!=0),"value"); | 359 | icalerror_check_arg( (value!=0),"value"); |
480 | icalerror_check_value_type(value, ICAL_CLASS_VALUE); | 360 | icalerror_check_value_type(value, ICAL_BINARY_VALUE); |
481 | return ((struct icalvalue_impl*)value)->data.v_enum; | 361 | return ((struct icalvalue_impl*)value)->data.v_string; |
482 | } | 362 | } |
483 | 363 | ||
484 | 364 | ||
485 | 365 | ||
486 | icalvalue* icalvalue_new_date (struct icaltimetype v){ | 366 | icalvalue* icalvalue_new_period (struct icalperiodtype v){ |
487 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE); | 367 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE); |
488 | 368 | ||
489 | icalvalue_set_date((icalvalue*)impl,v); | 369 | icalvalue_set_period((icalvalue*)impl,v); |
490 | return (icalvalue*)impl; | 370 | return (icalvalue*)impl; |
491 | } | 371 | } |
492 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v) { | 372 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) { |
493 | struct icalvalue_impl* impl; | 373 | struct icalvalue_impl* impl; |
494 | icalerror_check_arg_rv( (value!=0),"value"); | 374 | icalerror_check_arg_rv( (value!=0),"value"); |
495 | 375 | ||
496 | icalerror_check_value_type(value, ICAL_DATE_VALUE); | 376 | icalerror_check_value_type(value, ICAL_PERIOD_VALUE); |
497 | impl = (struct icalvalue_impl*)value; | 377 | impl = (struct icalvalue_impl*)value; |
498 | 378 | ||
499 | 379 | ||
500 | impl->data.v_time = v; | 380 | impl->data.v_period = v; |
501 | 381 | ||
502 | icalvalue_reset_kind(impl); | 382 | icalvalue_reset_kind(impl); |
503 | } | 383 | } |
504 | struct icaltimetype icalvalue_get_date(icalvalue* value) { | 384 | struct icalperiodtype icalvalue_get_period(const icalvalue* value) { |
505 | 385 | ||
506 | icalerror_check_arg( (value!=0),"value"); | 386 | icalerror_check_arg( (value!=0),"value"); |
507 | icalerror_check_value_type(value, ICAL_DATE_VALUE); | 387 | icalerror_check_value_type(value, ICAL_PERIOD_VALUE); |
508 | return ((struct icalvalue_impl*)value)->data.v_time; | 388 | return ((struct icalvalue_impl*)value)->data.v_period; |
509 | } | 389 | } |
510 | 390 | ||
511 | 391 | ||
512 | 392 | ||
513 | icalvalue* icalvalue_new_string (const char* v){ | 393 | icalvalue* icalvalue_new_float (float v){ |
514 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE); | 394 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE); |
515 | icalerror_check_arg_rz( (v!=0),"v"); | 395 | |
516 | 396 | icalvalue_set_float((icalvalue*)impl,v); | |
517 | icalvalue_set_string((icalvalue*)impl,v); | ||
518 | return (icalvalue*)impl; | 397 | return (icalvalue*)impl; |
519 | } | 398 | } |
520 | void icalvalue_set_string(icalvalue* value, const char* v) { | 399 | void icalvalue_set_float(icalvalue* value, float v) { |
521 | struct icalvalue_impl* impl; | 400 | struct icalvalue_impl* impl; |
522 | icalerror_check_arg_rv( (value!=0),"value"); | 401 | icalerror_check_arg_rv( (value!=0),"value"); |
523 | icalerror_check_arg_rv( (v!=0),"v"); | 402 | |
524 | 403 | icalerror_check_value_type(value, ICAL_FLOAT_VALUE); | |
525 | icalerror_check_value_type(value, ICAL_STRING_VALUE); | ||
526 | impl = (struct icalvalue_impl*)value; | 404 | impl = (struct icalvalue_impl*)value; |
527 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | ||
528 | 405 | ||
529 | 406 | ||
530 | impl->data.v_string = icalmemory_strdup(v); | 407 | impl->data.v_float = v; |
531 | |||
532 | if (impl->data.v_string == 0){ | ||
533 | errno = ENOMEM; | ||
534 | } | ||
535 | |||
536 | 408 | ||
537 | icalvalue_reset_kind(impl); | 409 | icalvalue_reset_kind(impl); |
538 | } | 410 | } |
539 | const char* icalvalue_get_string(icalvalue* value) { | 411 | float icalvalue_get_float(const icalvalue* value) { |
540 | 412 | ||
541 | icalerror_check_arg( (value!=0),"value"); | 413 | icalerror_check_arg( (value!=0),"value"); |
542 | icalerror_check_value_type(value, ICAL_STRING_VALUE); | 414 | icalerror_check_value_type(value, ICAL_FLOAT_VALUE); |
543 | return ((struct icalvalue_impl*)value)->data.v_string; | 415 | return ((struct icalvalue_impl*)value)->data.v_float; |
544 | } | 416 | } |
545 | 417 | ||
546 | 418 | ||
@@ -563,7 +435,7 @@ void icalvalue_set_integer(icalvalue* value, int v) { | |||
563 | 435 | ||
564 | icalvalue_reset_kind(impl); | 436 | icalvalue_reset_kind(impl); |
565 | } | 437 | } |
566 | int icalvalue_get_integer(icalvalue* value) { | 438 | int icalvalue_get_integer(const icalvalue* value) { |
567 | 439 | ||
568 | icalerror_check_arg( (value!=0),"value"); | 440 | icalerror_check_arg( (value!=0),"value"); |
569 | icalerror_check_value_type(value, ICAL_INTEGER_VALUE); | 441 | icalerror_check_value_type(value, ICAL_INTEGER_VALUE); |
@@ -572,46 +444,46 @@ int icalvalue_get_integer(icalvalue* value) { | |||
572 | 444 | ||
573 | 445 | ||
574 | 446 | ||
575 | icalvalue* icalvalue_new_period (struct icalperiodtype v){ | 447 | icalvalue* icalvalue_new_class (enum icalproperty_class v){ |
576 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE); | 448 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE); |
577 | 449 | ||
578 | icalvalue_set_period((icalvalue*)impl,v); | 450 | icalvalue_set_class((icalvalue*)impl,v); |
579 | return (icalvalue*)impl; | 451 | return (icalvalue*)impl; |
580 | } | 452 | } |
581 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) { | 453 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) { |
582 | struct icalvalue_impl* impl; | 454 | struct icalvalue_impl* impl; |
583 | icalerror_check_arg_rv( (value!=0),"value"); | 455 | icalerror_check_arg_rv( (value!=0),"value"); |
584 | 456 | ||
585 | icalerror_check_value_type(value, ICAL_PERIOD_VALUE); | 457 | icalerror_check_value_type(value, ICAL_CLASS_VALUE); |
586 | impl = (struct icalvalue_impl*)value; | 458 | impl = (struct icalvalue_impl*)value; |
587 | 459 | ||
588 | 460 | ||
589 | impl->data.v_period = v; | 461 | impl->data.v_enum = v; |
590 | 462 | ||
591 | icalvalue_reset_kind(impl); | 463 | icalvalue_reset_kind(impl); |
592 | } | 464 | } |
593 | struct icalperiodtype icalvalue_get_period(icalvalue* value) { | 465 | enum icalproperty_class icalvalue_get_class(const icalvalue* value) { |
594 | 466 | ||
595 | icalerror_check_arg( (value!=0),"value"); | 467 | icalerror_check_arg( (value!=0),"value"); |
596 | icalerror_check_value_type(value, ICAL_PERIOD_VALUE); | 468 | icalerror_check_value_type(value, ICAL_CLASS_VALUE); |
597 | return ((struct icalvalue_impl*)value)->data.v_period; | 469 | return ((struct icalvalue_impl*)value)->data.v_enum; |
598 | } | 470 | } |
599 | 471 | ||
600 | 472 | ||
601 | 473 | ||
602 | icalvalue* icalvalue_new_text (const char* v){ | 474 | icalvalue* icalvalue_new_uri (const char* v){ |
603 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE); | 475 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE); |
604 | icalerror_check_arg_rz( (v!=0),"v"); | 476 | icalerror_check_arg_rz( (v!=0),"v"); |
605 | 477 | ||
606 | icalvalue_set_text((icalvalue*)impl,v); | 478 | icalvalue_set_uri((icalvalue*)impl,v); |
607 | return (icalvalue*)impl; | 479 | return (icalvalue*)impl; |
608 | } | 480 | } |
609 | void icalvalue_set_text(icalvalue* value, const char* v) { | 481 | void icalvalue_set_uri(icalvalue* value, const char* v) { |
610 | struct icalvalue_impl* impl; | 482 | struct icalvalue_impl* impl; |
611 | icalerror_check_arg_rv( (value!=0),"value"); | 483 | icalerror_check_arg_rv( (value!=0),"value"); |
612 | icalerror_check_arg_rv( (v!=0),"v"); | 484 | icalerror_check_arg_rv( (v!=0),"v"); |
613 | 485 | ||
614 | icalerror_check_value_type(value, ICAL_TEXT_VALUE); | 486 | icalerror_check_value_type(value, ICAL_URI_VALUE); |
615 | impl = (struct icalvalue_impl*)value; | 487 | impl = (struct icalvalue_impl*)value; |
616 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | 488 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} |
617 | 489 | ||
@@ -625,10 +497,10 @@ void icalvalue_set_text(icalvalue* value, const char* v) { | |||
625 | 497 | ||
626 | icalvalue_reset_kind(impl); | 498 | icalvalue_reset_kind(impl); |
627 | } | 499 | } |
628 | const char* icalvalue_get_text(icalvalue* value) { | 500 | const char* icalvalue_get_uri(const icalvalue* value) { |
629 | 501 | ||
630 | icalerror_check_arg( (value!=0),"value"); | 502 | icalerror_check_arg( (value!=0),"value"); |
631 | icalerror_check_value_type(value, ICAL_TEXT_VALUE); | 503 | icalerror_check_value_type(value, ICAL_URI_VALUE); |
632 | return ((struct icalvalue_impl*)value)->data.v_string; | 504 | return ((struct icalvalue_impl*)value)->data.v_string; |
633 | } | 505 | } |
634 | 506 | ||
@@ -652,7 +524,7 @@ void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) { | |||
652 | 524 | ||
653 | icalvalue_reset_kind(impl); | 525 | icalvalue_reset_kind(impl); |
654 | } | 526 | } |
655 | struct icaldurationtype icalvalue_get_duration(icalvalue* value) { | 527 | struct icaldurationtype icalvalue_get_duration(const icalvalue* value) { |
656 | 528 | ||
657 | icalerror_check_arg( (value!=0),"value"); | 529 | icalerror_check_arg( (value!=0),"value"); |
658 | icalerror_check_value_type(value, ICAL_DURATION_VALUE); | 530 | icalerror_check_value_type(value, ICAL_DURATION_VALUE); |
@@ -679,7 +551,7 @@ void icalvalue_set_boolean(icalvalue* value, int v) { | |||
679 | 551 | ||
680 | icalvalue_reset_kind(impl); | 552 | icalvalue_reset_kind(impl); |
681 | } | 553 | } |
682 | int icalvalue_get_boolean(icalvalue* value) { | 554 | int icalvalue_get_boolean(const icalvalue* value) { |
683 | 555 | ||
684 | icalerror_check_arg( (value!=0),"value"); | 556 | icalerror_check_arg( (value!=0),"value"); |
685 | icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); | 557 | icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); |
@@ -688,19 +560,19 @@ int icalvalue_get_boolean(icalvalue* value) { | |||
688 | 560 | ||
689 | 561 | ||
690 | 562 | ||
691 | icalvalue* icalvalue_new_uri (const char* v){ | 563 | icalvalue* icalvalue_new_caladdress (const char* v){ |
692 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE); | 564 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE); |
693 | icalerror_check_arg_rz( (v!=0),"v"); | 565 | icalerror_check_arg_rz( (v!=0),"v"); |
694 | 566 | ||
695 | icalvalue_set_uri((icalvalue*)impl,v); | 567 | icalvalue_set_caladdress((icalvalue*)impl,v); |
696 | return (icalvalue*)impl; | 568 | return (icalvalue*)impl; |
697 | } | 569 | } |
698 | void icalvalue_set_uri(icalvalue* value, const char* v) { | 570 | void icalvalue_set_caladdress(icalvalue* value, const char* v) { |
699 | struct icalvalue_impl* impl; | 571 | struct icalvalue_impl* impl; |
700 | icalerror_check_arg_rv( (value!=0),"value"); | 572 | icalerror_check_arg_rv( (value!=0),"value"); |
701 | icalerror_check_arg_rv( (v!=0),"v"); | 573 | icalerror_check_arg_rv( (v!=0),"v"); |
702 | 574 | ||
703 | icalerror_check_value_type(value, ICAL_URI_VALUE); | 575 | icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); |
704 | impl = (struct icalvalue_impl*)value; | 576 | impl = (struct icalvalue_impl*)value; |
705 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | 577 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} |
706 | 578 | ||
@@ -714,38 +586,65 @@ void icalvalue_set_uri(icalvalue* value, const char* v) { | |||
714 | 586 | ||
715 | icalvalue_reset_kind(impl); | 587 | icalvalue_reset_kind(impl); |
716 | } | 588 | } |
717 | const char* icalvalue_get_uri(icalvalue* value) { | 589 | const char* icalvalue_get_caladdress(const icalvalue* value) { |
718 | 590 | ||
719 | icalerror_check_arg( (value!=0),"value"); | 591 | icalerror_check_arg( (value!=0),"value"); |
720 | icalerror_check_value_type(value, ICAL_URI_VALUE); | 592 | icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); |
721 | return ((struct icalvalue_impl*)value)->data.v_string; | 593 | return ((struct icalvalue_impl*)value)->data.v_string; |
722 | } | 594 | } |
723 | 595 | ||
724 | 596 | ||
725 | 597 | ||
726 | icalvalue* icalvalue_new_geo (struct icalgeotype v){ | 598 | icalvalue* icalvalue_new_xlicclass (enum icalproperty_xlicclass v){ |
727 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE); | 599 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_XLICCLASS_VALUE); |
728 | 600 | ||
729 | icalvalue_set_geo((icalvalue*)impl,v); | 601 | icalvalue_set_xlicclass((icalvalue*)impl,v); |
730 | return (icalvalue*)impl; | 602 | return (icalvalue*)impl; |
731 | } | 603 | } |
732 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) { | 604 | void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v) { |
733 | struct icalvalue_impl* impl; | 605 | struct icalvalue_impl* impl; |
734 | icalerror_check_arg_rv( (value!=0),"value"); | 606 | icalerror_check_arg_rv( (value!=0),"value"); |
735 | 607 | ||
736 | icalerror_check_value_type(value, ICAL_GEO_VALUE); | 608 | icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE); |
737 | impl = (struct icalvalue_impl*)value; | 609 | impl = (struct icalvalue_impl*)value; |
738 | 610 | ||
739 | 611 | ||
740 | impl->data.v_geo = v; | 612 | impl->data.v_enum = v; |
741 | 613 | ||
742 | icalvalue_reset_kind(impl); | 614 | icalvalue_reset_kind(impl); |
743 | } | 615 | } |
744 | struct icalgeotype icalvalue_get_geo(icalvalue* value) { | 616 | enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value) { |
745 | 617 | ||
746 | icalerror_check_arg( (value!=0),"value"); | 618 | icalerror_check_arg( (value!=0),"value"); |
747 | icalerror_check_value_type(value, ICAL_GEO_VALUE); | 619 | icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE); |
748 | return ((struct icalvalue_impl*)value)->data.v_geo; | 620 | return ((struct icalvalue_impl*)value)->data.v_enum; |
621 | } | ||
622 | |||
623 | |||
624 | |||
625 | icalvalue* icalvalue_new_action (enum icalproperty_action v){ | ||
626 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE); | ||
627 | |||
628 | icalvalue_set_action((icalvalue*)impl,v); | ||
629 | return (icalvalue*)impl; | ||
630 | } | ||
631 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) { | ||
632 | struct icalvalue_impl* impl; | ||
633 | icalerror_check_arg_rv( (value!=0),"value"); | ||
634 | |||
635 | icalerror_check_value_type(value, ICAL_ACTION_VALUE); | ||
636 | impl = (struct icalvalue_impl*)value; | ||
637 | |||
638 | |||
639 | impl->data.v_enum = v; | ||
640 | |||
641 | icalvalue_reset_kind(impl); | ||
642 | } | ||
643 | enum icalproperty_action icalvalue_get_action(const icalvalue* value) { | ||
644 | |||
645 | icalerror_check_arg( (value!=0),"value"); | ||
646 | icalerror_check_value_type(value, ICAL_ACTION_VALUE); | ||
647 | return ((struct icalvalue_impl*)value)->data.v_enum; | ||
749 | } | 648 | } |
750 | 649 | ||
751 | 650 | ||
@@ -768,7 +667,7 @@ void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) { | |||
768 | 667 | ||
769 | icalvalue_reset_kind(impl); | 668 | icalvalue_reset_kind(impl); |
770 | } | 669 | } |
771 | struct icaltimetype icalvalue_get_datetime(icalvalue* value) { | 670 | struct icaltimetype icalvalue_get_datetime(const icalvalue* value) { |
772 | 671 | ||
773 | icalerror_check_arg( (value!=0),"value"); | 672 | icalerror_check_arg( (value!=0),"value"); |
774 | icalerror_check_value_type(value, ICAL_DATETIME_VALUE); | 673 | icalerror_check_value_type(value, ICAL_DATETIME_VALUE); |
@@ -795,7 +694,7 @@ void icalvalue_set_utcoffset(icalvalue* value, int v) { | |||
795 | 694 | ||
796 | icalvalue_reset_kind(impl); | 695 | icalvalue_reset_kind(impl); |
797 | } | 696 | } |
798 | int icalvalue_get_utcoffset(icalvalue* value) { | 697 | int icalvalue_get_utcoffset(const icalvalue* value) { |
799 | 698 | ||
800 | icalerror_check_arg( (value!=0),"value"); | 699 | icalerror_check_arg( (value!=0),"value"); |
801 | icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); | 700 | icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); |
@@ -804,17 +703,17 @@ int icalvalue_get_utcoffset(icalvalue* value) { | |||
804 | 703 | ||
805 | 704 | ||
806 | 705 | ||
807 | icalvalue* icalvalue_new_action (enum icalproperty_action v){ | 706 | icalvalue* icalvalue_new_method (enum icalproperty_method v){ |
808 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE); | 707 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE); |
809 | 708 | ||
810 | icalvalue_set_action((icalvalue*)impl,v); | 709 | icalvalue_set_method((icalvalue*)impl,v); |
811 | return (icalvalue*)impl; | 710 | return (icalvalue*)impl; |
812 | } | 711 | } |
813 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) { | 712 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) { |
814 | struct icalvalue_impl* impl; | 713 | struct icalvalue_impl* impl; |
815 | icalerror_check_arg_rv( (value!=0),"value"); | 714 | icalerror_check_arg_rv( (value!=0),"value"); |
816 | 715 | ||
817 | icalerror_check_value_type(value, ICAL_ACTION_VALUE); | 716 | icalerror_check_value_type(value, ICAL_METHOD_VALUE); |
818 | impl = (struct icalvalue_impl*)value; | 717 | impl = (struct icalvalue_impl*)value; |
819 | 718 | ||
820 | 719 | ||
@@ -822,160 +721,287 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) { | |||
822 | 721 | ||
823 | icalvalue_reset_kind(impl); | 722 | icalvalue_reset_kind(impl); |
824 | } | 723 | } |
825 | enum icalproperty_action icalvalue_get_action(icalvalue* value) { | 724 | enum icalproperty_method icalvalue_get_method(const icalvalue* value) { |
826 | 725 | ||
827 | icalerror_check_arg( (value!=0),"value"); | 726 | icalerror_check_arg( (value!=0),"value"); |
828 | icalerror_check_value_type(value, ICAL_ACTION_VALUE); | 727 | icalerror_check_value_type(value, ICAL_METHOD_VALUE); |
829 | return ((struct icalvalue_impl*)value)->data.v_enum; | 728 | return ((struct icalvalue_impl*)value)->data.v_enum; |
830 | } | 729 | } |
831 | 730 | ||
832 | 731 | ||
732 | int icalvalue_kind_is_valid(const icalvalue_kind kind) | ||
733 | { | ||
734 | int i = 0; | ||
735 | do { | ||
736 | if (value_map[i].kind == kind) | ||
737 | return 1; | ||
738 | } while (value_map[i++].kind != ICAL_NO_VALUE); | ||
833 | 739 | ||
834 | icalvalue* icalvalue_new_caladdress (const char* v){ | 740 | return 0; |
835 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE); | 741 | } |
742 | |||
743 | const char* icalvalue_kind_to_string(const icalvalue_kind kind) | ||
744 | { | ||
745 | int i; | ||
746 | |||
747 | for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) { | ||
748 | if (value_map[i].kind == kind) { | ||
749 | return value_map[i].name; | ||
750 | } | ||
751 | } | ||
752 | |||
753 | return 0; | ||
754 | } | ||
755 | |||
756 | icalvalue_kind icalvalue_string_to_kind(const char* str) | ||
757 | { | ||
758 | int i; | ||
759 | |||
760 | for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) { | ||
761 | if (strcmp(value_map[i].name,str) == 0) { | ||
762 | return value_map[i].kind; | ||
763 | } | ||
764 | } | ||
765 | |||
766 | return value_map[i].kind; | ||
767 | |||
768 | } | ||
769 | |||
770 | icalvalue* icalvalue_new_x (const char* v){ | ||
771 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE); | ||
836 | icalerror_check_arg_rz( (v!=0),"v"); | 772 | icalerror_check_arg_rz( (v!=0),"v"); |
837 | 773 | ||
838 | icalvalue_set_caladdress((icalvalue*)impl,v); | 774 | icalvalue_set_x((icalvalue*)impl,v); |
839 | return (icalvalue*)impl; | 775 | return (icalvalue*)impl; |
840 | } | 776 | } |
841 | void icalvalue_set_caladdress(icalvalue* value, const char* v) { | 777 | void icalvalue_set_x(icalvalue* impl, const char* v) { |
842 | struct icalvalue_impl* impl; | 778 | icalerror_check_arg_rv( (impl!=0),"value"); |
843 | icalerror_check_arg_rv( (value!=0),"value"); | ||
844 | icalerror_check_arg_rv( (v!=0),"v"); | 779 | icalerror_check_arg_rv( (v!=0),"v"); |
845 | 780 | ||
846 | icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); | 781 | if(impl->x_value!=0) {free((void*)impl->x_value);} |
847 | impl = (struct icalvalue_impl*)value; | ||
848 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | ||
849 | |||
850 | 782 | ||
851 | impl->data.v_string = icalmemory_strdup(v); | 783 | impl->x_value = icalmemory_strdup(v); |
852 | 784 | ||
853 | if (impl->data.v_string == 0){ | 785 | if (impl->x_value == 0){ |
854 | errno = ENOMEM; | 786 | errno = ENOMEM; |
855 | } | 787 | } |
856 | 788 | ||
857 | 789 | } | |
858 | icalvalue_reset_kind(impl); | 790 | const char* icalvalue_get_x(const icalvalue* value) { |
859 | } | ||
860 | const char* icalvalue_get_caladdress(icalvalue* value) { | ||
861 | 791 | ||
862 | icalerror_check_arg( (value!=0),"value"); | 792 | icalerror_check_arg( (value!=0),"value"); |
863 | icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); | 793 | icalerror_check_value_type(value, ICAL_X_VALUE); |
864 | return ((struct icalvalue_impl*)value)->data.v_string; | 794 | return value->x_value; |
865 | } | 795 | } |
866 | 796 | ||
797 | /* Recur is a special case, so it is not auto generated. */ | ||
798 | icalvalue* | ||
799 | icalvalue_new_recur (struct icalrecurrencetype v) | ||
800 | { | ||
801 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE); | ||
802 | |||
803 | icalvalue_set_recur((icalvalue*)impl,v); | ||
867 | 804 | ||
868 | |||
869 | icalvalue* icalvalue_new_float (float v){ | ||
870 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE); | ||
871 | |||
872 | icalvalue_set_float((icalvalue*)impl,v); | ||
873 | return (icalvalue*)impl; | 805 | return (icalvalue*)impl; |
874 | } | 806 | } |
875 | void icalvalue_set_float(icalvalue* value, float v) { | ||
876 | struct icalvalue_impl* impl; | ||
877 | icalerror_check_arg_rv( (value!=0),"value"); | ||
878 | |||
879 | icalerror_check_value_type(value, ICAL_FLOAT_VALUE); | ||
880 | impl = (struct icalvalue_impl*)value; | ||
881 | 807 | ||
808 | void | ||
809 | icalvalue_set_recur(icalvalue* impl, struct icalrecurrencetype v) | ||
810 | { | ||
811 | icalerror_check_arg_rv( (impl!=0),"value"); | ||
812 | icalerror_check_value_type(value, ICAL_RECUR_VALUE); | ||
882 | 813 | ||
883 | impl->data.v_float = v; | 814 | if (impl->data.v_recur != 0){ |
815 | free(impl->data.v_recur); | ||
816 | impl->data.v_recur = 0; | ||
817 | } | ||
884 | 818 | ||
885 | icalvalue_reset_kind(impl); | 819 | impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); |
820 | |||
821 | if (impl->data.v_recur == 0){ | ||
822 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
823 | return; | ||
824 | } else { | ||
825 | memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype)); | ||
826 | } | ||
827 | |||
886 | } | 828 | } |
887 | float icalvalue_get_float(icalvalue* value) { | ||
888 | 829 | ||
830 | struct icalrecurrencetype | ||
831 | icalvalue_get_recur(const icalvalue* value) | ||
832 | { | ||
889 | icalerror_check_arg( (value!=0),"value"); | 833 | icalerror_check_arg( (value!=0),"value"); |
890 | icalerror_check_value_type(value, ICAL_FLOAT_VALUE); | 834 | icalerror_check_value_type(value, ICAL_RECUR_VALUE); |
891 | return ((struct icalvalue_impl*)value)->data.v_float; | 835 | |
836 | return *(value->data.v_recur); | ||
892 | } | 837 | } |
893 | 838 | ||
894 | 839 | ||
895 | 840 | ||
896 | icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){ | 841 | |
897 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE); | 842 | icalvalue* |
898 | 843 | icalvalue_new_trigger (struct icaltriggertype v) | |
899 | icalvalue_set_requeststatus((icalvalue*)impl,v); | 844 | { |
845 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE); | ||
846 | |||
847 | icalvalue_set_trigger((icalvalue*)impl,v); | ||
848 | |||
900 | return (icalvalue*)impl; | 849 | return (icalvalue*)impl; |
901 | } | 850 | } |
902 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) { | 851 | |
903 | struct icalvalue_impl* impl; | 852 | void |
853 | icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v) | ||
854 | { | ||
904 | icalerror_check_arg_rv( (value!=0),"value"); | 855 | icalerror_check_arg_rv( (value!=0),"value"); |
905 | 856 | ||
906 | icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE); | 857 | if(!icaltime_is_null_time(v.time)){ |
907 | impl = (struct icalvalue_impl*)value; | 858 | icalvalue_set_datetime(value,v.time); |
859 | value->kind = ICAL_DATETIME_VALUE; | ||
860 | } else { | ||
861 | icalvalue_set_duration(value,v.duration); | ||
862 | value->kind = ICAL_DURATION_VALUE; | ||
863 | } | ||
864 | } | ||
908 | 865 | ||
866 | struct icaltriggertype | ||
867 | icalvalue_get_trigger(const icalvalue* impl) | ||
868 | { | ||
869 | struct icaltriggertype tr; | ||
909 | 870 | ||
910 | impl->data.v_requeststatus = v; | 871 | icalerror_check_arg( (impl!=0),"value"); |
872 | icalerror_check_arg( (impl!=0),"value"); | ||
911 | 873 | ||
912 | icalvalue_reset_kind(impl); | 874 | if(impl->kind == ICAL_DATETIME_VALUE){ |
913 | } | 875 | tr.duration = icaldurationtype_from_int(0); |
914 | struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value) { | 876 | tr.time = impl->data.v_time; |
877 | } else if(impl->kind == ICAL_DURATION_VALUE){ | ||
878 | tr.time = icaltime_null_time(); | ||
879 | tr.duration = impl->data.v_duration; | ||
880 | } else { | ||
881 | tr.duration = icaldurationtype_from_int(0); | ||
882 | tr.time = icaltime_null_time(); | ||
883 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
884 | } | ||
915 | 885 | ||
916 | icalerror_check_arg( (value!=0),"value"); | 886 | return tr; |
917 | icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE); | ||
918 | return ((struct icalvalue_impl*)value)->data.v_requeststatus; | ||
919 | } | 887 | } |
920 | 888 | ||
889 | /* DATE-TIME-PERIOD is a special case, and is not auto generated */ | ||
921 | 890 | ||
891 | icalvalue* | ||
892 | icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v) | ||
893 | { | ||
894 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE); | ||
895 | |||
896 | icalvalue_set_datetimeperiod(impl,v); | ||
922 | 897 | ||
923 | icalvalue* icalvalue_new_method (enum icalproperty_method v){ | ||
924 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE); | ||
925 | |||
926 | icalvalue_set_method((icalvalue*)impl,v); | ||
927 | return (icalvalue*)impl; | 898 | return (icalvalue*)impl; |
928 | } | 899 | } |
929 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) { | ||
930 | struct icalvalue_impl* impl; | ||
931 | icalerror_check_arg_rv( (value!=0),"value"); | ||
932 | |||
933 | icalerror_check_value_type(value, ICAL_METHOD_VALUE); | ||
934 | impl = (struct icalvalue_impl*)value; | ||
935 | |||
936 | 900 | ||
937 | impl->data.v_enum = v; | 901 | void |
902 | icalvalue_set_datetimeperiod(icalvalue* impl, struct icaldatetimeperiodtype v) | ||
903 | { | ||
904 | icalerror_check_arg_rv( (impl!=0),"value"); | ||
905 | |||
906 | icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); | ||
938 | 907 | ||
939 | icalvalue_reset_kind(impl); | 908 | if(!icaltime_is_null_time(v.time)){ |
909 | if(!icaltime_is_valid_time(v.time)){ | ||
910 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
911 | return; | ||
912 | } | ||
913 | impl->kind = ICAL_DATETIME_VALUE; | ||
914 | icalvalue_set_datetime(impl,v.time); | ||
915 | } else if (!icalperiodtype_is_null_period(v.period)) { | ||
916 | if(!icalperiodtype_is_valid_period(v.period)){ | ||
917 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
918 | return; | ||
919 | } | ||
920 | impl->kind = ICAL_PERIOD_VALUE; | ||
921 | icalvalue_set_period(impl,v.period); | ||
922 | } else { | ||
923 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
924 | } | ||
940 | } | 925 | } |
941 | enum icalproperty_method icalvalue_get_method(icalvalue* value) { | ||
942 | 926 | ||
943 | icalerror_check_arg( (value!=0),"value"); | 927 | struct icaldatetimeperiodtype |
944 | icalerror_check_value_type(value, ICAL_METHOD_VALUE); | 928 | icalvalue_get_datetimeperiod(const icalvalue* impl) |
945 | return ((struct icalvalue_impl*)value)->data.v_enum; | 929 | { |
946 | } | 930 | struct icaldatetimeperiodtype dtp; |
931 | |||
932 | icalerror_check_arg( (impl!=0),"value"); | ||
933 | icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); | ||
934 | |||
935 | if(impl->kind == ICAL_DATETIME_VALUE){ | ||
936 | dtp.period = icalperiodtype_null_period(); | ||
937 | dtp.time = impl->data.v_time; | ||
938 | } else if(impl->kind == ICAL_PERIOD_VALUE) { | ||
939 | dtp.period = impl->data.v_period; | ||
940 | dtp.time = icaltime_null_time(); | ||
941 | } else { | ||
942 | dtp.period = icalperiodtype_null_period(); | ||
943 | dtp.time = icaltime_null_time(); | ||
944 | icalerror_set_errno(ICAL_BADARG_ERROR); | ||
945 | } | ||
947 | 946 | ||
947 | return dtp; | ||
948 | } | ||
948 | 949 | ||
949 | 950 | ||
950 | icalvalue* icalvalue_new_binary (const char* v){ | ||
951 | struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE); | ||
952 | icalerror_check_arg_rz( (v!=0),"v"); | ||
953 | 951 | ||
954 | icalvalue_set_binary((icalvalue*)impl,v); | 952 | icalvalue * |
955 | return (icalvalue*)impl; | 953 | icalvalue_new_attach (icalattach *attach) |
956 | } | 954 | { |
957 | void icalvalue_set_binary(icalvalue* value, const char* v) { | 955 | struct icalvalue_impl *impl; |
958 | struct icalvalue_impl* impl; | ||
959 | icalerror_check_arg_rv( (value!=0),"value"); | ||
960 | icalerror_check_arg_rv( (v!=0),"v"); | ||
961 | 956 | ||
962 | icalerror_check_value_type(value, ICAL_BINARY_VALUE); | 957 | icalerror_check_arg_rz ((attach != NULL), "attach"); |
963 | impl = (struct icalvalue_impl*)value; | ||
964 | if(impl->data.v_string!=0) {free((void*)impl->data.v_string);} | ||
965 | 958 | ||
959 | impl = icalvalue_new_impl (ICAL_ATTACH_VALUE); | ||
960 | if (!impl) { | ||
961 | errno = ENOMEM; | ||
962 | return NULL; | ||
963 | } | ||
966 | 964 | ||
967 | impl->data.v_string = icalmemory_strdup(v); | 965 | icalvalue_set_attach ((icalvalue *) impl, attach); |
966 | return (icalvalue *) impl; | ||
967 | } | ||
968 | 968 | ||
969 | if (impl->data.v_string == 0){ | 969 | void |
970 | errno = ENOMEM; | 970 | icalvalue_set_attach (icalvalue *value, icalattach *attach) |
971 | } | 971 | { |
972 | struct icalvalue_impl *impl; | ||
973 | |||
974 | icalerror_check_arg_rv ((value != NULL), "value"); | ||
975 | icalerror_check_value_type (value, ICAL_ATTACH_VALUE); | ||
976 | icalerror_check_arg_rv ((attach != NULL), "attach"); | ||
977 | |||
978 | impl = (struct icalvalue_impl *) value; | ||
972 | 979 | ||
980 | icalattach_ref (attach); | ||
973 | 981 | ||
974 | icalvalue_reset_kind(impl); | 982 | if (impl->data.v_attach) |
983 | icalattach_unref (impl->data.v_attach); | ||
984 | |||
985 | impl->data.v_attach = attach; | ||
975 | } | 986 | } |
976 | const char* icalvalue_get_binary(icalvalue* value) { | ||
977 | 987 | ||
978 | icalerror_check_arg( (value!=0),"value"); | 988 | icalattach * |
979 | icalerror_check_value_type(value, ICAL_BINARY_VALUE); | 989 | icalvalue_get_attach (const icalvalue *value) |
980 | return ((struct icalvalue_impl*)value)->data.v_string; | 990 | { |
991 | icalerror_check_arg_rz ((value != NULL), "value"); | ||
992 | icalerror_check_value_type (value, ICAL_ATTACH_VALUE); | ||
993 | |||
994 | return value->data.v_attach; | ||
981 | } | 995 | } |
996 | |||
997 | |||
998 | |||
999 | |||
1000 | |||
1001 | |||
1002 | |||
1003 | /* The remaining interfaces are 'new', 'set' and 'get' for each of the value | ||
1004 | types */ | ||
1005 | |||
1006 | |||
1007 | /* 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 | |||
@@ -34,63 +34,64 @@ | |||
34 | #include "icaltime.h" | 34 | #include "icaltime.h" |
35 | #include "icalduration.h" | 35 | #include "icalduration.h" |
36 | #include "icalperiod.h" | 36 | #include "icalperiod.h" |
37 | #include "icalattach.h" | ||
37 | 38 | ||
38 | typedef void icalvalue; | 39 | typedef struct icalvalue_impl icalvalue; |
39 | 40 | ||
40 | 41 | ||
41 | 42 | ||
42 | void icalvalue_set_x(icalvalue* value, const char* v); | 43 | void icalvalue_set_x(icalvalue* value, const char* v); |
43 | icalvalue* icalvalue_new_x(const char* v); | 44 | icalvalue* icalvalue_new_x(const char* v); |
44 | const char* icalvalue_get_x(icalvalue* value); | 45 | const char* icalvalue_get_x(const icalvalue* value); |
45 | |||
46 | icalvalue* icalvalue_new_attach (struct icalattachtype* v); | ||
47 | void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v); | ||
48 | struct icalattachtype* icalvalue_get_attach(icalvalue* value); | ||
49 | 46 | ||
50 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); | 47 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); |
51 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); | 48 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); |
52 | struct icalrecurrencetype icalvalue_get_recur(icalvalue* value); | 49 | struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); |
53 | 50 | ||
54 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); | 51 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); |
55 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); | 52 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); |
56 | struct icaltriggertype icalvalue_get_trigger(icalvalue* value); | 53 | struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); |
57 | 54 | ||
58 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); | 55 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); |
59 | void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); | 56 | void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); |
60 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value); | 57 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); |
58 | |||
59 | icalvalue *icalvalue_new_attach (icalattach *attach); | ||
60 | void icalvalue_set_attach (icalvalue *value, icalattach *attach); | ||
61 | icalattach *icalvalue_get_attach (const icalvalue *value); | ||
61 | 62 | ||
62 | void icalvalue_reset_kind(icalvalue* value); | 63 | void icalvalue_reset_kind(icalvalue* value); |
63 | 64 | ||
64 | /* Everything below this line is machine generated. Do not edit. */ | ||
65 | typedef enum icalvalue_kind { | 65 | typedef enum icalvalue_kind { |
66 | ICAL_ANY_VALUE=5000, | 66 | ICAL_ANY_VALUE=5000, |
67 | ICAL_QUERY_VALUE=5001, | 67 | ICAL_QUERY_VALUE=5001, |
68 | ICAL_TRIGGER_VALUE=5002, | 68 | ICAL_DATE_VALUE=5002, |
69 | ICAL_STATUS_VALUE=5003, | 69 | ICAL_ATTACH_VALUE=5003, |
70 | ICAL_TRANSP_VALUE=5004, | 70 | ICAL_GEO_VALUE=5004, |
71 | ICAL_CLASS_VALUE=5005, | 71 | ICAL_STATUS_VALUE=5005, |
72 | ICAL_DATE_VALUE=5006, | 72 | ICAL_TRANSP_VALUE=5006, |
73 | ICAL_STRING_VALUE=5007, | 73 | ICAL_STRING_VALUE=5007, |
74 | ICAL_INTEGER_VALUE=5008, | 74 | ICAL_TEXT_VALUE=5008, |
75 | ICAL_PERIOD_VALUE=5009, | 75 | ICAL_REQUESTSTATUS_VALUE=5009, |
76 | ICAL_TEXT_VALUE=5010, | 76 | ICAL_BINARY_VALUE=5010, |
77 | ICAL_DURATION_VALUE=5011, | 77 | ICAL_PERIOD_VALUE=5011, |
78 | ICAL_BOOLEAN_VALUE=5012, | 78 | ICAL_FLOAT_VALUE=5012, |
79 | ICAL_URI_VALUE=5013, | 79 | ICAL_DATETIMEPERIOD_VALUE=5013, |
80 | ICAL_DATETIMEPERIOD_VALUE=5014, | 80 | ICAL_INTEGER_VALUE=5014, |
81 | ICAL_GEO_VALUE=5015, | 81 | ICAL_CLASS_VALUE=5015, |
82 | ICAL_DATETIME_VALUE=5016, | 82 | ICAL_URI_VALUE=5016, |
83 | ICAL_UTCOFFSET_VALUE=5017, | 83 | ICAL_DURATION_VALUE=5017, |
84 | ICAL_ATTACH_VALUE=5018, | 84 | ICAL_BOOLEAN_VALUE=5018, |
85 | ICAL_ACTION_VALUE=5019, | 85 | ICAL_X_VALUE=5019, |
86 | ICAL_CALADDRESS_VALUE=5020, | 86 | ICAL_CALADDRESS_VALUE=5020, |
87 | ICAL_X_VALUE=5021, | 87 | ICAL_TRIGGER_VALUE=5021, |
88 | ICAL_FLOAT_VALUE=5022, | 88 | ICAL_XLICCLASS_VALUE=5022, |
89 | ICAL_REQUESTSTATUS_VALUE=5023, | 89 | ICAL_RECUR_VALUE=5023, |
90 | ICAL_METHOD_VALUE=5024, | 90 | ICAL_ACTION_VALUE=5024, |
91 | ICAL_BINARY_VALUE=5025, | 91 | ICAL_DATETIME_VALUE=5025, |
92 | ICAL_RECUR_VALUE=5026, | 92 | ICAL_UTCOFFSET_VALUE=5026, |
93 | ICAL_NO_VALUE=5027 | 93 | ICAL_METHOD_VALUE=5027, |
94 | ICAL_NO_VALUE=5028 | ||
94 | } icalvalue_kind ; | 95 | } icalvalue_kind ; |
95 | 96 | ||
96 | #define ICALPROPERTY_FIRST_ENUM 10000 | 97 | #define ICALPROPERTY_FIRST_ENUM 10000 |
@@ -148,136 +149,176 @@ typedef enum icalproperty_status { | |||
148 | typedef enum icalproperty_transp { | 149 | typedef enum icalproperty_transp { |
149 | ICAL_TRANSP_X = 10038, | 150 | ICAL_TRANSP_X = 10038, |
150 | ICAL_TRANSP_OPAQUE = 10039, | 151 | ICAL_TRANSP_OPAQUE = 10039, |
151 | ICAL_TRANSP_TRANSPARENT = 10040, | 152 | ICAL_TRANSP_OPAQUENOCONFLICT = 10040, |
152 | ICAL_TRANSP_NONE = 10041 | 153 | ICAL_TRANSP_TRANSPARENT = 10041, |
154 | ICAL_TRANSP_TRANSPARENTNOCONFLICT = 10042, | ||
155 | ICAL_TRANSP_NONE = 10043 | ||
153 | } icalproperty_transp; | 156 | } icalproperty_transp; |
154 | 157 | ||
155 | #define ICALPROPERTY_LAST_ENUM 10042 | 158 | typedef enum icalproperty_xlicclass { |
159 | ICAL_XLICCLASS_X = 10044, | ||
160 | ICAL_XLICCLASS_PUBLISHNEW = 10045, | ||
161 | ICAL_XLICCLASS_PUBLISHUPDATE = 10046, | ||
162 | ICAL_XLICCLASS_PUBLISHFREEBUSY = 10047, | ||
163 | ICAL_XLICCLASS_REQUESTNEW = 10048, | ||
164 | ICAL_XLICCLASS_REQUESTUPDATE = 10049, | ||
165 | ICAL_XLICCLASS_REQUESTRESCHEDULE = 10050, | ||
166 | ICAL_XLICCLASS_REQUESTDELEGATE = 10051, | ||
167 | ICAL_XLICCLASS_REQUESTNEWORGANIZER = 10052, | ||
168 | ICAL_XLICCLASS_REQUESTFORWARD = 10053, | ||
169 | ICAL_XLICCLASS_REQUESTSTATUS = 10054, | ||
170 | ICAL_XLICCLASS_REQUESTFREEBUSY = 10055, | ||
171 | ICAL_XLICCLASS_REPLYACCEPT = 10056, | ||
172 | ICAL_XLICCLASS_REPLYDECLINE = 10057, | ||
173 | ICAL_XLICCLASS_REPLYDELEGATE = 10058, | ||
174 | ICAL_XLICCLASS_REPLYCRASHERACCEPT = 10059, | ||
175 | ICAL_XLICCLASS_REPLYCRASHERDECLINE = 10060, | ||
176 | ICAL_XLICCLASS_ADDINSTANCE = 10061, | ||
177 | ICAL_XLICCLASS_CANCELEVENT = 10062, | ||
178 | ICAL_XLICCLASS_CANCELINSTANCE = 10063, | ||
179 | ICAL_XLICCLASS_CANCELALL = 10064, | ||
180 | ICAL_XLICCLASS_REFRESH = 10065, | ||
181 | ICAL_XLICCLASS_COUNTER = 10066, | ||
182 | ICAL_XLICCLASS_DECLINECOUNTER = 10067, | ||
183 | ICAL_XLICCLASS_MALFORMED = 10068, | ||
184 | ICAL_XLICCLASS_OBSOLETE = 10069, | ||
185 | ICAL_XLICCLASS_MISSEQUENCED = 10070, | ||
186 | ICAL_XLICCLASS_UNKNOWN = 10071, | ||
187 | ICAL_XLICCLASS_NONE = 10072 | ||
188 | } icalproperty_xlicclass; | ||
189 | |||
190 | #define ICALPROPERTY_LAST_ENUM 10073 | ||
156 | 191 | ||
157 | 192 | ||
158 | /* QUERY */ | 193 | /* QUERY */ |
159 | icalvalue* icalvalue_new_query(const char* v); | 194 | icalvalue* icalvalue_new_query(const char* v); |
160 | const char* icalvalue_get_query(icalvalue* value); | 195 | const char* icalvalue_get_query(const icalvalue* value); |
161 | void icalvalue_set_query(icalvalue* value, const char* v); | 196 | void icalvalue_set_query(icalvalue* value, const char* v); |
162 | 197 | ||
163 | 198 | ||
199 | /* DATE */ | ||
200 | icalvalue* icalvalue_new_date(struct icaltimetype v); | ||
201 | struct icaltimetype icalvalue_get_date(const icalvalue* value); | ||
202 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v); | ||
203 | |||
204 | |||
205 | /* GEO */ | ||
206 | icalvalue* icalvalue_new_geo(struct icalgeotype v); | ||
207 | struct icalgeotype icalvalue_get_geo(const icalvalue* value); | ||
208 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); | ||
209 | |||
210 | |||
164 | /* STATUS */ | 211 | /* STATUS */ |
165 | icalvalue* icalvalue_new_status(enum icalproperty_status v); | 212 | icalvalue* icalvalue_new_status(enum icalproperty_status v); |
166 | enum icalproperty_status icalvalue_get_status(icalvalue* value); | 213 | enum icalproperty_status icalvalue_get_status(const icalvalue* value); |
167 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v); | 214 | void icalvalue_set_status(icalvalue* value, enum icalproperty_status v); |
168 | 215 | ||
169 | 216 | ||
170 | /* TRANSP */ | 217 | /* TRANSP */ |
171 | icalvalue* icalvalue_new_transp(enum icalproperty_transp v); | 218 | icalvalue* icalvalue_new_transp(enum icalproperty_transp v); |
172 | enum icalproperty_transp icalvalue_get_transp(icalvalue* value); | 219 | enum icalproperty_transp icalvalue_get_transp(const icalvalue* value); |
173 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v); | 220 | void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v); |
174 | 221 | ||
175 | 222 | ||
176 | /* CLASS */ | 223 | /* STRING */ |
177 | icalvalue* icalvalue_new_class(enum icalproperty_class v); | 224 | icalvalue* icalvalue_new_string(const char* v); |
178 | enum icalproperty_class icalvalue_get_class(icalvalue* value); | 225 | const char* icalvalue_get_string(const icalvalue* value); |
179 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); | 226 | void icalvalue_set_string(icalvalue* value, const char* v); |
180 | 227 | ||
181 | 228 | ||
182 | /* DATE */ | 229 | /* TEXT */ |
183 | icalvalue* icalvalue_new_date(struct icaltimetype v); | 230 | icalvalue* icalvalue_new_text(const char* v); |
184 | struct icaltimetype icalvalue_get_date(icalvalue* value); | 231 | const char* icalvalue_get_text(const icalvalue* value); |
185 | void icalvalue_set_date(icalvalue* value, struct icaltimetype v); | 232 | void icalvalue_set_text(icalvalue* value, const char* v); |
186 | 233 | ||
187 | 234 | ||
188 | /* STRING */ | 235 | /* REQUEST-STATUS */ |
189 | icalvalue* icalvalue_new_string(const char* v); | 236 | icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v); |
190 | const char* icalvalue_get_string(icalvalue* value); | 237 | struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value); |
191 | void icalvalue_set_string(icalvalue* value, const char* v); | 238 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v); |
192 | 239 | ||
193 | 240 | ||
194 | /* INTEGER */ | 241 | /* BINARY */ |
195 | icalvalue* icalvalue_new_integer(int v); | 242 | icalvalue* icalvalue_new_binary(const char* v); |
196 | int icalvalue_get_integer(icalvalue* value); | 243 | const char* icalvalue_get_binary(const icalvalue* value); |
197 | void icalvalue_set_integer(icalvalue* value, int v); | 244 | void icalvalue_set_binary(icalvalue* value, const char* v); |
198 | 245 | ||
199 | 246 | ||
200 | /* PERIOD */ | 247 | /* PERIOD */ |
201 | icalvalue* icalvalue_new_period(struct icalperiodtype v); | 248 | icalvalue* icalvalue_new_period(struct icalperiodtype v); |
202 | struct icalperiodtype icalvalue_get_period(icalvalue* value); | 249 | struct icalperiodtype icalvalue_get_period(const icalvalue* value); |
203 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v); | 250 | void icalvalue_set_period(icalvalue* value, struct icalperiodtype v); |
204 | 251 | ||
205 | 252 | ||
206 | /* TEXT */ | 253 | /* FLOAT */ |
207 | icalvalue* icalvalue_new_text(const char* v); | 254 | icalvalue* icalvalue_new_float(float v); |
208 | const char* icalvalue_get_text(icalvalue* value); | 255 | float icalvalue_get_float(const icalvalue* value); |
209 | void icalvalue_set_text(icalvalue* value, const char* v); | 256 | void icalvalue_set_float(icalvalue* value, float v); |
210 | 257 | ||
211 | 258 | ||
212 | /* DURATION */ | 259 | /* INTEGER */ |
213 | icalvalue* icalvalue_new_duration(struct icaldurationtype v); | 260 | icalvalue* icalvalue_new_integer(int v); |
214 | struct icaldurationtype icalvalue_get_duration(icalvalue* value); | 261 | int icalvalue_get_integer(const icalvalue* value); |
215 | void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v); | 262 | void icalvalue_set_integer(icalvalue* value, int v); |
216 | 263 | ||
217 | 264 | ||
218 | /* BOOLEAN */ | 265 | /* CLASS */ |
219 | icalvalue* icalvalue_new_boolean(int v); | 266 | icalvalue* icalvalue_new_class(enum icalproperty_class v); |
220 | int icalvalue_get_boolean(icalvalue* value); | 267 | enum icalproperty_class icalvalue_get_class(const icalvalue* value); |
221 | void icalvalue_set_boolean(icalvalue* value, int v); | 268 | void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); |
222 | 269 | ||
223 | 270 | ||
224 | /* URI */ | 271 | /* URI */ |
225 | icalvalue* icalvalue_new_uri(const char* v); | 272 | icalvalue* icalvalue_new_uri(const char* v); |
226 | const char* icalvalue_get_uri(icalvalue* value); | 273 | const char* icalvalue_get_uri(const icalvalue* value); |
227 | void icalvalue_set_uri(icalvalue* value, const char* v); | 274 | void icalvalue_set_uri(icalvalue* value, const char* v); |
228 | 275 | ||
229 | 276 | ||
230 | /* GEO */ | 277 | /* DURATION */ |
231 | icalvalue* icalvalue_new_geo(struct icalgeotype v); | 278 | icalvalue* icalvalue_new_duration(struct icaldurationtype v); |
232 | struct icalgeotype icalvalue_get_geo(icalvalue* value); | 279 | struct icaldurationtype icalvalue_get_duration(const icalvalue* value); |
233 | void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); | 280 | void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v); |
234 | 281 | ||
235 | 282 | ||
236 | /* DATE-TIME */ | 283 | /* BOOLEAN */ |
237 | icalvalue* icalvalue_new_datetime(struct icaltimetype v); | 284 | icalvalue* icalvalue_new_boolean(int v); |
238 | struct icaltimetype icalvalue_get_datetime(icalvalue* value); | 285 | int icalvalue_get_boolean(const icalvalue* value); |
239 | void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); | 286 | void icalvalue_set_boolean(icalvalue* value, int v); |
240 | 287 | ||
241 | 288 | ||
242 | /* UTC-OFFSET */ | 289 | /* CAL-ADDRESS */ |
243 | icalvalue* icalvalue_new_utcoffset(int v); | 290 | icalvalue* icalvalue_new_caladdress(const char* v); |
244 | int icalvalue_get_utcoffset(icalvalue* value); | 291 | const char* icalvalue_get_caladdress(const icalvalue* value); |
245 | void icalvalue_set_utcoffset(icalvalue* value, int v); | 292 | void icalvalue_set_caladdress(icalvalue* value, const char* v); |
293 | |||
294 | |||
295 | /* X-LIC-CLASS */ | ||
296 | icalvalue* icalvalue_new_xlicclass(enum icalproperty_xlicclass v); | ||
297 | enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value); | ||
298 | void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v); | ||
246 | 299 | ||
247 | 300 | ||
248 | /* ACTION */ | 301 | /* ACTION */ |
249 | icalvalue* icalvalue_new_action(enum icalproperty_action v); | 302 | icalvalue* icalvalue_new_action(enum icalproperty_action v); |
250 | enum icalproperty_action icalvalue_get_action(icalvalue* value); | 303 | enum icalproperty_action icalvalue_get_action(const icalvalue* value); |
251 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v); | 304 | void icalvalue_set_action(icalvalue* value, enum icalproperty_action v); |
252 | 305 | ||
253 | 306 | ||
254 | /* CAL-ADDRESS */ | 307 | /* DATE-TIME */ |
255 | icalvalue* icalvalue_new_caladdress(const char* v); | 308 | icalvalue* icalvalue_new_datetime(struct icaltimetype v); |
256 | const char* icalvalue_get_caladdress(icalvalue* value); | 309 | struct icaltimetype icalvalue_get_datetime(const icalvalue* value); |
257 | void icalvalue_set_caladdress(icalvalue* value, const char* v); | 310 | void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); |
258 | |||
259 | |||
260 | /* FLOAT */ | ||
261 | icalvalue* icalvalue_new_float(float v); | ||
262 | float icalvalue_get_float(icalvalue* value); | ||
263 | void icalvalue_set_float(icalvalue* value, float v); | ||
264 | 311 | ||
265 | 312 | ||
266 | /* REQUEST-STATUS */ | 313 | /* UTC-OFFSET */ |
267 | icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v); | 314 | icalvalue* icalvalue_new_utcoffset(int v); |
268 | struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value); | 315 | int icalvalue_get_utcoffset(const icalvalue* value); |
269 | void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v); | 316 | void icalvalue_set_utcoffset(icalvalue* value, int v); |
270 | 317 | ||
271 | 318 | ||
272 | /* METHOD */ | 319 | /* METHOD */ |
273 | icalvalue* icalvalue_new_method(enum icalproperty_method v); | 320 | icalvalue* icalvalue_new_method(enum icalproperty_method v); |
274 | enum icalproperty_method icalvalue_get_method(icalvalue* value); | 321 | enum icalproperty_method icalvalue_get_method(const icalvalue* value); |
275 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v); | 322 | void icalvalue_set_method(icalvalue* value, enum icalproperty_method v); |
276 | 323 | ||
277 | |||
278 | /* BINARY */ | ||
279 | icalvalue* icalvalue_new_binary(const char* v); | ||
280 | const char* icalvalue_get_binary(icalvalue* value); | ||
281 | void icalvalue_set_binary(icalvalue* value, const char* v); | ||
282 | |||
283 | #endif /*ICALVALUE_H*/ | 324 | #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 | |||
@@ -36,14 +36,9 @@ | |||
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | #include <stdio.h> | 37 | #include <stdio.h> |
38 | 38 | ||
39 | #ifdef ICAL_NO_LIBICAL | ||
40 | #define icalerror_set_errno(x) | ||
41 | #define icalerror_check_arg_rv(x,y) | ||
42 | #define icalerror_check_arg_re(x,y,z) | ||
43 | #else | ||
44 | #include "icalerror.h" | 39 | #include "icalerror.h" |
45 | #include "icalmemory.h" | 40 | #include "icalmemory.h" |
46 | #endif | 41 | #include "icalvalue.h" |
47 | 42 | ||
48 | 43 | ||
49 | 44 | ||
@@ -51,34 +46,32 @@ | |||
51 | /* From Seth Alves, <alves@hungry.com> */ | 46 | /* From Seth Alves, <alves@hungry.com> */ |
52 | struct icaldurationtype icaldurationtype_from_int(int t) | 47 | struct icaldurationtype icaldurationtype_from_int(int t) |
53 | { | 48 | { |
54 | struct icaldurationtype dur; | 49 | struct icaldurationtype dur; |
55 | int used = 0; | 50 | int used = 0; |
56 | 51 | ||
57 | dur = icaldurationtype_null_duration(); | 52 | dur = icaldurationtype_null_duration(); |
58 | 53 | ||
59 | if(t < 0){ | 54 | if(t < 0){ |
60 | dur.is_neg = 1; | 55 | dur.is_neg = 1; |
61 | t = -t; | 56 | t = -t; |
62 | } | 57 | } |
63 | 58 | ||
64 | if (t % (60 * 60 * 24 * 7) == 0) { | 59 | if (t % (60 * 60 * 24 * 7) == 0) { |
65 | dur.weeks = t / (60 * 60 * 24 * 7); | 60 | dur.weeks = t / (60 * 60 * 24 * 7); |
66 | } else { | 61 | } else { |
67 | used += dur.weeks * (60 * 60 * 24 * 7); | 62 | used += dur.weeks * (60 * 60 * 24 * 7); |
68 | dur.days = (t - used) / (60 * 60 * 24); | 63 | dur.days = (t - used) / (60 * 60 * 24); |
69 | used += dur.days * (60 * 60 * 24); | 64 | used += dur.days * (60 * 60 * 24); |
70 | dur.hours = (t - used) / (60 * 60); | 65 | dur.hours = (t - used) / (60 * 60); |
71 | used += dur.hours * (60 * 60); | 66 | used += dur.hours * (60 * 60); |
72 | dur.minutes = (t - used) / (60); | 67 | dur.minutes = (t - used) / (60); |
73 | used += dur.minutes * (60); | 68 | used += dur.minutes * (60); |
74 | dur.seconds = (t - used); | 69 | dur.seconds = (t - used); |
75 | } | 70 | } |
76 | 71 | ||
77 | return dur; | 72 | return dur; |
78 | } | 73 | } |
79 | 74 | ||
80 | #ifndef ICAL_NO_LIBICAL | ||
81 | #include "icalvalue.h" | ||
82 | struct icaldurationtype icaldurationtype_from_string(const char* str) | 75 | struct icaldurationtype icaldurationtype_from_string(const char* str) |
83 | { | 76 | { |
84 | 77 | ||
@@ -138,7 +131,7 @@ struct icaldurationtype icaldurationtype_from_string(const char* str) | |||
138 | 131 | ||
139 | if (begin_flag == 0) goto error; | 132 | if (begin_flag == 0) goto error; |
140 | /* Get all of the digits, not one at a time */ | 133 | /* Get all of the digits, not one at a time */ |
141 | scan_size = sscanf((char*)(str+i),"%d",&digits); | 134 | scan_size = sscanf(&str[i],"%d",&digits); |
142 | if(scan_size == 0) goto error; | 135 | if(scan_size == 0) goto error; |
143 | break; | 136 | break; |
144 | } | 137 | } |
@@ -187,12 +180,11 @@ struct icaldurationtype icaldurationtype_from_string(const char* str) | |||
187 | 180 | ||
188 | error: | 181 | error: |
189 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 182 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
190 | memset(&d, 0, sizeof(struct icaldurationtype)); | 183 | return icaldurationtype_bad_duration(); |
191 | return d; | ||
192 | |||
193 | } | 184 | } |
194 | 185 | ||
195 | #define TMP_BUF_SIZE 1024 | 186 | #define TMP_BUF_SIZE 1024 |
187 | static | ||
196 | void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size, | 188 | void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size, |
197 | char* sep, unsigned int value) { | 189 | char* sep, unsigned int value) { |
198 | 190 | ||
@@ -253,7 +245,7 @@ char* icaldurationtype_as_ical_string(struct icaldurationtype d) | |||
253 | 245 | ||
254 | } | 246 | } |
255 | } else { | 247 | } else { |
256 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PTS0"); | 248 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PT0S"); |
257 | } | 249 | } |
258 | 250 | ||
259 | output_line = icalmemory_tmp_copy(buf); | 251 | output_line = icalmemory_tmp_copy(buf); |
@@ -263,8 +255,6 @@ char* icaldurationtype_as_ical_string(struct icaldurationtype d) | |||
263 | 255 | ||
264 | } | 256 | } |
265 | 257 | ||
266 | #endif | ||
267 | |||
268 | 258 | ||
269 | /* From Russel Steinthal */ | 259 | /* From Russel Steinthal */ |
270 | int icaldurationtype_as_int(struct icaldurationtype dur) | 260 | int icaldurationtype_as_int(struct icaldurationtype dur) |
@@ -277,7 +267,7 @@ int icaldurationtype_as_int(struct icaldurationtype dur) | |||
277 | * (dur.is_neg==1? -1 : 1) ) ; | 267 | * (dur.is_neg==1? -1 : 1) ) ; |
278 | } | 268 | } |
279 | 269 | ||
280 | struct icaldurationtype icaldurationtype_null_duration() | 270 | struct icaldurationtype icaldurationtype_null_duration(void) |
281 | { | 271 | { |
282 | struct icaldurationtype d; | 272 | struct icaldurationtype d; |
283 | 273 | ||
@@ -295,6 +285,25 @@ int icaldurationtype_is_null_duration(struct icaldurationtype d) | |||
295 | } | 285 | } |
296 | } | 286 | } |
297 | 287 | ||
288 | /* in icalvalue_new_from_string_with_error, we should not call | ||
289 | icaldurationtype_is_null_duration() to see if there is an error | ||
290 | condition. Null duration is perfectly valid for an alarm. | ||
291 | We cannot depend on the caller to check icalerrno either, | ||
292 | following the philosophy of unix errno. we set the is_neg | ||
293 | to -1 to indicate that this is a bad duration. | ||
294 | */ | ||
295 | struct icaldurationtype icaldurationtype_bad_duration() | ||
296 | { | ||
297 | struct icaldurationtype d; | ||
298 | memset(&d,0,sizeof(struct icaldurationtype)); | ||
299 | d.is_neg = -1; | ||
300 | return d; | ||
301 | } | ||
302 | |||
303 | int icaldurationtype_is_bad_duration(struct icaldurationtype d) | ||
304 | { | ||
305 | return (d.is_neg == -1); | ||
306 | } | ||
298 | 307 | ||
299 | 308 | ||
300 | struct icaltimetype icaltime_add(struct icaltimetype t, | 309 | struct icaltimetype icaltime_add(struct icaltimetype t, |
@@ -316,7 +325,7 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1, | |||
316 | time_t t1t = icaltime_as_timet(t1); | 325 | time_t t1t = icaltime_as_timet(t1); |
317 | time_t t2t = icaltime_as_timet(t2); | 326 | time_t t2t = icaltime_as_timet(t2); |
318 | 327 | ||
319 | return icaldurationtype_from_int(t1t-t2t); | 328 | return icaldurationtype_from_int((int)(t1t-t2t)); |
320 | 329 | ||
321 | 330 | ||
322 | } | 331 | } |
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 | |||
@@ -45,8 +45,10 @@ struct icaldurationtype icaldurationtype_from_int(int t); | |||
45 | struct icaldurationtype icaldurationtype_from_string(const char*); | 45 | struct icaldurationtype icaldurationtype_from_string(const char*); |
46 | int icaldurationtype_as_int(struct icaldurationtype duration); | 46 | int icaldurationtype_as_int(struct icaldurationtype duration); |
47 | char* icaldurationtype_as_ical_string(struct icaldurationtype d); | 47 | char* icaldurationtype_as_ical_string(struct icaldurationtype d); |
48 | struct icaldurationtype icaldurationtype_null_duration(); | 48 | struct icaldurationtype icaldurationtype_null_duration(void); |
49 | struct icaldurationtype icaldurationtype_bad_duration(void); | ||
49 | int icaldurationtype_is_null_duration(struct icaldurationtype d); | 50 | int icaldurationtype_is_null_duration(struct icaldurationtype d); |
51 | int icaldurationtype_is_bad_duration(struct icaldurationtype d); | ||
50 | 52 | ||
51 | struct icaltimetype icaltime_add(struct icaltimetype t, | 53 | struct icaltimetype icaltime_add(struct icaltimetype t, |
52 | struct icaldurationtype d); | 54 | 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 | |||
@@ -34,10 +34,11 @@ | |||
34 | #include <stdio.h> /* For stderr */ | 34 | #include <stdio.h> /* For stderr */ |
35 | #include <string.h> /* For strncmp */ | 35 | #include <string.h> /* For strncmp */ |
36 | #include <assert.h> | 36 | #include <assert.h> |
37 | #include "icalmemory.h" | ||
37 | 38 | ||
38 | 39 | /*** @brief Allowed request status values | |
39 | 40 | */ | |
40 | struct { | 41 | static struct { |
41 | enum icalrequeststatus kind; | 42 | enum icalrequeststatus kind; |
42 | int major; | 43 | int major; |
43 | int minor; | 44 | int minor; |
@@ -70,18 +71,25 @@ struct { | |||
70 | {ICAL_3_12_UNKCOMP_STATUS, 3,12,"Unknown component or property found."}, | 71 | {ICAL_3_12_UNKCOMP_STATUS, 3,12,"Unknown component or property found."}, |
71 | {ICAL_3_13_BADCOMP_STATUS, 3,13,"Unsupported component or property found"}, | 72 | {ICAL_3_13_BADCOMP_STATUS, 3,13,"Unsupported component or property found"}, |
72 | {ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."}, | 73 | {ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."}, |
74 | {ICAL_3_15_INVCOMMAND, 3,15,"Invalid command."}, | ||
73 | {ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."}, | 75 | {ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."}, |
76 | {ICAL_4_1_STORE_ACCESS_DENIED, 4,1,"Store Access Denied."}, | ||
77 | {ICAL_4_2_STORE_FAILED, 4,2,"Store Failed."}, | ||
78 | {ICAL_4_3_STORE_NOT_FOUND, 4,3,"Store not found."}, | ||
74 | {ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."}, | 79 | {ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."}, |
75 | {ICAL_5_1_UNAVAIL_STATUS, 5,1,"Service unavailable."}, | 80 | {ICAL_5_1_UNAVAIL_STATUS, 5,1,"Service unavailable."}, |
76 | {ICAL_5_2_NOSERVICE_STATUS, 5,2,"Invalid calendar service."}, | 81 | {ICAL_5_2_NOSERVICE_STATUS, 5,2,"Invalid calendar service."}, |
77 | {ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."}, | 82 | {ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."}, |
83 | {ICAL_6_1_CONTAINER_NOT_FOUND, 6,1,"Container not found."}, | ||
84 | {ICAL_9_0_UNRECOGNIZED_COMMAND, 9,0,"An unrecognized command was received."}, | ||
78 | {ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"} | 85 | {ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"} |
79 | }; | 86 | }; |
80 | 87 | ||
81 | 88 | ||
89 | /*** @brief Return the descriptive text for a request status | ||
90 | */ | ||
82 | const char* icalenum_reqstat_desc(icalrequeststatus stat) | 91 | const char* icalenum_reqstat_desc(icalrequeststatus stat) |
83 | { | 92 | { |
84 | |||
85 | int i; | 93 | int i; |
86 | 94 | ||
87 | for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) { | 95 | for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) { |
@@ -93,7 +101,26 @@ const char* icalenum_reqstat_desc(icalrequeststatus stat) | |||
93 | return 0; | 101 | return 0; |
94 | } | 102 | } |
95 | 103 | ||
104 | /*** @brief Return the code for a request status | ||
105 | */ | ||
106 | char* icalenum_reqstat_code(icalrequeststatus stat) | ||
107 | { | ||
108 | int i, major, minor; | ||
109 | char tmpbuf[36]; | ||
110 | |||
111 | for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) { | ||
112 | if ( request_status_map[i].kind == stat) { | ||
113 | major = request_status_map[i].major; | ||
114 | minor = request_status_map[i].minor; | ||
115 | sprintf(tmpbuf, "%i.%i", major, minor); | ||
116 | return icalmemory_tmp_copy(tmpbuf); | ||
117 | } | ||
118 | } | ||
119 | return NULL; | ||
120 | } | ||
96 | 121 | ||
122 | /*** @brief Return the major number for a request status | ||
123 | */ | ||
97 | short icalenum_reqstat_major(icalrequeststatus stat) | 124 | short icalenum_reqstat_major(icalrequeststatus stat) |
98 | { | 125 | { |
99 | int i; | 126 | int i; |
@@ -106,6 +133,8 @@ short icalenum_reqstat_major(icalrequeststatus stat) | |||
106 | return -1; | 133 | return -1; |
107 | } | 134 | } |
108 | 135 | ||
136 | /*** @brief Return the minor number for a request status | ||
137 | */ | ||
109 | short icalenum_reqstat_minor(icalrequeststatus stat) | 138 | short icalenum_reqstat_minor(icalrequeststatus stat) |
110 | { | 139 | { |
111 | int i; | 140 | int i; |
@@ -119,6 +148,8 @@ short icalenum_reqstat_minor(icalrequeststatus stat) | |||
119 | } | 148 | } |
120 | 149 | ||
121 | 150 | ||
151 | /*** @brief Return a request status for major/minor status numbers | ||
152 | */ | ||
122 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor) | 153 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor) |
123 | { | 154 | { |
124 | int i; | 155 | int i; |
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 | |||
@@ -43,6 +43,7 @@ typedef enum icalcomponent_kind { | |||
43 | ICAL_VTODO_COMPONENT, | 43 | ICAL_VTODO_COMPONENT, |
44 | ICAL_VJOURNAL_COMPONENT, | 44 | ICAL_VJOURNAL_COMPONENT, |
45 | ICAL_VCALENDAR_COMPONENT, | 45 | ICAL_VCALENDAR_COMPONENT, |
46 | ICAL_VAGENDA_COMPONENT, | ||
46 | ICAL_VFREEBUSY_COMPONENT, | 47 | ICAL_VFREEBUSY_COMPONENT, |
47 | ICAL_VALARM_COMPONENT, | 48 | ICAL_VALARM_COMPONENT, |
48 | ICAL_XAUDIOALARM_COMPONENT, | 49 | ICAL_XAUDIOALARM_COMPONENT, |
@@ -98,11 +99,17 @@ typedef enum icalrequeststatus { | |||
98 | ICAL_3_12_UNKCOMP_STATUS, | 99 | ICAL_3_12_UNKCOMP_STATUS, |
99 | ICAL_3_13_BADCOMP_STATUS, | 100 | ICAL_3_13_BADCOMP_STATUS, |
100 | ICAL_3_14_NOCAP_STATUS, | 101 | ICAL_3_14_NOCAP_STATUS, |
102 | ICAL_3_15_INVCOMMAND, | ||
101 | ICAL_4_0_BUSY_STATUS, | 103 | ICAL_4_0_BUSY_STATUS, |
104 | ICAL_4_1_STORE_ACCESS_DENIED, | ||
105 | ICAL_4_2_STORE_FAILED, | ||
106 | ICAL_4_3_STORE_NOT_FOUND, | ||
102 | ICAL_5_0_MAYBE_STATUS, | 107 | ICAL_5_0_MAYBE_STATUS, |
103 | ICAL_5_1_UNAVAIL_STATUS, | 108 | ICAL_5_1_UNAVAIL_STATUS, |
104 | ICAL_5_2_NOSERVICE_STATUS, | 109 | ICAL_5_2_NOSERVICE_STATUS, |
105 | ICAL_5_3_NOSCHED_STATUS | 110 | ICAL_5_3_NOSCHED_STATUS, |
111 | ICAL_6_1_CONTAINER_NOT_FOUND, | ||
112 | ICAL_9_0_UNRECOGNIZED_COMMAND | ||
106 | } icalrequeststatus; | 113 | } icalrequeststatus; |
107 | 114 | ||
108 | 115 | ||
@@ -110,6 +117,7 @@ const char* icalenum_reqstat_desc(icalrequeststatus stat); | |||
110 | short icalenum_reqstat_major(icalrequeststatus stat); | 117 | short icalenum_reqstat_major(icalrequeststatus stat); |
111 | short icalenum_reqstat_minor(icalrequeststatus stat); | 118 | short icalenum_reqstat_minor(icalrequeststatus stat); |
112 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor); | 119 | icalrequeststatus icalenum_num_to_reqstat(short major, short minor); |
120 | char* icalenum_reqstat_code(icalrequeststatus stat); | ||
113 | 121 | ||
114 | /*********************************************************************** | 122 | /*********************************************************************** |
115 | * Conversion functions | 123 | * Conversion functions |
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 | |||
@@ -29,13 +29,53 @@ | |||
29 | #include "config.h" | 29 | #include "config.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <stdlib.h> /* for malloc() */ | ||
33 | #include <string.h> /* for strcmp */ | ||
32 | #include "icalerror.h" | 34 | #include "icalerror.h" |
33 | 35 | ||
34 | #include <string.h> | 36 | #ifdef HAVE_PTHREAD |
37 | #include <pthread.h> | ||
35 | 38 | ||
36 | icalerrorenum icalerrno; | 39 | static pthread_key_t icalerrno_key; |
40 | static pthread_once_t icalerrno_key_once = PTHREAD_ONCE_INIT; | ||
41 | |||
42 | static void icalerrno_destroy(void* buf) { | ||
43 | free(buf); | ||
44 | pthread_setspecific(icalerrno_key, NULL); | ||
45 | } | ||
46 | |||
47 | static void icalerrno_key_alloc(void) { | ||
48 | pthread_key_create(&icalerrno_key, icalerrno_destroy); | ||
49 | } | ||
50 | |||
51 | icalerrorenum *icalerrno_return(void) { | ||
52 | icalerrorenum *_errno; | ||
53 | |||
54 | pthread_once(&icalerrno_key_once, icalerrno_key_alloc); | ||
55 | |||
56 | _errno = (icalerrorenum*) pthread_getspecific(icalerrno_key); | ||
57 | |||
58 | if (!_errno) { | ||
59 | _errno = malloc(sizeof(icalerrorenum)); | ||
60 | *_errno = ICAL_NO_ERROR; | ||
61 | pthread_setspecific(icalerrno_key, _errno); | ||
62 | } | ||
63 | return _errno; | ||
64 | } | ||
65 | |||
66 | #else | ||
67 | |||
68 | static icalerrorenum icalerrno_storage = ICAL_NO_ERROR; | ||
69 | |||
70 | icalerrorenum *icalerrno_return(void) { | ||
71 | return &icalerrno_storage; | ||
72 | } | ||
73 | |||
74 | #endif | ||
75 | |||
76 | |||
77 | static int foo; | ||
37 | 78 | ||
38 | int foo; | ||
39 | void icalerror_stop_here(void) | 79 | void icalerror_stop_here(void) |
40 | { | 80 | { |
41 | foo++; /* Keep optimizers from removing routine */ | 81 | foo++; /* Keep optimizers from removing routine */ |
@@ -79,10 +119,11 @@ struct icalerror_state { | |||
79 | icalerrorstate state; | 119 | icalerrorstate state; |
80 | }; | 120 | }; |
81 | 121 | ||
82 | struct icalerror_state error_state_map[] = | 122 | static struct icalerror_state error_state_map[] = |
83 | { | 123 | { |
84 | { ICAL_BADARG_ERROR,ICAL_ERROR_DEFAULT}, | 124 | { ICAL_BADARG_ERROR,ICAL_ERROR_DEFAULT}, |
85 | { ICAL_NEWFAILED_ERROR,ICAL_ERROR_DEFAULT}, | 125 | { ICAL_NEWFAILED_ERROR,ICAL_ERROR_DEFAULT}, |
126 | { ICAL_ALLOCATION_ERROR,ICAL_ERROR_DEFAULT}, | ||
86 | { ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_DEFAULT}, | 127 | { ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_DEFAULT}, |
87 | { ICAL_PARSE_ERROR,ICAL_ERROR_DEFAULT}, | 128 | { ICAL_PARSE_ERROR,ICAL_ERROR_DEFAULT}, |
88 | { ICAL_INTERNAL_ERROR,ICAL_ERROR_DEFAULT}, | 129 | { ICAL_INTERNAL_ERROR,ICAL_ERROR_DEFAULT}, |
@@ -104,6 +145,7 @@ static struct icalerror_string_map string_map[] = | |||
104 | { | 145 | { |
105 | {"BADARG",ICAL_BADARG_ERROR,"BADARG: Bad argument to function"}, | 146 | {"BADARG",ICAL_BADARG_ERROR,"BADARG: Bad argument to function"}, |
106 | { "NEWFAILED",ICAL_NEWFAILED_ERROR,"NEWFAILED: Failed to create a new object via a *_new() routine"}, | 147 | { "NEWFAILED",ICAL_NEWFAILED_ERROR,"NEWFAILED: Failed to create a new object via a *_new() routine"}, |
148 | { "ALLOCATION",ICAL_ALLOCATION_ERROR,"ALLOCATION: Failed to allocate new memory"}, | ||
107 | {"MALFORMEDDATA",ICAL_MALFORMEDDATA_ERROR,"MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties"}, | 149 | {"MALFORMEDDATA",ICAL_MALFORMEDDATA_ERROR,"MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties"}, |
108 | { "PARSE",ICAL_PARSE_ERROR,"PARSE: Failed to parse a part of an iCal component"}, | 150 | { "PARSE",ICAL_PARSE_ERROR,"PARSE: Failed to parse a part of an iCal component"}, |
109 | {"INTERNAL",ICAL_INTERNAL_ERROR,"INTERNAL: Random internal error. This indicates an error in the library code, not an error in use"}, | 151 | {"INTERNAL",ICAL_INTERNAL_ERROR,"INTERNAL: Random internal error. This indicates an error in the library code, not an error in use"}, |
@@ -168,7 +210,7 @@ void icalerror_set_error_state( icalerrorenum error, | |||
168 | { | 210 | { |
169 | int i; | 211 | int i; |
170 | 212 | ||
171 | for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){ | 213 | for(i = 0; error_state_map[i].error!= ICAL_NO_ERROR;i++){ |
172 | if(error_state_map[i].error == error){ | 214 | if(error_state_map[i].error == error){ |
173 | error_state_map[i].state = state; | 215 | error_state_map[i].state = state; |
174 | } | 216 | } |
@@ -179,7 +221,7 @@ icalerrorstate icalerror_get_error_state( icalerrorenum error) | |||
179 | { | 221 | { |
180 | int i; | 222 | int i; |
181 | 223 | ||
182 | for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){ | 224 | for(i = 0; error_state_map[i].error!= ICAL_NO_ERROR;i++){ |
183 | if(error_state_map[i].error == error){ | 225 | if(error_state_map[i].error == error){ |
184 | return error_state_map[i].state; | 226 | return error_state_map[i].state; |
185 | } | 227 | } |
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 | |||
@@ -38,7 +38,7 @@ | |||
38 | #define ICAL_SETERROR_ISFUNC | 38 | #define ICAL_SETERROR_ISFUNC |
39 | 39 | ||
40 | 40 | ||
41 | /* This routine is called before any error is triggered. It is called | 41 | /** This routine is called before any error is triggered. It is called |
42 | by icalerror_set_errno, so it does not appear in all of the macros | 42 | by icalerror_set_errno, so it does not appear in all of the macros |
43 | below */ | 43 | below */ |
44 | void icalerror_stop_here(void); | 44 | void icalerror_stop_here(void); |
@@ -46,7 +46,7 @@ void icalerror_stop_here(void); | |||
46 | void icalerror_crash_here(void); | 46 | void icalerror_crash_here(void); |
47 | 47 | ||
48 | typedef enum icalerrorenum { | 48 | typedef enum icalerrorenum { |
49 | 49 | ICAL_NO_ERROR, /* icalerrno may not be initialized - put it first so and pray that the compiler initialize things to zero */ | |
50 | ICAL_BADARG_ERROR, | 50 | ICAL_BADARG_ERROR, |
51 | ICAL_NEWFAILED_ERROR, | 51 | ICAL_NEWFAILED_ERROR, |
52 | ICAL_ALLOCATION_ERROR, | 52 | ICAL_ALLOCATION_ERROR, |
@@ -56,15 +56,18 @@ typedef enum icalerrorenum { | |||
56 | ICAL_FILE_ERROR, | 56 | ICAL_FILE_ERROR, |
57 | ICAL_USAGE_ERROR, | 57 | ICAL_USAGE_ERROR, |
58 | ICAL_UNIMPLEMENTED_ERROR, | 58 | ICAL_UNIMPLEMENTED_ERROR, |
59 | ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/ | 59 | ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ |
60 | ICAL_NO_ERROR | ||
61 | 60 | ||
62 | } icalerrorenum; | 61 | } icalerrorenum; |
63 | 62 | ||
64 | /* The libical error enumeration, like errno*/ | 63 | icalerrorenum * icalerrno_return(void); |
65 | extern icalerrorenum icalerrno; | 64 | #define icalerrno (*(icalerrno_return())) |
66 | 65 | ||
67 | /* If true, libicl aborts after a call to icalerror_set_error*/ | 66 | /** If true, libicl aborts after a call to icalerror_set_error |
67 | * | ||
68 | * @warning NOT THREAD SAFE -- recommended that you do not change | ||
69 | * this in a multithreaded program. | ||
70 | */ | ||
68 | extern int icalerror_errors_are_fatal; | 71 | extern int icalerror_errors_are_fatal; |
69 | 72 | ||
70 | /* Warning messages */ | 73 | /* Warning messages */ |
@@ -77,6 +80,7 @@ extern int icalerror_errors_are_fatal; | |||
77 | 80 | ||
78 | 81 | ||
79 | void icalerror_clear_errno(void); | 82 | void icalerror_clear_errno(void); |
83 | void _icalerror_set_errno(icalerrorenum); | ||
80 | 84 | ||
81 | /* Make an individual error fatal or non-fatal. */ | 85 | /* Make an individual error fatal or non-fatal. */ |
82 | typedef enum icalerrorstate { | 86 | typedef enum icalerrorstate { |
@@ -94,14 +98,15 @@ icalerrorstate icalerror_get_error_state( icalerrorenum error); | |||
94 | #ifndef ICAL_SETERROR_ISFUNC | 98 | #ifndef ICAL_SETERROR_ISFUNC |
95 | #define icalerror_set_errno(x) \ | 99 | #define icalerror_set_errno(x) \ |
96 | icalerrno = x; \ | 100 | icalerrno = x; \ |
101 | fprintf(stderr,"Ical error # %d\n", x); \ | ||
97 | if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ | 102 | if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \ |
98 | (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \ | 103 | (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \ |
99 | icalerror_errors_are_fatal == 1 )){ \ | 104 | icalerror_errors_are_fatal == 1 )){ \ |
100 | icalerror_warn(icalerror_strerror(x)); \ | 105 | icalerror_warn(icalerror_strerror(x)); \ |
101 | assert(0); \ | 106 | assert(0); \ |
102 | } | 107 | } |
103 | #else | 108 | #else |
104 | void icalerror_set_errno(icalerrorenum); | 109 | void icalerror_set_errno(icalerrorenum x); |
105 | #endif | 110 | #endif |
106 | 111 | ||
107 | #ifdef ICAL_ERRORS_ARE_FATAL | 112 | #ifdef ICAL_ERRORS_ARE_FATAL |
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 | |||
@@ -22,11 +22,14 @@ | |||
22 | #include "icalproperty.h" | 22 | #include "icalproperty.h" |
23 | #include "icalerror.h" | 23 | #include "icalerror.h" |
24 | #include "icalmemory.h" | 24 | #include "icalmemory.h" |
25 | #include "icalvalue.h" | ||
25 | #include <stdlib.h> | 26 | #include <stdlib.h> |
26 | #include <string.h> | 27 | #include <string.h> |
27 | #include <stdio.h> | ||
28 | 28 | ||
29 | int snprintf(char *str, size_t n, char const *fmt, ...); | 29 | #ifdef WIN32 |
30 | #define snprintf _snprintf | ||
31 | #define strcasecmp stricmp | ||
32 | #endif | ||
30 | 33 | ||
31 | int* icallangbind_new_array(int size){ | 34 | int* icallangbind_new_array(int size){ |
32 | int* p = (int*)malloc(size*sizeof(int)); | 35 | int* p = (int*)malloc(size*sizeof(int)); |
@@ -41,11 +44,28 @@ int icallangbind_access_array(int* array, int index) { | |||
41 | return array[index]; | 44 | return array[index]; |
42 | } | 45 | } |
43 | 46 | ||
47 | /** Iterators to fetch parameters given property */ | ||
44 | 48 | ||
49 | icalparameter* icallangbind_get_first_parameter(icalproperty *prop) | ||
45 | 50 | ||
46 | /* LIke icalcomponent_get_first_component, buut takes a string for the | 51 | { |
52 | icalparameter_kind kind = ICAL_ANY_PARAMETER; | ||
53 | |||
54 | return icalproperty_get_first_parameter(prop,kind); | ||
55 | } | ||
56 | |||
57 | icalparameter* icallangbind_get_next_parameter(icalproperty *prop) | ||
58 | { | ||
59 | icalparameter_kind kind = ICAL_ANY_PARAMETER; | ||
60 | |||
61 | return icalproperty_get_next_parameter(prop,kind); | ||
62 | } | ||
63 | |||
64 | |||
65 | /** Like icalcomponent_get_first_component(), but takes a string for the | ||
47 | kind and can iterate over X properties as if each X name was a | 66 | kind and can iterate over X properties as if each X name was a |
48 | seperate kind */ | 67 | seperate kind */ |
68 | |||
49 | icalproperty* icallangbind_get_first_property(icalcomponent *c, | 69 | icalproperty* icallangbind_get_first_property(icalcomponent *c, |
50 | const char* prop) | 70 | const char* prop) |
51 | { | 71 | { |
@@ -132,6 +152,7 @@ icalcomponent* icallangbind_get_next_component(icalcomponent *c, | |||
132 | 152 | ||
133 | #define APPENDC(x) icalmemory_append_char(&buf, &buf_ptr, &buf_size, x); | 153 | #define APPENDC(x) icalmemory_append_char(&buf, &buf_ptr, &buf_size, x); |
134 | 154 | ||
155 | |||
135 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep) | 156 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep) |
136 | { | 157 | { |
137 | char tmp[25]; | 158 | char tmp[25]; |
@@ -153,14 +174,14 @@ const char* icallangbind_property_eval_string(icalproperty* prop, char* sep) | |||
153 | APPENDS(" 'name' "); | 174 | APPENDS(" 'name' "); |
154 | APPENDS(sep); | 175 | APPENDS(sep); |
155 | APPENDC('\''); | 176 | APPENDC('\''); |
156 | APPENDS(icalenum_property_kind_to_string(icalproperty_isa(prop))); | 177 | APPENDS(icalproperty_kind_to_string(icalproperty_isa(prop))); |
157 | APPENDC('\''); | 178 | APPENDC('\''); |
158 | 179 | ||
159 | if(value){ | 180 | if(value){ |
160 | APPENDS(", 'value_type' "); | 181 | APPENDS(", 'value_type' "); |
161 | APPENDS(sep); | 182 | APPENDS(sep); |
162 | APPENDC('\''); | 183 | APPENDC('\''); |
163 | APPENDS(icalenum_value_kind_to_string(icalvalue_isa(value))); | 184 | APPENDS(icalvalue_kind_to_string(icalvalue_isa(value))); |
164 | APPENDC('\''); | 185 | APPENDC('\''); |
165 | } | 186 | } |
166 | 187 | ||
@@ -269,7 +290,23 @@ int icallangbind_string_to_open_flag(const char* str) | |||
269 | if (strcmp(str,"r") == 0) {return O_RDONLY;} | 290 | if (strcmp(str,"r") == 0) {return O_RDONLY;} |
270 | else if (strcmp(str,"r+") == 0) {return O_RDWR;} | 291 | else if (strcmp(str,"r+") == 0) {return O_RDWR;} |
271 | else if (strcmp(str,"w") == 0) {return O_WRONLY;} | 292 | else if (strcmp(str,"w") == 0) {return O_WRONLY;} |
293 | else if (strcmp(str,"w+") == 0) {return O_RDWR|O_CREAT;} | ||
272 | else if (strcmp(str,"a") == 0) {return O_WRONLY|O_APPEND;} | 294 | else if (strcmp(str,"a") == 0) {return O_WRONLY|O_APPEND;} |
273 | else return -1; | 295 | else return -1; |
274 | } | 296 | } |
275 | 297 | ||
298 | |||
299 | const char* icallangbind_quote_as_ical(const char* str) | ||
300 | { | ||
301 | size_t buf_size = 2 * strlen(str); | ||
302 | |||
303 | /* assume every char could be quoted */ | ||
304 | char* buf = icalmemory_new_buffer(buf_size); | ||
305 | int result; | ||
306 | |||
307 | result = icalvalue_encode_ical_string(str, buf, buf_size); | ||
308 | |||
309 | icalmemory_add_tmp_buffer(buf); | ||
310 | |||
311 | return buf; | ||
312 | } | ||
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 | |||
@@ -41,9 +41,14 @@ icalcomponent* icallangbind_get_first_component(icalcomponent *c, | |||
41 | icalcomponent* icallangbind_get_next_component(icalcomponent *c, | 41 | icalcomponent* icallangbind_get_next_component(icalcomponent *c, |
42 | const char* comp); | 42 | const char* comp); |
43 | 43 | ||
44 | icalparameter* icallangbind_get_first_parameter(icalproperty *prop); | ||
45 | |||
46 | icalparameter* icallangbind_get_next_parameter(icalproperty *prop); | ||
44 | 47 | ||
45 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep); | 48 | const char* icallangbind_property_eval_string(icalproperty* prop, char* sep); |
46 | 49 | ||
47 | 50 | ||
48 | int icallangbind_string_to_open_flag(const char* str); | 51 | int icallangbind_string_to_open_flag(const char* str); |
52 | |||
53 | const char* icallangbind_quote_as_ical(const char* str); | ||
49 | #endif /*__ICALLANGBIND_H__*/ | 54 | #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 | |||
@@ -32,7 +32,11 @@ | |||
32 | 32 | ||
33 | ======================================================================*/ | 33 | ======================================================================*/ |
34 | 34 | ||
35 | /* libical often passes strings back to the caller. To make these | 35 | /** |
36 | * @file icalmemory.c | ||
37 | * @brief Common memory management routines. | ||
38 | * | ||
39 | * libical often passes strings back to the caller. To make these | ||
36 | * interfaces simple, I did not want the caller to have to pass in a | 40 | * interfaces simple, I did not want the caller to have to pass in a |
37 | * memory buffer, but having libical pass out newly allocated memory | 41 | * memory buffer, but having libical pass out newly allocated memory |
38 | * makes it difficult to de-allocate the memory. | 42 | * makes it difficult to de-allocate the memory. |
@@ -41,7 +45,8 @@ | |||
41 | * out references to memory which the caller does not own, and be able | 45 | * out references to memory which the caller does not own, and be able |
42 | * to de-allocate the memory later. The ring allows libical to have | 46 | * to de-allocate the memory later. The ring allows libical to have |
43 | * several buffers active simultaneously, which is handy when creating | 47 | * several buffers active simultaneously, which is handy when creating |
44 | * string representations of components. */ | 48 | * string representations of components. |
49 | */ | ||
45 | 50 | ||
46 | #define ICALMEMORY_C | 51 | #define ICALMEMORY_C |
47 | 52 | ||
@@ -60,47 +65,116 @@ | |||
60 | #include <stdlib.h> /* for malloc, realloc */ | 65 | #include <stdlib.h> /* for malloc, realloc */ |
61 | #include <string.h> /* for memset(), strdup */ | 66 | #include <string.h> /* for memset(), strdup */ |
62 | 67 | ||
63 | #define BUFFER_RING_SIZE 25 | 68 | #ifdef WIN32 |
69 | #include <windows.h> | ||
70 | #endif | ||
71 | |||
72 | #define BUFFER_RING_SIZE 2500 | ||
64 | #define MIN_BUFFER_SIZE 200 | 73 | #define MIN_BUFFER_SIZE 200 |
65 | 74 | ||
75 | |||
76 | /* HACK. Not threadsafe */ | ||
77 | |||
78 | typedef struct { | ||
79 | int pos; | ||
80 | void *ring[BUFFER_RING_SIZE]; | ||
81 | } buffer_ring; | ||
82 | |||
66 | void icalmemory_free_tmp_buffer (void* buf); | 83 | void icalmemory_free_tmp_buffer (void* buf); |
84 | void icalmemory_free_ring_byval(buffer_ring *br); | ||
67 | 85 | ||
86 | static buffer_ring* global_buffer_ring = 0; | ||
68 | 87 | ||
69 | /* HACK. Not threadsafe */ | 88 | #ifdef HAVE_PTHREAD |
70 | void* buffer_ring[BUFFER_RING_SIZE]; | 89 | #include <pthread.h> |
71 | int buffer_pos = -1; | ||
72 | int initialized = 0; | ||
73 | 90 | ||
74 | /* Add an existing buffer to the buffer ring */ | 91 | static pthread_key_t ring_key; |
75 | void icalmemory_add_tmp_buffer(void* buf) | 92 | static pthread_once_t ring_key_once = PTHREAD_ONCE_INIT; |
76 | { | 93 | |
77 | /* I don't think I need this -- I think static arrays are | 94 | static void ring_destroy(void * buf) { |
78 | initialized to 0 as a standard part of C, but I am not sure. */ | 95 | if (buf) icalmemory_free_ring_byval((buffer_ring *) buf); |
79 | if (initialized == 0){ | 96 | pthread_setspecific(ring_key, NULL); |
97 | } | ||
98 | |||
99 | static void ring_key_alloc(void) { | ||
100 | pthread_key_create(&ring_key, ring_destroy); | ||
101 | } | ||
102 | #endif | ||
103 | |||
104 | |||
105 | static buffer_ring * buffer_ring_new(void) { | ||
106 | buffer_ring *br; | ||
80 | int i; | 107 | int i; |
108 | |||
109 | br = (buffer_ring *)malloc(sizeof(buffer_ring)); | ||
110 | |||
81 | for(i=0; i<BUFFER_RING_SIZE; i++){ | 111 | for(i=0; i<BUFFER_RING_SIZE; i++){ |
82 | buffer_ring[i] = 0; | 112 | br->ring[i] = 0; |
83 | } | 113 | } |
84 | initialized = 1; | 114 | br->pos = 0; |
115 | return(br); | ||
116 | } | ||
117 | |||
118 | |||
119 | #ifdef HAVE_PTHREAD | ||
120 | static buffer_ring* get_buffer_ring_pthread(void) { | ||
121 | buffer_ring *br; | ||
122 | |||
123 | pthread_once(&ring_key_once, ring_key_alloc); | ||
124 | |||
125 | br = pthread_getspecific(ring_key); | ||
126 | |||
127 | if (!br) { | ||
128 | br = buffer_ring_new(); | ||
129 | pthread_setspecific(ring_key, br); | ||
85 | } | 130 | } |
131 | return(br); | ||
132 | } | ||
133 | #endif | ||
134 | |||
135 | /* get buffer ring via a single global for a non-threaded program */ | ||
136 | static buffer_ring* get_buffer_ring_global(void) { | ||
137 | if (global_buffer_ring == 0) { | ||
138 | global_buffer_ring = buffer_ring_new(); | ||
139 | } | ||
140 | return(global_buffer_ring); | ||
141 | } | ||
142 | |||
143 | static buffer_ring *get_buffer_ring(void) { | ||
144 | #ifdef HAVE_PTHREAD | ||
145 | return(get_buffer_ring_pthread()); | ||
146 | #else | ||
147 | return get_buffer_ring_global(); | ||
148 | #endif | ||
149 | } | ||
150 | |||
151 | |||
152 | /** Add an existing buffer to the buffer ring */ | ||
153 | void icalmemory_add_tmp_buffer(void* buf) | ||
154 | { | ||
155 | buffer_ring *br = get_buffer_ring(); | ||
156 | |||
86 | 157 | ||
87 | /* Wrap around the ring */ | 158 | /* Wrap around the ring */ |
88 | if(++buffer_pos == BUFFER_RING_SIZE){ | 159 | if(++(br->pos) == BUFFER_RING_SIZE){ |
89 | buffer_pos = 0; | 160 | br->pos = 0; |
90 | } | 161 | } |
91 | 162 | ||
92 | /* Free buffers as their slots are overwritten */ | 163 | /* Free buffers as their slots are overwritten */ |
93 | if ( buffer_ring[buffer_pos] != 0){ | 164 | if ( br->ring[br->pos] != 0){ |
94 | free( buffer_ring[buffer_pos]); | 165 | free( br->ring[br->pos]); |
95 | buffer_ring[buffer_pos] = 0; | ||
96 | } | 166 | } |
97 | 167 | ||
98 | /* Assign the buffer to a slot */ | 168 | /* Assign the buffer to a slot */ |
99 | buffer_ring[buffer_pos] = buf; | 169 | br->ring[br->pos] = buf; |
100 | } | 170 | } |
101 | 171 | ||
102 | /* Create a new temporary buffer on the ring. Libical owns these and | 172 | |
103 | wil deallocate them. */ | 173 | /** |
174 | * Create a new temporary buffer on the ring. Libical owns these and | ||
175 | * will deallocate them. | ||
176 | */ | ||
177 | |||
104 | void* | 178 | void* |
105 | icalmemory_tmp_buffer (size_t size) | 179 | icalmemory_tmp_buffer (size_t size) |
106 | { | 180 | { |
@@ -124,24 +198,28 @@ icalmemory_tmp_buffer (size_t size) | |||
124 | return buf; | 198 | return buf; |
125 | } | 199 | } |
126 | 200 | ||
127 | void icalmemory_free_ring() | 201 | /** get rid of this buffer ring */ |
128 | { | 202 | void icalmemory_free_ring_byval(buffer_ring *br) { |
129 | |||
130 | int i; | 203 | int i; |
131 | for(i=0; i<BUFFER_RING_SIZE; i++){ | 204 | for(i=0; i<BUFFER_RING_SIZE; i++){ |
132 | if ( buffer_ring[i] != 0){ | 205 | if ( br->ring[i] != 0){ |
133 | free( buffer_ring[i]); | 206 | free( br->ring[i]); |
134 | } | 207 | } |
135 | buffer_ring[i] = 0; | 208 | } |
136 | } | 209 | free(br); |
210 | } | ||
137 | 211 | ||
138 | initialized = 1; | 212 | void icalmemory_free_ring() |
213 | { | ||
214 | buffer_ring *br; | ||
215 | br = get_buffer_ring(); | ||
139 | 216 | ||
217 | icalmemory_free_ring_byval(br); | ||
140 | } | 218 | } |
141 | 219 | ||
142 | 220 | ||
143 | 221 | ||
144 | /* Like strdup, but the buffer is on the ring. */ | 222 | /** Like strdup, but the buffer is on the ring. */ |
145 | char* | 223 | char* |
146 | icalmemory_tmp_copy(const char* str) | 224 | icalmemory_tmp_copy(const char* str) |
147 | { | 225 | { |
@@ -170,8 +248,10 @@ icalmemory_free_tmp_buffer (void* buf) | |||
170 | } | 248 | } |
171 | 249 | ||
172 | 250 | ||
173 | /* These buffer routines create memory the old fashioned way -- so the | 251 | /* |
174 | caller will have to delocate the new memory */ | 252 | * These buffer routines create memory the old fashioned way -- so the |
253 | * caller will have to deallocate the new memory | ||
254 | */ | ||
175 | 255 | ||
176 | void* icalmemory_new_buffer(size_t size) | 256 | void* icalmemory_new_buffer(size_t size) |
177 | { | 257 | { |
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 | |||
@@ -26,13 +26,11 @@ | |||
26 | #ifndef ICALMEMORY_H | 26 | #ifndef ICALMEMORY_H |
27 | #define ICALMEMORY_H | 27 | #define ICALMEMORY_H |
28 | 28 | ||
29 | #ifndef WIN32 | ||
29 | #include <sys/types.h> /* for size_t */ | 30 | #include <sys/types.h> /* for size_t */ |
30 | 31 | #else | |
31 | // Eugen C. <eug@thekompany.com> | ||
32 | #ifdef _WIN32 | ||
33 | #include <stddef.h> | 32 | #include <stddef.h> |
34 | #endif | 33 | #endif |
35 | // Eugen C. <eug@thekompany.com> | ||
36 | 34 | ||
37 | /* Tmp buffers are managed by ical. References can be returned to the | 35 | /* Tmp buffers are managed by ical. References can be returned to the |
38 | caller, although the caller will not own the memory. */ | 36 | caller, although the caller will not own the memory. */ |
@@ -40,11 +38,11 @@ | |||
40 | void* icalmemory_tmp_buffer(size_t size); | 38 | void* icalmemory_tmp_buffer(size_t size); |
41 | char* icalmemory_tmp_copy(const char* str); | 39 | char* icalmemory_tmp_copy(const char* str); |
42 | 40 | ||
43 | /* Add an externally allocated buffer to the ring. */ | 41 | /** Add an externally allocated buffer to the ring. */ |
44 | void icalmemory_add_tmp_buffer(void*); | 42 | void icalmemory_add_tmp_buffer(void*); |
45 | 43 | ||
46 | 44 | ||
47 | /* Free all memory used in the ring */ | 45 | /** Free all memory used in the ring */ |
48 | void icalmemory_free_ring(void); | 46 | void icalmemory_free_ring(void); |
49 | 47 | ||
50 | /* Non-tmp buffers must be freed. These are mostly wrappers around | 48 | /* Non-tmp buffers must be freed. These are mostly wrappers around |
@@ -55,7 +53,8 @@ void* icalmemory_new_buffer(size_t size); | |||
55 | void* icalmemory_resize_buffer(void* buf, size_t size); | 53 | void* icalmemory_resize_buffer(void* buf, size_t size); |
56 | void icalmemory_free_buffer(void* buf); | 54 | void icalmemory_free_buffer(void* buf); |
57 | 55 | ||
58 | /* icalmemory_append_string will copy the string 'string' to the | 56 | /** |
57 | icalmemory_append_string will copy the string 'string' to the | ||
59 | buffer 'buf' starting at position 'pos', reallocing 'buf' if it is | 58 | buffer 'buf' starting at position 'pos', reallocing 'buf' if it is |
60 | too small. 'buf_size' is the size of 'buf' and will be changed if | 59 | too small. 'buf_size' is the size of 'buf' and will be changed if |
61 | 'buf' is reallocated. 'pos' will point to the last byte of the new | 60 | 'buf' is reallocated. 'pos' will point to the last byte of the new |
@@ -71,12 +70,12 @@ void icalmemory_free_buffer(void* buf); | |||
71 | void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, | 70 | void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, |
72 | const char* string); | 71 | const char* string); |
73 | 72 | ||
74 | /* icalmemory_append_char is similar, but is appends a character instead of a string */ | 73 | /** icalmemory_append_char is similar, but is appends a character instead of a string */ |
75 | void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, | 74 | void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, |
76 | char ch); | 75 | char ch); |
77 | 76 | ||
78 | /* A wrapper around strdup. Partly to trap calls to strdup, partly | 77 | /** A wrapper around strdup. Partly to trap calls to strdup, partly |
79 | because in -ansi, gcc on Red Hat claims that strudup is undeclared */ | 78 | because in -ansi, gcc on Red Hat claims that strdup is undeclared */ |
80 | char* icalmemory_strdup(const char *s); | 79 | char* icalmemory_strdup(const char *s); |
81 | 80 | ||
82 | #endif /* !ICALMEMORY_H */ | 81 | #endif /* !ICALMEMORY_H */ |
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 | |||
@@ -34,12 +34,14 @@ | |||
34 | #include <string.h> /* For strdup */ | 34 | #include <string.h> /* For strdup */ |
35 | #include <stdio.h> /* for snprintf*/ | 35 | #include <stdio.h> /* for snprintf*/ |
36 | 36 | ||
37 | int snprintf(char *str, size_t n, char const *fmt, ...); | ||
38 | |||
39 | #ifdef DMALLOC | 37 | #ifdef DMALLOC |
40 | #include "dmalloc.h" | 38 | #include "dmalloc.h" |
41 | #endif | 39 | #endif |
42 | 40 | ||
41 | #ifdef WIN32 | ||
42 | #define snprintf _snprintf | ||
43 | #define strcasecmp stricmp | ||
44 | #endif | ||
43 | 45 | ||
44 | /* These *_part routines are called by the MIME parser via the | 46 | /* These *_part routines are called by the MIME parser via the |
45 | local_action_map */ | 47 | local_action_map */ |
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 | |||
@@ -78,53 +78,48 @@ icalparameter_new (icalparameter_kind kind) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | void | 80 | void |
81 | icalparameter_free (icalparameter* parameter) | 81 | icalparameter_free (icalparameter* param) |
82 | { | 82 | { |
83 | struct icalparameter_impl * impl; | ||
84 | |||
85 | impl = (struct icalparameter_impl*)parameter; | ||
86 | 83 | ||
87 | /* HACK. This always triggers, even when parameter is non-zero | 84 | /* HACK. This always triggers, even when parameter is non-zero |
88 | icalerror_check_arg_rv((parameter==0),"parameter");*/ | 85 | icalerror_check_arg_rv((parameter==0),"parameter");*/ |
89 | 86 | ||
90 | 87 | ||
91 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR | 88 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR |
92 | icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. "); | 89 | icalerror_assert( (param->parent ==0),"Tried to free a parameter that is still attached to a component. "); |
93 | 90 | ||
94 | #else | 91 | #else |
95 | if(impl->parent !=0){ | 92 | if(param->parent !=0){ |
96 | return; | 93 | return; |
97 | } | 94 | } |
98 | #endif | 95 | #endif |
99 | 96 | ||
100 | 97 | ||
101 | if (impl->string != 0){ | 98 | if (param->string != 0){ |
102 | free ((void*)impl->string); | 99 | free ((void*)param->string); |
103 | } | 100 | } |
104 | 101 | ||
105 | if (impl->x_name != 0){ | 102 | if (param->x_name != 0){ |
106 | free ((void*)impl->x_name); | 103 | free ((void*)param->x_name); |
107 | } | 104 | } |
108 | 105 | ||
109 | memset(impl,0,sizeof(impl)); | 106 | memset(param,0,sizeof(param)); |
110 | 107 | ||
111 | impl->parent = 0; | 108 | param->parent = 0; |
112 | impl->id[0] = 'X'; | 109 | param->id[0] = 'X'; |
113 | free(impl); | 110 | free(param); |
114 | } | 111 | } |
115 | 112 | ||
116 | 113 | ||
117 | 114 | ||
118 | icalparameter* | 115 | icalparameter* |
119 | icalparameter_new_clone(icalparameter* param) | 116 | icalparameter_new_clone(icalparameter* old) |
120 | { | 117 | { |
121 | struct icalparameter_impl *old; | ||
122 | struct icalparameter_impl *new; | 118 | struct icalparameter_impl *new; |
123 | 119 | ||
124 | old = (struct icalparameter_impl *)param; | ||
125 | new = icalparameter_new_impl(old->kind); | 120 | new = icalparameter_new_impl(old->kind); |
126 | 121 | ||
127 | icalerror_check_arg_rz((param!=0),"param"); | 122 | icalerror_check_arg_rz((old!=0),"param"); |
128 | 123 | ||
129 | if (new == 0){ | 124 | if (new == 0){ |
130 | return 0; | 125 | return 0; |
@@ -197,17 +192,27 @@ icalparameter* icalparameter_new_from_string(const char *str) | |||
197 | 192 | ||
198 | } | 193 | } |
199 | 194 | ||
195 | /** | ||
196 | * Return a string representation of the parameter according to RFC2445. | ||
197 | * | ||
198 | * param= param-name "=" param-value | ||
199 | * param-name= iana-token / x-token | ||
200 | * param-value= paramtext /quoted-string | ||
201 | * paramtext= *SAFE-SHARE | ||
202 | * quoted-string= DQUOTE *QSAFE-CHARE DQUOTE | ||
203 | * QSAFE-CHAR= any character except CTLs and DQUOTE | ||
204 | * SAFE-CHAR= any character except CTLs, DQUOTE. ";", ":", "," | ||
205 | */ | ||
200 | char* | 206 | char* |
201 | icalparameter_as_ical_string (icalparameter* parameter) | 207 | icalparameter_as_ical_string (icalparameter* param) |
202 | { | 208 | { |
203 | struct icalparameter_impl* impl; | ||
204 | size_t buf_size = 1024; | 209 | size_t buf_size = 1024; |
205 | char* buf; | 210 | char* buf; |
206 | char* buf_ptr; | 211 | char* buf_ptr; |
207 | char *out_buf; | 212 | char *out_buf; |
208 | const char *kind_string; | 213 | const char *kind_string; |
209 | 214 | ||
210 | icalerror_check_arg_rz( (parameter!=0), "parameter"); | 215 | icalerror_check_arg_rz( (param!=0), "parameter"); |
211 | 216 | ||
212 | /* Create new buffer that we can append names, parameters and a | 217 | /* Create new buffer that we can append names, parameters and a |
213 | value to, and reallocate as needed. Later, this buffer will be | 218 | value to, and reallocate as needed. Later, this buffer will be |
@@ -217,19 +222,18 @@ icalparameter_as_ical_string (icalparameter* parameter) | |||
217 | 222 | ||
218 | buf = icalmemory_new_buffer(buf_size); | 223 | buf = icalmemory_new_buffer(buf_size); |
219 | buf_ptr = buf; | 224 | buf_ptr = buf; |
220 | impl = (struct icalparameter_impl*)parameter; | ||
221 | 225 | ||
222 | if(impl->kind == ICAL_X_PARAMETER) { | 226 | if(param->kind == ICAL_X_PARAMETER) { |
223 | 227 | ||
224 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, | 228 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, |
225 | icalparameter_get_xname(impl)); | 229 | icalparameter_get_xname(param)); |
226 | 230 | ||
227 | } else { | 231 | } else { |
228 | 232 | ||
229 | kind_string = icalparameter_kind_to_string(impl->kind); | 233 | kind_string = icalparameter_kind_to_string(param->kind); |
230 | 234 | ||
231 | if (impl->kind == ICAL_NO_PARAMETER || | 235 | if (param->kind == ICAL_NO_PARAMETER || |
232 | impl->kind == ICAL_ANY_PARAMETER || | 236 | param->kind == ICAL_ANY_PARAMETER || |
233 | kind_string == 0) | 237 | kind_string == 0) |
234 | { | 238 | { |
235 | icalerror_set_errno(ICAL_BADARG_ERROR); | 239 | icalerror_set_errno(ICAL_BADARG_ERROR); |
@@ -244,10 +248,20 @@ icalparameter_as_ical_string (icalparameter* parameter) | |||
244 | 248 | ||
245 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "="); | 249 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "="); |
246 | 250 | ||
247 | if(impl->string !=0){ | 251 | if(param->string !=0){ |
248 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string); | 252 | int qm = 0; |
249 | } else if (impl->data != 0){ | 253 | |
250 | const char* str = icalparameter_enum_to_string(impl->data); | 254 | /* Encapsulate the property in quotes if necessary */ |
255 | if (strpbrk(param->string, ";:,") != 0) { | ||
256 | icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"'); | ||
257 | qm = 1; | ||
258 | } | ||
259 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, param->string); | ||
260 | if (qm == 1) { | ||
261 | icalmemory_append_char (&buf, &buf_ptr, &buf_size, '"'); | ||
262 | } | ||
263 | } else if (param->data != 0){ | ||
264 | const char* str = icalparameter_enum_to_string(param->data); | ||
251 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); | 265 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); |
252 | } else { | 266 | } else { |
253 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 267 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
@@ -278,7 +292,7 @@ icalparameter_isa (icalparameter* parameter) | |||
278 | return ICAL_NO_PARAMETER; | 292 | return ICAL_NO_PARAMETER; |
279 | } | 293 | } |
280 | 294 | ||
281 | return ((struct icalparameter_impl *)parameter)->kind; | 295 | return parameter->kind; |
282 | } | 296 | } |
283 | 297 | ||
284 | 298 | ||
@@ -302,17 +316,16 @@ icalparameter_isa_parameter (void* parameter) | |||
302 | void | 316 | void |
303 | icalparameter_set_xname (icalparameter* param, const char* v) | 317 | icalparameter_set_xname (icalparameter* param, const char* v) |
304 | { | 318 | { |
305 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
306 | icalerror_check_arg_rv( (param!=0),"param"); | 319 | icalerror_check_arg_rv( (param!=0),"param"); |
307 | icalerror_check_arg_rv( (v!=0),"v"); | 320 | icalerror_check_arg_rv( (v!=0),"v"); |
308 | 321 | ||
309 | if (impl->x_name != 0){ | 322 | if (param->x_name != 0){ |
310 | free((void*)impl->x_name); | 323 | free((void*)param->x_name); |
311 | } | 324 | } |
312 | 325 | ||
313 | impl->x_name = icalmemory_strdup(v); | 326 | param->x_name = icalmemory_strdup(v); |
314 | 327 | ||
315 | if (impl->x_name == 0){ | 328 | if (param->x_name == 0){ |
316 | errno = ENOMEM; | 329 | errno = ENOMEM; |
317 | } | 330 | } |
318 | 331 | ||
@@ -321,27 +334,24 @@ icalparameter_set_xname (icalparameter* param, const char* v) | |||
321 | const char* | 334 | const char* |
322 | icalparameter_get_xname (icalparameter* param) | 335 | icalparameter_get_xname (icalparameter* param) |
323 | { | 336 | { |
324 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
325 | icalerror_check_arg_rz( (param!=0),"param"); | 337 | icalerror_check_arg_rz( (param!=0),"param"); |
326 | 338 | ||
327 | return impl->x_name; | 339 | return param->x_name; |
328 | } | 340 | } |
329 | 341 | ||
330 | void | 342 | void |
331 | icalparameter_set_xvalue (icalparameter* param, const char* v) | 343 | icalparameter_set_xvalue (icalparameter* param, const char* v) |
332 | { | 344 | { |
333 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
334 | |||
335 | icalerror_check_arg_rv( (param!=0),"param"); | 345 | icalerror_check_arg_rv( (param!=0),"param"); |
336 | icalerror_check_arg_rv( (v!=0),"v"); | 346 | icalerror_check_arg_rv( (v!=0),"v"); |
337 | 347 | ||
338 | if (impl->string != 0){ | 348 | if (param->string != 0){ |
339 | free((void*)impl->string); | 349 | free((void*)param->string); |
340 | } | 350 | } |
341 | 351 | ||
342 | impl->string = icalmemory_strdup(v); | 352 | param->string = icalmemory_strdup(v); |
343 | 353 | ||
344 | if (impl->string == 0){ | 354 | if (param->string == 0){ |
345 | errno = ENOMEM; | 355 | errno = ENOMEM; |
346 | } | 356 | } |
347 | 357 | ||
@@ -350,31 +360,24 @@ icalparameter_set_xvalue (icalparameter* param, const char* v) | |||
350 | const char* | 360 | const char* |
351 | icalparameter_get_xvalue (icalparameter* param) | 361 | icalparameter_get_xvalue (icalparameter* param) |
352 | { | 362 | { |
353 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
354 | |||
355 | icalerror_check_arg_rz( (param!=0),"param"); | 363 | icalerror_check_arg_rz( (param!=0),"param"); |
356 | 364 | ||
357 | return impl->string; | 365 | return param->string; |
358 | |||
359 | } | 366 | } |
360 | 367 | ||
361 | void icalparameter_set_parent(icalparameter* param, | 368 | void icalparameter_set_parent(icalparameter* param, |
362 | icalproperty* property) | 369 | icalproperty* property) |
363 | { | 370 | { |
364 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
365 | |||
366 | icalerror_check_arg_rv( (param!=0),"param"); | 371 | icalerror_check_arg_rv( (param!=0),"param"); |
367 | 372 | ||
368 | impl->parent = property; | 373 | param->parent = property; |
369 | } | 374 | } |
370 | 375 | ||
371 | icalproperty* icalparameter_get_parent(icalparameter* param) | 376 | icalproperty* icalparameter_get_parent(icalparameter* param) |
372 | { | 377 | { |
373 | struct icalparameter_impl *impl = (struct icalparameter_impl*)param; | ||
374 | |||
375 | icalerror_check_arg_rz( (param!=0),"param"); | 378 | icalerror_check_arg_rz( (param!=0),"param"); |
376 | 379 | ||
377 | return impl->parent; | 380 | return param->parent; |
378 | } | 381 | } |
379 | 382 | ||
380 | 383 | ||
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 | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "icalderivedparameter.h" | 32 | #include "icalderivedparameter.h" |
33 | 33 | ||
34 | /* Declared in icalderivedparameter.h */ | 34 | /* Declared in icalderivedparameter.h */ |
35 | /*typedef void icalparameter;*/ | 35 | /*typedef struct icalparameter_impl icalparameter;*/ |
36 | 36 | ||
37 | icalparameter* icalparameter_new(icalparameter_kind kind); | 37 | icalparameter* icalparameter_new(icalparameter_kind kind); |
38 | icalparameter* icalparameter_new_clone(icalparameter* p); | 38 | icalparameter* icalparameter_new_clone(icalparameter* p); |
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,4 +1,4 @@ | |||
1 | /* -*- Mode: C -*- | 1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 8; -*- |
2 | ====================================================================== | 2 | ====================================================================== |
3 | FILE: icalparser.c | 3 | FILE: icalparser.c |
4 | CREATOR: eric 04 August 1999 | 4 | CREATOR: eric 04 August 1999 |
@@ -38,9 +38,7 @@ | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | #include "icalparser.h" | ||
42 | #include "pvl.h" | 41 | #include "pvl.h" |
43 | #include "icalmemory.h" | ||
44 | #include "icalerror.h" | 42 | #include "icalerror.h" |
45 | #include "icalvalue.h" | 43 | #include "icalvalue.h" |
46 | #include "icalderivedparameter.h" | 44 | #include "icalderivedparameter.h" |
@@ -52,13 +50,28 @@ | |||
52 | #include <stdio.h> /* For FILE and fgets and sprintf */ | 50 | #include <stdio.h> /* For FILE and fgets and sprintf */ |
53 | #include <stdlib.h> /* for free */ | 51 | #include <stdlib.h> /* for free */ |
54 | 52 | ||
55 | int snprintf(char *str, size_t n, char const *fmt, ...); | 53 | #include "icalmemory.h" |
54 | #include "icalparser.h" | ||
55 | |||
56 | #ifdef HAVE_WCTYPE_H | ||
57 | # include <wctype.h> | ||
58 | /* Some systems have an imcomplete implementation on wctype (FreeBSD, | ||
59 | * Darwin). Cope with that. */ | ||
60 | # ifndef HAVE_ISWSPACE | ||
61 | # define iswspace isspace | ||
62 | # endif | ||
63 | #else | ||
64 | # ifndef HAVE_ISWSPACE | ||
65 | # define iswspace isspace | ||
66 | # endif | ||
67 | #endif | ||
56 | 68 | ||
57 | extern icalvalue* icalparser_yy_value; | 69 | #ifdef WIN32 |
58 | void set_parser_value_state(icalvalue_kind kind); | 70 | #define snprintf _snprintf |
59 | int ical_yyparse(void); | 71 | #define strcasecmp stricmp |
72 | #endif | ||
60 | 73 | ||
61 | char* icalparser_get_next_char(char c, char *str); | 74 | char* icalparser_get_next_char(char c, char *str, int qm); |
62 | char* icalparser_get_next_parameter(char* line,char** end); | 75 | char* icalparser_get_next_parameter(char* line,char** end); |
63 | char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind); | 76 | char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind); |
64 | char* icalparser_get_prop_name(char* line, char** end); | 77 | char* icalparser_get_prop_name(char* line, char** end); |
@@ -81,7 +94,7 @@ struct icalparser_impl | |||
81 | pvl_list components; | 94 | pvl_list components; |
82 | 95 | ||
83 | void *line_gen_data; | 96 | void *line_gen_data; |
84 | 97 | ||
85 | }; | 98 | }; |
86 | 99 | ||
87 | 100 | ||
@@ -100,6 +113,7 @@ icalparser* icalparser_new(void) | |||
100 | impl->state = ICALPARSER_SUCCESS; | 113 | impl->state = ICALPARSER_SUCCESS; |
101 | impl->tmp_buf_size = TMP_BUF_SIZE; | 114 | impl->tmp_buf_size = TMP_BUF_SIZE; |
102 | impl->buffer_full = 0; | 115 | impl->buffer_full = 0; |
116 | impl->continuation_line = 0; | ||
103 | impl->lineno = 0; | 117 | impl->lineno = 0; |
104 | impl->continuation_line = 0; | 118 | impl->continuation_line = 0; |
105 | memset(impl->temp,0, TMP_BUF_SIZE); | 119 | memset(impl->temp,0, TMP_BUF_SIZE); |
@@ -110,27 +124,24 @@ icalparser* icalparser_new(void) | |||
110 | 124 | ||
111 | void icalparser_free(icalparser* parser) | 125 | void icalparser_free(icalparser* parser) |
112 | { | 126 | { |
113 | struct icalparser_impl* impl = (struct icalparser_impl*)parser; | ||
114 | icalcomponent *c; | 127 | icalcomponent *c; |
115 | 128 | ||
116 | if (impl->root_component != 0){ | 129 | if (parser->root_component != 0){ |
117 | icalcomponent_free(impl->root_component); | 130 | icalcomponent_free(parser->root_component); |
118 | } | 131 | } |
119 | 132 | ||
120 | while( (c=pvl_pop(impl->components)) != 0){ | 133 | while( (c=pvl_pop(parser->components)) != 0){ |
121 | icalcomponent_free(c); | 134 | icalcomponent_free(c); |
122 | } | 135 | } |
123 | 136 | ||
124 | pvl_free(impl->components); | 137 | pvl_free(parser->components); |
125 | 138 | ||
126 | free(impl); | 139 | free(parser); |
127 | } | 140 | } |
128 | 141 | ||
129 | void icalparser_set_gen_data(icalparser* parser, void* data) | 142 | void icalparser_set_gen_data(icalparser* parser, void* data) |
130 | { | 143 | { |
131 | struct icalparser_impl* impl = (struct icalparser_impl*)parser; | 144 | parser->line_gen_data = data; |
132 | |||
133 | impl->line_gen_data = data; | ||
134 | } | 145 | } |
135 | 146 | ||
136 | 147 | ||
@@ -140,37 +151,38 @@ icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind, | |||
140 | 151 | ||
141 | 152 | ||
142 | 153 | ||
143 | char* icalparser_get_next_char(char c, char *str) | 154 | char* icalparser_get_next_char(char c, char *str, int qm) |
144 | { | 155 | { |
145 | int quote_mode = 0; | 156 | int quote_mode = 0; |
146 | char* p; | 157 | char* p; |
147 | |||
148 | 158 | ||
149 | for(p=str; *p!=0; p++){ | 159 | for(p=str; *p!=0; p++){ |
150 | 160 | if (qm == 1) { | |
151 | if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ | 161 | if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ |
152 | quote_mode =1; | 162 | quote_mode =1; |
153 | continue; | 163 | continue; |
154 | } | 164 | } |
155 | 165 | ||
156 | if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ | 166 | if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ |
157 | quote_mode =0; | 167 | quote_mode =0; |
158 | continue; | 168 | continue; |
159 | } | 169 | } |
160 | 170 | } | |
161 | if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ | 171 | |
162 | return p; | 172 | if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ |
163 | } | 173 | return p; |
174 | } | ||
164 | 175 | ||
165 | } | 176 | } |
166 | 177 | ||
167 | return 0; | 178 | return 0; |
168 | } | 179 | } |
169 | 180 | ||
170 | /* make a new tmp buffer out of a substring */ | 181 | |
171 | char* make_segment(char* start, char* end) | 182 | /** make a new tmp buffer out of a substring */ |
183 | static char* make_segment(char* start, char* end) | ||
172 | { | 184 | { |
173 | char *buf; | 185 | char *buf, *tmp; |
174 | size_t size = (size_t)end - (size_t)start; | 186 | size_t size = (size_t)end - (size_t)start; |
175 | 187 | ||
176 | buf = icalmemory_tmp_buffer(size+1); | 188 | buf = icalmemory_tmp_buffer(size+1); |
@@ -178,64 +190,17 @@ char* make_segment(char* start, char* end) | |||
178 | 190 | ||
179 | strncpy(buf,start,size); | 191 | strncpy(buf,start,size); |
180 | *(buf+size) = 0; | 192 | *(buf+size) = 0; |
193 | |||
194 | tmp = (buf+size); | ||
195 | while ( *tmp == '\0' || iswspace(*tmp) ) | ||
196 | { | ||
197 | *tmp = 0; | ||
198 | tmp--; | ||
199 | } | ||
181 | 200 | ||
182 | return buf; | 201 | return buf; |
183 | |||
184 | } | 202 | } |
185 | 203 | ||
186 | const char* input_buffer; | ||
187 | const char* input_buffer_p; | ||
188 | //#define min(a,b) ((a) < (b) ? (a) : (b)) | ||
189 | |||
190 | int icalparser_flex_input(char* buf, int max_size) | ||
191 | { | ||
192 | int n = max_size; // = min(max_size,strlen(input_buffer_p)); | ||
193 | if ( n < ((int )strlen(input_buffer_p)) ) | ||
194 | n = strlen(input_buffer_p); | ||
195 | if (n > 0){ | ||
196 | memcpy(buf, input_buffer_p, n); | ||
197 | input_buffer_p += n; | ||
198 | return n; | ||
199 | } else { | ||
200 | return 0; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | void icalparser_clear_flex_input(void) | ||
205 | { | ||
206 | input_buffer_p = input_buffer+strlen(input_buffer); | ||
207 | } | ||
208 | |||
209 | /* Call the flex/bison parser to parse a complex value */ | ||
210 | |||
211 | icalvalue* icalparser_parse_value(icalvalue_kind kind, | ||
212 | const char* str, icalproperty** error) | ||
213 | { | ||
214 | int r; | ||
215 | input_buffer_p = input_buffer = str; | ||
216 | |||
217 | set_parser_value_state(kind); | ||
218 | icalparser_yy_value = 0; | ||
219 | |||
220 | r = ical_yyparse(); | ||
221 | |||
222 | /* Error. Parse failed */ | ||
223 | if( icalparser_yy_value == 0 || r != 0){ | ||
224 | |||
225 | if(icalparser_yy_value !=0){ | ||
226 | icalvalue_free(icalparser_yy_value); | ||
227 | icalparser_yy_value = 0; | ||
228 | } | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | if (error != 0){ | ||
234 | *error = 0; | ||
235 | } | ||
236 | |||
237 | return icalparser_yy_value; | ||
238 | } | ||
239 | 204 | ||
240 | char* icalparser_get_prop_name(char* line, char** end) | 205 | char* icalparser_get_prop_name(char* line, char** end) |
241 | { | 206 | { |
@@ -243,8 +208,8 @@ char* icalparser_get_prop_name(char* line, char** end) | |||
243 | char* v; | 208 | char* v; |
244 | char *str; | 209 | char *str; |
245 | 210 | ||
246 | p = icalparser_get_next_char(';',line); | 211 | p = icalparser_get_next_char(';',line,1); |
247 | v = icalparser_get_next_char(':',line); | 212 | v = icalparser_get_next_char(':',line,1); |
248 | if (p== 0 && v == 0) { | 213 | if (p== 0 && v == 0) { |
249 | return 0; | 214 | return 0; |
250 | } | 215 | } |
@@ -262,13 +227,13 @@ char* icalparser_get_prop_name(char* line, char** end) | |||
262 | return str; | 227 | return str; |
263 | } | 228 | } |
264 | 229 | ||
230 | |||
265 | char* icalparser_get_param_name(char* line, char **end) | 231 | char* icalparser_get_param_name(char* line, char **end) |
266 | { | 232 | { |
267 | |||
268 | char* next; | 233 | char* next; |
269 | char *str; | 234 | char *str; |
270 | 235 | ||
271 | next = icalparser_get_next_char('=',line); | 236 | next = icalparser_get_next_char('=',line,1); |
272 | 237 | ||
273 | if (next == 0) { | 238 | if (next == 0) { |
274 | return 0; | 239 | return 0; |
@@ -276,17 +241,26 @@ char* icalparser_get_param_name(char* line, char **end) | |||
276 | 241 | ||
277 | str = make_segment(line,next); | 242 | str = make_segment(line,next); |
278 | *end = next+1; | 243 | *end = next+1; |
244 | if (**end == '"') { | ||
245 | *end = *end+1; | ||
246 | next = icalparser_get_next_char('"',*end,0); | ||
247 | if (next == 0) { | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | *end = make_segment(*end,next); | ||
252 | } | ||
253 | |||
279 | return str; | 254 | return str; |
280 | |||
281 | } | 255 | } |
282 | 256 | ||
257 | |||
283 | char* icalparser_get_next_paramvalue(char* line, char **end) | 258 | char* icalparser_get_next_paramvalue(char* line, char **end) |
284 | { | 259 | { |
285 | |||
286 | char* next; | 260 | char* next; |
287 | char *str; | 261 | char *str; |
288 | 262 | ||
289 | next = icalparser_get_next_char(',',line); | 263 | next = icalparser_get_next_char(',',line,1); |
290 | 264 | ||
291 | if (next == 0){ | 265 | if (next == 0){ |
292 | next = (char*)(size_t)line+(size_t)strlen(line);\ | 266 | next = (char*)(size_t)line+(size_t)strlen(line);\ |
@@ -299,10 +273,11 @@ char* icalparser_get_next_paramvalue(char* line, char **end) | |||
299 | *end = next+1; | 273 | *end = next+1; |
300 | return str; | 274 | return str; |
301 | } | 275 | } |
302 | |||
303 | } | 276 | } |
304 | 277 | ||
305 | /* A property may have multiple values, if the values are seperated by | 278 | |
279 | /** | ||
280 | A property may have multiple values, if the values are seperated by | ||
306 | commas in the content line. This routine will look for the next | 281 | commas in the content line. This routine will look for the next |
307 | comma after line and will set the next place to start searching in | 282 | comma after line and will set the next place to start searching in |
308 | end. */ | 283 | end. */ |
@@ -318,7 +293,7 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) | |||
318 | p = line; | 293 | p = line; |
319 | while(1){ | 294 | while(1){ |
320 | 295 | ||
321 | next = icalparser_get_next_char(',',p); | 296 | next = icalparser_get_next_char(',',p,1); |
322 | 297 | ||
323 | /* Unforunately, RFC2445 says that for the RECUR value, COMMA | 298 | /* Unforunately, RFC2445 says that for the RECUR value, COMMA |
324 | can both seperate digits in a list, and it can seperate | 299 | can both seperate digits in a list, and it can seperate |
@@ -340,6 +315,15 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) | |||
340 | continue; | 315 | continue; |
341 | } | 316 | } |
342 | } | 317 | } |
318 | /* ignore all , for query value. select dtstart, dtend etc ... */ | ||
319 | else if( kind == ICAL_QUERY_VALUE) { | ||
320 | if ( next != 0) { | ||
321 | p = next+1; | ||
322 | continue; | ||
323 | } | ||
324 | else | ||
325 | break; | ||
326 | } | ||
343 | 327 | ||
344 | /* If the comma is preceeded by a '\', then it is a literal and | 328 | /* If the comma is preceeded by a '\', then it is a literal and |
345 | not a value seperator*/ | 329 | not a value seperator*/ |
@@ -379,14 +363,14 @@ char* icalparser_get_next_parameter(char* line,char** end) | |||
379 | char *v; | 363 | char *v; |
380 | char *str; | 364 | char *str; |
381 | 365 | ||
382 | v = icalparser_get_next_char(':',line); | 366 | v = icalparser_get_next_char(':',line,1); |
383 | next = icalparser_get_next_char(';', line); | 367 | next = icalparser_get_next_char(';', line,1); |
384 | 368 | ||
385 | /* There is no ';' or, it is after the ':' that marks the beginning of | 369 | /* There is no ';' or, it is after the ':' that marks the beginning of |
386 | the value */ | 370 | the value */ |
387 | 371 | ||
388 | if (next == 0 || next > v) { | 372 | if (next == 0 || next > v) { |
389 | next = icalparser_get_next_char(':', line); | 373 | next = icalparser_get_next_char(':', line,1); |
390 | } | 374 | } |
391 | 375 | ||
392 | if (next != 0) { | 376 | if (next != 0) { |
@@ -399,23 +383,23 @@ char* icalparser_get_next_parameter(char* line,char** end) | |||
399 | } | 383 | } |
400 | } | 384 | } |
401 | 385 | ||
402 | /* Get a single property line, from the property name through the | ||
403 | final new line, and include any continuation lines */ | ||
404 | 386 | ||
387 | /** | ||
388 | * Get a single property line, from the property name through the | ||
389 | * final new line, and include any continuation lines | ||
390 | */ | ||
405 | char* icalparser_get_line(icalparser *parser, | 391 | char* icalparser_get_line(icalparser *parser, |
406 | char* (*line_gen_func)(char *s, size_t size, void *d)) | 392 | char* (*line_gen_func)(char *s, size_t size, void *d)) |
407 | { | 393 | { |
408 | char *line; | 394 | char *line; |
409 | char *line_p; | 395 | char *line_p; |
410 | struct icalparser_impl* impl = (struct icalparser_impl*)parser; | 396 | size_t buf_size = parser->tmp_buf_size; |
411 | size_t buf_size = impl->tmp_buf_size; | ||
412 | |||
413 | 397 | ||
414 | line_p = line = icalmemory_new_buffer(buf_size); | 398 | line_p = line = icalmemory_new_buffer(buf_size); |
415 | line[0] = '\0'; | 399 | line[0] = '\0'; |
416 | 400 | ||
417 | /* Read lines by calling line_gen_func and putting the data into | 401 | /* Read lines by calling line_gen_func and putting the data into |
418 | impl->temp. If the line is a continuation line ( begins with a | 402 | parser->temp. If the line is a continuation line ( begins with a |
419 | space after a newline ) then append the data onto line and read | 403 | space after a newline ) then append the data onto line and read |
420 | again. Otherwise, exit the loop. */ | 404 | again. Otherwise, exit the loop. */ |
421 | 405 | ||
@@ -429,23 +413,23 @@ char* icalparser_get_line(icalparser *parser, | |||
429 | 413 | ||
430 | /* The tmp buffer is not clear, so transfer the data in it to the | 414 | /* The tmp buffer is not clear, so transfer the data in it to the |
431 | output. This may be left over from a previous call */ | 415 | output. This may be left over from a previous call */ |
432 | if (impl->temp[0] != '\0' ) { | 416 | if (parser->temp[0] != '\0' ) { |
433 | 417 | ||
434 | /* If the last position in the temp buffer is occupied, | 418 | /* If the last position in the temp buffer is occupied, |
435 | mark the buffer as full. The means we will do another | 419 | mark the buffer as full. The means we will do another |
436 | read later, because the line is not finished */ | 420 | read later, because the line is not finished */ |
437 | if (impl->temp[impl->tmp_buf_size-1] == 0 && | 421 | if (parser->temp[parser->tmp_buf_size-1] == 0 && |
438 | impl->temp[impl->tmp_buf_size-2] != '\n'&& | 422 | parser->temp[parser->tmp_buf_size-2] != '\n'&& |
439 | impl->temp[impl->tmp_buf_size-2] != 0 ){ | 423 | parser->temp[parser->tmp_buf_size-2] != 0 ){ |
440 | impl->buffer_full = 1; | 424 | parser->buffer_full = 1; |
441 | } else { | 425 | } else { |
442 | impl->buffer_full = 0; | 426 | parser->buffer_full = 0; |
443 | } | 427 | } |
444 | 428 | ||
445 | /* Copy the temp to the output and clear the temp buffer. */ | 429 | /* Copy the temp to the output and clear the temp buffer. */ |
446 | if(impl->continuation_line==1){ | 430 | if(parser->continuation_line==1){ |
447 | /* back up the pointer to erase the continuation characters */ | 431 | /* back up the pointer to erase the continuation characters */ |
448 | impl->continuation_line = 0; | 432 | parser->continuation_line = 0; |
449 | line_p--; | 433 | line_p--; |
450 | 434 | ||
451 | if ( *(line_p-1) == '\r'){ | 435 | if ( *(line_p-1) == '\r'){ |
@@ -454,24 +438,24 @@ char* icalparser_get_line(icalparser *parser, | |||
454 | 438 | ||
455 | /* copy one space up to eliminate the leading space*/ | 439 | /* copy one space up to eliminate the leading space*/ |
456 | icalmemory_append_string(&line,&line_p,&buf_size, | 440 | icalmemory_append_string(&line,&line_p,&buf_size, |
457 | impl->temp+1); | 441 | parser->temp+1); |
458 | 442 | ||
459 | } else { | 443 | } else { |
460 | icalmemory_append_string(&line,&line_p,&buf_size,impl->temp); | 444 | icalmemory_append_string(&line,&line_p,&buf_size,parser->temp); |
461 | } | 445 | } |
462 | 446 | ||
463 | impl->temp[0] = '\0' ; | 447 | parser->temp[0] = '\0' ; |
464 | } | 448 | } |
465 | 449 | ||
466 | impl->temp[impl->tmp_buf_size-1] = 1; /* Mark end of buffer */ | 450 | parser->temp[parser->tmp_buf_size-1] = 1; /* Mark end of buffer */ |
467 | 451 | ||
468 | /****** Here is where the routine gets string data ******************/ | 452 | /****** Here is where the routine gets string data ******************/ |
469 | if ((*line_gen_func)(impl->temp,impl->tmp_buf_size,impl->line_gen_data) | 453 | if ((*line_gen_func)(parser->temp,parser->tmp_buf_size,parser->line_gen_data) |
470 | ==0){/* Get more data */ | 454 | ==0){/* Get more data */ |
471 | 455 | ||
472 | /* If the first position is clear, it means we didn't get | 456 | /* If the first position is clear, it means we didn't get |
473 | any more data from the last call to line_ge_func*/ | 457 | any more data from the last call to line_ge_func*/ |
474 | if (impl->temp[0] == '\0'){ | 458 | if (parser->temp[0] == '\0'){ |
475 | 459 | ||
476 | if(line[0] != '\0'){ | 460 | if(line[0] != '\0'){ |
477 | /* There is data in the output, so fall trhough and process it*/ | 461 | /* There is data in the output, so fall trhough and process it*/ |
@@ -490,12 +474,11 @@ char* icalparser_get_line(icalparser *parser, | |||
490 | begins with a ' ', then the buffer holds a continuation | 474 | begins with a ' ', then the buffer holds a continuation |
491 | line, so keep reading. */ | 475 | line, so keep reading. */ |
492 | 476 | ||
493 | if ( line_p > line+1 && *(line_p-1) == '\n' | 477 | if ( line_p > line+1 && *(line_p-1) == '\n' && parser->temp[0] == ' ') { |
494 | && (impl->temp[0] == ' ' || impl->temp[0] == '\t') ) { | ||
495 | 478 | ||
496 | impl->continuation_line = 1; | 479 | parser->continuation_line = 1; |
497 | 480 | ||
498 | } else if ( impl->buffer_full == 1 ) { | 481 | } else if ( parser->buffer_full == 1 ) { |
499 | 482 | ||
500 | /* The buffer was filled on the last read, so read again */ | 483 | /* The buffer was filled on the last read, so read again */ |
501 | 484 | ||
@@ -519,11 +502,17 @@ char* icalparser_get_line(icalparser *parser, | |||
519 | *(line_p) = '\0'; | 502 | *(line_p) = '\0'; |
520 | } | 503 | } |
521 | 504 | ||
505 | while ( (*line_p == '\0' || iswspace(*line_p)) && line_p > line ) | ||
506 | { | ||
507 | *line_p = '\0'; | ||
508 | line_p--; | ||
509 | } | ||
510 | |||
522 | return line; | 511 | return line; |
523 | 512 | ||
524 | } | 513 | } |
525 | 514 | ||
526 | void insert_error(icalcomponent* comp, char* text, | 515 | static void insert_error(icalcomponent* comp, char* text, |
527 | char* message, icalparameter_xlicerrortype type) | 516 | char* message, icalparameter_xlicerrortype type) |
528 | { | 517 | { |
529 | char temp[1024]; | 518 | char temp[1024]; |
@@ -542,7 +531,8 @@ void insert_error(icalcomponent* comp, char* text, | |||
542 | 0)); | 531 | 0)); |
543 | } | 532 | } |
544 | 533 | ||
545 | int line_is_blank(char* line){ | 534 | |
535 | static int line_is_blank(char* line){ | ||
546 | int i=0; | 536 | int i=0; |
547 | 537 | ||
548 | for(i=0; *(line+i)!=0; i++){ | 538 | for(i=0; *(line+i)!=0; i++){ |
@@ -564,8 +554,8 @@ icalcomponent* icalparser_parse(icalparser *parser, | |||
564 | char* line; | 554 | char* line; |
565 | icalcomponent *c=0; | 555 | icalcomponent *c=0; |
566 | icalcomponent *root=0; | 556 | icalcomponent *root=0; |
567 | struct icalparser_impl *impl = (struct icalparser_impl*)parser; | ||
568 | icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR); | 557 | icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR); |
558 | int cont; | ||
569 | 559 | ||
570 | icalerror_check_arg_rz((parser !=0),"parser"); | 560 | icalerror_check_arg_rz((parser !=0),"parser"); |
571 | 561 | ||
@@ -580,8 +570,8 @@ icalcomponent* icalparser_parse(icalparser *parser, | |||
580 | /* This is bad news... assert? */ | 570 | /* This is bad news... assert? */ |
581 | } | 571 | } |
582 | 572 | ||
583 | assert(impl->root_component == 0); | 573 | assert(parser->root_component == 0); |
584 | assert(pvl_count(impl->components) ==0); | 574 | assert(pvl_count(parser->components) ==0); |
585 | 575 | ||
586 | if (root == 0){ | 576 | if (root == 0){ |
587 | /* Just one component */ | 577 | /* Just one component */ |
@@ -606,10 +596,12 @@ icalcomponent* icalparser_parse(icalparser *parser, | |||
606 | c = 0; | 596 | c = 0; |
607 | 597 | ||
608 | } | 598 | } |
599 | cont = 0; | ||
609 | if(line != 0){ | 600 | if(line != 0){ |
610 | free(line); | 601 | free(line); |
602 | cont = 1; | ||
611 | } | 603 | } |
612 | } while ( line != 0); | 604 | } while ( cont ); |
613 | 605 | ||
614 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); | 606 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); |
615 | 607 | ||
@@ -621,7 +613,6 @@ icalcomponent* icalparser_parse(icalparser *parser, | |||
621 | icalcomponent* icalparser_add_line(icalparser* parser, | 613 | icalcomponent* icalparser_add_line(icalparser* parser, |
622 | char* line) | 614 | char* line) |
623 | { | 615 | { |
624 | char *p; | ||
625 | char *str; | 616 | char *str; |
626 | char *end; | 617 | char *end; |
627 | int vcount = 0; | 618 | int vcount = 0; |
@@ -631,13 +622,12 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
631 | icalvalue_kind value_kind = ICAL_NO_VALUE; | 622 | icalvalue_kind value_kind = ICAL_NO_VALUE; |
632 | 623 | ||
633 | 624 | ||
634 | struct icalparser_impl *impl = (struct icalparser_impl*)parser; | ||
635 | icalerror_check_arg_rz((parser != 0),"parser"); | 625 | icalerror_check_arg_rz((parser != 0),"parser"); |
636 | 626 | ||
637 | 627 | ||
638 | if (line == 0) | 628 | if (line == 0) |
639 | { | 629 | { |
640 | impl->state = ICALPARSER_ERROR; | 630 | parser->state = ICALPARSER_ERROR; |
641 | return 0; | 631 | return 0; |
642 | } | 632 | } |
643 | 633 | ||
@@ -655,7 +645,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
655 | 645 | ||
656 | if (str == 0 || strlen(str) == 0 ){ | 646 | if (str == 0 || strlen(str) == 0 ){ |
657 | /* Could not get a property name */ | 647 | /* Could not get a property name */ |
658 | icalcomponent *tail = pvl_data(pvl_tail(impl->components)); | 648 | icalcomponent *tail = pvl_data(pvl_tail(parser->components)); |
659 | 649 | ||
660 | if (tail){ | 650 | if (tail){ |
661 | insert_error(tail,line, | 651 | insert_error(tail,line, |
@@ -663,7 +653,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
663 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); | 653 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); |
664 | } | 654 | } |
665 | tail = 0; | 655 | tail = 0; |
666 | impl->state = ICALPARSER_ERROR; | 656 | parser->state = ICALPARSER_ERROR; |
667 | return 0; | 657 | return 0; |
668 | } | 658 | } |
669 | 659 | ||
@@ -673,17 +663,22 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
673 | /* If the property name is BEGIN or END, we are actually | 663 | /* If the property name is BEGIN or END, we are actually |
674 | starting or ending a new component */ | 664 | starting or ending a new component */ |
675 | 665 | ||
666 | |||
676 | if(strcmp(str,"BEGIN") == 0){ | 667 | if(strcmp(str,"BEGIN") == 0){ |
677 | icalcomponent *c; | 668 | icalcomponent *c; |
678 | icalcomponent_kind comp_kind; | 669 | icalcomponent_kind comp_kind; |
679 | 670 | ||
680 | impl->level++; | 671 | |
672 | parser->level++; | ||
681 | str = icalparser_get_next_value(end,&end, value_kind); | 673 | str = icalparser_get_next_value(end,&end, value_kind); |
682 | 674 | ||
683 | 675 | ||
684 | comp_kind = icalenum_string_to_component_kind(str); | 676 | comp_kind = icalenum_string_to_component_kind(str); |
685 | 677 | ||
678 | |||
686 | if (comp_kind == ICAL_NO_COMPONENT){ | 679 | if (comp_kind == ICAL_NO_COMPONENT){ |
680 | |||
681 | |||
687 | c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT); | 682 | c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT); |
688 | insert_error(c,str,"Parse error in component name", | 683 | insert_error(c,str,"Parse error in component name", |
689 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); | 684 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); |
@@ -697,48 +692,48 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
697 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); | 692 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); |
698 | } | 693 | } |
699 | 694 | ||
700 | pvl_push(impl->components,c); | 695 | pvl_push(parser->components,c); |
701 | 696 | ||
702 | impl->state = ICALPARSER_BEGIN_COMP; | 697 | parser->state = ICALPARSER_BEGIN_COMP; |
703 | return 0; | 698 | return 0; |
704 | 699 | ||
705 | } else if (strcmp(str,"END") == 0 ) { | 700 | } else if (strcmp(str,"END") == 0 ) { |
706 | icalcomponent* tail; | 701 | icalcomponent* tail; |
707 | 702 | ||
708 | impl->level--; | 703 | parser->level--; |
709 | str = icalparser_get_next_value(end,&end, value_kind); | 704 | str = icalparser_get_next_value(end,&end, value_kind); |
710 | 705 | ||
711 | /* Pop last component off of list and add it to the second-to-last*/ | 706 | /* Pop last component off of list and add it to the second-to-last*/ |
712 | impl->root_component = pvl_pop(impl->components); | 707 | parser->root_component = pvl_pop(parser->components); |
713 | 708 | ||
714 | tail = pvl_data(pvl_tail(impl->components)); | 709 | tail = pvl_data(pvl_tail(parser->components)); |
715 | 710 | ||
716 | if(tail != 0){ | 711 | if(tail != 0){ |
717 | icalcomponent_add_component(tail,impl->root_component); | 712 | icalcomponent_add_component(tail,parser->root_component); |
718 | } | 713 | } |
719 | 714 | ||
720 | tail = 0; | 715 | tail = 0; |
721 | 716 | ||
722 | /* Return the component if we are back to the 0th level */ | 717 | /* Return the component if we are back to the 0th level */ |
723 | if (impl->level == 0){ | 718 | if (parser->level == 0){ |
724 | icalcomponent *rtrn; | 719 | icalcomponent *rtrn; |
725 | 720 | ||
726 | if(pvl_count(impl->components) != 0){ | 721 | if(pvl_count(parser->components) != 0){ |
727 | /* There are still components on the stack -- this means | 722 | /* There are still components on the stack -- this means |
728 | that one of them did not have a proper "END" */ | 723 | that one of them did not have a proper "END" */ |
729 | pvl_push(impl->components,impl->root_component); | 724 | pvl_push(parser->components,parser->root_component); |
730 | icalparser_clean(parser); /* may reset impl->root_component*/ | 725 | icalparser_clean(parser); /* may reset parser->root_component*/ |
731 | } | 726 | } |
732 | 727 | ||
733 | assert(pvl_count(impl->components) == 0); | 728 | assert(pvl_count(parser->components) == 0); |
734 | 729 | ||
735 | impl->state = ICALPARSER_SUCCESS; | 730 | parser->state = ICALPARSER_SUCCESS; |
736 | rtrn = impl->root_component; | 731 | rtrn = parser->root_component; |
737 | impl->root_component = 0; | 732 | parser->root_component = 0; |
738 | return rtrn; | 733 | return rtrn; |
739 | 734 | ||
740 | } else { | 735 | } else { |
741 | impl->state = ICALPARSER_END_COMP; | 736 | parser->state = ICALPARSER_END_COMP; |
742 | return 0; | 737 | return 0; |
743 | } | 738 | } |
744 | } | 739 | } |
@@ -747,8 +742,8 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
747 | /* There is no point in continuing if we have not seen a | 742 | /* There is no point in continuing if we have not seen a |
748 | component yet */ | 743 | component yet */ |
749 | 744 | ||
750 | if(pvl_data(pvl_tail(impl->components)) == 0){ | 745 | if(pvl_data(pvl_tail(parser->components)) == 0){ |
751 | impl->state = ICALPARSER_ERROR; | 746 | parser->state = ICALPARSER_ERROR; |
752 | return 0; | 747 | return 0; |
753 | } | 748 | } |
754 | 749 | ||
@@ -767,7 +762,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
767 | prop = icalproperty_new(prop_kind); | 762 | prop = icalproperty_new(prop_kind); |
768 | 763 | ||
769 | if (prop != 0){ | 764 | if (prop != 0){ |
770 | icalcomponent *tail = pvl_data(pvl_tail(impl->components)); | 765 | icalcomponent *tail = pvl_data(pvl_tail(parser->components)); |
771 | 766 | ||
772 | if(prop_kind==ICAL_X_PROPERTY){ | 767 | if(prop_kind==ICAL_X_PROPERTY){ |
773 | icalproperty_set_x_name(prop,str); | 768 | icalproperty_set_x_name(prop,str); |
@@ -780,13 +775,13 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
780 | value_kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop)); | 775 | value_kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop)); |
781 | 776 | ||
782 | } else { | 777 | } else { |
783 | icalcomponent* tail = pvl_data(pvl_tail(impl->components)); | 778 | icalcomponent* tail = pvl_data(pvl_tail(parser->components)); |
784 | 779 | ||
785 | insert_error(tail,str,"Parse error in property name", | 780 | insert_error(tail,str,"Parse error in property name", |
786 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR); | 781 | ICAL_XLICERRORTYPE_PROPERTYPARSEERROR); |
787 | 782 | ||
788 | tail = 0; | 783 | tail = 0; |
789 | impl->state = ICALPARSER_ERROR; | 784 | parser->state = ICALPARSER_ERROR; |
790 | return 0; | 785 | return 0; |
791 | } | 786 | } |
792 | 787 | ||
@@ -796,7 +791,6 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
796 | 791 | ||
797 | /* Now, add any parameters to the last property */ | 792 | /* Now, add any parameters to the last property */ |
798 | 793 | ||
799 | p = 0; | ||
800 | while(1) { | 794 | while(1) { |
801 | 795 | ||
802 | if (*(end-1) == ':'){ | 796 | if (*(end-1) == ':'){ |
@@ -814,7 +808,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
814 | 808 | ||
815 | icalparameter *param = 0; | 809 | icalparameter *param = 0; |
816 | icalparameter_kind kind; | 810 | icalparameter_kind kind; |
817 | icalcomponent *tail = pvl_data(pvl_tail(impl->components)); | 811 | icalcomponent *tail = pvl_data(pvl_tail(parser->components)); |
818 | 812 | ||
819 | name = icalparser_get_param_name(str,&pvalue); | 813 | name = icalparser_get_param_name(str,&pvalue); |
820 | 814 | ||
@@ -845,7 +839,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
845 | insert_error(tail, str, "Cant parse parameter name", | 839 | insert_error(tail, str, "Cant parse parameter name", |
846 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); | 840 | ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR); |
847 | tail = 0; | 841 | tail = 0; |
848 | impl->state = ICALPARSER_ERROR; | 842 | parser->state = ICALPARSER_ERROR; |
849 | return 0; | 843 | return 0; |
850 | } | 844 | } |
851 | 845 | ||
@@ -855,7 +849,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
855 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR); | 849 | ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR); |
856 | 850 | ||
857 | tail = 0; | 851 | tail = 0; |
858 | impl->state = ICALPARSER_ERROR; | 852 | parser->state = ICALPARSER_ERROR; |
859 | continue; | 853 | continue; |
860 | } | 854 | } |
861 | 855 | ||
@@ -885,7 +879,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
885 | 879 | ||
886 | icalparameter_free(param); | 880 | icalparameter_free(param); |
887 | tail = 0; | 881 | tail = 0; |
888 | impl->state = ICALPARSER_ERROR; | 882 | parser->state = ICALPARSER_ERROR; |
889 | return 0; | 883 | return 0; |
890 | } | 884 | } |
891 | } | 885 | } |
@@ -919,7 +913,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
919 | if (vcount > 0){ | 913 | if (vcount > 0){ |
920 | /* Actually, only clone after the second value */ | 914 | /* Actually, only clone after the second value */ |
921 | icalproperty* clone = icalproperty_new_clone(prop); | 915 | icalproperty* clone = icalproperty_new_clone(prop); |
922 | icalcomponent* tail = pvl_data(pvl_tail(impl->components)); | 916 | icalcomponent* tail = pvl_data(pvl_tail(parser->components)); |
923 | 917 | ||
924 | icalcomponent_add_property(tail, clone); | 918 | icalcomponent_add_property(tail, clone); |
925 | prop = clone; | 919 | prop = clone; |
@@ -933,7 +927,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
933 | char temp[200]; /* HACK */ | 927 | char temp[200]; /* HACK */ |
934 | 928 | ||
935 | icalproperty_kind prop_kind = icalproperty_isa(prop); | 929 | icalproperty_kind prop_kind = icalproperty_isa(prop); |
936 | icalcomponent* tail = pvl_data(pvl_tail(impl->components)); | 930 | icalcomponent* tail = pvl_data(pvl_tail(parser->components)); |
937 | 931 | ||
938 | sprintf(temp,"Cant parse as %s value in %s property. Removing entire property", | 932 | sprintf(temp,"Cant parse as %s value in %s property. Removing entire property", |
939 | icalvalue_kind_to_string(value_kind), | 933 | icalvalue_kind_to_string(value_kind), |
@@ -947,7 +941,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
947 | icalproperty_free(prop); | 941 | icalproperty_free(prop); |
948 | prop = 0; | 942 | prop = 0; |
949 | tail = 0; | 943 | tail = 0; |
950 | impl->state = ICALPARSER_ERROR; | 944 | parser->state = ICALPARSER_ERROR; |
951 | return 0; | 945 | return 0; |
952 | 946 | ||
953 | } else { | 947 | } else { |
@@ -961,7 +955,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
961 | char temp[200]; /* HACK */ | 955 | char temp[200]; /* HACK */ |
962 | 956 | ||
963 | icalproperty_kind prop_kind = icalproperty_isa(prop); | 957 | icalproperty_kind prop_kind = icalproperty_isa(prop); |
964 | icalcomponent *tail = pvl_data(pvl_tail(impl->components)); | 958 | icalcomponent *tail = pvl_data(pvl_tail(parser->components)); |
965 | 959 | ||
966 | sprintf(temp,"No value for %s property. Removing entire property", | 960 | sprintf(temp,"No value for %s property. Removing entire property", |
967 | icalproperty_kind_to_string(prop_kind)); | 961 | icalproperty_kind_to_string(prop_kind)); |
@@ -974,7 +968,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
974 | icalproperty_free(prop); | 968 | icalproperty_free(prop); |
975 | prop = 0; | 969 | prop = 0; |
976 | tail = 0; | 970 | tail = 0; |
977 | impl->state = ICALPARSER_ERROR; | 971 | parser->state = ICALPARSER_ERROR; |
978 | return 0; | 972 | return 0; |
979 | } else { | 973 | } else { |
980 | 974 | ||
@@ -987,14 +981,14 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
987 | * End of component parsing. | 981 | * End of component parsing. |
988 | *****************************************************************/ | 982 | *****************************************************************/ |
989 | 983 | ||
990 | if (pvl_data(pvl_tail(impl->components)) == 0 && | 984 | if (pvl_data(pvl_tail(parser->components)) == 0 && |
991 | impl->level == 0){ | 985 | parser->level == 0){ |
992 | /* HACK. Does this clause ever get executed? */ | 986 | /* HACK. Does this clause ever get executed? */ |
993 | impl->state = ICALPARSER_SUCCESS; | 987 | parser->state = ICALPARSER_SUCCESS; |
994 | assert(0); | 988 | assert(0); |
995 | return impl->root_component; | 989 | return parser->root_component; |
996 | } else { | 990 | } else { |
997 | impl->state = ICALPARSER_IN_PROGRESS; | 991 | parser->state = ICALPARSER_IN_PROGRESS; |
998 | return 0; | 992 | return 0; |
999 | } | 993 | } |
1000 | 994 | ||
@@ -1002,14 +996,12 @@ icalcomponent* icalparser_add_line(icalparser* parser, | |||
1002 | 996 | ||
1003 | icalparser_state icalparser_get_state(icalparser* parser) | 997 | icalparser_state icalparser_get_state(icalparser* parser) |
1004 | { | 998 | { |
1005 | struct icalparser_impl* impl = (struct icalparser_impl*) parser; | 999 | return parser->state; |
1006 | return impl->state; | ||
1007 | 1000 | ||
1008 | } | 1001 | } |
1009 | 1002 | ||
1010 | icalcomponent* icalparser_clean(icalparser* parser) | 1003 | icalcomponent* icalparser_clean(icalparser* parser) |
1011 | { | 1004 | { |
1012 | struct icalparser_impl* impl = (struct icalparser_impl*) parser; | ||
1013 | icalcomponent *tail; | 1005 | icalcomponent *tail; |
1014 | 1006 | ||
1015 | icalerror_check_arg_rz((parser != 0 ),"parser"); | 1007 | icalerror_check_arg_rz((parser != 0 ),"parser"); |
@@ -1017,27 +1009,27 @@ icalcomponent* icalparser_clean(icalparser* parser) | |||
1017 | /* We won't get a clean exit if some components did not have an | 1009 | /* We won't get a clean exit if some components did not have an |
1018 | "END" tag. Clear off any component that may be left in the list */ | 1010 | "END" tag. Clear off any component that may be left in the list */ |
1019 | 1011 | ||
1020 | while((tail=pvl_data(pvl_tail(impl->components))) != 0){ | 1012 | while((tail=pvl_data(pvl_tail(parser->components))) != 0){ |
1021 | 1013 | ||
1022 | insert_error(tail," ", | 1014 | insert_error(tail," ", |
1023 | "Missing END tag for this component. Closing component at end of input.", | 1015 | "Missing END tag for this component. Closing component at end of input.", |
1024 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); | 1016 | ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); |
1025 | 1017 | ||
1026 | 1018 | ||
1027 | impl->root_component = pvl_pop(impl->components); | 1019 | parser->root_component = pvl_pop(parser->components); |
1028 | tail=pvl_data(pvl_tail(impl->components)); | 1020 | tail=pvl_data(pvl_tail(parser->components)); |
1029 | 1021 | ||
1030 | if(tail != 0){ | 1022 | if(tail != 0){ |
1031 | if(icalcomponent_get_parent(impl->root_component)!=0){ | 1023 | if(icalcomponent_get_parent(parser->root_component)!=0){ |
1032 | icalerror_warn("icalparser_clean is trying to attach a component for the second time"); | 1024 | icalerror_warn("icalparser_clean is trying to attach a component for the second time"); |
1033 | } else { | 1025 | } else { |
1034 | icalcomponent_add_component(tail,impl->root_component); | 1026 | icalcomponent_add_component(tail,parser->root_component); |
1035 | } | 1027 | } |
1036 | } | 1028 | } |
1037 | 1029 | ||
1038 | } | 1030 | } |
1039 | 1031 | ||
1040 | return impl->root_component; | 1032 | return parser->root_component; |
1041 | 1033 | ||
1042 | } | 1034 | } |
1043 | 1035 | ||
@@ -1046,7 +1038,8 @@ struct slg_data { | |||
1046 | const char* str; | 1038 | const char* str; |
1047 | }; | 1039 | }; |
1048 | 1040 | ||
1049 | char* string_line_generator(char *out, size_t buf_size, void *d) | 1041 | |
1042 | char* icalparser_string_line_generator(char *out, size_t buf_size, void *d) | ||
1050 | { | 1043 | { |
1051 | char *n; | 1044 | char *n; |
1052 | size_t size; | 1045 | size_t size; |
@@ -1100,7 +1093,7 @@ icalcomponent* icalparser_parse_string(const char* str) | |||
1100 | 1093 | ||
1101 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL); | 1094 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL); |
1102 | 1095 | ||
1103 | c = icalparser_parse(p,string_line_generator); | 1096 | c = icalparser_parse(p,icalparser_string_line_generator); |
1104 | 1097 | ||
1105 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); | 1098 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); |
1106 | 1099 | ||
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 | |||
@@ -33,16 +33,17 @@ | |||
33 | 33 | ||
34 | #include <stdio.h> /* For FILE* */ | 34 | #include <stdio.h> /* For FILE* */ |
35 | 35 | ||
36 | typedef void* icalparser; | 36 | typedef struct icalparser_impl icalparser; |
37 | 37 | ||
38 | 38 | ||
39 | /*********************************************************************** | 39 | /** |
40 | * Line-oriented parsing. | 40 | * @file icalparser.h |
41 | * @brief Line-oriented parsing. | ||
41 | * | 42 | * |
42 | * Create a new parser via icalparse_new_parser, then add ines one at | 43 | * Create a new parser via icalparse_new_parser, then add lines one at |
43 | * a time with icalparse_add_line(). icalparser_add_line() will return | 44 | * a time with icalparse_add_line(). icalparser_add_line() will return |
44 | * non-zero when it has finished with a component. | 45 | * non-zero when it has finished with a component. |
45 | ***********************************************************************/ | 46 | */ |
46 | 47 | ||
47 | typedef enum icalparser_state { | 48 | typedef enum icalparser_state { |
48 | ICALPARSER_ERROR, | 49 | ICALPARSER_ERROR, |
@@ -59,18 +60,20 @@ icalparser_state icalparser_get_state(icalparser* parser); | |||
59 | void icalparser_free(icalparser* parser); | 60 | void icalparser_free(icalparser* parser); |
60 | 61 | ||
61 | 62 | ||
62 | /*********************************************************************** | 63 | /** |
63 | * Message oriented parsing. icalparser_parse takes a string that | 64 | * Message oriented parsing. icalparser_parse takes a string that |
64 | * holds the text ( in RFC 2445 format ) and returns a pointer to an | 65 | * holds the text ( in RFC 2445 format ) and returns a pointer to an |
65 | * icalcomponent. The caller owns the memory. line_gen_func is a | 66 | * icalcomponent. The caller owns the memory. line_gen_func is a |
66 | * pointer to a function that returns one content line per invocation | 67 | * pointer to a function that returns one content line per invocation |
67 | **********************************************************************/ | 68 | */ |
68 | 69 | ||
69 | icalcomponent* icalparser_parse(icalparser *parser, | 70 | icalcomponent* icalparser_parse(icalparser *parser, |
70 | char* (*line_gen_func)(char *s, size_t size, void *d)); | 71 | char* (*line_gen_func)(char *s, size_t size, void *d)); |
71 | 72 | ||
72 | /* Set the data that icalparser_parse will give to the line_gen_func | 73 | /** |
73 | as the parameter 'd'*/ | 74 | Set the data that icalparser_parse will give to the line_gen_func |
75 | as the parameter 'd' | ||
76 | */ | ||
74 | void icalparser_set_gen_data(icalparser* parser, void* data); | 77 | void icalparser_set_gen_data(icalparser* parser, void* data); |
75 | 78 | ||
76 | 79 | ||
@@ -81,13 +84,13 @@ icalcomponent* icalparser_parse_string(const char* str); | |||
81 | * Parser support functions | 84 | * Parser support functions |
82 | ***********************************************************************/ | 85 | ***********************************************************************/ |
83 | 86 | ||
84 | /* Use the flex/bison parser to turn a string into a value type */ | 87 | /** Use the flex/bison parser to turn a string into a value type */ |
85 | icalvalue* icalparser_parse_value(icalvalue_kind kind, | 88 | icalvalue* icalparser_parse_value(icalvalue_kind kind, |
86 | const char* str, icalcomponent** errors); | 89 | const char* str, icalcomponent** errors); |
87 | 90 | ||
88 | /* Given a line generator function, return a single iCal content line.*/ | 91 | /** Given a line generator function, return a single iCal content line.*/ |
89 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); | 92 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); |
90 | 93 | ||
91 | char* string_line_generator(char *out, size_t buf_size, void *d); | 94 | char* icalparser_string_line_generator(char *out, size_t buf_size, void *d); |
92 | 95 | ||
93 | #endif /* !ICALPARSE_H */ | 96 | #endif /* !ICALPARSE_H */ |
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 | |||
@@ -36,14 +36,8 @@ | |||
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | #include <stdio.h> | 37 | #include <stdio.h> |
38 | 38 | ||
39 | #ifdef ICAL_NO_LIBICAL | ||
40 | #define icalerror_set_errno(x) | ||
41 | #define icalerror_check_arg_rv(x,y) | ||
42 | #define icalerror_check_arg_re(x,y,z) | ||
43 | #else | ||
44 | #include "icalerror.h" | 39 | #include "icalerror.h" |
45 | #include "icalmemory.h" | 40 | #include "icalmemory.h" |
46 | #endif | ||
47 | 41 | ||
48 | 42 | ||
49 | 43 | ||
@@ -97,10 +91,15 @@ struct icalperiodtype icalperiodtype_from_string (const char* str) | |||
97 | 91 | ||
98 | icalerrno = e; | 92 | icalerrno = e; |
99 | 93 | ||
94 | icalmemory_free_buffer(s); | ||
95 | |||
100 | return p; | 96 | return p; |
101 | 97 | ||
102 | error: | 98 | error: |
103 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 99 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
100 | |||
101 | if (s) | ||
102 | icalmemory_free_buffer (s); | ||
104 | return null_p; | 103 | return null_p; |
105 | } | 104 | } |
106 | 105 | ||
@@ -133,13 +132,14 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p) | |||
133 | 132 | ||
134 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, end); | 133 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, end); |
135 | 134 | ||
135 | icalmemory_add_tmp_buffer(buf); | ||
136 | 136 | ||
137 | return buf; | 137 | return buf; |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | 141 | ||
142 | struct icalperiodtype icalperiodtype_null_period() { | 142 | struct icalperiodtype icalperiodtype_null_period(void) { |
143 | struct icalperiodtype p; | 143 | struct icalperiodtype p; |
144 | p.start = icaltime_null_time(); | 144 | p.start = icaltime_null_time(); |
145 | p.end = icaltime_null_time(); | 145 | p.end = icaltime_null_time(); |
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 | |||
@@ -42,12 +42,12 @@ struct icalperiodtype | |||
42 | struct icalperiodtype icalperiodtype_from_string (const char* str); | 42 | struct icalperiodtype icalperiodtype_from_string (const char* str); |
43 | 43 | ||
44 | const char* icalperiodtype_as_ical_string(struct icalperiodtype p); | 44 | const char* icalperiodtype_as_ical_string(struct icalperiodtype p); |
45 | struct icalperiodtype icalperiodtype_null_period(); | ||
46 | int icalperiodtype_is_null_period(struct icalperiodtype p); | ||
47 | int icalperiodtype_is_valid_period(struct icalperiodtype p); | ||
48 | 45 | ||
46 | struct icalperiodtype icalperiodtype_null_period(void); | ||
49 | 47 | ||
48 | int icalperiodtype_is_null_period(struct icalperiodtype p); | ||
50 | 49 | ||
50 | int icalperiodtype_is_valid_period(struct icalperiodtype p); | ||
51 | 51 | ||
52 | #endif /* !ICALTIME_H */ | 52 | #endif /* !ICALTIME_H */ |
53 | 53 | ||
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 | |||
@@ -23,7 +23,6 @@ | |||
23 | The original code is icalproperty.c | 23 | The original code is icalproperty.c |
24 | 24 | ||
25 | ======================================================================*/ | 25 | ======================================================================*/ |
26 | /*#line 27 "icalproperty.c.in"*/ | ||
27 | 26 | ||
28 | #ifdef HAVE_CONFIG_H | 27 | #ifdef HAVE_CONFIG_H |
29 | #include <config.h> | 28 | #include <config.h> |
@@ -45,9 +44,10 @@ | |||
45 | #include <stdio.h> /* for printf */ | 44 | #include <stdio.h> /* for printf */ |
46 | #include <stdarg.h> /* for va_list, va_start, etc. */ | 45 | #include <stdarg.h> /* for va_list, va_start, etc. */ |
47 | 46 | ||
48 | int snprintf(char *str, size_t n, char const *fmt, ...); | 47 | #ifdef WIN32 |
49 | 48 | #define snprintf _snprintf | |
50 | #define TMP_BUF_SIZE 1024 | 49 | #define strcasecmp stricmp |
50 | #endif | ||
51 | 51 | ||
52 | /* Private routines for icalproperty */ | 52 | /* Private routines for icalproperty */ |
53 | void icalvalue_set_parent(icalvalue* value, | 53 | void icalvalue_set_parent(icalvalue* value, |
@@ -72,37 +72,34 @@ struct icalproperty_impl | |||
72 | icalcomponent *parent; | 72 | icalcomponent *parent; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args) | 75 | void icalproperty_add_parameters(icalproperty* prop, va_list args) |
76 | { | 76 | { |
77 | |||
78 | void* vp; | 77 | void* vp; |
79 | 78 | ||
80 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
81 | |||
82 | while((vp = va_arg(args, void*)) != 0) { | 79 | while((vp = va_arg(args, void*)) != 0) { |
83 | 80 | ||
84 | if (icalvalue_isa_value(vp) != 0 ){ | 81 | if (icalvalue_isa_value(vp) != 0 ){ |
85 | } else if (icalparameter_isa_parameter(vp) != 0 ){ | 82 | } else if (icalparameter_isa_parameter(vp) != 0 ){ |
86 | 83 | ||
87 | icalproperty_add_parameter((icalproperty*)impl, | 84 | icalproperty_add_parameter((icalproperty*)prop, |
88 | (icalparameter*)vp); | 85 | (icalparameter*)vp); |
89 | } else { | 86 | } else { |
90 | assert(0); | 87 | icalerror_set_errno(ICAL_BADARG_ERROR); |
91 | } | 88 | } |
92 | 89 | ||
93 | } | 90 | } |
94 | |||
95 | |||
96 | } | 91 | } |
97 | 92 | ||
98 | 93 | ||
99 | struct icalproperty_impl* | 94 | icalproperty* |
100 | icalproperty_new_impl (icalproperty_kind kind) | 95 | icalproperty_new_impl(icalproperty_kind kind) |
101 | { | 96 | { |
102 | struct icalproperty_impl* prop; | 97 | icalproperty* prop; |
98 | |||
99 | if (!icalproperty_kind_is_valid(kind)) | ||
100 | return NULL; | ||
103 | 101 | ||
104 | if ( ( prop = (struct icalproperty_impl*) | 102 | if ( ( prop = (icalproperty*) malloc(sizeof(icalproperty))) == 0) { |
105 | malloc(sizeof(struct icalproperty_impl))) == 0) { | ||
106 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 103 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); |
107 | return 0; | 104 | return 0; |
108 | } | 105 | } |
@@ -123,7 +120,7 @@ icalproperty_new_impl (icalproperty_kind kind) | |||
123 | icalproperty* | 120 | icalproperty* |
124 | icalproperty_new (icalproperty_kind kind) | 121 | icalproperty_new (icalproperty_kind kind) |
125 | { | 122 | { |
126 | if(kind == ICAL_NO_PROPERTY){ | 123 | if (kind == ICAL_NO_PROPERTY){ |
127 | return 0; | 124 | return 0; |
128 | } | 125 | } |
129 | 126 | ||
@@ -132,13 +129,11 @@ icalproperty_new (icalproperty_kind kind) | |||
132 | 129 | ||
133 | 130 | ||
134 | icalproperty* | 131 | icalproperty* |
135 | icalproperty_new_clone(icalproperty* prop) | 132 | icalproperty_new_clone(icalproperty* old) |
136 | { | 133 | { |
137 | struct icalproperty_impl *old = (struct icalproperty_impl*)prop; | 134 | icalproperty *new = icalproperty_new_impl(old->kind); |
138 | struct icalproperty_impl *new = icalproperty_new_impl(old->kind); | ||
139 | pvl_elem p; | 135 | pvl_elem p; |
140 | 136 | ||
141 | icalerror_check_arg_rz((prop!=0),"Prop"); | ||
142 | icalerror_check_arg_rz((old!=0),"old"); | 137 | icalerror_check_arg_rz((old!=0),"old"); |
143 | icalerror_check_arg_rz((new!=0),"new"); | 138 | icalerror_check_arg_rz((new!=0),"new"); |
144 | 139 | ||
@@ -219,15 +214,11 @@ icalproperty* icalproperty_new_from_string(const char* str) | |||
219 | } | 214 | } |
220 | 215 | ||
221 | void | 216 | void |
222 | icalproperty_free (icalproperty* prop) | 217 | icalproperty_free (icalproperty* p) |
223 | { | 218 | { |
224 | struct icalproperty_impl *p; | ||
225 | |||
226 | icalparameter* param; | 219 | icalparameter* param; |
227 | 220 | ||
228 | icalerror_check_arg_rv((prop!=0),"prop"); | 221 | icalerror_check_arg_rv((p!=0),"prop"); |
229 | |||
230 | p = (struct icalproperty_impl*)prop; | ||
231 | 222 | ||
232 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR | 223 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR |
233 | icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. "); | 224 | icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. "); |
@@ -265,69 +256,135 @@ icalproperty_free (icalproperty* prop) | |||
265 | } | 256 | } |
266 | 257 | ||
267 | 258 | ||
268 | const char* | 259 | /* This returns where the start of the next line should be. chars_left does |
269 | icalproperty_as_ical_string (icalproperty* prop) | 260 | not include the trailing '\0'. */ |
270 | { | 261 | #define MAX_LINE_LEN 75 |
271 | icalparameter *param; | 262 | /*#define MAX_LINE_LEN 120*/ |
272 | 263 | ||
273 | /* Create new buffer that we can append names, parameters and a | 264 | static char* |
274 | value to, and reallocate as needed. Later, this buffer will be | 265 | get_next_line_start (char *line_start, int chars_left) |
275 | copied to a icalmemory_tmp_buffer, which is managed internally | 266 | { |
276 | by libical, so it can be given to the caller without fear of | 267 | char *pos; |
277 | the caller forgetting to free it */ | ||
278 | |||
279 | const char* property_name = 0; | ||
280 | size_t buf_size = 1024; | ||
281 | char* buf = icalmemory_new_buffer(buf_size); | ||
282 | char* buf_ptr = buf; | ||
283 | icalvalue* value; | ||
284 | char *out_buf; | ||
285 | 268 | ||
286 | char newline[] = "\n"; | 269 | /* If we have 74 chars or less left, we can output all of them. |
270 | we return a pointer to the '\0' at the end of the string. */ | ||
271 | if (chars_left < MAX_LINE_LEN) { | ||
272 | return line_start + chars_left; | ||
273 | } | ||
287 | 274 | ||
288 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | 275 | /* Now we jump to the last possible character of the line, and step back |
289 | 276 | trying to find a ';' ':' or ' '. If we find one, we return the character | |
290 | icalerror_check_arg_rz( (prop!=0),"prop"); | 277 | after it. */ |
278 | pos = line_start + MAX_LINE_LEN - 2; | ||
279 | while (pos > line_start) { | ||
280 | if (*pos == ';' || *pos == ':' || *pos == ' ') { | ||
281 | return pos + 1; | ||
282 | } | ||
283 | pos--; | ||
284 | } | ||
285 | /* Now try to split on a UTF-8 boundary defined as a 7-bit | ||
286 | value or as a byte with the two high-most bits set: | ||
287 | 11xxxxxx. See http://czyborra.com/utf/ */ | ||
291 | 288 | ||
289 | pos = line_start + MAX_LINE_LEN - 1; | ||
290 | while (pos > line_start) { | ||
291 | /* plain ascii */ | ||
292 | if ((*pos & 128) == 0) | ||
293 | return pos; | ||
292 | 294 | ||
293 | /* Append property name */ | 295 | /* utf8 escape byte */ |
296 | if ((*pos & 192) == 192) | ||
297 | return pos; | ||
294 | 298 | ||
295 | if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){ | 299 | pos--; |
296 | property_name = impl->x_name; | ||
297 | } else { | ||
298 | property_name = icalproperty_kind_to_string(impl->kind); | ||
299 | } | 300 | } |
300 | 301 | ||
301 | if (property_name == 0 ) { | 302 | /* Give up, just break at 74 chars (the 75th char is the space at |
302 | icalerror_warn("Got a property of an unknown kind."); | 303 | the start of the line). */ |
303 | icalmemory_free_buffer(buf); | 304 | |
304 | return 0; | 305 | return line_start + MAX_LINE_LEN - 1; |
305 | 306 | } | |
306 | } | ||
307 | 307 | ||
308 | 308 | ||
309 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name); | 309 | /** This splits the property into lines less than 75 octects long (as |
310 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); | 310 | * specified in RFC2445). It tries to split after a ';' if it can. |
311 | * It returns a tmp buffer. NOTE: I'm not sure if it matters if we | ||
312 | * split a line in the middle of a UTF-8 character. It probably won't | ||
313 | * look nice in a text editor. | ||
314 | */ | ||
315 | static char* | ||
316 | fold_property_line (char *text) | ||
317 | { | ||
318 | size_t buf_size; | ||
319 | char *buf, *buf_ptr, *line_start, *next_line_start, *out_buf; | ||
320 | int len, chars_left, first_line; | ||
321 | char ch; | ||
322 | |||
323 | /* Start with a buffer twice the size of our property line, so we almost | ||
324 | certainly won't overflow it. */ | ||
325 | len = strlen (text); | ||
326 | buf_size = len * 2; | ||
327 | buf = icalmemory_new_buffer (buf_size); | ||
328 | buf_ptr = buf; | ||
329 | |||
330 | /* Step through the text, finding each line to add to the output. */ | ||
331 | line_start = text; | ||
332 | chars_left = len; | ||
333 | first_line = 1; | ||
334 | for (;;) { | ||
335 | if (chars_left <= 0) | ||
336 | break; | ||
337 | |||
338 | /* This returns the first character for the next line. */ | ||
339 | next_line_start = get_next_line_start (line_start, chars_left); | ||
340 | |||
341 | /* If this isn't the first line, we need to output a newline and space | ||
342 | first. */ | ||
343 | if (!first_line) { | ||
344 | icalmemory_append_string (&buf, &buf_ptr, &buf_size, "\n "); | ||
345 | } | ||
346 | first_line = 0; | ||
347 | |||
348 | /* This adds the line to our tmp buffer. We temporarily place a '\0' | ||
349 | in text, so we can copy the line in one go. */ | ||
350 | ch = *next_line_start; | ||
351 | *next_line_start = '\0'; | ||
352 | icalmemory_append_string (&buf, &buf_ptr, &buf_size, line_start); | ||
353 | *next_line_start = ch; | ||
311 | 354 | ||
355 | /* Now we move on to the next line. */ | ||
356 | chars_left -= (next_line_start - line_start); | ||
357 | line_start = next_line_start; | ||
358 | } | ||
359 | |||
360 | /* Copy it to a temporary buffer, and then free it. */ | ||
361 | out_buf = icalmemory_tmp_buffer (strlen (buf) + 1); | ||
362 | strcpy (out_buf, buf); | ||
363 | icalmemory_free_buffer (buf); | ||
364 | |||
365 | return out_buf; | ||
366 | } | ||
312 | 367 | ||
313 | 368 | ||
314 | /* Determine what VALUE parameter to include. The VALUE parameters | 369 | /* Determine what VALUE parameter to include. The VALUE parameters |
315 | are ignored in the normal parameter printing ( the block after | 370 | are ignored in the normal parameter printing ( the block after |
316 | this one, so we need to do it here */ | 371 | this one, so we need to do it here */ |
317 | { | 372 | static const char * |
373 | icalproperty_get_value_kind(icalproperty *prop) | ||
374 | { | ||
318 | const char* kind_string = 0; | 375 | const char* kind_string = 0; |
319 | 376 | ||
320 | icalparameter *orig_val_param | 377 | icalparameter *orig_val_param |
321 | = icalproperty_get_first_parameter(prop,ICAL_VALUE_PARAMETER); | 378 | = icalproperty_get_first_parameter(prop,ICAL_VALUE_PARAMETER); |
322 | 379 | ||
323 | icalvalue *value = icalproperty_get_value(impl); | 380 | icalvalue *value = icalproperty_get_value(prop); |
324 | 381 | ||
325 | icalvalue_kind orig_kind = ICAL_NO_VALUE; | 382 | icalvalue_kind orig_kind = ICAL_NO_VALUE; |
326 | 383 | ||
327 | icalvalue_kind this_kind = ICAL_NO_VALUE; | 384 | icalvalue_kind this_kind = ICAL_NO_VALUE; |
328 | 385 | ||
329 | icalvalue_kind default_kind | 386 | icalvalue_kind default_kind |
330 | = icalproperty_kind_to_value_kind(impl->kind); | 387 | = icalproperty_kind_to_value_kind(prop->kind); |
331 | 388 | ||
332 | if(orig_val_param){ | 389 | if(orig_val_param){ |
333 | orig_kind = (icalvalue_kind)icalparameter_get_value(orig_val_param); | 390 | orig_kind = (icalvalue_kind)icalparameter_get_value(orig_val_param); |
@@ -354,14 +411,55 @@ icalproperty_as_ical_string (icalproperty* prop) | |||
354 | /* Don'tinclude the VALUE parameter at all */ | 411 | /* Don'tinclude the VALUE parameter at all */ |
355 | } | 412 | } |
356 | 413 | ||
357 | if(kind_string!=0){ | 414 | return kind_string; |
358 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;"); | 415 | } |
359 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE="); | 416 | |
360 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); | 417 | const char* |
361 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); | 418 | icalproperty_as_ical_string (icalproperty* prop) |
362 | } | 419 | { |
420 | icalparameter *param; | ||
421 | |||
422 | /* Create new buffer that we can append names, parameters and a | ||
423 | value to, and reallocate as needed. Later, this buffer will be | ||
424 | copied to a icalmemory_tmp_buffer, which is managed internally | ||
425 | by libical, so it can be given to the caller without fear of | ||
426 | the caller forgetting to free it */ | ||
427 | |||
428 | const char* property_name = 0; | ||
429 | size_t buf_size = 1024; | ||
430 | char* buf = icalmemory_new_buffer(buf_size); | ||
431 | char* buf_ptr = buf; | ||
432 | icalvalue* value; | ||
433 | char *out_buf; | ||
434 | const char* kind_string = 0; | ||
435 | |||
436 | char newline[] = "\n"; | ||
437 | |||
438 | |||
439 | icalerror_check_arg_rz( (prop!=0),"prop"); | ||
440 | |||
441 | |||
442 | /* Append property name */ | ||
443 | |||
444 | if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){ | ||
445 | property_name = prop->x_name; | ||
446 | } else { | ||
447 | property_name = icalproperty_kind_to_string(prop->kind); | ||
448 | } | ||
449 | |||
450 | if (property_name == 0 ) { | ||
451 | icalerror_warn("Got a property of an unknown kind."); | ||
452 | icalmemory_free_buffer(buf); | ||
453 | return 0; | ||
363 | 454 | ||
455 | } | ||
364 | 456 | ||
457 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name); | ||
458 | |||
459 | kind_string = icalproperty_get_value_kind(prop); | ||
460 | if(kind_string!=0){ | ||
461 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";VALUE="); | ||
462 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); | ||
365 | } | 463 | } |
366 | 464 | ||
367 | /* Append parameters */ | 465 | /* Append parameters */ |
@@ -369,29 +467,27 @@ icalproperty_as_ical_string (icalproperty* prop) | |||
369 | param != 0; | 467 | param != 0; |
370 | param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) { | 468 | param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) { |
371 | 469 | ||
372 | char* kind_string = icalparameter_as_ical_string(param); | ||
373 | icalparameter_kind kind = icalparameter_isa(param); | 470 | icalparameter_kind kind = icalparameter_isa(param); |
471 | kind_string = icalparameter_as_ical_string(param); | ||
374 | 472 | ||
375 | if(kind==ICAL_VALUE_PARAMETER){ | 473 | if(kind==ICAL_VALUE_PARAMETER){ |
376 | continue; | 474 | continue; |
377 | } | 475 | } |
378 | 476 | ||
379 | if (kind_string == 0 ) { | 477 | if (kind_string == 0 ) { |
380 | char temp[TMP_BUF_SIZE]; | 478 | icalerror_warn("Got a parameter of unknown kind for the following property"); |
381 | snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name); | 479 | |
382 | icalerror_warn(temp); | 480 | icalerror_warn((property_name) ? property_name : "(NULL)"); |
383 | continue; | 481 | continue; |
384 | } | 482 | } |
385 | 483 | ||
386 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;"); | 484 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";"); |
387 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); | 485 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); |
388 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); | ||
389 | |||
390 | } | 486 | } |
391 | 487 | ||
392 | /* Append value */ | 488 | /* Append value */ |
393 | 489 | ||
394 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :"); | 490 | icalmemory_append_string(&buf, &buf_ptr, &buf_size, ":"); |
395 | 491 | ||
396 | value = icalproperty_get_value(prop); | 492 | value = icalproperty_get_value(prop); |
397 | 493 | ||
@@ -409,9 +505,8 @@ icalproperty_as_ical_string (icalproperty* prop) | |||
409 | /* Now, copy the buffer to a tmp_buffer, which is safe to give to | 505 | /* Now, copy the buffer to a tmp_buffer, which is safe to give to |
410 | the caller without worring about de-allocating it. */ | 506 | the caller without worring about de-allocating it. */ |
411 | 507 | ||
412 | 508 | /* We now use a function to fold the line properly every 75 characters. */ | |
413 | out_buf = icalmemory_tmp_buffer(strlen(buf)+1); | 509 | out_buf = fold_property_line (buf); |
414 | strcpy(out_buf, buf); | ||
415 | 510 | ||
416 | icalmemory_free_buffer(buf); | 511 | icalmemory_free_buffer(buf); |
417 | 512 | ||
@@ -421,11 +516,9 @@ icalproperty_as_ical_string (icalproperty* prop) | |||
421 | 516 | ||
422 | 517 | ||
423 | icalproperty_kind | 518 | icalproperty_kind |
424 | icalproperty_isa (icalproperty* property) | 519 | icalproperty_isa (icalproperty* p) |
425 | { | 520 | { |
426 | struct icalproperty_impl *p = (struct icalproperty_impl*)property; | 521 | if(p != 0){ |
427 | |||
428 | if(property != 0){ | ||
429 | return p->kind; | 522 | return p->kind; |
430 | } | 523 | } |
431 | 524 | ||
@@ -435,10 +528,9 @@ icalproperty_isa (icalproperty* property) | |||
435 | int | 528 | int |
436 | icalproperty_isa_property (void* property) | 529 | icalproperty_isa_property (void* property) |
437 | { | 530 | { |
438 | struct icalproperty_impl *impl = (struct icalproperty_impl*)property; | 531 | icalproperty *impl = (icalproperty *) property; |
439 | 532 | ||
440 | icalerror_check_arg_rz( (property!=0), "property"); | 533 | icalerror_check_arg_rz( (property!=0), "property"); |
441 | |||
442 | if (strcmp(impl->id,"prop") == 0) { | 534 | if (strcmp(impl->id,"prop") == 0) { |
443 | return 1; | 535 | return 1; |
444 | } else { | 536 | } else { |
@@ -448,11 +540,9 @@ icalproperty_isa_property (void* property) | |||
448 | 540 | ||
449 | 541 | ||
450 | void | 542 | void |
451 | icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter) | 543 | icalproperty_add_parameter (icalproperty* p,icalparameter* parameter) |
452 | { | 544 | { |
453 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | 545 | icalerror_check_arg_rv( (p!=0),"prop"); |
454 | |||
455 | icalerror_check_arg_rv( (prop!=0),"prop"); | ||
456 | icalerror_check_arg_rv( (parameter!=0),"parameter"); | 546 | icalerror_check_arg_rv( (parameter!=0),"parameter"); |
457 | 547 | ||
458 | pvl_push(p->parameters, parameter); | 548 | pvl_push(p->parameters, parameter); |
@@ -468,8 +558,11 @@ icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter) | |||
468 | icalerror_check_arg_rv( (parameter!=0),"parameter"); | 558 | icalerror_check_arg_rv( (parameter!=0),"parameter"); |
469 | 559 | ||
470 | kind = icalparameter_isa(parameter); | 560 | kind = icalparameter_isa(parameter); |
471 | 561 | if (kind != ICAL_X_PARAMETER) | |
472 | icalproperty_remove_parameter(prop,kind); | 562 | icalproperty_remove_parameter_by_kind(prop,kind); |
563 | else | ||
564 | icalproperty_remove_parameter_by_name(prop, | ||
565 | icalparameter_get_xname(parameter)); | ||
473 | 566 | ||
474 | icalproperty_add_parameter(prop,parameter); | 567 | icalproperty_add_parameter(prop,parameter); |
475 | } | 568 | } |
@@ -491,7 +584,7 @@ void icalproperty_set_parameter_from_string(icalproperty* prop, | |||
491 | icalerror_set_errno(ICAL_BADARG_ERROR); | 584 | icalerror_set_errno(ICAL_BADARG_ERROR); |
492 | return; | 585 | return; |
493 | } | 586 | } |
494 | 587 | ||
495 | param = icalparameter_new_from_value_string(kind,value); | 588 | param = icalparameter_new_from_value_string(kind,value); |
496 | 589 | ||
497 | if (param == 0){ | 590 | if (param == 0){ |
@@ -499,6 +592,10 @@ void icalproperty_set_parameter_from_string(icalproperty* prop, | |||
499 | return; | 592 | return; |
500 | } | 593 | } |
501 | 594 | ||
595 | if(kind == ICAL_X_PARAMETER){ | ||
596 | icalparameter_set_xname(param, name); | ||
597 | } | ||
598 | |||
502 | icalproperty_set_parameter(prop,param); | 599 | icalproperty_set_parameter(prop,param); |
503 | 600 | ||
504 | } | 601 | } |
@@ -516,17 +613,28 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop, | |||
516 | 613 | ||
517 | kind = icalparameter_string_to_kind(name); | 614 | kind = icalparameter_string_to_kind(name); |
518 | 615 | ||
519 | if(kind == ICAL_NO_PROPERTY){ | 616 | if(kind == ICAL_NO_PARAMETER){ |
520 | /* icalenum_string_to_parameter_kind will set icalerrno */ | 617 | /* icalenum_string_to_parameter_kind will set icalerrno */ |
521 | return 0; | 618 | return 0; |
522 | } | 619 | } |
620 | |||
621 | for(param = icalproperty_get_first_parameter(prop,kind); | ||
622 | param != 0; | ||
623 | param = icalproperty_get_next_parameter(prop,kind)) { | ||
624 | if (kind != ICAL_X_PARAMETER) { | ||
625 | break; | ||
626 | } | ||
523 | 627 | ||
524 | param = icalproperty_get_first_parameter(prop,kind); | 628 | if (strcmp(icalparameter_get_xname(param),name)==0) { |
629 | break; | ||
630 | } | ||
631 | } | ||
525 | 632 | ||
526 | if (param == 0){ | 633 | if (param == 0){ |
527 | return 0; | 634 | return 0; |
528 | } | 635 | } |
529 | 636 | ||
637 | |||
530 | str = icalparameter_as_ical_string(param); | 638 | str = icalparameter_as_ical_string(param); |
531 | 639 | ||
532 | pv = strchr(str,'='); | 640 | pv = strchr(str,'='); |
@@ -540,32 +648,133 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop, | |||
540 | 648 | ||
541 | } | 649 | } |
542 | 650 | ||
651 | /** @see icalproperty_remove_parameter_by_kind() | ||
652 | * | ||
653 | * @deprecated Please use icalproperty_remove_parameter_by_kind() | ||
654 | * instead. | ||
655 | */ | ||
656 | |||
543 | void | 657 | void |
544 | icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind) | 658 | icalproperty_remove_parameter(icalproperty* prop, icalparameter_kind kind) |
659 | { | ||
660 | icalproperty_remove_parameter_by_kind(prop, kind); | ||
661 | } | ||
662 | |||
663 | |||
664 | /** @brief Remove all parameters with the specified kind. | ||
665 | * | ||
666 | * @param prop A valid icalproperty. | ||
667 | * @param kind The kind to remove (ex. ICAL_TZID_PARAMETER) | ||
668 | * | ||
669 | * See icalproperty_remove_parameter_by_name() and | ||
670 | * icalproperty_remove_parameter_by_ref() for alternate ways of | ||
671 | * removing parameters | ||
672 | */ | ||
673 | |||
674 | void | ||
675 | icalproperty_remove_parameter_by_kind(icalproperty* prop, icalparameter_kind kind) | ||
545 | { | 676 | { |
546 | pvl_elem p; | 677 | pvl_elem p; |
547 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
548 | 678 | ||
549 | icalerror_check_arg_rv((prop!=0),"prop"); | 679 | icalerror_check_arg_rv((prop!=0),"prop"); |
550 | 680 | ||
551 | for(p=pvl_head(impl->parameters);p != 0; p = pvl_next(p)){ | 681 | for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){ |
552 | icalparameter* param = (icalparameter *)pvl_data (p); | 682 | icalparameter* param = (icalparameter *)pvl_data (p); |
553 | if (icalparameter_isa(param) == kind) { | 683 | if (icalparameter_isa(param) == kind) { |
554 | pvl_remove (impl->parameters, p); | 684 | pvl_remove (prop->parameters, p); |
555 | icalparameter_free (param); | 685 | icalparameter_free(param); |
556 | break; | 686 | break; |
557 | } | 687 | } |
558 | } | 688 | } |
559 | } | 689 | } |
560 | 690 | ||
561 | 691 | ||
562 | int | 692 | /** @brief Remove all parameters with the specified name. |
563 | icalproperty_count_parameters (icalproperty* prop) | 693 | * |
694 | * @param prop A valid icalproperty. | ||
695 | * @param name The name of the parameter to remove | ||
696 | * | ||
697 | * This function removes paramters with the given name. The name | ||
698 | * corresponds to either a built-in name (TZID, etc.) or the name of | ||
699 | * an extended parameter (X-FOO) | ||
700 | * | ||
701 | * See icalproperty_remove_parameter_by_kind() and | ||
702 | * icalproperty_remove_parameter_by_ref() for alternate ways of removing | ||
703 | * parameters | ||
704 | */ | ||
705 | |||
706 | |||
707 | void | ||
708 | icalproperty_remove_parameter_by_name(icalproperty* prop, const char *name) | ||
564 | { | 709 | { |
565 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | 710 | pvl_elem p; |
711 | |||
712 | icalerror_check_arg_rv((prop!=0),"prop"); | ||
713 | |||
714 | for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){ | ||
715 | icalparameter* param = (icalparameter *)pvl_data (p); | ||
716 | const char * kind_string; | ||
717 | |||
718 | if (icalparameter_isa(param) == ICAL_X_PARAMETER) | ||
719 | kind_string = icalparameter_get_xname(param); | ||
720 | else | ||
721 | kind_string = icalparameter_kind_to_string(icalparameter_isa(param)); | ||
722 | |||
723 | if (!kind_string) | ||
724 | continue; | ||
566 | 725 | ||
726 | if (0 == strcmp(kind_string, name)) { | ||
727 | pvl_remove (prop->parameters, p); | ||
728 | break; | ||
729 | } | ||
730 | } | ||
731 | } | ||
732 | |||
733 | |||
734 | /** @brief Remove the specified parameter reference from the property. | ||
735 | * | ||
736 | * @param prop A valid icalproperty. | ||
737 | * @param parameter A reference to a specific icalparameter. | ||
738 | * | ||
739 | * This function removes the specified parameter reference from the | ||
740 | * property. | ||
741 | */ | ||
742 | |||
743 | void | ||
744 | icalproperty_remove_parameter_by_ref(icalproperty* prop, icalparameter* parameter) | ||
745 | { | ||
746 | pvl_elem p; | ||
747 | icalparameter_kind kind; | ||
748 | const char *name; | ||
749 | |||
750 | icalerror_check_arg_rv((prop!=0),"prop"); | ||
751 | icalerror_check_arg_rv((parameter!=0),"parameter"); | ||
752 | |||
753 | kind = icalparameter_isa(parameter); | ||
754 | name = icalparameter_get_xname(parameter); | ||
755 | |||
756 | /* | ||
757 | * FIXME If it's an X- parameter, also compare the names. It would be nice | ||
758 | * to have a better abstraction like icalparameter_equals() | ||
759 | */ | ||
760 | for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){ | ||
761 | icalparameter* p_param = (icalparameter *)pvl_data (p); | ||
762 | if (icalparameter_isa(p_param) == kind && | ||
763 | (kind != ICAL_X_PARAMETER || | ||
764 | !strcmp(icalparameter_get_xname(p_param), name))) { | ||
765 | pvl_remove (prop->parameters, p); | ||
766 | icalparameter_free(p_param); | ||
767 | break; | ||
768 | } | ||
769 | } | ||
770 | } | ||
771 | |||
772 | |||
773 | int | ||
774 | icalproperty_count_parameters (const icalproperty* prop) | ||
775 | { | ||
567 | if(prop != 0){ | 776 | if(prop != 0){ |
568 | return pvl_count(p->parameters); | 777 | return pvl_count(prop->parameters); |
569 | } | 778 | } |
570 | 779 | ||
571 | icalerror_set_errno(ICAL_USAGE_ERROR); | 780 | icalerror_set_errno(ICAL_USAGE_ERROR); |
@@ -574,11 +783,9 @@ icalproperty_count_parameters (icalproperty* prop) | |||
574 | 783 | ||
575 | 784 | ||
576 | icalparameter* | 785 | icalparameter* |
577 | icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind) | 786 | icalproperty_get_first_parameter(icalproperty* p, icalparameter_kind kind) |
578 | { | 787 | { |
579 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | 788 | icalerror_check_arg_rz( (p!=0),"prop"); |
580 | |||
581 | icalerror_check_arg_rz( (prop!=0),"prop"); | ||
582 | 789 | ||
583 | p->parameter_iterator = pvl_head(p->parameters); | 790 | p->parameter_iterator = pvl_head(p->parameters); |
584 | 791 | ||
@@ -602,11 +809,9 @@ icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind) | |||
602 | 809 | ||
603 | 810 | ||
604 | icalparameter* | 811 | icalparameter* |
605 | icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind) | 812 | icalproperty_get_next_parameter (icalproperty* p, icalparameter_kind kind) |
606 | { | 813 | { |
607 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | 814 | icalerror_check_arg_rz( (p!=0),"prop"); |
608 | |||
609 | icalerror_check_arg_rz( (prop!=0),"prop"); | ||
610 | 815 | ||
611 | if (p->parameter_iterator == 0) { | 816 | if (p->parameter_iterator == 0) { |
612 | return 0; | 817 | return 0; |
@@ -628,11 +833,9 @@ icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind) | |||
628 | } | 833 | } |
629 | 834 | ||
630 | void | 835 | void |
631 | icalproperty_set_value (icalproperty* prop, icalvalue* value) | 836 | icalproperty_set_value (icalproperty* p, icalvalue* value) |
632 | { | 837 | { |
633 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | 838 | icalerror_check_arg_rv((p !=0),"prop"); |
634 | |||
635 | icalerror_check_arg_rv((prop !=0),"prop"); | ||
636 | icalerror_check_arg_rv((value !=0),"value"); | 839 | icalerror_check_arg_rv((value !=0),"value"); |
637 | 840 | ||
638 | if (p->value != 0){ | 841 | if (p->value != 0){ |
@@ -643,7 +846,7 @@ icalproperty_set_value (icalproperty* prop, icalvalue* value) | |||
643 | 846 | ||
644 | p->value = value; | 847 | p->value = value; |
645 | 848 | ||
646 | icalvalue_set_parent(value,prop); | 849 | icalvalue_set_parent(value,p); |
647 | } | 850 | } |
648 | 851 | ||
649 | 852 | ||
@@ -691,24 +894,20 @@ void icalproperty_set_value_from_string(icalproperty* prop,const char* str, | |||
691 | } | 894 | } |
692 | 895 | ||
693 | icalvalue* | 896 | icalvalue* |
694 | icalproperty_get_value (icalproperty* prop) | 897 | icalproperty_get_value(const icalproperty* prop) |
695 | { | 898 | { |
696 | struct icalproperty_impl *p = (struct icalproperty_impl*)prop; | ||
697 | |||
698 | icalerror_check_arg_rz( (prop!=0),"prop"); | 899 | icalerror_check_arg_rz( (prop!=0),"prop"); |
699 | 900 | ||
700 | return p->value; | 901 | return prop->value; |
701 | } | 902 | } |
702 | 903 | ||
703 | const char* icalproperty_get_value_as_string(icalproperty* prop) | 904 | const char* icalproperty_get_value_as_string(const icalproperty* prop) |
704 | { | 905 | { |
705 | icalvalue *value; | 906 | icalvalue *value; |
706 | 907 | ||
707 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
708 | |||
709 | icalerror_check_arg_rz( (prop!=0),"prop"); | 908 | icalerror_check_arg_rz( (prop!=0),"prop"); |
710 | 909 | ||
711 | value = impl->value; | 910 | value = prop->value; |
712 | 911 | ||
713 | return icalvalue_as_ical_string(value); | 912 | return icalvalue_as_ical_string(value); |
714 | } | 913 | } |
@@ -716,35 +915,37 @@ const char* icalproperty_get_value_as_string(icalproperty* prop) | |||
716 | 915 | ||
717 | void icalproperty_set_x_name(icalproperty* prop, const char* name) | 916 | void icalproperty_set_x_name(icalproperty* prop, const char* name) |
718 | { | 917 | { |
719 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
720 | |||
721 | icalerror_check_arg_rv( (name!=0),"name"); | 918 | icalerror_check_arg_rv( (name!=0),"name"); |
722 | icalerror_check_arg_rv( (prop!=0),"prop"); | 919 | icalerror_check_arg_rv( (prop!=0),"prop"); |
723 | 920 | ||
724 | if (impl->x_name != 0) { | 921 | if (prop->x_name != 0) { |
725 | free(impl->x_name); | 922 | free(prop->x_name); |
726 | } | 923 | } |
727 | 924 | ||
728 | impl->x_name = icalmemory_strdup(name); | 925 | prop->x_name = icalmemory_strdup(name); |
729 | 926 | ||
730 | if(impl->x_name == 0){ | 927 | if(prop->x_name == 0){ |
731 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 928 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); |
732 | } | 929 | } |
733 | 930 | ||
734 | } | 931 | } |
735 | 932 | ||
736 | const char* icalproperty_get_x_name(icalproperty* prop){ | 933 | const char* icalproperty_get_x_name(icalproperty* prop){ |
737 | |||
738 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
739 | |||
740 | icalerror_check_arg_rz( (prop!=0),"prop"); | 934 | icalerror_check_arg_rz( (prop!=0),"prop"); |
741 | 935 | ||
742 | return impl->x_name; | 936 | return prop->x_name; |
743 | } | 937 | } |
744 | 938 | ||
745 | 939 | ||
746 | /* From Jonathan Yue <jonathan.yue@cp.net> */ | 940 | const char* icalproperty_get_name(const icalproperty* prop) |
747 | const char* icalproperty_get_name (icalproperty* prop) | 941 | { |
942 | #ifndef NO_WARN_DEPRECATED | ||
943 | icalerror_warn("icalproperty_get_name() is DEPRECATED, please use icalproperty_get_property_name() instead."); | ||
944 | #endif | ||
945 | return icalproperty_get_property_name(prop); | ||
946 | } | ||
947 | |||
948 | const char* icalproperty_get_property_name(const icalproperty* prop) | ||
748 | { | 949 | { |
749 | 950 | ||
750 | const char* property_name = 0; | 951 | const char* property_name = 0; |
@@ -752,14 +953,12 @@ const char* icalproperty_get_name (icalproperty* prop) | |||
752 | char* buf = icalmemory_new_buffer(buf_size); | 953 | char* buf = icalmemory_new_buffer(buf_size); |
753 | char* buf_ptr = buf; | 954 | char* buf_ptr = buf; |
754 | 955 | ||
755 | struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; | ||
756 | |||
757 | icalerror_check_arg_rz( (prop!=0),"prop"); | 956 | icalerror_check_arg_rz( (prop!=0),"prop"); |
758 | 957 | ||
759 | if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){ | 958 | if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){ |
760 | property_name = impl->x_name; | 959 | property_name = prop->x_name; |
761 | } else { | 960 | } else { |
762 | property_name = icalproperty_kind_to_string(impl->kind); | 961 | property_name = icalproperty_kind_to_string(prop->kind); |
763 | } | 962 | } |
764 | 963 | ||
765 | if (property_name == 0 ) { | 964 | if (property_name == 0 ) { |
@@ -785,26 +984,14 @@ const char* icalproperty_get_name (icalproperty* prop) | |||
785 | void icalproperty_set_parent(icalproperty* property, | 984 | void icalproperty_set_parent(icalproperty* property, |
786 | icalcomponent* component) | 985 | icalcomponent* component) |
787 | { | 986 | { |
788 | struct icalproperty_impl *impl = (struct icalproperty_impl*)property; | ||
789 | |||
790 | icalerror_check_arg_rv( (property!=0),"property"); | 987 | icalerror_check_arg_rv( (property!=0),"property"); |
791 | 988 | ||
792 | impl->parent = component; | 989 | property->parent = component; |
793 | } | 990 | } |
794 | 991 | ||
795 | icalcomponent* icalproperty_get_parent(icalproperty* property) | 992 | icalcomponent* icalproperty_get_parent(const icalproperty* property) |
796 | { | 993 | { |
797 | struct icalproperty_impl *impl = (struct icalproperty_impl*)property; | ||
798 | |||
799 | icalerror_check_arg_rz( (property!=0),"property"); | 994 | icalerror_check_arg_rz( (property!=0),"property"); |
800 | 995 | ||
801 | return impl->parent; | 996 | return property->parent; |
802 | } | 997 | } |
803 | |||
804 | |||
805 | |||
806 | |||
807 | |||
808 | |||
809 | |||
810 | /* 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 | |||
@@ -31,11 +31,7 @@ | |||
31 | #define ICALPROPERTY_H | 31 | #define ICALPROPERTY_H |
32 | 32 | ||
33 | #include <time.h> | 33 | #include <time.h> |
34 | 34 | #include <stdarg.h> /* for va_... */ | |
35 | #ifdef _WIN32 | ||
36 | #include <stdio.h> /* for printf */ | ||
37 | #include <stdarg.h> /* for va_list, va_start, etc. */ | ||
38 | #endif | ||
39 | 35 | ||
40 | #include "icalderivedparameter.h" | 36 | #include "icalderivedparameter.h" |
41 | 37 | ||
@@ -43,12 +39,10 @@ | |||
43 | #include "icalrecur.h" | 39 | #include "icalrecur.h" |
44 | 40 | ||
45 | /* Actually in icalderivedproperty.h: | 41 | /* Actually in icalderivedproperty.h: |
46 | typedef void icalproperty; */ | 42 | typedef struct icalproperty_impl icalproperty; */ |
47 | 43 | ||
48 | #include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */ | 44 | #include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */ |
49 | 45 | ||
50 | // void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); | ||
51 | |||
52 | icalproperty* icalproperty_new(icalproperty_kind kind); | 46 | icalproperty* icalproperty_new(icalproperty_kind kind); |
53 | 47 | ||
54 | icalproperty* icalproperty_new_clone(icalproperty * prop); | 48 | icalproperty* icalproperty_new_clone(icalproperty * prop); |
@@ -62,6 +56,7 @@ void icalproperty_free(icalproperty* prop); | |||
62 | icalproperty_kind icalproperty_isa(icalproperty* property); | 56 | icalproperty_kind icalproperty_isa(icalproperty* property); |
63 | int icalproperty_isa_property(void* property); | 57 | int icalproperty_isa_property(void* property); |
64 | 58 | ||
59 | void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); | ||
65 | void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter); | 60 | void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter); |
66 | void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter); | 61 | void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter); |
67 | void icalproperty_set_parameter_from_string(icalproperty* prop, | 62 | void icalproperty_set_parameter_from_string(icalproperty* prop, |
@@ -72,7 +67,18 @@ const char* icalproperty_get_parameter_as_string(icalproperty* prop, | |||
72 | void icalproperty_remove_parameter(icalproperty* prop, | 67 | void icalproperty_remove_parameter(icalproperty* prop, |
73 | icalparameter_kind kind); | 68 | icalparameter_kind kind); |
74 | 69 | ||
75 | int icalproperty_count_parameters(icalproperty* prop); | 70 | void icalproperty_remove_parameter_by_kind(icalproperty* prop, |
71 | icalparameter_kind kind); | ||
72 | |||
73 | void icalproperty_remove_parameter_by_name(icalproperty* prop, | ||
74 | const char *name); | ||
75 | |||
76 | void icalproperty_remove_parameter_by_ref(icalproperty* prop, | ||
77 | icalparameter *param); | ||
78 | |||
79 | |||
80 | |||
81 | int icalproperty_count_parameters(const icalproperty* prop); | ||
76 | 82 | ||
77 | /* Iterate through the parameters */ | 83 | /* Iterate through the parameters */ |
78 | icalparameter* icalproperty_get_first_parameter(icalproperty* prop, | 84 | icalparameter* icalproperty_get_first_parameter(icalproperty* prop, |
@@ -83,33 +89,39 @@ icalparameter* icalproperty_get_next_parameter(icalproperty* prop, | |||
83 | void icalproperty_set_value(icalproperty* prop, icalvalue* value); | 89 | void icalproperty_set_value(icalproperty* prop, icalvalue* value); |
84 | void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind); | 90 | void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind); |
85 | 91 | ||
86 | icalvalue* icalproperty_get_value(icalproperty* prop); | 92 | icalvalue* icalproperty_get_value(const icalproperty* prop); |
87 | const char* icalproperty_get_value_as_string(icalproperty* prop); | 93 | const char* icalproperty_get_value_as_string(const icalproperty* prop); |
88 | 94 | ||
89 | /* Deal with X properties */ | 95 | /* Deal with X properties */ |
90 | 96 | ||
91 | void icalproperty_set_x_name(icalproperty* prop, const char* name); | 97 | void icalproperty_set_x_name(icalproperty* prop, const char* name); |
92 | const char* icalproperty_get_x_name(icalproperty* prop); | 98 | const char* icalproperty_get_x_name(icalproperty* prop); |
93 | 99 | ||
94 | /* Return the name of the property -- the type name converted to a | 100 | /** Return the name of the property -- the type name converted to a |
95 | string, or the value of _get_x_name if the type is and X property */ | 101 | * string, or the value of _get_x_name if the type is and X |
96 | const char* icalproperty_get_name (icalproperty* prop); | 102 | * property |
103 | */ | ||
104 | const char* icalproperty_get_property_name (const icalproperty* prop); | ||
97 | 105 | ||
98 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value); | 106 | icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value); |
99 | 107 | ||
100 | /* Convert kinds to string and get default value type */ | 108 | /* Convert kinds to string and get default value type */ |
101 | 109 | ||
102 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind); | 110 | icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind); |
103 | icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind); | 111 | icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind); |
104 | const char* icalproperty_kind_to_string(icalproperty_kind kind); | 112 | const char* icalproperty_kind_to_string(icalproperty_kind kind); |
105 | icalproperty_kind icalproperty_string_to_kind(const char* string); | 113 | icalproperty_kind icalproperty_string_to_kind(const char* string); |
106 | 114 | ||
115 | /** Check validity of a specific icalproperty_kind **/ | ||
116 | int icalproperty_kind_is_valid(const icalproperty_kind kind); | ||
117 | |||
107 | icalproperty_method icalproperty_string_to_method(const char* str); | 118 | icalproperty_method icalproperty_string_to_method(const char* str); |
108 | const char* icalproperty_method_to_string(icalproperty_method method); | 119 | const char* icalproperty_method_to_string(icalproperty_method method); |
109 | 120 | ||
110 | 121 | ||
111 | const char* icalproperty_enum_to_string(int e); | 122 | const char* icalproperty_enum_to_string(int e); |
112 | int icalproperty_string_to_enum(const char* str); | 123 | int icalproperty_string_to_enum(const char* str); |
124 | int icalproperty_kind_and_string_to_enum(const int kind, const char* str); | ||
113 | 125 | ||
114 | const char* icalproperty_status_to_string(icalproperty_status); | 126 | const char* icalproperty_status_to_string(icalproperty_status); |
115 | icalproperty_status icalproperty_string_to_status(const char* string); | 127 | icalproperty_status icalproperty_string_to_status(const char* string); |
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 | |||
@@ -19,7 +19,11 @@ | |||
19 | 19 | ||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | 20 | The Mozilla Public License Version 1.0. You may obtain a copy of |
21 | the License at http://www.mozilla.org/MPL/ | 21 | the License at http://www.mozilla.org/MPL/ |
22 | */ | ||
22 | 23 | ||
24 | /** | ||
25 | @file icalrecur.c | ||
26 | @brief Implementation of routines for dealing with recurring time | ||
23 | 27 | ||
24 | How this code works: | 28 | How this code works: |
25 | 29 | ||
@@ -130,15 +134,14 @@ | |||
130 | #include "config.h" | 134 | #include "config.h" |
131 | #endif | 135 | #endif |
132 | 136 | ||
137 | #ifdef HAVE_STDINT_H | ||
138 | #include <stdint.h> | ||
139 | #endif | ||
140 | |||
133 | #include "icalrecur.h" | 141 | #include "icalrecur.h" |
134 | 142 | ||
135 | #ifdef ICAL_NO_LIBICAL | ||
136 | #define icalerror_set_errno(x) | ||
137 | #define icalerror_check_arg_rv(x,y) | ||
138 | #else | ||
139 | #include "icalerror.h" | 143 | #include "icalerror.h" |
140 | #include "icalmemory.h" | 144 | #include "icalmemory.h" |
141 | #endif | ||
142 | 145 | ||
143 | #include <stdlib.h> /* for malloc */ | 146 | #include <stdlib.h> /* for malloc */ |
144 | #include <errno.h> /* for errno */ | 147 | #include <errno.h> /* for errno */ |
@@ -148,6 +151,10 @@ | |||
148 | 151 | ||
149 | #include "pvl.h" | 152 | #include "pvl.h" |
150 | 153 | ||
154 | /** This is the last year we will go up to, since 32-bit time_t values | ||
155 | only go up to the start of 2038. */ | ||
156 | #define MAX_TIME_T_YEAR2037 | ||
157 | |||
151 | #define TEMP_MAX 1024 | 158 | #define TEMP_MAX 1024 |
152 | 159 | ||
153 | 160 | ||
@@ -170,7 +177,6 @@ const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind); | |||
170 | icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); | 177 | icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); |
171 | 178 | ||
172 | 179 | ||
173 | |||
174 | /*********************** Rule parsing routines ************************/ | 180 | /*********************** Rule parsing routines ************************/ |
175 | 181 | ||
176 | struct icalrecur_parser { | 182 | struct icalrecur_parser { |
@@ -253,7 +259,7 @@ void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array, | |||
253 | char *t, *n; | 259 | char *t, *n; |
254 | int i=0; | 260 | int i=0; |
255 | int sign = 1; | 261 | int sign = 1; |
256 | short v; | 262 | int v; |
257 | 263 | ||
258 | n = vals; | 264 | n = vals; |
259 | 265 | ||
@@ -280,12 +286,14 @@ void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array, | |||
280 | } else if (*t == '+'){ | 286 | } else if (*t == '+'){ |
281 | sign = 1; | 287 | sign = 1; |
282 | t++; | 288 | t++; |
289 | } else { | ||
290 | sign = 1; | ||
283 | } | 291 | } |
284 | 292 | ||
285 | v = atoi(t) * sign ; | 293 | v = atoi(t) * sign ; |
286 | 294 | ||
287 | 295 | ||
288 | array[i++] = v; | 296 | array[i++] = (short)v; |
289 | array[i] = ICAL_RECURRENCE_ARRAY_MAX; | 297 | array[i] = ICAL_RECURRENCE_ARRAY_MAX; |
290 | 298 | ||
291 | } | 299 | } |
@@ -332,21 +340,18 @@ void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals) | |||
332 | sign = 1; | 340 | sign = 1; |
333 | } | 341 | } |
334 | 342 | ||
335 | weekno = 0; | ||
336 | /* Get Optional weekno */ | 343 | /* Get Optional weekno */ |
337 | if( sscanf(t,"%d",&weekno) != 0){ | 344 | weekno = strtol(t,&t,10); |
338 | if (n != 0){ | 345 | |
339 | int weeknolen = (n-t)-3; /* 3 -> one for \0, 2 for day name */ | 346 | /* Outlook/Exchange generate "BYDAY=MO, FR" and "BYDAY=2 TH". |
340 | /* could use abs(log10(weekno))+1, but that needs libm */ | 347 | * Cope with that. |
341 | t += weeknolen; | 348 | */ |
342 | } else { | 349 | if (*t == ' ') |
343 | t = end -2; | 350 | t++; |
344 | } | ||
345 | } | ||
346 | 351 | ||
347 | wd = icalrecur_string_to_weekday(t); | 352 | wd = icalrecur_string_to_weekday(t); |
348 | 353 | ||
349 | array[i++] = sign* ((int)wd + 8*weekno); | 354 | array[i++] = (short)(sign* (wd + 8*weekno)); |
350 | array[i] = ICAL_RECURRENCE_ARRAY_MAX; | 355 | array[i] = ICAL_RECURRENCE_ARRAY_MAX; |
351 | 356 | ||
352 | } | 357 | } |
@@ -387,6 +392,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) | |||
387 | if(name == 0){ | 392 | if(name == 0){ |
388 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 393 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
389 | icalrecurrencetype_clear(&parser.rt); | 394 | icalrecurrencetype_clear(&parser.rt); |
395 | free(parser.copy); | ||
390 | return parser.rt; | 396 | return parser.rt; |
391 | } | 397 | } |
392 | 398 | ||
@@ -397,7 +403,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) | |||
397 | } else if (strcmp(name,"UNTIL") == 0){ | 403 | } else if (strcmp(name,"UNTIL") == 0){ |
398 | parser.rt.until = icaltime_from_string(value); | 404 | parser.rt.until = icaltime_from_string(value); |
399 | } else if (strcmp(name,"INTERVAL") == 0){ | 405 | } else if (strcmp(name,"INTERVAL") == 0){ |
400 | parser.rt.interval = atoi(value); | 406 | parser.rt.interval = (short)atoi(value); |
401 | } else if (strcmp(name,"WKST") == 0){ | 407 | } else if (strcmp(name,"WKST") == 0){ |
402 | parser.rt.week_start = icalrecur_string_to_weekday(value); | 408 | parser.rt.week_start = icalrecur_string_to_weekday(value); |
403 | } else if (strcmp(name,"BYSECOND") == 0){ | 409 | } else if (strcmp(name,"BYSECOND") == 0){ |
@@ -429,6 +435,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) | |||
429 | } else { | 435 | } else { |
430 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 436 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
431 | icalrecurrencetype_clear(&parser.rt); | 437 | icalrecurrencetype_clear(&parser.rt); |
438 | free(parser.copy); | ||
432 | return parser.rt; | 439 | return parser.rt; |
433 | } | 440 | } |
434 | 441 | ||
@@ -440,9 +447,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str) | |||
440 | 447 | ||
441 | } | 448 | } |
442 | 449 | ||
443 | #ifndef ICAL_NO_LIBICAL | 450 | static struct { char* str;size_t offset; int limit; } recurmap[] = |
444 | |||
445 | struct { char* str;size_t offset; short limit; } recurmap[] = | ||
446 | { | 451 | { |
447 | {";BYSECOND=",offsetof(struct icalrecurrencetype,by_second),60}, | 452 | {";BYSECOND=",offsetof(struct icalrecurrencetype,by_second),60}, |
448 | {";BYMINUTE=",offsetof(struct icalrecurrencetype,by_minute),60}, | 453 | {";BYMINUTE=",offsetof(struct icalrecurrencetype,by_minute),60}, |
@@ -457,6 +462,7 @@ struct { char* str;size_t offset; short limit; } recurmap[] = | |||
457 | }; | 462 | }; |
458 | 463 | ||
459 | /* A private routine in icalvalue.c */ | 464 | /* A private routine in icalvalue.c */ |
465 | void print_date_to_string(char* str, struct icaltimetype *data); | ||
460 | void print_datetime_to_string(char* str, struct icaltimetype *data); | 466 | void print_datetime_to_string(char* str, struct icaltimetype *data); |
461 | 467 | ||
462 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) | 468 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) |
@@ -481,7 +487,10 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) | |||
481 | if(recur->until.year != 0){ | 487 | if(recur->until.year != 0){ |
482 | 488 | ||
483 | temp[0] = 0; | 489 | temp[0] = 0; |
484 | print_datetime_to_string(temp,&(recur->until)); | 490 | if (recur->until.is_date) |
491 | print_date_to_string(temp,&(recur->until)); | ||
492 | else | ||
493 | print_datetime_to_string(temp,&(recur->until)); | ||
485 | 494 | ||
486 | icalmemory_append_string(&str,&str_p,&buf_sz,";UNTIL="); | 495 | icalmemory_append_string(&str,&str_p,&buf_sz,";UNTIL="); |
487 | icalmemory_append_string(&str,&str_p,&buf_sz, temp); | 496 | icalmemory_append_string(&str,&str_p,&buf_sz, temp); |
@@ -501,7 +510,7 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) | |||
501 | 510 | ||
502 | for(j =0; recurmap[j].str != 0; j++){ | 511 | for(j =0; recurmap[j].str != 0; j++){ |
503 | short* array = (short*)(recurmap[j].offset+ (size_t)recur); | 512 | short* array = (short*)(recurmap[j].offset+ (size_t)recur); |
504 | short limit = recurmap[j].limit; | 513 | int limit = recurmap[j].limit; |
505 | 514 | ||
506 | /* Skip unused arrays */ | 515 | /* Skip unused arrays */ |
507 | if( array[0] != ICAL_RECURRENCE_ARRAY_MAX ) { | 516 | if( array[0] != ICAL_RECURRENCE_ARRAY_MAX ) { |
@@ -512,9 +521,9 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) | |||
512 | i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; | 521 | i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; |
513 | i++){ | 522 | i++){ |
514 | if (j == 3) { /* BYDAY */ | 523 | if (j == 3) { /* BYDAY */ |
515 | short dow = icalrecurrencetype_day_day_of_week(array[i]); | 524 | const char *daystr = icalrecur_weekday_to_string( |
516 | const char *daystr = icalrecur_weekday_to_string(dow); | 525 | icalrecurrencetype_day_day_of_week(array[i])); |
517 | short pos; | 526 | int pos; |
518 | 527 | ||
519 | pos = icalrecurrencetype_day_position(array[i]); | 528 | pos = icalrecurrencetype_day_position(array[i]); |
520 | 529 | ||
@@ -540,8 +549,6 @@ char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur) | |||
540 | 549 | ||
541 | return str; | 550 | return str; |
542 | } | 551 | } |
543 | #endif | ||
544 | |||
545 | 552 | ||
546 | 553 | ||
547 | /************************* occurrence iteration routiens ******************/ | 554 | /************************* occurrence iteration routiens ******************/ |
@@ -573,13 +580,15 @@ struct icalrecur_iterator_impl { | |||
573 | 580 | ||
574 | enum byrule byrule; | 581 | enum byrule byrule; |
575 | short by_indices[9]; | 582 | short by_indices[9]; |
576 | short orig_data[9]; /* 1 if there was data in the byrule */ | 583 | short orig_data[9]; /**< 1 if there was data in the byrule */ |
577 | 584 | ||
578 | 585 | ||
579 | short *by_ptrs[9]; /* Pointers into the by_* array elements of the rule */ | 586 | short *by_ptrs[9]; /**< Pointers into the by_* array elements of the rule */ |
580 | 587 | ||
581 | }; | 588 | }; |
582 | 589 | ||
590 | static void increment_year(icalrecur_iterator* impl, int inc); | ||
591 | |||
583 | int icalrecur_iterator_sizeof_byarray(short* byarray) | 592 | int icalrecur_iterator_sizeof_byarray(short* byarray) |
584 | { | 593 | { |
585 | int array_itr; | 594 | int array_itr; |
@@ -599,10 +608,13 @@ enum expand_table { | |||
599 | ILLEGAL=3 | 608 | ILLEGAL=3 |
600 | }; | 609 | }; |
601 | 610 | ||
602 | /* The split map indicates, for a particular interval, wether a BY_* | 611 | /** |
603 | rule part expands the number of instances in the occcurrence set or | 612 | * The split map indicates, for a particular interval, wether a BY_* |
604 | contracts it. 1=> contract, 2=>expand, and 3 means the pairing is | 613 | * rule part expands the number of instances in the occcurrence set or |
605 | not allowed. */ | 614 | * contracts it. 1=> contract, 2=>expand, and 3 means the pairing is |
615 | * not allowed. | ||
616 | */ | ||
617 | |||
606 | struct expand_split_map_struct | 618 | struct expand_split_map_struct |
607 | { | 619 | { |
608 | icalrecurrencetype_frequency frequency; | 620 | icalrecurrencetype_frequency frequency; |
@@ -613,7 +625,7 @@ struct expand_split_map_struct | |||
613 | short map[8]; | 625 | short map[8]; |
614 | }; | 626 | }; |
615 | 627 | ||
616 | struct expand_split_map_struct expand_map[] = | 628 | static struct expand_split_map_struct expand_map[] = |
617 | { | 629 | { |
618 | {ICAL_SECONDLY_RECURRENCE,{1,1,1,1,1,1,1,1}}, | 630 | {ICAL_SECONDLY_RECURRENCE,{1,1,1,1,1,1,1,1}}, |
619 | {ICAL_MINUTELY_RECURRENCE,{2,1,1,1,1,1,1,1}}, | 631 | {ICAL_MINUTELY_RECURRENCE,{2,1,1,1,1,1,1,1}}, |
@@ -628,15 +640,16 @@ struct expand_split_map_struct expand_map[] = | |||
628 | 640 | ||
629 | 641 | ||
630 | 642 | ||
631 | /* Check that the rule has only the two given interday byrule parts. */ | 643 | /** Check that the rule has only the two given interday byrule parts. */ |
632 | int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl, | 644 | static |
645 | int icalrecur_two_byrule(icalrecur_iterator* impl, | ||
633 | enum byrule one,enum byrule two) | 646 | enum byrule one,enum byrule two) |
634 | { | 647 | { |
635 | short test_array[9]; | 648 | short test_array[9]; |
636 | enum byrule itr; | 649 | enum byrule itr; |
637 | int passes = 0; | 650 | int passes = 0; |
638 | 651 | ||
639 | memset(test_array,0,9); | 652 | memset(test_array,0,sizeof(test_array)); |
640 | 653 | ||
641 | test_array[one] = 1; | 654 | test_array[one] = 1; |
642 | test_array[two] = 1; | 655 | test_array[two] = 1; |
@@ -659,8 +672,8 @@ int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl, | |||
659 | 672 | ||
660 | } | 673 | } |
661 | 674 | ||
662 | /* Check that the rule has only the one given interdat byrule parts. */ | 675 | /** Check that the rule has only the one given interdat byrule parts. */ |
663 | int icalrecur_one_byrule(struct icalrecur_iterator_impl* impl,enum byrule one) | 676 | static int icalrecur_one_byrule(icalrecur_iterator* impl,enum byrule one) |
664 | { | 677 | { |
665 | int passes = 1; | 678 | int passes = 1; |
666 | enum byrule itr; | 679 | enum byrule itr; |
@@ -676,7 +689,7 @@ int icalrecur_one_byrule(struct icalrecur_iterator_impl* impl,enum byrule one) | |||
676 | return passes; | 689 | return passes; |
677 | } | 690 | } |
678 | 691 | ||
679 | int count_byrules(struct icalrecur_iterator_impl* impl) | 692 | static int count_byrules(icalrecur_iterator* impl) |
680 | { | 693 | { |
681 | int count = 0; | 694 | int count = 0; |
682 | enum byrule itr; | 695 | enum byrule itr; |
@@ -691,9 +704,9 @@ int count_byrules(struct icalrecur_iterator_impl* impl) | |||
691 | } | 704 | } |
692 | 705 | ||
693 | 706 | ||
694 | void setup_defaults(struct icalrecur_iterator_impl* impl, | 707 | static void setup_defaults(icalrecur_iterator* impl, |
695 | enum byrule byrule, icalrecurrencetype_frequency req, | 708 | enum byrule byrule, icalrecurrencetype_frequency req, |
696 | short deftime, int *timepart) | 709 | int deftime, int *timepart) |
697 | { | 710 | { |
698 | 711 | ||
699 | icalrecurrencetype_frequency freq; | 712 | icalrecurrencetype_frequency freq; |
@@ -704,7 +717,7 @@ void setup_defaults(struct icalrecur_iterator_impl* impl, | |||
704 | 717 | ||
705 | if(impl->by_ptrs[byrule][0] == ICAL_RECURRENCE_ARRAY_MAX && | 718 | if(impl->by_ptrs[byrule][0] == ICAL_RECURRENCE_ARRAY_MAX && |
706 | expand_map[freq].map[byrule] != CONTRACT){ | 719 | expand_map[freq].map[byrule] != CONTRACT){ |
707 | impl->by_ptrs[byrule][0] = deftime; | 720 | impl->by_ptrs[byrule][0] = (short)deftime; |
708 | } | 721 | } |
709 | 722 | ||
710 | /* Initialize the first occurence */ | 723 | /* Initialize the first occurence */ |
@@ -715,30 +728,28 @@ void setup_defaults(struct icalrecur_iterator_impl* impl, | |||
715 | 728 | ||
716 | } | 729 | } |
717 | 730 | ||
718 | int has_by_data(struct icalrecur_iterator_impl* impl, enum byrule byrule){ | 731 | static int has_by_data(icalrecur_iterator* impl, enum byrule byrule){ |
719 | 732 | ||
720 | return (impl->orig_data[byrule] == 1); | 733 | return (impl->orig_data[byrule] == 1); |
721 | } | 734 | } |
722 | 735 | ||
723 | 736 | ||
724 | int expand_year_days(struct icalrecur_iterator_impl* impl,short year); | 737 | static int expand_year_days(icalrecur_iterator* impl, int year); |
725 | 738 | ||
726 | 739 | ||
727 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | 740 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, |
728 | struct icaltimetype dtstart) | 741 | struct icaltimetype dtstart) |
729 | { | 742 | { |
730 | struct icalrecur_iterator_impl* impl; | 743 | icalrecur_iterator* impl; |
731 | icalrecurrencetype_frequency freq; | 744 | icalrecurrencetype_frequency freq; |
732 | 745 | ||
733 | short days_in_month; | 746 | if ( ( impl = (icalrecur_iterator*) |
734 | 747 | malloc(sizeof(icalrecur_iterator))) == 0) { | |
735 | if ( ( impl = (struct icalrecur_iterator_impl *) | ||
736 | malloc(sizeof(struct icalrecur_iterator_impl))) == 0) { | ||
737 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 748 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); |
738 | return 0; | 749 | return 0; |
739 | } | 750 | } |
740 | 751 | ||
741 | memset(impl,0,sizeof(struct icalrecur_iterator_impl)); | 752 | memset(impl,0,sizeof(icalrecur_iterator)); |
742 | 753 | ||
743 | impl->rule = rule; | 754 | impl->rule = rule; |
744 | impl->last = dtstart; | 755 | impl->last = dtstart; |
@@ -760,7 +771,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
760 | impl->by_ptrs[BY_SECOND]=impl->rule.by_second; | 771 | impl->by_ptrs[BY_SECOND]=impl->rule.by_second; |
761 | impl->by_ptrs[BY_SET_POS]=impl->rule.by_set_pos; | 772 | impl->by_ptrs[BY_SET_POS]=impl->rule.by_set_pos; |
762 | 773 | ||
763 | memset(impl->orig_data,0,9); | 774 | memset(impl->orig_data,0,9*sizeof(short)); |
764 | 775 | ||
765 | /* Note which by rules had data in them when the iterator was | 776 | /* Note which by rules had data in them when the iterator was |
766 | created. We can't use the actuall by_x arrays, because the | 777 | created. We can't use the actuall by_x arrays, because the |
@@ -768,23 +779,23 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
768 | routine. The orig_data array will be used later in has_by_data */ | 779 | routine. The orig_data array will be used later in has_by_data */ |
769 | 780 | ||
770 | impl->orig_data[BY_MONTH] | 781 | impl->orig_data[BY_MONTH] |
771 | = (impl->rule.by_month[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 782 | = (short)(impl->rule.by_month[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
772 | impl->orig_data[BY_WEEK_NO] | 783 | impl->orig_data[BY_WEEK_NO] |
773 | =(impl->rule.by_week_no[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 784 | =(short)(impl->rule.by_week_no[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
774 | impl->orig_data[BY_YEAR_DAY] | 785 | impl->orig_data[BY_YEAR_DAY] |
775 | =(impl->rule.by_year_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 786 | =(short)(impl->rule.by_year_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
776 | impl->orig_data[BY_MONTH_DAY] | 787 | impl->orig_data[BY_MONTH_DAY] |
777 | =(impl->rule.by_month_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 788 | =(short)(impl->rule.by_month_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
778 | impl->orig_data[BY_DAY] | 789 | impl->orig_data[BY_DAY] |
779 | = (impl->rule.by_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 790 | = (short)(impl->rule.by_day[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
780 | impl->orig_data[BY_HOUR] | 791 | impl->orig_data[BY_HOUR] |
781 | = (impl->rule.by_hour[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 792 | = (short)(impl->rule.by_hour[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
782 | impl->orig_data[BY_MINUTE] | 793 | impl->orig_data[BY_MINUTE] |
783 | = (impl->rule.by_minute[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 794 | = (short)(impl->rule.by_minute[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
784 | impl->orig_data[BY_SECOND] | 795 | impl->orig_data[BY_SECOND] |
785 | = (impl->rule.by_second[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 796 | = (short)(impl->rule.by_second[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
786 | impl->orig_data[BY_SET_POS] | 797 | impl->orig_data[BY_SET_POS] |
787 | = (impl->rule.by_set_pos[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 798 | = (short)(impl->rule.by_set_pos[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
788 | 799 | ||
789 | 800 | ||
790 | /* Check if the recurrence rule is legal */ | 801 | /* Check if the recurrence rule is legal */ |
@@ -852,19 +863,24 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
852 | BY_* array is empty */ | 863 | BY_* array is empty */ |
853 | 864 | ||
854 | 865 | ||
855 | setup_defaults(impl,BY_SECOND,ICAL_SECONDLY_RECURRENCE,impl->dtstart.second, | 866 | setup_defaults(impl,BY_SECOND,ICAL_SECONDLY_RECURRENCE, |
867 | impl->dtstart.second, | ||
856 | &(impl->last.second)); | 868 | &(impl->last.second)); |
857 | 869 | ||
858 | setup_defaults(impl,BY_MINUTE,ICAL_MINUTELY_RECURRENCE,impl->dtstart.minute, | 870 | setup_defaults(impl,BY_MINUTE,ICAL_MINUTELY_RECURRENCE, |
871 | impl->dtstart.minute, | ||
859 | &(impl->last.minute)); | 872 | &(impl->last.minute)); |
860 | 873 | ||
861 | setup_defaults(impl,BY_HOUR,ICAL_HOURLY_RECURRENCE,impl->dtstart.hour, | 874 | setup_defaults(impl,BY_HOUR,ICAL_HOURLY_RECURRENCE, |
875 | impl->dtstart.hour, | ||
862 | &(impl->last.hour)); | 876 | &(impl->last.hour)); |
863 | 877 | ||
864 | setup_defaults(impl,BY_MONTH_DAY,ICAL_DAILY_RECURRENCE,impl->dtstart.day, | 878 | setup_defaults(impl,BY_MONTH_DAY,ICAL_DAILY_RECURRENCE, |
879 | impl->dtstart.day, | ||
865 | &(impl->last.day)); | 880 | &(impl->last.day)); |
866 | 881 | ||
867 | setup_defaults(impl,BY_MONTH,ICAL_MONTHLY_RECURRENCE,impl->dtstart.month, | 882 | setup_defaults(impl,BY_MONTH,ICAL_MONTHLY_RECURRENCE, |
883 | impl->dtstart.month, | ||
868 | &(impl->last.month)); | 884 | &(impl->last.month)); |
869 | 885 | ||
870 | 886 | ||
@@ -874,7 +890,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
874 | 890 | ||
875 | /* Weekly recurrences with no BY_DAY data should occur on the | 891 | /* Weekly recurrences with no BY_DAY data should occur on the |
876 | same day of the week as the start time . */ | 892 | same day of the week as the start time . */ |
877 | impl->by_ptrs[BY_DAY][0] = icaltime_day_of_week(impl->dtstart); | 893 | impl->by_ptrs[BY_DAY][0] = (short)icaltime_day_of_week(impl->dtstart); |
878 | 894 | ||
879 | } else { | 895 | } else { |
880 | /* If there is BY_DAY data, then we need to move the initial | 896 | /* If there is BY_DAY data, then we need to move the initial |
@@ -888,7 +904,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
888 | /* This is probably a HACK. There should be some more | 904 | /* This is probably a HACK. There should be some more |
889 | general way to solve this problem */ | 905 | general way to solve this problem */ |
890 | 906 | ||
891 | short dow = impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last); | 907 | short dow = (short)(impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last)); |
892 | 908 | ||
893 | if(dow < 0) { | 909 | if(dow < 0) { |
894 | /* initial time is after first day of BY_DAY data */ | 910 | /* initial time is after first day of BY_DAY data */ |
@@ -901,10 +917,24 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
901 | 917 | ||
902 | } | 918 | } |
903 | 919 | ||
904 | /* For YEARLY rule, begin by setting up the year days array */ | 920 | /* For YEARLY rule, begin by setting up the year days array . The |
921 | YEARLY rules work by expanding one year at a time. */ | ||
905 | 922 | ||
906 | if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){ | 923 | if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){ |
907 | expand_year_days(impl,impl->last.year); | 924 | struct icaltimetype next; |
925 | |||
926 | for (;;) { | ||
927 | expand_year_days(impl, impl->last.year); | ||
928 | if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX) | ||
929 | break; /* break when no days are expanded */ | ||
930 | increment_year(impl,impl->rule.interval); | ||
931 | } | ||
932 | |||
933 | /* Copy the first day into last. */ | ||
934 | next = icaltime_from_day_of_year(impl->days[0], impl->last.year); | ||
935 | |||
936 | impl->last.day = next.day; | ||
937 | impl->last.month = next.month; | ||
908 | } | 938 | } |
909 | 939 | ||
910 | 940 | ||
@@ -914,13 +944,13 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
914 | if(impl->rule.freq == ICAL_MONTHLY_RECURRENCE && | 944 | if(impl->rule.freq == ICAL_MONTHLY_RECURRENCE && |
915 | has_by_data(impl,BY_DAY)) { | 945 | has_by_data(impl,BY_DAY)) { |
916 | 946 | ||
917 | short dow = icalrecurrencetype_day_day_of_week( | 947 | int dow = icalrecurrencetype_day_day_of_week( |
918 | impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]); | 948 | impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]); |
919 | short pos = icalrecurrencetype_day_position( | 949 | int pos = icalrecurrencetype_day_position( |
920 | impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]); | 950 | impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]); |
921 | 951 | ||
922 | short poscount = 0; | 952 | int poscount = 0; |
923 | days_in_month = | 953 | int days_in_month = |
924 | icaltime_days_in_month(impl->last.month, impl->last.year); | 954 | icaltime_days_in_month(impl->last.month, impl->last.year); |
925 | 955 | ||
926 | if(pos >= 0){ | 956 | if(pos >= 0){ |
@@ -969,26 +999,21 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | |||
969 | 999 | ||
970 | void icalrecur_iterator_free(icalrecur_iterator* i) | 1000 | void icalrecur_iterator_free(icalrecur_iterator* i) |
971 | { | 1001 | { |
1002 | icalerror_check_arg_rv((i!=0),"impl"); | ||
972 | 1003 | ||
973 | struct icalrecur_iterator_impl* impl = | 1004 | free(i); |
974 | (struct icalrecur_iterator_impl*)i; | ||
975 | |||
976 | icalerror_check_arg_rv((impl!=0),"impl"); | ||
977 | |||
978 | free(impl); | ||
979 | 1005 | ||
980 | } | 1006 | } |
981 | 1007 | ||
982 | 1008 | static void increment_year(icalrecur_iterator* impl, int inc) | |
983 | void increment_year(struct icalrecur_iterator_impl* impl, int inc) | ||
984 | { | 1009 | { |
985 | impl->last.year+=inc; | 1010 | impl->last.year+=inc; |
986 | } | 1011 | } |
987 | 1012 | ||
988 | /* Increment month is different that the other incement_* routines -- | 1013 | /** Increment month is different that the other incement_* routines -- |
989 | it figures out the interval for itself, and uses BYMONTH data if | 1014 | it figures out the interval for itself, and uses BYMONTH data if |
990 | available. */ | 1015 | available. */ |
991 | void increment_month(struct icalrecur_iterator_impl* impl) | 1016 | static void increment_month(icalrecur_iterator* impl) |
992 | { | 1017 | { |
993 | int years; | 1018 | int years; |
994 | 1019 | ||
@@ -1035,14 +1060,14 @@ void increment_month(struct icalrecur_iterator_impl* impl) | |||
1035 | } | 1060 | } |
1036 | } | 1061 | } |
1037 | 1062 | ||
1038 | void increment_monthday(struct icalrecur_iterator_impl* impl, int inc) | 1063 | static void increment_monthday(icalrecur_iterator* impl, int inc) |
1039 | { | 1064 | { |
1040 | int i; | 1065 | int i; |
1041 | 1066 | ||
1042 | for(i=0; i<inc; i++){ | 1067 | for(i=0; i<inc; i++){ |
1043 | 1068 | ||
1044 | short days_in_month = | 1069 | int days_in_month = |
1045 | icaltime_days_in_month(impl->last.month,impl->last.year); | 1070 | icaltime_days_in_month(impl->last.month, impl->last.year); |
1046 | 1071 | ||
1047 | impl->last.day++; | 1072 | impl->last.day++; |
1048 | 1073 | ||
@@ -1054,9 +1079,9 @@ void increment_monthday(struct icalrecur_iterator_impl* impl, int inc) | |||
1054 | } | 1079 | } |
1055 | 1080 | ||
1056 | 1081 | ||
1057 | void increment_hour(struct icalrecur_iterator_impl* impl, int inc) | 1082 | static void increment_hour(icalrecur_iterator* impl, int inc) |
1058 | { | 1083 | { |
1059 | short days; | 1084 | int days; |
1060 | 1085 | ||
1061 | impl->last.hour+=inc; | 1086 | impl->last.hour+=inc; |
1062 | 1087 | ||
@@ -1068,9 +1093,9 @@ void increment_hour(struct icalrecur_iterator_impl* impl, int inc) | |||
1068 | } | 1093 | } |
1069 | } | 1094 | } |
1070 | 1095 | ||
1071 | void increment_minute(struct icalrecur_iterator_impl* impl, int inc) | 1096 | static void increment_minute(icalrecur_iterator* impl, int inc) |
1072 | { | 1097 | { |
1073 | short hours; | 1098 | int hours; |
1074 | 1099 | ||
1075 | impl->last.minute+=inc; | 1100 | impl->last.minute+=inc; |
1076 | 1101 | ||
@@ -1083,9 +1108,9 @@ void increment_minute(struct icalrecur_iterator_impl* impl, int inc) | |||
1083 | 1108 | ||
1084 | } | 1109 | } |
1085 | 1110 | ||
1086 | void increment_second(struct icalrecur_iterator_impl* impl, int inc) | 1111 | static void increment_second(icalrecur_iterator* impl, int inc) |
1087 | { | 1112 | { |
1088 | short minutes; | 1113 | int minutes; |
1089 | 1114 | ||
1090 | impl->last.second+=inc; | 1115 | impl->last.second+=inc; |
1091 | 1116 | ||
@@ -1102,7 +1127,7 @@ void increment_second(struct icalrecur_iterator_impl* impl, int inc) | |||
1102 | #include "ical.h" | 1127 | #include "ical.h" |
1103 | void test_increment() | 1128 | void test_increment() |
1104 | { | 1129 | { |
1105 | struct icalrecur_iterator_impl impl; | 1130 | icalrecur_iterator impl; |
1106 | 1131 | ||
1107 | impl.last = icaltime_from_string("20000101T000000Z"); | 1132 | impl.last = icaltime_from_string("20000101T000000Z"); |
1108 | 1133 | ||
@@ -1132,17 +1157,17 @@ void test_increment() | |||
1132 | 1157 | ||
1133 | #endif | 1158 | #endif |
1134 | 1159 | ||
1135 | short next_second(struct icalrecur_iterator_impl* impl) | 1160 | static int next_second(icalrecur_iterator* impl) |
1136 | { | 1161 | { |
1137 | 1162 | ||
1138 | short has_by_data = (impl->by_ptrs[BY_SECOND][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1163 | int has_by_second = (impl->by_ptrs[BY_SECOND][0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1139 | short this_frequency = (impl->rule.freq == ICAL_SECONDLY_RECURRENCE); | 1164 | int this_frequency = (impl->rule.freq == ICAL_SECONDLY_RECURRENCE); |
1140 | 1165 | ||
1141 | short end_of_data = 0; | 1166 | int end_of_data = 0; |
1142 | 1167 | ||
1143 | assert(has_by_data || this_frequency); | 1168 | assert(has_by_second || this_frequency); |
1144 | 1169 | ||
1145 | if( has_by_data ){ | 1170 | if( has_by_second ){ |
1146 | /* Ignore the frequency and use the byrule data */ | 1171 | /* Ignore the frequency and use the byrule data */ |
1147 | 1172 | ||
1148 | impl->by_indices[BY_SECOND]++; | 1173 | impl->by_indices[BY_SECOND]++; |
@@ -1159,7 +1184,7 @@ short next_second(struct icalrecur_iterator_impl* impl) | |||
1159 | impl->by_ptrs[BY_SECOND][impl->by_indices[BY_SECOND]]; | 1184 | impl->by_ptrs[BY_SECOND][impl->by_indices[BY_SECOND]]; |
1160 | 1185 | ||
1161 | 1186 | ||
1162 | } else if( !has_by_data && this_frequency ){ | 1187 | } else if( !has_by_second && this_frequency ){ |
1163 | /* Compute the next value from the last time and the frequency interval*/ | 1188 | /* Compute the next value from the last time and the frequency interval*/ |
1164 | increment_second(impl, impl->rule.interval); | 1189 | increment_second(impl, impl->rule.interval); |
1165 | 1190 | ||
@@ -1168,7 +1193,7 @@ short next_second(struct icalrecur_iterator_impl* impl) | |||
1168 | /* If we have gone through all of the seconds on the BY list, then we | 1193 | /* If we have gone through all of the seconds on the BY list, then we |
1169 | need to move to the next minute */ | 1194 | need to move to the next minute */ |
1170 | 1195 | ||
1171 | if(has_by_data && end_of_data && this_frequency ){ | 1196 | if(has_by_second && end_of_data && this_frequency ){ |
1172 | increment_minute(impl,1); | 1197 | increment_minute(impl,1); |
1173 | } | 1198 | } |
1174 | 1199 | ||
@@ -1176,22 +1201,22 @@ short next_second(struct icalrecur_iterator_impl* impl) | |||
1176 | 1201 | ||
1177 | } | 1202 | } |
1178 | 1203 | ||
1179 | int next_minute(struct icalrecur_iterator_impl* impl) | 1204 | static int next_minute(icalrecur_iterator* impl) |
1180 | { | 1205 | { |
1181 | 1206 | ||
1182 | short has_by_data = (impl->by_ptrs[BY_MINUTE][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1207 | int has_by_minute = (impl->by_ptrs[BY_MINUTE][0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1183 | short this_frequency = (impl->rule.freq == ICAL_MINUTELY_RECURRENCE); | 1208 | int this_frequency = (impl->rule.freq == ICAL_MINUTELY_RECURRENCE); |
1184 | 1209 | ||
1185 | short end_of_data = 0; | 1210 | int end_of_data = 0; |
1186 | 1211 | ||
1187 | assert(has_by_data || this_frequency); | 1212 | assert(has_by_minute || this_frequency); |
1188 | 1213 | ||
1189 | 1214 | ||
1190 | if (next_second(impl) == 0){ | 1215 | if (next_second(impl) == 0){ |
1191 | return 0; | 1216 | return 0; |
1192 | } | 1217 | } |
1193 | 1218 | ||
1194 | if( has_by_data ){ | 1219 | if( has_by_minute ){ |
1195 | /* Ignore the frequency and use the byrule data */ | 1220 | /* Ignore the frequency and use the byrule data */ |
1196 | 1221 | ||
1197 | impl->by_indices[BY_MINUTE]++; | 1222 | impl->by_indices[BY_MINUTE]++; |
@@ -1207,7 +1232,7 @@ int next_minute(struct icalrecur_iterator_impl* impl) | |||
1207 | impl->last.minute = | 1232 | impl->last.minute = |
1208 | impl->by_ptrs[BY_MINUTE][impl->by_indices[BY_MINUTE]]; | 1233 | impl->by_ptrs[BY_MINUTE][impl->by_indices[BY_MINUTE]]; |
1209 | 1234 | ||
1210 | } else if( !has_by_data && this_frequency ){ | 1235 | } else if( !has_by_minute && this_frequency ){ |
1211 | /* Compute the next value from the last time and the frequency interval*/ | 1236 | /* Compute the next value from the last time and the frequency interval*/ |
1212 | increment_minute(impl,impl->rule.interval); | 1237 | increment_minute(impl,impl->rule.interval); |
1213 | } | 1238 | } |
@@ -1215,28 +1240,28 @@ int next_minute(struct icalrecur_iterator_impl* impl) | |||
1215 | /* If we have gone through all of the minutes on the BY list, then we | 1240 | /* If we have gone through all of the minutes on the BY list, then we |
1216 | need to move to the next hour */ | 1241 | need to move to the next hour */ |
1217 | 1242 | ||
1218 | if(has_by_data && end_of_data && this_frequency ){ | 1243 | if(has_by_minute && end_of_data && this_frequency ){ |
1219 | increment_hour(impl,1); | 1244 | increment_hour(impl,1); |
1220 | } | 1245 | } |
1221 | 1246 | ||
1222 | return end_of_data; | 1247 | return end_of_data; |
1223 | } | 1248 | } |
1224 | 1249 | ||
1225 | int next_hour(struct icalrecur_iterator_impl* impl) | 1250 | static int next_hour(icalrecur_iterator* impl) |
1226 | { | 1251 | { |
1227 | 1252 | ||
1228 | short has_by_data = (impl->by_ptrs[BY_HOUR][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1253 | int has_by_hour = (impl->by_ptrs[BY_HOUR][0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1229 | short this_frequency = (impl->rule.freq == ICAL_HOURLY_RECURRENCE); | 1254 | int this_frequency = (impl->rule.freq == ICAL_HOURLY_RECURRENCE); |
1230 | 1255 | ||
1231 | short end_of_data = 0; | 1256 | int end_of_data = 0; |
1232 | 1257 | ||
1233 | assert(has_by_data || this_frequency); | 1258 | assert(has_by_hour || this_frequency); |
1234 | 1259 | ||
1235 | if (next_minute(impl) == 0){ | 1260 | if (next_minute(impl) == 0){ |
1236 | return 0; | 1261 | return 0; |
1237 | } | 1262 | } |
1238 | 1263 | ||
1239 | if( has_by_data ){ | 1264 | if( has_by_hour ){ |
1240 | /* Ignore the frequency and use the byrule data */ | 1265 | /* Ignore the frequency and use the byrule data */ |
1241 | 1266 | ||
1242 | impl->by_indices[BY_HOUR]++; | 1267 | impl->by_indices[BY_HOUR]++; |
@@ -1251,7 +1276,7 @@ int next_hour(struct icalrecur_iterator_impl* impl) | |||
1251 | impl->last.hour = | 1276 | impl->last.hour = |
1252 | impl->by_ptrs[BY_HOUR][impl->by_indices[BY_HOUR]]; | 1277 | impl->by_ptrs[BY_HOUR][impl->by_indices[BY_HOUR]]; |
1253 | 1278 | ||
1254 | } else if( !has_by_data && this_frequency ){ | 1279 | } else if( !has_by_hour && this_frequency ){ |
1255 | /* Compute the next value from the last time and the frequency interval*/ | 1280 | /* Compute the next value from the last time and the frequency interval*/ |
1256 | increment_hour(impl,impl->rule.interval); | 1281 | increment_hour(impl,impl->rule.interval); |
1257 | 1282 | ||
@@ -1260,7 +1285,7 @@ int next_hour(struct icalrecur_iterator_impl* impl) | |||
1260 | /* If we have gone through all of the hours on the BY list, then we | 1285 | /* If we have gone through all of the hours on the BY list, then we |
1261 | need to move to the next day */ | 1286 | need to move to the next day */ |
1262 | 1287 | ||
1263 | if(has_by_data && end_of_data && this_frequency ){ | 1288 | if(has_by_hour && end_of_data && this_frequency ){ |
1264 | increment_monthday(impl,1); | 1289 | increment_monthday(impl,1); |
1265 | } | 1290 | } |
1266 | 1291 | ||
@@ -1268,13 +1293,13 @@ int next_hour(struct icalrecur_iterator_impl* impl) | |||
1268 | 1293 | ||
1269 | } | 1294 | } |
1270 | 1295 | ||
1271 | int next_day(struct icalrecur_iterator_impl* impl) | 1296 | static int next_day(icalrecur_iterator* impl) |
1272 | { | 1297 | { |
1273 | 1298 | ||
1274 | short has_by_data = (impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1299 | int has_by_day = (impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1275 | short this_frequency = (impl->rule.freq == ICAL_DAILY_RECURRENCE); | 1300 | int this_frequency = (impl->rule.freq == ICAL_DAILY_RECURRENCE); |
1276 | 1301 | ||
1277 | assert(has_by_data || this_frequency); | 1302 | assert(has_by_day || this_frequency); |
1278 | 1303 | ||
1279 | if (next_hour(impl) == 0){ | 1304 | if (next_hour(impl) == 0){ |
1280 | return 0; | 1305 | return 0; |
@@ -1296,14 +1321,14 @@ int next_day(struct icalrecur_iterator_impl* impl) | |||
1296 | } | 1321 | } |
1297 | 1322 | ||
1298 | 1323 | ||
1299 | int next_yearday(struct icalrecur_iterator_impl* impl) | 1324 | static int next_yearday(icalrecur_iterator* impl) |
1300 | { | 1325 | { |
1301 | 1326 | ||
1302 | short has_by_data = (impl->by_ptrs[BY_YEAR_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1327 | int has_by_yearday = (impl->by_ptrs[BY_YEAR_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1303 | 1328 | ||
1304 | short end_of_data = 0; | 1329 | int end_of_data = 0; |
1305 | 1330 | ||
1306 | assert(has_by_data ); | 1331 | assert(has_by_yearday ); |
1307 | 1332 | ||
1308 | if (next_hour(impl) == 0){ | 1333 | if (next_hour(impl) == 0){ |
1309 | return 0; | 1334 | return 0; |
@@ -1321,7 +1346,7 @@ int next_yearday(struct icalrecur_iterator_impl* impl) | |||
1321 | impl->last.day = | 1346 | impl->last.day = |
1322 | impl->by_ptrs[BY_YEAR_DAY][impl->by_indices[BY_YEAR_DAY]]; | 1347 | impl->by_ptrs[BY_YEAR_DAY][impl->by_indices[BY_YEAR_DAY]]; |
1323 | 1348 | ||
1324 | if(has_by_data && end_of_data){ | 1349 | if(has_by_yearday && end_of_data){ |
1325 | increment_year(impl,1); | 1350 | increment_year(impl,1); |
1326 | } | 1351 | } |
1327 | 1352 | ||
@@ -1329,62 +1354,15 @@ int next_yearday(struct icalrecur_iterator_impl* impl) | |||
1329 | 1354 | ||
1330 | } | 1355 | } |
1331 | 1356 | ||
1332 | /* This routine is only called by next_week. It is certain that BY_DAY | ||
1333 | has data */ | ||
1334 | |||
1335 | int next_weekday_by_week(struct icalrecur_iterator_impl* impl) | ||
1336 | { | ||
1337 | |||
1338 | short end_of_data = 0; | ||
1339 | short start_of_week, dow; | ||
1340 | struct icaltimetype next; | ||
1341 | |||
1342 | if (next_hour(impl) == 0){ | ||
1343 | return 0; | ||
1344 | } | ||
1345 | |||
1346 | assert( impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX); | ||
1347 | |||
1348 | while(1) { | ||
1349 | |||
1350 | impl->by_indices[BY_DAY]++; /* Look at next elem in BYDAY array */ | ||
1351 | |||
1352 | /* Are we at the end of the BYDAY array? */ | ||
1353 | if (impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]] | ||
1354 | ==ICAL_RECURRENCE_ARRAY_MAX){ | ||
1355 | |||
1356 | impl->by_indices[BY_DAY] = 0; /* Reset to 0 */ | ||
1357 | end_of_data = 1; /* Signal that we're at the end */ | ||
1358 | } | ||
1359 | |||
1360 | /* Add the day of week offset to to the start of this week, and use | ||
1361 | that to get the next day */ | ||
1362 | dow = impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]; | ||
1363 | start_of_week = icaltime_start_doy_of_week(impl->last); | ||
1364 | |||
1365 | dow--; /*Sun is 1, not 0 */ | ||
1366 | |||
1367 | if(dow+start_of_week <1 && !end_of_data){ | ||
1368 | /* The selected date is in the previous year. */ | ||
1369 | continue; | ||
1370 | } | ||
1371 | |||
1372 | next = icaltime_from_day_of_year(start_of_week + dow,impl->last.year); | ||
1373 | |||
1374 | impl->last.day = next.day; | ||
1375 | impl->last.month = next.month; | ||
1376 | impl->last.year = next.year; | ||
1377 | |||
1378 | return end_of_data; | ||
1379 | } | ||
1380 | 1357 | ||
1381 | } | 1358 | /* Returns the day of the month for the current month of t that is the |
1359 | pos'th instance of the day-of-week dow */ | ||
1382 | 1360 | ||
1383 | int nth_weekday(short dow, short pos, struct icaltimetype t){ | 1361 | static int nth_weekday(int dow, int pos, struct icaltimetype t){ |
1384 | 1362 | ||
1385 | short days_in_month = icaltime_days_in_month(t.month,t.year); | 1363 | int days_in_month = icaltime_days_in_month(t.month, t.year); |
1386 | short end_dow, start_dow; | 1364 | int end_dow, start_dow; |
1387 | short wd; | 1365 | int wd; |
1388 | 1366 | ||
1389 | if(pos >= 0){ | 1367 | if(pos >= 0){ |
1390 | t.day = 1; | 1368 | t.day = 1; |
@@ -1428,12 +1406,29 @@ int nth_weekday(short dow, short pos, struct icaltimetype t){ | |||
1428 | return wd; | 1406 | return wd; |
1429 | } | 1407 | } |
1430 | 1408 | ||
1409 | static int is_day_in_byday(icalrecur_iterator* impl,struct icaltimetype tt){ | ||
1410 | |||
1411 | int idx; | ||
1431 | 1412 | ||
1432 | int next_month(struct icalrecur_iterator_impl* impl) | 1413 | for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){ |
1414 | int dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]); | ||
1415 | int pos = icalrecurrencetype_day_position(BYDAYPTR[idx]); | ||
1416 | int this_dow = icaltime_day_of_week(tt); | ||
1417 | |||
1418 | if( (pos == 0 && dow == this_dow ) || /* Just a dow, like "TU" or "FR" */ | ||
1419 | (nth_weekday(dow,pos,tt) == tt.day)){ /*pos+wod: "3FR" or -1TU" */ | ||
1420 | return 1; | ||
1421 | } | ||
1422 | } | ||
1423 | |||
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1427 | static int next_month(icalrecur_iterator* impl) | ||
1433 | { | 1428 | { |
1434 | int data_valid = 1; | 1429 | int data_valid = 1; |
1435 | 1430 | ||
1436 | short this_frequency = (impl->rule.freq == ICAL_MONTHLY_RECURRENCE); | 1431 | int this_frequency = (impl->rule.freq == ICAL_MONTHLY_RECURRENCE); |
1437 | 1432 | ||
1438 | assert( has_by_data(impl,BY_MONTH) || this_frequency); | 1433 | assert( has_by_data(impl,BY_MONTH) || this_frequency); |
1439 | 1434 | ||
@@ -1445,14 +1440,17 @@ int next_month(struct icalrecur_iterator_impl* impl) | |||
1445 | return data_valid; /* Signal that the data is valid */ | 1440 | return data_valid; /* Signal that the data is valid */ |
1446 | } | 1441 | } |
1447 | 1442 | ||
1448 | |||
1449 | /* Now iterate through the occurrences within a month -- by days, | 1443 | /* Now iterate through the occurrences within a month -- by days, |
1450 | weeks or weekdays. */ | 1444 | weeks or weekdays. */ |
1445 | |||
1446 | /* | ||
1447 | * Case 1: | ||
1448 | * Rules Like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYMONTHDAY=13 | ||
1449 | */ | ||
1451 | 1450 | ||
1452 | if(has_by_data(impl,BY_DAY) && has_by_data(impl,BY_MONTH_DAY)){ | 1451 | if(has_by_data(impl,BY_DAY) && has_by_data(impl,BY_MONTH_DAY)){ |
1453 | /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYMONTHDAY=13 */ | 1452 | int day, idx,j; |
1454 | short day, idx,j; | 1453 | int days_in_month = icaltime_days_in_month(impl->last.month, |
1455 | short days_in_month = icaltime_days_in_month(impl->last.month, | ||
1456 | impl->last.year); | 1454 | impl->last.year); |
1457 | /* Iterate through the remaining days in the month and check if | 1455 | /* Iterate through the remaining days in the month and check if |
1458 | each day is listed in the BY_DAY array and in the BY_MONTHDAY | 1456 | each day is listed in the BY_DAY array and in the BY_MONTHDAY |
@@ -1463,11 +1461,11 @@ int next_month(struct icalrecur_iterator_impl* impl) | |||
1463 | for(day = impl->last.day+1; day <= days_in_month; day++){ | 1461 | for(day = impl->last.day+1; day <= days_in_month; day++){ |
1464 | for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){ | 1462 | for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){ |
1465 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ | 1463 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ |
1466 | short dow = | 1464 | int dow = |
1467 | icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]); | 1465 | icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]); |
1468 | short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]); | 1466 | int pos = icalrecurrencetype_day_position(BYDAYPTR[idx]); |
1469 | short mday = BYMDPTR[j]; | 1467 | int mday = BYMDPTR[j]; |
1470 | short this_dow; | 1468 | int this_dow; |
1471 | 1469 | ||
1472 | impl->last.day = day; | 1470 | impl->last.day = day; |
1473 | this_dow = icaltime_day_of_week(impl->last); | 1471 | this_dow = icaltime_day_of_week(impl->last); |
@@ -1488,51 +1486,57 @@ int next_month(struct icalrecur_iterator_impl* impl) | |||
1488 | data_valid = 0; /* signal that impl->last is invalid */ | 1486 | data_valid = 0; /* signal that impl->last is invalid */ |
1489 | } | 1487 | } |
1490 | 1488 | ||
1491 | 1489 | ||
1490 | /* | ||
1491 | * Case 2: | ||
1492 | * Rules Like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR | ||
1493 | */ | ||
1494 | |||
1492 | } else if(has_by_data(impl,BY_DAY)){ | 1495 | } else if(has_by_data(impl,BY_DAY)){ |
1493 | /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR */ | ||
1494 | /* For this case, the weekdays are relative to the | 1496 | /* For this case, the weekdays are relative to the |
1495 | month. BYDAY=FR -> First Friday in month, etc. */ | 1497 | month. BYDAY=FR -> First Friday in month, etc. */ |
1496 | 1498 | ||
1497 | short day, idx; | 1499 | /* This code iterates through the remaining days in the month |
1498 | short days_in_month = icaltime_days_in_month(impl->last.month, | 1500 | and checks if each day is listed in the BY_DAY array. This |
1499 | impl->last.year); | 1501 | seems very inneficient, but I think it is the simplest way to |
1502 | account for both BYDAY=1FR (First friday in month) and | ||
1503 | BYDAY=FR ( every friday in month ) */ | ||
1500 | 1504 | ||
1505 | int day; | ||
1506 | int days_in_month = icaltime_days_in_month(impl->last.month, | ||
1507 | impl->last.year); | ||
1501 | assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1508 | assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1502 | 1509 | ||
1503 | /* Iterate through the remaining days in the month and check if | ||
1504 | each day is listed in the BY_DAY array. This seems very | ||
1505 | inneficient, but I think it is the simplest way to account | ||
1506 | for both BYDAY=1FR (First friday in month) and BYDAY=FR ( | ||
1507 | every friday in month ) */ | ||
1508 | |||
1509 | for(day = impl->last.day+1; day <= days_in_month; day++){ | 1510 | for(day = impl->last.day+1; day <= days_in_month; day++){ |
1510 | for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){ | 1511 | impl->last.day = day; |
1511 | short dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]); | 1512 | if(is_day_in_byday(impl,impl->last)){ |
1512 | short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]); | 1513 | data_valid = 1; |
1513 | short this_dow; | 1514 | break; |
1514 | |||
1515 | impl->last.day = day; | ||
1516 | this_dow = icaltime_day_of_week(impl->last); | ||
1517 | |||
1518 | if( (pos == 0 && dow == this_dow ) || | ||
1519 | (nth_weekday(dow,pos,impl->last) == day)){ | ||
1520 | goto DEND; | ||
1521 | } | ||
1522 | } | 1515 | } |
1523 | } | 1516 | } |
1524 | 1517 | ||
1525 | DEND: | ||
1526 | |||
1527 | if ( day > days_in_month){ | 1518 | if ( day > days_in_month){ |
1528 | impl->last.day = 1; | 1519 | impl->last.day = 1; |
1529 | increment_month(impl); | 1520 | increment_month(impl); |
1530 | data_valid = 0; /* signal that impl->last is invalid */ | 1521 | |
1522 | /* Did moving to the next month put us on a valid date? if | ||
1523 | so, note that the new data is valid, if, not, mark it | ||
1524 | invalid */ | ||
1525 | |||
1526 | if(is_day_in_byday(impl,impl->last)){ | ||
1527 | data_valid = 1; | ||
1528 | } else { | ||
1529 | data_valid = 0; /* signal that impl->last is invalid */ | ||
1530 | } | ||
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | /* | ||
1534 | * Case 3 | ||
1535 | * Rules Like: FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-3 | ||
1536 | */ | ||
1537 | |||
1533 | } else if (has_by_data(impl,BY_MONTH_DAY)) { | 1538 | } else if (has_by_data(impl,BY_MONTH_DAY)) { |
1534 | /* Cases like: FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-3 */ | 1539 | int day; |
1535 | short day; | ||
1536 | 1540 | ||
1537 | assert( BYMDPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1541 | assert( BYMDPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX); |
1538 | 1542 | ||
@@ -1548,8 +1552,7 @@ int next_month(struct icalrecur_iterator_impl* impl) | |||
1548 | day = BYMDPTR[BYMDIDX]; | 1552 | day = BYMDPTR[BYMDIDX]; |
1549 | 1553 | ||
1550 | if (day < 0) { | 1554 | if (day < 0) { |
1551 | day = icaltime_days_in_month(impl->last.month,impl->last.year)+ | 1555 | day = icaltime_days_in_month(impl->last.month, impl->last.year) + day + 1; |
1552 | day + 1; | ||
1553 | } | 1556 | } |
1554 | 1557 | ||
1555 | impl->last.day = day; | 1558 | impl->last.day = day; |
@@ -1558,18 +1561,72 @@ int next_month(struct icalrecur_iterator_impl* impl) | |||
1558 | increment_month(impl); | 1561 | increment_month(impl); |
1559 | } | 1562 | } |
1560 | 1563 | ||
1561 | return data_valid; /* Signal that the data is valid */ | 1564 | return data_valid; |
1562 | 1565 | ||
1563 | } | 1566 | } |
1564 | 1567 | ||
1568 | static int next_weekday_by_week(icalrecur_iterator* impl) | ||
1569 | { | ||
1570 | |||
1571 | int end_of_data = 0; | ||
1572 | int start_of_week, dow; | ||
1573 | struct icaltimetype next; | ||
1574 | |||
1575 | if (next_hour(impl) == 0){ | ||
1576 | return 0; | ||
1577 | } | ||
1578 | |||
1579 | if(!has_by_data(impl,BY_DAY)){ | ||
1580 | return 1; | ||
1581 | } | ||
1582 | |||
1583 | /* If we get here, we need to step to tne next day */ | ||
1584 | |||
1585 | for (;;) { | ||
1586 | struct icaltimetype tt = icaltime_null_time(); | ||
1587 | BYDAYIDX++; /* Look at next elem in BYDAY array */ | ||
1588 | |||
1589 | /* Are we at the end of the BYDAY array? */ | ||
1590 | if (BYDAYPTR[BYDAYIDX]==ICAL_RECURRENCE_ARRAY_MAX){ | ||
1591 | BYDAYIDX = 0; /* Reset to 0 */ | ||
1592 | end_of_data = 1; /* Signal that we're at the end */ | ||
1593 | } | ||
1594 | |||
1595 | /* Add the day of week offset to to the start of this week, and use | ||
1596 | that to get the next day */ | ||
1597 | /* ignore position of dow ("4FR"), only use dow ("FR")*/ | ||
1598 | dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[BYDAYIDX]); | ||
1599 | tt.year = impl->last.year; | ||
1600 | tt.day = impl->last.day; | ||
1601 | tt.month = impl->last.month; | ||
1602 | |||
1603 | start_of_week = icaltime_start_doy_of_week(tt); | ||
1604 | |||
1605 | dow--; /* Set Sunday to be 0 */ | ||
1606 | |||
1607 | if(dow+start_of_week <1){ | ||
1608 | /* The selected date is in the previous year. */ | ||
1609 | if(!end_of_data){ | ||
1610 | continue; | ||
1611 | } | ||
1612 | } | ||
1613 | |||
1614 | next = icaltime_from_day_of_year(start_of_week + dow,impl->last.year); | ||
1615 | |||
1616 | impl->last.day = next.day; | ||
1617 | impl->last.month = next.month; | ||
1618 | impl->last.year = next.year; | ||
1619 | |||
1620 | return end_of_data; | ||
1621 | } | ||
1622 | |||
1623 | } | ||
1565 | 1624 | ||
1566 | int next_week(struct icalrecur_iterator_impl* impl) | 1625 | static int next_week(icalrecur_iterator* impl) |
1567 | { | 1626 | { |
1568 | short has_by_data = (impl->by_ptrs[BY_WEEK_NO][0]!=ICAL_RECURRENCE_ARRAY_MAX); | 1627 | int end_of_data = 0; |
1569 | short this_frequency = (impl->rule.freq == ICAL_WEEKLY_RECURRENCE); | ||
1570 | short end_of_data = 0; | ||
1571 | 1628 | ||
1572 | /* Increment to the next week day */ | 1629 | /* Increment to the next week day, if there is data at a level less than a week */ |
1573 | if (next_weekday_by_week(impl) == 0){ | 1630 | if (next_weekday_by_week(impl) == 0){ |
1574 | return 0; /* Have not reached end of week yet */ | 1631 | return 0; /* Have not reached end of week yet */ |
1575 | } | 1632 | } |
@@ -1577,8 +1634,8 @@ int next_week(struct icalrecur_iterator_impl* impl) | |||
1577 | /* If we get here, we have incremented through the entire week, and | 1634 | /* If we get here, we have incremented through the entire week, and |
1578 | can increment to the next week */ | 1635 | can increment to the next week */ |
1579 | 1636 | ||
1580 | 1637 | if( has_by_data(impl,BY_WEEK_NO)){ | |
1581 | if( has_by_data){ | 1638 | /*FREQ=WEEKLY;BYWEEK=20*/ |
1582 | /* Use the Week Number byrule data */ | 1639 | /* Use the Week Number byrule data */ |
1583 | int week_no; | 1640 | int week_no; |
1584 | struct icaltimetype t; | 1641 | struct icaltimetype t; |
@@ -1602,13 +1659,12 @@ int next_week(struct icalrecur_iterator_impl* impl) | |||
1602 | 1659 | ||
1603 | impl->last = icaltime_normalize(impl->last); | 1660 | impl->last = icaltime_normalize(impl->last); |
1604 | 1661 | ||
1605 | } else if( !has_by_data && this_frequency ){ | 1662 | } else { |
1606 | /* If there is no BY_WEEK_NO data, just jump forward 7 days. */ | 1663 | /* Jump to the next week */ |
1607 | increment_monthday(impl,7*impl->rule.interval); | 1664 | increment_monthday(impl,7*impl->rule.interval); |
1608 | } | 1665 | } |
1609 | 1666 | ||
1610 | 1667 | if( has_by_data(impl,BY_WEEK_NO) && end_of_data){ | |
1611 | if(has_by_data && end_of_data && this_frequency ){ | ||
1612 | increment_year(impl,1); | 1668 | increment_year(impl,1); |
1613 | } | 1669 | } |
1614 | 1670 | ||
@@ -1616,14 +1672,14 @@ int next_week(struct icalrecur_iterator_impl* impl) | |||
1616 | 1672 | ||
1617 | } | 1673 | } |
1618 | 1674 | ||
1619 | /* Expand the BYDAY rule part and return a pointer to a newly allocated list of days. */ | 1675 | /** Expand the BYDAY rule part and return a pointer to a newly allocated list of days. */ |
1620 | pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year) | 1676 | static pvl_list expand_by_day(icalrecur_iterator* impl, int year) |
1621 | { | 1677 | { |
1622 | /* Try to calculate each of the occurrences. */ | 1678 | /* Try to calculate each of the occurrences. */ |
1623 | int i; | 1679 | int i; |
1624 | pvl_list days_list = pvl_newlist(); | 1680 | pvl_list days_list = pvl_newlist(); |
1625 | 1681 | ||
1626 | short start_dow, end_dow, end_year_day, start_doy; | 1682 | int start_dow, end_dow, end_year_day; |
1627 | struct icaltimetype tmp = impl->last; | 1683 | struct icaltimetype tmp = impl->last; |
1628 | 1684 | ||
1629 | tmp.year= year; | 1685 | tmp.year= year; |
@@ -1631,37 +1687,35 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year) | |||
1631 | tmp.day = 1; | 1687 | tmp.day = 1; |
1632 | tmp.is_date = 1; | 1688 | tmp.is_date = 1; |
1633 | 1689 | ||
1690 | /* Find the day that 1st Jan falls on, 1 (Sun) to 7 (Sat). */ | ||
1634 | start_dow = icaltime_day_of_week(tmp); | 1691 | start_dow = icaltime_day_of_week(tmp); |
1635 | start_doy = icaltime_start_doy_of_week(tmp); | ||
1636 | 1692 | ||
1637 | /* Get the last day of the year*/ | 1693 | /* Get the last day of the year*/ |
1638 | tmp.year++; | 1694 | tmp.year= year; |
1639 | tmp = icaltime_normalize(tmp); | 1695 | tmp.month = 12; |
1640 | tmp.day--; | 1696 | tmp.day = 31; |
1641 | tmp = icaltime_normalize(tmp); | 1697 | tmp.is_date = 1; |
1642 | 1698 | ||
1643 | end_dow = icaltime_day_of_week(tmp); | 1699 | end_dow = icaltime_day_of_week(tmp); |
1644 | end_year_day = icaltime_day_of_year(tmp); | 1700 | end_year_day = icaltime_day_of_year(tmp); |
1645 | 1701 | ||
1646 | for(i = 0; BYDAYPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ | 1702 | for(i = 0; BYDAYPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ |
1647 | short dow = | 1703 | /* This is 1 (Sun) to 7 (Sat). */ |
1704 | int dow = | ||
1648 | icalrecurrencetype_day_day_of_week(BYDAYPTR[i]); | 1705 | icalrecurrencetype_day_day_of_week(BYDAYPTR[i]); |
1649 | short pos = icalrecurrencetype_day_position(BYDAYPTR[i]); | 1706 | int pos = icalrecurrencetype_day_position(BYDAYPTR[i]); |
1650 | 1707 | ||
1651 | if(pos == 0){ | 1708 | if(pos == 0){ |
1652 | /* The day was specified without a position -- it is just | 1709 | /* The day was specified without a position -- it is just |
1653 | a bare day of the week ( BYDAY=SU) so add all of the | 1710 | a bare day of the week ( BYDAY=SU) so add all of the |
1654 | days of the year with this day-of-week*/ | 1711 | days of the year with this day-of-week*/ |
1655 | int week; | 1712 | int doy, tmp_start_doy; |
1656 | for(week = 0; week < 52 ; week ++){ | ||
1657 | short doy = start_doy + (week * 7) + dow-1; | ||
1658 | 1713 | ||
1659 | if(doy > end_year_day){ | 1714 | tmp_start_doy = ((dow + 7 - start_dow) % 7) + 1; |
1660 | break; | 1715 | |
1661 | } else { | 1716 | for (doy = tmp_start_doy; doy <= end_year_day; doy += 7) |
1662 | pvl_push(days_list,(void*)(int)doy); | 1717 | pvl_push(days_list,(void*)(int)doy); |
1663 | } | 1718 | |
1664 | } | ||
1665 | } else if ( pos > 0) { | 1719 | } else if ( pos > 0) { |
1666 | int first; | 1720 | int first; |
1667 | /* First occurrence of dow in year */ | 1721 | /* First occurrence of dow in year */ |
@@ -1671,7 +1725,7 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year) | |||
1671 | first = dow - start_dow + 8; | 1725 | first = dow - start_dow + 8; |
1672 | } | 1726 | } |
1673 | 1727 | ||
1674 | /* THen just multiple the position times 7 to get the pos'th day in the year */ | 1728 | /* Then just multiple the position times 7 to get the pos'th day in the year */ |
1675 | pvl_push(days_list,(void*)(first+ (pos-1) * 7)); | 1729 | pvl_push(days_list,(void*)(first+ (pos-1) * 7)); |
1676 | 1730 | ||
1677 | } else { /* pos < 0 */ | 1731 | } else { /* pos < 0 */ |
@@ -1696,22 +1750,23 @@ pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year) | |||
1696 | list all of the days of the current year that are specified in this | 1750 | list all of the days of the current year that are specified in this |
1697 | rule. */ | 1751 | rule. */ |
1698 | 1752 | ||
1699 | int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | 1753 | static int expand_year_days(icalrecur_iterator* impl, int year) |
1700 | { | 1754 | { |
1701 | int j,k; | 1755 | int j,k; |
1702 | int days_index=0; | 1756 | int days_index=0; |
1703 | struct icaltimetype t; | 1757 | struct icaltimetype t; |
1704 | int flags; | 1758 | int flags; |
1705 | 1759 | ||
1706 | t = icaltime_null_time(); | 1760 | t = icaltime_null_date(); |
1707 | 1761 | ||
1708 | #define HBD(x) has_by_data(impl,x) | 1762 | #define HBD(x) has_by_data(impl,x) |
1709 | 1763 | ||
1710 | t.is_date = 1; /* Needed to make day_of_year routines work property */ | ||
1711 | |||
1712 | memset(&t,0,sizeof(t)); | ||
1713 | memset(impl->days,ICAL_RECURRENCE_ARRAY_MAX_BYTE,sizeof(impl->days)); | 1764 | memset(impl->days,ICAL_RECURRENCE_ARRAY_MAX_BYTE,sizeof(impl->days)); |
1714 | 1765 | ||
1766 | /* The flags and the following switch statement select which code | ||
1767 | to use to expand the yers days, based on which BY-rules are | ||
1768 | present. */ | ||
1769 | |||
1715 | flags = (HBD(BY_DAY) ? 1<<BY_DAY : 0) + | 1770 | flags = (HBD(BY_DAY) ? 1<<BY_DAY : 0) + |
1716 | (HBD(BY_WEEK_NO) ? 1<<BY_WEEK_NO : 0) + | 1771 | (HBD(BY_WEEK_NO) ? 1<<BY_WEEK_NO : 0) + |
1717 | (HBD(BY_MONTH_DAY) ? 1<<BY_MONTH_DAY : 0) + | 1772 | (HBD(BY_MONTH_DAY) ? 1<<BY_MONTH_DAY : 0) + |
@@ -1723,16 +1778,19 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1723 | 1778 | ||
1724 | case 0: { | 1779 | case 0: { |
1725 | /* FREQ=YEARLY; */ | 1780 | /* FREQ=YEARLY; */ |
1781 | t = impl->dtstart; | ||
1782 | t.year = impl->last.year; | ||
1726 | 1783 | ||
1784 | impl->days[days_index++] = (short)icaltime_day_of_year(t); | ||
1785 | |||
1727 | break; | 1786 | break; |
1728 | } | 1787 | } |
1729 | case 1<<BY_MONTH: { | 1788 | case 1<<BY_MONTH: { |
1730 | /* FREQ=YEARLY; BYMONTH=3,11*/ | 1789 | /* FREQ=YEARLY; BYMONTH=3,11*/ |
1731 | 1790 | ||
1732 | for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ | 1791 | for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ |
1733 | struct icaltimetype t; | 1792 | int month = impl->by_ptrs[BY_MONTH][j]; |
1734 | short month = impl->by_ptrs[BY_MONTH][j]; | 1793 | int doy; |
1735 | short doy; | ||
1736 | 1794 | ||
1737 | t = impl->dtstart; | 1795 | t = impl->dtstart; |
1738 | t.year = year; | 1796 | t.year = year; |
@@ -1741,7 +1799,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1741 | 1799 | ||
1742 | doy = icaltime_day_of_year(t); | 1800 | doy = icaltime_day_of_year(t); |
1743 | 1801 | ||
1744 | impl->days[days_index++] = doy; | 1802 | impl->days[days_index++] = (short)doy; |
1745 | 1803 | ||
1746 | } | 1804 | } |
1747 | break; | 1805 | break; |
@@ -1751,8 +1809,8 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1751 | /* FREQ=YEARLY; BYMONTHDAY=1,15*/ | 1809 | /* FREQ=YEARLY; BYMONTHDAY=1,15*/ |
1752 | for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++) | 1810 | for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++) |
1753 | { | 1811 | { |
1754 | short month_day = impl->by_ptrs[BY_MONTH_DAY][k]; | 1812 | int month_day = impl->by_ptrs[BY_MONTH_DAY][k]; |
1755 | short doy; | 1813 | int doy; |
1756 | 1814 | ||
1757 | t = impl->dtstart; | 1815 | t = impl->dtstart; |
1758 | t.day = month_day; | 1816 | t.day = month_day; |
@@ -1761,7 +1819,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1761 | 1819 | ||
1762 | doy = icaltime_day_of_year(t); | 1820 | doy = icaltime_day_of_year(t); |
1763 | 1821 | ||
1764 | impl->days[days_index++] = doy; | 1822 | impl->days[days_index++] = (short)doy; |
1765 | 1823 | ||
1766 | } | 1824 | } |
1767 | break; | 1825 | break; |
@@ -1773,9 +1831,9 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1773 | for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ | 1831 | for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ |
1774 | for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++) | 1832 | for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++) |
1775 | { | 1833 | { |
1776 | short month = impl->by_ptrs[BY_MONTH][j]; | 1834 | int month = impl->by_ptrs[BY_MONTH][j]; |
1777 | short month_day = impl->by_ptrs[BY_MONTH_DAY][k]; | 1835 | int month_day = impl->by_ptrs[BY_MONTH_DAY][k]; |
1778 | short doy; | 1836 | int doy; |
1779 | 1837 | ||
1780 | t.day = month_day; | 1838 | t.day = month_day; |
1781 | t.month = month; | 1839 | t.month = month; |
@@ -1784,7 +1842,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1784 | 1842 | ||
1785 | doy = icaltime_day_of_year(t); | 1843 | doy = icaltime_day_of_year(t); |
1786 | 1844 | ||
1787 | impl->days[days_index++] = doy; | 1845 | impl->days[days_index++] = (short)doy; |
1788 | 1846 | ||
1789 | } | 1847 | } |
1790 | } | 1848 | } |
@@ -1795,8 +1853,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1795 | case 1<<BY_WEEK_NO: { | 1853 | case 1<<BY_WEEK_NO: { |
1796 | /* FREQ=YEARLY; BYWEEKNO=20,50 */ | 1854 | /* FREQ=YEARLY; BYWEEKNO=20,50 */ |
1797 | 1855 | ||
1798 | struct icaltimetype t; | 1856 | int dow; |
1799 | short dow; | ||
1800 | 1857 | ||
1801 | t.day = impl->dtstart.day; | 1858 | t.day = impl->dtstart.day; |
1802 | t.month = impl->dtstart.month; | 1859 | t.month = impl->dtstart.month; |
@@ -1819,13 +1876,12 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1819 | 1876 | ||
1820 | case 1<<BY_DAY: { | 1877 | case 1<<BY_DAY: { |
1821 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR*/ | 1878 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR*/ |
1822 | int days_index = 0; | ||
1823 | pvl_elem i; | 1879 | pvl_elem i; |
1824 | pvl_list days = expand_by_day(impl,year); | 1880 | pvl_list days = expand_by_day(impl,year); |
1825 | 1881 | ||
1826 | 1882 | ||
1827 | for(i=pvl_head(days);i!=0;i=pvl_next(i)){ | 1883 | for(i=pvl_head(days);i!=0;i=pvl_next(i)){ |
1828 | short day = (short)(int)pvl_data(i); | 1884 | short day = (short)(*((int*)pvl_data(i))); |
1829 | impl->days[days_index++] = day; | 1885 | impl->days[days_index++] = day; |
1830 | } | 1886 | } |
1831 | 1887 | ||
@@ -1837,50 +1893,76 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1837 | case (1<<BY_DAY)+(1<<BY_MONTH): { | 1893 | case (1<<BY_DAY)+(1<<BY_MONTH): { |
1838 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTH = 12*/ | 1894 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTH = 12*/ |
1839 | 1895 | ||
1840 | int days_index = 0; | ||
1841 | pvl_elem itr; | ||
1842 | pvl_list days = expand_by_day(impl,year); | ||
1843 | 1896 | ||
1844 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ | 1897 | for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ |
1845 | short doy = (short)(int)pvl_data(itr); | 1898 | int month = impl->by_ptrs[BY_MONTH][j]; |
1846 | struct icaltimetype tt; | 1899 | int days_in_month = icaltime_days_in_month(month,year); |
1847 | short j; | 1900 | int first_dow, last_dow, doy_offset; |
1848 | 1901 | ||
1849 | tt = icaltime_from_day_of_year(doy,year); | 1902 | t.year = year; |
1903 | t.month = month; | ||
1904 | t.day = 1; | ||
1905 | t.is_date = 1; | ||
1850 | 1906 | ||
1851 | for(j=0; | 1907 | first_dow = icaltime_day_of_week(t); |
1852 | impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX; | ||
1853 | j++){ | ||
1854 | short month = impl->by_ptrs[BY_MONTH][j]; | ||
1855 | 1908 | ||
1856 | if(tt.month == month){ | 1909 | /* This holds the day offset used to calculate the day of the year |
1857 | impl->days[days_index++] = doy; | 1910 | from the month day. Just add the month day to this. */ |
1858 | } | 1911 | doy_offset = icaltime_day_of_year(t) - 1; |
1859 | } | ||
1860 | 1912 | ||
1861 | } | 1913 | t.day = days_in_month; |
1914 | last_dow = icaltime_day_of_week(t); | ||
1862 | 1915 | ||
1863 | pvl_free(days); | 1916 | for(k=0;impl->by_ptrs[BY_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++){ |
1917 | short day_coded = impl->by_ptrs[BY_DAY][k]; | ||
1918 | enum icalrecurrencetype_weekday dow = | ||
1919 | icalrecurrencetype_day_day_of_week(day_coded); | ||
1920 | int pos = icalrecurrencetype_day_position(day_coded); | ||
1921 | int first_matching_day, last_matching_day, day, month_day; | ||
1922 | |||
1923 | /* Calculate the first day in the month with the given weekday, | ||
1924 | and the last day. */ | ||
1925 | first_matching_day = ((dow + 7 - first_dow) % 7) + 1; | ||
1926 | last_matching_day = days_in_month - ((last_dow + 7 - dow) % 7); | ||
1927 | |||
1928 | if (pos == 0) { | ||
1929 | /* Add all of instances of the weekday within the month. */ | ||
1930 | for (day = first_matching_day; day <= days_in_month; day += 7) | ||
1931 | impl->days[days_index++] = (short)(doy_offset + day); | ||
1932 | |||
1933 | } else if (pos > 0) { | ||
1934 | /* Add the nth instance of the weekday within the month. */ | ||
1935 | month_day = first_matching_day + (pos - 1) * 7; | ||
1936 | |||
1937 | if (month_day <= days_in_month) | ||
1938 | impl->days[days_index++] = (short)(doy_offset + month_day); | ||
1864 | 1939 | ||
1940 | } else { | ||
1941 | /* Add the -nth instance of the weekday within the month.*/ | ||
1942 | month_day = last_matching_day + (pos + 1) * 7; | ||
1943 | |||
1944 | if (month_day > 0) | ||
1945 | impl->days[days_index++] = (short)(doy_offset + month_day); | ||
1946 | } | ||
1947 | } | ||
1948 | } | ||
1865 | break; | 1949 | break; |
1866 | } | 1950 | } |
1867 | 1951 | ||
1868 | case (1<<BY_DAY) + (1<<BY_MONTH_DAY) : { | 1952 | case (1<<BY_DAY) + (1<<BY_MONTH_DAY) : { |
1869 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=1,15*/ | 1953 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=1,15*/ |
1870 | 1954 | ||
1871 | int days_index = 0; | ||
1872 | pvl_elem itr; | 1955 | pvl_elem itr; |
1873 | pvl_list days = expand_by_day(impl,year); | 1956 | pvl_list days = expand_by_day(impl,year); |
1874 | 1957 | ||
1875 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ | 1958 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ |
1876 | short day = (short)(int)pvl_data(itr); | 1959 | short day = (short)(*((int*)pvl_data(itr))); |
1877 | struct icaltimetype tt; | 1960 | struct icaltimetype tt; |
1878 | short j; | ||
1879 | 1961 | ||
1880 | tt = icaltime_from_day_of_year(day,year); | 1962 | tt = icaltime_from_day_of_year(day,year); |
1881 | 1963 | ||
1882 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ | 1964 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ |
1883 | short mday = BYMDPTR[j]; | 1965 | int mday = BYMDPTR[j]; |
1884 | 1966 | ||
1885 | if(tt.day == mday){ | 1967 | if(tt.day == mday){ |
1886 | impl->days[days_index++] = day; | 1968 | impl->days[days_index++] = day; |
@@ -1897,21 +1979,20 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1897 | case (1<<BY_DAY) + (1<<BY_MONTH_DAY) + (1<<BY_MONTH): { | 1979 | case (1<<BY_DAY) + (1<<BY_MONTH_DAY) + (1<<BY_MONTH): { |
1898 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=10; MYMONTH=6,11*/ | 1980 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=10; MYMONTH=6,11*/ |
1899 | 1981 | ||
1900 | int days_index = 0; | ||
1901 | pvl_elem itr; | 1982 | pvl_elem itr; |
1902 | pvl_list days = expand_by_day(impl,year); | 1983 | pvl_list days = expand_by_day(impl,year); |
1903 | 1984 | ||
1904 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ | 1985 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ |
1905 | short day = (short)(int)pvl_data(itr); | 1986 | short day = (short)(*((int*)pvl_data(itr))); |
1906 | struct icaltimetype tt; | 1987 | struct icaltimetype tt; |
1907 | short i,j; | 1988 | int i; |
1908 | 1989 | ||
1909 | tt = icaltime_from_day_of_year(day,year); | 1990 | tt = icaltime_from_day_of_year(day,year); |
1910 | 1991 | ||
1911 | for(i = 0; BYMONPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ | 1992 | for(i = 0; BYMONPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ |
1912 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ | 1993 | for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){ |
1913 | short mday = BYMDPTR[j]; | 1994 | int mday = BYMDPTR[j]; |
1914 | short month = BYMONPTR[i]; | 1995 | int month = BYMONPTR[i]; |
1915 | 1996 | ||
1916 | if(tt.month == month && tt.day == mday){ | 1997 | if(tt.month == month && tt.day == mday){ |
1917 | impl->days[days_index++] = day; | 1998 | impl->days[days_index++] = day; |
@@ -1930,21 +2011,20 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1930 | case (1<<BY_DAY) + (1<<BY_WEEK_NO) : { | 2011 | case (1<<BY_DAY) + (1<<BY_WEEK_NO) : { |
1931 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; WEEKNO=20,50*/ | 2012 | /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; WEEKNO=20,50*/ |
1932 | 2013 | ||
1933 | int days_index = 0; | ||
1934 | pvl_elem itr; | 2014 | pvl_elem itr; |
1935 | pvl_list days = expand_by_day(impl,year); | 2015 | pvl_list days = expand_by_day(impl,year); |
1936 | 2016 | ||
1937 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ | 2017 | for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){ |
1938 | short day = (short)(int)pvl_data(itr); | 2018 | short day = (short)(*((int*)pvl_data(itr))); |
1939 | struct icaltimetype tt; | 2019 | struct icaltimetype tt; |
1940 | short i; | 2020 | int i; |
1941 | 2021 | ||
1942 | tt = icaltime_from_day_of_year(day,year); | 2022 | tt = icaltime_from_day_of_year(day,year); |
1943 | 2023 | ||
1944 | for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ | 2024 | for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ |
1945 | short weekno = BYWEEKPTR[i]; | 2025 | int weekno = BYWEEKPTR[i]; |
1946 | 2026 | int this_weekno = icaltime_week_number(tt); | |
1947 | if(weekno== icaltime_week_number(tt)){ | 2027 | if(weekno== this_weekno){ |
1948 | impl->days[days_index++] = day; | 2028 | impl->days[days_index++] = day; |
1949 | } | 2029 | } |
1950 | } | 2030 | } |
@@ -1963,8 +2043,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1963 | 2043 | ||
1964 | case 1<<BY_YEAR_DAY: { | 2044 | case 1<<BY_YEAR_DAY: { |
1965 | for(j=0;impl->by_ptrs[BY_YEAR_DAY][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ | 2045 | for(j=0;impl->by_ptrs[BY_YEAR_DAY][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){ |
1966 | short doy = impl->by_ptrs[BY_YEAR_DAY][j]; | 2046 | impl->days[days_index++] = impl->by_ptrs[BY_YEAR_DAY][j]; |
1967 | impl->days[days_index++] = doy; | ||
1968 | } | 2047 | } |
1969 | break; | 2048 | break; |
1970 | } | 2049 | } |
@@ -1980,26 +2059,26 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year) | |||
1980 | } | 2059 | } |
1981 | 2060 | ||
1982 | 2061 | ||
1983 | int next_year(struct icalrecur_iterator_impl* impl) | 2062 | static int next_year(icalrecur_iterator* impl) |
1984 | { | 2063 | { |
1985 | struct icaltimetype next; | 2064 | struct icaltimetype next; |
1986 | 2065 | ||
1987 | /* Next_year does it's own interatio in days, so the next level down is hours */ | ||
1988 | if (next_hour(impl) == 0){ | 2066 | if (next_hour(impl) == 0){ |
1989 | return 1; | 2067 | return 0; |
1990 | } | 2068 | } |
1991 | 2069 | ||
1992 | if (impl->days[++impl->days_index] == ICAL_RECURRENCE_ARRAY_MAX){ | 2070 | if (impl->days[++impl->days_index] == ICAL_RECURRENCE_ARRAY_MAX){ |
1993 | impl->days_index = 0; | 2071 | impl->days_index = 0; |
2072 | |||
2073 | for (;;) { | ||
1994 | increment_year(impl,impl->rule.interval); | 2074 | increment_year(impl,impl->rule.interval); |
1995 | expand_year_days(impl,impl->last.year); | 2075 | expand_year_days(impl,impl->last.year); |
2076 | if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX) | ||
2077 | break; | ||
1996 | } | 2078 | } |
1997 | |||
1998 | if(impl->days[0] == ICAL_RECURRENCE_ARRAY_MAX) { | ||
1999 | return 0; | ||
2000 | } | 2079 | } |
2001 | 2080 | ||
2002 | next = icaltime_from_day_of_year(impl->days[impl->days_index],impl->last.year); | 2081 | next = icaltime_from_day_of_year(impl->days[impl->days_index], impl->last.year); |
2003 | 2082 | ||
2004 | impl->last.day = next.day; | 2083 | impl->last.day = next.day; |
2005 | impl->last.month = next.month; | 2084 | impl->last.month = next.month; |
@@ -2007,8 +2086,8 @@ int next_year(struct icalrecur_iterator_impl* impl) | |||
2007 | return 1; | 2086 | return 1; |
2008 | } | 2087 | } |
2009 | 2088 | ||
2010 | int icalrecur_check_rulepart(struct icalrecur_iterator_impl* impl, | 2089 | int icalrecur_check_rulepart(icalrecur_iterator* impl, |
2011 | short v, enum byrule byrule) | 2090 | int v, enum byrule byrule) |
2012 | { | 2091 | { |
2013 | int itr; | 2092 | int itr; |
2014 | 2093 | ||
@@ -2023,8 +2102,8 @@ int icalrecur_check_rulepart(struct icalrecur_iterator_impl* impl, | |||
2023 | return 0; | 2102 | return 0; |
2024 | } | 2103 | } |
2025 | 2104 | ||
2026 | int check_contract_restriction(struct icalrecur_iterator_impl* impl, | 2105 | static int check_contract_restriction(icalrecur_iterator* impl, |
2027 | enum byrule byrule, short v) | 2106 | enum byrule byrule, int v) |
2028 | { | 2107 | { |
2029 | int pass = 0; | 2108 | int pass = 0; |
2030 | int itr; | 2109 | int itr; |
@@ -2048,22 +2127,22 @@ int check_contract_restriction(struct icalrecur_iterator_impl* impl, | |||
2048 | } | 2127 | } |
2049 | 2128 | ||
2050 | 2129 | ||
2051 | int check_contracting_rules(struct icalrecur_iterator_impl* impl) | 2130 | static int check_contracting_rules(icalrecur_iterator* impl) |
2052 | { | 2131 | { |
2053 | 2132 | ||
2054 | int day_of_week=0; | 2133 | int day_of_week = icaltime_day_of_week(impl->last); |
2055 | int week_no=0; | 2134 | int week_no = icaltime_week_number(impl->last); |
2056 | int year_day=0; | 2135 | int year_day = icaltime_day_of_year(impl->last); |
2057 | 2136 | ||
2058 | if ( | 2137 | if ( |
2059 | check_contract_restriction(impl,BY_SECOND,impl->last.second) && | 2138 | check_contract_restriction(impl,BY_SECOND, impl->last.second) && |
2060 | check_contract_restriction(impl,BY_MINUTE,impl->last.minute) && | 2139 | check_contract_restriction(impl,BY_MINUTE, impl->last.minute) && |
2061 | check_contract_restriction(impl,BY_HOUR,impl->last.hour) && | 2140 | check_contract_restriction(impl,BY_HOUR, impl->last.hour) && |
2062 | check_contract_restriction(impl,BY_DAY,day_of_week) && | 2141 | check_contract_restriction(impl,BY_DAY, day_of_week) && |
2063 | check_contract_restriction(impl,BY_WEEK_NO,week_no) && | 2142 | check_contract_restriction(impl,BY_WEEK_NO, week_no) && |
2064 | check_contract_restriction(impl,BY_MONTH_DAY,impl->last.day) && | 2143 | check_contract_restriction(impl,BY_MONTH_DAY, impl->last.day) && |
2065 | check_contract_restriction(impl,BY_MONTH,impl->last.month) && | 2144 | check_contract_restriction(impl,BY_MONTH, impl->last.month) && |
2066 | check_contract_restriction(impl,BY_YEAR_DAY,year_day) ) | 2145 | check_contract_restriction(impl,BY_YEAR_DAY, year_day) ) |
2067 | { | 2146 | { |
2068 | 2147 | ||
2069 | return 1; | 2148 | return 1; |
@@ -2072,11 +2151,9 @@ int check_contracting_rules(struct icalrecur_iterator_impl* impl) | |||
2072 | } | 2151 | } |
2073 | } | 2152 | } |
2074 | 2153 | ||
2075 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr) | 2154 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl) |
2076 | { | 2155 | { |
2077 | int valid = 1; | 2156 | int valid = 1; |
2078 | struct icalrecur_iterator_impl* impl = | ||
2079 | (struct icalrecur_iterator_impl*)itr; | ||
2080 | 2157 | ||
2081 | if( (impl->rule.count!=0 &&impl->occurrence_no >= impl->rule.count) || | 2158 | if( (impl->rule.count!=0 &&impl->occurrence_no >= impl->rule.count) || |
2082 | (!icaltime_is_null_time(impl->rule.until) && | 2159 | (!icaltime_is_null_time(impl->rule.until) && |
@@ -2120,7 +2197,7 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr) | |||
2120 | break; | 2197 | break; |
2121 | } | 2198 | } |
2122 | case ICAL_YEARLY_RECURRENCE:{ | 2199 | case ICAL_YEARLY_RECURRENCE:{ |
2123 | valid = next_year(impl); | 2200 | next_year(impl); |
2124 | break; | 2201 | break; |
2125 | } | 2202 | } |
2126 | default:{ | 2203 | default:{ |
@@ -2135,7 +2212,7 @@ struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr) | |||
2135 | } | 2212 | } |
2136 | 2213 | ||
2137 | } while(!check_contracting_rules(impl) | 2214 | } while(!check_contracting_rules(impl) |
2138 | || icaltime_compare(impl->last,impl->dtstart) <= 0 | 2215 | || icaltime_compare(impl->last,impl->dtstart) < 0 |
2139 | || valid == 0); | 2216 | || valid == 0); |
2140 | 2217 | ||
2141 | 2218 | ||
@@ -2166,16 +2243,15 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *recur) | |||
2166 | recur->count = 0; | 2243 | recur->count = 0; |
2167 | } | 2244 | } |
2168 | 2245 | ||
2169 | /* The 'day' element of icalrecurrencetype_weekday is encoded to allow | 2246 | /** The 'day' element of icalrecurrencetype_weekday is encoded to |
2170 | reporesentation of both the day of the week ( Monday, Tueday), but | 2247 | * allow representation of both the day of the week ( Monday, Tueday), |
2171 | also the Nth day of the week ( First tuesday of the month, last | 2248 | * but also the Nth day of the week ( First tuesday of the month, last |
2172 | thursday of the year) These routines decode the day values. | 2249 | * thursday of the year) These routines decode the day values. |
2173 | 2250 | * | |
2174 | The day's position in the period ( Nth-ness) and the numerical value | 2251 | * The day's position in the period ( Nth-ness) and the numerical |
2175 | of the day are encoded together as: pos*7 + dow | 2252 | * value of the day are encoded together as: pos*7 + dow |
2176 | 2253 | * | |
2177 | A position of 0 means 'any' or 'every' | 2254 | * A position of 0 means 'any' or 'every' |
2178 | |||
2179 | */ | 2255 | */ |
2180 | 2256 | ||
2181 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day) | 2257 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day) |
@@ -2183,9 +2259,9 @@ enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day) | |||
2183 | return abs(day)%8; | 2259 | return abs(day)%8; |
2184 | } | 2260 | } |
2185 | 2261 | ||
2186 | short icalrecurrencetype_day_position(short day) | 2262 | int icalrecurrencetype_day_position(short day) |
2187 | { | 2263 | { |
2188 | short wd, pos; | 2264 | int wd, pos; |
2189 | 2265 | ||
2190 | wd = icalrecurrencetype_day_day_of_week(day); | 2266 | wd = icalrecurrencetype_day_day_of_week(day); |
2191 | 2267 | ||
@@ -2198,7 +2274,7 @@ short icalrecurrencetype_day_position(short day) | |||
2198 | 2274 | ||
2199 | /****************** Enumeration Routines ******************/ | 2275 | /****************** Enumeration Routines ******************/ |
2200 | 2276 | ||
2201 | struct {icalrecurrencetype_weekday wd; const char * str; } | 2277 | static struct {icalrecurrencetype_weekday wd; const char * str; } |
2202 | wd_map[] = { | 2278 | wd_map[] = { |
2203 | {ICAL_SUNDAY_WEEKDAY,"SU"}, | 2279 | {ICAL_SUNDAY_WEEKDAY,"SU"}, |
2204 | {ICAL_MONDAY_WEEKDAY,"MO"}, | 2280 | {ICAL_MONDAY_WEEKDAY,"MO"}, |
@@ -2238,7 +2314,7 @@ icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str) | |||
2238 | 2314 | ||
2239 | 2315 | ||
2240 | 2316 | ||
2241 | struct { | 2317 | static struct { |
2242 | icalrecurrencetype_frequency kind; | 2318 | icalrecurrencetype_frequency kind; |
2243 | const char* str; | 2319 | const char* str; |
2244 | } freq_map[] = { | 2320 | } freq_map[] = { |
@@ -2276,10 +2352,11 @@ icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str) | |||
2276 | return ICAL_NO_RECURRENCE; | 2352 | return ICAL_NO_RECURRENCE; |
2277 | } | 2353 | } |
2278 | 2354 | ||
2279 | /* Fill an array with the 'count' number of occurrences generated by | 2355 | /** Fill an array with the 'count' number of occurrences generated by |
2280 | the rrule. Note that the times are returned in UTC, but the times | 2356 | * the rrule. Note that the times are returned in UTC, but the times |
2281 | are calculated in local time. YOu will have to convert the results | 2357 | * are calculated in local time. YOu will have to convert the results |
2282 | back into local time before using them. */ | 2358 | * back into local time before using them. |
2359 | */ | ||
2283 | 2360 | ||
2284 | int icalrecur_expand_recurrence(char* rule, time_t start, | 2361 | int icalrecur_expand_recurrence(char* rule, time_t start, |
2285 | int count, time_t* array) | 2362 | int count, time_t* array) |
@@ -2292,7 +2369,7 @@ int icalrecur_expand_recurrence(char* rule, time_t start, | |||
2292 | 2369 | ||
2293 | memset(array, 0, count*sizeof(time_t)); | 2370 | memset(array, 0, count*sizeof(time_t)); |
2294 | 2371 | ||
2295 | icstart = icaltime_from_timet(start,0); | 2372 | icstart = icaltime_from_timet_with_zone(start,0,0); |
2296 | 2373 | ||
2297 | recur = icalrecurrencetype_from_string(rule); | 2374 | recur = icalrecurrencetype_from_string(rule); |
2298 | 2375 | ||
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 | |||
@@ -16,10 +16,17 @@ | |||
16 | 16 | ||
17 | The Mozilla Public License Version 1.0. You may obtain a copy of | 17 | The Mozilla Public License Version 1.0. You may obtain a copy of |
18 | the License at http://www.mozilla.org/MPL/ | 18 | the License at http://www.mozilla.org/MPL/ |
19 | */ | ||
20 | |||
21 | /** | ||
22 | @file icalrecur.h | ||
23 | @brief Routines for dealing with recurring time | ||
19 | 24 | ||
20 | How to use: | 25 | How to use: |
21 | 26 | ||
22 | 1) Get a rule and a start time from a component | 27 | 1) Get a rule and a start time from a component |
28 | |||
29 | @code | ||
23 | icalproperty rrule; | 30 | icalproperty rrule; |
24 | struct icalrecurrencetype recur; | 31 | struct icalrecurrencetype recur; |
25 | struct icaltimetype dtstart; | 32 | struct icaltimetype dtstart; |
@@ -27,26 +34,36 @@ How to use: | |||
27 | rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); | 34 | rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); |
28 | recur = icalproperty_get_rrule(rrule); | 35 | recur = icalproperty_get_rrule(rrule); |
29 | start = icalproperty_get_dtstart(dtstart); | 36 | start = icalproperty_get_dtstart(dtstart); |
37 | @endcode | ||
30 | 38 | ||
31 | Or, just make them up: | 39 | Or, just make them up: |
40 | |||
41 | @code | ||
32 | recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE"); | 42 | recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE"); |
33 | dtstart = icaltime_from_string("19970101T123000") | 43 | dtstart = icaltime_from_string("19970101T123000") |
44 | @endcode | ||
34 | 45 | ||
35 | 2) Create an iterator | 46 | 2) Create an iterator |
47 | |||
48 | @code | ||
36 | icalrecur_iterator* ritr; | 49 | icalrecur_iterator* ritr; |
37 | ritr = icalrecur_iterator_new(recur,start); | 50 | ritr = icalrecur_iterator_new(recur,start); |
51 | @endcode | ||
38 | 52 | ||
39 | 3) Iterator over the occurrences | 53 | 3) Iterator over the occurrences |
54 | |||
55 | @code | ||
40 | struct icaltimetype next; | 56 | struct icaltimetype next; |
41 | while (next = icalrecur_iterator_next(ritr) | 57 | while (next = icalrecur_iterator_next(ritr) |
42 | && !icaltime_is_null_time(next){ | 58 | && !icaltime_is_null_time(next){ |
43 | Do something with next | 59 | Do something with next |
44 | } | 60 | } |
61 | @endcode | ||
45 | 62 | ||
46 | Note that that the time returned by icalrecur_iterator_next is in | 63 | Note that that the time returned by icalrecur_iterator_next is in |
47 | whatever timezone that dtstart is in. | 64 | whatever timezone that dtstart is in. |
48 | 65 | ||
49 | ======================================================================*/ | 66 | */ |
50 | 67 | ||
51 | #ifndef ICALRECUR_H | 68 | #ifndef ICALRECUR_H |
52 | #define ICALRECUR_H | 69 | #define ICALRECUR_H |
@@ -54,9 +71,9 @@ whatever timezone that dtstart is in. | |||
54 | #include <time.h> | 71 | #include <time.h> |
55 | #include "icaltime.h" | 72 | #include "icaltime.h" |
56 | 73 | ||
57 | /*********************************************************************** | 74 | /* |
58 | * Recurrance enumerations | 75 | * Recurrance enumerations |
59 | **********************************************************************/ | 76 | */ |
60 | 77 | ||
61 | typedef enum icalrecurrencetype_frequency | 78 | typedef enum icalrecurrencetype_frequency |
62 | { | 79 | { |
@@ -93,7 +110,9 @@ enum { | |||
93 | 110 | ||
94 | 111 | ||
95 | 112 | ||
96 | /********************** Recurrence type routines **************/ | 113 | /** |
114 | * Recurrence type routines | ||
115 | */ | ||
97 | 116 | ||
98 | /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of | 117 | /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of |
99 | the values and fields in struct icalrecurrencetype */ | 118 | the values and fields in struct icalrecurrencetype */ |
@@ -108,7 +127,7 @@ enum { | |||
108 | #define ICAL_BY_MONTH_SIZE 13 | 127 | #define ICAL_BY_MONTH_SIZE 13 |
109 | #define ICAL_BY_SETPOS_SIZE 367 | 128 | #define ICAL_BY_SETPOS_SIZE 367 |
110 | 129 | ||
111 | /* Main struct for holding digested recurrence rules */ | 130 | /** Main struct for holding digested recurrence rules */ |
112 | struct icalrecurrencetype | 131 | struct icalrecurrencetype |
113 | { | 132 | { |
114 | icalrecurrencetype_frequency freq; | 133 | icalrecurrencetype_frequency freq; |
@@ -145,43 +164,49 @@ struct icalrecurrencetype | |||
145 | 164 | ||
146 | void icalrecurrencetype_clear(struct icalrecurrencetype *r); | 165 | void icalrecurrencetype_clear(struct icalrecurrencetype *r); |
147 | 166 | ||
148 | /* The 'day' element of the by_day array is encoded to allow | 167 | /** |
149 | representation of both the day of the week ( Monday, Tueday), but also | 168 | * Array Encoding |
150 | the Nth day of the week ( First tuesday of the month, last thursday of | 169 | * |
151 | the year) These routines decode the day values */ | 170 | * The 'day' element of the by_day array is encoded to allow |
171 | * representation of both the day of the week ( Monday, Tueday), but also | ||
172 | * the Nth day of the week ( First tuesday of the month, last thursday of | ||
173 | * the year) These routines decode the day values | ||
174 | */ | ||
152 | 175 | ||
153 | /* 1 == Monday, etc. */ | 176 | /** 1 == Monday, etc. */ |
154 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); | 177 | enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); |
155 | 178 | ||
156 | /* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ | 179 | /** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ |
157 | short icalrecurrencetype_day_position(short day); | 180 | int icalrecurrencetype_day_position(short day); |
158 | 181 | ||
159 | 182 | ||
160 | /*********************************************************************** | 183 | /** Recurrance rule parser */ |
161 | * Recurrance rule parser | ||
162 | **********************************************************************/ | ||
163 | 184 | ||
164 | /* Convert between strings ans recurrencetype structures. */ | 185 | /** Convert between strings and recurrencetype structures. */ |
165 | struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); | 186 | struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); |
166 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); | 187 | char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); |
167 | 188 | ||
168 | 189 | ||
169 | /********** recurrence iteration routines ********************/ | 190 | /** Recurrence iteration routines */ |
170 | 191 | ||
171 | typedef void icalrecur_iterator; | 192 | typedef struct icalrecur_iterator_impl icalrecur_iterator; |
172 | 193 | ||
173 | /* Create a new recurrence rule iterator */ | 194 | /** Create a new recurrence rule iterator */ |
174 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, | 195 | icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, |
175 | struct icaltimetype dtstart); | 196 | struct icaltimetype dtstart); |
176 | 197 | ||
177 | /* Get the next occurrence from an iterator */ | 198 | /** Get the next occurrence from an iterator */ |
178 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); | 199 | struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); |
179 | 200 | ||
180 | /* Free the iterator */ | 201 | void icalrecur_iterator_decrement_count(icalrecur_iterator*); |
202 | |||
203 | /** Free the iterator */ | ||
181 | void icalrecur_iterator_free(icalrecur_iterator*); | 204 | void icalrecur_iterator_free(icalrecur_iterator*); |
182 | 205 | ||
183 | /* Fills array up with at most 'count' time_t values, each | 206 | /** |
184 | representing an occurrence time in seconds past the POSIX epoch */ | 207 | * Fills array up with at most 'count' time_t values, each |
208 | * representing an occurrence time in seconds past the POSIX epoch | ||
209 | */ | ||
185 | int icalrecur_expand_recurrence(char* rule, time_t start, | 210 | int icalrecur_expand_recurrence(char* rule, time_t start, |
186 | int count, time_t* array); | 211 | int count, time_t* array); |
187 | 212 | ||
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 | |||
@@ -17,10 +17,13 @@ | |||
17 | #include <assert.h> | 17 | #include <assert.h> |
18 | #include <stdio.h> /* For snprintf */ | 18 | #include <stdio.h> /* For snprintf */ |
19 | 19 | ||
20 | int snprintf(char *str, size_t n, char const *fmt, ...); | ||
21 | |||
22 | #define TMP_BUF_SIZE 1024 | 20 | #define TMP_BUF_SIZE 1024 |
23 | 21 | ||
22 | #ifdef WIN32 | ||
23 | #define snprintf_snprintf | ||
24 | #define strcasecmpstricmp | ||
25 | #endif | ||
26 | |||
24 | 27 | ||
25 | /* Define the structs for the restrictions. these data are filled out | 28 | /* Define the structs for the restrictions. these data are filled out |
26 | in machine generated code below */ | 29 | in machine generated code below */ |
@@ -63,7 +66,7 @@ icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_C | |||
63 | icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0}; | 66 | icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0}; |
64 | 67 | ||
65 | 68 | ||
66 | /* The each row gives the result of comparing a restriction against a | 69 | /** The each row gives the result of comparing a restriction against a |
67 | count. The columns in each row represent 0,1,2+. '-1' indicates | 70 | count. The columns in each row represent 0,1,2+. '-1' indicates |
68 | 'invalid, 'don't care' or 'needs more analysis' So, for | 71 | 'invalid, 'don't care' or 'needs more analysis' So, for |
69 | ICAL_RESTRICTION_ONE, if there is 1 of a property with that | 72 | ICAL_RESTRICTION_ONE, if there is 1 of a property with that |
@@ -221,7 +224,7 @@ char* icalrestriction_must_have_duration(icalrestriction_property_record *rec, | |||
221 | 224 | ||
222 | if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){ | 225 | if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){ |
223 | 226 | ||
224 | return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property"; | 227 | return "Failed iTIP restrictions. This component must have a DURATION property"; |
225 | 228 | ||
226 | } | 229 | } |
227 | 230 | ||
@@ -232,7 +235,7 @@ char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec, | |||
232 | icalproperty* prop){ | 235 | icalproperty* prop){ |
233 | if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){ | 236 | if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){ |
234 | 237 | ||
235 | return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property"; | 238 | return "Failed iTIP restrictions. This component must have a REPEAT property"; |
236 | 239 | ||
237 | } | 240 | } |
238 | 241 | ||
@@ -249,9 +252,9 @@ char* icalrestriction_no_dtend(icalrestriction_property_record *rec, | |||
249 | icalcomponent* comp, | 252 | icalcomponent* comp, |
250 | icalproperty* prop){ | 253 | icalproperty* prop){ |
251 | 254 | ||
252 | if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){ | 255 | if( icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){ |
253 | 256 | ||
254 | return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND"; | 257 | return "Failed iTIP restrictions. The component must not have both DURATION and DTEND"; |
255 | 258 | ||
256 | } | 259 | } |
257 | 260 | ||
@@ -264,7 +267,21 @@ char* icalrestriction_no_duration(icalrestriction_property_record *rec, | |||
264 | /* _no_dtend takes care of this one */ | 267 | /* _no_dtend takes care of this one */ |
265 | return 0; | 268 | return 0; |
266 | } | 269 | } |
270 | char* icalrestriction_must_be_email( | ||
271 | icalrestriction_property_record *rec, | ||
272 | icalcomponent* comp, | ||
273 | icalproperty* prop) | ||
274 | { | ||
275 | icalproperty_status stat = icalproperty_get_action(prop); | ||
267 | 276 | ||
277 | if( !( stat == ICAL_ACTION_EMAIL)){ | ||
278 | |||
279 | return "Failed iTIP restrictions for ACTION property. Value must be EMAIL."; | ||
280 | |||
281 | } | ||
282 | |||
283 | return 0; | ||
284 | } | ||
268 | 285 | ||
269 | int icalrestriction_check_component(icalproperty_method method, | 286 | int icalrestriction_check_component(icalproperty_method method, |
270 | icalcomponent* comp) | 287 | icalcomponent* comp) |
@@ -272,8 +289,7 @@ int icalrestriction_check_component(icalproperty_method method, | |||
272 | icalproperty_kind kind; | 289 | icalproperty_kind kind; |
273 | icalcomponent_kind comp_kind; | 290 | icalcomponent_kind comp_kind; |
274 | icalrestriction_kind restr; | 291 | icalrestriction_kind restr; |
275 | icalrestriction_property_record *prop_record = 0L; | 292 | icalrestriction_property_record *prop_record; |
276 | icalrestriction_component_record *comp_record = 0L; | ||
277 | char* funcr = 0; | 293 | char* funcr = 0; |
278 | icalproperty *prop; | 294 | icalproperty *prop; |
279 | 295 | ||
@@ -463,8 +479,8 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
463 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 479 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
464 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 480 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
465 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 481 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
466 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 482 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, |
467 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 483 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend}, |
468 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 484 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
469 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 485 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
470 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 486 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -481,6 +497,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
481 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 497 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
482 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 498 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
483 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 499 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
500 | {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
484 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 501 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
485 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 502 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
486 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 503 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -513,6 +530,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
513 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 530 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
514 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 531 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
515 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 532 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
533 | {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
516 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 534 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
517 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 535 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
518 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 536 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -545,6 +563,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
545 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 563 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
546 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 564 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
547 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 565 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
566 | {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
548 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 567 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
549 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 568 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
550 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 569 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -560,7 +579,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
560 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 579 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
561 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 580 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
562 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 581 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, |
563 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 582 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend}, |
564 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 583 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
565 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 584 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
566 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 585 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -577,6 +596,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
577 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 596 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
578 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring}, | 597 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring}, |
579 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 598 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
599 | {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
580 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 600 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
581 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 601 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
582 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 602 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -591,7 +611,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
591 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 611 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
592 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE ,icalrestriction_no_duration}, | 612 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE ,icalrestriction_no_duration}, |
593 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 613 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
594 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 614 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend}, |
595 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 615 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
596 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 616 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
597 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 617 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -609,6 +629,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
609 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 629 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
610 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 630 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
611 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 631 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
632 | {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
612 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 633 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
613 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 634 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
614 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 635 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -641,6 +662,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
641 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 662 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
642 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 663 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
643 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 664 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
665 | {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
644 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 666 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
645 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 667 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
646 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 668 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -656,7 +678,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
656 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 678 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
657 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 679 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
658 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 680 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, |
659 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 681 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend}, |
660 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 682 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
661 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 683 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
662 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 684 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -673,6 +695,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
673 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 695 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
674 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 696 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
675 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 697 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
698 | {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
676 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 699 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
677 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 700 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
678 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 701 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -705,6 +728,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
705 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 728 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
706 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 729 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
707 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 730 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
731 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
708 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 732 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
709 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 733 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
710 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 734 | {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -746,7 +770,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
746 | {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 770 | {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
747 | {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 771 | {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
748 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 772 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
749 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 773 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
750 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 774 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
751 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 775 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
752 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 776 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -777,9 +801,10 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
777 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 801 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
778 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 802 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
779 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 803 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
804 | {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
780 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 805 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
781 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 806 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
782 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 807 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
783 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 808 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
784 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 809 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
785 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 810 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
@@ -809,6 +834,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
809 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 834 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
810 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 835 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
811 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 836 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
837 | {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
812 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 838 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
813 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 839 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
814 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 840 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -841,6 +867,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
841 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 867 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
842 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 868 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
843 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 869 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
870 | {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
844 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 871 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
845 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 872 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
846 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 873 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -873,6 +900,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
873 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 900 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
874 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring}, | 901 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring}, |
875 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 902 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
903 | {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
876 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 904 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
877 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 905 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
878 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 906 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -904,6 +932,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
904 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 932 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
905 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 933 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
906 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 934 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
935 | {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
907 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 936 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
908 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 937 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
909 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 938 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -935,6 +964,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
935 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 964 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
936 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 965 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
937 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 966 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
967 | {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
938 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 968 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
939 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 969 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
940 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 970 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -967,6 +997,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
967 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_comp_need_process}, | 997 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_comp_need_process}, |
968 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 998 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
969 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 999 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1000 | {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
970 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 1001 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
971 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1002 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
972 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1003 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -998,6 +1029,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
998 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1029 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
999 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1030 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1000 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1031 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1032 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1001 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1033 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
1002 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1034 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
1003 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1035 | {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, |
@@ -1071,9 +1103,50 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1071 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1103 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1072 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1104 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1073 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1105 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1106 | {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1107 | {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1108 | {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1109 | {ICAL_METHOD_PUBLISH,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1110 | {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1111 | {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1112 | {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1113 | {ICAL_METHOD_REQUEST,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1114 | {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1115 | {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1116 | {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1117 | {ICAL_METHOD_REPLY,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1118 | {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1119 | {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1120 | {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1121 | {ICAL_METHOD_ADD,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1122 | {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1123 | {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1124 | {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1125 | {ICAL_METHOD_CANCEL,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1126 | {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1127 | {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1128 | {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1129 | {ICAL_METHOD_REFRESH,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1130 | {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1131 | {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1132 | {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1133 | {ICAL_METHOD_COUNTER,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1134 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1135 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1136 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1137 | {ICAL_METHOD_DECLINECOUNTER,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1138 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_ALLOWCONFLICT_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1139 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_CALMASTER_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1140 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_OWNER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1141 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1142 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1143 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTCHARSET_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1144 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTLOCALE_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1145 | {ICAL_METHOD_NONE,ICAL_VAGENDA_COMPONENT,ICAL_DEFAULTTZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1074 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1146 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1075 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1147 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1076 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1148 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1149 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1077 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1150 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1078 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1151 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1079 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1152 | {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
@@ -1134,7 +1207,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1134 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1207 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1135 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1208 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1136 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1209 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1137 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration}, | 1210 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend}, |
1138 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1211 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1139 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1212 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1140 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1213 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
@@ -1167,6 +1240,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1167 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1240 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1168 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1241 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1169 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1242 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1243 | {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1170 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1244 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1171 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1245 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1172 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1246 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
@@ -1215,6 +1289,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1215 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | 1289 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, |
1216 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1290 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1217 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1291 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1292 | {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RELCALID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1218 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1293 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1219 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1294 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1220 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1295 | {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
@@ -1551,7 +1626,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1551 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1626 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1552 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1627 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1553 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1628 | {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1554 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, | 1629 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,icalrestriction_must_be_email}, |
1555 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1630 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1556 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, | 1631 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, |
1557 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1632 | {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
@@ -1647,6 +1722,9 @@ icalrestriction_property_record icalrestriction_property_records[] = { | |||
1647 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1722 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1648 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, | 1723 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, |
1649 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, | 1724 | {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, |
1725 | {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_QUERY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, | ||
1726 | {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_QUERYNAME_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1727 | {ICAL_METHOD_NONE,ICAL_VQUERY_COMPONENT,ICAL_EXPAND_PROPERTY,ICAL_RESTRICTION_ONE,0}, | ||
1650 | {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} | 1728 | {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} |
1651 | }; | 1729 | }; |
1652 | icalrestriction_component_record icalrestriction_component_records[] = { | 1730 | icalrestriction_component_record icalrestriction_component_records[] = { |
@@ -1777,5 +1855,7 @@ icalrestriction_component_record icalrestriction_component_records[] = { | |||
1777 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0}, | 1855 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0}, |
1778 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0}, | 1856 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0}, |
1779 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0}, | 1857 | {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0}, |
1858 | {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_XSTANDARD_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0}, | ||
1859 | {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_XDAYLIGHT_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0}, | ||
1780 | {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} | 1860 | {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} |
1781 | }; | 1861 | }; |
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 | |||
@@ -26,7 +26,7 @@ | |||
26 | ======================================================================*/ | 26 | ======================================================================*/ |
27 | 27 | ||
28 | #ifdef HAVE_CONFIG_H | 28 | #ifdef HAVE_CONFIG_H |
29 | #include <config.h> | 29 | #include "config.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include "icaltime.h" | 32 | #include "icaltime.h" |
@@ -34,140 +34,223 @@ | |||
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <time.h> | ||
37 | 38 | ||
38 | int snprintf(char *str, size_t n, char const *fmt, ...); | 39 | #include "astime.h" /* Julian data handling routines */ |
39 | 40 | ||
40 | #ifdef ICAL_NO_LIBICAL | ||
41 | #define icalerror_set_errno(x) | ||
42 | #define icalerror_check_arg_rv(x,y) | ||
43 | #define icalerror_check_arg_re(x,y,z) | ||
44 | #else | ||
45 | #include "icalerror.h" | 41 | #include "icalerror.h" |
46 | #include "icalmemory.h" | 42 | #include "icalmemory.h" |
43 | |||
44 | #include "icaltimezone.h" | ||
45 | #include "icalvalue.h" | ||
46 | |||
47 | #ifdef WIN32 | ||
48 | #include <Windows.h> | ||
49 | #define ERROR error | ||
50 | #define snprintf _snprintf | ||
51 | #define strcasecmp stricmp | ||
47 | #endif | 52 | #endif |
48 | 53 | ||
54 | /* | ||
55 | * Function to convert a struct tm time specification | ||
56 | * to an ANSI time_t using the specified time zone. | ||
57 | * This is different from the standard mktime() function | ||
58 | * in that we dont want the automatic adjustments for | ||
59 | * local daylight savings time applied to the result. | ||
60 | * This function expects well-formed input. | ||
61 | */ | ||
62 | static time_t make_time(struct tm *tm, int tzm) | ||
63 | { | ||
64 | time_t tim; | ||
49 | 65 | ||
66 | static int days[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }; | ||
50 | 67 | ||
68 | /* check that year specification within range */ | ||
51 | 69 | ||
52 | struct icaltimetype | 70 | if (tm->tm_year < 70 || tm->tm_year > 138) |
53 | icaltime_from_timet(time_t tm, int is_date) | 71 | return((time_t) -1); |
54 | { | ||
55 | struct icaltimetype tt = icaltime_null_time(); | ||
56 | struct tm t; | ||
57 | 72 | ||
58 | t = *(gmtime(&tm)); | 73 | /* check that month specification within range */ |
59 | |||
60 | if(is_date == 0){ | ||
61 | tt.second = t.tm_sec; | ||
62 | tt.minute = t.tm_min; | ||
63 | tt.hour = t.tm_hour; | ||
64 | } else { | ||
65 | tt.second = tt.minute =tt.hour = 0 ; | ||
66 | } | ||
67 | 74 | ||
68 | tt.day = t.tm_mday; | 75 | if (tm->tm_mon < 0 || tm->tm_mon > 11) |
69 | tt.month = t.tm_mon + 1; | 76 | return((time_t) -1); |
70 | tt.year = t.tm_year+ 1900; | ||
71 | |||
72 | tt.is_utc = 1; | ||
73 | tt.is_date = is_date; | ||
74 | 77 | ||
75 | return tt; | 78 | /* check for upper bound of Jan 17, 2038 (to avoid possibility of |
76 | } | 79 | 32-bit arithmetic overflow) */ |
80 | |||
81 | if (tm->tm_year == 138) { | ||
82 | if (tm->tm_mon > 0) | ||
83 | return((time_t) -1); | ||
84 | else if (tm->tm_mday > 17) | ||
85 | return((time_t) -1); | ||
86 | } | ||
77 | 87 | ||
78 | /* Structure used by set_tz to hold an old value of TZ, and the new | 88 | /* |
79 | value, which is in memory we will have to free in unset_tz */ | 89 | * calculate elapsed days since start of the epoch (midnight Jan |
80 | struct set_tz_save {char* orig_tzid; char* new_env_str;}; | 90 | * 1st, 1970 UTC) 17 = number of leap years between 1900 and 1970 |
91 | * (number of leap days to subtract) | ||
92 | */ | ||
81 | 93 | ||
82 | /* Temporarily change the TZ environmental variable. */ | 94 | tim = (tm->tm_year - 70) * 365 + ((tm->tm_year - 1) / 4) - 17; |
83 | struct set_tz_save set_tz(const char* tzid) | ||
84 | { | ||
85 | 95 | ||
86 | char *orig_tzid = 0; | 96 | /* add number of days elapsed in the current year */ |
87 | char *new_env_str; | ||
88 | struct set_tz_save savetz; | ||
89 | size_t tmp_sz; | ||
90 | 97 | ||
91 | savetz.orig_tzid = 0; | 98 | tim += days[tm->tm_mon]; |
92 | savetz.new_env_str = 0; | ||
93 | 99 | ||
94 | if(getenv("TZ") != 0){ | 100 | /* check and adjust for leap years (the leap year check only valid |
95 | orig_tzid = (char*)icalmemory_strdup(getenv("TZ")); | 101 | during the 32-bit era */ |
96 | 102 | ||
97 | if(orig_tzid == 0){ | 103 | if ((tm->tm_year & 3) == 0 && tm->tm_mon > 1) |
98 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 104 | tim += 1; |
99 | return savetz; | ||
100 | } | ||
101 | } | ||
102 | 105 | ||
103 | tmp_sz =strlen(tzid)+4; | 106 | /* elapsed days to current date */ |
104 | new_env_str = (char*)malloc(tmp_sz); | ||
105 | 107 | ||
106 | if(new_env_str == 0){ | 108 | tim += tm->tm_mday; |
107 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
108 | return savetz; | ||
109 | } | ||
110 | |||
111 | /* Copy the TZid into a string with the form that putenv expects. */ | ||
112 | strcpy(new_env_str,"TZ="); | ||
113 | strcpy(new_env_str+3,tzid); | ||
114 | 109 | ||
115 | putenv(new_env_str); | ||
116 | 110 | ||
117 | /* Old value of TZ and the string we will have to free later */ | 111 | /* calculate elapsed hours since start of the epoch */ |
118 | savetz.orig_tzid = orig_tzid; | 112 | |
119 | savetz.new_env_str = new_env_str; | 113 | tim = tim * 24 + tm->tm_hour; |
120 | return savetz; | 114 | |
115 | /* calculate elapsed minutes since start of the epoch */ | ||
116 | |||
117 | tim = tim * 60 + tm->tm_min; | ||
118 | |||
119 | /* adjust per time zone specification */ | ||
120 | |||
121 | tim -= tzm; | ||
122 | |||
123 | /* calculate elapsed seconds since start of the epoch */ | ||
124 | |||
125 | tim = tim * 60 + tm->tm_sec; | ||
126 | |||
127 | /* return number of seconds since start of the epoch */ | ||
128 | |||
129 | return(tim); | ||
121 | } | 130 | } |
122 | 131 | ||
123 | void unset_tz(struct set_tz_save savetz) | 132 | /**@brief Constructor (deprecated). |
133 | * | ||
134 | * Convert seconds past UNIX epoch to a timetype. | ||
135 | * | ||
136 | * @deprecated This constructor is deprecated and shouldn't be used in | ||
137 | * new software. Use icaltime_from_timet_with_zone(time_t, int, | ||
138 | * icaltimezone *) instead. In the meantime, calls to this method | ||
139 | * return a floating time, which can always be converted to a local | ||
140 | * time with an appropriate call to icaltime_convert_to_zone(). | ||
141 | */ | ||
142 | |||
143 | struct icaltimetype | ||
144 | icaltime_from_timet(const time_t tm, const int is_date) | ||
124 | { | 145 | { |
125 | /* restore the original TZ environment */ | 146 | #ifndef NO_WARN_DEPRECATED |
147 | icalerror_warn("icaltime_from_timet() is DEPRECATED, use icaltime_from_timet_with_zone() instead"); | ||
148 | #endif | ||
126 | 149 | ||
127 | char* orig_tzid = savetz.orig_tzid; | 150 | return icaltime_from_timet_with_zone(tm, is_date, 0); |
151 | } | ||
128 | 152 | ||
129 | if(orig_tzid!=0){ | ||
130 | size_t tmp_sz =strlen(orig_tzid)+4; | ||
131 | char* orig_env_str = (char*)icalmemory_tmp_buffer(tmp_sz); | ||
132 | 153 | ||
133 | if(orig_env_str == 0){ | 154 | /**@brief Constructor. |
134 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 155 | * |
135 | return; | 156 | *@param tm The time |
136 | } | 157 | *@param is_date Boolean: 1 means we should treat tm as a DATE |
137 | 158 | *@param zone The timezone tm is in, NULL means to treat tm as a | |
138 | strcpy(orig_env_str,"TZ="); | 159 | * floating time |
139 | strcpy(orig_env_str+3,orig_tzid); | 160 | * |
140 | #ifndef _WIN32 | 161 | *Return a new icaltime instance, initialized to the given time |
141 | setenv("TZ", savetz.orig_tzid,1 ); | 162 | *expressed as seconds past UNIX epoch, optionally using the given |
142 | #else | 163 | *timezone. |
143 | putenv("TZ=MEZ");//, savetz.orig_tzid ); | 164 | * |
144 | #endif | 165 | *If the caller specifies the is_date param as TRUE, the returned |
145 | free(orig_tzid); | 166 | *object is of DATE type, otherwise the input is meant to be of |
146 | } else { | 167 | *DATE-TIME type. |
147 | #ifdef __FreeBSD__ | 168 | *If the zone is not specified (NULL zone param) the time is taken |
148 | unsetenv("TZ"); | 169 | *to be floating, that is, valid in any timezone. Note that, in |
170 | *addition to the uses specified in [RFC2445], this can be used | ||
171 | *when doing simple math on couples of times. | ||
172 | *If the zone is specified (UTC or otherwise), it's stored in the | ||
173 | *object and it's used as the native timezone for this object. | ||
174 | *This means that the caller can convert this time to a different | ||
175 | *target timezone with no need to store the source timezone. | ||
176 | * | ||
177 | */ | ||
178 | struct icaltimetype | ||
179 | icaltime_from_timet_with_zone(const time_t tm, const int is_date, | ||
180 | const icaltimezone *zone) | ||
181 | { | ||
182 | struct icaltimetype tt = icaltime_null_time(); | ||
183 | struct tm t; | ||
184 | icaltimezone *utc_zone; | ||
185 | |||
186 | /* Convert the time_t to a struct tm. We can trust gmtime for this. */ | ||
187 | #ifdef HAVE_GMTIME_R | ||
188 | gmtime_r(&tm, &t); | ||
149 | #else | 189 | #else |
150 | putenv("TZ"); /* Delete from environment */ | 190 | { |
191 | struct tm *t_ptr = gmtime(&tm); | ||
192 | t = *t_ptr; | ||
193 | } | ||
151 | #endif | 194 | #endif |
152 | } | ||
153 | 195 | ||
154 | if(savetz.new_env_str != 0){ | 196 | tt.year = t.tm_year + 1900; |
155 | free(savetz.new_env_str); | 197 | tt.month = t.tm_mon + 1; |
198 | tt.day = t.tm_mday; | ||
199 | |||
200 | if (is_date) { | ||
201 | tt.is_date = 1; | ||
202 | return tt; | ||
156 | } | 203 | } |
204 | |||
205 | tt.hour = t.tm_hour; | ||
206 | tt.minute = t.tm_min; | ||
207 | tt.second = t.tm_sec; | ||
208 | |||
209 | /* If it's a floating time, we don't do any conversion. */ | ||
210 | if (zone == NULL) { | ||
211 | return tt; | ||
212 | } | ||
213 | |||
214 | utc_zone = icaltimezone_get_utc_timezone (); | ||
215 | tt.is_utc = (zone == utc_zone) ? 1 : 0; | ||
216 | tt.zone = zone; | ||
217 | |||
218 | return tt; | ||
157 | } | 219 | } |
158 | 220 | ||
221 | /**@brief Convenience constructor. | ||
222 | * | ||
223 | * Returns the current time in the given timezone, as an icaltimetype. | ||
224 | */ | ||
225 | struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone) | ||
226 | { | ||
227 | return icaltime_from_timet_with_zone (time (NULL), 0, zone); | ||
228 | } | ||
159 | 229 | ||
160 | time_t icaltime_as_timet(struct icaltimetype tt) | 230 | /**@brief Convenience constructor. |
231 | * | ||
232 | * Returns the current day as an icaltimetype, with is_date set. | ||
233 | */ | ||
234 | struct icaltimetype icaltime_today(void) | ||
235 | { | ||
236 | return icaltime_from_timet_with_zone (time (NULL), 1, NULL); | ||
237 | } | ||
238 | |||
239 | /** @briefReturn the time as seconds past the UNIX epoch | ||
240 | */ | ||
241 | time_t icaltime_as_timet(const struct icaltimetype tt) | ||
161 | { | 242 | { |
162 | struct tm stm; | 243 | struct tm stm; |
163 | time_t t; | 244 | time_t t; |
164 | 245 | ||
165 | memset(&stm,0,sizeof( struct tm)); | 246 | /* If the time is the special null time, return 0. */ |
166 | 247 | if (icaltime_is_null_time(tt)) { | |
167 | if(icaltime_is_null_time(tt)) { | ||
168 | return 0; | 248 | return 0; |
169 | } | 249 | } |
170 | 250 | ||
251 | /* Copy the icaltimetype to a struct tm. */ | ||
252 | memset (&stm, 0, sizeof (struct tm)); | ||
253 | |||
171 | stm.tm_sec = tt.second; | 254 | stm.tm_sec = tt.second; |
172 | stm.tm_min = tt.minute; | 255 | stm.tm_min = tt.minute; |
173 | stm.tm_hour = tt.hour; | 256 | stm.tm_hour = tt.hour; |
@@ -176,19 +259,57 @@ time_t icaltime_as_timet(struct icaltimetype tt) | |||
176 | stm.tm_year = tt.year-1900; | 259 | stm.tm_year = tt.year-1900; |
177 | stm.tm_isdst = -1; | 260 | stm.tm_isdst = -1; |
178 | 261 | ||
179 | if(tt.is_utc == 1 || tt.is_date == 1){ | 262 | t = make_time(&stm, 0); |
180 | struct set_tz_save old_tz = set_tz("UTC"); | ||
181 | t = mktime(&stm); | ||
182 | unset_tz(old_tz); | ||
183 | } else { | ||
184 | t = mktime(&stm); | ||
185 | } | ||
186 | 263 | ||
187 | return t; | 264 | return t; |
188 | 265 | ||
189 | } | 266 | } |
190 | 267 | ||
191 | char* icaltime_as_ical_string(struct icaltimetype tt) | 268 | /** @briefReturn the time as seconds past the UNIX epoch, using the |
269 | *given timezone. | ||
270 | * | ||
271 | *This convenience method combines a call to icaltime_convert() with | ||
272 | *a call to icaltime_as_timet(). | ||
273 | *If the input timezone is null, no conversion is done; that is, the | ||
274 | *time is simply returned as time_t in its native timezone. | ||
275 | */ | ||
276 | time_t icaltime_as_timet_with_zone(const struct icaltimetype _tt, | ||
277 | const icaltimezone *zone) | ||
278 | { | ||
279 | struct icaltimetype tt = _tt; | ||
280 | struct tm stm; | ||
281 | time_t t; | ||
282 | |||
283 | /* If the time is the special null time, return 0. */ | ||
284 | if (icaltime_is_null_time(tt)) { | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | if (zone != NULL) { | ||
289 | tt = icaltime_convert_to_zone(_tt, zone); | ||
290 | } | ||
291 | |||
292 | /* Copy the icaltimetype to a struct tm. */ | ||
293 | memset (&stm, 0, sizeof (struct tm)); | ||
294 | |||
295 | stm.tm_sec = tt.second; | ||
296 | stm.tm_min = tt.minute; | ||
297 | stm.tm_hour = tt.hour; | ||
298 | stm.tm_mday = tt.day; | ||
299 | stm.tm_mon = tt.month-1; | ||
300 | stm.tm_year = tt.year-1900; | ||
301 | stm.tm_isdst = -1; | ||
302 | |||
303 | t = make_time(&stm, 0); | ||
304 | |||
305 | return t; | ||
306 | } | ||
307 | |||
308 | /** | ||
309 | * Return a string represention of the time, in RFC2445 format. The | ||
310 | * string is owned by libical | ||
311 | */ | ||
312 | const char* icaltime_as_ical_string(const struct icaltimetype tt) | ||
192 | { | 313 | { |
193 | size_t size = 17; | 314 | size_t size = 17; |
194 | char* buf = icalmemory_new_buffer(size); | 315 | char* buf = icalmemory_new_buffer(size); |
@@ -212,107 +333,33 @@ char* icaltime_as_ical_string(struct icaltimetype tt) | |||
212 | 333 | ||
213 | } | 334 | } |
214 | 335 | ||
215 | 336 | /** | |
216 | /* convert tt, of timezone tzid, into a utc time */ | 337 | *Reset all of the time components to be in their normal ranges. For |
217 | struct icaltimetype icaltime_as_utc(struct icaltimetype tt,const char* tzid) | 338 | *instance, given a time with minutes=70, the minutes will be reduces |
218 | { | 339 | *to 10, and the hour incremented. This allows the caller to do |
219 | int tzid_offset; | 340 | *arithmetic on times without worrying about overflow or |
220 | 341 | *underflow. | |
221 | if(tt.is_utc == 1 || tt.is_date == 1){ | 342 | * |
222 | return tt; | 343 | *Implementation note: we call icaltime_adjust() with no adjustment. |
223 | } | 344 | */ |
224 | 345 | struct icaltimetype icaltime_normalize(const struct icaltimetype tt) | |
225 | tzid_offset = icaltime_utc_offset(tt,tzid); | ||
226 | |||
227 | tt.second -= tzid_offset; | ||
228 | |||
229 | tt.is_utc = 1; | ||
230 | |||
231 | return icaltime_normalize(tt); | ||
232 | } | ||
233 | |||
234 | /* convert tt, a time in UTC, into a time in timezone tzid */ | ||
235 | struct icaltimetype icaltime_as_zone(struct icaltimetype tt,const char* tzid) | ||
236 | { | 346 | { |
237 | int tzid_offset; | 347 | struct icaltimetype ret = tt; |
238 | 348 | icaltime_adjust(&ret, 0, 0, 0, 0); | |
239 | tzid_offset = icaltime_utc_offset(tt,tzid); | 349 | return ret; |
240 | |||
241 | tt.second += tzid_offset; | ||
242 | |||
243 | tt.is_utc = 0; | ||
244 | |||
245 | return icaltime_normalize(tt); | ||
246 | |||
247 | } | ||
248 | |||
249 | |||
250 | /* Return the offset of the named zone as seconds. tt is a time | ||
251 | indicating the date for which you want the offset */ | ||
252 | int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid) | ||
253 | { | ||
254 | |||
255 | time_t tt = icaltime_as_timet(ictt); | ||
256 | time_t offset_tt; | ||
257 | struct tm gtm; | ||
258 | struct set_tz_save old_tz; | ||
259 | |||
260 | if(tzid != 0){ | ||
261 | old_tz = set_tz(tzid); | ||
262 | } | ||
263 | |||
264 | /* Mis-interpret a UTC broken out time as local time */ | ||
265 | gtm = *(gmtime(&tt)); | ||
266 | gtm.tm_isdst = localtime(&tt)->tm_isdst; | ||
267 | offset_tt = mktime(>m); | ||
268 | |||
269 | if(tzid != 0){ | ||
270 | unset_tz(old_tz); | ||
271 | } | ||
272 | |||
273 | return tt-offset_tt; | ||
274 | } | ||
275 | |||
276 | |||
277 | |||
278 | /* Normalize by converting from localtime to utc and back to local | ||
279 | time. This uses localtime because localtime and mktime are inverses | ||
280 | of each other */ | ||
281 | |||
282 | struct icaltimetype icaltime_normalize(struct icaltimetype tt) | ||
283 | { | ||
284 | struct tm stm; | ||
285 | time_t tut; | ||
286 | |||
287 | memset(&stm,0,sizeof( struct tm)); | ||
288 | |||
289 | stm.tm_sec = tt.second; | ||
290 | stm.tm_min = tt.minute; | ||
291 | stm.tm_hour = tt.hour; | ||
292 | stm.tm_mday = tt.day; | ||
293 | stm.tm_mon = tt.month-1; | ||
294 | stm.tm_year = tt.year-1900; | ||
295 | stm.tm_isdst = -1; /* prevents mktime from changing hour based on | ||
296 | daylight savings */ | ||
297 | |||
298 | tut = mktime(&stm); | ||
299 | |||
300 | stm = *(localtime(&tut)); | ||
301 | |||
302 | tt.second = stm.tm_sec; | ||
303 | tt.minute = stm.tm_min; | ||
304 | tt.hour = stm.tm_hour; | ||
305 | tt.day = stm.tm_mday; | ||
306 | tt.month = stm.tm_mon +1; | ||
307 | tt.year = stm.tm_year+1900; | ||
308 | |||
309 | return tt; | ||
310 | } | 350 | } |
311 | 351 | ||
312 | 352 | ||
313 | #ifndef ICAL_NO_LIBICAL | ||
314 | #include "icalvalue.h" | ||
315 | 353 | ||
354 | /**@brief Contructor. | ||
355 | * | ||
356 | * Create a time from an ISO format string. | ||
357 | * | ||
358 | * @todo If the given string specifies a DATE-TIME not in UTC, there | ||
359 | * is no way to know if this is a floating time or really refers to a | ||
360 | * timezone. We should probably add a new constructor: | ||
361 | * icaltime_from_string_with_zone() | ||
362 | */ | ||
316 | struct icaltimetype icaltime_from_string(const char* str) | 363 | struct icaltimetype icaltime_from_string(const char* str) |
317 | { | 364 | { |
318 | struct icaltimetype tt = icaltime_null_time(); | 365 | struct icaltimetype tt = icaltime_null_time(); |
@@ -326,189 +373,230 @@ struct icaltimetype icaltime_from_string(const char* str) | |||
326 | tt.is_utc = 0; | 373 | tt.is_utc = 0; |
327 | tt.is_date = 0; | 374 | tt.is_date = 0; |
328 | } else if (size == 16) { /* UTC time, ends in 'Z'*/ | 375 | } else if (size == 16) { /* UTC time, ends in 'Z'*/ |
376 | if(str[15] != 'Z') | ||
377 | goto ERROR; | ||
378 | |||
329 | tt.is_utc = 1; | 379 | tt.is_utc = 1; |
380 | tt.zone = icaltimezone_get_utc_timezone(); | ||
330 | tt.is_date = 0; | 381 | tt.is_date = 0; |
331 | |||
332 | if(str[15] != 'Z'){ | ||
333 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
334 | return icaltime_null_time(); | ||
335 | } | ||
336 | |||
337 | } else if (size == 8) { /* A DATE */ | 382 | } else if (size == 8) { /* A DATE */ |
338 | tt.is_utc = 1; | 383 | tt.is_utc = 1; |
339 | tt.is_date = 1; | 384 | tt.is_date = 1; |
340 | } else { /* error */ | 385 | } else { /* error */ |
341 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 386 | goto ERROR; |
342 | return icaltime_null_time(); | ||
343 | } | 387 | } |
344 | 388 | ||
345 | if(tt.is_date == 1){ | 389 | if(tt.is_date == 1){ |
346 | sscanf(str,"%04d%02d%02d",&tt.year,&tt.month,&tt.day); | 390 | if (sscanf(str,"%04d%02d%02d",&tt.year,&tt.month,&tt.day) < 3) |
391 | goto ERROR; | ||
347 | } else { | 392 | } else { |
348 | char tsep; | 393 | char tsep; |
349 | sscanf(str,"%04d%02d%02d%c%02d%02d%02d",&tt.year,&tt.month,&tt.day, | 394 | if (sscanf(str,"%04d%02d%02d%c%02d%02d%02d",&tt.year,&tt.month,&tt.day, |
350 | &tsep,&tt.hour,&tt.minute,&tt.second); | 395 | &tsep,&tt.hour,&tt.minute,&tt.second) < 7) |
351 | 396 | goto ERROR; | |
352 | if(tsep != 'T'){ | ||
353 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
354 | return icaltime_null_time(); | ||
355 | } | ||
356 | 397 | ||
398 | if(tsep != 'T') | ||
399 | goto ERROR; | ||
357 | } | 400 | } |
358 | 401 | ||
359 | return tt; | 402 | return tt; |
403 | |||
404 | ERROR: | ||
405 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
406 | return icaltime_null_time(); | ||
360 | } | 407 | } |
361 | #endif | ||
362 | 408 | ||
363 | char ctime_str[20]; | ||
364 | char* icaltime_as_ctime(struct icaltimetype t) | ||
365 | { | ||
366 | time_t tt; | ||
367 | |||
368 | tt = icaltime_as_timet(t); | ||
369 | sprintf(ctime_str,"%s",ctime(&tt)); | ||
370 | 409 | ||
371 | ctime_str[strlen(ctime_str)-1] = 0; | 410 | /* Returns whether the specified year is a leap year. Year is the normal year, |
411 | e.g. 2001. */ | ||
412 | int | ||
413 | icaltime_is_leap_year (const int year) | ||
414 | { | ||
372 | 415 | ||
373 | return ctime_str; | 416 | if (year <= 1752) |
417 | return (year % 4 == 0); | ||
418 | else | ||
419 | return ( (year % 4==0) && (year % 100 !=0 )) || (year % 400 == 0); | ||
374 | } | 420 | } |
375 | 421 | ||
422 | static int _days_in_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; | ||
376 | 423 | ||
377 | short days_in_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; | 424 | int icaltime_days_in_month(const int month, const int year) |
378 | |||
379 | short icaltime_days_in_month(short month,short year) | ||
380 | { | 425 | { |
381 | 426 | ||
382 | int is_leap =0; | 427 | int days = _days_in_month[month]; |
383 | int days = days_in_month[month]; | ||
384 | 428 | ||
385 | assert(month > 0); | 429 | assert(month > 0); |
386 | assert(month <= 12); | 430 | assert(month <= 12); |
387 | 431 | ||
388 | if( (year % 4 == 0 && year % 100 != 0) || | ||
389 | year % 400 == 0){ | ||
390 | is_leap =1; | ||
391 | } | ||
392 | |||
393 | if( month == 2){ | 432 | if( month == 2){ |
394 | days += is_leap; | 433 | days += icaltime_is_leap_year(year); |
395 | } | 434 | } |
396 | 435 | ||
397 | return days; | 436 | return days; |
398 | } | 437 | } |
399 | 438 | ||
400 | /* 1-> Sunday, 7->Saturday */ | 439 | /* 1-> Sunday, 7->Saturday */ |
401 | short icaltime_day_of_week(struct icaltimetype t){ | 440 | int icaltime_day_of_week(const struct icaltimetype t){ |
441 | UTinstant jt; | ||
402 | 442 | ||
403 | time_t tt = icaltime_as_timet(t); | 443 | memset(&jt,0,sizeof(UTinstant)); |
404 | struct tm *tm; | ||
405 | 444 | ||
406 | if(t.is_utc == 1 || t.is_date == 1){ | 445 | jt.year = t.year; |
407 | tm = gmtime(&tt); | 446 | jt.month = t.month; |
408 | } else { | 447 | jt.day = t.day; |
409 | tm = localtime(&tt); | 448 | jt.i_hour = 0; |
410 | } | 449 | jt.i_minute = 0; |
450 | jt.i_second = 0; | ||
451 | |||
452 | juldat(&jt); | ||
411 | 453 | ||
412 | return tm->tm_wday+1; | 454 | return jt.weekday + 1; |
413 | } | 455 | } |
414 | 456 | ||
415 | /* Day of the year that the first day of the week (Sunday) is on */ | 457 | /** Day of the year that the first day of the week (Sunday) is on. |
416 | short icaltime_start_doy_of_week(struct icaltimetype t){ | 458 | * |
417 | time_t tt = icaltime_as_timet(t); | 459 | * @todo Doesn't take into account different week start days. |
418 | time_t start_tt; | 460 | */ |
419 | struct tm *stm; | 461 | int icaltime_start_doy_of_week(const struct icaltimetype t){ |
420 | int syear; | 462 | UTinstant jt; |
421 | 463 | ||
422 | stm = gmtime(&tt); | 464 | memset(&jt,0,sizeof(UTinstant)); |
423 | syear = stm->tm_year; | ||
424 | 465 | ||
425 | start_tt = tt - stm->tm_wday*(60*60*24); | 466 | jt.year = t.year; |
467 | jt.month = t.month; | ||
468 | jt.day = t.day; | ||
469 | jt.i_hour = 0; | ||
470 | jt.i_minute = 0; | ||
471 | jt.i_second = 0; | ||
426 | 472 | ||
427 | stm = gmtime(&start_tt); | 473 | juldat(&jt); |
428 | 474 | caldat(&jt); | |
429 | if(syear == stm->tm_year){ | ||
430 | return stm->tm_yday+1; | ||
431 | } else { | ||
432 | /* return negative to indicate that start of week is in | ||
433 | previous year. */ | ||
434 | int is_leap = 0; | ||
435 | int year = stm->tm_year; | ||
436 | |||
437 | if( (year % 4 == 0 && year % 100 != 0) || | ||
438 | year % 400 == 0){ | ||
439 | is_leap =1; | ||
440 | } | ||
441 | 475 | ||
442 | return (stm->tm_yday+1)-(365+is_leap); | 476 | return jt.day_of_year - jt.weekday; |
443 | } | ||
444 | |||
445 | } | 477 | } |
446 | 478 | ||
447 | short icaltime_week_number(struct icaltimetype ictt) | 479 | /** |
480 | * @todo Doesn't take into account the start day of the | ||
481 | * week. strftime assumes that weeks start on Monday. | ||
482 | */ | ||
483 | int icaltime_week_number(const struct icaltimetype ictt) | ||
448 | { | 484 | { |
449 | char str[5]; | 485 | UTinstant jt; |
450 | time_t t = icaltime_as_timet(ictt); | ||
451 | int week_no; | ||
452 | 486 | ||
453 | strftime(str,5,"%V", gmtime(&t)); | 487 | memset(&jt,0,sizeof(UTinstant)); |
454 | 488 | ||
455 | week_no = atoi(str); | 489 | jt.year = ictt.year; |
490 | jt.month = ictt.month; | ||
491 | jt.day = ictt.day; | ||
492 | jt.i_hour = 0; | ||
493 | jt.i_minute = 0; | ||
494 | jt.i_second = 0; | ||
456 | 495 | ||
457 | return week_no; | 496 | juldat(&jt); |
497 | caldat(&jt); | ||
458 | 498 | ||
499 | return (jt.day_of_year - jt.weekday) / 7; | ||
459 | } | 500 | } |
460 | 501 | ||
502 | /* The first array is for non-leap years, the second for leap years*/ | ||
503 | static const int days_in_year[2][13] = | ||
504 | { /* jan feb mar apr may jun jul aug sep oct nov dec */ | ||
505 | { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, | ||
506 | { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } | ||
507 | }; | ||
461 | 508 | ||
462 | short icaltime_day_of_year(struct icaltimetype t){ | 509 | /** |
463 | time_t tt; | 510 | *Returns the day of the year, counting from 1 (Jan 1st). |
464 | struct tm *stm; | 511 | */ |
465 | struct set_tz_save old_tz; | 512 | int icaltime_day_of_year(const struct icaltimetype t){ |
466 | 513 | int is_leap = icaltime_is_leap_year (t.year); | |
467 | tt = icaltime_as_timet(t); | ||
468 | 514 | ||
469 | old_tz = set_tz("UTC"); | 515 | return days_in_year[is_leap][t.month - 1] + t.day; |
470 | stm = localtime(&tt); | ||
471 | unset_tz(old_tz); | ||
472 | |||
473 | return stm->tm_yday+1; | ||
474 | |||
475 | } | 516 | } |
476 | 517 | ||
518 | /**@brief Contructor. | ||
519 | * | ||
520 | *Create a new time, given a day of year and a year. | ||
521 | */ | ||
477 | /* Jan 1 is day #1, not 0 */ | 522 | /* Jan 1 is day #1, not 0 */ |
478 | struct icaltimetype icaltime_from_day_of_year(short doy, short year) | 523 | struct icaltimetype icaltime_from_day_of_year(const int _doy, const int _year) |
479 | { | 524 | { |
480 | struct tm stm; | 525 | struct icaltimetype tt = icaltime_null_date(); |
481 | time_t tt; | 526 | int is_leap; |
482 | struct set_tz_save old_tz; | 527 | int month; |
483 | 528 | int doy = _doy; | |
484 | /* Get the time of january 1 of this year*/ | 529 | int year = _year; |
485 | memset(&stm,0,sizeof(struct tm)); | 530 | |
486 | stm.tm_year = year-1900; | 531 | is_leap = icaltime_is_leap_year(year); |
487 | stm.tm_mday = 1; | 532 | |
533 | /* Zero and neg numbers represent days of the previous year */ | ||
534 | if(doy <1){ | ||
535 | year--; | ||
536 | is_leap = icaltime_is_leap_year(year); | ||
537 | doy += days_in_year[is_leap][12]; | ||
538 | } else if(doy > days_in_year[is_leap][12]){ | ||
539 | /* Move on to the next year*/ | ||
540 | is_leap = icaltime_is_leap_year(year); | ||
541 | doy -= days_in_year[is_leap][12]; | ||
542 | year++; | ||
543 | } | ||
488 | 544 | ||
489 | old_tz = set_tz("UTC"); | 545 | tt.year = year; |
490 | tt = mktime(&stm); | ||
491 | unset_tz(old_tz); | ||
492 | 546 | ||
547 | for (month = 11; month >= 0; month--) { | ||
548 | if (doy > days_in_year[is_leap][month]) { | ||
549 | tt.month = month + 1; | ||
550 | tt.day = doy - days_in_year[is_leap][month]; | ||
551 | break; | ||
552 | } | ||
553 | } | ||
493 | 554 | ||
494 | /* Now add in the days */ | 555 | return tt; |
556 | } | ||
495 | 557 | ||
496 | doy--; | 558 | /**@brief Constructor. |
497 | tt += doy *60*60*24; | 559 | * |
560 | *Return a null time, which indicates no time has been set. | ||
561 | *This time represents the beginning of the epoch. | ||
562 | */ | ||
563 | struct icaltimetype icaltime_null_time(void) | ||
564 | { | ||
565 | struct icaltimetype t; | ||
566 | memset(&t,0,sizeof(struct icaltimetype)); | ||
498 | 567 | ||
499 | return icaltime_from_timet(tt, 1); | 568 | return t; |
500 | } | 569 | } |
501 | 570 | ||
502 | struct icaltimetype icaltime_null_time() | 571 | /**@brief Constructor. |
572 | * | ||
573 | *Return a null date, which indicates no time has been set. | ||
574 | */ | ||
575 | struct icaltimetype icaltime_null_date(void) | ||
503 | { | 576 | { |
504 | struct icaltimetype t; | 577 | struct icaltimetype t; |
505 | memset(&t,0,sizeof(struct icaltimetype)); | 578 | memset(&t,0,sizeof(struct icaltimetype)); |
506 | 579 | ||
580 | t.is_date = 1; | ||
581 | |||
582 | /* | ||
583 | * Init to -1 to match what icalyacc.y used to do. | ||
584 | * Does anything depend on this? | ||
585 | */ | ||
586 | t.hour = -1; | ||
587 | t.minute = -1; | ||
588 | t.second = -1; | ||
589 | |||
507 | return t; | 590 | return t; |
508 | } | 591 | } |
509 | 592 | ||
510 | 593 | ||
511 | int icaltime_is_valid_time(struct icaltimetype t){ | 594 | /** |
595 | *Returns false if the time is clearly invalid, but is not null. This | ||
596 | *is usually the result of creating a new time type buy not clearing | ||
597 | *it, or setting one of the flags to an illegal value. | ||
598 | */ | ||
599 | int icaltime_is_valid_time(const struct icaltimetype t){ | ||
512 | if(t.is_utc > 1 || t.is_utc < 0 || | 600 | if(t.is_utc > 1 || t.is_utc < 0 || |
513 | t.year < 0 || t.year > 3000 || | 601 | t.year < 0 || t.year > 3000 || |
514 | t.is_date > 1 || t.is_date < 0){ | 602 | t.is_date > 1 || t.is_date < 0){ |
@@ -519,7 +607,26 @@ int icaltime_is_valid_time(struct icaltimetype t){ | |||
519 | 607 | ||
520 | } | 608 | } |
521 | 609 | ||
522 | int icaltime_is_null_time(struct icaltimetype t) | 610 | /**@brief Returns true if time is a DATE |
611 | */ | ||
612 | int icaltime_is_date(const struct icaltimetype t) { | ||
613 | |||
614 | return t.is_date; | ||
615 | } | ||
616 | |||
617 | /**@brief Returns true if time is relative to UTC zone | ||
618 | * | ||
619 | *@todo We should only check the zone | ||
620 | */ | ||
621 | int icaltime_is_utc(const struct icaltimetype t) { | ||
622 | |||
623 | return t.is_utc; | ||
624 | } | ||
625 | |||
626 | /** | ||
627 | *Return true if the time is null. | ||
628 | */ | ||
629 | int icaltime_is_null_time(const struct icaltimetype t) | ||
523 | { | 630 | { |
524 | if (t.second +t.minute+t.hour+t.day+t.month+t.year == 0){ | 631 | if (t.second +t.minute+t.hour+t.day+t.month+t.year == 0){ |
525 | return 1; | 632 | return 1; |
@@ -529,44 +636,101 @@ int icaltime_is_null_time(struct icaltimetype t) | |||
529 | 636 | ||
530 | } | 637 | } |
531 | 638 | ||
532 | int icaltime_compare(struct icaltimetype a,struct icaltimetype b) | 639 | /** |
533 | { | 640 | *Return -1, 0, or 1 to indicate that a<b, a==b, or a>b. |
534 | time_t t1 = icaltime_as_timet(a); | 641 | * This calls icaltime_compare function after converting them to the utc |
535 | time_t t2 = icaltime_as_timet(b); | 642 | * timezone. |
536 | 643 | */ | |
537 | if (t1 > t2) { | ||
538 | return 1; | ||
539 | } else if (t1 < t2) { | ||
540 | return -1; | ||
541 | } else { | ||
542 | return 0; | ||
543 | } | ||
544 | 644 | ||
645 | int icaltime_compare(const struct icaltimetype a_in, const struct icaltimetype b_in) | ||
646 | { | ||
647 | int retval = 0; | ||
648 | struct icaltimetype a, b; | ||
649 | |||
650 | a = icaltime_convert_to_zone(a_in, icaltimezone_get_utc_timezone()); | ||
651 | b = icaltime_convert_to_zone(b_in, icaltimezone_get_utc_timezone()); | ||
652 | |||
653 | if (a.year > b.year) | ||
654 | retval = 1; | ||
655 | else if (a.year < b.year) | ||
656 | retval = -1; | ||
657 | |||
658 | else if (a.month > b.month) | ||
659 | retval = 1; | ||
660 | else if (a.month < b.month) | ||
661 | retval = -1; | ||
662 | |||
663 | else if (a.day > b.day) | ||
664 | retval = 1; | ||
665 | else if (a.day < b.day) | ||
666 | retval = -1; | ||
667 | |||
668 | /* if both are dates, we are done */ | ||
669 | if (a.is_date && b.is_date) | ||
670 | return retval; | ||
671 | |||
672 | /* else, if we already found a difference, we are done */ | ||
673 | else if (retval != 0) | ||
674 | return retval; | ||
675 | |||
676 | /* else, if only one is a date (and we already know the date part is equal), | ||
677 | then the other is greater */ | ||
678 | else if (b.is_date) | ||
679 | retval = 1; | ||
680 | else if (a.is_date) | ||
681 | retval = -1; | ||
682 | |||
683 | else if (a.hour > b.hour) | ||
684 | retval = 1; | ||
685 | else if (a.hour < b.hour) | ||
686 | retval = -1; | ||
687 | |||
688 | else if (a.minute > b.minute) | ||
689 | retval = 1; | ||
690 | else if (a.minute < b.minute) | ||
691 | retval = -1; | ||
692 | |||
693 | else if (a.second > b.second) | ||
694 | retval = 1; | ||
695 | else if (a.second < b.second) | ||
696 | retval = -1; | ||
697 | |||
698 | return retval; | ||
545 | } | 699 | } |
546 | 700 | ||
701 | /** | ||
702 | *like icaltime_compare, but only use the date parts. | ||
703 | */ | ||
704 | |||
547 | int | 705 | int |
548 | icaltime_compare_date_only (struct icaltimetype a, struct icaltimetype b) | 706 | icaltime_compare_date_only(const struct icaltimetype a_in, const struct icaltimetype b_in) |
549 | { | 707 | { |
550 | time_t t1; | 708 | int retval; |
551 | time_t t2; | 709 | struct icaltimetype a, b; |
552 | 710 | ||
553 | if (a.year == b.year && a.month == b.month && a.day == b.day) | 711 | a = icaltime_convert_to_zone(a_in, icaltimezone_get_utc_timezone()); |
554 | return 0; | 712 | b = icaltime_convert_to_zone(b_in, icaltimezone_get_utc_timezone()); |
555 | 713 | ||
556 | t1 = icaltime_as_timet (a); | 714 | if (a.year > b.year) |
557 | t2 = icaltime_as_timet (b); | 715 | retval = 1; |
558 | 716 | else if (a.year < b.year) | |
559 | if (t1 > t2) | 717 | retval = -1; |
560 | return 1; | 718 | |
561 | else if (t1 < t2) | 719 | else if (a.month > b.month) |
562 | return -1; | 720 | retval = 1; |
563 | else { | 721 | else if (a.month < b.month) |
564 | /* not reached */ | 722 | retval = -1; |
565 | assert (0); | 723 | |
566 | return 0; | 724 | else if (a.day > b.day) |
567 | } | 725 | retval = 1; |
568 | } | 726 | else if (a.day < b.day) |
727 | retval = -1; | ||
569 | 728 | ||
729 | else | ||
730 | retval = 0; | ||
731 | |||
732 | return retval; | ||
733 | } | ||
570 | 734 | ||
571 | /* These are defined in icalduration.c: | 735 | /* These are defined in icalduration.c: |
572 | struct icaltimetype icaltime_add(struct icaltimetype t, | 736 | struct icaltimetype icaltime_add(struct icaltimetype t, |
@@ -575,3 +739,277 @@ struct icaldurationtype icaltime_subtract(struct icaltimetype t1, | |||
575 | struct icaltimetype t2) | 739 | struct icaltimetype t2) |
576 | */ | 740 | */ |
577 | 741 | ||
742 | |||
743 | |||
744 | /**@brief Internal, shouldn't be part of the public API | ||
745 | * | ||
746 | *Adds (or subtracts) a time from a icaltimetype. | ||
747 | *NOTE: This function is exactly the same as icaltimezone_adjust_change() | ||
748 | *except for the type of the first parameter. | ||
749 | */ | ||
750 | void | ||
751 | icaltime_adjust(struct icaltimetype *tt, const int days, const int hours, | ||
752 | const int minutes, const int seconds) { | ||
753 | |||
754 | int second, minute, hour, day; | ||
755 | int minutes_overflow, hours_overflow, days_overflow, years_overflow; | ||
756 | int days_in_month; | ||
757 | |||
758 | /* Add on the seconds. */ | ||
759 | second = tt->second + seconds; | ||
760 | tt->second = second % 60; | ||
761 | minutes_overflow = second / 60; | ||
762 | if (tt->second < 0) { | ||
763 | tt->second += 60; | ||
764 | minutes_overflow--; | ||
765 | } | ||
766 | |||
767 | /* Add on the minutes. */ | ||
768 | minute = tt->minute + minutes + minutes_overflow; | ||
769 | tt->minute = minute % 60; | ||
770 | hours_overflow = minute / 60; | ||
771 | if (tt->minute < 0) { | ||
772 | tt->minute += 60; | ||
773 | hours_overflow--; | ||
774 | } | ||
775 | |||
776 | /* Add on the hours. */ | ||
777 | hour = tt->hour + hours + hours_overflow; | ||
778 | tt->hour = hour % 24; | ||
779 | days_overflow = hour / 24; | ||
780 | if (tt->hour < 0) { | ||
781 | tt->hour += 24; | ||
782 | days_overflow--; | ||
783 | } | ||
784 | |||
785 | /* Normalize the month. We do this before handling the day since we may | ||
786 | need to know what month it is to get the number of days in it. | ||
787 | Note that months are 1 to 12, so we have to be a bit careful. */ | ||
788 | if (tt->month >= 13) { | ||
789 | years_overflow = (tt->month - 1) / 12; | ||
790 | tt->year += years_overflow; | ||
791 | tt->month -= years_overflow * 12; | ||
792 | } else if (tt->month <= 0) { | ||
793 | /* 0 to -11 is -1 year out, -12 to -23 is -2 years. */ | ||
794 | years_overflow = (tt->month / 12) - 1; | ||
795 | tt->year += years_overflow; | ||
796 | tt->month -= years_overflow * 12; | ||
797 | } | ||
798 | |||
799 | /* Add on the days. */ | ||
800 | day = tt->day + days + days_overflow; | ||
801 | if (day > 0) { | ||
802 | for (;;) { | ||
803 | days_in_month = icaltime_days_in_month (tt->month, tt->year); | ||
804 | if (day <= days_in_month) | ||
805 | break; | ||
806 | |||
807 | tt->month++; | ||
808 | if (tt->month >= 13) { | ||
809 | tt->year++; | ||
810 | tt->month = 1; | ||
811 | } | ||
812 | |||
813 | day -= days_in_month; | ||
814 | } | ||
815 | } else { | ||
816 | while (day <= 0) { | ||
817 | if (tt->month == 1) { | ||
818 | tt->year--; | ||
819 | tt->month = 12; | ||
820 | } else { | ||
821 | tt->month--; | ||
822 | } | ||
823 | |||
824 | day += icaltime_days_in_month (tt->month, tt->year); | ||
825 | } | ||
826 | } | ||
827 | tt->day = day; | ||
828 | } | ||
829 | |||
830 | /**@brief Convert time to a given timezone | ||
831 | * | ||
832 | *Convert a time from its native timezone to a given timezone. | ||
833 | * | ||
834 | *If tt is a date, the returned time is an exact | ||
835 | *copy of the input. If it's a floating time, the returned object | ||
836 | *represents the same time translated to the given timezone. | ||
837 | *Otherwise the time will be converted to the new | ||
838 | *time zone, and its native timezone set to the right timezone. | ||
839 | */ | ||
840 | struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, | ||
841 | icaltimezone *zone) { | ||
842 | |||
843 | struct icaltimetype ret = tt; | ||
844 | |||
845 | /* If it's a date do nothing */ | ||
846 | if (tt.is_date) { | ||
847 | return ret; | ||
848 | } | ||
849 | |||
850 | if (tt.zone == zone) { | ||
851 | return ret; | ||
852 | } | ||
853 | |||
854 | /* If it's a floating time we don't want to adjust the time */ | ||
855 | if (tt.zone != NULL) { | ||
856 | icaltimezone_convert_time(&ret, tt.zone, zone); | ||
857 | } | ||
858 | |||
859 | ret.zone = zone; | ||
860 | if (zone == icaltimezone_get_utc_timezone()) { | ||
861 | ret.is_utc = 1; | ||
862 | } else { | ||
863 | ret.is_utc = 0; | ||
864 | } | ||
865 | |||
866 | return ret; | ||
867 | } | ||
868 | |||
869 | const icaltimezone * | ||
870 | icaltime_get_timezone(const struct icaltimetype t) { | ||
871 | |||
872 | return t.zone; | ||
873 | } | ||
874 | |||
875 | char * | ||
876 | icaltime_get_tzid(const struct icaltimetype t) { | ||
877 | |||
878 | if (t.zone != NULL) { | ||
879 | return icaltimezone_get_tzid(t.zone); | ||
880 | } else { | ||
881 | return NULL; | ||
882 | } | ||
883 | } | ||
884 | |||
885 | /**@brief Set the timezone | ||
886 | * | ||
887 | *Force the icaltime to be interpreted relative to another timezone. | ||
888 | *If you need to do timezone conversion, applying offset adjustments, | ||
889 | *then you should use icaltime_convert_to_timezone instead. | ||
890 | */ | ||
891 | struct icaltimetype | ||
892 | icaltime_set_timezone(struct icaltimetype *t, const icaltimezone *zone) { | ||
893 | |||
894 | /* If it's a date do nothing */ | ||
895 | if (t->is_date) { | ||
896 | return *t; | ||
897 | } | ||
898 | |||
899 | if (t->zone == zone) { | ||
900 | return *t; | ||
901 | } | ||
902 | |||
903 | t->zone = zone; | ||
904 | if (zone == icaltimezone_get_utc_timezone()) { | ||
905 | t->is_utc = 1; | ||
906 | } else { | ||
907 | t->is_utc = 0; | ||
908 | } | ||
909 | |||
910 | return *t; | ||
911 | } | ||
912 | |||
913 | |||
914 | /** | ||
915 | * @brief builds an icaltimespan given a start time, end time and busy value. | ||
916 | * | ||
917 | * @param dtstart The beginning time of the span, can be a date-time | ||
918 | * or just a date. | ||
919 | * @param dtend The end time of the span. | ||
920 | * @param is_busy A boolean value, 0/1. | ||
921 | * @return A span using the supplied values. | ||
922 | * | ||
923 | * returned span contains times specified in UTC. | ||
924 | */ | ||
925 | |||
926 | icaltime_span icaltime_span_new(struct icaltimetype dtstart, | ||
927 | struct icaltimetype dtend, | ||
928 | int is_busy) | ||
929 | { | ||
930 | icaltime_span span; | ||
931 | |||
932 | span.is_busy = is_busy; | ||
933 | |||
934 | span.start = icaltime_as_timet_with_zone(dtstart, | ||
935 | icaltimezone_get_utc_timezone()); | ||
936 | |||
937 | if (icaltime_is_null_time(dtend)) { | ||
938 | if (!icaltime_is_date(dtstart)) { | ||
939 | /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION | ||
940 | it takes no time */ | ||
941 | span.end = span.start; | ||
942 | return span; | ||
943 | } else { | ||
944 | dtend = dtstart; | ||
945 | } | ||
946 | } | ||
947 | |||
948 | span.end = icaltime_as_timet_with_zone(dtend, icaltimezone_get_utc_timezone()); | ||
949 | |||
950 | if (icaltime_is_date(dtstart)) { | ||
951 | /* no time specified, go until the end of the day..*/ | ||
952 | span.end += 60*60*24 - 1; | ||
953 | } | ||
954 | return span; | ||
955 | } | ||
956 | |||
957 | |||
958 | /** @brief Returns true if the two spans overlap | ||
959 | * | ||
960 | * @param s1 1st span to test | ||
961 | * @param s2 2nd span to test | ||
962 | * @return boolean value | ||
963 | * | ||
964 | * The result is calculated by testing if the start time of s1 is contained | ||
965 | * by the s2 span, or if the end time of s1 is contained by the s2 span. | ||
966 | * | ||
967 | * Also returns true if the spans are equal. | ||
968 | * | ||
969 | * Note, this will return false if the spans are adjacent. | ||
970 | */ | ||
971 | |||
972 | int icaltime_span_overlaps(icaltime_span *s1, | ||
973 | icaltime_span *s2) | ||
974 | { | ||
975 | /* s1->start in s2 */ | ||
976 | if (s1->start > s2->start && s1->start < s2->end) | ||
977 | return 1; | ||
978 | |||
979 | /* s1->end in s2 */ | ||
980 | if (s1->end > s2->start && s1->end < s2->end) | ||
981 | return 1; | ||
982 | |||
983 | /* s2->start in s1 */ | ||
984 | if (s2->start > s1->start && s2->start < s1->end) | ||
985 | return 1; | ||
986 | |||
987 | /* s2->end in s1 */ | ||
988 | if (s2->end > s1->start && s2->end < s1->end) | ||
989 | return 1; | ||
990 | |||
991 | if (s1->start == s2->start && s1->end == s2->end) | ||
992 | return 1; | ||
993 | |||
994 | return 0; | ||
995 | } | ||
996 | |||
997 | /** @brief Returns true if the span is totally within the containing | ||
998 | * span | ||
999 | * | ||
1000 | * @param s The span to test for. | ||
1001 | * @param container The span to test against. | ||
1002 | * @return boolean value. | ||
1003 | * | ||
1004 | */ | ||
1005 | |||
1006 | int icaltime_span_contains(icaltime_span *s, | ||
1007 | icaltime_span *container) | ||
1008 | { | ||
1009 | |||
1010 | if ((s->start >= container->start && s->start < container->end) && | ||
1011 | (s->end <= container->end && s->end > container->start)) | ||
1012 | return 1; | ||
1013 | |||
1014 | return 0; | ||
1015 | } | ||
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 | |||
@@ -26,120 +26,248 @@ | |||
26 | 26 | ||
27 | ======================================================================*/ | 27 | ======================================================================*/ |
28 | 28 | ||
29 | /**@file icaltime.h | ||
30 | *@brief struct icaltimetype is a pseudo-object that abstracts time | ||
31 | *handling. | ||
32 | * | ||
33 | *It can represent either a DATE or a DATE-TIME (floating, UTC or in a | ||
34 | *given timezone), and it keeps track internally of its native timezone. | ||
35 | * | ||
36 | *The typical usage is to call the correct constructor specifying the | ||
37 | *desired timezone. If this is not known until a later time, the | ||
38 | *correct behavior is to specify a NULL timezone and call | ||
39 | *icaltime_convert_to_zone() at a later time. | ||
40 | * | ||
41 | *There are several ways to create a new icaltimetype: | ||
42 | * | ||
43 | *- icaltime_null_time() | ||
44 | *- icaltime_null_date() | ||
45 | *- icaltime_current_time_with_zone() | ||
46 | *- icaltime_today() | ||
47 | *- icaltime_from_timet_with_zone(time_t tm, int is_date, | ||
48 | * icaltimezone *zone) | ||
49 | * - icaltime_from_string_with_zone(const char* str, icaltimezone *zone) | ||
50 | *- icaltime_from_day_of_year(int doy, int year) | ||
51 | *- icaltime_from_week_number(int week_number, int year) | ||
52 | * | ||
53 | *italtimetype objects can be converted to different formats: | ||
54 | * | ||
55 | *- icaltime_as_timet(struct icaltimetype tt) | ||
56 | *- icaltime_as_timet_with_zone(struct icaltimetype tt, | ||
57 | * icaltimezone *zone) | ||
58 | *- icaltime_as_ical_string(struct icaltimetype tt) | ||
59 | * | ||
60 | *Accessor methods include: | ||
61 | * | ||
62 | *- icaltime_get_timezone(struct icaltimetype t) | ||
63 | *- icaltime_get_tzid(struct icaltimetype t) | ||
64 | *- icaltime_set_timezone(struct icaltimetype t, const icaltimezone *zone) | ||
65 | *- icaltime_day_of_year(struct icaltimetype t) | ||
66 | *- icaltime_day_of_week(struct icaltimetype t) | ||
67 | *- icaltime_start_doy_of_week(struct icaltimetype t) | ||
68 | *- icaltime_week_number(struct icaltimetype t) | ||
69 | * | ||
70 | *Query methods include: | ||
71 | * | ||
72 | *- icaltime_is_null_time(struct icaltimetype t) | ||
73 | *- icaltime_is_valid_time(struct icaltimetype t) | ||
74 | *- icaltime_is_date(struct icaltimetype t) | ||
75 | *- icaltime_is_utc(struct icaltimetype t) | ||
76 | *- icaltime_is_floating(struct icaltimetype t) | ||
77 | * | ||
78 | *Modify, compare and utility methods include: | ||
79 | * | ||
80 | *- icaltime_add(struct icaltimetype t, struct icaldurationtype d) | ||
81 | *- icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2) | ||
82 | * - icaltime_compare_with_zone(struct icaltimetype a,struct icaltimetype b) | ||
83 | *- icaltime_compare(struct icaltimetype a,struct icaltimetype b) | ||
84 | *- icaltime_compare_date_only(struct icaltimetype a, | ||
85 | * struct icaltimetype b) | ||
86 | *- icaltime_adjust(struct icaltimetype *tt, int days, int hours, | ||
87 | * int minutes, int seconds); | ||
88 | *- icaltime_normalize(struct icaltimetype t); | ||
89 | *- icaltime_convert_to_zone(const struct icaltimetype tt, | ||
90 | * icaltimezone *zone); | ||
91 | */ | ||
92 | |||
29 | #ifndef ICALTIME_H | 93 | #ifndef ICALTIME_H |
30 | #define ICALTIME_H | 94 | #define ICALTIME_H |
31 | 95 | ||
32 | #include <time.h> | 96 | #include <time.h> |
33 | 97 | ||
34 | /* icaltime_span is returned by icalcomponent_get_span() */ | 98 | /* An opaque struct representing a timezone. We declare this here to avoid |
99 | a circular dependancy. */ | ||
100 | #ifndef ICALTIMEZONE_DEFINED | ||
101 | #define ICALTIMEZONE_DEFINED | ||
102 | typedef struct _icaltimezone icaltimezone; | ||
103 | #endif | ||
104 | |||
105 | /** icaltime_span is returned by icalcomponent_get_span() */ | ||
35 | struct icaltime_span { | 106 | struct icaltime_span { |
36 | time_t start; /* in UTC */ | 107 | time_t start; /**< in UTC */ |
37 | time_t end; /* in UTC */ | 108 | time_t end; /**< in UTC */ |
38 | int is_busy; /* 1->busy time, 0-> free time */ | 109 | int is_busy; /**< 1->busy time, 0-> free time */ |
39 | }; | 110 | }; |
40 | 111 | ||
112 | typedef struct icaltime_span icaltime_span; | ||
41 | 113 | ||
114 | /* | ||
115 | *FIXME | ||
116 | * | ||
117 | *is_utc is redundant, and might be considered a minor optimization. | ||
118 | *It might be deprecated, so you should use icaltime_is_utc() instead. | ||
119 | */ | ||
42 | struct icaltimetype | 120 | struct icaltimetype |
43 | { | 121 | { |
44 | int year; | 122 | int year;/**< Actual year, e.g. 2001. */ |
45 | int month; | 123 | int month;/**< 1 (Jan) to 12 (Dec). */ |
46 | int day; | 124 | int day; |
47 | int hour; | 125 | int hour; |
48 | int minute; | 126 | int minute; |
49 | int second; | 127 | int second; |
50 | 128 | ||
51 | int is_utc; /* 1-> time is in UTC timezone */ | 129 | int is_utc; /**< 1-> time is in UTC timezone */ |
52 | 130 | ||
53 | int is_date; /* 1 -> interpret this as date. */ | 131 | int is_date; /**< 1 -> interpret this as date. */ |
54 | 132 | ||
55 | const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/ | 133 | int is_daylight; /**< 1 -> time is in daylight savings time. */ |
134 | |||
135 | const icaltimezone *zone;/**< timezone */ | ||
56 | }; | 136 | }; |
57 | 137 | ||
58 | /* Convert seconds past UNIX epoch to a timetype*/ | 138 | typedef struct icaltimetype icaltimetype; |
59 | struct icaltimetype icaltime_from_timet(time_t v, int is_date); | ||
60 | 139 | ||
61 | /* Return the time as seconds past the UNIX epoch */ | 140 | /** Return a null time, which indicates no time has been set. |
62 | time_t icaltime_as_timet(struct icaltimetype); | 141 | This time represent the beginning of the epoch */ |
142 | struct icaltimetype icaltime_null_time(void); | ||
63 | 143 | ||
64 | /* Return a string represention of the time, in RFC2445 format. The | 144 | /** Return a null date */ |
65 | string is owned by libical */ | 145 | struct icaltimetype icaltime_null_date(void); |
66 | char* icaltime_as_ical_string(struct icaltimetype tt); | 146 | |
147 | /** Returns the current time in the given timezone, as an icaltimetype. */ | ||
148 | struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone); | ||
149 | |||
150 | /** Returns the current day as an icaltimetype, with is_date set. */ | ||
151 | struct icaltimetype icaltime_today(void); | ||
67 | 152 | ||
68 | /* Like icaltime_from_timet(), except that the input may be in seconds | 153 | /** Convert seconds past UNIX epoch to a timetype*/ |
69 | past the epoch in floating time. This routine is deprecated */ | 154 | struct icaltimetype icaltime_from_timet(const time_t v, const int is_date); |
70 | struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc); | ||
71 | 155 | ||
72 | /* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */ | 156 | /** Convert seconds past UNIX epoch to a timetype, using timezones. */ |
73 | int icaltime_as_int(struct icaltimetype); | 157 | struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, |
158 | const int is_date, const icaltimezone *zone); | ||
74 | 159 | ||
75 | /* create a time from an ISO format string */ | 160 | /** create a time from an ISO format string */ |
76 | struct icaltimetype icaltime_from_string(const char* str); | 161 | struct icaltimetype icaltime_from_string(const char* str); |
77 | 162 | ||
78 | /* Routines for handling timezones */ | 163 | /** create a time from an ISO format string */ |
79 | /* Return the offset of the named zone as seconds. tt is a time | 164 | struct icaltimetype icaltime_from_string_with_zone(const char* str, |
80 | indicating the date for which you want the offset */ | 165 | const icaltimezone *zone); |
81 | int icaltime_utc_offset(struct icaltimetype tt, const char* tzid); | ||
82 | 166 | ||
83 | /* convert tt, of timezone tzid, into a utc time. Does nothing if the | 167 | /** Create a new time, given a day of year and a year. */ |
84 | time is already UTC. */ | 168 | struct icaltimetype icaltime_from_day_of_year(const int doy, |
85 | struct icaltimetype icaltime_as_utc(struct icaltimetype tt, | 169 | const int year); |
86 | const char* tzid); | ||
87 | 170 | ||
88 | /* convert tt, a time in UTC, into a time in timezone tzid */ | 171 | /**@brief Contructor (TODO). |
89 | struct icaltimetype icaltime_as_zone(struct icaltimetype tt, | 172 | * Create a new time from a weeknumber and a year. */ |
90 | const char* tzid); | 173 | struct icaltimetype icaltime_from_week_number(const int week_number, |
174 | const int year); | ||
91 | 175 | ||
92 | /* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */ | 176 | /** Return the time as seconds past the UNIX epoch */ |
93 | struct icaltimetype icaltime_null_time(void); | 177 | time_t icaltime_as_timet(const struct icaltimetype); |
178 | |||
179 | /** Return the time as seconds past the UNIX epoch, using timezones. */ | ||
180 | time_t icaltime_as_timet_with_zone(const struct icaltimetype tt, | ||
181 | const icaltimezone *zone); | ||
182 | |||
183 | /** Return a string represention of the time, in RFC2445 format. The | ||
184 | string is owned by libical */ | ||
185 | const char* icaltime_as_ical_string(const struct icaltimetype tt); | ||
186 | |||
187 | /** @brief Return the timezone */ | ||
188 | const icaltimezone *icaltime_get_timezone(const struct icaltimetype t); | ||
94 | 189 | ||
95 | /* Return true of the time is null. */ | 190 | /** @brief Return the tzid, or NULL for a floating time */ |
96 | int icaltime_is_null_time(struct icaltimetype t); | 191 | char *icaltime_get_tzid(const struct icaltimetype t); |
97 | 192 | ||
98 | /* Returns false if the time is clearly invalid, but is not null. This | 193 | /** @brief Set the timezone */ |
194 | struct icaltimetype icaltime_set_timezone(struct icaltimetype *t, | ||
195 | const icaltimezone *zone); | ||
196 | |||
197 | /** Return the day of the year of the given time */ | ||
198 | int icaltime_day_of_year(const struct icaltimetype t); | ||
199 | |||
200 | /** Return the day of the week of the given time. Sunday is 1 */ | ||
201 | int icaltime_day_of_week(const struct icaltimetype t); | ||
202 | |||
203 | /** Return the day of the year for the Sunday of the week that the | ||
204 | given time is within. */ | ||
205 | int icaltime_start_doy_of_week(const struct icaltimetype t); | ||
206 | |||
207 | /** Return the week number for the week the given time is within */ | ||
208 | int icaltime_week_number(const struct icaltimetype t); | ||
209 | |||
210 | /** Return true of the time is null. */ | ||
211 | int icaltime_is_null_time(const struct icaltimetype t); | ||
212 | |||
213 | /** Returns false if the time is clearly invalid, but is not null. This | ||
99 | is usually the result of creating a new time type buy not clearing | 214 | is usually the result of creating a new time type buy not clearing |
100 | it, or setting one of the flags to an illegal value. */ | 215 | it, or setting one of the flags to an illegal value. */ |
101 | int icaltime_is_valid_time(struct icaltimetype t); | 216 | int icaltime_is_valid_time(const struct icaltimetype t); |
102 | 217 | ||
103 | /* Reset all of the time components to be in their normal ranges. For | 218 | /** @brief Returns true if time is of DATE type, false if DATE-TIME */ |
104 | instance, given a time with minutes=70, the minutes will be reduces | 219 | int icaltime_is_date(const struct icaltimetype t); |
105 | to 10, and the hour incremented. This allows the caller to do | ||
106 | arithmetic on times without worrying about overflow or | ||
107 | underflow. */ | ||
108 | struct icaltimetype icaltime_normalize(struct icaltimetype t); | ||
109 | 220 | ||
110 | /* Return the day of the year of the given time */ | 221 | /** @brief Returns true if time is relative to UTC zone */ |
111 | short icaltime_day_of_year(struct icaltimetype t); | 222 | int icaltime_is_utc(const struct icaltimetype t); |
112 | 223 | ||
113 | /* Create a new time, given a day of year and a year. */ | 224 | /** @brief Returns true if time is a floating time */ |
114 | struct icaltimetype icaltime_from_day_of_year(short doy, short year); | 225 | int icaltime_is_floating(const struct icaltimetype t); |
115 | 226 | ||
116 | /* Return the day of the week of the given time. Sunday is 1 */ | 227 | /** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ |
117 | short icaltime_day_of_week(struct icaltimetype t); | 228 | int icaltime_compare_with_zone(const struct icaltimetype a, |
229 | const struct icaltimetype b); | ||
118 | 230 | ||
119 | /* Return the day of the year for the Sunday of the week that the | 231 | /** Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ |
120 | given time is within. */ | 232 | int icaltime_compare(const struct icaltimetype a, |
121 | short icaltime_start_doy_of_week(struct icaltimetype t); | 233 | const struct icaltimetype b); |
122 | 234 | ||
123 | /* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */ | 235 | /** like icaltime_compare, but only use the date parts. */ |
124 | char* icaltime_as_ctime(struct icaltimetype); | 236 | int icaltime_compare_date_only(const struct icaltimetype a, |
237 | const struct icaltimetype b); | ||
125 | 238 | ||
126 | /* Return the week number for the week the given time is within */ | 239 | /** Adds or subtracts a number of days, hours, minutes and seconds. */ |
127 | short icaltime_week_number(struct icaltimetype t); | 240 | void icaltime_adjust(struct icaltimetype *tt, const int days, |
241 | const int hours, const int minutes, const int seconds); | ||
128 | 242 | ||
129 | /* Create a new time from a weeknumber and a year. */ | 243 | /** Normalize the icaltime, so that all fields are within the normal range. */ |
130 | struct icaltimetype icaltime_from_week_number(short week_number, short year); | 244 | struct icaltimetype icaltime_normalize(const struct icaltimetype t); |
131 | 245 | ||
132 | /* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */ | 246 | /** convert tt, of timezone tzid, into a utc time. Does nothing if the |
133 | int icaltime_compare(struct icaltimetype a,struct icaltimetype b); | 247 | time is already UTC. */ |
248 | struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, | ||
249 | icaltimezone *zone); | ||
134 | 250 | ||
135 | /* like icaltime_compare, but only use the date parts. */ | 251 | /** Return the number of days in the given month */ |
136 | int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b); | 252 | int icaltime_days_in_month(const int month, const int year); |
137 | 253 | ||
138 | /* Return the number of days in the given month */ | ||
139 | short icaltime_days_in_month(short month,short year); | ||
140 | 254 | ||
255 | /** @brief calculate an icaltimespan given a start and end time. */ | ||
256 | struct icaltime_span icaltime_span_new(struct icaltimetype dtstart, | ||
257 | struct icaltimetype dtend, | ||
258 | int is_busy); | ||
141 | 259 | ||
142 | #endif /* !ICALTIME_H */ | 260 | /** @brief Returns true if the two spans overlap **/ |
261 | int icaltime_span_overlaps(icaltime_span *s1, | ||
262 | icaltime_span *s2); | ||
143 | 263 | ||
264 | /** @brief Returns true if the span is totally within the containing | ||
265 | * span | ||
266 | */ | ||
267 | int icaltime_span_contains(icaltime_span *s, | ||
268 | icaltime_span *container); | ||
269 | |||
270 | |||
271 | #endif /* !ICALTIME_H */ | ||
144 | 272 | ||
145 | 273 | ||
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 @@ | |||
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icaltimezone.c | ||
4 | CREATOR: Damon Chaplin 15 March 2001 | ||
5 | |||
6 | $Id$ | ||
7 | $Locker$ | ||
8 | |||
9 | (C) COPYRIGHT 2001, Damon Chaplin | ||
10 | |||
11 | This program is free software; you can redistribute it and/or modify | ||
12 | it under the terms of either: | ||
13 | |||
14 | The LGPL as published by the Free Software Foundation, version | ||
15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
16 | |||
17 | Or: | ||
18 | |||
19 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
20 | the License at http://www.mozilla.org/MPL/ | ||
21 | |||
22 | |||
23 | ======================================================================*/ | ||
24 | |||
25 | /** @file icaltimezone.c | ||
26 | * @brief implementation of timezone handling routines | ||
27 | **/ | ||
28 | |||
29 | #ifdef HAVE_CONFIG_H | ||
30 | #include "config.h" | ||
31 | #endif | ||
32 | |||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <string.h> | ||
36 | #include "icalproperty.h" | ||
37 | #include "icalarray.h" | ||
38 | #include "icalerror.h" | ||
39 | #include "icalparser.h" | ||
40 | #include "icaltimezone.h" | ||
41 | |||
42 | #ifdef WIN32 | ||
43 | #define snprintf _snprintf | ||
44 | #define PACKAGE_DATA_DIR "/Projects/libical" | ||
45 | #endif | ||
46 | |||
47 | /** This is the toplevel directory where the timezone data is installed in. */ | ||
48 | #define ZONEINFO_DIRECTORY "/zoneinfo" | ||
49 | |||
50 | /** The prefix we use to uniquely identify TZIDs. */ | ||
51 | #define TZID_PREFIX "/softwarestudio.org/" | ||
52 | #define TZID_PREFIX_LEN 20 | ||
53 | |||
54 | /** This is the filename of the file containing the city names and | ||
55 | coordinates of all the builtin timezones. */ | ||
56 | #define ZONES_TAB_FILENAME"zones.tab" | ||
57 | |||
58 | /** This is the number of years of extra coverage we do when expanding | ||
59 | the timezone changes. */ | ||
60 | #define ICALTIMEZONE_EXTRA_COVERAGE5 | ||
61 | |||
62 | /** This is the maximum year we will expand to. time_t values only go up to | ||
63 | somewhere around 2037. */ | ||
64 | #define ICALTIMEZONE_MAX_YEAR 2035 | ||
65 | |||
66 | struct _icaltimezone { | ||
67 | char *tzid; | ||
68 | /**< The unique ID of this timezone, | ||
69 | e.g. "/softwarestudio.org/Olson_20010601_1/Africa/Banjul". | ||
70 | This should only be used to identify a VTIMEZONE. It is not | ||
71 | meant to be displayed to the user in any form. */ | ||
72 | |||
73 | char *location; | ||
74 | /**< The location for the timezone, e.g. "Africa/Accra" for the | ||
75 | Olson database. We look for this in the "LOCATION" or | ||
76 | "X-LIC-LOCATION" properties of the VTIMEZONE component. It | ||
77 | isn't a standard property yet. This will be NULL if no location | ||
78 | is found in the VTIMEZONE. */ | ||
79 | |||
80 | char *tznames; | ||
81 | /**< This will be set to a combination of the TZNAME properties | ||
82 | from the last STANDARD and DAYLIGHT components in the | ||
83 | VTIMEZONE, e.g. "EST/EDT". If they both use the same TZNAME, | ||
84 | or only one type of component is found, then only one TZNAME | ||
85 | will appear, e.g. "AZOT". If no TZNAME is found this will be | ||
86 | NULL. */ | ||
87 | |||
88 | double latitude; | ||
89 | double longitude; | ||
90 | /**< The coordinates of the city, in degrees. */ | ||
91 | |||
92 | icalcomponent*component; | ||
93 | /**< The toplevel VTIMEZONE component loaded from the .ics file for this | ||
94 | timezone. If we need to regenerate the changes data we need this. */ | ||
95 | |||
96 | icaltimezone*builtin_timezone; | ||
97 | /**< If this is not NULL it points to the builtin icaltimezone | ||
98 | that the above TZID refers to. This icaltimezone should be used | ||
99 | instead when accessing the timezone changes data, so that the | ||
100 | expanded timezone changes data is shared between calendar | ||
101 | components. */ | ||
102 | |||
103 | int end_year; | ||
104 | /**< This is the last year for which we have expanded the data to. | ||
105 | If we need to calculate a date past this we need to expand the | ||
106 | timezone component data from scratch. */ | ||
107 | |||
108 | icalarray *changes; | ||
109 | /**< A dynamically-allocated array of time zone changes, sorted by the | ||
110 | time of the change in local time. So we can do fast binary-searches | ||
111 | to convert from local time to UTC. */ | ||
112 | }; | ||
113 | |||
114 | typedef struct _icaltimezonechangeicaltimezonechange; | ||
115 | |||
116 | struct _icaltimezonechange { | ||
117 | int utc_offset; | ||
118 | /**< The offset to add to UTC to get local time, in seconds. */ | ||
119 | |||
120 | int prev_utc_offset; | ||
121 | /**< The offset to add to UTC, before this change, in seconds. */ | ||
122 | |||
123 | int year; /**< Actual year, e.g. 2001. */ | ||
124 | int month; /**< 1 (Jan) to 12 (Dec). */ | ||
125 | int day; | ||
126 | int hour; | ||
127 | int minute; | ||
128 | int second; | ||
129 | /**< The time that the change came into effect, in UTC. | ||
130 | Note that the prev_utc_offset applies to this local time, | ||
131 | since we haven't changed to the new offset yet. */ | ||
132 | |||
133 | int is_daylight; | ||
134 | /**< Whether this is STANDARD or DAYLIGHT time. */ | ||
135 | }; | ||
136 | |||
137 | |||
138 | /** An array of icaltimezones for the builtin timezones. */ | ||
139 | static icalarray *builtin_timezones = NULL; | ||
140 | |||
141 | /** This is the special UTC timezone, which isn't in builtin_timezones. */ | ||
142 | static icaltimezone utc_timezone = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | ||
143 | |||
144 | static char* zone_files_directory = NULL; | ||
145 | |||
146 | static void icaltimezone_reset (icaltimezone *zone); | ||
147 | static char* icaltimezone_get_location_from_vtimezone (icalcomponent *component); | ||
148 | static char* icaltimezone_get_tznames_from_vtimezone (icalcomponent *component); | ||
149 | static void icaltimezone_expand_changes (icaltimezone*zone, | ||
150 | int end_year); | ||
151 | static void icaltimezone_expand_vtimezone (icalcomponent*comp, | ||
152 | int end_year, | ||
153 | icalarray*changes); | ||
154 | static int icaltimezone_compare_change_fn (const void*elem1, | ||
155 | const void*elem2); | ||
156 | |||
157 | static int icaltimezone_find_nearby_change (icaltimezone*zone, | ||
158 | icaltimezonechange *change); | ||
159 | |||
160 | static void icaltimezone_adjust_change (icaltimezonechange *tt, | ||
161 | int days, | ||
162 | int hours, | ||
163 | int minutes, | ||
164 | int seconds); | ||
165 | |||
166 | static void icaltimezone_init (icaltimezone*zone); | ||
167 | |||
168 | /** Gets the TZID, LOCATION/X-LIC-LOCATION, and TZNAME properties from the | ||
169 | VTIMEZONE component and places them in the icaltimezone. It returns 1 on | ||
170 | success, or 0 if the TZID can't be found. */ | ||
171 | static int icaltimezone_get_vtimezone_properties (icaltimezone *zone, | ||
172 | icalcomponent *component); | ||
173 | |||
174 | |||
175 | static void icaltimezone_load_builtin_timezone (icaltimezone*zone); | ||
176 | |||
177 | static void icaltimezone_ensure_coverage (icaltimezone*zone, | ||
178 | int end_year); | ||
179 | |||
180 | |||
181 | static void icaltimezone_init_builtin_timezones(void); | ||
182 | |||
183 | static void icaltimezone_parse_zone_tab(void); | ||
184 | |||
185 | static char* icaltimezone_load_get_line_fn (char *s, | ||
186 | size_t size, | ||
187 | void *data); | ||
188 | |||
189 | static void format_utc_offset (int utc_offset, | ||
190 | char *buffer); | ||
191 | |||
192 | static char* get_zone_directory(void); | ||
193 | |||
194 | |||
195 | /** Creates a new icaltimezone. */ | ||
196 | icaltimezone* | ||
197 | icaltimezone_new (void) | ||
198 | { | ||
199 | icaltimezone *zone; | ||
200 | |||
201 | zone = (icaltimezone*) malloc (sizeof (icaltimezone)); | ||
202 | if (!zone) { | ||
203 | icalerror_set_errno (ICAL_NEWFAILED_ERROR); | ||
204 | return NULL; | ||
205 | } | ||
206 | |||
207 | icaltimezone_init (zone); | ||
208 | |||
209 | return zone; | ||
210 | } | ||
211 | |||
212 | |||
213 | /** Frees all memory used for the icaltimezone. */ | ||
214 | void | ||
215 | icaltimezone_free (icaltimezone *zone, | ||
216 | int free_struct) | ||
217 | { | ||
218 | icaltimezone_reset (zone); | ||
219 | if (free_struct) | ||
220 | free (zone); | ||
221 | } | ||
222 | |||
223 | |||
224 | /** Resets the icaltimezone to the initial state, freeing most of the fields. */ | ||
225 | static void | ||
226 | icaltimezone_reset (icaltimezone *zone) | ||
227 | { | ||
228 | if (zone->tzid) | ||
229 | free (zone->tzid); | ||
230 | if (zone->location) | ||
231 | free (zone->location); | ||
232 | if (zone->tznames) | ||
233 | free (zone->tznames); | ||
234 | if (zone->component) | ||
235 | icalcomponent_free (zone->component); | ||
236 | if (zone->changes) | ||
237 | icalarray_free (zone->changes); | ||
238 | |||
239 | icaltimezone_init (zone); | ||
240 | } | ||
241 | |||
242 | |||
243 | /** Initializes an icaltimezone. */ | ||
244 | static void | ||
245 | icaltimezone_init (icaltimezone*zone) | ||
246 | { | ||
247 | zone->tzid = NULL; | ||
248 | zone->location = NULL; | ||
249 | zone->tznames = NULL; | ||
250 | zone->latitude = 0.0; | ||
251 | zone->longitude = 0.0; | ||
252 | zone->component = NULL; | ||
253 | zone->builtin_timezone = NULL; | ||
254 | zone->end_year = 0; | ||
255 | zone->changes = NULL; | ||
256 | } | ||
257 | |||
258 | |||
259 | /** Gets the TZID, LOCATION/X-LIC-LOCATION and TZNAME properties of | ||
260 | the VTIMEZONE component and stores them in the icaltimezone. It | ||
261 | returns 1 on success, or 0 if the TZID can't be found. Note that | ||
262 | it expects the zone to be initialized or reset - it doesn't free | ||
263 | any old values. */ | ||
264 | static int | ||
265 | icaltimezone_get_vtimezone_properties (icaltimezone*zone, | ||
266 | icalcomponent*component) | ||
267 | { | ||
268 | icalproperty *prop; | ||
269 | const char *tzid; | ||
270 | |||
271 | prop = icalcomponent_get_first_property (component, ICAL_TZID_PROPERTY); | ||
272 | if (!prop) | ||
273 | return 0; | ||
274 | |||
275 | /* A VTIMEZONE MUST have a TZID, or a lot of our code won't work. */ | ||
276 | tzid = icalproperty_get_tzid (prop); | ||
277 | if (!tzid) | ||
278 | return 0; | ||
279 | |||
280 | zone->tzid = strdup (tzid); | ||
281 | zone->component = component; | ||
282 | if ( zone->location != 0 ) free ( zone->location ); | ||
283 | zone->location = icaltimezone_get_location_from_vtimezone (component); | ||
284 | zone->tznames = icaltimezone_get_tznames_from_vtimezone (component); | ||
285 | |||
286 | return 1; | ||
287 | } | ||
288 | |||
289 | /** Gets the LOCATION or X-LIC-LOCATION property from a VTIMEZONE. */ | ||
290 | static char* | ||
291 | icaltimezone_get_location_from_vtimezone (icalcomponent *component) | ||
292 | { | ||
293 | icalproperty *prop; | ||
294 | const char *location; | ||
295 | const char *name; | ||
296 | |||
297 | prop = icalcomponent_get_first_property (component, | ||
298 | ICAL_LOCATION_PROPERTY); | ||
299 | if (prop) { | ||
300 | location = icalproperty_get_location (prop); | ||
301 | if (location) | ||
302 | return strdup (location); | ||
303 | } | ||
304 | |||
305 | prop = icalcomponent_get_first_property (component, ICAL_X_PROPERTY); | ||
306 | while (prop) { | ||
307 | name = icalproperty_get_x_name (prop); | ||
308 | if (name && !strcmp (name, "X-LIC-LOCATION")) { | ||
309 | location = icalproperty_get_x (prop); | ||
310 | if (location) | ||
311 | return strdup (location); | ||
312 | } | ||
313 | prop = icalcomponent_get_next_property (component, | ||
314 | ICAL_X_PROPERTY); | ||
315 | } | ||
316 | |||
317 | return NULL; | ||
318 | } | ||
319 | |||
320 | |||
321 | /** Gets the TZNAMEs used for the last STANDARD & DAYLIGHT components | ||
322 | in a VTIMEZONE. If both STANDARD and DAYLIGHT components use the | ||
323 | same TZNAME, it returns that. If they use different TZNAMEs, it | ||
324 | formats them like "EST/EDT". The returned string should be freed by | ||
325 | the caller. */ | ||
326 | static char* | ||
327 | icaltimezone_get_tznames_from_vtimezone (icalcomponent *component) | ||
328 | { | ||
329 | icalcomponent *comp; | ||
330 | icalcomponent_kind type; | ||
331 | icalproperty *prop; | ||
332 | struct icaltimetype dtstart; | ||
333 | struct icaldatetimeperiodtype rdate; | ||
334 | const char *current_tzname; | ||
335 | const char *standard_tzname = NULL, *daylight_tzname = NULL; | ||
336 | struct icaltimetype standard_max_date, daylight_max_date; | ||
337 | struct icaltimetype current_max_date; | ||
338 | |||
339 | standard_max_date = icaltime_null_time(); | ||
340 | daylight_max_date = icaltime_null_time(); | ||
341 | |||
342 | /* Step through the STANDARD & DAYLIGHT subcomponents. */ | ||
343 | comp = icalcomponent_get_first_component (component, ICAL_ANY_COMPONENT); | ||
344 | while (comp) { | ||
345 | type = icalcomponent_isa (comp); | ||
346 | if (type == ICAL_XSTANDARD_COMPONENT | ||
347 | || type == ICAL_XDAYLIGHT_COMPONENT) { | ||
348 | current_max_date = icaltime_null_time (); | ||
349 | current_tzname = NULL; | ||
350 | |||
351 | /* Step through the properties. We want to find the TZNAME, and | ||
352 | the largest DTSTART or RDATE. */ | ||
353 | prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); | ||
354 | while (prop) { | ||
355 | switch (icalproperty_isa (prop)) { | ||
356 | case ICAL_TZNAME_PROPERTY: | ||
357 | current_tzname = icalproperty_get_tzname (prop); | ||
358 | break; | ||
359 | |||
360 | case ICAL_DTSTART_PROPERTY: | ||
361 | dtstart = icalproperty_get_dtstart (prop); | ||
362 | if (icaltime_compare (dtstart, current_max_date) > 0) | ||
363 | current_max_date = dtstart; | ||
364 | |||
365 | break; | ||
366 | |||
367 | case ICAL_RDATE_PROPERTY: | ||
368 | rdate = icalproperty_get_rdate (prop); | ||
369 | if (icaltime_compare (rdate.time, current_max_date) > 0) | ||
370 | current_max_date = rdate.time; | ||
371 | |||
372 | break; | ||
373 | |||
374 | default: | ||
375 | break; | ||
376 | } | ||
377 | |||
378 | prop = icalcomponent_get_next_property (comp, | ||
379 | ICAL_ANY_PROPERTY); | ||
380 | } | ||
381 | |||
382 | if (current_tzname) { | ||
383 | if (type == ICAL_XSTANDARD_COMPONENT) { | ||
384 | if (!standard_tzname | ||
385 | || icaltime_compare (current_max_date, | ||
386 | standard_max_date) > 0) { | ||
387 | standard_max_date = current_max_date; | ||
388 | standard_tzname = current_tzname; | ||
389 | } | ||
390 | } else { | ||
391 | if (!daylight_tzname | ||
392 | || icaltime_compare (current_max_date, | ||
393 | daylight_max_date) > 0) { | ||
394 | daylight_max_date = current_max_date; | ||
395 | daylight_tzname = current_tzname; | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | } | ||
400 | |||
401 | comp = icalcomponent_get_next_component (component, | ||
402 | ICAL_ANY_COMPONENT); | ||
403 | } | ||
404 | |||
405 | /* Outlook (2000) places "Standard Time" and "Daylight Time" in the TZNAME | ||
406 | strings, which is totally useless. So we return NULL in that case. */ | ||
407 | if (standard_tzname && !strcmp (standard_tzname, "Standard Time")) | ||
408 | return NULL; | ||
409 | |||
410 | /* If both standard and daylight TZNAMEs were found, if they are the same | ||
411 | we return just one, else we format them like "EST/EDT". */ | ||
412 | if (standard_tzname && daylight_tzname) { | ||
413 | unsigned int standard_len, daylight_len; | ||
414 | char *tznames; | ||
415 | |||
416 | if (!strcmp (standard_tzname, daylight_tzname)) | ||
417 | return strdup (standard_tzname); | ||
418 | |||
419 | standard_len = strlen (standard_tzname); | ||
420 | daylight_len = strlen (daylight_tzname); | ||
421 | tznames = malloc (standard_len + daylight_len + 2); | ||
422 | strcpy (tznames, standard_tzname); | ||
423 | tznames[standard_len] = '/'; | ||
424 | strcpy (tznames + standard_len + 1, daylight_tzname); | ||
425 | return tznames; | ||
426 | } else { | ||
427 | const char *tznames; | ||
428 | |||
429 | /* If either of the TZNAMEs was found just return that, else NULL. */ | ||
430 | tznames = standard_tzname ? standard_tzname : daylight_tzname; | ||
431 | return tznames ? strdup (tznames) : NULL; | ||
432 | } | ||
433 | } | ||
434 | |||
435 | |||
436 | static void | ||
437 | icaltimezone_ensure_coverage (icaltimezone*zone, | ||
438 | int end_year) | ||
439 | { | ||
440 | /* When we expand timezone changes we always expand at least up to this | ||
441 | year, plus ICALTIMEZONE_EXTRA_COVERAGE. */ | ||
442 | static int icaltimezone_minimum_expansion_year = -1; | ||
443 | |||
444 | int changes_end_year; | ||
445 | |||
446 | if (!zone->component) | ||
447 | icaltimezone_load_builtin_timezone (zone); | ||
448 | |||
449 | if (icaltimezone_minimum_expansion_year == -1) { | ||
450 | struct icaltimetype today = icaltime_today(); | ||
451 | icaltimezone_minimum_expansion_year = today.year; | ||
452 | } | ||
453 | |||
454 | changes_end_year = end_year; | ||
455 | if (changes_end_year < icaltimezone_minimum_expansion_year) | ||
456 | changes_end_year = icaltimezone_minimum_expansion_year; | ||
457 | |||
458 | changes_end_year += ICALTIMEZONE_EXTRA_COVERAGE; | ||
459 | |||
460 | if (changes_end_year > ICALTIMEZONE_MAX_YEAR) | ||
461 | changes_end_year = ICALTIMEZONE_MAX_YEAR; | ||
462 | |||
463 | if (!zone->changes || zone->end_year < end_year) | ||
464 | icaltimezone_expand_changes (zone, changes_end_year); | ||
465 | } | ||
466 | |||
467 | |||
468 | static void | ||
469 | icaltimezone_expand_changes (icaltimezone*zone, | ||
470 | int end_year) | ||
471 | { | ||
472 | icalarray *changes; | ||
473 | icalcomponent *comp; | ||
474 | |||
475 | #if 0 | ||
476 | printf ("\nExpanding changes for: %s to year: %i\n", zone->tzid, end_year); | ||
477 | #endif | ||
478 | |||
479 | changes = icalarray_new (sizeof (icaltimezonechange), 32); | ||
480 | if (!changes) | ||
481 | return; | ||
482 | |||
483 | /* Scan the STANDARD and DAYLIGHT subcomponents. */ | ||
484 | comp = icalcomponent_get_first_component (zone->component, | ||
485 | ICAL_ANY_COMPONENT); | ||
486 | while (comp) { | ||
487 | icaltimezone_expand_vtimezone (comp, end_year, changes); | ||
488 | comp = icalcomponent_get_next_component (zone->component, | ||
489 | ICAL_ANY_COMPONENT); | ||
490 | } | ||
491 | |||
492 | /* Sort the changes. We may have duplicates but I don't think it will | ||
493 | matter. */ | ||
494 | icalarray_sort (changes, icaltimezone_compare_change_fn); | ||
495 | |||
496 | if (zone->changes) | ||
497 | icalarray_free (zone->changes); | ||
498 | |||
499 | zone->changes = changes; | ||
500 | zone->end_year = end_year; | ||
501 | } | ||
502 | |||
503 | |||
504 | static void | ||
505 | icaltimezone_expand_vtimezone (icalcomponent*comp, | ||
506 | int end_year, | ||
507 | icalarray*changes) | ||
508 | { | ||
509 | icaltimezonechange change; | ||
510 | icalproperty *prop; | ||
511 | struct icaltimetype dtstart, occ; | ||
512 | struct icalrecurrencetype rrule; | ||
513 | icalrecur_iterator* rrule_iterator; | ||
514 | struct icaldatetimeperiodtype rdate; | ||
515 | int found_dtstart = 0, found_tzoffsetto = 0, found_tzoffsetfrom = 0; | ||
516 | int has_recurrence = 0; | ||
517 | |||
518 | /* First we check if it is a STANDARD or DAYLIGHT component, and | ||
519 | just return if it isn't. */ | ||
520 | if (icalcomponent_isa (comp) == ICAL_XSTANDARD_COMPONENT) | ||
521 | change.is_daylight = 0; | ||
522 | else if (icalcomponent_isa (comp) == ICAL_XDAYLIGHT_COMPONENT) | ||
523 | change.is_daylight = 1; | ||
524 | else | ||
525 | return; | ||
526 | |||
527 | /* Step through each of the properties to find the DTSTART, | ||
528 | TZOFFSETFROM and TZOFFSETTO. We can't expand recurrences here | ||
529 | since we need these properties before we can do that. */ | ||
530 | prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); | ||
531 | while (prop) { | ||
532 | switch (icalproperty_isa (prop)) { | ||
533 | case ICAL_DTSTART_PROPERTY: | ||
534 | dtstart = icalproperty_get_dtstart (prop); | ||
535 | found_dtstart = 1; | ||
536 | break; | ||
537 | case ICAL_TZOFFSETTO_PROPERTY: | ||
538 | change.utc_offset = icalproperty_get_tzoffsetto (prop); | ||
539 | /*printf ("Found TZOFFSETTO: %i\n", change.utc_offset);*/ | ||
540 | found_tzoffsetto = 1; | ||
541 | break; | ||
542 | case ICAL_TZOFFSETFROM_PROPERTY: | ||
543 | change.prev_utc_offset = icalproperty_get_tzoffsetfrom (prop); | ||
544 | /*printf ("Found TZOFFSETFROM: %i\n", change.prev_utc_offset);*/ | ||
545 | found_tzoffsetfrom = 1; | ||
546 | break; | ||
547 | case ICAL_RDATE_PROPERTY: | ||
548 | case ICAL_RRULE_PROPERTY: | ||
549 | has_recurrence = 1; | ||
550 | break; | ||
551 | default: | ||
552 | /* Just ignore any other properties. */ | ||
553 | break; | ||
554 | } | ||
555 | |||
556 | prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY); | ||
557 | } | ||
558 | |||
559 | /* If we didn't find a DTSTART, TZOFFSETTO and TZOFFSETFROM we have to | ||
560 | ignore the component. FIXME: Add an error property? */ | ||
561 | if (!found_dtstart || !found_tzoffsetto || !found_tzoffsetfrom) | ||
562 | return; | ||
563 | |||
564 | #if 0 | ||
565 | printf ("\n Expanding component DTSTART (Y/M/D): %i/%i/%i %i:%02i:%02i\n", | ||
566 | dtstart.year, dtstart.month, dtstart.day, | ||
567 | dtstart.hour, dtstart.minute, dtstart.second); | ||
568 | #endif | ||
569 | |||
570 | /* If the STANDARD/DAYLIGHT component has no recurrence data, we just add | ||
571 | a single change for the DTSTART. */ | ||
572 | if (!has_recurrence) { | ||
573 | change.year = dtstart.year; | ||
574 | change.month = dtstart.month; | ||
575 | change.day = dtstart.day; | ||
576 | change.hour = dtstart.hour; | ||
577 | change.minute = dtstart.minute; | ||
578 | change.second = dtstart.second; | ||
579 | |||
580 | /* Convert to UTC. */ | ||
581 | icaltimezone_adjust_change (&change, 0, 0, 0, -change.prev_utc_offset); | ||
582 | |||
583 | #if 0 | ||
584 | printf (" Appending single DTSTART (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n", | ||
585 | change.year, change.month, change.day, | ||
586 | change.hour, change.minute, change.second); | ||
587 | #endif | ||
588 | |||
589 | /* Add the change to the array. */ | ||
590 | icalarray_append (changes, &change); | ||
591 | return; | ||
592 | } | ||
593 | |||
594 | /* The component has recurrence data, so we expand that now. */ | ||
595 | prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); | ||
596 | while (prop) { | ||
597 | #if 0 | ||
598 | printf ("Expanding property...\n"); | ||
599 | #endif | ||
600 | switch (icalproperty_isa (prop)) { | ||
601 | case ICAL_RDATE_PROPERTY: | ||
602 | rdate = icalproperty_get_rdate (prop); | ||
603 | change.year = rdate.time.year; | ||
604 | change.month = rdate.time.month; | ||
605 | change.day = rdate.time.day; | ||
606 | /* RDATEs with a DATE value inherit the time from | ||
607 | the DTSTART. */ | ||
608 | if (icaltime_is_date(rdate.time)) { | ||
609 | change.hour = dtstart.hour; | ||
610 | change.minute = dtstart.minute; | ||
611 | change.second = dtstart.second; | ||
612 | } else { | ||
613 | change.hour = rdate.time.hour; | ||
614 | change.minute = rdate.time.minute; | ||
615 | change.second = rdate.time.second; | ||
616 | |||
617 | /* The spec was a bit vague about whether RDATEs were in local | ||
618 | time or UTC so we support both to be safe. So if it is in | ||
619 | UTC we have to add the UTC offset to get a local time. */ | ||
620 | if (!icaltime_is_utc(rdate.time)) | ||
621 | icaltimezone_adjust_change (&change, 0, 0, 0, | ||
622 | -change.prev_utc_offset); | ||
623 | } | ||
624 | |||
625 | #if 0 | ||
626 | printf (" Appending RDATE element (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n", | ||
627 | change.year, change.month, change.day, | ||
628 | change.hour, change.minute, change.second); | ||
629 | #endif | ||
630 | |||
631 | icalarray_append (changes, &change); | ||
632 | break; | ||
633 | case ICAL_RRULE_PROPERTY: | ||
634 | rrule = icalproperty_get_rrule (prop); | ||
635 | |||
636 | /* If the rrule UNTIL value is set and is in UTC, we convert it to | ||
637 | a local time, since the recurrence code has no way to convert | ||
638 | it itself. */ | ||
639 | if (!icaltime_is_null_time (rrule.until) && rrule.until.is_utc) { | ||
640 | #if 0 | ||
641 | printf (" Found RRULE UNTIL in UTC.\n"); | ||
642 | #endif | ||
643 | |||
644 | /* To convert from UTC to a local time, we use the TZOFFSETFROM | ||
645 | since that is the offset from UTC that will be in effect | ||
646 | when each of the RRULE occurrences happens. */ | ||
647 | icaltime_adjust (&rrule.until, 0, 0, 0, | ||
648 | change.prev_utc_offset); | ||
649 | rrule.until.is_utc = 0; | ||
650 | } | ||
651 | |||
652 | rrule_iterator = icalrecur_iterator_new (rrule, dtstart); | ||
653 | for (;;) { | ||
654 | occ = icalrecur_iterator_next (rrule_iterator); | ||
655 | if (occ.year > end_year || icaltime_is_null_time (occ)) | ||
656 | break; | ||
657 | |||
658 | change.year = occ.year; | ||
659 | change.month = occ.month; | ||
660 | change.day = occ.day; | ||
661 | change.hour = occ.hour; | ||
662 | change.minute = occ.minute; | ||
663 | change.second = occ.second; | ||
664 | |||
665 | #if 0 | ||
666 | printf (" Appending RRULE element (Y/M/D): %i/%02i/%02i %i:%02i:%02i\n", | ||
667 | change.year, change.month, change.day, | ||
668 | change.hour, change.minute, change.second); | ||
669 | #endif | ||
670 | |||
671 | icaltimezone_adjust_change (&change, 0, 0, 0, | ||
672 | -change.prev_utc_offset); | ||
673 | |||
674 | icalarray_append (changes, &change); | ||
675 | } | ||
676 | |||
677 | icalrecur_iterator_free (rrule_iterator); | ||
678 | break; | ||
679 | default: | ||
680 | break; | ||
681 | } | ||
682 | |||
683 | prop = icalcomponent_get_next_property (comp, ICAL_ANY_PROPERTY); | ||
684 | } | ||
685 | } | ||
686 | |||
687 | |||
688 | /** A function to compare 2 icaltimezonechange elements, used for qsort(). */ | ||
689 | static int | ||
690 | icaltimezone_compare_change_fn (const void*elem1, | ||
691 | const void*elem2) | ||
692 | { | ||
693 | const icaltimezonechange *change1, *change2; | ||
694 | int retval; | ||
695 | |||
696 | change1 = elem1; | ||
697 | change2 = elem2; | ||
698 | |||
699 | if (change1->year < change2->year) | ||
700 | retval = -1; | ||
701 | else if (change1->year > change2->year) | ||
702 | retval = 1; | ||
703 | |||
704 | else if (change1->month < change2->month) | ||
705 | retval = -1; | ||
706 | else if (change1->month > change2->month) | ||
707 | retval = 1; | ||
708 | |||
709 | else if (change1->day < change2->day) | ||
710 | retval = -1; | ||
711 | else if (change1->day > change2->day) | ||
712 | retval = 1; | ||
713 | |||
714 | else if (change1->hour < change2->hour) | ||
715 | retval = -1; | ||
716 | else if (change1->hour > change2->hour) | ||
717 | retval = 1; | ||
718 | |||
719 | else if (change1->minute < change2->minute) | ||
720 | retval = -1; | ||
721 | else if (change1->minute > change2->minute) | ||
722 | retval = 1; | ||
723 | |||
724 | else if (change1->second < change2->second) | ||
725 | retval = -1; | ||
726 | else if (change1->second > change2->second) | ||
727 | retval = 1; | ||
728 | |||
729 | else | ||
730 | retval = 0; | ||
731 | |||
732 | return retval; | ||
733 | } | ||
734 | |||
735 | |||
736 | |||
737 | void | ||
738 | icaltimezone_convert_time (struct icaltimetype *tt, | ||
739 | icaltimezone*from_zone, | ||
740 | icaltimezone*to_zone) | ||
741 | { | ||
742 | int utc_offset, is_daylight; | ||
743 | |||
744 | /* If the time is a DATE value or both timezones are the same, or we are | ||
745 | converting a floating time, we don't need to do anything. */ | ||
746 | if (icaltime_is_date(*tt) || from_zone == to_zone || from_zone == NULL) | ||
747 | return; | ||
748 | |||
749 | /* Convert the time to UTC by getting the UTC offset and subtracting it. */ | ||
750 | utc_offset = icaltimezone_get_utc_offset (from_zone, tt, NULL); | ||
751 | icaltime_adjust (tt, 0, 0, 0, -utc_offset); | ||
752 | |||
753 | /* Now we convert the time to the new timezone by getting the UTC offset | ||
754 | of our UTC time and adding it. */ | ||
755 | utc_offset = icaltimezone_get_utc_offset_of_utc_time (to_zone, tt, | ||
756 | &is_daylight); | ||
757 | tt->is_daylight = is_daylight; | ||
758 | icaltime_adjust (tt, 0, 0, 0, utc_offset); | ||
759 | } | ||
760 | |||
761 | |||
762 | |||
763 | |||
764 | /** @deprecated This API wasn't updated when we changed icaltimetype to contain its own | ||
765 | timezone. Also, this takes a pointer instead of the struct. */ | ||
766 | /* Calculates the UTC offset of a given local time in the given | ||
767 | timezone. It is the number of seconds to add to UTC to get local | ||
768 | time. The is_daylight flag is set to 1 if the time is in | ||
769 | daylight-savings time. */ | ||
770 | int | ||
771 | icaltimezone_get_utc_offset (icaltimezone*zone, | ||
772 | struct icaltimetype*tt, | ||
773 | int *is_daylight) | ||
774 | { | ||
775 | icaltimezonechange *zone_change, *prev_zone_change, tt_change, tmp_change; | ||
776 | int change_num, step, utc_offset_change, cmp; | ||
777 | int change_num_to_use; | ||
778 | int want_daylight; | ||
779 | |||
780 | if (tt == NULL) | ||
781 | return 0; | ||
782 | |||
783 | if (is_daylight) | ||
784 | *is_daylight = 0; | ||
785 | |||
786 | /* For local times and UTC return 0. */ | ||
787 | if (zone == NULL || zone == &utc_timezone) | ||
788 | return 0; | ||
789 | |||
790 | /* Use the builtin icaltimezone if possible. */ | ||
791 | if (zone->builtin_timezone) | ||
792 | zone = zone->builtin_timezone; | ||
793 | |||
794 | /* Make sure the changes array is expanded up to the given time. */ | ||
795 | icaltimezone_ensure_coverage (zone, tt->year); | ||
796 | |||
797 | if (!zone->changes || zone->changes->num_elements == 0) | ||
798 | return 0; | ||
799 | |||
800 | /* Copy the time parts of the icaltimetype to an icaltimezonechange so we | ||
801 | can use our comparison function on it. */ | ||
802 | tt_change.year = tt->year; | ||
803 | tt_change.month = tt->month; | ||
804 | tt_change.day = tt->day; | ||
805 | tt_change.hour = tt->hour; | ||
806 | tt_change.minute = tt->minute; | ||
807 | tt_change.second = tt->second; | ||
808 | |||
809 | /* This should find a change close to the time, either the change before | ||
810 | it or the change after it. */ | ||
811 | change_num = icaltimezone_find_nearby_change (zone, &tt_change); | ||
812 | |||
813 | /* Sanity check. */ | ||
814 | icalerror_assert (change_num >= 0, | ||
815 | "Negative timezone change index"); | ||
816 | icalerror_assert (change_num < zone->changes->num_elements, | ||
817 | "Timezone change index out of bounds"); | ||
818 | |||
819 | /* Now move backwards or forwards to find the timezone change that applies | ||
820 | to tt. It should only have to do 1 or 2 steps. */ | ||
821 | zone_change = icalarray_element_at (zone->changes, change_num); | ||
822 | step = 1; | ||
823 | change_num_to_use = -1; | ||
824 | for (;;) { | ||
825 | /* Copy the change, so we can adjust it. */ | ||
826 | tmp_change = *zone_change; | ||
827 | |||
828 | /* If the clock is going backward, check if it is in the region of time | ||
829 | that is used twice. If it is, use the change with the daylight | ||
830 | setting which matches tt, or use standard if we don't know. */ | ||
831 | if (tmp_change.utc_offset < tmp_change.prev_utc_offset) { | ||
832 | /* If the time change is at 2:00AM local time and the clock is | ||
833 | going back to 1:00AM we adjust the change to 1:00AM. We may | ||
834 | have the wrong change but we'll figure that out later. */ | ||
835 | icaltimezone_adjust_change (&tmp_change, 0, 0, 0, | ||
836 | tmp_change.utc_offset); | ||
837 | } else { | ||
838 | icaltimezone_adjust_change (&tmp_change, 0, 0, 0, | ||
839 | tmp_change.prev_utc_offset); | ||
840 | } | ||
841 | |||
842 | cmp = icaltimezone_compare_change_fn (&tt_change, &tmp_change); | ||
843 | |||
844 | /* If the given time is on or after this change, then this change may | ||
845 | apply, but we continue as a later change may be the right one. | ||
846 | If the given time is before this change, then if we have already | ||
847 | found a change which applies we can use that, else we need to step | ||
848 | backwards. */ | ||
849 | if (cmp >= 0) | ||
850 | change_num_to_use = change_num; | ||
851 | else | ||
852 | step = -1; | ||
853 | |||
854 | /* If we are stepping backwards through the changes and we have found | ||
855 | a change that applies, then we know this is the change to use so | ||
856 | we exit the loop. */ | ||
857 | if (step == -1 && change_num_to_use != -1) | ||
858 | break; | ||
859 | |||
860 | change_num += step; | ||
861 | |||
862 | /* If we go past the start of the changes array, then we have no data | ||
863 | for this time so we return a UTC offset of 0. */ | ||
864 | if (change_num < 0) | ||
865 | return 0; | ||
866 | |||
867 | if (change_num >= zone->changes->num_elements) | ||
868 | break; | ||
869 | |||
870 | zone_change = icalarray_element_at (zone->changes, change_num); | ||
871 | } | ||
872 | |||
873 | /* If we didn't find a change to use, then we have a bug! */ | ||
874 | icalerror_assert (change_num_to_use != -1, | ||
875 | "No applicable timezone change found"); | ||
876 | |||
877 | /* Now we just need to check if the time is in the overlapped region of | ||
878 | time when clocks go back. */ | ||
879 | zone_change = icalarray_element_at (zone->changes, change_num_to_use); | ||
880 | |||
881 | utc_offset_change = zone_change->utc_offset - zone_change->prev_utc_offset; | ||
882 | if (utc_offset_change < 0 && change_num_to_use > 0) { | ||
883 | tmp_change = *zone_change; | ||
884 | icaltimezone_adjust_change (&tmp_change, 0, 0, 0, | ||
885 | tmp_change.prev_utc_offset); | ||
886 | |||
887 | if (icaltimezone_compare_change_fn (&tt_change, &tmp_change) < 0) { | ||
888 | /* The time is in the overlapped region, so we may need to use | ||
889 | either the current zone_change or the previous one. If the | ||
890 | time has the is_daylight field set we use the matching change, | ||
891 | else we use the change with standard time. */ | ||
892 | prev_zone_change = icalarray_element_at (zone->changes, | ||
893 | change_num_to_use - 1); | ||
894 | |||
895 | /* I was going to add an is_daylight flag to struct icaltimetype, | ||
896 | but iCalendar doesn't let us distinguish between standard and | ||
897 | daylight time anyway, so there's no point. So we just use the | ||
898 | standard time instead. */ | ||
899 | want_daylight = (tt->is_daylight == 1) ? 1 : 0; | ||
900 | |||
901 | #if 0 | ||
902 | if (zone_change->is_daylight == prev_zone_change->is_daylight) | ||
903 | printf (" **** Same is_daylight setting\n"); | ||
904 | #endif | ||
905 | |||
906 | if (zone_change->is_daylight != want_daylight | ||
907 | && prev_zone_change->is_daylight == want_daylight) | ||
908 | zone_change = prev_zone_change; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | /* Now we know exactly which timezone change applies to the time, so | ||
913 | we can return the UTC offset and whether it is a daylight time. */ | ||
914 | if (is_daylight) | ||
915 | *is_daylight = zone_change->is_daylight; | ||
916 | return zone_change->utc_offset; | ||
917 | } | ||
918 | |||
919 | |||
920 | /** @deprecated This API wasn't updated when we changed icaltimetype to contain its own | ||
921 | timezone. Also, this takes a pointer instead of the struct. */ | ||
922 | /** Calculates the UTC offset of a given UTC time in the given | ||
923 | timezone. It is the number of seconds to add to UTC to get local | ||
924 | time. The is_daylight flag is set to 1 if the time is in | ||
925 | daylight-savings time. */ | ||
926 | int | ||
927 | icaltimezone_get_utc_offset_of_utc_time (icaltimezone*zone, | ||
928 | struct icaltimetype*tt, | ||
929 | int *is_daylight) | ||
930 | { | ||
931 | icaltimezonechange *zone_change, tt_change, tmp_change; | ||
932 | int change_num, step, change_num_to_use; | ||
933 | |||
934 | if (is_daylight) | ||
935 | *is_daylight = 0; | ||
936 | |||
937 | /* For local times and UTC return 0. */ | ||
938 | if (zone == NULL || zone == &utc_timezone) | ||
939 | return 0; | ||
940 | |||
941 | /* Use the builtin icaltimezone if possible. */ | ||
942 | if (zone->builtin_timezone) | ||
943 | zone = zone->builtin_timezone; | ||
944 | |||
945 | /* Make sure the changes array is expanded up to the given time. */ | ||
946 | icaltimezone_ensure_coverage (zone, tt->year); | ||
947 | |||
948 | if (!zone->changes || zone->changes->num_elements == 0) | ||
949 | return 0; | ||
950 | |||
951 | /* Copy the time parts of the icaltimetype to an icaltimezonechange so we | ||
952 | can use our comparison function on it. */ | ||
953 | tt_change.year = tt->year; | ||
954 | tt_change.month = tt->month; | ||
955 | tt_change.day = tt->day; | ||
956 | tt_change.hour = tt->hour; | ||
957 | tt_change.minute = tt->minute; | ||
958 | tt_change.second = tt->second; | ||
959 | |||
960 | /* This should find a change close to the time, either the change before | ||
961 | it or the change after it. */ | ||
962 | change_num = icaltimezone_find_nearby_change (zone, &tt_change); | ||
963 | |||
964 | /* Sanity check. */ | ||
965 | icalerror_assert (change_num >= 0, | ||
966 | "Negative timezone change index"); | ||
967 | icalerror_assert (change_num < zone->changes->num_elements, | ||
968 | "Timezone change index out of bounds"); | ||
969 | |||
970 | /* Now move backwards or forwards to find the timezone change that applies | ||
971 | to tt. It should only have to do 1 or 2 steps. */ | ||
972 | zone_change = icalarray_element_at (zone->changes, change_num); | ||
973 | step = 1; | ||
974 | change_num_to_use = -1; | ||
975 | for (;;) { | ||
976 | /* Copy the change and adjust it to UTC. */ | ||
977 | tmp_change = *zone_change; | ||
978 | |||
979 | /* If the given time is on or after this change, then this change may | ||
980 | apply, but we continue as a later change may be the right one. | ||
981 | If the given time is before this change, then if we have already | ||
982 | found a change which applies we can use that, else we need to step | ||
983 | backwards. */ | ||
984 | if (icaltimezone_compare_change_fn (&tt_change, &tmp_change) >= 0) | ||
985 | change_num_to_use = change_num; | ||
986 | else | ||
987 | step = -1; | ||
988 | |||
989 | /* If we are stepping backwards through the changes and we have found | ||
990 | a change that applies, then we know this is the change to use so | ||
991 | we exit the loop. */ | ||
992 | if (step == -1 && change_num_to_use != -1) | ||
993 | break; | ||
994 | |||
995 | change_num += step; | ||
996 | |||
997 | /* If we go past the start of the changes array, then we have no data | ||
998 | for this time so we return a UTC offset of 0. */ | ||
999 | if (change_num < 0) | ||
1000 | return 0; | ||
1001 | |||
1002 | if (change_num >= zone->changes->num_elements) | ||
1003 | break; | ||
1004 | |||
1005 | zone_change = icalarray_element_at (zone->changes, change_num); | ||
1006 | } | ||
1007 | |||
1008 | /* If we didn't find a change to use, then we have a bug! */ | ||
1009 | icalerror_assert (change_num_to_use != -1, | ||
1010 | "No applicable timezone change found"); | ||
1011 | |||
1012 | /* Now we know exactly which timezone change applies to the time, so | ||
1013 | we can return the UTC offset and whether it is a daylight time. */ | ||
1014 | zone_change = icalarray_element_at (zone->changes, change_num_to_use); | ||
1015 | if (is_daylight) | ||
1016 | *is_daylight = zone_change->is_daylight; | ||
1017 | |||
1018 | return zone_change->utc_offset; | ||
1019 | } | ||
1020 | |||
1021 | |||
1022 | /** Returns the index of a timezone change which is close to the time | ||
1023 | given in change. */ | ||
1024 | static int | ||
1025 | icaltimezone_find_nearby_change (icaltimezone *zone, | ||
1026 | icaltimezonechange*change) | ||
1027 | { | ||
1028 | icaltimezonechange *zone_change; | ||
1029 | int lower, upper, middle, cmp; | ||
1030 | |||
1031 | /* Do a simple binary search. */ | ||
1032 | lower = middle = 0; | ||
1033 | upper = zone->changes->num_elements; | ||
1034 | |||
1035 | while (lower < upper) { | ||
1036 | middle = (lower + upper) / 2; | ||
1037 | zone_change = icalarray_element_at (zone->changes, middle); | ||
1038 | cmp = icaltimezone_compare_change_fn (change, zone_change); | ||
1039 | if (cmp == 0) | ||
1040 | break; | ||
1041 | else if (cmp < 0) | ||
1042 | upper = middle; | ||
1043 | else | ||
1044 | lower = middle + 1; | ||
1045 | } | ||
1046 | |||
1047 | return middle; | ||
1048 | } | ||
1049 | |||
1050 | |||
1051 | |||
1052 | |||
1053 | /** Adds (or subtracts) a time from a icaltimezonechange. NOTE: This | ||
1054 | function is exactly the same as icaltime_adjust() except for the | ||
1055 | type of the first parameter. */ | ||
1056 | static void | ||
1057 | icaltimezone_adjust_change (icaltimezonechange *tt, | ||
1058 | int days, | ||
1059 | int hours, | ||
1060 | int minutes, | ||
1061 | int seconds) | ||
1062 | { | ||
1063 | int second, minute, hour, day; | ||
1064 | int minutes_overflow, hours_overflow, days_overflow; | ||
1065 | int days_in_month; | ||
1066 | |||
1067 | /* Add on the seconds. */ | ||
1068 | second = tt->second + seconds; | ||
1069 | tt->second = second % 60; | ||
1070 | minutes_overflow = second / 60; | ||
1071 | if (tt->second < 0) { | ||
1072 | tt->second += 60; | ||
1073 | minutes_overflow--; | ||
1074 | } | ||
1075 | |||
1076 | /* Add on the minutes. */ | ||
1077 | minute = tt->minute + minutes + minutes_overflow; | ||
1078 | tt->minute = minute % 60; | ||
1079 | hours_overflow = minute / 60; | ||
1080 | if (tt->minute < 0) { | ||
1081 | tt->minute += 60; | ||
1082 | hours_overflow--; | ||
1083 | } | ||
1084 | |||
1085 | /* Add on the hours. */ | ||
1086 | hour = tt->hour + hours + hours_overflow; | ||
1087 | tt->hour = hour % 24; | ||
1088 | days_overflow = hour / 24; | ||
1089 | if (tt->hour < 0) { | ||
1090 | tt->hour += 24; | ||
1091 | days_overflow--; | ||
1092 | } | ||
1093 | |||
1094 | /* Add on the days. */ | ||
1095 | day = tt->day + days + days_overflow; | ||
1096 | if (day > 0) { | ||
1097 | for (;;) { | ||
1098 | days_in_month = icaltime_days_in_month (tt->month, tt->year); | ||
1099 | if (day <= days_in_month) | ||
1100 | break; | ||
1101 | |||
1102 | tt->month++; | ||
1103 | if (tt->month >= 13) { | ||
1104 | tt->year++; | ||
1105 | tt->month = 1; | ||
1106 | } | ||
1107 | |||
1108 | day -= days_in_month; | ||
1109 | } | ||
1110 | } else { | ||
1111 | while (day <= 0) { | ||
1112 | if (tt->month == 1) { | ||
1113 | tt->year--; | ||
1114 | tt->month = 12; | ||
1115 | } else { | ||
1116 | tt->month--; | ||
1117 | } | ||
1118 | |||
1119 | day += icaltime_days_in_month (tt->month, tt->year); | ||
1120 | } | ||
1121 | } | ||
1122 | tt->day = day; | ||
1123 | } | ||
1124 | |||
1125 | |||
1126 | char* | ||
1127 | icaltimezone_get_tzid (icaltimezone*zone) | ||
1128 | { | ||
1129 | /* If this is a floating time, without a timezone, return NULL. */ | ||
1130 | if (!zone) | ||
1131 | return NULL; | ||
1132 | |||
1133 | if (!zone->tzid) | ||
1134 | icaltimezone_load_builtin_timezone (zone); | ||
1135 | |||
1136 | return zone->tzid; | ||
1137 | } | ||
1138 | |||
1139 | |||
1140 | char* | ||
1141 | icaltimezone_get_location (icaltimezone*zone) | ||
1142 | { | ||
1143 | /* If this is a floating time, without a timezone, return NULL. */ | ||
1144 | if (!zone) | ||
1145 | return NULL; | ||
1146 | |||
1147 | /* Note that for builtin timezones this comes from zones.tab so we don't | ||
1148 | need to check the timezone is loaded here. */ | ||
1149 | return zone->location; | ||
1150 | } | ||
1151 | |||
1152 | |||
1153 | char* | ||
1154 | icaltimezone_get_tznames (icaltimezone*zone) | ||
1155 | { | ||
1156 | /* If this is a floating time, without a timezone, return NULL. */ | ||
1157 | if (!zone) | ||
1158 | return NULL; | ||
1159 | |||
1160 | if (!zone->component) | ||
1161 | icaltimezone_load_builtin_timezone (zone); | ||
1162 | |||
1163 | return zone->tznames; | ||
1164 | } | ||
1165 | |||
1166 | |||
1167 | /** Returns the latitude of a builtin timezone. */ | ||
1168 | double | ||
1169 | icaltimezone_get_latitude (icaltimezone*zone) | ||
1170 | { | ||
1171 | /* If this is a floating time, without a timezone, return 0. */ | ||
1172 | if (!zone) | ||
1173 | return 0.0; | ||
1174 | |||
1175 | /* Note that for builtin timezones this comes from zones.tab so we don't | ||
1176 | need to check the timezone is loaded here. */ | ||
1177 | return zone->latitude; | ||
1178 | } | ||
1179 | |||
1180 | |||
1181 | /** Returns the longitude of a builtin timezone. */ | ||
1182 | double | ||
1183 | icaltimezone_get_longitude (icaltimezone*zone) | ||
1184 | { | ||
1185 | /* If this is a floating time, without a timezone, return 0. */ | ||
1186 | if (!zone) | ||
1187 | return 0.0; | ||
1188 | |||
1189 | /* Note that for builtin timezones this comes from zones.tab so we don't | ||
1190 | need to check the timezone is loaded here. */ | ||
1191 | return zone->longitude; | ||
1192 | } | ||
1193 | |||
1194 | |||
1195 | /** Returns the VTIMEZONE component of a timezone. */ | ||
1196 | icalcomponent* | ||
1197 | icaltimezone_get_component (icaltimezone*zone) | ||
1198 | { | ||
1199 | /* If this is a floating time, without a timezone, return NULL. */ | ||
1200 | if (!zone) | ||
1201 | return NULL; | ||
1202 | |||
1203 | if (!zone->component) | ||
1204 | icaltimezone_load_builtin_timezone (zone); | ||
1205 | |||
1206 | return zone->component; | ||
1207 | } | ||
1208 | |||
1209 | |||
1210 | /** Sets the VTIMEZONE component of an icaltimezone, initializing the | ||
1211 | tzid, location & tzname fields. It returns 1 on success or 0 on | ||
1212 | failure, i.e. no TZID was found. */ | ||
1213 | int | ||
1214 | icaltimezone_set_component (icaltimezone*zone, | ||
1215 | icalcomponent*comp) | ||
1216 | { | ||
1217 | icaltimezone_reset (zone); | ||
1218 | return icaltimezone_get_vtimezone_properties (zone, comp); | ||
1219 | } | ||
1220 | |||
1221 | |||
1222 | icalarray* | ||
1223 | icaltimezone_array_new (void) | ||
1224 | { | ||
1225 | return icalarray_new (sizeof (icaltimezone), 16); | ||
1226 | } | ||
1227 | |||
1228 | |||
1229 | void | ||
1230 | icaltimezone_array_append_from_vtimezone (icalarray*timezones, | ||
1231 | icalcomponent*child) | ||
1232 | { | ||
1233 | icaltimezone zone; | ||
1234 | |||
1235 | icaltimezone_init (&zone); | ||
1236 | if (icaltimezone_get_vtimezone_properties (&zone, child)) | ||
1237 | icalarray_append (timezones, &zone); | ||
1238 | } | ||
1239 | |||
1240 | |||
1241 | void | ||
1242 | icaltimezone_array_free (icalarray*timezones) | ||
1243 | { | ||
1244 | icaltimezone *zone; | ||
1245 | int i; | ||
1246 | |||
1247 | if ( timezones ) | ||
1248 | { | ||
1249 | for (i = 0; i < timezones->num_elements; i++) { | ||
1250 | zone = icalarray_element_at (timezones, i); | ||
1251 | icaltimezone_free (zone, 0); | ||
1252 | } | ||
1253 | |||
1254 | icalarray_free (timezones); | ||
1255 | } | ||
1256 | } | ||
1257 | |||
1258 | |||
1259 | /* | ||
1260 | * BUILTIN TIMEZONE HANDLING | ||
1261 | */ | ||
1262 | |||
1263 | |||
1264 | /** Returns an icalarray of icaltimezone structs, one for each builtin | ||
1265 | timezone. This will load and parse the zones.tab file to get the | ||
1266 | timezone names and their coordinates. It will not load the | ||
1267 | VTIMEZONE data for any timezones. */ | ||
1268 | icalarray* | ||
1269 | icaltimezone_get_builtin_timezones(void) | ||
1270 | { | ||
1271 | if (!builtin_timezones) | ||
1272 | icaltimezone_init_builtin_timezones (); | ||
1273 | |||
1274 | return builtin_timezones; | ||
1275 | } | ||
1276 | |||
1277 | /** Release builtin timezone memory */ | ||
1278 | void | ||
1279 | icaltimezone_free_builtin_timezones(void) | ||
1280 | { | ||
1281 | icaltimezone_array_free(builtin_timezones); | ||
1282 | } | ||
1283 | |||
1284 | |||
1285 | /** Returns a single builtin timezone, given its Olson city name. */ | ||
1286 | icaltimezone* | ||
1287 | icaltimezone_get_builtin_timezone(const char *location) | ||
1288 | { | ||
1289 | icaltimezone *zone; | ||
1290 | int lower, upper, middle, cmp; | ||
1291 | char *zone_location; | ||
1292 | |||
1293 | if (!location || !location[0]) | ||
1294 | return NULL; | ||
1295 | |||
1296 | if (!strcmp (location, "UTC")) | ||
1297 | return &utc_timezone; | ||
1298 | |||
1299 | if (!builtin_timezones) | ||
1300 | icaltimezone_init_builtin_timezones (); | ||
1301 | |||
1302 | /* Do a simple binary search. */ | ||
1303 | lower = middle = 0; | ||
1304 | upper = builtin_timezones->num_elements; | ||
1305 | |||
1306 | while (lower < upper) { | ||
1307 | middle = (lower + upper) / 2; | ||
1308 | zone = icalarray_element_at (builtin_timezones, middle); | ||
1309 | zone_location = icaltimezone_get_location (zone); | ||
1310 | cmp = strcmp (location, zone_location); | ||
1311 | if (cmp == 0) | ||
1312 | return zone; | ||
1313 | else if (cmp < 0) | ||
1314 | upper = middle; | ||
1315 | else | ||
1316 | lower = middle + 1; | ||
1317 | } | ||
1318 | |||
1319 | return NULL; | ||
1320 | } | ||
1321 | |||
1322 | |||
1323 | /** Returns a single builtin timezone, given its TZID. */ | ||
1324 | icaltimezone* | ||
1325 | icaltimezone_get_builtin_timezone_from_tzid (const char *tzid) | ||
1326 | { | ||
1327 | int num_slashes = 0; | ||
1328 | const char *p, *zone_tzid; | ||
1329 | icaltimezone *zone; | ||
1330 | |||
1331 | if (!tzid || !tzid[0]) | ||
1332 | return NULL; | ||
1333 | |||
1334 | /* Check that the TZID starts with our unique prefix. */ | ||
1335 | if (strncmp (tzid, TZID_PREFIX, TZID_PREFIX_LEN)) | ||
1336 | return NULL; | ||
1337 | |||
1338 | /* Get the location, which is after the 3rd '/' character. */ | ||
1339 | p = tzid; | ||
1340 | for (p = tzid; *p; p++) { | ||
1341 | if (*p == '/') { | ||
1342 | num_slashes++; | ||
1343 | if (num_slashes == 3) | ||
1344 | break; | ||
1345 | } | ||
1346 | } | ||
1347 | |||
1348 | if (num_slashes != 3) | ||
1349 | return NULL; | ||
1350 | |||
1351 | p++; | ||
1352 | |||
1353 | /* Now we can use the function to get the builtin timezone from the | ||
1354 | location string. */ | ||
1355 | zone = icaltimezone_get_builtin_timezone (p); | ||
1356 | if (!zone) | ||
1357 | return NULL; | ||
1358 | |||
1359 | /* Check that the builtin TZID matches exactly. We don't want to return | ||
1360 | a different version of the VTIMEZONE. */ | ||
1361 | zone_tzid = icaltimezone_get_tzid (zone); | ||
1362 | if (!strcmp (zone_tzid, tzid)) | ||
1363 | return zone; | ||
1364 | else | ||
1365 | return NULL; | ||
1366 | } | ||
1367 | |||
1368 | |||
1369 | /** Returns the special UTC timezone. */ | ||
1370 | icaltimezone* | ||
1371 | icaltimezone_get_utc_timezone (void) | ||
1372 | { | ||
1373 | if (!builtin_timezones) | ||
1374 | icaltimezone_init_builtin_timezones (); | ||
1375 | |||
1376 | return &utc_timezone; | ||
1377 | } | ||
1378 | |||
1379 | |||
1380 | |||
1381 | /** This initializes the builtin timezone data, i.e. the | ||
1382 | builtin_timezones array and the special UTC timezone. It should be | ||
1383 | called before any code that uses the timezone functions. */ | ||
1384 | static void | ||
1385 | icaltimezone_init_builtin_timezones(void) | ||
1386 | { | ||
1387 | /* Initialize the special UTC timezone. */ | ||
1388 | utc_timezone.tzid = "UTC"; | ||
1389 | |||
1390 | icaltimezone_parse_zone_tab (); | ||
1391 | } | ||
1392 | |||
1393 | |||
1394 | /** This parses the zones.tab file containing the names and locations | ||
1395 | of the builtin timezones. It creates the builtin_timezones array | ||
1396 | which is an icalarray of icaltimezone structs. It only fills in the | ||
1397 | location, latitude and longtude fields; the rest are left | ||
1398 | blank. The VTIMEZONE component is loaded later if it is needed. The | ||
1399 | timezones in the zones.tab file are sorted by their name, which is | ||
1400 | useful for binary searches. */ | ||
1401 | static void | ||
1402 | icaltimezone_parse_zone_tab (void) | ||
1403 | { | ||
1404 | char *filename; | ||
1405 | FILE *fp; | ||
1406 | char buf[1024]; /* Used to store each line of zones.tab as it is read. */ | ||
1407 | char location[1024]; /* Stores the city name when parsing buf. */ | ||
1408 | unsigned int filename_len; | ||
1409 | int latitude_degrees, latitude_minutes, latitude_seconds; | ||
1410 | int longitude_degrees, longitude_minutes, longitude_seconds; | ||
1411 | icaltimezone zone; | ||
1412 | |||
1413 | icalerror_assert (builtin_timezones == NULL, | ||
1414 | "Parsing zones.tab file multiple times"); | ||
1415 | |||
1416 | builtin_timezones = icalarray_new (sizeof (icaltimezone), 32); | ||
1417 | |||
1418 | filename_len = strlen (get_zone_directory()) + strlen (ZONES_TAB_FILENAME) | ||
1419 | + 2; | ||
1420 | |||
1421 | filename = (char*) malloc (filename_len); | ||
1422 | if (!filename) { | ||
1423 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
1424 | return; | ||
1425 | } | ||
1426 | |||
1427 | snprintf (filename, filename_len, "%s/%s", get_zone_directory(), | ||
1428 | ZONES_TAB_FILENAME); | ||
1429 | |||
1430 | fp = fopen (filename, "r"); | ||
1431 | free (filename); | ||
1432 | if (!fp) { | ||
1433 | icalerror_set_errno(ICAL_FILE_ERROR); | ||
1434 | return; | ||
1435 | } | ||
1436 | |||
1437 | while (fgets (buf, sizeof(buf), fp)) { | ||
1438 | if (*buf == '#') continue; | ||
1439 | |||
1440 | /* The format of each line is: "latitude longitude location". */ | ||
1441 | if (sscanf (buf, "%4d%2d%2d %4d%2d%2d %s", | ||
1442 | &latitude_degrees, &latitude_minutes, | ||
1443 | &latitude_seconds, | ||
1444 | &longitude_degrees, &longitude_minutes, | ||
1445 | &longitude_seconds, | ||
1446 | location) != 7) { | ||
1447 | fprintf (stderr, "Invalid timezone description line: %s\n", buf); | ||
1448 | continue; | ||
1449 | } | ||
1450 | |||
1451 | icaltimezone_init (&zone); | ||
1452 | zone.location = strdup (location); | ||
1453 | |||
1454 | if (latitude_degrees >= 0) | ||
1455 | zone.latitude = (double) latitude_degrees | ||
1456 | + (double) latitude_minutes / 60 | ||
1457 | + (double) latitude_seconds / 3600; | ||
1458 | else | ||
1459 | zone.latitude = (double) latitude_degrees | ||
1460 | - (double) latitude_minutes / 60 | ||
1461 | - (double) latitude_seconds / 3600; | ||
1462 | |||
1463 | if (longitude_degrees >= 0) | ||
1464 | zone.longitude = (double) longitude_degrees | ||
1465 | + (double) longitude_minutes / 60 | ||
1466 | + (double) longitude_seconds / 3600; | ||
1467 | else | ||
1468 | zone.longitude = (double) longitude_degrees | ||
1469 | - (double) longitude_minutes / 60 | ||
1470 | - (double) longitude_seconds / 3600; | ||
1471 | |||
1472 | icalarray_append (builtin_timezones, &zone); | ||
1473 | |||
1474 | #if 0 | ||
1475 | printf ("Found zone: %s %f %f\n", | ||
1476 | location, zone.latitude, zone.longitude); | ||
1477 | #endif | ||
1478 | } | ||
1479 | |||
1480 | fclose (fp); | ||
1481 | } | ||
1482 | |||
1483 | |||
1484 | /** Loads the builtin VTIMEZONE data for the given timezone. */ | ||
1485 | static void | ||
1486 | icaltimezone_load_builtin_timezone (icaltimezone*zone) | ||
1487 | { | ||
1488 | char *filename; | ||
1489 | unsigned int filename_len; | ||
1490 | FILE *fp; | ||
1491 | icalparser *parser; | ||
1492 | icalcomponent *comp, *subcomp; | ||
1493 | |||
1494 | /* If the location isn't set, it isn't a builtin timezone. */ | ||
1495 | if (!zone->location || !zone->location[0]) | ||
1496 | return; | ||
1497 | |||
1498 | filename_len = strlen (get_zone_directory()) + strlen (zone->location) + 6; | ||
1499 | |||
1500 | filename = (char*) malloc (filename_len); | ||
1501 | if (!filename) { | ||
1502 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | ||
1503 | return; | ||
1504 | } | ||
1505 | |||
1506 | snprintf (filename, filename_len, "%s/%s.ics", get_zone_directory(), | ||
1507 | zone->location); | ||
1508 | |||
1509 | fp = fopen (filename, "r"); | ||
1510 | free (filename); | ||
1511 | if (!fp) { | ||
1512 | icalerror_set_errno(ICAL_FILE_ERROR); | ||
1513 | return; | ||
1514 | } | ||
1515 | |||
1516 | |||
1517 | /* ##### B.# Sun, 11 Nov 2001 04:04:29 +1100 | ||
1518 | this is where the MALFORMEDDATA error is being set, after the call to 'icalparser_parse' | ||
1519 | fprintf(stderr, "** WARNING ** %s: %d %s\n", __FILE__, __LINE__, icalerror_strerror(icalerrno)); | ||
1520 | */ | ||
1521 | |||
1522 | parser = icalparser_new (); | ||
1523 | icalparser_set_gen_data (parser, fp); | ||
1524 | comp = icalparser_parse (parser, icaltimezone_load_get_line_fn); | ||
1525 | icalparser_free (parser); | ||
1526 | fclose (fp); | ||
1527 | |||
1528 | |||
1529 | |||
1530 | /* Find the VTIMEZONE component inside the VCALENDAR. There should be 1. */ | ||
1531 | subcomp = icalcomponent_get_first_component (comp, | ||
1532 | ICAL_VTIMEZONE_COMPONENT); | ||
1533 | if (!subcomp) { | ||
1534 | icalerror_set_errno(ICAL_PARSE_ERROR); | ||
1535 | return; | ||
1536 | } | ||
1537 | |||
1538 | icaltimezone_get_vtimezone_properties (zone, subcomp); | ||
1539 | |||
1540 | icalcomponent_remove_component(comp,subcomp); | ||
1541 | |||
1542 | icalcomponent_free(comp); | ||
1543 | |||
1544 | } | ||
1545 | |||
1546 | |||
1547 | /** Callback used from icalparser_parse() */ | ||
1548 | static char * | ||
1549 | icaltimezone_load_get_line_fn (char *s, | ||
1550 | size_t size, | ||
1551 | void *data) | ||
1552 | { | ||
1553 | return fgets (s, size, (FILE*) data); | ||
1554 | } | ||
1555 | |||
1556 | |||
1557 | |||
1558 | |||
1559 | /* | ||
1560 | * DEBUGGING | ||
1561 | */ | ||
1562 | |||
1563 | /** | ||
1564 | * This outputs a list of timezone changes for the given timezone to the | ||
1565 | * given file, up to the maximum year given. We compare this output with the | ||
1566 | * output from 'vzic --dump-changes' to make sure that we are consistent. | ||
1567 | * (vzic is the Olson timezone database to VTIMEZONE converter.) | ||
1568 | * | ||
1569 | * The output format is: | ||
1570 | * | ||
1571 | *Zone-Name [tab] Date [tab] Time [tab] UTC-Offset | ||
1572 | * | ||
1573 | * The Date and Time fields specify the time change in UTC. | ||
1574 | * | ||
1575 | * The UTC Offset is for local (wall-clock) time. It is the amount of time | ||
1576 | * to add to UTC to get local time. | ||
1577 | */ | ||
1578 | int | ||
1579 | icaltimezone_dump_changes (icaltimezone*zone, | ||
1580 | int max_year, | ||
1581 | FILE *fp) | ||
1582 | { | ||
1583 | static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", | ||
1584 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; | ||
1585 | icaltimezonechange *zone_change; | ||
1586 | int change_num; | ||
1587 | char buffer[8]; | ||
1588 | |||
1589 | /* Make sure the changes array is expanded up to the given time. */ | ||
1590 | icaltimezone_ensure_coverage (zone, max_year); | ||
1591 | |||
1592 | #if 0 | ||
1593 | printf ("Num changes: %i\n", zone->changes->num_elements); | ||
1594 | #endif | ||
1595 | |||
1596 | change_num = 0; | ||
1597 | for (change_num = 0; change_num < zone->changes->num_elements; change_num++) { | ||
1598 | zone_change = icalarray_element_at (zone->changes, change_num); | ||
1599 | |||
1600 | if (zone_change->year > max_year) | ||
1601 | break; | ||
1602 | |||
1603 | fprintf (fp, "%s\t%2i %s %04i\t%2i:%02i:%02i", | ||
1604 | zone->location, | ||
1605 | zone_change->day, months[zone_change->month - 1], | ||
1606 | zone_change->year, | ||
1607 | zone_change->hour, zone_change->minute, zone_change->second); | ||
1608 | |||
1609 | /* Wall Clock Time offset from UTC. */ | ||
1610 | format_utc_offset (zone_change->utc_offset, buffer); | ||
1611 | fprintf (fp, "\t%s", buffer); | ||
1612 | |||
1613 | fprintf (fp, "\n"); | ||
1614 | } | ||
1615 | return 1; | ||
1616 | } | ||
1617 | |||
1618 | |||
1619 | /** This formats a UTC offset as "+HHMM" or "+HHMMSS". | ||
1620 | buffer should have space for 8 characters. */ | ||
1621 | static void | ||
1622 | format_utc_offset (int utc_offset, | ||
1623 | char *buffer) | ||
1624 | { | ||
1625 | char *sign = "+"; | ||
1626 | int hours, minutes, seconds; | ||
1627 | |||
1628 | if (utc_offset < 0) { | ||
1629 | utc_offset = -utc_offset; | ||
1630 | sign = "-"; | ||
1631 | } | ||
1632 | |||
1633 | hours = utc_offset / 3600; | ||
1634 | minutes = (utc_offset % 3600) / 60; | ||
1635 | seconds = utc_offset % 60; | ||
1636 | |||
1637 | /* Sanity check. Standard timezone offsets shouldn't be much more than 12 | ||
1638 | hours, and daylight saving shouldn't change it by more than a few hours. | ||
1639 | (The maximum offset is 15 hours 56 minutes at present.) */ | ||
1640 | if (hours < 0 || hours >= 24 || minutes < 0 || minutes >= 60 | ||
1641 | || seconds < 0 || seconds >= 60) { | ||
1642 | fprintf (stderr, "Warning: Strange timezone offset: H:%i M:%i S:%i\n", | ||
1643 | hours, minutes, seconds); | ||
1644 | } | ||
1645 | |||
1646 | if (seconds == 0) | ||
1647 | sprintf (buffer, "%s%02i%02i", sign, hours, minutes); | ||
1648 | else | ||
1649 | sprintf (buffer, "%s%02i%02i%02i", sign, hours, minutes, seconds); | ||
1650 | } | ||
1651 | |||
1652 | static char* get_zone_directory(void) | ||
1653 | { | ||
1654 | return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory; | ||
1655 | } | ||
1656 | |||
1657 | void set_zone_directory(char *path) | ||
1658 | { | ||
1659 | zone_files_directory = malloc(strlen(path)+1); | ||
1660 | if ( zone_files_directory != NULL ) | ||
1661 | { | ||
1662 | strcpy(zone_files_directory,path); | ||
1663 | } | ||
1664 | } | ||
1665 | |||
1666 | void free_zone_directory(void) | ||
1667 | { | ||
1668 | if ( zone_files_directory != NULL ) | ||
1669 | { | ||
1670 | free(zone_files_directory); | ||
1671 | } | ||
1672 | } | ||
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 @@ | |||
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icaltimezone.h | ||
4 | CREATOR: Damon Chaplin 15 March 2001 | ||
5 | |||
6 | |||
7 | $Id$ | ||
8 | $Locker$ | ||
9 | |||
10 | (C) COPYRIGHT 2001, Damon Chaplin | ||
11 | |||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of either: | ||
14 | |||
15 | The LGPL as published by the Free Software Foundation, version | ||
16 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
17 | |||
18 | Or: | ||
19 | |||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
21 | the License at http://www.mozilla.org/MPL/ | ||
22 | |||
23 | |||
24 | ======================================================================*/ | ||
25 | /** | ||
26 | * @file icaltimezone.h | ||
27 | * @brief timezone handling routines | ||
28 | */ | ||
29 | |||
30 | #ifndef ICALTIMEZONE_H | ||
31 | #define ICALTIMEZONE_H | ||
32 | |||
33 | #include <stdio.h> /* For FILE* */ | ||
34 | #include "icaltime.h" | ||
35 | #include "icalarray.h" | ||
36 | #include "icalcomponent.h" | ||
37 | |||
38 | |||
39 | #ifndef ICALTIMEZONE_DEFINED | ||
40 | #define ICALTIMEZONE_DEFINED | ||
41 | /** @brief An opaque struct representing a timezone. | ||
42 | * We declare this here to avoid a circular dependancy. | ||
43 | */ | ||
44 | typedef struct _icaltimezone icaltimezone; | ||
45 | #endif | ||
46 | |||
47 | /** | ||
48 | * @par Creating/Destroying individual icaltimezones. | ||
49 | */ | ||
50 | |||
51 | /** Creates a new icaltimezone. */ | ||
52 | icaltimezone *icaltimezone_new (void); | ||
53 | |||
54 | /** Frees all memory used for the icaltimezone. Set free_struct to free the | ||
55 | icaltimezone struct as well. */ | ||
56 | void icaltimezone_free (icaltimezone *zone, | ||
57 | int free_struct); | ||
58 | |||
59 | |||
60 | /** | ||
61 | * @par Accessing timezones. | ||
62 | */ | ||
63 | |||
64 | /** Free any builtin timezone information **/ | ||
65 | void icaltimezone_free_builtin_timezones(void); | ||
66 | |||
67 | /** Returns the array of builtin icaltimezones. */ | ||
68 | icalarray* icaltimezone_get_builtin_timezones(void); | ||
69 | |||
70 | /** Returns a single builtin timezone, given its Olson city name. */ | ||
71 | icaltimezone* icaltimezone_get_builtin_timezone(const char *location); | ||
72 | |||
73 | /** Returns a single builtin timezone, given its TZID. */ | ||
74 | icaltimezone* icaltimezone_get_builtin_timezone_from_tzid (const char *tzid); | ||
75 | |||
76 | /** Returns the UTC timezone. */ | ||
77 | icaltimezone* icaltimezone_get_utc_timezone(void); | ||
78 | |||
79 | /** Returns the TZID of a timezone. */ | ||
80 | char* icaltimezone_get_tzid (icaltimezone*zone); | ||
81 | |||
82 | /** Returns the city name of a timezone. */ | ||
83 | char* icaltimezone_get_location (icaltimezone*zone); | ||
84 | |||
85 | /** Returns the TZNAME properties used in the latest STANDARD and DAYLIGHT | ||
86 | components. If they are the same it will return just one, e.g. "LMT". | ||
87 | If they are different it will format them like "EST/EDT". Note that this | ||
88 | may also return NULL. */ | ||
89 | char* icaltimezone_get_tznames (icaltimezone*zone); | ||
90 | |||
91 | /** Returns the latitude of a builtin timezone. */ | ||
92 | double icaltimezone_get_latitude (icaltimezone*zone); | ||
93 | |||
94 | /** Returns the longitude of a builtin timezone. */ | ||
95 | double icaltimezone_get_longitude (icaltimezone*zone); | ||
96 | |||
97 | /** Returns the VTIMEZONE component of a timezone. */ | ||
98 | icalcomponent* icaltimezone_get_component (icaltimezone*zone); | ||
99 | |||
100 | /** Sets the VTIMEZONE component of an icaltimezone, initializing the tzid, | ||
101 | location & tzname fields. It returns 1 on success or 0 on failure, i.e. | ||
102 | no TZID was found. */ | ||
103 | int icaltimezone_set_component (icaltimezone*zone, | ||
104 | icalcomponent*comp); | ||
105 | |||
106 | /** | ||
107 | * @par Converting times between timezones. | ||
108 | */ | ||
109 | |||
110 | void icaltimezone_convert_time (struct icaltimetype *tt, | ||
111 | icaltimezone*from_zone, | ||
112 | icaltimezone*to_zone); | ||
113 | |||
114 | |||
115 | /** | ||
116 | * @par Getting offsets from UTC. | ||
117 | */ | ||
118 | |||
119 | /** Calculates the UTC offset of a given local time in the given | ||
120 | timezone. It is the number of seconds to add to UTC to get local | ||
121 | time. The is_daylight flag is set to 1 if the time is in | ||
122 | daylight-savings time. */ | ||
123 | int icaltimezone_get_utc_offset (icaltimezone*zone, | ||
124 | struct icaltimetype *tt, | ||
125 | int *is_daylight); | ||
126 | |||
127 | /** Calculates the UTC offset of a given UTC time in the given | ||
128 | timezone. It is the number of seconds to add to UTC to get local | ||
129 | time. The is_daylight flag is set to 1 if the time is in | ||
130 | daylight-savings time. */ | ||
131 | int icaltimezone_get_utc_offset_of_utc_time (icaltimezone*zone, | ||
132 | struct icaltimetype *tt, | ||
133 | int *is_daylight); | ||
134 | |||
135 | |||
136 | |||
137 | /* | ||
138 | * Handling arrays of timezones. Mainly for internal use. | ||
139 | */ | ||
140 | icalarray* icaltimezone_array_new (void); | ||
141 | |||
142 | void icaltimezone_array_append_from_vtimezone (icalarray *timezones, | ||
143 | icalcomponent *child); | ||
144 | void icaltimezone_array_free (icalarray*timezones); | ||
145 | |||
146 | |||
147 | /* | ||
148 | * @par Handling the default location the timezone files | ||
149 | */ | ||
150 | |||
151 | /** Set the directory to look for the zonefiles */ | ||
152 | void set_zone_directory(char *path); | ||
153 | |||
154 | /** Free memory dedicated to the zonefile directory */ | ||
155 | void free_zone_directory(void); | ||
156 | |||
157 | /* | ||
158 | * @par Debugging Output. | ||
159 | */ | ||
160 | |||
161 | /** Dumps information about changes in the timezone up to and including | ||
162 | max_year. */ | ||
163 | int icaltimezone_dump_changes (icaltimezone*zone, | ||
164 | int max_year, | ||
165 | FILE *fp); | ||
166 | |||
167 | #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 | |||
@@ -35,137 +35,43 @@ | |||
35 | #include <string.h> /* for icalmemory_strdup */ | 35 | #include <string.h> /* for icalmemory_strdup */ |
36 | #include <assert.h> | 36 | #include <assert.h> |
37 | 37 | ||
38 | int snprintf(char *str, size_t n, char const *fmt, ...); | 38 | #ifdef WIN32 |
39 | #define snprintf _snprintf | ||
40 | #define strcasecmp stricmp | ||
41 | #endif | ||
39 | 42 | ||
40 | #define TEMP_MAX 1024 | 43 | #define TEMP_MAX 1024 |
41 | 44 | ||
42 | void* | ||
43 | icalattachtype_get_data (struct icalattachtype* type); | ||
44 | 45 | ||
45 | struct icalattachtype* | 46 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr) |
46 | icalattachtype_new() | ||
47 | { | 47 | { |
48 | struct icalattachtype* v; | 48 | if(icaltime_is_null_time(tr.time) && |
49 | 49 | icaldurationtype_is_null_duration(tr.duration)){ | |
50 | if ( ( v = (struct icalattachtype*) | 50 | return 1; |
51 | malloc(sizeof(struct icalattachtype))) == 0) { | ||
52 | errno = ENOMEM; | ||
53 | return 0; | ||
54 | } | 51 | } |
55 | 52 | ||
56 | v->refcount = 1; | 53 | return 0; |
57 | |||
58 | v->binary = 0; | ||
59 | v->owns_binary = 0; | ||
60 | v->base64 = 0; | ||
61 | //fprintf(stderr,"setting base 64 to 0 \n"); | ||
62 | |||
63 | v->owns_base64 = 0; | ||
64 | |||
65 | v->url = 0; | ||
66 | |||
67 | return v; | ||
68 | } | 54 | } |
69 | |||
70 | |||
71 | void | ||
72 | icalattachtype_free(struct icalattachtype* v) | ||
73 | { | ||
74 | icalerror_check_arg( (v!=0),"v"); | ||
75 | 55 | ||
76 | v->refcount--; | 56 | int icaltriggertype_is_bad_trigger(struct icaltriggertype tr) |
77 | |||
78 | if (v->refcount <= 0){ | ||
79 | |||
80 | if (v->base64 != 0 && v->owns_base64 != 0){ | ||
81 | int val = v->base64 ; | ||
82 | if ( val < 255 ) { | ||
83 | fprintf(stderr,"Possible error in attachment processing (%d)\nPocssible solution: Remove attachment from file.\n",val ); | ||
84 | } | ||
85 | free(v->base64); | ||
86 | } | ||
87 | |||
88 | if (v->binary != 0 && v->owns_binary != 0){ | ||
89 | free(v->binary); | ||
90 | } | ||
91 | |||
92 | if (v->url != 0){ | ||
93 | free(v->url); | ||
94 | } | ||
95 | |||
96 | free(v); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | void icalattachtype_add_reference(struct icalattachtype* v) | ||
101 | { | ||
102 | icalerror_check_arg( (v!=0),"v"); | ||
103 | v->refcount++; | ||
104 | } | ||
105 | |||
106 | void icalattachtype_set_url(struct icalattachtype* v, char* url) | ||
107 | { | 57 | { |
108 | icalerror_check_arg( (v!=0),"v"); | 58 | if(icaldurationtype_is_bad_duration(tr.duration)){ |
109 | 59 | return 1; | |
110 | if (v->url != 0){ | ||
111 | free (v->url); | ||
112 | } | 60 | } |
113 | 61 | ||
114 | v->url = icalmemory_strdup(url); | 62 | return 0; |
115 | |||
116 | /* HACK This routine should do something if icalmemory_strdup returns NULL */ | ||
117 | |||
118 | } | ||
119 | |||
120 | char* icalattachtype_get_url(struct icalattachtype* v) | ||
121 | { | ||
122 | icalerror_check_arg( (v!=0),"v"); | ||
123 | return v->url; | ||
124 | } | ||
125 | |||
126 | void icalattachtype_set_base64(struct icalattachtype* v, char* base64, | ||
127 | int owns) | ||
128 | { | ||
129 | //fprintf(stderr,"1setbase64 %d \n", base64 ); | ||
130 | icalerror_check_arg( (v!=0),"v"); | ||
131 | //fprintf(stderr,"setbase64 %d \n", base64 ); | ||
132 | v->base64 = base64; | ||
133 | v->owns_base64 = !(owns != 0 ); | ||
134 | |||
135 | } | ||
136 | |||
137 | char* icalattachtype_get_base64(struct icalattachtype* v) | ||
138 | { | ||
139 | icalerror_check_arg( (v!=0),"v"); | ||
140 | return v->base64; | ||
141 | } | 63 | } |
142 | 64 | ||
143 | void icalattachtype_set_binary(struct icalattachtype* v, char* binary, | 65 | struct icaltriggertype icaltriggertype_from_int(const int reltime) |
144 | int owns) | ||
145 | { | 66 | { |
146 | icalerror_check_arg( (v!=0),"v"); | 67 | struct icaltriggertype tr; |
147 | 68 | ||
148 | v->binary = binary; | 69 | tr.time= icaltime_null_time(); |
149 | v->owns_binary = !(owns != 0 ); | 70 | tr.duration = icaldurationtype_from_int(reltime); |
150 | 71 | ||
72 | return tr; | ||
151 | } | 73 | } |
152 | 74 | ||
153 | void* icalattachtype_get_binary(struct icalattachtype* v) | ||
154 | { | ||
155 | icalerror_check_arg( (v!=0),"v"); | ||
156 | return v->binary; | ||
157 | } | ||
158 | |||
159 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr) | ||
160 | { | ||
161 | if(icaltime_is_null_time(tr.time) && | ||
162 | icaldurationtype_is_null_duration(tr.duration)){ | ||
163 | return 1; | ||
164 | } | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | struct icaltriggertype icaltriggertype_from_string(const char* str) | 75 | struct icaltriggertype icaltriggertype_from_string(const char* str) |
170 | { | 76 | { |
171 | 77 | ||
@@ -181,7 +87,7 @@ struct icaltriggertype icaltriggertype_from_string(const char* str) | |||
181 | 87 | ||
182 | if(str == 0) goto error; | 88 | if(str == 0) goto error; |
183 | 89 | ||
184 | /* Surpress errors so a failure in icaltime_from_string() does not cause an abort */ | 90 | /* Suppress errors so a failure in icaltime_from_string() does not cause an abort */ |
185 | es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR); | 91 | es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR); |
186 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL); | 92 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL); |
187 | e = icalerrno; | 93 | e = icalerrno; |
@@ -193,7 +99,7 @@ struct icaltriggertype icaltriggertype_from_string(const char* str) | |||
193 | 99 | ||
194 | tr.duration = icaldurationtype_from_string(str); | 100 | tr.duration = icaldurationtype_from_string(str); |
195 | 101 | ||
196 | if(icaldurationtype_as_int(tr.duration) == 0) goto error; | 102 | if (icaldurationtype_is_bad_duration(tr.duration)) goto error; |
197 | } | 103 | } |
198 | 104 | ||
199 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); | 105 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); |
@@ -203,7 +109,7 @@ struct icaltriggertype icaltriggertype_from_string(const char* str) | |||
203 | error: | 109 | error: |
204 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); | 110 | icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es); |
205 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 111 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
206 | return null_tr; | 112 | return tr; |
207 | 113 | ||
208 | } | 114 | } |
209 | 115 | ||
@@ -212,7 +118,7 @@ struct icalreqstattype icalreqstattype_from_string(const char* str) | |||
212 | { | 118 | { |
213 | const char *p1,*p2; | 119 | const char *p1,*p2; |
214 | struct icalreqstattype stat; | 120 | struct icalreqstattype stat; |
215 | int major, minor; | 121 | short major=0, minor=0; |
216 | 122 | ||
217 | icalerror_check_arg((str != 0),"str"); | 123 | icalerror_check_arg((str != 0),"str"); |
218 | 124 | ||
@@ -222,7 +128,7 @@ struct icalreqstattype icalreqstattype_from_string(const char* str) | |||
222 | 128 | ||
223 | /* Get the status numbers */ | 129 | /* Get the status numbers */ |
224 | 130 | ||
225 | sscanf(str, "%d.%d",&major, &minor); | 131 | sscanf(str, "%hd.%hd",&major, &minor); |
226 | 132 | ||
227 | if (major <= 0 || minor < 0){ | 133 | if (major <= 0 || minor < 0){ |
228 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | 134 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); |
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 | |||
@@ -31,39 +31,6 @@ | |||
31 | #include "icalperiod.h" | 31 | #include "icalperiod.h" |
32 | 32 | ||
33 | 33 | ||
34 | /* This type type should probably be an opaque type... */ | ||
35 | struct icalattachtype | ||
36 | { | ||
37 | void* binary; | ||
38 | int owns_binary; | ||
39 | |||
40 | char* base64; | ||
41 | int owns_base64; | ||
42 | |||
43 | char* url; | ||
44 | |||
45 | int refcount; | ||
46 | |||
47 | }; | ||
48 | |||
49 | /* converts base64 to binary, fetches url and stores as binary, or | ||
50 | just returns data */ | ||
51 | |||
52 | struct icalattachtype* icalattachtype_new(void); | ||
53 | void icalattachtype_add_reference(struct icalattachtype* v); | ||
54 | void icalattachtype_free(struct icalattachtype* v); | ||
55 | |||
56 | void icalattachtype_set_url(struct icalattachtype* v, char* url); | ||
57 | char* icalattachtype_get_url(struct icalattachtype* v); | ||
58 | |||
59 | void icalattachtype_set_base64(struct icalattachtype* v, char* base64, | ||
60 | int owns); | ||
61 | char* icalattachtype_get_base64(struct icalattachtype* v); | ||
62 | |||
63 | void icalattachtype_set_binary(struct icalattachtype* v, char* binary, | ||
64 | int owns); | ||
65 | void* icalattachtype_get_binary(struct icalattachtype* v); | ||
66 | |||
67 | struct icalgeotype | 34 | struct icalgeotype |
68 | { | 35 | { |
69 | float lat; | 36 | float lat; |
@@ -84,9 +51,11 @@ struct icaltriggertype | |||
84 | struct icaldurationtype duration; | 51 | struct icaldurationtype duration; |
85 | }; | 52 | }; |
86 | 53 | ||
54 | struct icaltriggertype icaltriggertype_from_int(const int reltime); | ||
87 | struct icaltriggertype icaltriggertype_from_string(const char* str); | 55 | struct icaltriggertype icaltriggertype_from_string(const char* str); |
88 | 56 | ||
89 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr); | 57 | int icaltriggertype_is_null_trigger(struct icaltriggertype tr); |
58 | int icaltriggertype_is_bad_trigger(struct icaltriggertype tr); | ||
90 | 59 | ||
91 | /* struct icalreqstattype. This struct contains two string pointers, | 60 | /* struct icalreqstattype. This struct contains two string pointers, |
92 | but don't try to free either of them. The "desc" string is a pointer | 61 | but don't try to free either of them. The "desc" string is a pointer |
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,4 +1,5 @@ | |||
1 | /* -*- Mode: C -*- */ | 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | /* vi:set ts=4 sts=4 sw=4 expandtab : */ | ||
2 | /*====================================================================== | 3 | /*====================================================================== |
3 | FILE: icalvalue.c | 4 | FILE: icalvalue.c |
4 | CREATOR: eric 02 May 1999 | 5 | CREATOR: eric 02 May 1999 |
@@ -46,7 +47,10 @@ | |||
46 | #include <stdlib.h> /* for atoi and atof */ | 47 | #include <stdlib.h> /* for atoi and atof */ |
47 | #include <limits.h> /* for SHRT_MAX */ | 48 | #include <limits.h> /* for SHRT_MAX */ |
48 | 49 | ||
49 | int snprintf(char *str, size_t n, char const *fmt, ...); | 50 | #ifdef WIN32 |
51 | #define snprintf _snprintf | ||
52 | #define strcasecmp stricmp | ||
53 | #endif | ||
50 | 54 | ||
51 | #if _MAC_OS_ | 55 | #if _MAC_OS_ |
52 | #include "icalmemory_strdup.h" | 56 | #include "icalmemory_strdup.h" |
@@ -54,16 +58,18 @@ int snprintf(char *str, size_t n, char const *fmt, ...); | |||
54 | 58 | ||
55 | #define TMP_BUF_SIZE 1024 | 59 | #define TMP_BUF_SIZE 1024 |
56 | 60 | ||
57 | void print_datetime_to_string(char* str, struct icaltimetype *data); | 61 | void print_datetime_to_string(char* str, const struct icaltimetype *data); |
58 | void print_date_to_string(char* str, struct icaltimetype *data); | 62 | void print_date_to_string(char* str, const struct icaltimetype *data); |
59 | void print_time_to_string(char* str, struct icaltimetype *data); | 63 | void print_time_to_string(char* str, const struct icaltimetype *data); |
60 | void print_recur_to_string(char* str, struct icaltimetype *data); | ||
61 | 64 | ||
62 | 65 | ||
63 | struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){ | 66 | struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){ |
64 | 67 | ||
65 | struct icalvalue_impl* v; | 68 | struct icalvalue_impl* v; |
66 | 69 | ||
70 | if (!icalvalue_kind_is_valid(kind)) | ||
71 | return NULL; | ||
72 | |||
67 | if ( ( v = (struct icalvalue_impl*) | 73 | if ( ( v = (struct icalvalue_impl*) |
68 | malloc(sizeof(struct icalvalue_impl))) == 0) { | 74 | malloc(sizeof(struct icalvalue_impl))) == 0) { |
69 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); | 75 | icalerror_set_errno(ICAL_NEWFAILED_ERROR); |
@@ -90,10 +96,8 @@ icalvalue_new (icalvalue_kind kind) | |||
90 | return (icalvalue*)icalvalue_new_impl(kind); | 96 | return (icalvalue*)icalvalue_new_impl(kind); |
91 | } | 97 | } |
92 | 98 | ||
93 | icalvalue* icalvalue_new_clone(icalvalue* value){ | 99 | icalvalue* icalvalue_new_clone(const icalvalue* old) { |
94 | |||
95 | struct icalvalue_impl* new; | 100 | struct icalvalue_impl* new; |
96 | struct icalvalue_impl* old = (struct icalvalue_impl*)value; | ||
97 | 101 | ||
98 | new = icalvalue_new_impl(old->kind); | 102 | new = icalvalue_new_impl(old->kind); |
99 | 103 | ||
@@ -101,21 +105,25 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ | |||
101 | return 0; | 105 | return 0; |
102 | } | 106 | } |
103 | 107 | ||
104 | |||
105 | strcpy(new->id, old->id); | 108 | strcpy(new->id, old->id); |
106 | new->kind = old->kind; | 109 | new->kind = old->kind; |
107 | new->size = old->size; | 110 | new->size = old->size; |
108 | 111 | ||
109 | switch (new->kind){ | 112 | switch (new->kind){ |
110 | |||
111 | /* The contents of the attach value may or may not be owned by the | ||
112 | * library. */ | ||
113 | case ICAL_ATTACH_VALUE: | 113 | case ICAL_ATTACH_VALUE: |
114 | case ICAL_BINARY_VALUE: | 114 | case ICAL_BINARY_VALUE: |
115 | { | 115 | { |
116 | /* HACK ugh. I don't feel like impleenting this */ | 116 | /* Hmm. We just ref the attach value, which may not be the right |
117 | } | 117 | * thing to do. We cannot quite copy the data, anyways, since we |
118 | * don't know how long it is. | ||
119 | */ | ||
120 | new->data.v_attach = old->data.v_attach; | ||
121 | if (new->data.v_attach) | ||
122 | icalattach_ref (new->data.v_attach); | ||
118 | 123 | ||
124 | break; | ||
125 | } | ||
126 | case ICAL_QUERY_VALUE: | ||
119 | case ICAL_STRING_VALUE: | 127 | case ICAL_STRING_VALUE: |
120 | case ICAL_TEXT_VALUE: | 128 | case ICAL_TEXT_VALUE: |
121 | case ICAL_CALADDRESS_VALUE: | 129 | case ICAL_CALADDRESS_VALUE: |
@@ -146,6 +154,19 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ | |||
146 | break; | 154 | break; |
147 | } | 155 | } |
148 | 156 | ||
157 | case ICAL_X_VALUE: | ||
158 | { | ||
159 | if (old->x_value != 0) { | ||
160 | new->x_value=icalmemory_strdup(old->x_value); | ||
161 | |||
162 | if (new->x_value == 0) { | ||
163 | return 0; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | break; | ||
168 | } | ||
169 | |||
149 | default: | 170 | default: |
150 | { | 171 | { |
151 | /* all of the other types are stored as values, not | 172 | /* all of the other types are stored as values, not |
@@ -158,7 +179,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ | |||
158 | return new; | 179 | return new; |
159 | } | 180 | } |
160 | 181 | ||
161 | char* icalmemory_strdup_and_dequote(const char* str) | 182 | static char* icalmemory_strdup_and_dequote(const char* str) |
162 | { | 183 | { |
163 | const char* p; | 184 | const char* p; |
164 | char* out = (char*)malloc(sizeof(char) * strlen(str) +1); | 185 | char* out = (char*)malloc(sizeof(char) * strlen(str) +1); |
@@ -183,18 +204,39 @@ char* icalmemory_strdup_and_dequote(const char* str) | |||
183 | 204 | ||
184 | } | 205 | } |
185 | case 'n': | 206 | case 'n': |
207 | case 'N': | ||
186 | { | 208 | { |
187 | *pout = '\n'; | 209 | *pout = '\n'; |
188 | break; | 210 | break; |
189 | } | 211 | } |
190 | case 'N': | 212 | case 't': |
213 | case 'T': | ||
191 | { | 214 | { |
192 | *pout = '\n'; | 215 | *pout = '\t'; |
216 | break; | ||
217 | } | ||
218 | case 'r': | ||
219 | case 'R': | ||
220 | { | ||
221 | *pout = '\r'; | ||
222 | break; | ||
223 | } | ||
224 | case 'b': | ||
225 | case 'B': | ||
226 | { | ||
227 | *pout = '\b'; | ||
228 | break; | ||
229 | } | ||
230 | case 'f': | ||
231 | case 'F': | ||
232 | { | ||
233 | *pout = '\f'; | ||
193 | break; | 234 | break; |
194 | } | 235 | } |
195 | case '\\': | ||
196 | case ',': | ||
197 | case ';': | 236 | case ';': |
237 | case ',': | ||
238 | case '"': | ||
239 | case '\\': | ||
198 | { | 240 | { |
199 | *pout = *p; | 241 | *pout = *p; |
200 | break; | 242 | break; |
@@ -217,9 +259,16 @@ char* icalmemory_strdup_and_dequote(const char* str) | |||
217 | return out; | 259 | return out; |
218 | } | 260 | } |
219 | 261 | ||
262 | /* | ||
263 | * FIXME | ||
264 | * | ||
265 | * This is a bad API, as it forces callers to specify their own X type. | ||
266 | * This function should take care of this by itself. | ||
267 | */ | ||
268 | static | ||
220 | icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str) | 269 | icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str) |
221 | { | 270 | { |
222 | int e = icalproperty_string_to_enum(str); | 271 | int e = icalproperty_kind_and_string_to_enum(kind, str); |
223 | struct icalvalue_impl *value; | 272 | struct icalvalue_impl *value; |
224 | 273 | ||
225 | if(e != 0 && icalproperty_enum_belongs_to_property( | 274 | if(e != 0 && icalproperty_enum_belongs_to_property( |
@@ -242,7 +291,6 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
242 | { | 291 | { |
243 | 292 | ||
244 | struct icalvalue_impl *value = 0; | 293 | struct icalvalue_impl *value = 0; |
245 | struct icalattachtype *attach = 0; | ||
246 | 294 | ||
247 | icalerror_check_arg_rz(str!=0,"str"); | 295 | icalerror_check_arg_rz(str!=0,"str"); |
248 | 296 | ||
@@ -253,12 +301,19 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
253 | switch (kind){ | 301 | switch (kind){ |
254 | 302 | ||
255 | case ICAL_ATTACH_VALUE: | 303 | case ICAL_ATTACH_VALUE: |
256 | attach = icalattachtype_new(); | 304 | { |
257 | value = icalvalue_new_attach( attach ); | 305 | icalattach *attach; |
258 | icalattachtype_free( attach ); | 306 | |
259 | icalattachtype_set_url( value->data.v_attach, str ); | 307 | attach = icalattach_new_from_url (str); |
260 | break; | 308 | if (!attach) |
261 | case ICAL_BINARY_VALUE: | 309 | break; |
310 | |||
311 | value = icalvalue_new_attach (attach); | ||
312 | icalattach_unref (attach); | ||
313 | break; | ||
314 | } | ||
315 | |||
316 | case ICAL_BINARY_VALUE: | ||
262 | case ICAL_BOOLEAN_VALUE: | 317 | case ICAL_BOOLEAN_VALUE: |
263 | { | 318 | { |
264 | /* HACK */ | 319 | /* HACK */ |
@@ -267,7 +322,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
267 | if (error != 0){ | 322 | if (error != 0){ |
268 | char temp[TMP_BUF_SIZE]; | 323 | char temp[TMP_BUF_SIZE]; |
269 | sprintf(temp,"%s Values are not implemented", | 324 | sprintf(temp,"%s Values are not implemented", |
270 | icalparameter_kind_to_string(kind)); | 325 | icalvalue_kind_to_string(kind)); |
271 | *error = icalproperty_vanew_xlicerror( | 326 | *error = icalproperty_vanew_xlicerror( |
272 | temp, | 327 | temp, |
273 | icalparameter_new_xlicerrortype( | 328 | icalparameter_new_xlicerrortype( |
@@ -279,37 +334,50 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
279 | 334 | ||
280 | 335 | ||
281 | case ICAL_TRANSP_VALUE: | 336 | case ICAL_TRANSP_VALUE: |
282 | value = icalvalue_new_enum(kind, ICAL_TRANSP_X,str); | 337 | value = icalvalue_new_enum(kind, (int)ICAL_TRANSP_X,str); |
283 | break; | 338 | break; |
284 | case ICAL_METHOD_VALUE: | 339 | case ICAL_METHOD_VALUE: |
285 | value = icalvalue_new_enum(kind, ICAL_METHOD_X,str); | 340 | value = icalvalue_new_enum(kind, (int)ICAL_METHOD_X,str); |
286 | break; | 341 | break; |
287 | case ICAL_STATUS_VALUE: | 342 | case ICAL_STATUS_VALUE: |
288 | value = icalvalue_new_enum(kind, ICAL_STATUS_X,str); | 343 | value = icalvalue_new_enum(kind, (int)ICAL_STATUS_X,str); |
289 | break; | 344 | break; |
290 | case ICAL_ACTION_VALUE: | 345 | case ICAL_ACTION_VALUE: |
291 | value = icalvalue_new_enum(kind, ICAL_ACTION_X,str); | 346 | value = icalvalue_new_enum(kind, (int)ICAL_ACTION_X,str); |
292 | break; | 347 | break; |
348 | |||
349 | case ICAL_QUERY_VALUE: | ||
350 | value = icalvalue_new_query(str); | ||
351 | break; | ||
352 | |||
293 | case ICAL_CLASS_VALUE: | 353 | case ICAL_CLASS_VALUE: |
294 | value = icalvalue_new_enum(kind, ICAL_CLASS_X,str); | 354 | value = icalvalue_new_enum(kind, (int)ICAL_CLASS_X,str); |
295 | break; | 355 | break; |
296 | 356 | ||
297 | 357 | ||
298 | case ICAL_INTEGER_VALUE: | 358 | case ICAL_INTEGER_VALUE: |
299 | { | ||
300 | value = icalvalue_new_integer(atoi(str)); | 359 | value = icalvalue_new_integer(atoi(str)); |
301 | break; | 360 | break; |
302 | } | ||
303 | 361 | ||
304 | case ICAL_FLOAT_VALUE: | 362 | case ICAL_FLOAT_VALUE: |
305 | { | 363 | value = icalvalue_new_float((float)atof(str)); |
306 | value = icalvalue_new_float((float )atof(str)); | ||
307 | break; | 364 | break; |
308 | } | 365 | |
309 | |||
310 | case ICAL_UTCOFFSET_VALUE: | 366 | case ICAL_UTCOFFSET_VALUE: |
311 | { | 367 | { |
312 | value = icalparser_parse_value(kind,str,(icalcomponent*)0); | 368 | int t,utcoffset, hours, minutes, seconds; |
369 | /* treat the UTCOFSET string a a decimal number, disassemble its digits | ||
370 | and reconstruct it as sections */ | ||
371 | t = strtol(str,0,10); | ||
372 | /* add phantom seconds field */ | ||
373 | if(abs(t)<9999){t *= 100; } | ||
374 | hours = (t/10000); | ||
375 | minutes = (t-hours*10000)/100; | ||
376 | seconds = (t-hours*10000-minutes*100); | ||
377 | utcoffset = hours*3600+minutes*60+seconds; | ||
378 | |||
379 | value = icalvalue_new_utcoffset(utcoffset); | ||
380 | |||
313 | break; | 381 | break; |
314 | } | 382 | } |
315 | 383 | ||
@@ -321,28 +389,19 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
321 | break; | 389 | break; |
322 | } | 390 | } |
323 | 391 | ||
324 | |||
325 | case ICAL_STRING_VALUE: | 392 | case ICAL_STRING_VALUE: |
326 | { | ||
327 | value = icalvalue_new_string(str); | 393 | value = icalvalue_new_string(str); |
328 | break; | 394 | break; |
329 | } | ||
330 | 395 | ||
331 | case ICAL_CALADDRESS_VALUE: | 396 | case ICAL_CALADDRESS_VALUE: |
332 | { | ||
333 | value = icalvalue_new_caladdress(str); | 397 | value = icalvalue_new_caladdress(str); |
334 | break; | 398 | break; |
335 | } | ||
336 | 399 | ||
337 | case ICAL_URI_VALUE: | 400 | case ICAL_URI_VALUE: |
338 | { | ||
339 | value = icalvalue_new_uri(str); | 401 | value = icalvalue_new_uri(str); |
340 | break; | 402 | break; |
341 | } | ||
342 | |||
343 | 403 | ||
344 | case ICAL_GEO_VALUE: | 404 | case ICAL_GEO_VALUE: |
345 | { | ||
346 | value = 0; | 405 | value = 0; |
347 | /* HACK */ | 406 | /* HACK */ |
348 | 407 | ||
@@ -350,16 +409,15 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
350 | char temp[TMP_BUF_SIZE]; | 409 | char temp[TMP_BUF_SIZE]; |
351 | sprintf(temp,"GEO Values are not implemented"); | 410 | sprintf(temp,"GEO Values are not implemented"); |
352 | *error = icalproperty_vanew_xlicerror( | 411 | *error = icalproperty_vanew_xlicerror( |
353 | temp, | 412 | temp, |
354 | icalparameter_new_xlicerrortype( | 413 | icalparameter_new_xlicerrortype( |
355 | ICAL_XLICERRORTYPE_VALUEPARSEERROR), | 414 | ICAL_XLICERRORTYPE_VALUEPARSEERROR), |
356 | 0); | 415 | 0); |
357 | } | 416 | } |
358 | 417 | ||
359 | /*icalerror_warn("Parsing GEO properties is unimplmeneted");*/ | 418 | /*icalerror_warn("Parsing GEO properties is unimplmeneted");*/ |
360 | 419 | ||
361 | break; | 420 | break; |
362 | } | ||
363 | 421 | ||
364 | case ICAL_RECUR_VALUE: | 422 | case ICAL_RECUR_VALUE: |
365 | { | 423 | { |
@@ -391,14 +449,17 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
391 | struct icaltimetype tt; | 449 | struct icaltimetype tt; |
392 | struct icalperiodtype p; | 450 | struct icalperiodtype p; |
393 | tt = icaltime_from_string(str); | 451 | tt = icaltime_from_string(str); |
394 | p = icalperiodtype_from_string(str); | 452 | |
395 | |||
396 | if(!icaltime_is_null_time(tt)){ | 453 | if(!icaltime_is_null_time(tt)){ |
397 | value = icalvalue_new_datetime(tt); | 454 | value = icalvalue_new_datetime(tt); |
398 | } else if (!icalperiodtype_is_null_period(p)){ | 455 | break; |
456 | } | ||
457 | |||
458 | p = icalperiodtype_from_string(str); | ||
459 | if (!icalperiodtype_is_null_period(p)){ | ||
399 | value = icalvalue_new_period(p); | 460 | value = icalvalue_new_period(p); |
400 | } | 461 | } |
401 | 462 | ||
402 | break; | 463 | break; |
403 | } | 464 | } |
404 | 465 | ||
@@ -406,9 +467,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
406 | { | 467 | { |
407 | struct icaldurationtype dur = icaldurationtype_from_string(str); | 468 | struct icaldurationtype dur = icaldurationtype_from_string(str); |
408 | 469 | ||
409 | if(icaldurationtype_is_null_duration(dur)){ | 470 | if (!icaldurationtype_is_bad_duration(dur)) { /* failed to parse */ |
410 | value = 0; | ||
411 | } else { | ||
412 | value = icalvalue_new_duration(dur); | 471 | value = icalvalue_new_duration(dur); |
413 | } | 472 | } |
414 | 473 | ||
@@ -429,7 +488,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
429 | case ICAL_TRIGGER_VALUE: | 488 | case ICAL_TRIGGER_VALUE: |
430 | { | 489 | { |
431 | struct icaltriggertype tr = icaltriggertype_from_string(str); | 490 | struct icaltriggertype tr = icaltriggertype_from_string(str); |
432 | if (!icaltriggertype_is_null_trigger(tr)){ | 491 | if (!icaltriggertype_is_bad_trigger(tr)) { |
433 | value = icalvalue_new_trigger(tr); | 492 | value = icalvalue_new_trigger(tr); |
434 | } | 493 | } |
435 | break; | 494 | break; |
@@ -444,9 +503,17 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
444 | break; | 503 | break; |
445 | 504 | ||
446 | } | 505 | } |
506 | |||
507 | case ICAL_X_VALUE: | ||
508 | { | ||
509 | char* dequoted_str = icalmemory_strdup_and_dequote(str); | ||
510 | value = icalvalue_new_x(dequoted_str); | ||
511 | free(dequoted_str); | ||
512 | } | ||
513 | break; | ||
514 | |||
447 | default: | 515 | default: |
448 | { | 516 | { |
449 | |||
450 | if (error != 0 ){ | 517 | if (error != 0 ){ |
451 | char temp[TMP_BUF_SIZE]; | 518 | char temp[TMP_BUF_SIZE]; |
452 | 519 | ||
@@ -484,17 +551,15 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* | |||
484 | 551 | ||
485 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind,const char* str) | 552 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind,const char* str) |
486 | { | 553 | { |
487 | return icalvalue_new_from_string_with_error(kind,str,(icalproperty*)0); | 554 | return icalvalue_new_from_string_with_error(kind,str,(icalproperty**)0); |
488 | } | 555 | } |
489 | 556 | ||
490 | 557 | ||
491 | 558 | ||
492 | void | 559 | void |
493 | icalvalue_free (icalvalue* value) | 560 | icalvalue_free (icalvalue* v) |
494 | { | 561 | { |
495 | struct icalvalue_impl* v = (struct icalvalue_impl*)value; | 562 | icalerror_check_arg_rv((v != 0),"value"); |
496 | |||
497 | icalerror_check_arg_rv((value != 0),"value"); | ||
498 | 563 | ||
499 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR | 564 | #ifdef ICAL_FREE_ON_LIST_IS_ERROR |
500 | icalerror_assert( (v->parent ==0),"This value is still attached to a property"); | 565 | icalerror_assert( (v->parent ==0),"This value is still attached to a property"); |
@@ -510,15 +575,19 @@ icalvalue_free (icalvalue* value) | |||
510 | } | 575 | } |
511 | 576 | ||
512 | switch (v->kind){ | 577 | switch (v->kind){ |
513 | case ICAL_ATTACH_VALUE: | 578 | case ICAL_BINARY_VALUE: |
514 | icalattachtype_free( v->data.v_attach ); | 579 | case ICAL_ATTACH_VALUE: { |
580 | if (v->data.v_attach) { | ||
581 | icalattach_unref (v->data.v_attach); | ||
582 | v->data.v_attach = NULL; | ||
583 | } | ||
584 | |||
515 | break; | 585 | break; |
516 | case ICAL_BINARY_VALUE: { | ||
517 | /* HACK ugh. This will be tough to implement */ | ||
518 | } | 586 | } |
519 | case ICAL_TEXT_VALUE: | 587 | case ICAL_TEXT_VALUE: |
520 | case ICAL_CALADDRESS_VALUE: | 588 | case ICAL_CALADDRESS_VALUE: |
521 | case ICAL_URI_VALUE: | 589 | case ICAL_URI_VALUE: |
590 | case ICAL_QUERY_VALUE: | ||
522 | { | 591 | { |
523 | if (v->data.v_string != 0) { | 592 | if (v->data.v_string != 0) { |
524 | free((void*)v->data.v_string); | 593 | free((void*)v->data.v_string); |
@@ -550,10 +619,8 @@ icalvalue_free (icalvalue* value) | |||
550 | } | 619 | } |
551 | 620 | ||
552 | int | 621 | int |
553 | icalvalue_is_valid (icalvalue* value) | 622 | icalvalue_is_valid (const icalvalue* value) |
554 | { | 623 | { |
555 | /*struct icalvalue_impl* v = (struct icalvalue_impl*)value;*/ | ||
556 | |||
557 | if(value == 0){ | 624 | if(value == 0){ |
558 | return 0; | 625 | return 0; |
559 | } | 626 | } |
@@ -561,7 +628,7 @@ icalvalue_is_valid (icalvalue* value) | |||
561 | return 1; | 628 | return 1; |
562 | } | 629 | } |
563 | 630 | ||
564 | char* icalvalue_binary_as_ical_string(icalvalue* value) { | 631 | static char* icalvalue_binary_as_ical_string(const icalvalue* value) { |
565 | 632 | ||
566 | const char* data; | 633 | const char* data; |
567 | char* str; | 634 | char* str; |
@@ -575,10 +642,10 @@ char* icalvalue_binary_as_ical_string(icalvalue* value) { | |||
575 | return str; | 642 | return str; |
576 | } | 643 | } |
577 | 644 | ||
578 | #ifndef _WIN32 | 645 | |
579 | #define MAX_INT_DIGITS 12 /* Enough for 2^32 + sign*/ | 646 | #define MAX_INT_DIGITS 12 /* Enough for 2^32 + sign*/ |
580 | char* icalvalue_int_as_ical_string(icalvalue* value) { | ||
581 | 647 | ||
648 | static char* icalvalue_int_as_ical_string(const icalvalue* value) { | ||
582 | int data; | 649 | int data; |
583 | char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS); | 650 | char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS); |
584 | 651 | ||
@@ -590,26 +657,8 @@ char* icalvalue_int_as_ical_string(icalvalue* value) { | |||
590 | 657 | ||
591 | return str; | 658 | return str; |
592 | } | 659 | } |
593 | #else | ||
594 | // snprintf not working on wintendo | ||
595 | 660 | ||
596 | #define MAX_INT_DIGITS 32 /* Enough for 2^32 + sign*/ | 661 | static char* icalvalue_utcoffset_as_ical_string(const icalvalue* value) |
597 | char* icalvalue_int_as_ical_string(icalvalue* value) { | ||
598 | |||
599 | int data; | ||
600 | char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS); | ||
601 | |||
602 | icalerror_check_arg_rz( (value!=0),"value"); | ||
603 | |||
604 | data = icalvalue_get_integer(value); | ||
605 | |||
606 | sprintf(str,"%d",data); | ||
607 | |||
608 | return str; | ||
609 | } | ||
610 | |||
611 | #endif | ||
612 | char* icalvalue_utcoffset_as_ical_string(icalvalue* value) | ||
613 | { | 662 | { |
614 | int data,h,m,s; | 663 | int data,h,m,s; |
615 | char sign; | 664 | char sign; |
@@ -629,18 +678,20 @@ char* icalvalue_utcoffset_as_ical_string(icalvalue* value) | |||
629 | m = (data - (h*3600))/ 60; | 678 | m = (data - (h*3600))/ 60; |
630 | s = (data - (h*3600) - (m*60)); | 679 | s = (data - (h*3600) - (m*60)); |
631 | 680 | ||
632 | sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s)); | 681 | if (s > 0) |
682 | sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s)); | ||
683 | else | ||
684 | sprintf(str,"%c%02d%02d",sign,abs(h),abs(m)); | ||
633 | 685 | ||
634 | return str; | 686 | return str; |
635 | } | 687 | } |
636 | 688 | ||
637 | char* icalvalue_string_as_ical_string(icalvalue* value) { | 689 | static char* icalvalue_string_as_ical_string(const icalvalue* value) { |
638 | 690 | ||
639 | const char* data; | 691 | const char* data; |
640 | char* str = 0; | 692 | char* str = 0; |
641 | icalerror_check_arg_rz( (value!=0),"value"); | 693 | icalerror_check_arg_rz( (value!=0),"value"); |
642 | 694 | data = value->data.v_string; | |
643 | data = ((struct icalvalue_impl*)value)->data.v_string; | ||
644 | 695 | ||
645 | str = (char*)icalmemory_tmp_buffer(strlen(data)+1); | 696 | str = (char*)icalmemory_tmp_buffer(strlen(data)+1); |
646 | 697 | ||
@@ -650,26 +701,27 @@ char* icalvalue_string_as_ical_string(icalvalue* value) { | |||
650 | } | 701 | } |
651 | 702 | ||
652 | 703 | ||
653 | char* icalvalue_recur_as_ical_string(icalvalue* value) | 704 | static char* icalvalue_recur_as_ical_string(const icalvalue* value) |
654 | { | 705 | { |
655 | struct icalvalue_impl *impl = (struct icalvalue_impl*)value; | 706 | struct icalrecurrencetype *recur = value->data.v_recur; |
656 | struct icalrecurrencetype *recur = impl->data.v_recur; | ||
657 | 707 | ||
658 | return icalrecurrencetype_as_string(recur); | 708 | return icalrecurrencetype_as_string(recur); |
659 | } | 709 | } |
660 | 710 | ||
661 | char* icalvalue_text_as_ical_string(icalvalue* value) { | 711 | /* @todo This is not RFC2445 compliant. |
712 | * The RFC only allows: | ||
713 | * TSAFE-CHAR = %x20-21 / %x23-2B / %x2D-39 / %x3C-5B / %x5D-7E / NON-US-ASCII | ||
714 | * As such, \t\r\b\f are not allowed, not even escaped | ||
715 | */ | ||
662 | 716 | ||
717 | static char* icalvalue_text_as_ical_string(const icalvalue* value) { | ||
663 | char *str; | 718 | char *str; |
664 | char *str_p; | 719 | char *str_p; |
665 | char *rtrn; | 720 | char *rtrn; |
666 | const char *p; | 721 | const char *p; |
667 | size_t buf_sz; | 722 | size_t buf_sz; |
668 | int line_length; | ||
669 | |||
670 | line_length = 0; | ||
671 | 723 | ||
672 | buf_sz = strlen(((struct icalvalue_impl*)value)->data.v_string)+1; | 724 | buf_sz = strlen(value->data.v_string)+1; |
673 | 725 | ||
674 | str_p = str = (char*)icalmemory_new_buffer(buf_sz); | 726 | str_p = str = (char*)icalmemory_new_buffer(buf_sz); |
675 | 727 | ||
@@ -677,61 +729,44 @@ char* icalvalue_text_as_ical_string(icalvalue* value) { | |||
677 | return 0; | 729 | return 0; |
678 | } | 730 | } |
679 | 731 | ||
680 | for(p=((struct icalvalue_impl*)value)->data.v_string; *p!=0; p++){ | 732 | for(p=value->data.v_string; *p!=0; p++){ |
681 | 733 | ||
682 | switch(*p){ | 734 | switch(*p){ |
683 | case '\n': { | 735 | case '\n': { |
684 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\n"); | 736 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\n"); |
685 | line_length+=3; | ||
686 | break; | 737 | break; |
687 | } | 738 | } |
688 | 739 | ||
689 | case '\t': { | 740 | case '\t': { |
690 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\t"); | 741 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\t"); |
691 | line_length+=3; | ||
692 | break; | 742 | break; |
693 | } | 743 | } |
694 | case '\r': { | 744 | case '\r': { |
695 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\r"); | 745 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\r"); |
696 | line_length+=3; | ||
697 | break; | 746 | break; |
698 | } | 747 | } |
699 | case '\b': { | 748 | case '\b': { |
700 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\b"); | 749 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\b"); |
701 | line_length+=3; | ||
702 | break; | 750 | break; |
703 | } | 751 | } |
704 | case '\f': { | 752 | case '\f': { |
705 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\f"); | 753 | icalmemory_append_string(&str,&str_p,&buf_sz,"\\f"); |
706 | line_length+=3; | ||
707 | break; | 754 | break; |
708 | } | 755 | } |
709 | 756 | ||
710 | case ';': | 757 | case ';': |
711 | case ',':{ | 758 | case ',': |
759 | case '"': | ||
760 | case '\\':{ | ||
712 | icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); | 761 | icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); |
713 | icalmemory_append_char(&str,&str_p,&buf_sz,*p); | 762 | icalmemory_append_char(&str,&str_p,&buf_sz,*p); |
714 | line_length+=3; | ||
715 | break; | 763 | break; |
716 | } | 764 | } |
717 | 765 | ||
718 | default: { | 766 | default: { |
719 | icalmemory_append_char(&str,&str_p,&buf_sz,*p); | 767 | icalmemory_append_char(&str,&str_p,&buf_sz,*p); |
720 | line_length++; | ||
721 | } | 768 | } |
722 | } | 769 | } |
723 | |||
724 | if (line_length > 65 && *p == ' '){ | ||
725 | icalmemory_append_string(&str,&str_p,&buf_sz,"\n "); | ||
726 | line_length=0; | ||
727 | } | ||
728 | |||
729 | |||
730 | if (line_length > 75){ | ||
731 | icalmemory_append_string(&str,&str_p,&buf_sz,"\n "); | ||
732 | line_length=0; | ||
733 | } | ||
734 | |||
735 | } | 770 | } |
736 | 771 | ||
737 | /* Assume the last character is not a '\0' and add one. We could | 772 | /* Assume the last character is not a '\0' and add one. We could |
@@ -749,34 +784,29 @@ char* icalvalue_text_as_ical_string(icalvalue* value) { | |||
749 | } | 784 | } |
750 | 785 | ||
751 | 786 | ||
752 | char* icalvalue_attach_as_ical_string(icalvalue* value) { | 787 | static char* |
753 | 788 | icalvalue_attach_as_ical_string(const icalvalue* value) | |
754 | struct icalattachtype *a; | 789 | { |
790 | icalattach *a; | ||
755 | char * str; | 791 | char * str; |
756 | 792 | ||
757 | icalerror_check_arg_rz( (value!=0),"value"); | 793 | icalerror_check_arg_rz( (value!=0),"value"); |
758 | 794 | ||
759 | a = icalvalue_get_attach(value); | 795 | a = icalvalue_get_attach(value); |
760 | 796 | ||
761 | if (a->binary != 0) { | 797 | if (icalattach_get_is_url (a)) { |
762 | return icalvalue_binary_as_ical_string(value); | 798 | const char *url; |
763 | } else if (a->base64 != 0) { | 799 | |
764 | str = (char*)icalmemory_tmp_buffer(strlen(a->base64)+1); | 800 | url = icalattach_get_url (a); |
765 | strcpy(str,a->base64); | 801 | str = icalmemory_tmp_buffer (strlen (url) + 1); |
802 | strcpy (str, url); | ||
766 | return str; | 803 | return str; |
767 | } else if (a->url != 0){ | 804 | } else |
768 | icalvalue *v = icalvalue_new_text( a->url ); | 805 | return icalvalue_binary_as_ical_string (value); |
769 | char *icalstring = icalvalue_string_as_ical_string(v); | ||
770 | icalvalue_free( v ); | ||
771 | return icalstring; | ||
772 | } else { | ||
773 | icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); | ||
774 | return 0; | ||
775 | } | ||
776 | } | 806 | } |
777 | 807 | ||
778 | 808 | ||
779 | char* icalvalue_duration_as_ical_string(icalvalue* value) { | 809 | static char* icalvalue_duration_as_ical_string(const icalvalue* value) { |
780 | 810 | ||
781 | struct icaldurationtype data; | 811 | struct icaldurationtype data; |
782 | 812 | ||
@@ -786,11 +816,11 @@ char* icalvalue_duration_as_ical_string(icalvalue* value) { | |||
786 | return icaldurationtype_as_ical_string(data); | 816 | return icaldurationtype_as_ical_string(data); |
787 | } | 817 | } |
788 | 818 | ||
789 | void print_time_to_string(char* str, struct icaltimetype *data) | 819 | void print_time_to_string(char* str, const struct icaltimetype *data) |
790 | { | 820 | { |
791 | char temp[20]; | 821 | char temp[20]; |
792 | 822 | ||
793 | if (data->is_utc == 1){ | 823 | if (icaltime_is_utc(*data)){ |
794 | sprintf(temp,"%02d%02d%02dZ",data->hour,data->minute,data->second); | 824 | sprintf(temp,"%02d%02d%02dZ",data->hour,data->minute,data->second); |
795 | } else { | 825 | } else { |
796 | sprintf(temp,"%02d%02d%02d",data->hour,data->minute,data->second); | 826 | sprintf(temp,"%02d%02d%02d",data->hour,data->minute,data->second); |
@@ -800,7 +830,7 @@ void print_time_to_string(char* str, struct icaltimetype *data) | |||
800 | } | 830 | } |
801 | 831 | ||
802 | 832 | ||
803 | void print_date_to_string(char* str, struct icaltimetype *data) | 833 | void print_date_to_string(char* str, const struct icaltimetype *data) |
804 | { | 834 | { |
805 | char temp[20]; | 835 | char temp[20]; |
806 | 836 | ||
@@ -809,7 +839,7 @@ void print_date_to_string(char* str, struct icaltimetype *data) | |||
809 | strcat(str,temp); | 839 | strcat(str,temp); |
810 | } | 840 | } |
811 | 841 | ||
812 | char* icalvalue_date_as_ical_string(icalvalue* value) { | 842 | static char* icalvalue_date_as_ical_string(const icalvalue* value) { |
813 | 843 | ||
814 | struct icaltimetype data; | 844 | struct icaltimetype data; |
815 | char* str; | 845 | char* str; |
@@ -824,15 +854,14 @@ char* icalvalue_date_as_ical_string(icalvalue* value) { | |||
824 | return str; | 854 | return str; |
825 | } | 855 | } |
826 | 856 | ||
827 | void print_datetime_to_string(char* str, struct icaltimetype *data) | 857 | void print_datetime_to_string(char* str, const struct icaltimetype *data) |
828 | { | 858 | { |
829 | print_date_to_string(str,data); | 859 | print_date_to_string(str,data); |
830 | strcat(str,"T"); | 860 | strcat(str,"T"); |
831 | print_time_to_string(str,data); | 861 | print_time_to_string(str,data); |
832 | |||
833 | } | 862 | } |
834 | 863 | ||
835 | const char* icalvalue_datetime_as_ical_string(icalvalue* value) { | 864 | static const char* icalvalue_datetime_as_ical_string(const icalvalue* value) { |
836 | 865 | ||
837 | struct icaltimetype data; | 866 | struct icaltimetype data; |
838 | char* str; | 867 | char* str; |
@@ -859,7 +888,7 @@ const char* icalvalue_datetime_as_ical_string(icalvalue* value) { | |||
859 | 888 | ||
860 | } | 889 | } |
861 | 890 | ||
862 | char* icalvalue_float_as_ical_string(icalvalue* value) { | 891 | static char* icalvalue_float_as_ical_string(const icalvalue* value) { |
863 | 892 | ||
864 | float data; | 893 | float data; |
865 | char* str; | 894 | char* str; |
@@ -873,7 +902,7 @@ char* icalvalue_float_as_ical_string(icalvalue* value) { | |||
873 | return str; | 902 | return str; |
874 | } | 903 | } |
875 | 904 | ||
876 | char* icalvalue_geo_as_ical_string(icalvalue* value) { | 905 | static char* icalvalue_geo_as_ical_string(const icalvalue* value) { |
877 | 906 | ||
878 | struct icalgeotype data; | 907 | struct icalgeotype data; |
879 | char* str; | 908 | char* str; |
@@ -888,7 +917,7 @@ char* icalvalue_geo_as_ical_string(icalvalue* value) { | |||
888 | return str; | 917 | return str; |
889 | } | 918 | } |
890 | 919 | ||
891 | const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) { | 920 | static const char* icalvalue_datetimeperiod_as_ical_string(const icalvalue* value) { |
892 | struct icaldatetimeperiodtype dtp = icalvalue_get_datetimeperiod(value); | 921 | struct icaldatetimeperiodtype dtp = icalvalue_get_datetimeperiod(value); |
893 | 922 | ||
894 | icalerror_check_arg_rz( (value!=0),"value"); | 923 | icalerror_check_arg_rz( (value!=0),"value"); |
@@ -900,7 +929,7 @@ const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) { | |||
900 | } | 929 | } |
901 | } | 930 | } |
902 | 931 | ||
903 | const char* icalvalue_period_as_ical_string(icalvalue* value) { | 932 | static const char* icalvalue_period_as_ical_string(const icalvalue* value) { |
904 | struct icalperiodtype data; | 933 | struct icalperiodtype data; |
905 | icalerror_check_arg_rz( (value!=0),"value"); | 934 | icalerror_check_arg_rz( (value!=0),"value"); |
906 | data = icalvalue_get_period(value); | 935 | data = icalvalue_get_period(value); |
@@ -909,7 +938,7 @@ const char* icalvalue_period_as_ical_string(icalvalue* value) { | |||
909 | 938 | ||
910 | } | 939 | } |
911 | 940 | ||
912 | char* icalvalue_trigger_as_ical_string(icalvalue* value) { | 941 | static const char* icalvalue_trigger_as_ical_string(const icalvalue* value) { |
913 | 942 | ||
914 | struct icaltriggertype data; | 943 | struct icaltriggertype data; |
915 | 944 | ||
@@ -925,17 +954,13 @@ char* icalvalue_trigger_as_ical_string(icalvalue* value) { | |||
925 | } | 954 | } |
926 | 955 | ||
927 | const char* | 956 | const char* |
928 | icalvalue_as_ical_string (icalvalue* value) | 957 | icalvalue_as_ical_string(const icalvalue* value) |
929 | { | 958 | { |
930 | struct icalvalue_impl* v = (struct icalvalue_impl*)value; | ||
931 | |||
932 | v=v; | ||
933 | |||
934 | if(value == 0){ | 959 | if(value == 0){ |
935 | return 0; | 960 | return 0; |
936 | } | 961 | } |
937 | 962 | ||
938 | switch (v->kind){ | 963 | switch (value->kind){ |
939 | 964 | ||
940 | case ICAL_ATTACH_VALUE: | 965 | case ICAL_ATTACH_VALUE: |
941 | return icalvalue_attach_as_ical_string(value); | 966 | return icalvalue_attach_as_ical_string(value); |
@@ -953,6 +978,9 @@ icalvalue_as_ical_string (icalvalue* value) | |||
953 | case ICAL_TEXT_VALUE: | 978 | case ICAL_TEXT_VALUE: |
954 | return icalvalue_text_as_ical_string(value); | 979 | return icalvalue_text_as_ical_string(value); |
955 | 980 | ||
981 | case ICAL_QUERY_VALUE: | ||
982 | return icalvalue_string_as_ical_string(value); | ||
983 | |||
956 | case ICAL_STRING_VALUE: | 984 | case ICAL_STRING_VALUE: |
957 | case ICAL_URI_VALUE: | 985 | case ICAL_URI_VALUE: |
958 | case ICAL_CALADDRESS_VALUE: | 986 | case ICAL_CALADDRESS_VALUE: |
@@ -983,21 +1011,24 @@ icalvalue_as_ical_string (icalvalue* value) | |||
983 | return icalvalue_trigger_as_ical_string(value); | 1011 | return icalvalue_trigger_as_ical_string(value); |
984 | 1012 | ||
985 | case ICAL_REQUESTSTATUS_VALUE: | 1013 | case ICAL_REQUESTSTATUS_VALUE: |
986 | return icalreqstattype_as_string(v->data.v_requeststatus); | 1014 | return icalreqstattype_as_string(value->data.v_requeststatus); |
987 | 1015 | ||
988 | case ICAL_ACTION_VALUE: | 1016 | case ICAL_ACTION_VALUE: |
989 | case ICAL_METHOD_VALUE: | 1017 | case ICAL_METHOD_VALUE: |
990 | case ICAL_STATUS_VALUE: | 1018 | case ICAL_STATUS_VALUE: |
991 | case ICAL_TRANSP_VALUE: | 1019 | case ICAL_TRANSP_VALUE: |
992 | case ICAL_CLASS_VALUE: | 1020 | case ICAL_CLASS_VALUE: |
993 | if(v->x_value !=0){ | 1021 | if(value->x_value !=0){ |
994 | return icalmemory_tmp_copy(v->x_value); | 1022 | return icalmemory_tmp_copy(value->x_value); |
995 | } | 1023 | } |
996 | 1024 | ||
997 | return icalproperty_enum_to_string(v->data.v_enum); | 1025 | return icalproperty_enum_to_string(value->data.v_enum); |
998 | 1026 | ||
999 | case ICAL_X_VALUE: | 1027 | case ICAL_X_VALUE: |
1000 | return icalmemory_tmp_copy(v->x_value); | 1028 | if (value->x_value != 0) |
1029 | return icalmemory_tmp_copy(value->x_value); | ||
1030 | |||
1031 | /* FALLTHRU */ | ||
1001 | 1032 | ||
1002 | case ICAL_NO_VALUE: | 1033 | case ICAL_NO_VALUE: |
1003 | default: | 1034 | default: |
@@ -1009,15 +1040,13 @@ icalvalue_as_ical_string (icalvalue* value) | |||
1009 | 1040 | ||
1010 | 1041 | ||
1011 | icalvalue_kind | 1042 | icalvalue_kind |
1012 | icalvalue_isa (icalvalue* value) | 1043 | icalvalue_isa (const icalvalue* value) |
1013 | { | 1044 | { |
1014 | struct icalvalue_impl* v = (struct icalvalue_impl*)value; | ||
1015 | |||
1016 | if(value == 0){ | 1045 | if(value == 0){ |
1017 | return ICAL_NO_VALUE; | 1046 | return ICAL_NO_VALUE; |
1018 | } | 1047 | } |
1019 | 1048 | ||
1020 | return v->kind; | 1049 | return value->kind; |
1021 | } | 1050 | } |
1022 | 1051 | ||
1023 | 1052 | ||
@@ -1036,7 +1065,7 @@ icalvalue_isa_value (void* value) | |||
1036 | } | 1065 | } |
1037 | 1066 | ||
1038 | 1067 | ||
1039 | int icalvalue_is_time(icalvalue* a) { | 1068 | static int icalvalue_is_time(const icalvalue* a) { |
1040 | icalvalue_kind kind = icalvalue_isa(a); | 1069 | icalvalue_kind kind = icalvalue_isa(a); |
1041 | 1070 | ||
1042 | if(kind == ICAL_DATETIME_VALUE || | 1071 | if(kind == ICAL_DATETIME_VALUE || |
@@ -1048,11 +1077,14 @@ int icalvalue_is_time(icalvalue* a) { | |||
1048 | 1077 | ||
1049 | } | 1078 | } |
1050 | 1079 | ||
1080 | /* | ||
1081 | * In case of error, this function returns 0. This is partly bogus, as 0 is | ||
1082 | * not part of the returned enum. | ||
1083 | * FIXME We should probably add an error value to the enum. | ||
1084 | */ | ||
1051 | icalparameter_xliccomparetype | 1085 | icalparameter_xliccomparetype |
1052 | icalvalue_compare(icalvalue* a, icalvalue *b) | 1086 | icalvalue_compare(const icalvalue* a, const icalvalue *b) |
1053 | { | 1087 | { |
1054 | struct icalvalue_impl *impla = (struct icalvalue_impl *)a; | ||
1055 | struct icalvalue_impl *implb = (struct icalvalue_impl *)b; | ||
1056 | 1088 | ||
1057 | icalerror_check_arg_rz( (a!=0), "a"); | 1089 | icalerror_check_arg_rz( (a!=0), "a"); |
1058 | icalerror_check_arg_rz( (b!=0), "b"); | 1090 | icalerror_check_arg_rz( (b!=0), "b"); |
@@ -1066,7 +1098,29 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1066 | switch (icalvalue_isa(a)){ | 1098 | switch (icalvalue_isa(a)){ |
1067 | 1099 | ||
1068 | case ICAL_ATTACH_VALUE: | 1100 | case ICAL_ATTACH_VALUE: |
1069 | case ICAL_BINARY_VALUE: | 1101 | { |
1102 | if (icalattach_get_is_url(a->data.v_attach) && | ||
1103 | icalattach_get_is_url(b->data.v_attach)) { | ||
1104 | if (strcasecmp(icalattach_get_url(a->data.v_attach), | ||
1105 | icalattach_get_url(b->data.v_attach)) == 0) | ||
1106 | return ICAL_XLICCOMPARETYPE_EQUAL; | ||
1107 | else | ||
1108 | return ICAL_XLICCOMPARETYPE_NOTEQUAL; | ||
1109 | } | ||
1110 | else { | ||
1111 | if (a->data.v_attach == b->data.v_attach) | ||
1112 | return ICAL_XLICCOMPARETYPE_EQUAL; | ||
1113 | else | ||
1114 | return ICAL_XLICCOMPARETYPE_NOTEQUAL; | ||
1115 | } | ||
1116 | } | ||
1117 | case ICAL_BINARY_VALUE: | ||
1118 | { | ||
1119 | if (a->data.v_attach == b->data.v_attach) | ||
1120 | return ICAL_XLICCOMPARETYPE_EQUAL; | ||
1121 | else | ||
1122 | return ICAL_XLICCOMPARETYPE_NOTEQUAL; | ||
1123 | } | ||
1070 | 1124 | ||
1071 | case ICAL_BOOLEAN_VALUE: | 1125 | case ICAL_BOOLEAN_VALUE: |
1072 | { | 1126 | { |
@@ -1079,9 +1133,9 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1079 | 1133 | ||
1080 | case ICAL_FLOAT_VALUE: | 1134 | case ICAL_FLOAT_VALUE: |
1081 | { | 1135 | { |
1082 | if (impla->data.v_float > implb->data.v_float){ | 1136 | if (a->data.v_float > b->data.v_float){ |
1083 | return ICAL_XLICCOMPARETYPE_GREATER; | 1137 | return ICAL_XLICCOMPARETYPE_GREATER; |
1084 | } else if (impla->data.v_float < implb->data.v_float){ | 1138 | } else if (a->data.v_float < b->data.v_float){ |
1085 | return ICAL_XLICCOMPARETYPE_LESS; | 1139 | return ICAL_XLICCOMPARETYPE_LESS; |
1086 | } else { | 1140 | } else { |
1087 | return ICAL_XLICCOMPARETYPE_EQUAL; | 1141 | return ICAL_XLICCOMPARETYPE_EQUAL; |
@@ -1091,9 +1145,9 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1091 | case ICAL_INTEGER_VALUE: | 1145 | case ICAL_INTEGER_VALUE: |
1092 | case ICAL_UTCOFFSET_VALUE: | 1146 | case ICAL_UTCOFFSET_VALUE: |
1093 | { | 1147 | { |
1094 | if (impla->data.v_int > implb->data.v_int){ | 1148 | if (a->data.v_int > b->data.v_int){ |
1095 | return ICAL_XLICCOMPARETYPE_GREATER; | 1149 | return ICAL_XLICCOMPARETYPE_GREATER; |
1096 | } else if (impla->data.v_int < implb->data.v_int){ | 1150 | } else if (a->data.v_int < b->data.v_int){ |
1097 | return ICAL_XLICCOMPARETYPE_LESS; | 1151 | return ICAL_XLICCOMPARETYPE_LESS; |
1098 | } else { | 1152 | } else { |
1099 | return ICAL_XLICCOMPARETYPE_EQUAL; | 1153 | return ICAL_XLICCOMPARETYPE_EQUAL; |
@@ -1102,12 +1156,12 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1102 | 1156 | ||
1103 | case ICAL_DURATION_VALUE: | 1157 | case ICAL_DURATION_VALUE: |
1104 | { | 1158 | { |
1105 | int a = icaldurationtype_as_int(impla->data.v_duration); | 1159 | int dur_a = icaldurationtype_as_int(a->data.v_duration); |
1106 | int b = icaldurationtype_as_int(implb->data.v_duration); | 1160 | int dur_b = icaldurationtype_as_int(b->data.v_duration); |
1107 | 1161 | ||
1108 | if (a > b){ | 1162 | if (dur_a > dur_b){ |
1109 | return ICAL_XLICCOMPARETYPE_GREATER; | 1163 | return ICAL_XLICCOMPARETYPE_GREATER; |
1110 | } else if (a < b){ | 1164 | } else if (dur_a < dur_b){ |
1111 | return ICAL_XLICCOMPARETYPE_LESS; | 1165 | return ICAL_XLICCOMPARETYPE_LESS; |
1112 | } else { | 1166 | } else { |
1113 | return ICAL_XLICCOMPARETYPE_EQUAL; | 1167 | return ICAL_XLICCOMPARETYPE_EQUAL; |
@@ -1122,6 +1176,8 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1122 | case ICAL_DATE_VALUE: | 1176 | case ICAL_DATE_VALUE: |
1123 | case ICAL_DATETIME_VALUE: | 1177 | case ICAL_DATETIME_VALUE: |
1124 | case ICAL_DATETIMEPERIOD_VALUE: | 1178 | case ICAL_DATETIMEPERIOD_VALUE: |
1179 | case ICAL_QUERY_VALUE: | ||
1180 | case ICAL_RECUR_VALUE: | ||
1125 | { | 1181 | { |
1126 | int r; | 1182 | int r; |
1127 | 1183 | ||
@@ -1159,31 +1215,49 @@ icalvalue_compare(icalvalue* a, icalvalue *b) | |||
1159 | 1215 | ||
1160 | } | 1216 | } |
1161 | 1217 | ||
1218 | case ICAL_TRANSP_VALUE: | ||
1219 | { | ||
1220 | if (icalvalue_get_transp(a) == icalvalue_get_transp(b)){ | ||
1221 | return ICAL_XLICCOMPARETYPE_EQUAL; | ||
1222 | } else { | ||
1223 | return ICAL_XLICCOMPARETYPE_NOTEQUAL; | ||
1224 | } | ||
1225 | } | ||
1226 | |||
1227 | case ICAL_ACTION_VALUE: | ||
1228 | { | ||
1229 | if (icalvalue_get_action(a) == icalvalue_get_action(b)){ | ||
1230 | return ICAL_XLICCOMPARETYPE_EQUAL; | ||
1231 | } else { | ||
1232 | return ICAL_XLICCOMPARETYPE_NOTEQUAL; | ||
1233 | } | ||
1234 | } | ||
1235 | |||
1162 | case ICAL_PERIOD_VALUE: | 1236 | case ICAL_PERIOD_VALUE: |
1163 | case ICAL_GEO_VALUE: | 1237 | case ICAL_GEO_VALUE: |
1164 | case ICAL_RECUR_VALUE: | ||
1165 | case ICAL_NO_VALUE: | 1238 | case ICAL_NO_VALUE: |
1166 | default: | 1239 | default: |
1167 | { | 1240 | { |
1168 | icalerror_warn("Comparison not implemented for value type"); | 1241 | icalerror_warn("Comparison not implemented for value type"); |
1169 | return ICAL_XLICCOMPARETYPE_REGEX+1; /* HACK */ | 1242 | return 0; |
1170 | } | 1243 | } |
1171 | } | 1244 | } |
1172 | 1245 | ||
1173 | } | 1246 | } |
1174 | 1247 | ||
1175 | /* Examine the value and possiby chage the kind to agree with the value */ | 1248 | /** Examine the value and possibly change the kind to agree with the |
1249 | * value | ||
1250 | */ | ||
1251 | |||
1176 | void icalvalue_reset_kind(icalvalue* value) | 1252 | void icalvalue_reset_kind(icalvalue* value) |
1177 | { | 1253 | { |
1178 | struct icalvalue_impl* impl = (struct icalvalue_impl*)value; | 1254 | if( (value->kind==ICAL_DATETIME_VALUE || value->kind==ICAL_DATE_VALUE )&& |
1179 | 1255 | !icaltime_is_null_time(value->data.v_time) ) { | |
1180 | if( (impl->kind==ICAL_DATETIME_VALUE || impl->kind==ICAL_DATE_VALUE )&& | ||
1181 | !icaltime_is_null_time(impl->data.v_time) ) { | ||
1182 | 1256 | ||
1183 | if( impl->data.v_time.is_date == 1){ | 1257 | if(icaltime_is_date(value->data.v_time)){ |
1184 | impl->kind = ICAL_DATE_VALUE; | 1258 | value->kind = ICAL_DATE_VALUE; |
1185 | } else { | 1259 | } else { |
1186 | impl->kind = ICAL_DATETIME_VALUE; | 1260 | value->kind = ICAL_DATETIME_VALUE; |
1187 | } | 1261 | } |
1188 | } | 1262 | } |
1189 | 1263 | ||
@@ -1192,24 +1266,44 @@ void icalvalue_reset_kind(icalvalue* value) | |||
1192 | void icalvalue_set_parent(icalvalue* value, | 1266 | void icalvalue_set_parent(icalvalue* value, |
1193 | icalproperty* property) | 1267 | icalproperty* property) |
1194 | { | 1268 | { |
1195 | struct icalvalue_impl* v = (struct icalvalue_impl*)value; | 1269 | value->parent = property; |
1196 | |||
1197 | v->parent = property; | ||
1198 | |||
1199 | } | 1270 | } |
1200 | 1271 | ||
1201 | icalproperty* icalvalue_get_parent(icalvalue* value) | 1272 | icalproperty* icalvalue_get_parent(icalvalue* value) |
1202 | { | 1273 | { |
1203 | struct icalvalue_impl* v = (struct icalvalue_impl*)value; | 1274 | return value->parent; |
1275 | } | ||
1204 | 1276 | ||
1205 | 1277 | ||
1206 | return v->parent; | 1278 | int icalvalue_encode_ical_string(const char *szText, char *szEncText, int nMaxBufferLen) |
1207 | } | 1279 | { |
1280 | char *ptr; | ||
1281 | icalvalue *value = 0; | ||
1282 | |||
1283 | if ((szText == 0) || (szEncText == 0)) | ||
1284 | return 0; | ||
1285 | |||
1286 | value = icalvalue_new_from_string(ICAL_STRING_VALUE, szText); | ||
1287 | |||
1288 | if (value == 0) | ||
1289 | return 0; | ||
1290 | |||
1291 | ptr = icalvalue_text_as_ical_string(value); | ||
1292 | if (ptr == 0) | ||
1293 | return 0; | ||
1294 | |||
1295 | if ((int)strlen(ptr) >= nMaxBufferLen) | ||
1296 | { | ||
1297 | icalvalue_free (value); | ||
1298 | return 0; | ||
1299 | } | ||
1208 | 1300 | ||
1301 | strcpy(szEncText, ptr); | ||
1209 | 1302 | ||
1303 | icalvalue_free ((icalvalue*)value); | ||
1304 | |||
1305 | return 1; | ||
1306 | } | ||
1210 | 1307 | ||
1211 | /* The remaining interfaces are 'new', 'set' and 'get' for each of the value | 1308 | /* The remaining interfaces are 'new', 'set' and 'get' for each of the value |
1212 | types */ | 1309 | types */ |
1213 | |||
1214 | |||
1215 | /* 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 | |||
@@ -7,8 +7,6 @@ | |||
7 | $Id$ | 7 | $Id$ |
8 | $Locker$ | 8 | $Locker$ |
9 | 9 | ||
10 | |||
11 | |||
12 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 10 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
13 | 11 | ||
14 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
@@ -40,46 +38,51 @@ | |||
40 | #include "icalderivedvalue.h" | 38 | #include "icalderivedvalue.h" |
41 | 39 | ||
42 | /* Defined in icalderivedvalue.h */ | 40 | /* Defined in icalderivedvalue.h */ |
43 | /*typedef void icalvalue;*/ | 41 | /*typedef struct icalvalue_impl icalvalue;*/ |
44 | 42 | ||
45 | icalvalue* icalvalue_new(icalvalue_kind kind); | 43 | icalvalue* icalvalue_new(icalvalue_kind kind); |
46 | 44 | ||
47 | icalvalue* icalvalue_new_clone(icalvalue* value); | 45 | icalvalue* icalvalue_new_clone(const icalvalue* value); |
48 | 46 | ||
49 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str); | 47 | icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str); |
50 | 48 | ||
51 | void icalvalue_free(icalvalue* value); | 49 | void icalvalue_free(icalvalue* value); |
52 | 50 | ||
53 | int icalvalue_is_valid(icalvalue* value); | 51 | int icalvalue_is_valid(const icalvalue* value); |
54 | 52 | ||
55 | const char* icalvalue_as_ical_string(icalvalue* value); | 53 | const char* icalvalue_as_ical_string(const icalvalue* value); |
56 | 54 | ||
57 | icalvalue_kind icalvalue_isa(icalvalue* value); | 55 | icalvalue_kind icalvalue_isa(const icalvalue* value); |
58 | 56 | ||
59 | int icalvalue_isa_value(void*); | 57 | int icalvalue_isa_value(void*); |
60 | 58 | ||
61 | icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b); | 59 | icalparameter_xliccomparetype icalvalue_compare(const icalvalue* a, const icalvalue *b); |
62 | 60 | ||
63 | 61 | ||
64 | /* Special, non autogenerated value accessors */ | 62 | /* Special, non autogenerated value accessors */ |
65 | 63 | ||
66 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); | 64 | icalvalue* icalvalue_new_recur (struct icalrecurrencetype v); |
67 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); | 65 | void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); |
68 | struct icalrecurrencetype icalvalue_get_recur(icalvalue* value); | 66 | struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value); |
69 | 67 | ||
70 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); | 68 | icalvalue* icalvalue_new_trigger (struct icaltriggertype v); |
71 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); | 69 | void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); |
72 | struct icaltriggertype icalvalue_get_trigger(icalvalue* value); | 70 | struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); |
73 | 71 | ||
74 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); | 72 | icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); |
75 | void icalvalue_set_datetimeperiod(icalvalue* value, | 73 | void icalvalue_set_datetimeperiod(icalvalue* value, |
76 | struct icaldatetimeperiodtype v); | 74 | struct icaldatetimeperiodtype v); |
77 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value); | 75 | struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); |
78 | 76 | ||
79 | /* Convert enumerations */ | 77 | /* Convert enumerations */ |
80 | 78 | ||
81 | icalvalue_kind icalvalue_string_to_kind(const char* str); | 79 | icalvalue_kind icalvalue_string_to_kind(const char* str); |
82 | const char* icalvalue_kind_to_string(icalvalue_kind kind); | 80 | const char* icalvalue_kind_to_string(const icalvalue_kind kind); |
81 | |||
82 | /** Check validity of a specific icalvalue_kind **/ | ||
83 | int icalvalue_kind_is_valid(const icalvalue_kind kind); | ||
83 | 84 | ||
85 | /** Encode a character string in ical format, esacpe certain characters, etc. */ | ||
86 | int icalvalue_encode_ical_string(const char *szText, char *szEncText, int MaxBufferLen); | ||
84 | 87 | ||
85 | #endif /*ICALVALUE_H*/ | 88 | #endif /*ICALVALUE_H*/ |
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 | |||
@@ -35,6 +35,8 @@ | |||
35 | #define ICALVALUEIMPL_H | 35 | #define ICALVALUEIMPL_H |
36 | 36 | ||
37 | #include "icalenums.h" | 37 | #include "icalenums.h" |
38 | #include "icalproperty.h" | ||
39 | #include "icalderivedvalue.h" | ||
38 | 40 | ||
39 | 41 | ||
40 | struct icalvalue_impl { | 42 | struct icalvalue_impl { |
@@ -43,10 +45,10 @@ struct icalvalue_impl { | |||
43 | char id[5]; | 45 | char id[5]; |
44 | int size; | 46 | int size; |
45 | icalproperty* parent; | 47 | icalproperty* parent; |
46 | const char* x_value; | 48 | char* x_value; |
47 | 49 | ||
48 | union data { | 50 | union data { |
49 | struct icalattachtype *v_attach; | 51 | icalattach *v_attach; |
50 | /* void *v_binary; */ /* use v_attach */ | 52 | /* void *v_binary; */ /* use v_attach */ |
51 | const char *v_string; | 53 | const char *v_string; |
52 | /*char *v_text;*/ | 54 | /*char *v_text;*/ |
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 | |||
@@ -2,6 +2,6 @@ | |||
2 | #define ICAL_VERSION_H | 2 | #define ICAL_VERSION_H |
3 | 3 | ||
4 | #define ICAL_PACKAGE "libical" | 4 | #define ICAL_PACKAGE "libical" |
5 | #define ICAL_VERSION "0.23" | 5 | #define ICAL_VERSION "0.24" |
6 | 6 | ||
7 | #endif | 7 | #endif |
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 @@ | |||
1 | include(../../../variables.pri) | 1 | ###################################################################### |
2 | 2 | # Automatically generated by qmake (1.07a) Sun Jun 27 22:44:35 2004 | |
3 | TEMPLATE= lib | 3 | ###################################################################### |
4 | |||
5 | TARGET = ical | ||
6 | DESTDIR = ../../lib | ||
7 | |||
8 | win32: DEFINES += _WIN32 | ||
9 | 4 | ||
5 | TEMPLATE = lib | ||
6 | INCLUDEPATH += . | ||
10 | CONFIG += staticlib | 7 | CONFIG += staticlib |
8 | DESTDIR = ../../lib | ||
9 | TARGET = ical | ||
10 | # Input | ||
11 | HEADERS += astime.h \ | ||
12 | ical.h \ | ||
13 | icalarray.h \ | ||
14 | icalattach.h \ | ||
15 | icalattachimpl.h \ | ||
16 | icalcomponent.h \ | ||
17 | icalderivedparameter.h \ | ||
18 | icalderivedproperty.h \ | ||
19 | icalderivedvalue.h \ | ||
20 | icalduration.h \ | ||
21 | icalenums.h \ | ||
22 | icalerror.h \ | ||
23 | icallangbind.h \ | ||
24 | icalmemory.h \ | ||
25 | icalmime.h \ | ||
26 | icalparameter.h \ | ||
27 | icalparameterimpl.h \ | ||
28 | icalparser.h \ | ||
29 | icalperiod.h \ | ||
30 | icalproperty.h \ | ||
31 | icalrecur.h \ | ||
32 | icalrestriction.h \ | ||
33 | icaltime.h \ | ||
34 | icaltimezone.h \ | ||
35 | icaltypes.h \ | ||
36 | icalvalue.h \ | ||
37 | icalvalueimpl.h \ | ||
38 | icalversion.h \ | ||
39 | pvl.h \ | ||
40 | sspm.h | ||
41 | SOURCES += caldate.c \ | ||
42 | icalarray.c \ | ||
43 | icalattach.c \ | ||
44 | icalcomponent.c \ | ||
45 | icalderivedparameter.c \ | ||
46 | icalderivedproperty.c \ | ||
47 | icalderivedvalue.c \ | ||
48 | icalduration.c \ | ||
49 | icalenums.c \ | ||
50 | icalerror.c \ | ||
51 | icallangbind.c \ | ||
52 | icalmemory.c \ | ||
53 | icalmime.c \ | ||
54 | icalparameter.c \ | ||
55 | icalparser.c \ | ||
56 | icalperiod.c \ | ||
57 | icalproperty.c \ | ||
58 | icalrecur.c \ | ||
59 | icalrestriction.c \ | ||
60 | icaltime.c \ | ||
61 | icaltimezone.c \ | ||
62 | icaltypes.c \ | ||
63 | icalvalue.c \ | ||
64 | pvl.c \ | ||
65 | sspm.c | ||
11 | 66 | ||
12 | HEADERS = \ | ||
13 | icalattendee.h \ | ||
14 | icalcomponent.h \ | ||
15 | icalderivedparameter.h \ | ||
16 | icalderivedproperty.h \ | ||
17 | icalderivedvalue.h \ | ||
18 | icalduration.h \ | ||
19 | icalenums.h \ | ||
20 | icalerror.h \ | ||
21 | icallangbind.h \ | ||
22 | icalmemory.h \ | ||
23 | icalmime.h \ | ||
24 | icalparameter.h \ | ||
25 | icalparameterimpl.h \ | ||
26 | icalparser.h \ | ||
27 | icalperiod.h \ | ||
28 | icalproperty.h \ | ||
29 | icalrecur.h \ | ||
30 | icalrestriction.h \ | ||
31 | icaltime.h \ | ||
32 | icaltypes.h \ | ||
33 | icalvalue.h \ | ||
34 | icalvalueimpl.h \ | ||
35 | icalversion.h \ | ||
36 | icalyacc.h \ | ||
37 | pvl.h \ | ||
38 | sspm.h | ||
39 | |||
40 | SOURCES = icalattendee.c \ | ||
41 | icalcomponent.c \ | ||
42 | icalderivedparameter.c \ | ||
43 | icalderivedproperty.c \ | ||
44 | icalderivedvalue.c \ | ||
45 | icalduration.c \ | ||
46 | icalenums.c \ | ||
47 | icalerror.c \ | ||
48 | icallangbind.c \ | ||
49 | icallexer.c \ | ||
50 | icalmemory.c \ | ||
51 | icalmime.c \ | ||
52 | icalparameter.c \ | ||
53 | icalparser.c \ | ||
54 | icalperiod.c \ | ||
55 | icalproperty.c \ | ||
56 | icalrecur.c \ | ||
57 | icalrestriction.c \ | ||
58 | icaltime.c \ | ||
59 | icaltypes.c \ | ||
60 | icalvalue.c \ | ||
61 | icalyacc.c \ | ||
62 | pvl.c \ | ||
63 | sspm.c \ | ||
64 | vsnprintf.c | ||
65 | |||
66 | INTERFACES= | ||
67 | 67 | ||
68 | INCLUDEPATH += . | 68 | # 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,66 +1,70 @@ | |||
1 | TEMPLATE= lib | 1 | ###################################################################### |
2 | CONFIG = warn_on staticlib | 2 | # Automatically generated by qmake (1.07a) Sun Jun 27 22:44:35 2004 |
3 | ###################################################################### | ||
3 | 4 | ||
4 | INCLUDEPATH += . | 5 | TEMPLATE = lib |
6 | INCLUDEPATH += . | ||
7 | CONFIG += staticlib | ||
5 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
6 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
7 | DESTDIR=../../lib/$(PLATFORM) | 10 | DESTDIR=../../lib/$(PLATFORM) |
8 | TARGET = ical | 11 | TARGET = ical |
9 | INTERFACES = \ | 12 | # Input |
13 | HEADERS += astime.h \ | ||
14 | ical.h \ | ||
15 | icalarray.h \ | ||
16 | icalattach.h \ | ||
17 | icalattachimpl.h \ | ||
18 | icalcomponent.h \ | ||
19 | icalderivedparameter.h \ | ||
20 | icalderivedproperty.h \ | ||
21 | icalderivedvalue.h \ | ||
22 | icalduration.h \ | ||
23 | icalenums.h \ | ||
24 | icalerror.h \ | ||
25 | icallangbind.h \ | ||
26 | icalmemory.h \ | ||
27 | icalmime.h \ | ||
28 | icalparameter.h \ | ||
29 | icalparameterimpl.h \ | ||
30 | icalparser.h \ | ||
31 | icalperiod.h \ | ||
32 | icalproperty.h \ | ||
33 | icalrecur.h \ | ||
34 | icalrestriction.h \ | ||
35 | icaltime.h \ | ||
36 | icaltimezone.h \ | ||
37 | icaltypes.h \ | ||
38 | icalvalue.h \ | ||
39 | icalvalueimpl.h \ | ||
40 | icalversion.h \ | ||
41 | pvl.h \ | ||
42 | sspm.h | ||
43 | SOURCES += caldate.c \ | ||
44 | icalarray.c \ | ||
45 | icalattach.c \ | ||
46 | icalcomponent.c \ | ||
47 | icalderivedparameter.c \ | ||
48 | icalderivedproperty.c \ | ||
49 | icalderivedvalue.c \ | ||
50 | icalduration.c \ | ||
51 | icalenums.c \ | ||
52 | icalerror.c \ | ||
53 | icallangbind.c \ | ||
54 | icalmemory.c \ | ||
55 | icalmime.c \ | ||
56 | icalparameter.c \ | ||
57 | icalparser.c \ | ||
58 | icalperiod.c \ | ||
59 | icalproperty.c \ | ||
60 | icalrecur.c \ | ||
61 | icalrestriction.c \ | ||
62 | icaltime.c \ | ||
63 | icaltimezone.c \ | ||
64 | icaltypes.c \ | ||
65 | icalvalue.c \ | ||
66 | pvl.c \ | ||
67 | sspm.c | ||
10 | 68 | ||
11 | HEADERS = \ | ||
12 | ical.h \ | ||
13 | icalattendee.h \ | ||
14 | icalcomponent.h \ | ||
15 | icalderivedparameter.h \ | ||
16 | icalderivedproperty.h \ | ||
17 | icalderivedvalue.h \ | ||
18 | icalduration.h \ | ||
19 | icalenums.h \ | ||
20 | icalerror.h \ | ||
21 | icallangbind.h \ | ||
22 | icalmemory.h \ | ||
23 | icalmime.h \ | ||
24 | icalparameter.h \ | ||
25 | icalparameterimpl.h \ | ||
26 | icalparser.h \ | ||
27 | icalperiod.h \ | ||
28 | icalproperty.h \ | ||
29 | icalrecur.h \ | ||
30 | icalrestriction.h \ | ||
31 | icaltime.h \ | ||
32 | icaltypes.h \ | ||
33 | icalvalue.h \ | ||
34 | icalvalueimpl.h \ | ||
35 | icalversion.h \ | ||
36 | icalyacc.h \ | ||
37 | pvl.h \ | ||
38 | sspm.h \ | ||
39 | |||
40 | SOURCES = \ | ||
41 | icalattendee.c \ | ||
42 | icalcomponent.c \ | ||
43 | icalderivedparameter.c \ | ||
44 | icalderivedproperty.c \ | ||
45 | icalderivedvalue.c \ | ||
46 | icalduration.c \ | ||
47 | icalenums.c \ | ||
48 | icalerror.c \ | ||
49 | icallangbind.c \ | ||
50 | icallexer.c \ | ||
51 | icalmemory.c \ | ||
52 | icalmime.c \ | ||
53 | icalparameter.c \ | ||
54 | icalparser.c \ | ||
55 | icalperiod.c \ | ||
56 | icalproperty.c \ | ||
57 | icalrecur.c \ | ||
58 | icalrestriction.c \ | ||
59 | icaltime.c \ | ||
60 | icaltypes.c \ | ||
61 | icalvalue.c \ | ||
62 | icalyacc.c \ | ||
63 | pvl.c \ | ||
64 | sspm.c \ | ||
65 | vsnprintf.c \ | ||
66 | 69 | ||
70 | # 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 | |||
@@ -15,9 +15,7 @@ | |||
15 | #include <assert.h> | 15 | #include <assert.h> |
16 | #include <stdlib.h> | 16 | #include <stdlib.h> |
17 | 17 | ||
18 | 18 | /** | |
19 | |||
20 | /* | ||
21 | struct pvl_list_t | 19 | struct pvl_list_t |
22 | 20 | ||
23 | The list structure. This is the hanlde for the entire list | 21 | The list structure. This is the hanlde for the entire list |
@@ -28,35 +26,30 @@ | |||
28 | 26 | ||
29 | typedef struct pvl_list_t | 27 | typedef struct pvl_list_t |
30 | { | 28 | { |
31 | int MAGIC; /* Magic Identifier */ | 29 | int MAGIC; /**< Magic Identifier */ |
32 | struct pvl_elem_t *head;/* Head of list */ | 30 | struct pvl_elem_t *head;/**< Head of list */ |
33 | struct pvl_elem_t *tail;/* Tail of list */ | 31 | struct pvl_elem_t *tail;/**< Tail of list */ |
34 | int count; /* Number of items in the list */ | 32 | int count; /**< Number of items in the list */ |
35 | struct pvl_elem_t *p; /* Pointer used for iterators */ | 33 | struct pvl_elem_t *p; /**< Pointer used for iterators */ |
36 | } pvl_list_t; | 34 | } pvl_list_t; |
37 | 35 | ||
38 | 36 | ||
39 | 37 | ||
40 | 38 | ||
41 | /* This global is incremented for each call to pvl_new_element(); it gives each | 39 | /** |
42 | * list a unique identifer */ | 40 | * This global is incremented for each call to pvl_new_element(); it gives each |
41 | * list a unique identifer | ||
42 | */ | ||
43 | 43 | ||
44 | int pvl_elem_count = 0; | 44 | int pvl_elem_count = 0; |
45 | int pvl_list_count = 0; | 45 | int pvl_list_count = 0; |
46 | 46 | ||
47 | 47 | ||
48 | /*---------------------------------------------------------------------- | 48 | /** |
49 | Function: pvl_list pvl_newlist() | 49 | * @brief Creates a new list, clears the pointers and assigns a magic number |
50 | 50 | * | |
51 | Purpose: | 51 | * @return Pointer to the new list, 0 if there is no available memory. |
52 | 52 | */ | |
53 | Creates a new list, clears the pointers and assigns a magic number | ||
54 | |||
55 | Returns: | ||
56 | |||
57 | Pointer to the new list | ||
58 | 0 if there is no available memory. | ||
59 | *----------------------------------------------------------------------*/ | ||
60 | 53 | ||
61 | pvl_list | 54 | pvl_list |
62 | pvl_newlist() | 55 | pvl_newlist() |
@@ -89,32 +82,23 @@ pvl_free(pvl_list l) | |||
89 | free(L); | 82 | free(L); |
90 | } | 83 | } |
91 | 84 | ||
92 | /*---------------------------------------------------------------------- | 85 | /** |
93 | Function: pvl_new_element(void *d, struct pvl_elem_t *next,struct pvl_elem_t *prior) | 86 | * @brief Creates a new list element, assigns a magic number, and assigns |
94 | 87 | * the next and previous pointers. | |
95 | Purpose: | 88 | * |
96 | Creates a new list element, assigns a magic number, and assigns | 89 | * Passing in the next and previous points may seem odd, but it allos the user |
97 | the next and previous pointers. | 90 | * to set them while keeping the internal data hidden. In nearly all cases, |
98 | 91 | * the user is the pvl library itself. | |
99 | Passing in the next and previous points may seem odd, but it allos the user | 92 | * |
100 | to set them while keeping the internal data hidden. In nearly all cases, | 93 | * @param dThe data item to be stored in the list |
101 | the user is the pvl library itself. | 94 | * @param next Pointer value to assign to the member "next" |
102 | 95 | * @param prior Pointer value to assign to the member "prior" | |
103 | Parameters: | 96 | * |
104 | 97 | * @return A pointer to the new element, 0 if there is no memory available. | |
105 | dThe data item to be stored in the list | 98 | */ |
106 | next Pointer value to assign to the member "next" | ||
107 | prior Pointer value to assign to the member "prior" | ||
108 | |||
109 | Returns: | ||
110 | |||
111 | A pointer to the new element. | ||
112 | 0 if there is no memory available. | ||
113 | |||
114 | *----------------------------------------------------------------------*/ | ||
115 | 99 | ||
116 | pvl_elem | 100 | pvl_elem |
117 | pvl_new_element(void *d, pvl_elem next,pvl_elem prior) | 101 | pvl_new_element(void *d, pvl_elem next, pvl_elem prior) |
118 | { | 102 | { |
119 | struct pvl_elem_t *E; | 103 | struct pvl_elem_t *E; |
120 | 104 | ||
@@ -132,25 +116,16 @@ pvl_new_element(void *d, pvl_elem next,pvl_elem prior) | |||
132 | return (pvl_elem)E; | 116 | return (pvl_elem)E; |
133 | } | 117 | } |
134 | 118 | ||
135 | /*---------------------------------------------------------------------- | 119 | /** |
136 | Function: pvl_unshift(pvl_list l,void *d) | 120 | * @brief Add a new element to the from of the list |
137 | 121 | * | |
138 | Purpose: | 122 | * @param LThe list to add the item to |
139 | 123 | * @param dPointer to the item to add | |
140 | Add a new element to the from of the list | 124 | */ |
141 | |||
142 | Parameters: | ||
143 | |||
144 | lThe list to add the item to | ||
145 | dPointer to the item to add | ||
146 | |||
147 | Returns: | ||
148 | *----------------------------------------------------------------------*/ | ||
149 | 125 | ||
150 | void | 126 | void |
151 | pvl_unshift(pvl_list l,void *d) | 127 | pvl_unshift(pvl_list L,void *d) |
152 | { | 128 | { |
153 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
154 | struct pvl_elem_t *E = pvl_new_element(d,L->head,0); | 129 | struct pvl_elem_t *E = pvl_new_element(d,L->head,0); |
155 | 130 | ||
156 | if (E->next != 0) | 131 | if (E->next != 0) |
@@ -172,53 +147,37 @@ pvl_unshift(pvl_list l,void *d) | |||
172 | L->count++; | 147 | L->count++; |
173 | } | 148 | } |
174 | 149 | ||
175 | /*---------------------------------------------------------------------- | 150 | /** |
176 | Function: pvl_shift(pvl_list l) | 151 | * @brief Remove an element from the front of the list |
177 | 152 | * | |
178 | Purpose: | 153 | * @param LThe list to operate on |
179 | 154 | * | |
180 | Remove an element from the front of the list | 155 | * @return the entry on the front of the list |
181 | 156 | */ | |
182 | Parameters: | ||
183 | |||
184 | lThe list to operate on | ||
185 | |||
186 | Returns: | ||
187 | *----------------------------------------------------------------------*/ | ||
188 | 157 | ||
189 | void* | 158 | void* |
190 | pvl_shift(pvl_list l) | 159 | pvl_shift(pvl_list L) |
191 | { | 160 | { |
192 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
193 | |||
194 | if (L->head == 0) | 161 | if (L->head == 0) |
195 | { | 162 | { |
196 | return 0; | 163 | return 0; |
197 | } | 164 | } |
198 | 165 | ||
199 | return pvl_remove(l,(void*)L->head); | 166 | return pvl_remove(L,(void*)L->head); |
200 | 167 | ||
201 | } | 168 | } |
202 | 169 | ||
203 | /*---------------------------------------------------------------------- | 170 | /** |
204 | Function: void pvl_push(pvl_list l,void *d) | 171 | * @brief Add a new item to the tail of the list |
205 | 172 | * | |
206 | Purpose: | 173 | * @param LThe list to operate on |
207 | 174 | * @param dPointer to the item to add | |
208 | Add a new item to the tail of the list | 175 | * |
209 | 176 | */ | |
210 | Paramters: | ||
211 | |||
212 | lThe list to operate on | ||
213 | dPointer to the item to add | ||
214 | |||
215 | Returns: | ||
216 | *----------------------------------------------------------------------*/ | ||
217 | 177 | ||
218 | void | 178 | void |
219 | pvl_push(pvl_list l,void *d) | 179 | pvl_push(pvl_list L,void *d) |
220 | { | 180 | { |
221 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
222 | struct pvl_elem_t *E = pvl_new_element(d,0,L->tail); | 181 | struct pvl_elem_t *E = pvl_new_element(d,0,L->tail); |
223 | 182 | ||
224 | /* These are done in pvl_new_element | 183 | /* These are done in pvl_new_element |
@@ -242,59 +201,37 @@ pvl_push(pvl_list l,void *d) | |||
242 | 201 | ||
243 | } | 202 | } |
244 | 203 | ||
245 | /*---------------------------------------------------------------------- | 204 | /** |
246 | Function: void* pvl_pop(pvl_list l) | 205 | * @brief Remove an element from the tail of the list |
247 | 206 | * | |
248 | Purpose: | 207 | * @param LThe list to operate on |
249 | 208 | */ | |
250 | Remove an element from the tail of the list | ||
251 | |||
252 | Paramters: | ||
253 | |||
254 | lThe list to operate on | ||
255 | |||
256 | Returns: | ||
257 | *----------------------------------------------------------------------*/ | ||
258 | 209 | ||
259 | void* | 210 | void* |
260 | pvl_pop(pvl_list l) | 211 | pvl_pop(pvl_list L) |
261 | { | 212 | { |
262 | |||
263 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
264 | |||
265 | if ( L->tail == 0) | 213 | if ( L->tail == 0) |
266 | { | 214 | { |
267 | return 0; | 215 | return 0; |
268 | } | 216 | } |
269 | 217 | ||
270 | return pvl_remove(l,(void*) L->tail);; | 218 | return pvl_remove(L,(void*) L->tail);; |
271 | 219 | ||
272 | } | 220 | } |
273 | 221 | ||
274 | 222 | ||
275 | /*---------------------------------------------------------------------- | 223 | /** |
276 | Function: void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) | 224 | * Add a new item to a list that is ordered by a comparison function. |
277 | 225 | * This routine assumes that the list is properly ordered. | |
278 | Purpose: | 226 | * |
279 | 227 | * @param LThe list to operate on | |
280 | Add a new item to a list that is ordered by a comparison function. | 228 | * @param fPointer to a comparison function |
281 | This routine assumes that the list is properly ordered. | 229 | * @param d Pointer to data to pass to the comparison function |
282 | 230 | */ | |
283 | lThe list to operate on | ||
284 | fPointer to a comparison function | ||
285 | d Pointer to data to pass to the comparison function | ||
286 | |||
287 | Returns: | ||
288 | |||
289 | void | ||
290 | |||
291 | *----------------------------------------------------------------------*/ | ||
292 | 231 | ||
293 | void | 232 | void |
294 | pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) | 233 | pvl_insert_ordered(pvl_list L,pvl_comparef f,void *d) |
295 | { | 234 | { |
296 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
297 | |||
298 | struct pvl_elem_t *P; | 235 | struct pvl_elem_t *P; |
299 | 236 | ||
300 | L->count++; | 237 | L->count++; |
@@ -303,7 +240,7 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) | |||
303 | 240 | ||
304 | if(L->head == 0) | 241 | if(L->head == 0) |
305 | { | 242 | { |
306 | pvl_unshift(l,d); | 243 | pvl_unshift(L,d); |
307 | return; | 244 | return; |
308 | } | 245 | } |
309 | 246 | ||
@@ -311,14 +248,14 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) | |||
311 | 248 | ||
312 | if ( ((*f)(d,L->head->d)) <= 0) | 249 | if ( ((*f)(d,L->head->d)) <= 0) |
313 | { | 250 | { |
314 | pvl_unshift(l,d); | 251 | pvl_unshift(L,d); |
315 | return; | 252 | return; |
316 | } | 253 | } |
317 | 254 | ||
318 | /* larger than tail, add to tail */ | 255 | /* larger than tail, add to tail */ |
319 | if ( (*f)(d,L->tail->d) >= 0) | 256 | if ( (*f)(d,L->tail->d) >= 0) |
320 | { | 257 | { |
321 | pvl_push(l,d); | 258 | pvl_push(L,d); |
322 | return; | 259 | return; |
323 | } | 260 | } |
324 | 261 | ||
@@ -329,48 +266,34 @@ pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) | |||
329 | { | 266 | { |
330 | if ( (*f)(P->d,d) >= 0) | 267 | if ( (*f)(P->d,d) >= 0) |
331 | { | 268 | { |
332 | pvl_insert_before(l,P,d); | 269 | pvl_insert_before(L,P,d); |
333 | return; | 270 | return; |
334 | } | 271 | } |
335 | } | 272 | } |
336 | 273 | ||
337 | /* badness, choke */ | 274 | /* badness, choke */ |
338 | 275 | #ifndef lint | |
339 | assert(0); | 276 | assert(0); |
340 | 277 | #endif | |
341 | } | 278 | } |
342 | 279 | ||
343 | /*---------------------------------------------------------------------- | 280 | /** |
344 | Function: void pvl_insert_after(pvl_list l,pvl_elem p,void *d) | 281 | * @brief Add a new item after the referenced element. |
345 | 282 | * @param LThe list to operate on | |
346 | Purpose: | 283 | * @param PThe list element to add the item after |
347 | 284 | * @param dPointer to the item to add. | |
348 | Add a new item after the referenced element. | 285 | */ |
349 | |||
350 | Parameters: | ||
351 | |||
352 | lThe list to operate on | ||
353 | pThe list element to add the item after | ||
354 | dPointer to the item to add. | ||
355 | |||
356 | Returns: | ||
357 | |||
358 | void | ||
359 | |||
360 | *----------------------------------------------------------------------*/ | ||
361 | 286 | ||
362 | void | 287 | void |
363 | pvl_insert_after(pvl_list l,pvl_elem p,void *d) | 288 | pvl_insert_after(pvl_list L,pvl_elem P,void *d) |
364 | { | 289 | { |
365 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
366 | struct pvl_elem_t *P = (struct pvl_elem_t *)p; | ||
367 | struct pvl_elem_t *E = 0; | 290 | struct pvl_elem_t *E = 0; |
368 | 291 | ||
369 | L->count++; | 292 | L->count++; |
370 | 293 | ||
371 | if (P == 0) | 294 | if (P == 0) |
372 | { | 295 | { |
373 | pvl_unshift(l,d); | 296 | pvl_unshift(L,d); |
374 | return; | 297 | return; |
375 | } | 298 | } |
376 | 299 | ||
@@ -388,34 +311,24 @@ pvl_insert_after(pvl_list l,pvl_elem p,void *d) | |||
388 | } | 311 | } |
389 | } | 312 | } |
390 | 313 | ||
391 | /*---------------------------------------------------------------------- | 314 | /** |
392 | Function: void pvl_insert_before(pvl_list l,pvl_elem p,void *d) | 315 | * @brief Add an item after a referenced item |
393 | 316 | * | |
394 | Purpose: | 317 | * @param LThe list to operate on |
395 | 318 | * @param PThe list element to add the item before | |
396 | Add an item after a referenced item | 319 | * @param dPointer to the data to be added. |
397 | 320 | */ | |
398 | Parameters: | ||
399 | |||
400 | lThe list to operate on | ||
401 | pThe list element to add the item before | ||
402 | dPointer to the data to be added. | ||
403 | |||
404 | Returns: | ||
405 | *----------------------------------------------------------------------*/ | ||
406 | 321 | ||
407 | void | 322 | void |
408 | pvl_insert_before(pvl_list l,pvl_elem p,void *d) | 323 | pvl_insert_before(pvl_list L,pvl_elem P,void *d) |
409 | { | 324 | { |
410 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
411 | struct pvl_elem_t *P = (struct pvl_elem_t *)p; | ||
412 | struct pvl_elem_t *E = 0; | 325 | struct pvl_elem_t *E = 0; |
413 | 326 | ||
414 | L->count++; | 327 | L->count++; |
415 | 328 | ||
416 | if (P == 0) | 329 | if (P == 0) |
417 | { | 330 | { |
418 | pvl_unshift(l,d); | 331 | pvl_unshift(L,d); |
419 | return; | 332 | return; |
420 | } | 333 | } |
421 | 334 | ||
@@ -433,29 +346,19 @@ pvl_insert_before(pvl_list l,pvl_elem p,void *d) | |||
433 | } | 346 | } |
434 | } | 347 | } |
435 | 348 | ||
436 | /*---------------------------------------------------------------------- | 349 | /** |
437 | Function: void pvl_remove(pvl_list l,pvl_elem e) | 350 | * @brief Remove the referenced item from the list. |
438 | 351 | * | |
439 | Purpose: | 352 | * This routine will free the element, but not the data item that the |
440 | 353 | * element contains. | |
441 | Remove the referenced item from the list | 354 | * |
442 | 355 | * @param LThe list to operate on | |
443 | This routine will free the element, but not the data item that the | 356 | * @param EThe element to remove. |
444 | element contains. | 357 | */ |
445 | |||
446 | Parameters: | ||
447 | |||
448 | lThe list to operate on | ||
449 | eThe element to remove. | ||
450 | |||
451 | Returns: | ||
452 | *----------------------------------------------------------------------*/ | ||
453 | 358 | ||
454 | void* | 359 | void* |
455 | pvl_remove(pvl_list l,pvl_elem e) | 360 | pvl_remove(pvl_list L,pvl_elem E) |
456 | { | 361 | { |
457 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
458 | struct pvl_elem_t *E = (struct pvl_elem_t *)e; | ||
459 | void* data; | 362 | void* data; |
460 | 363 | ||
461 | if (E == L->head) | 364 | if (E == L->head) |
@@ -504,28 +407,19 @@ pvl_remove(pvl_list l,pvl_elem e) | |||
504 | 407 | ||
505 | } | 408 | } |
506 | 409 | ||
507 | /*---------------------------------------------------------------------- | 410 | /** |
508 | Function: pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v) | 411 | * @brief Return a pointer to data that satisfies a function. |
509 | 412 | * | |
510 | Purpose: | 413 | * This routine will interate through the entire list and call the |
511 | 414 | * find function for each item. It will break and return a pointer to the | |
512 | Return a pointer to data that satisfies a function | 415 | * data that causes the find function to return 1. |
513 | 416 | * | |
514 | This routine will interate through the entire list and call the | 417 | * @param lThe list to operate on |
515 | find function for each item. It will break and return a pointer to the | 418 | * @param fPointer to the find function |
516 | data that causes the find function to return 1. | 419 | * @param vPointer to constant data to pass into the function |
517 | 420 | * | |
518 | Parameters: | 421 | * @return Pointer to the element that the find function found. |
519 | 422 | */ | |
520 | lThe list to operate on | ||
521 | fPointer to the find function | ||
522 | vPointer to constant data to pass into the function | ||
523 | |||
524 | Returns: | ||
525 | |||
526 | Pointer to the element that the find function found. | ||
527 | |||
528 | *----------------------------------------------------------------------*/ | ||
529 | 423 | ||
530 | pvl_elem | 424 | pvl_elem |
531 | pvl_find(pvl_list l,pvl_findf f,void* v) | 425 | pvl_find(pvl_list l,pvl_findf f,void* v) |
@@ -545,25 +439,17 @@ pvl_find(pvl_list l,pvl_findf f,void* v) | |||
545 | return 0; | 439 | return 0; |
546 | 440 | ||
547 | } | 441 | } |
548 | /*---------------------------------------------------------------------- | ||
549 | Function: void* pvl_find_next(pvl_list l,pvl_findf f,void* v) | ||
550 | |||
551 | Purpose: | ||
552 | |||
553 | Like pvl_find(), but continues the search where the last find() or | ||
554 | find_next() left off | ||
555 | 442 | ||
556 | Parameters: | 443 | /** |
557 | 444 | * @brief Like pvl_find(), but continues the search where the last find() or | |
558 | lThe list to operate on | 445 | * find_next() left off. |
559 | fPointer to the find function | 446 | * |
560 | vPointer to constant data to pass into the function | 447 | * @param lThe list to operate on |
561 | 448 | * @param fPointer to the find function | |
562 | Returns: | 449 | * @param vPointer to constant data to pass into the function |
563 | 450 | * | |
564 | Pointer to the element that the find function found. | 451 | * @return Pointer to the element that the find function found. |
565 | 452 | */ | |
566 | *----------------------------------------------------------------------*/ | ||
567 | 453 | ||
568 | pvl_elem | 454 | pvl_elem |
569 | pvl_find_next(pvl_list l,pvl_findf f,void* v) | 455 | pvl_find_next(pvl_list l,pvl_findf f,void* v) |
@@ -585,17 +471,10 @@ pvl_find_next(pvl_list l,pvl_findf f,void* v) | |||
585 | 471 | ||
586 | } | 472 | } |
587 | 473 | ||
588 | /*---------------------------------------------------------------------- | 474 | /** |
589 | Function: void pvl_clear(pvl_list l) | 475 | * @brief Remove the all the elements in the list. The does not free |
590 | 476 | * the data items the elements hold. | |
591 | Purpose: | 477 | */ |
592 | |||
593 | Remove the all the elements in the list. The does not free the data items | ||
594 | the elements hold. | ||
595 | |||
596 | |||
597 | Returns: | ||
598 | *----------------------------------------------------------------------*/ | ||
599 | 478 | ||
600 | void | 479 | void |
601 | pvl_clear(pvl_list l) | 480 | pvl_clear(pvl_list l) |
@@ -615,39 +494,25 @@ pvl_clear(pvl_list l) | |||
615 | } | 494 | } |
616 | } | 495 | } |
617 | 496 | ||
618 | /*---------------------------------------------------------------------- | ||
619 | Function: int pvl_count(pvl_list l) | ||
620 | |||
621 | Purpose: | ||
622 | |||
623 | Returns the number of items in the list. | ||
624 | 497 | ||
625 | Returns: | 498 | /** |
626 | *----------------------------------------------------------------------*/ | 499 | * @brief Returns the number of items in the list. |
500 | */ | ||
627 | 501 | ||
628 | int | 502 | int |
629 | pvl_count(pvl_list l) | 503 | pvl_count(pvl_list L) |
630 | { | 504 | { |
631 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
632 | |||
633 | return L->count; | 505 | return L->count; |
634 | } | 506 | } |
635 | 507 | ||
636 | 508 | ||
637 | /*---------------------------------------------------------------------- | 509 | /** |
638 | Function: pvl_elem pvl_next(pvl_elem e) | 510 | * @brief Returns a pointer to the given element |
639 | 511 | */ | |
640 | Purpose: | ||
641 | Returns a pointer to the given element | ||
642 | |||
643 | Returns: | ||
644 | *----------------------------------------------------------------------*/ | ||
645 | 512 | ||
646 | pvl_elem | 513 | pvl_elem |
647 | pvl_next(pvl_elem e) | 514 | pvl_next(pvl_elem E) |
648 | { | 515 | { |
649 | struct pvl_elem_t *E = (struct pvl_elem_t *)e; | ||
650 | |||
651 | if (E == 0){ | 516 | if (E == 0){ |
652 | return 0; | 517 | return 0; |
653 | } | 518 | } |
@@ -655,74 +520,42 @@ pvl_next(pvl_elem e) | |||
655 | return (pvl_elem)E->next; | 520 | return (pvl_elem)E->next; |
656 | } | 521 | } |
657 | 522 | ||
658 | /*---------------------------------------------------------------------- | ||
659 | Function: pvl_elem pvl_prior(pvl_elem e) | ||
660 | 523 | ||
661 | Purpose: | 524 | /** |
662 | 525 | * @brief Returns a pointer to the element previous to the element given. | |
663 | Returns a pointer to the element previous to the element given. | 526 | */ |
664 | |||
665 | Returns: | ||
666 | *----------------------------------------------------------------------*/ | ||
667 | 527 | ||
668 | pvl_elem | 528 | pvl_elem |
669 | pvl_prior(pvl_elem e) | 529 | pvl_prior(pvl_elem E) |
670 | { | 530 | { |
671 | struct pvl_elem_t *E = (struct pvl_elem_t *)e; | ||
672 | |||
673 | return (pvl_elem)E->prior; | 531 | return (pvl_elem)E->prior; |
674 | } | 532 | } |
675 | 533 | ||
676 | /*---------------------------------------------------------------------- | ||
677 | Function: pvl_elem pvl_head(pvl_list l ) | ||
678 | |||
679 | Purpose: | ||
680 | |||
681 | Returns a pointer to the first item in the list. | ||
682 | 534 | ||
683 | Returns: | 535 | /** |
684 | *----------------------------------------------------------------------*/ | 536 | * @brief Returns a pointer to the first item in the list. |
537 | */ | ||
538 | |||
685 | pvl_elem | 539 | pvl_elem |
686 | pvl_head(pvl_list l ) | 540 | pvl_head(pvl_list L ) |
687 | { | 541 | { |
688 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
689 | |||
690 | return (pvl_elem)L->head; | 542 | return (pvl_elem)L->head; |
691 | } | 543 | } |
692 | 544 | ||
693 | /*---------------------------------------------------------------------- | 545 | /** |
694 | Function: pvl_elem pvl_tail(pvl_list l) | 546 | * @brief Returns a pointer to the last item in the list. |
695 | 547 | */ | |
696 | Purpose: | ||
697 | |||
698 | Returns a pointer to the last item in the list. | ||
699 | |||
700 | Returns: | ||
701 | *----------------------------------------------------------------------*/ | ||
702 | pvl_elem | 548 | pvl_elem |
703 | pvl_tail(pvl_list l) | 549 | pvl_tail(pvl_list L) |
704 | { | 550 | { |
705 | struct pvl_list_t *L = (struct pvl_list_t *)l; | ||
706 | return (pvl_elem)L->tail; | 551 | return (pvl_elem)L->tail; |
707 | } | 552 | } |
708 | 553 | ||
709 | /*---------------------------------------------------------------------- | ||
710 | Function: | ||
711 | |||
712 | |||
713 | Purpose: | ||
714 | |||
715 | |||
716 | Returns: | ||
717 | *----------------------------------------------------------------------*/ | ||
718 | |||
719 | #ifndef PVL_USE_MACROS | 554 | #ifndef PVL_USE_MACROS |
720 | void* | 555 | void* |
721 | pvl_data(pvl_elem e) | 556 | pvl_data(pvl_elem E) |
722 | { | 557 | { |
723 | struct pvl_elem_t *E = (struct pvl_elem_t *)e; | 558 | if ( E == 0){ |
724 | |||
725 | if ( e == 0){ | ||
726 | return 0; | 559 | return 0; |
727 | } | 560 | } |
728 | 561 | ||
@@ -730,23 +563,13 @@ pvl_data(pvl_elem e) | |||
730 | } | 563 | } |
731 | #endif | 564 | #endif |
732 | 565 | ||
733 | /*---------------------------------------------------------------------- | 566 | /** |
734 | Function: void pvl_apply(pvl_list l,pvl_applyf f, void *v) | 567 | * @brief Call a function for every item in the list. |
735 | 568 | * | |
736 | Purpose: | 569 | * @param lThe list to operate on |
737 | 570 | * @param fPointer to the function to call | |
738 | Call a function for every item in the list. | 571 | * @param vData to pass to the function on every iteration |
739 | 572 | */ | |
740 | Paramters: | ||
741 | |||
742 | lThe list to operate on | ||
743 | fPointer to the function to call | ||
744 | vData to pass to the function on every iteration | ||
745 | |||
746 | Returns: | ||
747 | |||
748 | void | ||
749 | *----------------------------------------------------------------------*/ | ||
750 | 573 | ||
751 | void | 574 | void |
752 | pvl_apply(pvl_list l,pvl_applyf f, void *v) | 575 | pvl_apply(pvl_list l,pvl_applyf f, void *v) |
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 | |||
@@ -10,29 +10,29 @@ | |||
10 | #ifndef __PVL_H__ | 10 | #ifndef __PVL_H__ |
11 | #define __PVL_H__ | 11 | #define __PVL_H__ |
12 | 12 | ||
13 | typedef void* pvl_list; | 13 | typedef struct pvl_list_t* pvl_list; |
14 | typedef void* pvl_elem; | 14 | typedef struct pvl_elem_t* pvl_elem; |
15 | 15 | ||
16 | /* | 16 | /** |
17 | struct pvl_elem_t | 17 | * This type is private. Always use pvl_elem instead. The struct would |
18 | * not even appear in this header except to make code in the USE_MACROS | ||
19 | * blocks work | ||
20 | */ | ||
18 | 21 | ||
19 | This type is private. Always use pvl_elem instead. The struct would | ||
20 | not even appear in this header except to make code in the USE_MACROS | ||
21 | blocks work | ||
22 | |||
23 | */ | ||
24 | typedef struct pvl_elem_t | 22 | typedef struct pvl_elem_t |
25 | { | 23 | { |
26 | int MAGIC; /* Magic Identifier */ | 24 | int MAGIC; /**< Magic Identifier */ |
27 | void *d; /* Pointer to data user is storing */ | 25 | void *d; /**< Pointer to data user is storing */ |
28 | struct pvl_elem_t *next;/* Next element */ | 26 | struct pvl_elem_t *next;/**< Next element */ |
29 | struct pvl_elem_t *prior;/* prior element */ | 27 | struct pvl_elem_t *prior;/**< Prior element */ |
30 | } pvl_elem_t; | 28 | } pvl_elem_t; |
31 | 29 | ||
32 | 30 | ||
33 | 31 | ||
34 | /* This global is incremented for each call to pvl_new_element(); it gives each | 32 | /** |
35 | * list a unique identifer */ | 33 | * This global is incremented for each call to pvl_new_element(); it gives each |
34 | * list a unique identifer | ||
35 | */ | ||
36 | 36 | ||
37 | extern int pvl_elem_count; | 37 | extern int pvl_elem_count; |
38 | extern int pvl_list_count; | 38 | extern int pvl_list_count; |
@@ -81,8 +81,11 @@ typedef int (*pvl_findf)(void* a, void* b); /*a is list elem, b is other data*/ | |||
81 | pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v); | 81 | pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v); |
82 | pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v); | 82 | pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v); |
83 | 83 | ||
84 | /* Pass each element in the list to a function */ | 84 | /** |
85 | typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/ | 85 | * Pass each element in the list to a function |
86 | * a is list elem, b is other data | ||
87 | */ | ||
88 | typedef void (*pvl_applyf)(void* a, void* b); | ||
86 | void pvl_apply(pvl_list l,pvl_applyf f, void *v); | 89 | void pvl_apply(pvl_list l,pvl_applyf f, void *v); |
87 | 90 | ||
88 | 91 | ||
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 | |||
@@ -41,18 +41,15 @@ | |||
41 | #include <stdlib.h> /* for malloc, free */ | 41 | #include <stdlib.h> /* for malloc, free */ |
42 | #include <string.h> /* for strcasecmp */ | 42 | #include <string.h> /* for strcasecmp */ |
43 | 43 | ||
44 | // Eugen C. <eug@thekompany.com> | ||
45 | #ifdef _WIN32 | ||
46 | #define strcasecmp _stricmp | ||
47 | #endif | ||
48 | // Eugen C. <eug@thekompany.com> | ||
49 | |||
50 | int snprintf(char *str, size_t n, char const *fmt, ...); | ||
51 | |||
52 | #ifdef DMALLOC | 44 | #ifdef DMALLOC |
53 | #include "dmalloc.h" | 45 | #include "dmalloc.h" |
54 | #endif | 46 | #endif |
55 | 47 | ||
48 | #ifdef WIN32 | ||
49 | #define snprintf _snprintf | ||
50 | #define strcasecmp stricmp | ||
51 | #endif | ||
52 | |||
56 | #define TMP_BUF_SIZE 1024 | 53 | #define TMP_BUF_SIZE 1024 |
57 | 54 | ||
58 | 55 | ||
@@ -93,7 +90,7 @@ char* sspm_strdup(char* str){ | |||
93 | } | 90 | } |
94 | 91 | ||
95 | 92 | ||
96 | struct major_content_type_map | 93 | static struct major_content_type_map |
97 | { | 94 | { |
98 | enum sspm_major_type type; | 95 | enum sspm_major_type type; |
99 | char* str; | 96 | char* str; |
@@ -112,7 +109,7 @@ struct major_content_type_map | |||
112 | {SSPM_UNKNOWN_MAJOR_TYPE,"" }, | 109 | {SSPM_UNKNOWN_MAJOR_TYPE,"" }, |
113 | }; | 110 | }; |
114 | 111 | ||
115 | struct minor_content_type_map | 112 | static struct minor_content_type_map |
116 | { | 113 | { |
117 | enum sspm_minor_type type; | 114 | enum sspm_minor_type type; |
118 | char* str; | 115 | char* str; |
@@ -241,7 +238,7 @@ char* sspm_value(char* line) | |||
241 | 238 | ||
242 | } | 239 | } |
243 | 240 | ||
244 | char *mime_headers[] = { | 241 | static char *mime_headers[] = { |
245 | "Content-Type", | 242 | "Content-Type", |
246 | "Content-Transfer-Encoding", | 243 | "Content-Transfer-Encoding", |
247 | "Content-Disposition", | 244 | "Content-Disposition", |
@@ -366,7 +363,7 @@ enum line_type { | |||
366 | }; | 363 | }; |
367 | 364 | ||
368 | 365 | ||
369 | enum line_type get_line_type(char* line){ | 366 | static enum line_type get_line_type(char* line){ |
370 | 367 | ||
371 | if (line == 0){ | 368 | if (line == 0){ |
372 | return EMPTY; | 369 | return EMPTY; |
@@ -390,7 +387,7 @@ enum line_type get_line_type(char* line){ | |||
390 | } | 387 | } |
391 | 388 | ||
392 | 389 | ||
393 | struct sspm_action_map get_action(struct mime_impl *impl, | 390 | static struct sspm_action_map get_action(struct mime_impl *impl, |
394 | enum sspm_major_type major, | 391 | enum sspm_major_type major, |
395 | enum sspm_minor_type minor) | 392 | enum sspm_minor_type minor) |
396 | { | 393 | { |
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,4 +1,7 @@ | |||
1 | #ifdef __osf__ | 1 | #ifndef WIN32 |
2 | #include "config.h" | ||
3 | #endif | ||
4 | #ifndef HAVE_SNPRINTF | ||
2 | /* | 5 | /* |
3 | * Revision 12: http://theos.com/~deraadt/snprintf.c | 6 | * Revision 12: http://theos.com/~deraadt/snprintf.c |
4 | * | 7 | * |
@@ -25,14 +28,14 @@ | |||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 29 | */ |
27 | 30 | ||
28 | #include <sys/types.h> | 31 | #ifndef WIN32 |
29 | #include <stdio.h> | ||
30 | |||
31 | #include <unistd.h> | ||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> |
33 | #include <sys/mman.h> | 33 | #include <sys/mman.h> |
34 | #include <unistd.h> | ||
35 | #endif | ||
36 | #include <sys/types.h> | ||
34 | #include <signal.h> | 37 | #include <signal.h> |
35 | 38 | #include <stdio.h> | |
36 | #include <string.h> | 39 | #include <string.h> |
37 | #if __STDC__ | 40 | #if __STDC__ |
38 | #include <stdarg.h> | 41 | #include <stdarg.h> |
@@ -157,20 +160,9 @@ snprintf(str, n, fmt, va_alist) | |||
157 | va_end(ap); | 160 | va_end(ap); |
158 | } | 161 | } |
159 | 162 | ||
160 | #elif defined ( _WIN32 ) | ||
161 | |||
162 | #include <stdio.h> | ||
163 | #include <stdarg.h> | ||
164 | |||
165 | int snprintf(char *str, size_t n, char const *fmt, ...) | ||
166 | { | ||
167 | va_list ap; | ||
168 | va_start(ap, fmt); | ||
169 | |||
170 | return _snprintf(str, n, fmt, ap); | ||
171 | } | ||
172 | 163 | ||
173 | #else | 164 | #else |
165 | |||
174 | /* ANSI C forbids an empty source file... */ | 166 | /* ANSI C forbids an empty source file... */ |
175 | 167 | ||
176 | static void vsnprintf_dummy_func() { | 168 | static void vsnprintf_dummy_func() { |