[Vala] GValue get type



Hello All.

I trying to work with collections of (G)Values
and faced a problem. Sometimes i need to get type
of object in referenced by Value.

------------------------------------------
using Gee;

Value v = "hello";

var hash = new HashMap<string, Value?>();

hash["one"]   = 1;
hash["two"]   = "two";

int counter = 0;

foreach (var e in hash.entries) {
        // THIS IS PSEUDOCODE
        if (e.value.type == typeof(int)) {
                counter += e.value;
        }
}
------------------------------------------

How can i do it?


--
http://antono.info/
http://github.com/antono



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]