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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
/* multiset.c generated by valac 0.56.17, the Vala compiler
* generated from multiset.vala, do not modify */
/* multiset.vala
*
* Copyright (C) 2009 Ali Sabil
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Ali Sabil <ali.sabil@gmail.com>
*/
#include "gee.h"
#include <glib-object.h>
#include <glib.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ())
#define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection))
#define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
#define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION))
#define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION))
#define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection;
typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass;
#define GEE_TYPE_READ_ONLY_MULTI_SET (gee_read_only_multi_set_get_type ())
#define GEE_READ_ONLY_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_MULTI_SET, GeeReadOnlyMultiSet))
#define GEE_READ_ONLY_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_MULTI_SET, GeeReadOnlyMultiSetClass))
#define GEE_IS_READ_ONLY_MULTI_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_MULTI_SET))
#define GEE_IS_READ_ONLY_MULTI_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_MULTI_SET))
#define GEE_READ_ONLY_MULTI_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_MULTI_SET, GeeReadOnlyMultiSetClass))
typedef struct _GeeReadOnlyMultiSet GeeReadOnlyMultiSet;
typedef struct _GeeReadOnlyMultiSetClass GeeReadOnlyMultiSetClass;
G_GNUC_INTERNAL GeeReadOnlyMultiSet* gee_read_only_multi_set_new (GType g_type,
GBoxedCopyFunc g_dup_func,
GDestroyNotify g_destroy_func,
GeeMultiSet* multiset);
G_GNUC_INTERNAL GeeReadOnlyMultiSet* gee_read_only_multi_set_construct (GType object_type,
GType g_type,
GBoxedCopyFunc g_dup_func,
GDestroyNotify g_destroy_func,
GeeMultiSet* multiset);
G_GNUC_INTERNAL GType gee_read_only_collection_get_type (void) G_GNUC_CONST G_GNUC_UNUSED ;
G_GNUC_INTERNAL GType gee_read_only_multi_set_get_type (void) G_GNUC_CONST G_GNUC_UNUSED ;
static GType gee_multi_set_get_type_once (void);
/**
* Returns the number of occurrences of an item in this multiset.
*
* @param item the item to count occurrences of
*
* @return the number of occurrences of the item in this multiset.
*/
gint
gee_multi_set_count (GeeMultiSet* self,
gconstpointer item)
{
GeeMultiSetIface* _iface_;
g_return_val_if_fail (self != NULL, 0);
_iface_ = GEE_MULTI_SET_GET_INTERFACE (self);
if (_iface_->count) {
return _iface_->count (self, item);
}
return -1;
}
/**
* Returns an immutable empty set.
*
* @return an immutable empty set
*/
GeeSet*
gee_multi_set_empty (GType g_type,
GBoxedCopyFunc g_dup_func,
GDestroyNotify g_destroy_func)
{
GeeHashSet* _tmp0_;
GeeHashSet* _tmp1_;
GeeSet* _tmp2_;
GeeSet* _tmp3_;
GeeSet* _tmp4_;
GeeSet* result;
_tmp0_ = gee_hash_set_new (g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func, NULL, NULL, NULL, NULL, NULL, NULL);
_tmp1_ = _tmp0_;
_tmp2_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) _tmp1_);
_tmp3_ = _tmp2_;
_tmp4_ = _tmp3_;
_g_object_unref0 (_tmp1_);
result = _tmp4_;
return result;
}
GeeMultiSet*
gee_multi_set_get_read_only_view (GeeMultiSet* self)
{
GeeMultiSetIface* _iface_;
g_return_val_if_fail (self != NULL, NULL);
_iface_ = GEE_MULTI_SET_GET_INTERFACE (self);
if (_iface_->get_read_only_view) {
return _iface_->get_read_only_view (self);
}
return NULL;
}
static GeeMultiSet*
gee_multi_set_real_get_read_only_view (GeeMultiSet* base)
{
GeeMultiSet* result;
GeeMultiSet* self;
GeeReadOnlyMultiSet* _tmp0_;
self = base;
_tmp0_ = gee_read_only_multi_set_new (GEE_MULTI_SET_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_MULTI_SET_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_MULTI_SET_GET_INTERFACE (self)->get_g_destroy_func (self), self);
result = (GeeMultiSet*) _tmp0_;
return result;
}
static void
gee_multi_set_default_init (GeeMultiSetIface * iface,
gpointer iface_data)
{
iface->get_read_only_view = gee_multi_set_real_get_read_only_view;
}
/**
* A collection with duplicate elements.
*/
static GType
gee_multi_set_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (GeeMultiSetIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_multi_set_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
GType gee_multi_set_type_id;
gee_multi_set_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeMultiSet", &g_define_type_info, 0);
g_type_interface_add_prerequisite (gee_multi_set_type_id, GEE_TYPE_COLLECTION);
return gee_multi_set_type_id;
}
GType
gee_multi_set_get_type (void)
{
static volatile gsize gee_multi_set_type_id__once = 0;
if (g_once_init_enter (&gee_multi_set_type_id__once)) {
GType gee_multi_set_type_id;
gee_multi_set_type_id = gee_multi_set_get_type_once ();
g_once_init_leave (&gee_multi_set_type_id__once, gee_multi_set_type_id);
}
return gee_multi_set_type_id__once;
}
|