On  Sun, 14 Apr 2013 20:50:07 +0001, Alex Stefan Kaye <noxdeleo googlemail 
com> wrote:> I'm wondering if/how I can use dicts and lists in class 
properties, for example: 
> prop private channel_map:dict of string,list of Gst.ChannelPosition 
I remember having a similar problem in the one Genie program I've written so 
far.
I don't have an exact solution, but found this worked for an array of strings:

class log_hit : Object
    _fields : array of string[]
    prop readonly ip_address : string
        get
            return _fields[1]
    construct ( )
        _fields = new array of string[10]

I found using the _variable_name overcame what is probably a memory corruption 
bug 
when I used prop private. Then creating the actual array when the object is 
constructed
works for an array of strings.

So you could try something along the lines of:
class my_class : Object
    _channel_map : dict of string, Gst.ChannelPosition
    construct()
        _channel_map = new dict of string, Gst.ChannelPosition

If this inspires you to find a solution let us know!

Also some references on dicts and list:
http://bkhome.org/genie/datatypes.htm
https://live.gnome.org/Genie#Dicts
http://manualgenie.blogspot.co.uk/search/label/03.1%20Listas%20complejas.%20Lista%20de%20objetos.

Good luck,

Al
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to