generate gjs documentation, run under gjs
[gnome.introspection-doc-generator] / Introspect / Enum.js
1 //<script type="text/javascript">
2 //Gtk = imports.gi.Gtk;
3 const GI      = imports.gi.GIRepository;
4 const GLib    = imports.gi.GLib;
5 //xml     = imports.libxml;
6 const xml     = imports.gi.libxml2;
7
8
9
10 const XObject     = imports.XObject.XObject;
11 const console     = imports.console.console;
12
13 const NameSpace   = imports.Introspect.NameSpace.NameSpace;
14 const Base        = imports.Introspect.Base.Base;
15
16  
17   
18
19
20
21
22 var Enum = XObject.define(
23     function(ns, name) {
24         Base.call(this, ns, name);
25     },
26     Base, 
27     {
28         titleType: 'Enum',
29          _loaded : false,
30         load : function()
31         {
32             if (this._loaded) {
33                 return; // already loaded..
34             }
35             
36             this.desc = NameSpace.doc(this.alias);
37             var bi = this.getBI();
38                  
39             for(var i =0; i < GI.enum_info_get_n_values(bi); i++) {
40                
41                 var prop = GI.enum_info_get_value(bi,i);
42                  
43               
44                 this.values.push({
45                     name :  prop.get_name().toUpperCase() ,
46                     type :   GI.type_tag_to_string(GI.enum_info_get_storage_type(bi)),
47                     value:   GI.value_info_get_value(prop) ,
48                     memberOf : this.alias
49                 });
50             }
51             
52             this._loaded = true;
53              
54              
55             
56             
57         }
58 });
59
60