Diffstat (limited to 'libical/src/libical/icalderivedparameter.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libical/icalderivedparameter.c | 807 |
1 files changed, 402 insertions, 405 deletions
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 | |||
@@ -52,167 +52,31 @@ struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind); | |||
52 | struct icalparameter_kind_map { | 52 | struct icalparameter_kind_map { |
53 | icalparameter_kind kind; | 53 | icalparameter_kind kind; |
54 | char *name; | 54 | char *name; |
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 | ||
100 | struct icalparameter_value_kind_map { | 61 | struct icalparameter_value_kind_map { |
101 | icalparameter_value value; | 62 | icalparameter_value value; |
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 { |
126 | icalparameter_kind kind; | 69 | icalparameter_kind kind; |
127 | int enumeration; | 70 | int enumeration; |
128 | const char* str; | 71 | const char* str; |
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}, |
216 | {ICAL_VALUE_DURATION,ICAL_DURATION_VALUE}, | 80 | {ICAL_VALUE_DURATION,ICAL_DURATION_VALUE}, |
217 | {ICAL_VALUE_FLOAT,ICAL_FLOAT_VALUE}, | 81 | {ICAL_VALUE_FLOAT,ICAL_FLOAT_VALUE}, |
218 | {ICAL_VALUE_INTEGER,ICAL_INTEGER_VALUE}, | 82 | {ICAL_VALUE_INTEGER,ICAL_INTEGER_VALUE}, |
@@ -224,13 +88,13 @@ struct icalparameter_value_kind_map value_kind_map[] = { | |||
224 | {ICAL_VALUE_UTCOFFSET,ICAL_UTCOFFSET_VALUE}, | 88 | {ICAL_VALUE_UTCOFFSET,ICAL_UTCOFFSET_VALUE}, |
225 | {ICAL_VALUE_CALADDRESS,ICAL_CALADDRESS_VALUE}, | 89 | {ICAL_VALUE_CALADDRESS,ICAL_CALADDRESS_VALUE}, |
226 | {ICAL_VALUE_X,ICAL_X_VALUE}, | 90 | {ICAL_VALUE_X,ICAL_X_VALUE}, |
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"}, |
234 | {ICAL_DELEGATEDFROM_PARAMETER,"DELEGATED-FROM"}, | 98 | {ICAL_DELEGATEDFROM_PARAMETER,"DELEGATED-FROM"}, |
235 | {ICAL_DELEGATEDTO_PARAMETER,"DELEGATED-TO"}, | 99 | {ICAL_DELEGATEDTO_PARAMETER,"DELEGATED-TO"}, |
236 | {ICAL_DIR_PARAMETER,"DIR"}, | 100 | {ICAL_DIR_PARAMETER,"DIR"}, |
@@ -274,13 +138,13 @@ static struct icalparameter_map icalparameter_map[] = { | |||
274 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"}, | 138 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"}, |
275 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"}, | 139 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"}, |
276 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"}, | 140 | {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"}, |
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"}, |
284 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"}, | 148 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"}, |
285 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_REQPARTICIPANT,"REQ-PARTICIPANT"}, | 149 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_REQPARTICIPANT,"REQ-PARTICIPANT"}, |
286 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_OPTPARTICIPANT,"OPT-PARTICIPANT"}, | 150 | {ICAL_ROLE_PARAMETER,ICAL_ROLE_OPTPARTICIPANT,"OPT-PARTICIPANT"}, |
@@ -305,560 +169,629 @@ static struct icalparameter_map icalparameter_map[] = { | |||
305 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"}, | 169 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"}, |
306 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"}, | 170 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"}, |
307 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"}, | 171 | {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"}, |
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"}, |
314 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER-VALUE-PARSE-ERROR"}, | 180 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER-VALUE-PARSE-ERROR"}, |
315 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE-PARSE-ERROR"}, | 181 | {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE-PARSE-ERROR"}, |
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; |
336 | } | 203 | } |
337 | 204 | ||
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"); |
352 | icalerror_clear_errno(); | 219 | icalerror_clear_errno(); |
353 | 220 | ||
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; |
372 | } | 239 | } |
373 | 240 | ||
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"); |
388 | icalerror_clear_errno(); | 255 | icalerror_clear_errno(); |
389 | 256 | ||
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; |
409 | } | 276 | } |
410 | 277 | ||
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; |
448 | } | 317 | } |
449 | 318 | ||
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; |
490 | } | 390 | } |
491 | 391 | ||
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; |
529 | } | 428 | } |
530 | 429 | ||
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; |
571 | } | 501 | } |
572 | 502 | ||
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; |
613 | } | 543 | } |
614 | 544 | ||
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; |
654 | } | 581 | } |
655 | 582 | ||
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"); |
670 | icalerror_clear_errno(); | 597 | icalerror_clear_errno(); |
671 | 598 | ||
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; |
690 | } | 617 | } |
691 | 618 | ||
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"); |
706 | icalerror_clear_errno(); | 633 | icalerror_clear_errno(); |
707 | 634 | ||
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; |
726 | } | 653 | } |
727 | 654 | ||
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"); |
742 | icalerror_clear_errno(); | 669 | icalerror_clear_errno(); |
743 | 670 | ||
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; |
763 | } | 690 | } |
764 | 691 | ||
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; |
804 | } | 729 | } |
805 | 730 | ||
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; |
840 | } | 771 | } |
841 | 772 | ||
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 */ |
862 | icalparameter* icalparameter_new_related(icalparameter_related v) | 795 | icalparameter* icalparameter_new_related(icalparameter_related v) |
863 | { | 796 | { |
864 | struct icalparameter_impl *impl; | 797 | struct icalparameter_impl *impl; |
@@ -876,175 +809,184 @@ icalparameter* icalparameter_new_related(icalparameter_related v) | |||
876 | return 0; | 809 | return 0; |
877 | } | 810 | } |
878 | 811 | ||
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) |
891 | { | 824 | { |
892 | icalerror_check_arg_rv(v >= ICAL_RELATED_X,"v"); | 825 | icalerror_check_arg_rv(v >= ICAL_RELATED_X,"v"); |
893 | icalerror_check_arg_rv(v < ICAL_RELATED_NONE,"v"); | 826 | icalerror_check_arg_rv(v < ICAL_RELATED_NONE,"v"); |
894 | icalerror_check_arg_rv( (param!=0), "param"); | 827 | icalerror_check_arg_rv( (param!=0), "param"); |
895 | icalerror_clear_errno(); | 828 | icalerror_clear_errno(); |
896 | 829 | ||
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; |
915 | } | 849 | } |
916 | 850 | ||
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; |
952 | } | 890 | } |
953 | 891 | ||
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; |
990 | } | 926 | } |
991 | 927 | ||
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"); |
1006 | icalerror_clear_errno(); | 942 | icalerror_clear_errno(); |
1007 | 943 | ||
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; |
1026 | } | 963 | } |
1027 | 964 | ||
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 */ |
1048 | icalparameter* icalparameter_new_role(icalparameter_role v) | 990 | icalparameter* icalparameter_new_role(icalparameter_role v) |
1049 | { | 991 | { |
1050 | struct icalparameter_impl *impl; | 992 | struct icalparameter_impl *impl; |
@@ -1062,144 +1004,199 @@ icalparameter* icalparameter_new_role(icalparameter_role v) | |||
1062 | return 0; | 1004 | return 0; |
1063 | } | 1005 | } |
1064 | 1006 | ||
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) |
1080 | { | 1022 | { |
1081 | icalerror_check_arg_rv(v >= ICAL_ROLE_X,"v"); | 1023 | icalerror_check_arg_rv(v >= ICAL_ROLE_X,"v"); |
1082 | icalerror_check_arg_rv(v < ICAL_ROLE_NONE,"v"); | 1024 | icalerror_check_arg_rv(v < ICAL_ROLE_NONE,"v"); |
1083 | icalerror_check_arg_rv( (param!=0), "param"); | 1025 | icalerror_check_arg_rv( (param!=0), "param"); |
1084 | icalerror_clear_errno(); | 1026 | icalerror_clear_errno(); |
1085 | 1027 | ||
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; |
1105 | } | 1047 | } |
1106 | 1048 | ||
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. */ | ||