GType: Fix C warnings for properties in interface_init
[vala-lang.git] / gee / readonlyset.vala
blob54600dcc833f0871575d9163d38a79515d171f7d
1 /* readonlyset.vala
3 * Copyright (C) 2007-2008 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 using GLib;
25 /**
26 * Represents a read-only collection of items without duplicates.
28 public class Gee.ReadOnlySet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
29 public int size {
30 get { return _set.size; }
33 public Set<G> set {
34 set { _set = value; }
37 private Set<G> _set;
39 public ReadOnlySet (Set<G>? set = null) {
40 this.set = set;
43 public Type get_element_type () {
44 return typeof (G);
47 public Gee.Iterator<G> iterator () {
48 if (_set == null) {
49 return new Iterator<G> ();
52 return _set.iterator ();
55 public bool contains (G item) {
56 if (_set == null) {
57 return false;
60 return _set.contains (item);
63 public bool add (G item) {
64 assert_not_reached ();
67 public bool remove (G item) {
68 assert_not_reached ();
71 public void clear () {
72 assert_not_reached ();
75 private class Iterator<G> : CollectionObject, Gee.Iterator<G> {
76 public bool next () {
77 return false;
80 public G? get () {
81 return null;