Re-arrange files, add support for classic JS Documentor, and packer
[gnome.introspection-doc-generator] / Introspect / Constant.js
diff --git a/Introspect/Constant.js b/Introspect/Constant.js
new file mode 100644 (file)
index 0000000..bad3f6d
--- /dev/null
@@ -0,0 +1,54 @@
+//<script type="text/javascript">
+//Gtk = imports.gi.Gtk;
+GI      = imports.gi.GIRepository;
+GLib    = imports.gi.GLib;
+xml     = imports.libxml;
+
+
+XObject     = imports.XObject.XObject;
+console     = imports.console.console;
+NameSpace   = imports.NameSpace.NameSpace;
+
+Basic        = imports.Basic.Basic;
+
+
+/**
+ * Constant
+ */
+
+
+Constant = XObject.define(
+    function(prop, memberOf, saveto, keylist) {
+          
+        this.name  =  GI.base_info_get_name(prop);
+        var tif    = GI.constant_info_get_type(prop);
+        var ty = GI.type_tag_to_string( GI.type_info_get_tag(tif));
+        this.type  = this.typeToName(GI.constant_info_get_type(prop));
+        
+        ///this.flags =  GI.property_info_get_flags(prop),
+        
+        
+        this.value= 'UNKNOWN';
+        
+        
+        if (ty != 'interface') {
+            
+            var argm = new GI.Argument();
+            GI.constant_info_get_value ( prop ,argm);
+            if (ty != 'utf8') {
+                this.value = argm.v_long;
+            } else {
+                this.value = argm.v_string;
+            }
+        } 
+        
+        this.desc = NameSpace.doc(memberOf.alias + '.' + this.name)
+        
+        memberOf[saveto].push(this);
+        keylist.push(this.name);
+    },
+    Basic,
+    { }
+);