Re: [Vala] jSON parser

2012-03-14 Thread Denis Kuzmenok
> {"data":50.65} // jSON > stdout.printf ("data: %d\n", root_object.get_int_member ("data")); > // dont work! > I cant control the value. ¿How get variant type data? Try: stdout.printf ("data: %d\n", int.parse (root_object.get_double_member ("data"))) ___

[Vala] jSON parser

2012-03-14 Thread Luis L. Rodríguez Oro
in this examples Im parse a JSON: {"data":50} // JSON var parser = new Json.Parser (); parser.load_from_file ("cuota.json"); var root_object = parser.get_root ().get_object (); stdout.printf ("data: %d\n", root_object.get_int_member ("data")); // work perfect! {"data":50.65} // jSON stdou

Re: [Vala] How to refer current class in class method like "this" in instance method?

2012-03-14 Thread Derek Dai
Thanks Dionisi, but typeof(TypeName) only return a fixed type id, but class or type id get from an instance vary. For example void print_type_id(Object o) { message("%s, %p", o.get_type().name(), o.get_class()); } print_type_id(new Gtk.Button()); print_type_id(new Gtk.Box()); Derek Dai On

Re: [Vala] How to refer current class in class method like "this" in instance method?

2012-03-14 Thread Luca Dionisi
Type t = typeof(Foo); On Wed, Mar 14, 2012 at 10:47 AM, Derek Dai wrote: > In vala, before you can invoke a class method, you need an instance. Valac > generated C code will get class from instance and pass it in class method > as first argument. > > For example, > class Foo > { >    public class

[Vala] How to refer current class in class method like "this" in instance method?

2012-03-14 Thread Derek Dai
In vala, before you can invoke a class method, you need an instance. Valac generated C code will get class from instance and pass it in class method as first argument. For example, class Foo { public class void bar() { } } If we invoke bar() like vala code below var foo = new Foo(); foo.bar()