From: Juerg Billeter Date: Tue, 22 Jan 2008 13:18:05 +0000 (+0000) Subject: add get_element_type method to Gee.Iterable X-Git-Tag: VALA_0_1_7~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=635faebfffee0f3edad72ae6bd85ab5318567f13;p=thirdparty%2Fvala.git add get_element_type method to Gee.Iterable 2008-01-22 Juerg Billeter * 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 --- diff --git a/ChangeLog b/ChangeLog index 53a3e133e..4faf959ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-22 Jürg Billeter + + * 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 * vapigen/valagidlparser.vala: support cheader_filename metadata diff --git a/gee/arraylist.vala b/gee/arraylist.vala index b5e83da65..4a49b48e2 100644 --- a/gee/arraylist.vala +++ b/gee/arraylist.vala @@ -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 : Object, Iterable, Collection, List { public ArrayList (construct EqualFunc equal_func = GLib.direct_equal) { } + public Type get_element_type () { + return typeof (G); + } + public Gee.Iterator iterator () { return new Iterator (this); } diff --git a/gee/hashmap.vala b/gee/hashmap.vala index 2de53250f..c6cd0f940 100644 --- a/gee/hashmap.vala +++ b/gee/hashmap.vala @@ -188,6 +188,10 @@ public class Gee.HashMap : Object, Map { public KeySet (construct HashMap! map) { } + public Type get_element_type () { + return typeof (K); + } + public Iterator iterator () { return new KeyIterator (_map); } @@ -261,6 +265,10 @@ public class Gee.HashMap : Object, Map { public ValueCollection (construct HashMap! map) { } + public Type get_element_type () { + return typeof (V); + } + public Iterator iterator () { return new ValueIterator (_map); } diff --git a/gee/hashset.vala b/gee/hashset.vala index ad076bd4f..afa674d1d 100644 --- a/gee/hashset.vala +++ b/gee/hashset.vala @@ -75,6 +75,10 @@ public class Gee.HashSet : Object, Iterable, Collection, Set { return (*node != null); } + public Type get_element_type () { + return typeof (G); + } + public Gee.Iterator iterator () { return new Iterator (this); } diff --git a/gee/iterable.vala b/gee/iterable.vala index 2b9176df6..ca13109c2 100644 --- a/gee/iterable.vala +++ b/gee/iterable.vala @@ -1,6 +1,6 @@ /* 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 */ +using GLib; + /** * Implemented by classes that support a simple iteration over instances of the * collection. */ public interface Gee.Iterable : GLib.Object { + public abstract Type get_element_type (); + /** * Returns a Iterator that can be used for simple iteration over a * collection. diff --git a/gee/readonlycollection.vala b/gee/readonlycollection.vala index ecf900293..eaee2b0e0 100644 --- a/gee/readonlycollection.vala +++ b/gee/readonlycollection.vala @@ -1,6 +1,6 @@ /* 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 : Object, Iterable, Collection { public ReadOnlyCollection (construct Collection collection = null) { } + public Type get_element_type () { + return typeof (G); + } + public Gee.Iterator iterator () { if (_collection == null) { return new Iterator (); diff --git a/gee/readonlylist.vala b/gee/readonlylist.vala index 4f8741f5f..a7b187a28 100644 --- a/gee/readonlylist.vala +++ b/gee/readonlylist.vala @@ -1,6 +1,6 @@ /* 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 : Object, Iterable, Collection, List { public ReadOnlyList (construct List list = null) { } + public Type get_element_type () { + return typeof (G); + } + public Gee.Iterator iterator () { if (_list == null) { return new Iterator (); diff --git a/gee/readonlyset.vala b/gee/readonlyset.vala index edd8a06f8..492ec80b4 100644 --- a/gee/readonlyset.vala +++ b/gee/readonlyset.vala @@ -1,6 +1,6 @@ /* 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 : Object, Iterable, Collection, Set { public ReadOnlySet (construct Set set = null) { } + public Type get_element_type () { + return typeof (G); + } + public Gee.Iterator iterator () { if (_set == null) { return new Iterator ();