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

G_DEFINE_TYPE (ICalVcardStrArray, i_cal_vcard_str_array, I_CAL_TYPE_OBJECT)

static void i_cal_vcard_str_array_class_init (G_GNUC_UNUSED ICalVcardStrArrayClass *klass)
{
}

static void i_cal_vcard_str_array_init (G_GNUC_UNUSED ICalVcardStrArray *self)
{
}

/**
 * i_cal_vcard_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
 **/
ICalVcardStrArray *
i_cal_vcard_str_array_new_full (vcardstrarray *native, 
                                GObject *owner)
{
    ICalVcardStrArray *object;
    if (native == NULL) {
        return NULL;
    }
    
    
    object = i_cal_object_construct (I_CAL_VCARD_TYPE_STR_ARRAY,
                            (gpointer) native,
                            (GDestroyNotify) icalstrarray_free,
                            FALSE,
                            owner);

    return object;
}


/**
 * i_cal_vcard_str_array_new:
 * @increment_size: How many items preallocate in advance
 *
 * Creates a new #ICalVcardStrArray.
 *
 * Returns: (transfer full): The newly created #ICalVcardStrArray
 *
 * Since: 4.0
 *
 **/
ICalVcardStrArray *
i_cal_vcard_str_array_new (gint increment_size)
{
	return i_cal_vcard_str_array_new_full (vcardstrarray_new (increment_size), NULL);
}

/**
 * i_cal_vcard_str_array_get_element_at: (skip)
 * @array: The #ICalVcardStrArray 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_vcard_str_array_get_element_at (ICalVcardStrArray *array, 
                                      gsize position)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_STR_ARRAY ((ICalVcardStrArray*)array), NULL);

	return vcardstrarray_element_at ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), position);
}

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

	return vcardstrarray_size ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_vcard_str_array_find: (skip)
 * @array: The #ICalVcardStrArray
 * @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_vcard_str_array_find (ICalVcardStrArray *array, 
                            const gchar *value)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_STR_ARRAY ((ICalVcardStrArray*)array), ((gsize)-1));
    g_return_val_if_fail (value != NULL, ((gsize)-1));

	return vcardstrarray_find ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

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

	vcardstrarray_append ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

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

	vcardstrarray_add ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

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

	vcardstrarray_remove_element_at ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), position);
}

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

	vcardstrarray_remove ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)), value);
}

/**
 * i_cal_vcard_str_array_free: (skip)
 * @array: The #ICalVcardStrArray to be freed
 *
 * Frees the #ICalVcardStrArray.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_str_array_free (ICalVcardStrArray *array)
{
    g_return_if_fail (I_CAL_VCARD_IS_STR_ARRAY ((ICalVcardStrArray*)array));

	vcardstrarray_free ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

/**
 * i_cal_vcard_str_array_sort: (skip)
 * @array: The #ICalVcardStrArray to be sorted
 *
 * Sorts the @array.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_str_array_sort (ICalVcardStrArray *array)
{
    g_return_if_fail (I_CAL_VCARD_IS_STR_ARRAY ((ICalVcardStrArray*)array));

	vcardstrarray_sort ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array)));
}

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

	return i_cal_vcard_str_array_new_full (vcardstrarray_clone ((vcardstrarray *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)array))), NULL);
}
