1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
/**
* @file icalparameter_cxx.cpp
* @author fnguyen (12/10/01)
* @brief Implementation of C++ Wrapper for icalparameter.c
*
* SPDX-FileCopyrightText: 2001, Critical Path
SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
*/
#include "icalparameter_cxx.h"
using namespace LibICal;
ICalParameter::ICalParameter() : imp(icalparameter_new(ICAL_ANY_PARAMETER))
{
}
ICalParameter::ICalParameter(const ICalParameter &v) : imp(icalparameter_clone(v.imp))
{
if (imp == NULL) {
throw icalerrno;
}
}
ICalParameter &ICalParameter::operator=(const ICalParameter &v)
{
if (this == &v) {
return *this;
}
if (imp != NULL) {
icalparameter_free(imp);
imp = icalparameter_clone(v.imp);
if (imp == NULL) {
throw icalerrno;
}
}
return *this;
}
void ICalParameter::detach()
{
imp = NULL;
}
ICalParameter::~ICalParameter()
{
if (imp != NULL) {
icalparameter_free(imp);
}
}
ICalParameter::ICalParameter(icalparameter *v) : imp(v)
{
}
/// Create from string of form "PARAMNAME=VALUE"
ICalParameter::ICalParameter(const std::string &str)
: imp(icalparameter_new_from_string(str.c_str()))
{
if (imp == NULL) {
throw icalerrno;
}
}
/// Create from just the value, the part after the "="
ICalParameter::ICalParameter(const icalparameter_kind &kind, const std::string &str)
: imp(icalparameter_new_from_value_string(kind, str.c_str()))
{
if (imp == NULL) {
throw icalerrno;
}
}
ICalParameter::ICalParameter(const icalparameter_kind &kind) : imp(icalparameter_new(kind))
{
if (imp == NULL) {
throw icalerrno;
}
}
std::string ICalParameter::as_ical_string()
{
char *str = icalparameter_as_ical_string(imp);
if (str == NULL) {
throw icalerrno;
}
return str;
}
bool ICalParameter::is_valid()
{
if (imp == NULL) {
return false;
}
return (icalparameter_isa_parameter(static_cast<void *>(imp)) != 0);
}
icalparameter_kind ICalParameter::isa()
{
return icalparameter_isa(imp);
}
int ICalParameter::isa_parameter(void *param)
{
return icalparameter_isa_parameter(param);
}
/* Access the name of an X parameter */
void ICalParameter::set_xname(ICalParameter ¶m, const std::string &v)
{
icalparameter_set_xname(param, v.c_str());
}
std::string ICalParameter::get_xname(ICalParameter ¶m)
{
return static_cast<std::string>(icalparameter_get_xname(param));
}
void ICalParameter::set_xvalue(ICalParameter ¶m, const std::string &v)
{
icalparameter_set_xvalue(param, v.c_str());
}
std::string ICalParameter::get_xvalue(ICalParameter ¶m)
{
return static_cast<std::string>(icalparameter_get_xvalue(param));
}
/* Convert enumerations */
std::string ICalParameter::kind_to_string(const icalparameter_kind &kind)
{
return static_cast<std::string>(icalparameter_kind_to_string(kind));
}
icalparameter_kind ICalParameter::string_to_kind(const std::string &str)
{
return icalparameter_string_to_kind(str.c_str());
}
/* DELEGATED-FROM */
std::string ICalParameter::get_delegatedfrom() const
{
return static_cast<std::string>(icalparameter_get_delegatedfrom(imp));
}
void ICalParameter::set_delegatedfrom(const std::string &v)
{
icalparameter_set_delegatedfrom(imp, v.c_str());
}
/* RELATED */
icalparameter_related ICalParameter::get_related() const
{
return icalparameter_get_related(imp);
}
void ICalParameter::set_related(const icalparameter_related &v)
{
icalparameter_set_related(imp, v);
}
/* SENT-BY */
std::string ICalParameter::get_sentby() const
{
return static_cast<std::string>(icalparameter_get_sentby(imp));
}
void ICalParameter::set_sentby(const std::string &v)
{
icalparameter_set_sentby(imp, v.c_str());
}
/* LANGUAGE */
std::string ICalParameter::get_language() const
{
return static_cast<std::string>(icalparameter_get_language(imp));
}
void ICalParameter::set_language(const std::string &v)
{
icalparameter_set_language(imp, v.c_str());
}
/* RELTYPE */
icalparameter_reltype ICalParameter::get_reltype() const
{
return icalparameter_get_reltype(imp);
}
void ICalParameter::set_reltype(const icalparameter_reltype &v)
{
icalparameter_set_reltype(imp, v);
}
/* ENCODING */
icalparameter_encoding ICalParameter::get_encoding() const
{
return icalparameter_get_encoding(imp);
}
void ICalParameter::set_encoding(const icalparameter_encoding &v)
{
icalparameter_set_encoding(imp, v);
}
/* ALTREP */
std::string ICalParameter::get_altrep() const
{
return static_cast<std::string>(icalparameter_get_language(imp));
}
void ICalParameter::set_altrep(const std::string &v)
{
icalparameter_set_altrep(imp, v.c_str());
}
/* FMTTYPE */
std::string ICalParameter::get_fmttype() const
{
return static_cast<std::string>(icalparameter_get_fmttype(imp));
}
void ICalParameter::set_fmttype(const std::string &v)
{
icalparameter_set_fmttype(imp, v.c_str());
}
/* FBTYPE */
icalparameter_fbtype ICalParameter::get_fbtype() const
{
return icalparameter_get_fbtype(imp);
}
void ICalParameter::set_fbtype(const icalparameter_fbtype &v)
{
icalparameter_set_fbtype(imp, v);
}
/* RSVP */
icalparameter_rsvp ICalParameter::get_rsvp() const
{
return icalparameter_get_rsvp(imp);
}
void ICalParameter::set_rsvp(const icalparameter_rsvp &v)
{
icalparameter_set_rsvp(imp, v);
}
/* RANGE */
icalparameter_range ICalParameter::get_range() const
{
return icalparameter_get_range(imp);
}
void ICalParameter::set_range(const icalparameter_range &v)
{
icalparameter_set_range(imp, v);
}
/* DELEGATED-TO */
std::string ICalParameter::get_delegatedto() const
{
return static_cast<std::string>(icalparameter_get_delegatedto(imp));
}
void ICalParameter::set_delegatedto(const std::string &v)
{
icalparameter_set_delegatedto(imp, v.c_str());
}
/* CN */
std::string ICalParameter::get_cn() const
{
return static_cast<std::string>(icalparameter_get_cn(imp));
}
void ICalParameter::set_cn(const std::string &v)
{
icalparameter_set_cn(imp, v.c_str());
}
/* ROLE */
icalparameter_role ICalParameter::get_role() const
{
return icalparameter_get_role(imp);
}
void ICalParameter::set_role(const icalparameter_role &v)
{
icalparameter_set_role(imp, v);
}
/* X-LIC-COMPARETYPE */
icalparameter_xliccomparetype ICalParameter::get_xliccomparetype() const
{
return icalparameter_get_xliccomparetype(imp);
}
void ICalParameter::set_xliccomparetype(const icalparameter_xliccomparetype &v)
{
icalparameter_set_xliccomparetype(imp, v);
}
/* PARTSTAT */
icalparameter_partstat ICalParameter::get_partstat() const
{
return icalparameter_get_partstat(imp);
}
void ICalParameter::set_partstat(const icalparameter_partstat &v)
{
icalparameter_set_partstat(imp, v);
}
/* X-LIC-ERRORTYPE */
icalparameter_xlicerrortype ICalParameter::get_xlicerrortype() const
{
return icalparameter_get_xlicerrortype(imp);
}
void ICalParameter::set_xlicerrortype(const icalparameter_xlicerrortype &v)
{
icalparameter_set_xlicerrortype(imp, v);
}
/* MEMBER */
std::string ICalParameter::get_member() const
{
return static_cast<std::string>(icalparameter_get_member(imp));
}
void ICalParameter::set_member(const std::string &v)
{
icalparameter_set_member(imp, v.c_str());
}
/* X */
std::string ICalParameter::get_x() const
{
return static_cast<std::string>(icalparameter_get_x(imp));
}
void ICalParameter::set_x(const std::string &v)
{
icalparameter_set_x(imp, v.c_str());
}
/* CUTYPE */
icalparameter_cutype ICalParameter::get_cutype() const
{
return icalparameter_get_cutype(imp);
}
void ICalParameter::set_cutype(const icalparameter_cutype &v)
{
icalparameter_set_cutype(imp, v);
}
/* TZID */
std::string ICalParameter::get_tzid() const
{
return static_cast<std::string>(icalparameter_get_tzid(imp));
}
void ICalParameter::set_tzid(const std::string &v)
{
icalparameter_set_tzid(imp, v.c_str());
}
/* VALUE */
icalparameter_value ICalParameter::get_value() const
{
return icalparameter_get_value(imp);
}
void ICalParameter::set_value(const icalparameter_value &v)
{
icalparameter_set_value(imp, v);
}
/* DIR */
std::string ICalParameter::get_dir() const
{
return static_cast<std::string>(icalparameter_get_dir(imp));
}
void ICalParameter::set_dir(const std::string &v)
{
icalparameter_set_dir(imp, v.c_str());
}
|