Update Changelog
[profile/ivi/libgee.git] / gee / abstractset.vala
1 /* abstractset.vala
2  *
3  * Copyright (C) 2007  Jürg Billeter
4  * Copyright (C) 2009  Didier Villevalois
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19  *
20  * Author:
21  *      Julien Peeters <contact@julienpeeters.fr>
22  */
23
24 /**
25  * Skeletal implementation of the {@link Set} interface.
26  *
27  * Contains common code shared by all set implementations.
28  *
29  * @see HashSet
30  * @see TreeSet
31  */
32 public abstract class Gee.AbstractSet<G> : Gee.AbstractCollection<G>, Set<G> {
33
34         private weak Set<G> _read_only_view;
35
36         /**
37          * {@inheritDoc}
38          */
39         public virtual new Set<G> read_only_view {
40                 owned get {
41                         Set<G> instance = _read_only_view;
42                         if (_read_only_view == null) {
43                                 instance = new ReadOnlySet<G> (this);
44                                 _read_only_view = instance;
45                                 instance.add_weak_pointer ((void**) (&_read_only_view));
46                         }
47                         return instance;
48                 }
49         }
50
51         // Future-proofing
52         internal new virtual void reserved0() {}
53         internal new virtual void reserved1() {}
54         internal new virtual void reserved2() {}
55         internal new virtual void reserved3() {}
56         internal new virtual void reserved4() {}
57         internal new virtual void reserved5() {}
58         internal new virtual void reserved6() {}
59         internal new virtual void reserved7() {}
60         internal new virtual void reserved8() {}
61         internal new virtual void reserved9() {}
62 }