/* Generated file (by generator) */

/*
 * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
 *
 * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "i-cal-vcard-enum-array.h"
#include "libical-glib-private.h"

G_DEFINE_TYPE (ICalVcardEnumArray, i_cal_vcard_enum_array, I_CAL_TYPE_OBJECT)

static void i_cal_vcard_enum_array_class_init (G_GNUC_UNUSED ICalVcardEnumArrayClass *klass)
{
}

static void i_cal_vcard_enum_array_init (G_GNUC_UNUSED ICalVcardEnumArray *self)
{
}

/**
 * i_cal_vcard_enum_array_new_full: (skip)
 * @native: The native libical object.
 * @owner: The parent.
 *
 * Create a new libical-glib object from the native libical object and the owner.
 *
 * Returns: (transfer full): The newly create libical-glib object.
 *
 * Since: 1.0
 **/
ICalVcardEnumArray *
i_cal_vcard_enum_array_new_full (vcardenumarray *native, 
                                 GObject *owner)
{
    ICalVcardEnumArray *object;
    if (native == NULL) {
        return NULL;
    }
    
    
    object = i_cal_object_construct (I_CAL_VCARD_TYPE_ENUM_ARRAY,
                            (gpointer) native,
                            (GDestroyNotify) icalenumarray_free,
                            FALSE,
                            owner);

    return object;
}


/**
 * i_cal_vcard_enum_array_new:
 * @increment_size: how many slots to allocate on array expansion
 *
 * Creates a new #ICalVcardEnumArray.
 *
 * Returns: (transfer full): a new #ICalVcardEnumArray.
 *
 * Since: 4.0
 *
 **/
ICalVcardEnumArray *
i_cal_vcard_enum_array_new (gint increment_size)
{
	return i_cal_vcard_enum_array_new_full (vcardenumarray_new (increment_size), NULL);
}

/**
 * i_cal_vcard_enum_array_get_value_at: (skip)
 * @array: The #ICalVcardEnumArray to be queried
 * @position: The position the target element is located
 *
 * Gets the element integer value located in the @position in the @array. Zero if position is out of bounds.
 * See also i_cal_vcard_enum_array_get_xvalue_at()
 *
 * Returns: The element integer value located at the @position in the @array
 *
 * Since: 4.0
 *
 **/
gint
i_cal_vcard_enum_array_get_value_at (ICalVcardEnumArray *array, 
                                     gint position)
{
    const vcardenumarray_element *elem;
    g_return_val_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array), 0);
    elem = vcardenumarray_element_at((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), position);
    if (elem == NULL) {
        return 0;
    }
    return elem->val;
}

/**
 * i_cal_vcard_enum_array_get_xvalue_at: (skip)
 * @array: The #ICalVcardEnumArray to be queried
 * @position: The position the target element is located
 *
 * Gets the element X value located in the @position in the @array. %NULL if position is out of bounds.
 * See also i_cal_vcard_enum_array_get_value_at().
 *
 * Returns: (transfer none) (nullable): The element X value located at the @position in the @array
 *
 * Since: 4.0
 *
 **/
const gchar *
i_cal_vcard_enum_array_get_xvalue_at (ICalVcardEnumArray *array, 
                                      gint position)
{
    const vcardenumarray_element *elem;
    g_return_val_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array), 0);
    elem = vcardenumarray_element_at((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), position);
    if (elem == NULL) {
        return 0;
    }
    return elem->xvalue;
}

/**
 * i_cal_vcard_enum_array_size:
 * @array: The #ICalVcardEnumArray
 *
 * Gets the size of the array.
 *
 * Returns: The size of current array.
 *
 * Since: 4.0
 *
 **/
gsize
i_cal_vcard_enum_array_size (ICalVcardEnumArray *array)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_ENUM_ARRAY ((ICalVcardEnumArray*)array), 0);

	return vcardenumarray_size ((vcardenumarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_vcard_enum_array_find_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @value: The integer value to search for
 *
 * Searches for an integer value in the @array. See also i_cal_vcard_enum_array_find_x_value()
 *
 * Returns: The index of the value in the @array, or an index out of bounds, if not found.
 *
 * Since: 4.0
 *
 **/
gsize
i_cal_vcard_enum_array_find_value (ICalVcardEnumArray *array, 
                                   gint value)
{
    vcardenumarray_element elem = { 0 };
    g_return_val_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array), (gsize) -1);
    elem.val = value;
    return vcardenumarray_find((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_find_x_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @xvalue: The X (custom) value to search for
 *
 * Searches for an integer value in the @array. See also i_cal_vcard_enum_array_find_value()
 *
 * Returns: The index of the value in the @array, or an index out of bounds, if not found.
 *
 * Since: 4.0
 *
 **/
gsize
i_cal_vcard_enum_array_find_x_value (ICalVcardEnumArray *array, 
                                     const gchar *xvalue)
{
    vcardenumarray_element elem = { 0 };
    g_return_val_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array), (gsize) -1);
    elem.xvalue = xvalue;
    return vcardenumarray_find((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_append_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @value: The integer value to append
 *
 * Appends an integer value to the @array. See also i_cal_vcard_enum_array_add_value(), i_cal_vcard_enum_array_append_x_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_append_value (ICalVcardEnumArray *array, 
                                     gint value)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.val = value;
    vcardenumarray_append((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_append_x_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @xvalue: The X (custom) value to append
 *
 * Appends an X (custom) value to the @array. See also i_cal_vcard_enum_array_add_x_value(), i_cal_vcard_enum_array_append_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_append_x_value (ICalVcardEnumArray *array, 
                                       const gchar *xvalue)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.xvalue = xvalue;
    vcardenumarray_append((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_add_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @value: The integer value to append
 *
 * Adds an integer value to the @array, omitting duplicates. See also i_cal_vcard_enum_array_append_value(),
 * i_cal_vcard_enum_array_add_x_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_add_value (ICalVcardEnumArray *array, 
                                  gint value)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.val = value;
    vcardenumarray_add((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_add_x_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @xvalue: The X (custom) value to append
 *
 * Adds an X (custom) value to the @array, omitting duplicates. See also i_cal_vcard_enum_array_append_x_value(),
 * i_cal_vcard_enum_array_add_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_add_x_value (ICalVcardEnumArray *array, 
                                    const gchar *xvalue)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.xvalue = xvalue;
    vcardenumarray_add((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_remove_element_at:
 * @array: The #ICalVcardEnumArray to be modified
 * @position: The position in which the element will be removed from the array
 *
 * Removes the element at the @position from the array.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_remove_element_at (ICalVcardEnumArray *array, 
                                          gsize position)
{
    g_return_if_fail (I_CAL_VCARD_IS_ENUM_ARRAY ((ICalVcardEnumArray*)array));

	vcardenumarray_remove_element_at ((vcardenumarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), position);
}

/**
 * i_cal_vcard_enum_array_remove_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @value: The integer value to remove
 *
 * Removes all occurrences of an integer value from the @array. See also i_cal_vcard_enum_array_remove_x_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_remove_value (ICalVcardEnumArray *array, 
                                     gint value)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.val = value;
    vcardenumarray_remove((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_remove_x_value: (skip)
 * @array: The #ICalVcardEnumArray
 * @xvalue: The X (custom) value to remove
 *
 * Removes all occurrences of an X (custom) value from the @array. See also i_cal_vcard_enum_array_remove_value()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_remove_x_value (ICalVcardEnumArray *array, 
                                       const gchar *xvalue)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_ENUM_ARRAY(array));
    elem.xvalue = xvalue;
    vcardenumarray_remove((vcardenumarray *)i_cal_object_get_native((ICalObject *)array), &elem);
}

/**
 * i_cal_vcard_enum_array_free: (skip)
 * @array: The #ICalVcardEnumArray to be freed
 *
 * Frees the #ICalVcardEnumArray.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_free (ICalVcardEnumArray *array)
{
    g_return_if_fail (I_CAL_VCARD_IS_ENUM_ARRAY ((ICalVcardEnumArray*)array));

	vcardenumarray_free ((vcardenumarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_vcard_enum_array_sort: (skip)
 * @array: The #ICalVcardEnumArray to be sorted
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_enum_array_sort (ICalVcardEnumArray *array)
{
    g_return_if_fail (I_CAL_VCARD_IS_ENUM_ARRAY ((ICalVcardEnumArray*)array));

	vcardenumarray_sort ((vcardenumarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_vcard_enum_array_clone:
 * @array: (in): The #ICalVcardEnumArray to be cloned
 *
 * Creates a deep copy of #ICalVcardEnumArray with the same properties as the @array.
 *
 * Returns: (transfer full): The newly cloned #ICalVcardEnumArray with the same value as the @array
 *
 * Since: 4.0
 *
 **/
ICalVcardEnumArray *
i_cal_vcard_enum_array_clone (ICalVcardEnumArray *array)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_ENUM_ARRAY ((ICalVcardEnumArray*)array), NULL);

	return i_cal_vcard_enum_array_new_full (vcardenumarray_clone ((vcardenumarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array))), NULL);
}
