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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Libical API Documentation: icalparser.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Libical API Documentation
 <span id="projectnumber">3.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_b7a0ea939f6e83384f3c571d31a84be9.html">libical</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">icalparser.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Line-oriented parsing.
<a href="#details">More...</a></p>
<p><a href="icalparser_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a9332da05cc4922f68ae2b07f442c06fa"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structicalparser__impl.html">icalparser_impl</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a></td></tr>
<tr class="separator:a9332da05cc4922f68ae2b07f442c06fa"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0917f8ab0a302751de31c6e1172fad6f"><td class="memItemLeft" align="right" valign="top"><a id="a0917f8ab0a302751de31c6e1172fad6f"></a>
typedef char *(* </td><td class="memItemRight" valign="bottom"><b>icalparser_line_gen_func</b>) (char *s, size_t size, void *d)</td></tr>
<tr class="separator:a0917f8ab0a302751de31c6e1172fad6f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af8b34b2ce5d2982022e34e8a0ef32be0"><td class="memItemLeft" align="right" valign="top"><a id="af8b34b2ce5d2982022e34e8a0ef32be0"></a>
typedef enum <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">icalparser_state</a> </td><td class="memItemRight" valign="bottom"><b>icalparser_state</b></td></tr>
<tr class="separator:af8b34b2ce5d2982022e34e8a0ef32be0"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:aeec42cd09dd789c699d7b6741cbec3e7"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">icalparser_state</a> { <br />
  <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a>
, <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7a2dc67ce9b2811c477a462025a9ed9090">ICALPARSER_SUCCESS</a>
, <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7a0bfd41070e190cb87f0e8385e0c8031e">ICALPARSER_BEGIN_COMP</a>
, <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7a5a29afa239e509cc9f45a61a2c10feb2">ICALPARSER_END_COMP</a>
, <br />
  <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7a927206f107dfdc62cfd33a9115a997b2">ICALPARSER_IN_PROGRESS</a>
<br />
}</td></tr>
<tr class="memdesc:aeec42cd09dd789c699d7b6741cbec3e7"><td class="mdescLeft"> </td><td class="mdescRight">Represents the current state of the parser. <a href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">More...</a><br /></td></tr>
<tr class="separator:aeec42cd09dd789c699d7b6741cbec3e7"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a1138735cde70554bcdfc17dc8a595a6a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a">icalparser_add_line</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser, char *str)</td></tr>
<tr class="memdesc:a1138735cde70554bcdfc17dc8a595a6a"><td class="mdescLeft"> </td><td class="mdescRight">Adds a single line to be parsed by the <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a>. <a href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a">More...</a><br /></td></tr>
<tr class="separator:a1138735cde70554bcdfc17dc8a595a6a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa184343e374e5a201d8079df827597b2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#aa184343e374e5a201d8079df827597b2">icalparser_clean</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser)</td></tr>
<tr class="memdesc:aa184343e374e5a201d8079df827597b2"><td class="mdescLeft"> </td><td class="mdescRight">Cleans out an <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> and returns whatever it has parsed so far. <a href="icalparser_8h.html#aa184343e374e5a201d8079df827597b2">More...</a><br /></td></tr>
<tr class="separator:aa184343e374e5a201d8079df827597b2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1cb8b8678b781d3d2ede0fbce613b90d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser)</td></tr>
<tr class="memdesc:a1cb8b8678b781d3d2ede0fbce613b90d"><td class="mdescLeft"> </td><td class="mdescRight">Frees an <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> object. <a href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">More...</a><br /></td></tr>
<tr class="separator:a1cb8b8678b781d3d2ede0fbce613b90d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1e9b165c1aa2ba82605bcccadf85f74c"><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a1e9b165c1aa2ba82605bcccadf85f74c">icalparser_get_line</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser, icalparser_line_gen_func line_gen_func)</td></tr>
<tr class="memdesc:a1e9b165c1aa2ba82605bcccadf85f74c"><td class="mdescLeft"> </td><td class="mdescRight">Given a line generator function, returns a single iCal content line. <a href="icalparser_8h.html#a1e9b165c1aa2ba82605bcccadf85f74c">More...</a><br /></td></tr>
<tr class="separator:a1e9b165c1aa2ba82605bcccadf85f74c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9a27d19ac53219bb65aeb9a031dbf027"><td class="memItemLeft" align="right" valign="top"><a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">icalparser_state</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a9a27d19ac53219bb65aeb9a031dbf027">icalparser_get_state</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser)</td></tr>
<tr class="memdesc:a9a27d19ac53219bb65aeb9a031dbf027"><td class="mdescLeft"> </td><td class="mdescRight">Returns current state of the icalparser. <a href="icalparser_8h.html#a9a27d19ac53219bb65aeb9a031dbf027">More...</a><br /></td></tr>
<tr class="separator:a9a27d19ac53219bb65aeb9a031dbf027"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3a7a45307a9ff90ec23d632501c0bd00"><td class="memItemLeft" align="right" valign="top"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a> (void)</td></tr>
<tr class="memdesc:a3a7a45307a9ff90ec23d632501c0bd00"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a>. <a href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">More...</a><br /></td></tr>
<tr class="separator:a3a7a45307a9ff90ec23d632501c0bd00"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aab80e10c3636d6476bc4920ae72d4b70"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#aab80e10c3636d6476bc4920ae72d4b70">icalparser_parse</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser, icalparser_line_gen_func line_gen_func)</td></tr>
<tr class="memdesc:aab80e10c3636d6476bc4920ae72d4b70"><td class="mdescLeft"> </td><td class="mdescRight">Message oriented parsing. <a href="icalparser_8h.html#aab80e10c3636d6476bc4920ae72d4b70">More...</a><br /></td></tr>
<tr class="separator:aab80e10c3636d6476bc4920ae72d4b70"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a966f6fd4bc931c06b2c596daeadb692f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#a966f6fd4bc931c06b2c596daeadb692f">icalparser_parse_string</a> (const char *str)</td></tr>
<tr class="memdesc:a966f6fd4bc931c06b2c596daeadb692f"><td class="mdescLeft"> </td><td class="mdescRight">Parses a string and returns the parsed ::icalcomponent. <a href="icalparser_8h.html#a966f6fd4bc931c06b2c596daeadb692f">More...</a><br /></td></tr>
<tr class="separator:a966f6fd4bc931c06b2c596daeadb692f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aae6d08b4084610e225621a25dddd7689"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689">icalparser_set_gen_data</a> (<a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> *parser, void *data)</td></tr>
<tr class="memdesc:aae6d08b4084610e225621a25dddd7689"><td class="mdescLeft"> </td><td class="mdescRight">Sets the data that icalparser_parse will give to the line_gen_func as the parameter 'd'. <a href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689">More...</a><br /></td></tr>
<tr class="separator:aae6d08b4084610e225621a25dddd7689"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7c0eb0a99b21f94b4d5009cd660382e7"><td class="memItemLeft" align="right" valign="top"><a id="a7c0eb0a99b21f94b4d5009cd660382e7"></a>
char * </td><td class="memItemRight" valign="bottom"><b>icalparser_string_line_generator</b> (char *out, size_t buf_size, void *d)</td></tr>
<tr class="separator:a7c0eb0a99b21f94b4d5009cd660382e7"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Line-oriented parsing. </p>
<p>This file provides methods to parse iCalendar-formatted data into the structures provided by this library.</p>
<h3><a class="anchor" id="autotoc_md68"></a>
Usage</h3>
<p>Create a new parser via icalparser_new_parser(), then add lines one at a time with <a class="el" href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a" title="Adds a single line to be parsed by the icalparser.">icalparser_add_line()</a>. <a class="el" href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a" title="Adds a single line to be parsed by the icalparser.">icalparser_add_line()</a> will return non-zero when it has finished with a component. </p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="a9332da05cc4922f68ae2b07f442c06fa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9332da05cc4922f68ae2b07f442c06fa">◆ </a></span>icalparser</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Implementation of the icalparser struct, which holds the state for the current parsing operation. </p>
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="aeec42cd09dd789c699d7b6741cbec3e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeec42cd09dd789c699d7b6741cbec3e7">◆ </a></span>icalparser_state</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">icalparser_state</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Represents the current state of the parser. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8"></a>ICALPARSER_ERROR </td><td class="fielddoc"><p>An error occurred while parsing. </p>
</td></tr>
<tr><td class="fieldname"><a id="aeec42cd09dd789c699d7b6741cbec3e7a2dc67ce9b2811c477a462025a9ed9090"></a>ICALPARSER_SUCCESS </td><td class="fielddoc"><p>Parsing was successful. </p>
</td></tr>
<tr><td class="fieldname"><a id="aeec42cd09dd789c699d7b6741cbec3e7a0bfd41070e190cb87f0e8385e0c8031e"></a>ICALPARSER_BEGIN_COMP </td><td class="fielddoc"><p>Currently parsing the begin of a component. </p>
</td></tr>
<tr><td class="fieldname"><a id="aeec42cd09dd789c699d7b6741cbec3e7a5a29afa239e509cc9f45a61a2c10feb2"></a>ICALPARSER_END_COMP </td><td class="fielddoc"><p>Currently parsing the end of the component. </p>
</td></tr>
<tr><td class="fieldname"><a id="aeec42cd09dd789c699d7b6741cbec3e7a927206f107dfdc62cfd33a9115a997b2"></a>ICALPARSER_IN_PROGRESS </td><td class="fielddoc"><p>Parsing is currently in progress. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a1138735cde70554bcdfc17dc8a595a6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1138735cde70554bcdfc17dc8a595a6a">◆ </a></span>icalparser_add_line()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a>* icalparser_add_line </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char * </td>
<td class="paramname"><em>str</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Adds a single line to be parsed by the <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The parser to use </td></tr>
<tr><td class="paramname">str</td><td>A string representing a single line of RFC5545-formatted iCalendar data </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>When this was the last line of the component to be parsed, it returns the icalcomponent, otherwise it returns <code>NULL</code>. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="icalparser_8h.html#aab80e10c3636d6476bc4920ae72d4b70" title="Message oriented parsing.">icalparser_parse()</a></dd></dl>
<dl class="section user"><dt>Error handling</dt><dd><ul>
<li>If <em>parser</em> is <code>NULL</code>, it returns <code>NULL</code> and sets <a class="el" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37" title="Access the current icalerrno value.">icalerrno</a> to <a class="el" href="icalerror_8h.html#a601c122fcea522513b1b7732fa23e833a2cc8bbcd8c07fc9a16e36f7aae5757b1">ICAL_BADARG_ERROR</a>.</li>
<li>If <em>line</em> is empty, if returns <code>NULL</code></li>
<li>If <em>line</em> is <code>NULL</code>, it returns <code>NULL</code> and sets the <em>parser's</em> <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7" title="Represents the current state of the parser.">icalparser_state</a> to <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a>.</li>
<li>For errors during parsing, the functions can set the <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7" title="Represents the current state of the parser.">icalparser_state</a> to <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a> and/or return components of the type ::ICAL_XLICINVALID_COMPONENT, or components with properties of the type ::ICAL_XLICERROR_PROPERTY.</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Ownership</dt><dd>Ownership of the <em>str</em> is transferred to libical upon calling this method. The returned ::icalcomponent is owned by the caller and needs to be <code>free()</code>d with the appropriate method after it's no longer needed.</dd></dl>
<h3><a class="anchor" id="autotoc_md70"></a>
Example</h3>
<div class="fragment"><div class="line"><span class="keywordtype">char</span>* read_stream(<span class="keywordtype">char</span> *s, <span class="keywordtype">size_t</span> size, <span class="keywordtype">void</span> *d)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">return</span> fgets(s, (<span class="keywordtype">int</span>)size, (FILE*)d);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> parse()</div>
<div class="line">{</div>
<div class="line"> <span class="keywordtype">char</span>* line;</div>
<div class="line"> FILE* stream;</div>
<div class="line"> <a class="code" href="structicalcomponent__impl.html">icalcomponent</a> *component;</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="structicalparser__impl.html">icalparser</a> *parser = <a class="code" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a>();</div>
<div class="line"> stream = fopen(argv[1],<span class="stringliteral">"r"</span>);</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689">icalparser_set_gen_data</a>(parser, stream);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">do</span>{</div>
<div class="line"> <span class="comment">// get a single content line</span></div>
<div class="line"> line = <a class="code" href="icalparser_8h.html#a1e9b165c1aa2ba82605bcccadf85f74c">icalparser_get_line</a>(parser, read_stream);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// add that line to the parser</span></div>
<div class="line"> c = <a class="code" href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a">icalparser_add_line</a>(parser,line);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// once we parsed a component, print it</span></div>
<div class="line"> <span class="keywordflow">if</span> (c != 0) {</div>
<div class="line"> printf(<span class="stringliteral">"%s"</span>, icalcomponent_as_ical_string(c));</div>
<div class="line"> icalcomponent_free(c);</div>
<div class="line"> }</div>
<div class="line"> } <span class="keywordflow">while</span> (line != 0);</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a>(parser);</div>
<div class="line">}</div>
<div class="ttc" id="aicalparser_8h_html_a1138735cde70554bcdfc17dc8a595a6a"><div class="ttname"><a href="icalparser_8h.html#a1138735cde70554bcdfc17dc8a595a6a">icalparser_add_line</a></div><div class="ttdeci">icalcomponent * icalparser_add_line(icalparser *parser, char *str)</div><div class="ttdoc">Adds a single line to be parsed by the icalparser.</div><div class="ttdef"><b>Definition:</b> icalparser.c:702</div></div>
<div class="ttc" id="aicalparser_8h_html_a1cb8b8678b781d3d2ede0fbce613b90d"><div class="ttname"><a href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a></div><div class="ttdeci">void icalparser_free(icalparser *parser)</div><div class="ttdoc">Frees an icalparser object.</div><div class="ttdef"><b>Definition:</b> icalparser.c:124</div></div>
<div class="ttc" id="aicalparser_8h_html_a1e9b165c1aa2ba82605bcccadf85f74c"><div class="ttname"><a href="icalparser_8h.html#a1e9b165c1aa2ba82605bcccadf85f74c">icalparser_get_line</a></div><div class="ttdeci">char * icalparser_get_line(icalparser *parser, icalparser_line_gen_func line_gen_func)</div><div class="ttdoc">Given a line generator function, returns a single iCal content line.</div><div class="ttdef"><b>Definition:</b> icalparser.c:487</div></div>
<div class="ttc" id="aicalparser_8h_html_a3a7a45307a9ff90ec23d632501c0bd00"><div class="ttname"><a href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a></div><div class="ttdeci">icalparser * icalparser_new(void)</div><div class="ttdoc">Creates a new icalparser.</div><div class="ttdef"><b>Definition:</b> icalparser.c:101</div></div>
<div class="ttc" id="aicalparser_8h_html_aae6d08b4084610e225621a25dddd7689"><div class="ttname"><a href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689">icalparser_set_gen_data</a></div><div class="ttdeci">void icalparser_set_gen_data(icalparser *parser, void *data)</div><div class="ttdoc">Sets the data that icalparser_parse will give to the line_gen_func as the parameter 'd'.</div><div class="ttdef"><b>Definition:</b> icalparser.c:141</div></div>
<div class="ttc" id="astructicalcomponent__impl_html"><div class="ttname"><a href="structicalcomponent__impl.html">icalcomponent_impl</a></div><div class="ttdef"><b>Definition:</b> icalcomponent.c:36</div></div>
<div class="ttc" id="astructicalparser__impl_html"><div class="ttname"><a href="structicalparser__impl.html">icalparser_impl</a></div><div class="ttdef"><b>Definition:</b> icalparser.c:52</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aa184343e374e5a201d8079df827597b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa184343e374e5a201d8079df827597b2">◆ </a></span>icalparser_clean()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a>* icalparser_clean </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Cleans out an <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> and returns whatever it has parsed so far. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> to clean </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The parsed ::icalcomponent</dd></dl>
<dl class="section user"><dt>Error handling</dt><dd>If <em>parser</em> is <code>NULL</code>, it returns <code>NULL</code> and sets <a class="el" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37" title="Access the current icalerrno value.">icalerrno</a> to <a class="el" href="icalerror_8h.html#a601c122fcea522513b1b7732fa23e833a2cc8bbcd8c07fc9a16e36f7aae5757b1">ICAL_BADARG_ERROR</a>. For parsing errors, it inserts an <code>X-LIC-ERROR</code> property into the affected components.</dd></dl>
<dl class="section user"><dt>Ownership</dt><dd>The returned ::icalcomponent is property of the caller and needs to be free'd with icalcomponent_free() after use.</dd></dl>
<p>This will parse components even if it hasn't encountered a proper <code>END</code> tag for it yet and return them, as well as clearing any intermediate state resulting from being in the middle of parsing something so the parser can be used to parse something new. </p>
</div>
</div>
<a id="a1cb8b8678b781d3d2ede0fbce613b90d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1cb8b8678b781d3d2ede0fbce613b90d">◆ </a></span>icalparser_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void icalparser_free </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Frees an <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> to be freed.</td></tr>
</table>
</dd>
</dl>
<h3><a class="anchor" id="autotoc_md72"></a>
Example</h3>
<div class="fragment"><div class="line"><a class="code" href="structicalparser__impl.html">icalparser</a> *parser = <a class="code" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a>();</div>
<div class="line"> </div>
<div class="line"><span class="comment">// use parser ...</span></div>
<div class="line"> </div>
<div class="line"><a class="code" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a>(parser);</div>
</div><!-- fragment -->
</div>
</div>
<a id="a1e9b165c1aa2ba82605bcccadf85f74c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e9b165c1aa2ba82605bcccadf85f74c">◆ </a></span>icalparser_get_line()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* icalparser_get_line </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">icalparser_line_gen_func </td>
<td class="paramname"><em>line_gen_func</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Given a line generator function, returns a single iCal content line. </p>
<dl class="section return"><dt>Returns</dt><dd>A pointer to a single line of data or <code>NULL</code> if it reached end of file reading from the <em>line_gen_func</em>. Note that the pointer returned is owned by libical and must not be <code>free()</code>d by the user. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The parser object to use </td></tr>
<tr><td class="paramname">line_gen_func</td><td>The function to use for reading data</td></tr>
</table>
</dd>
</dl>
<p>This function uses the supplied <em>line_gen_func</em> to read data in, until it has read a full line, and returns the full line. It includes any continuation lines, which start with a space after a newline. To supply arbitrary data (as the parameter <em>d</em>) to your <em>line_gen_func</em>, call <a class="el" href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689" title="Sets the data that icalparser_parse will give to the line_gen_func as the parameter 'd'.">icalparser_set_gen_data()</a>. </p>
</div>
</div>
<a id="a9a27d19ac53219bb65aeb9a031dbf027"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a27d19ac53219bb65aeb9a031dbf027">◆ </a></span>icalparser_get_state()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7">icalparser_state</a> icalparser_get_state </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns current state of the icalparser. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The (valid, non-<code>NULL</code>) parser object </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The current state of the icalparser, as an <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7" title="Represents the current state of the parser.">icalparser_state</a></dd></dl>
<h3><a class="anchor" id="autotoc_md71"></a>
Example</h3>
<div class="fragment"><div class="line"><a class="code" href="structicalparser__impl.html">icalparser</a> *parser = <a class="code" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a>();</div>
<div class="line"> </div>
<div class="line"><span class="comment">// use icalparser...</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">if</span>(<a class="code" href="icalparser_8h.html#a9a27d19ac53219bb65aeb9a031dbf027">icalparser_get_state</a>(parser) == <a class="code" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a>) {</div>
<div class="line"> <span class="comment">// handle error</span></div>
<div class="line">} <span class="keywordflow">else</span> {</div>
<div class="line"> <span class="comment">// ...</span></div>
<div class="line">}</div>
<div class="ttc" id="aicalparser_8h_html_a9a27d19ac53219bb65aeb9a031dbf027"><div class="ttname"><a href="icalparser_8h.html#a9a27d19ac53219bb65aeb9a031dbf027">icalparser_get_state</a></div><div class="ttdeci">icalparser_state icalparser_get_state(icalparser *parser)</div><div class="ttdoc">Returns current state of the icalparser.</div><div class="ttdef"><b>Definition:</b> icalparser.c:1258</div></div>
<div class="ttc" id="aicalparser_8h_html_aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8"><div class="ttname"><a href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a></div><div class="ttdeci">@ ICALPARSER_ERROR</div><div class="ttdef"><b>Definition:</b> icalparser.h:58</div></div>
</div><!-- fragment --><p>icalparser_free(parser); </p>
</div>
</div>
<a id="a3a7a45307a9ff90ec23d632501c0bd00"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3a7a45307a9ff90ec23d632501c0bd00">◆ </a></span>icalparser_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a>* icalparser_new </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>An <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> object</dd></dl>
<dl class="section user"><dt>Error handling</dt><dd>On error, it returns <code>NULL</code> and sets <a class="el" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37" title="Access the current icalerrno value.">icalerrno</a> to <a class="el" href="icalerror_8h.html#a601c122fcea522513b1b7732fa23e833a055394ffaf6701aa12491dc10767f07d">ICAL_NEWFAILED_ERROR</a>.</dd></dl>
<dl class="section user"><dt>Ownership</dt><dd>All <a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> objects created with this function need to be freed using the <a class="el" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d" title="Frees an icalparser object.">icalparser_free()</a> function.</dd></dl>
<h3><a class="anchor" id="autotoc_md69"></a>
Usage</h3>
<div class="fragment"><div class="line"><span class="comment">// create new parser</span></div>
<div class="line"><a class="code" href="structicalparser__impl.html">icalparser</a> *parser = <a class="code" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a>();</div>
<div class="line"> </div>
<div class="line"><span class="comment">// do something with it...</span></div>
<div class="line"> </div>
<div class="line"><span class="comment">// free parser</span></div>
<div class="line"><a class="code" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a>(parser);</div>
</div><!-- fragment -->
</div>
</div>
<a id="aab80e10c3636d6476bc4920ae72d4b70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aab80e10c3636d6476bc4920ae72d4b70">◆ </a></span>icalparser_parse()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a>* icalparser_parse </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">icalparser_line_gen_func </td>
<td class="paramname"><em>line_gen_func</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Message oriented parsing. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The parser to use </td></tr>
<tr><td class="paramname">line_gen_func</td><td>A function that returns one content line per invocation </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The parsed icalcomponent </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="icalparser_8h.html#a966f6fd4bc931c06b2c596daeadb692f" title="Parses a string and returns the parsed ::icalcomponent.">icalparser_parse_string()</a></dd></dl>
<p>Reads an icalcomponent using the supplied <em>line_gen_func</em>, returning the parsed component (or <code>NULL</code> on error).</p>
<dl class="section user"><dt>Error handling</dt><dd><ul>
<li>If <em>parser</em> is <code>NULL</code>, it returns <code>NULL</code> and sets <a class="el" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37" title="Access the current icalerrno value.">icalerrno</a> to <a class="el" href="icalerror_8h.html#a601c122fcea522513b1b7732fa23e833a2cc8bbcd8c07fc9a16e36f7aae5757b1">ICAL_BADARG_ERROR</a>.</li>
<li>If data read by <em>line_gen_func</em> is empty, if returns <code>NULL</code></li>
<li>If data read by <em>line_gen_func</em> is <code>NULL</code>, it returns <code>NULL</code> and sets the <em>parser's</em> <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7" title="Represents the current state of the parser.">icalparser_state</a> to <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a>.</li>
<li>For errors during parsing, the functions can set the <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7" title="Represents the current state of the parser.">icalparser_state</a> to <a class="el" href="icalparser_8h.html#aeec42cd09dd789c699d7b6741cbec3e7adc8fd0c6d697007e6b3fa12bd118a9c8">ICALPARSER_ERROR</a> and/or return components of the type ::ICAL_XLICINVALID_COMPONENT, or components with properties of the type ::ICAL_XLICERROR_PROPERTY.</li>
</ul>
</dd></dl>
<dl class="section user"><dt>Ownership</dt><dd>The returned ::icalcomponent is owned by the caller of the function, and needs to be <code>free()</code>d with the appropriate method when no longer needed.</dd></dl>
<h3><a class="anchor" id="autotoc_md73"></a>
Example</h3>
<div class="fragment"><div class="line"><span class="keywordtype">char</span>* read_stream(<span class="keywordtype">char</span> *s, <span class="keywordtype">size_t</span> size, <span class="keywordtype">void</span> *d)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">return</span> fgets(s, (<span class="keywordtype">int</span>)size, (FILE*)d);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> parse()</div>
<div class="line">{</div>
<div class="line"> <span class="keywordtype">char</span>* line;</div>
<div class="line"> FILE* stream;</div>
<div class="line"> <a class="code" href="structicalcomponent__impl.html">icalcomponent</a> *component;</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="structicalparser__impl.html">icalparser</a> *parser = <a class="code" href="icalparser_8h.html#a3a7a45307a9ff90ec23d632501c0bd00">icalparser_new</a>();</div>
<div class="line"> stream = fopen(argv[1],<span class="stringliteral">"r"</span>);</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="icalparser_8h.html#aae6d08b4084610e225621a25dddd7689">icalparser_set_gen_data</a>(parser, stream);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// use the parse method to parse the input data</span></div>
<div class="line"> component = <a class="code" href="icalparser_8h.html#aab80e10c3636d6476bc4920ae72d4b70">icalparser_parse</a>(parser, read_stream);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// once we parsed a component, print it</span></div>
<div class="line"> printf(<span class="stringliteral">"%s"</span>, icalcomponent_as_ical_string(c));</div>
<div class="line"> icalcomponent_free(c);</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="icalparser_8h.html#a1cb8b8678b781d3d2ede0fbce613b90d">icalparser_free</a>(parser);</div>
<div class="line">}</div>
<div class="ttc" id="aicalparser_8h_html_aab80e10c3636d6476bc4920ae72d4b70"><div class="ttname"><a href="icalparser_8h.html#aab80e10c3636d6476bc4920ae72d4b70">icalparser_parse</a></div><div class="ttdeci">icalcomponent * icalparser_parse(icalparser *parser, icalparser_line_gen_func line_gen_func)</div><div class="ttdoc">Message oriented parsing.</div><div class="ttdef"><b>Definition:</b> icalparser.c:642</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a966f6fd4bc931c06b2c596daeadb692f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a966f6fd4bc931c06b2c596daeadb692f">◆ </a></span>icalparser_parse_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structicalcomponent__impl.html">icalcomponent</a>* icalparser_parse_string </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>str</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Parses a string and returns the parsed ::icalcomponent. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>The iCal formatted data to be parsed </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An ::icalcomponent representing the iCalendar</dd></dl>
<dl class="section user"><dt>Error handling</dt><dd>On error, returns <code>NULL</code> and sets <a class="el" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37" title="Access the current icalerrno value.">icalerrno</a></dd></dl>
<dl class="section user"><dt>Ownership</dt><dd>The returned ::icalcomponent is owned by the caller of the function, and needs to be free'd with the appropriate functions after use.</dd></dl>
<h3><a class="anchor" id="autotoc_md74"></a>
Example</h3>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *ical_string;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// parse ical_string</span></div>
<div class="line"><a class="code" href="structicalcomponent__impl.html">icalcomponent</a> *component = <a class="code" href="icalparser_8h.html#a966f6fd4bc931c06b2c596daeadb692f">icalparser_parse_string</a>(ical_string);</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">if</span>(!<a class="code" href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37">icalerrno</a> || component == NULL) {</div>
<div class="line"> <span class="comment">// use component ...</span></div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release component</span></div>
<div class="line">icalcomponent_free(component);</div>
<div class="ttc" id="aicalerror_8h_html_ad2562706150f5c5a4d9b0ca149d78e37"><div class="ttname"><a href="icalerror_8h.html#ad2562706150f5c5a4d9b0ca149d78e37">icalerrno</a></div><div class="ttdeci">#define icalerrno</div><div class="ttdoc">Access the current icalerrno value.</div><div class="ttdef"><b>Definition:</b> icalerror.h:144</div></div>
<div class="ttc" id="aicalparser_8h_html_a966f6fd4bc931c06b2c596daeadb692f"><div class="ttname"><a href="icalparser_8h.html#a966f6fd4bc931c06b2c596daeadb692f">icalparser_parse_string</a></div><div class="ttdeci">icalcomponent * icalparser_parse_string(const char *str)</div><div class="ttdoc">Parses a string and returns the parsed ::icalcomponent.</div><div class="ttdef"><b>Definition:</b> icalparser.c:1356</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aae6d08b4084610e225621a25dddd7689"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aae6d08b4084610e225621a25dddd7689">◆ </a></span>icalparser_set_gen_data()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void icalparser_set_gen_data </td>
<td>(</td>
<td class="paramtype"><a class="el" href="icalparser_8h.html#a9332da05cc4922f68ae2b07f442c06fa">icalparser</a> * </td>
<td class="paramname"><em>parser</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the data that icalparser_parse will give to the line_gen_func as the parameter 'd'. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">parser</td><td>The icalparser this applies to </td></tr>
<tr><td class="paramname">data</td><td>The pointer which will be passed to the line_gen_func as argument <code>d</code></td></tr>
</table>
</dd>
</dl>
<p>If you use any of the icalparser_parser() or <a class="el" href="icalparser_8h.html#a1e9b165c1aa2ba82605bcccadf85f74c" title="Given a line generator function, returns a single iCal content line.">icalparser_get_line()</a> functions, the <em>line_gen_func</em> that they expect has a third <code>void* d</code> argument. This function sets what will be passed to your <em>line_gen_function</em> as such argument. </p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Apr 9 2022 08:46:36 for Libical API Documentation by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
|