<!--
  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 <http://www.gnu.org/licenses/>.
-->
<structure namespace="ICal" name="Value" native="icalvalue" destroy_func="icalvalue_free" includes="string.h">
    <method name="i_cal_value_new" corresponds="icalvalue_new" kind="constructor" since="1.0">
        <parameter type="ICalValueKind" name="kind" comment="A #ICalValueKind"/>
        <returns type="ICalValue *" annotation="transfer full" comment="The newly created #ICalValue."/>
        <comment xml:space="preserve">Create a new #ICalValue with specific kind.</comment>
    </method>
    <method name="i_cal_value_new_clone" corresponds="icalvalue_new_clone" kind="clone" since="1.0">
        <parameter type="const ICalValue *" name="value" comment="The #ICalValue to be cloned."/>
        <returns type="ICalValue *" annotation="transfer full" comment="The newly created #ICalValue with the same property as @value."/>
        <comment xml:space="preserve">Deeply clone a #ICalValue.</comment>
    </method>
    <method name="i_cal_value_new_from_string" corresponds="icalvalue_new_from_string" kind="constructor" since="1.0">
        <parameter type="ICalValueKind" name="kind" comment="A #ICalValueKind"/>
        <parameter type="const gchar *" name="str" comment="A string."/>
        <returns type="ICalValue *" annotation="transfer full" comment="The newly created #ICalValue based on the @kind and @str."/>
        <comment xml:space="preserve">Create a new #ICalValue based on the #ICalValueKind and a string.</comment>
    </method>
    <method name="i_cal_value_free" corresponds="icalvalue_free" annotation="skip" kind="destructor" since="1.0">
        <parameter type="ICalValue *" name="value" comment="The #ICalValue to be freed."/>
        <comment xml:space="preserve">Free a #ICalValue.</comment>
    </method>
    <method name="i_cal_value_is_valid" corresponds="icalvalue_is_valid" since="1.0">
        <parameter type="const ICalValue *" name="value" comment="The #ICalValue to be checked."/>
        <returns type="gint" comment="1 if valid, 0 if not."/>
        <comment xml:space="preserve">Check if #ICalValue is valid.</comment>
    </method>
    <method name="i_cal_value_as_ical_string_r" corresponds="icalvalue_as_ical_string_r" since="1.0">
        <parameter type="const ICalValue *" name="value" comment="A #ICalValue."/>
        <returns type="gchar *" annotation="transfer full" comment="The string representation."/>
        <comment xml:space="preserve">Convert the #ICalValue to a string.</comment>
    </method>
    <method name="i_cal_value_isa" corresponds="icalvalue_isa" since="1.0">
        <parameter type="const ICalValue *" name="value" comment="A #ICalValue."/>
        <returns type="ICalValueKind" comment="The kind of @value."/>
        <comment xml:space="preserve">Get the kind of #ICalValue.</comment>
    </method>
    <method name="i_cal_value_isa_value" corresponds="icalvalue_isa_value" since="1.0">
        <parameter type="ICalValue *" name="value" comment="A #ICalValue"/>
        <returns type="gint" comment="1 if yes, 0 if not."/>
        <comment xml:space="preserve">Check whether the native part of #ICalValue is an icalvalue</comment>
    </method>
    <method name="i_cal_value_compare" corresponds="icalvalue_compare" since="1.0">
        <parameter type="const ICalValue *" name="a" comment="A #ICalValue."/>
        <parameter type="const ICalValue *" name="b" comment="A #ICalValue."/>
        <returns type="ICalParameterXliccomparetype" comment="The compare result."/>
        <comment xml:space="preserve">Compare two #ICalValue.</comment>
    </method>
    <method name="i_cal_value_string_to_kind" corresponds="icalvalue_string_to_kind" since="1.0">
        <parameter type="const gchar *" name="str" comment="A string."/>
        <returns type="ICalValueKind" comment="A #ICalValueKind."/>
        <comment xml:space="preserve">Convert a string to #ICalValueKind.</comment>
    </method>
    <method name="i_cal_value_kind_to_string" corresponds="icalvalue_kind_to_string" since="1.0">
        <parameter type="const ICalValueKind" name="kind" comment="A #ICalValueKind."/>
        <returns type="const gchar *" comment="The string representation of #ICalValueKind."/>
        <comment xml:space="preserve">Convert the #ICalValueKind to a string.</comment>
    </method>
    <method name="i_cal_value_kind_is_valid" corresponds="icalvalue_kind_is_valid" since="1.0">
        <parameter type="const ICalValueKind" name="kind" comment="The #ICalValueKind to be checked."/>
        <returns type="gint" comment="1 if yes, 0 if not."/>
        <comment xml:space="preserve">Check whether the #ICalValueKind is valid.</comment>
    </method>
    <method name="i_cal_value_encode_ical_string" corresponds="CUSTOM" since="1.0">
        <parameter type="const gchar *" name="szText" comment="A string."/>
        <returns type="gchar *" annotation="allow-none, transfer full" comment="The encoded string. NULL if fail."/>
        <comment xml:space="preserve">Encode a character string in ical format, escape certain characters, etc.</comment>
        <custom>	gchar *szEncText;
	gchar *buffer;
	gint result;

	g_return_val_if_fail (szText != NULL, 0);

	szEncText = g_new (gchar, 2 * strlen (szText) + 1);
	result = icalvalue_encode_ical_string (szText, szEncText, 2*strlen (szText)-1);
	if (result == 0) {
		g_free (szEncText);
		return NULL;
	} else {
		buffer = g_strdup (szEncText);
		g_free (szEncText);
		return buffer;
	}</custom>
    </method>
    <method name="i_cal_value_decode_ical_string" corresponds="CUSTOM" since="1.0">
        <parameter type="const gchar *" name="szText" comment="A string."/>
        <returns type="gchar *" annotation="allow-none, transfer full" comment="The decoded string. NULL if fail."/>
        <comment xml:space="preserve">Extract the original character string encoded by the above function</comment>
        <custom>	gchar *szDecText;
	gchar *buffer;
	gint result;
	g_return_val_if_fail (szText != NULL, 0);
	szDecText = g_new (gchar, strlen (szText));

	result = icalvalue_decode_ical_string (szText, szDecText, strlen (szText)-1);
	if (result == 0) {
		g_free (szDecText);
		return NULL;
	} else {
		buffer = g_strdup (szDecText);
		g_free (szDecText);
		return buffer;
	}</custom>
    </method>
</structure>
