Diffstat (limited to 'libical/src/libical/icalparser.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libical/icalparser.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h index 5e1c88f..7773af4 100644 --- a/libical/src/libical/icalparser.h +++ b/libical/src/libical/icalparser.h | |||
@@ -1,93 +1,96 @@ | |||
1 | /* -*- Mode: C -*- */ | 1 | /* -*- Mode: C -*- */ |
2 | /*====================================================================== | 2 | /*====================================================================== |
3 | FILE: icalparser.h | 3 | FILE: icalparser.h |
4 | CREATOR: eric 20 April 1999 | 4 | CREATOR: eric 20 April 1999 |
5 | 5 | ||
6 | $Id$ | 6 | $Id$ |
7 | 7 | ||
8 | 8 | ||
9 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 9 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
10 | 10 | ||
11 | This program is free software; you can redistribute it and/or modify | 11 | This program is free software; you can redistribute it and/or modify |
12 | it under the terms of either: | 12 | it under the terms of either: |
13 | 13 | ||
14 | The LGPL as published by the Free Software Foundation, version | 14 | The LGPL as published by the Free Software Foundation, version |
15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
16 | 16 | ||
17 | Or: | 17 | Or: |
18 | 18 | ||
19 | The Mozilla Public License Version 1.0. You may obtain a copy of | 19 | The Mozilla Public License Version 1.0. You may obtain a copy of |
20 | the License at http://www.mozilla.org/MPL/ | 20 | the License at http://www.mozilla.org/MPL/ |
21 | 21 | ||
22 | The original code is icalparser.h | 22 | The original code is icalparser.h |
23 | 23 | ||
24 | ======================================================================*/ | 24 | ======================================================================*/ |
25 | 25 | ||
26 | 26 | ||
27 | #ifndef ICALPARSER_H | 27 | #ifndef ICALPARSER_H |
28 | #define ICALPARSER_H | 28 | #define ICALPARSER_H |
29 | 29 | ||
30 | #include "icalenums.h" | 30 | #include "icalenums.h" |
31 | #include "icaltypes.h" | 31 | #include "icaltypes.h" |
32 | #include"icalcomponent.h" | 32 | #include"icalcomponent.h" |
33 | 33 | ||
34 | #include <stdio.h> /* For FILE* */ | 34 | #include <stdio.h> /* For FILE* */ |
35 | 35 | ||
36 | typedef void* icalparser; | 36 | typedef struct icalparser_impl icalparser; |
37 | 37 | ||
38 | 38 | ||
39 | /*********************************************************************** | 39 | /** |
40 | * Line-oriented parsing. | 40 | * @file icalparser.h |
41 | * @brief Line-oriented parsing. | ||
41 | * | 42 | * |
42 | * Create a new parser via icalparse_new_parser, then add ines one at | 43 | * Create a new parser via icalparse_new_parser, then add lines one at |
43 | * a time with icalparse_add_line(). icalparser_add_line() will return | 44 | * a time with icalparse_add_line(). icalparser_add_line() will return |
44 | * non-zero when it has finished with a component. | 45 | * non-zero when it has finished with a component. |
45 | ***********************************************************************/ | 46 | */ |
46 | 47 | ||
47 | typedef enum icalparser_state { | 48 | typedef enum icalparser_state { |
48 | ICALPARSER_ERROR, | 49 | ICALPARSER_ERROR, |
49 | ICALPARSER_SUCCESS, | 50 | ICALPARSER_SUCCESS, |
50 | ICALPARSER_BEGIN_COMP, | 51 | ICALPARSER_BEGIN_COMP, |
51 | ICALPARSER_END_COMP, | 52 | ICALPARSER_END_COMP, |
52 | ICALPARSER_IN_PROGRESS | 53 | ICALPARSER_IN_PROGRESS |
53 | } icalparser_state; | 54 | } icalparser_state; |
54 | 55 | ||
55 | icalparser* icalparser_new(void); | 56 | icalparser* icalparser_new(void); |
56 | icalcomponent* icalparser_add_line(icalparser* parser, char* str ); | 57 | icalcomponent* icalparser_add_line(icalparser* parser, char* str ); |
57 | icalcomponent* icalparser_clean(icalparser* parser); | 58 | icalcomponent* icalparser_clean(icalparser* parser); |
58 | icalparser_state icalparser_get_state(icalparser* parser); | 59 | icalparser_state icalparser_get_state(icalparser* parser); |
59 | void icalparser_free(icalparser* parser); | 60 | void icalparser_free(icalparser* parser); |
60 | 61 | ||
61 | 62 | ||
62 | /*********************************************************************** | 63 | /** |
63 | * Message oriented parsing. icalparser_parse takes a string that | 64 | * Message oriented parsing. icalparser_parse takes a string that |
64 | * holds the text ( in RFC 2445 format ) and returns a pointer to an | 65 | * holds the text ( in RFC 2445 format ) and returns a pointer to an |
65 | * icalcomponent. The caller owns the memory. line_gen_func is a | 66 | * icalcomponent. The caller owns the memory. line_gen_func is a |
66 | * pointer to a function that returns one content line per invocation | 67 | * pointer to a function that returns one content line per invocation |
67 | **********************************************************************/ | 68 | */ |
68 | 69 | ||
69 | icalcomponent* icalparser_parse(icalparser *parser, | 70 | icalcomponent* icalparser_parse(icalparser *parser, |
70 | char* (*line_gen_func)(char *s, size_t size, void *d)); | 71 | char* (*line_gen_func)(char *s, size_t size, void *d)); |
71 | 72 | ||
72 | /* Set the data that icalparser_parse will give to the line_gen_func | 73 | /** |
73 | as the parameter 'd'*/ | 74 | Set the data that icalparser_parse will give to the line_gen_func |
75 | as the parameter 'd' | ||
76 | */ | ||
74 | void icalparser_set_gen_data(icalparser* parser, void* data); | 77 | void icalparser_set_gen_data(icalparser* parser, void* data); |
75 | 78 | ||
76 | 79 | ||
77 | icalcomponent* icalparser_parse_string(const char* str); | 80 | icalcomponent* icalparser_parse_string(const char* str); |
78 | 81 | ||
79 | 82 | ||
80 | /*********************************************************************** | 83 | /*********************************************************************** |
81 | * Parser support functions | 84 | * Parser support functions |
82 | ***********************************************************************/ | 85 | ***********************************************************************/ |
83 | 86 | ||
84 | /* Use the flex/bison parser to turn a string into a value type */ | 87 | /** Use the flex/bison parser to turn a string into a value type */ |
85 | icalvalue* icalparser_parse_value(icalvalue_kind kind, | 88 | icalvalue* icalparser_parse_value(icalvalue_kind kind, |
86 | const char* str, icalcomponent** errors); | 89 | const char* str, icalcomponent** errors); |
87 | 90 | ||
88 | /* Given a line generator function, return a single iCal content line.*/ | 91 | /** Given a line generator function, return a single iCal content line.*/ |
89 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); | 92 | char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); |
90 | 93 | ||
91 | char* string_line_generator(char *out, size_t buf_size, void *d); | 94 | char* icalparser_string_line_generator(char *out, size_t buf_size, void *d); |
92 | 95 | ||
93 | #endif /* !ICALPARSE_H */ | 96 | #endif /* !ICALPARSE_H */ |