157d650bb14f4354f37d4f06efc725742a7df1d1
[gnome.introspection-doc-generator] / Introspect / Constant.js
1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 GI      = imports.gi.GIRepository;
4 GLib    = imports.gi.GLib;
5 xml     = imports.libxml;
6
7
8 XObject     = imports.XObject.XObject;
9 console     = imports.console.console;
10 NameSpace   = imports.NameSpace.NameSpace;
11
12 Basic        = imports.Basic.Basic;
13
14  
15  
16
17 /**
18  * Constant
19  *
20  * NEEDS <function name="constant_info_get_value"
21               c:identifier="g_constant_info_get_value"
22               introspectable="1">
23
24  */
25
26
27 Constant = XObject.define(
28     function(prop, memberOf, saveto, keylist) {
29           
30         this.name  =  prop.get_name();
31         var tif    = GI.constant_info_get_type(prop);
32         var ty = GI.type_tag_to_string( GI.type_info_get_tag(tif));
33         this.type  = this.typeToName(GI.constant_info_get_type(prop));
34         
35         ///this.flags =  GI.property_info_get_flags(prop),
36         
37         
38         this.value= 'UNKNOWN';
39         
40         
41         if (ty != 'interface') {
42             
43             var argm = new GI._Argument();
44             GI.constant_info_get_value ?
45                 GI.constant_info_get_value ( prop ,argm) :
46                 prop.get_value(argm);
47                 
48             if (ty != 'utf8') {
49                 this.value = argm.v_long;
50             } else {
51                 this.value = argm.v_string;
52             }
53         } 
54         
55         this.desc = NameSpace.doc(memberOf.alias + '.' + this.name)
56         
57         memberOf[saveto].push(this);
58         keylist.push(this.name);
59     },
60     Basic,
61     { }
62 );