Commit 635faebf authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

add get_element_type method to Gee.Iterable

2008-01-22  Juerg Billeter  <j@bitron.ch>

	* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
	  gee/iterable.vala, gee/readonlycollection.vala, gee/readonlylist.vala,
	  gee/readonlyset.vala: add get_element_type method to Gee.Iterable

svn path=/trunk/; revision=882
parent dab08557
2008-01-22 Jürg Billeter <j@bitron.ch>
* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
gee/iterable.vala, gee/readonlycollection.vala, gee/readonlylist.vala,
gee/readonlyset.vala: add get_element_type method to Gee.Iterable
2008-01-22 Jürg Billeter <j@bitron.ch>
* vapigen/valagidlparser.vala: support cheader_filename metadata
......
......@@ -2,7 +2,7 @@
*
* Copyright (C) 2004-2005 Novell, Inc
* Copyright (C) 2005 David Waite
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -46,6 +46,10 @@ public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public ArrayList (construct EqualFunc equal_func = GLib.direct_equal) {
}
public Type get_element_type () {
return typeof (G);
}
public Gee.Iterator<G> iterator () {
return new Iterator<G> (this);
}
......
......@@ -188,6 +188,10 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
public KeySet (construct HashMap! map) {
}
public Type get_element_type () {
return typeof (K);
}
public Iterator<K> iterator () {
return new KeyIterator<K,V> (_map);
}
......@@ -261,6 +265,10 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
public ValueCollection (construct HashMap! map) {
}
public Type get_element_type () {
return typeof (V);
}
public Iterator<V> iterator () {
return new ValueIterator<K,V> (_map);
}
......
......@@ -75,6 +75,10 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
return (*node != null);
}
public Type get_element_type () {
return typeof (G);
}
public Gee.Iterator<G> iterator () {
return new Iterator<G> (this);
}
......
/* iterable.vala
*
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -20,11 +20,15 @@
* Jürg Billeter <j@bitron.ch>
*/
using GLib;
/**
* Implemented by classes that support a simple iteration over instances of the
* collection.
*/
public interface Gee.Iterable<G> : GLib.Object {
public abstract Type get_element_type ();
/**
* Returns a Iterator that can be used for simple iteration over a
* collection.
......
/* readonlycollection.vala
*
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,10 @@ public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
public ReadOnlyCollection (construct Collection<G> collection = null) {
}
public Type get_element_type () {
return typeof (G);
}
public Gee.Iterator<G> iterator () {
if (_collection == null) {
return new Iterator<G> ();
......
/* readonlylist.vala
*
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,10 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
public ReadOnlyList (construct List<G> list = null) {
}
public Type get_element_type () {
return typeof (G);
}
public Gee.Iterator<G> iterator () {
if (_list == null) {
return new Iterator<G> ();
......
/* readonlyset.vala
*
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,10 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
public ReadOnlySet (construct Set<G> set = null) {
}
public Type get_element_type () {
return typeof (G);
}
public Gee.Iterator<G> iterator () {
if (_set == null) {
return new Iterator<G> ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment