/* 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-str-array.h"
#include "libical-glib-private.h"

G_DEFINE_TYPE (ICalStrArray, i_cal_str_array, I_CAL_TYPE_OBJECT)

static void i_cal_str_array_class_init (G_GNUC_UNUSED ICalStrArrayClass *klass)
{
}

static void i_cal_str_array_init (G_GNUC_UNUSED ICalStrArray *self)
{
}

/**
 * i_cal_str_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
 **/
ICalStrArray *
i_cal_str_array_new_full (icalstrarray *native, 
                          GObject *owner)
{
    ICalStrArray *object;
    if (native == NULL) {
        return NULL;
    }
    
    
    object = i_cal_object_construct (I_CAL_TYPE_STR_ARRAY,
                            (gpointer) native,
                            (GDestroyNotify) icalstrarray_free,
                            FALSE,
                            owner);

    return object;
}


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

/**
 * i_cal_str_array_get_element_at: (skip)
 * @array: The #ICalStrArray to be queried
 * @position: The position the target element is located
 *
 * Gets the element located in the @position in the @array. NULL if position if out of bound.
 *
 * Returns: (transfer none) (nullable): The element located at the @position in the @array
 *
 * Since: 4.0
 *
 **/
const gchar *
i_cal_str_array_get_element_at (ICalStrArray *array, 
                                gsize position)
{
    g_return_val_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array), NULL);

	return icalstrarray_element_at ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), position);
}

/**
 * i_cal_str_array_size:
 * @array: The #ICalStrArray
 *
 * Gets the size of the array.
 *
 * Returns: The size of current array.
 *
 * Since: 4.0
 *
 **/
gsize
i_cal_str_array_size (ICalStrArray *array)
{
    g_return_val_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array), ((gsize)-1));

	return icalstrarray_size ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_str_array_find: (skip)
 * @array: The #ICalStrArray
 * @value: The value to search for
 *
 * Searches for a value in the @array and returns its first index.
 *
 * Returns: The index of the value in the @array, or an index out of bounds, if not found.
 *
 * Since: 4.0
 *
 **/
gsize
i_cal_str_array_find (ICalStrArray *array, 
                      const gchar *value)
{
    g_return_val_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array), ((gsize)-1));
    g_return_val_if_fail (value != NULL, ((gsize)-1));

	return icalstrarray_find ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

/**
 * i_cal_str_array_append: (skip)
 * @array: The #ICalStrArray
 * @value: The value to append
 *
 * Appends the @value into the @array, not checking for duplicates. See also i_cal_str_array_add().
 *
 * Since: 4.0
 *
 **/
void
i_cal_str_array_append (ICalStrArray *array, 
                        const gchar *value)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));
    g_return_if_fail (value != NULL);

	icalstrarray_append ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

/**
 * i_cal_str_array_add: (skip)
 * @array: The #ICalStrArray
 * @value: The value to add
 *
 * Adds the @value into the @array, omitting duplicates. See also i_cal_str_array_append().
 *
 * Since: 4.0
 *
 **/
void
i_cal_str_array_add (ICalStrArray *array, 
                     const gchar *value)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));
    g_return_if_fail (value != NULL);

	icalstrarray_add ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

/**
 * i_cal_str_array_remove_element_at:
 * @array: The #ICalStrArray 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_str_array_remove_element_at (ICalStrArray *array, 
                                   gsize position)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));

	icalstrarray_remove_element_at ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), position);
}

/**
 * i_cal_str_array_remove:
 * @array: The #ICalStrArray to be modified
 * @value: The value to remove.
 *
 * Removes all the occurrences of the @value in the @array.
 *
 * Since: 4.0
 *
 **/
void
i_cal_str_array_remove (ICalStrArray *array, 
                        const gchar *value)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));
    g_return_if_fail (value != NULL);

	icalstrarray_remove ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

/**
 * i_cal_str_array_free: (skip)
 * @array: The #ICalStrArray to be freed
 *
 * Frees the #ICalStrArray.
 *
 * Since: 4.0
 *
 **/
void
i_cal_str_array_free (ICalStrArray *array)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));

	icalstrarray_free ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_str_array_sort: (skip)
 * @array: The #ICalStrArray to be sorted
 *
 * Since: 4.0
 *
 **/
void
i_cal_str_array_sort (ICalStrArray *array)
{
    g_return_if_fail (I_CAL_IS_STR_ARRAY ((ICalStrArray*)array));

	icalstrarray_sort ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

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

	return i_cal_str_array_new_full (icalstrarray_clone ((icalstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array))), NULL);
}
