JSDOC/TokenReader.js
[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 - might error out, this should be fixed upstream now
19  *
20  *    <union name="Argument" c:type="GIArgument">
21
22  * NEEDS <function name="constant_info_get_value"
23               c:identifier="g_constant_info_get_value"
24               introspectable="1">
25           <type name="Argument" c:type="GIArgument*"/>
26
27
28 g-ir-compiler /usr/share/gir-1.0/GIRepository-2.0.gir -o  /usr/lib/girepository-1.0/GIRepository-2.0.typelib 
29
30  */
31
32
33 Constant = XObject.define(
34     function(prop, memberOf, saveto, keylist) {
35           
36         this.name  =  prop.get_name();
37         var tif    = GI.constant_info_get_type(prop);
38         var ty = GI.type_tag_to_string( GI.type_info_get_tag(tif));
39         this.type  = this.typeToName(GI.constant_info_get_type(prop));
40         
41         ///this.flags =  GI.property_info_get_flags(prop),
42         
43         
44         this.value= 'UNKNOWN';
45         
46         
47         if (ty != 'interface') {
48             
49             var argm = new GI.Argument();
50             
51             GI.constant_info_get_value ( prop ,argm) 
52                 
53                 
54             if (ty != 'utf8') {
55                 this.value = argm.v_long;
56             } else {
57                 this.value = argm.v_string;
58             }
59         } 
60         
61         this.desc = NameSpace.doc(memberOf.alias + '.' + this.name)
62         
63         memberOf[saveto].push(this);
64         keylist.push(this.name);
65     },
66     Basic,
67     { }
68 );