Hi,

I'm not sure if that's what you need - but since vala uses glib internaly (of 
course unless you use that new profile..), why don't you just use this: 
http://valadoc.org/glib-2.0/GLib.KeyFile.html ?

I use it a lot when I need just a couple of key=value items and when things get 
complicated, I go for JSON or XML.

Jan Spurny

> ------------ Původní zpráva ------------
> Od: Chris Elston <[email protected]>
> Předmět: [Vala] Help me find the right Vala idiom
> Datum: 05.3.2012 15:22:04
> ----------------------------------------
> Hello list,
> 
> I have a pattern I commonly use in C which I've so far failed to
> translate to an equivalent Vala or indeed OO equivalent.  I was hoping
> that those more used to thinking in such terms would be able to point me
> in the right direction.
> 
> Attached is a C file which (dumbly) parses a config file with entries of
> the format:
> 
>       key=value
> 
> Where a given key is uniquely associated with a particular type of data
> (string, int etc...)
> 
> My aim is to parse the config file data into appropriately typed
> variables, but to do so using a table based lookup on the key to find
> the appropriate function to parse the data and the address of the
> location to place the data.
> 
> Hopefully the C is clear enough, I apologise for posting C to this list,
> but I'm not confident enough of my terminology to communicate the ideas
> in Vala.
> 
> I'm looking to produce a Vala class which is able to parse <some text
> data> into it's own member variables, based on a table lookup. The
> important bit for me isn't the parsing, it's the lookup from key to
> parse function and destination for the data.
> 
> Suggestions gratefully received!
> 
> Many thanks,
> 
> Chris.
> 
> 
> 
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to