GIR writer: Generate property's cannonical name instead of name
[vala-lang.git] / gee / readonlylist.vala
blobd03eb4d7e6a8c3603e76cd542a37856b97aeb388
1 /* readonlylist.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 in a well-defined order.
28 public class Gee.ReadOnlyList<G> : CollectionObject, Iterable<G>, Collection<G>, List<G> {
29 public int size {
30 get { return _list.size; }
33 public List<G> list {
34 set { _list = value; }
37 private List<G> _list;
39 public ReadOnlyList (List<G>? list = null) {
40 this.list = list;
43 public Type get_element_type () {
44 return typeof (G);
47 public Gee.Iterator<G> iterator () {
48 if (_list == null) {
49 return new Iterator<G> ();
52 return _list.iterator ();
55 public bool contains (G item) {
56 if (_list == null) {
57 return false;
60 return _list.contains (item);
63 public int index_of (G item) {
64 if (_list == null) {
65 return -1;
68 return _list.index_of (item);
71 public bool add (G item) {
72 assert_not_reached ();
75 public bool remove (G item) {
76 assert_not_reached ();
79 public void insert (int index, G item) {
80 assert_not_reached ();
83 public void remove_at (int index) {
84 assert_not_reached ();
87 public G? get (int index) {
88 if (_list == null) {
89 return null;
92 return _list.get (index);
95 public void set (int index, G o) {
96 assert_not_reached ();
99 public void clear () {
100 assert_not_reached ();
103 class Iterator<G> : CollectionObject, Gee.Iterator<G> {
104 public bool next () {
105 return false;
108 public G? get () {
109 return null;