> {"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")))
___
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
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
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
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()