summaryrefslogtreecommitdiff
path: root/src/libical-glib/api/i-cal-parser.xml
blob: ede9477213fd4d442a07cc4073ca0bd42ff17952 (plain)
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
<!--
  Copyright (C) 2015 William Yu <williamyu@gnome.org>

  This library is free software: you can redistribute it and/or modify it
  under the terms of version 2.1. of the GNU Lesser General Public License
  as published by the Free Software Foundation.

  This library is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with this library. If not, see <https://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Parser" native="icalparser" destroy_func="icalparser_free">
    <enum name="ICalParserState" native_name="icalparserstate" default_native="I_CAL_PARSER_ERROR">
        <element name="ICALPARSER_ERROR"/>
        <element name="ICALPARSER_SUCCESS"/>
        <element name="ICALPARSER_BEGIN_COMP"/>
        <element name="ICALPARSER_END_COMP"/>
        <element name="ICALPARSER_IN_PROGRESS"/>
    </enum>
    <declaration position="header">/**
 * ICalParserLineGenFunc:
 * @bytes: (array length=size) (element-type gchar): the bytes to process
 * @size: the length of the bytes array
 * @user_data: the user data
 *
 * Returns: One content line per invocation
 */
typedef gchar *(*ICalParserLineGenFunc)(gchar *bytes, size_t size, gpointer user_data);</declaration>
    <method name="i_cal_parser_new" corresponds="icalparser_new" kind="constructor" since="1.0">
        <returns type="ICalParser *" annotation="transfer full" comment="The newly created #ICalParser."/>
        <comment xml:space="preserve">Creates a default #ICalParser.</comment>
    </method>
    <method name="i_cal_parser_add_line" corresponds="icalparser_add_line" since="1.0">
        <parameter type="ICalParser *" name="parser" annotation="in, transfer full" comment="The #ICalParser used to parse the string into the #ICalComponent"/>
        <parameter type="gchar *" name="str" annotation="nullable, transfer none" comment="A line of string representation of the #ICalComponent"/>
        <returns type="ICalComponent *" annotation="nullable, transfer full" translator_argus="(gpointer) parser" comment="The complete #ICalComponent."/>
        <comment xml:space="preserve">Add a line at one time into the #ICalParser until the parsing is complete and #ICalComponent will be returned.</comment>
    </method>
    <method name="i_cal_parser_clean" corresponds="icalparser_clean" since="1.0">
        <parameter type="ICalParser *" name="parser" comment="The parser to be cleaned and queried"/>
        <returns type="ICalComponent *" annotation="nullable, transfer full" translator_argus="(gpointer) parser" comment="The root #ICalComponent in @parser."/>
        <comment xml:space="preserve">We won't get a clean exit if some components did not have an "END" tag. Clear off any component that may be left in the list.</comment>
    </method>
    <method name="i_cal_parser_get_state" corresponds="icalparser_get_state" kind="get" since="1.0">
        <parameter type="ICalParser *" name="parser" comment="The #ICalParser to be queried"/>
        <returns type="ICalParserState" comment="The parser state stored in the #ICalParser."/>
        <comment xml:space="preserve">Gets the state of the target parser.</comment>
    </method>
    <method name="i_cal_parser_free" corresponds="icalparser_free" kind="destructor" since="1.0">
        <parameter type="ICalParser *" name="parser" comment="The #ICalParser to be freed"/>
        <comment xml:space="preserve">Frees a #ICalParser.</comment>
    </method>
    <method name="i_cal_parser_parse" corresponds="CUSTOM" since="1.0">
        <parameter type="ICalParser *" name="parser" comment="The parser used to parse the string and output the #ICalComponent"/>
        <parameter type="ICalParserLineGenFunc" name="func" annotation="scope call" comment="The function used to parse"/>
        <parameter type="gpointer" name="user_data" annotation="closure" comment="The data given to @func"/>
        <returns type="ICalComponent *" annotation="transfer full" comment="The component output by the parser."/>
        <comment xml:space="preserve">icalparser_parse takes a string that holds the text ( in RFC 2445 format ) and returns a pointer to an #ICalComponent. The caller owns the memory. @func is a pointer to a function that returns one content line per invocation.</comment>
        <custom>	g_return_val_if_fail (parser != NULL &amp;&amp; func != NULL, NULL);

	icalparser_set_gen_data ((icalparser *)i_cal_object_get_native ((ICalObject *)parser), user_data);
	return i_cal_component_new_full (icalparser_parse ((icalparser *)i_cal_object_get_native ((ICalObject *)parser), func), NULL);</custom>
    </method>
    <method name="i_cal_parser_parse_string" corresponds="icalparser_parse_string" since="1.0">
        <parameter type="const gchar *" name="str" comment="The string to be parsed"/>
        <returns type="ICalComponent *" annotation="transfer full" comment="The #ICalComponent parsed from str."/>
        <comment xml:space="preserve">Parses the string into a #ICalComponent.</comment>
    </method>
    <method name="i_cal_parser_get_line" corresponds="CUSTOM" since="1.0">
        <parameter type="ICalParser *" name="parser" comment="The parser to be queried"/>
        <parameter type="ICalParserLineGenFunc" name="func" annotation="scope call" comment="A line generator function"/>
        <parameter type="gpointer" name="user_data" annotation="closure" comment="The data given to @func"/>
        <returns type="gchar *" annotation="transfer full" comment="A single iCal content line."/>
        <comment xml:space="preserve">Given a line generator function, returns a single iCal content line.</comment>
        <custom>	g_return_val_if_fail (parser != NULL &amp;&amp; func != NULL, NULL);

	icalparser_set_gen_data ((icalparser *)i_cal_object_get_native ((ICalObject *)parser), user_data);
	return icalparser_get_line ((icalparser *)i_cal_object_get_native ((ICalObject *)parser), func);</custom>
    </method>
</structure>