Libical API Documentation  3.0
icalparser.h
Go to the documentation of this file.
1 /*======================================================================
2  FILE: icalparser.h
3  CREATOR: eric 20 April 1999
4 
5  (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
6 
7  This library is free software; you can redistribute it and/or modify
8  it under the terms of either:
9 
10  The LGPL as published by the Free Software Foundation, version
11  2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
12 
13  Or:
14 
15  The Mozilla Public License Version 2.0. You may obtain a copy of
16  the License at https://www.mozilla.org/MPL/
17 
18  The original code is icalparser.h
19 ======================================================================*/
20 
21 #ifndef ICALPARSER_H
22 #define ICALPARSER_H
23 
24 #include "libical_ical_export.h"
25 #include "icalcomponent.h"
26 
48 typedef struct icalparser_impl icalparser;
49 
55 typedef enum icalparser_state
56 {
59 
62 
65 
68 
72 
73 typedef char *(*icalparser_line_gen_func) (char *s, size_t size, void *d);
74 
98 LIBICAL_ICAL_EXPORT icalparser *icalparser_new(void);
99 
159 LIBICAL_ICAL_EXPORT icalcomponent *icalparser_add_line(icalparser *parser, char *str);
160 
180 LIBICAL_ICAL_EXPORT icalcomponent *icalparser_clean(icalparser *parser);
181 
202 LIBICAL_ICAL_EXPORT icalparser_state icalparser_get_state(icalparser *parser);
203 
217 LIBICAL_ICAL_EXPORT void icalparser_free(icalparser *parser);
218 
271 LIBICAL_ICAL_EXPORT icalcomponent *icalparser_parse(icalparser *parser,
272  icalparser_line_gen_func line_gen_func);
273 
284 LIBICAL_ICAL_EXPORT void icalparser_set_gen_data(icalparser *parser, void *data);
285 
313 LIBICAL_ICAL_EXPORT icalcomponent *icalparser_parse_string(const char *str);
314 
326 };
327 
332 LIBICAL_ICAL_EXPORT enum icalparser_ctrl icalparser_get_ctrl(void);
333 
338 LIBICAL_ICAL_EXPORT void icalparser_set_ctrl(enum icalparser_ctrl ctrl);
339 
340 /***********************************************************************
341  * Parser support functions
342  ***********************************************************************/
343 
358 LIBICAL_ICAL_EXPORT char *icalparser_get_line(icalparser *parser,
359  icalparser_line_gen_func line_gen_func);
360 
361 LIBICAL_ICAL_EXPORT char *icalparser_string_line_generator(char *out, size_t buf_size, void *d);
362 
363 #endif /* !ICALPARSE_H */
void icalparser_set_ctrl(enum icalparser_ctrl ctrl)
Set the parser setting how to handle CONTROL characters.
Definition: icalparser.c:1423
Definition: icalparser.h:64
icalparser_state
Represents the current state of the parser.
Definition: icalparser.h:55
icalcomponent * icalparser_parse(icalparser *parser, icalparser_line_gen_func line_gen_func)
Message oriented parsing.
Definition: icalparser.c:635
icalparser * icalparser_new(void)
Creates a new icalparser.
Definition: icalparser.c:101
icalcomponent * icalparser_parse_string(const char *str)
Parses a string and returns the parsed icalcomponent.
Definition: icalparser.c:1393
char * icalparser_get_line(icalparser *parser, icalparser_line_gen_func line_gen_func)
Given a line generator function, returns a single iCal content line.
Definition: icalparser.c:486
Definition: icalparser.h:58
Definition: icalparser.c:52
Definition: icalparser.h:61
icalparser_state icalparser_get_state(icalparser *parser)
Returns current state of the icalparser.
Definition: icalparser.c:1287
Definition: icalparser.h:67
void icalparser_set_gen_data(icalparser *parser, void *data)
Sets the data that icalparser_parse will give to the line_gen_func as the parameter 'd'...
Definition: icalparser.c:140
icalcomponent * icalparser_add_line(icalparser *parser, char *str)
Adds a single line to be parsed by the icalparser.
Definition: icalparser.c:695
Definition: icalparser.h:321
Definition: icalcomponent.c:35
void icalparser_free(icalparser *parser)
Frees an icalparser object.
Definition: icalparser.c:123
icalcomponent * icalparser_clean(icalparser *parser)
Cleans out an icalparser and returns whatever it has parsed so far.
Definition: icalparser.c:1292
Definition: icalparser.h:70
Definition: icalparser.h:323
Definition: icalparser.h:325
icalparser_ctrl
Defines how to handle invalid CONTROL characters in content lines.
Definition: icalparser.h:319
enum icalparser_ctrl icalparser_get_ctrl(void)
Get the current parser setting how to handle CONTROL characters.
Definition: icalparser.c:1418