More commits to sync working copy
[gnome.introspection-doc-generator] / JSDOC / Introspect / Method.js
index 7014fef..5c51d6c 100644 (file)
 //<script type="text/javascript">
-//Gtk = imports.gi.Gtk;
+
 GI      = imports.gi.GIRepository;
-GLib    = imports.gi.GLib;
-xml     = imports.libxml;
-//GObject = imports.gi.GObject;
+
+
+imports['Object.js'].load(Object);
 
 console = imports['console.js'].console;
 JSDOC   = imports['JSDOC.js'].JSDOC;
-Roo     = imports['Roo.js'].Roo;
-
 
 Introspect = imports['JSDOC/Introspect.js'].Introspect;
 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
 /**
- * Methods, functiosn or consturctors
+ * Methods, functions or consturctors
  */
 
 
 
 
-Method = function(m, memberOf, saveto, keylist) {
-    this.propertyType  = 'Method';
-    
-    var flags = GI.function_info_get_flags (m);
-    var n = GI.base_info_get_name(m);
-    var n_original = n + '';
-    // posibly add: sink, 
-    if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
-        return false; // skip these!
-    }
-    
-    if (n == 'new') {
-        n = 'c_new';
-    }
-
-    
-    var retval = [ { 
-            name : 0, 
-            type :  this.typeToName(GI.callable_info_get_return_type(m)),
-            desc : Introspect.doc(memberOf.alias + '.' + n_original + '.return-value')
-    } ];
-    
-    
-    
-    var args = this.argsToArrays(m, retval);
-    
-    
-    if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
-        
-        memberOf.constructors[0].doc = Introspect.doc(memberOf.alias + '.' + n_original);
-        
-        return false; // skip.
-    }
-    
-
-    
-    
-    
-    //console.log(GI.base_info_get_name(m));
-   // console.dump(GI.base_info_get_attribute(m, 'doc') );
-   
-     // this is a bit messy, as we probably loose the doc's on new..
-   
-    
-    Roo.apply(this, {
-        name : n,
-        params: args,
-        returns :  retval,
-        isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
-        isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
-        memberOf : memberOf.alias,
-        exceptions : [],
-        desc : Introspect.doc(memberOf.alias + '.' + n_original)
-    });
-    // add descriptions to the arguments..
-    Roo.each(this.params, function(p) {
-        
-        
-        p.desc = Introspect.doc(memberOf.alias + '.' + n_original + '.' + p.name);
-        //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' +  p.desc);
-        
-    });
-    
-    
-        // collect references...
-    var addedto = [ memberOf.alias ]; // do not add to self...
-   
-     for(var i =0; i < args.length;i++) {
-        var ty = args[i].type;
-        if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
-            continue;
+Method = Object.define(
+    function(m, memberOf, saveto, keylist) {
+        this.propertyType  = 'Method';
+        
+        var flags = GI.function_info_get_flags (m);
+        var n = GI.base_info_get_name(m);
+        var n_original = n + '';
+        // posibly add: sink, 
+        if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
+            return false; // skip these!
         }
-        if (addedto.indexOf(ty) > -1) {
-            continue;
+        
+        if (n == 'new') {
+            n = 'c_new';
         }
+
         
+        var retval = [ { 
+                name : 0, 
+                type :  this.typeToName(GI.callable_info_get_return_type(m)),
+                desc : Introspect.doc(memberOf.alias + '.' + n_original + '.return-value')
+        } ];
         
         
-        Introspect.references[ty] = Introspect.references[ty] || [];
-        Introspect.references[ty].push(this);
-        addedto.push(ty);
-    }
-    
-    
-     // decide what to add to...
-     
-    if (this.isConstructor) {
         
-        if (this.name.match(/^new_/)) {
-            this.name = this.name.substring(4);
-        }
+        var args = this.argsToArrays(m, retval);
         
         
-        memberOf.constructors.push(this);
-        return;
-    }
-    // return values  = only applicable to non-constructors..
-    for(var i =0; i < retval.length;i++) {
-        var ty = retval[i].type;
-        if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
-            continue;
-        }
-        if (addedto.indexOf(ty) > -1) {
-            continue;
+        if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
+            
+            memberOf.constructors[0].doc = Introspect.doc(memberOf.alias + '.' + n_original);
+            
+            return false; // skip.
         }
         
+
         
         
-        Introspect.references[ty] = Introspect.references[ty] || [];
-        Introspect.references[ty].push(this);
-        addedto.push(ty);
-    }
-    
-    
-    if (this.isStatic) {
         
-        memberOf.functions.push(this);
-        return;
-    }
+        //console.log(GI.base_info_get_name(m));
+       // console.dump(GI.base_info_get_attribute(m, 'doc') );
+       
+         // this is a bit messy, as we probably loose the doc's on new..
+       
+        
+        Object.extend(this, {
+            name : n,
+            params: args,
+            returns :  retval,
+            isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
+            isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
+            memberOf : memberOf.alias,
+            exceptions : [],
+            desc : Introspect.doc(memberOf.alias + '.' + n_original)
+        });
+        // add descriptions to the arguments..
+        this.params.map(function(p) {
+            
+            
+            p.desc = Introspect.doc(memberOf.alias + '.' + n_original + '.' + p.name);
+            //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' +  p.desc);
+            
+        });
+        
+        
+            // collect references...
+        var addedto = [ memberOf.alias ]; // do not add to self...
+       
+         for(var i =0; i < args.length;i++) {
+            var ty = args[i].type;
+            if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
+                continue;
+            }
+            if (addedto.indexOf(ty) > -1) {
+                continue;
+            }
+            
+            
+            
+            Introspect.references[ty] = Introspect.references[ty] || [];
+            Introspect.references[ty].push(this);
+            addedto.push(ty);
+        }
         
         
-    memberOf.methods.push(this);
-    keylist.push(this.name);
+         // decide what to add to...
+         
+        if (this.isConstructor) {
+            
+            if (this.name.match(/^new_/)) {
+                this.name = this.name.substring(4);
+            }
+            
+            
+            memberOf.constructors.push(this);
+            return;
+        }
+        // return values  = only applicable to non-constructors..
+        for(var i =0; i < retval.length;i++) {
+            var ty = retval[i].type;
+            if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
+                continue;
+            }
+            if (addedto.indexOf(ty) > -1) {
+                continue;
+            }
+            
+            
+            
+            Introspect.references[ty] = Introspect.references[ty] || [];
+            Introspect.references[ty].push(this);
+            addedto.push(ty);
+        }
         
-    
         
-}
-
-
-Roo.extend(Method,Basic);
+        if (this.isStatic) {
+            
+            memberOf.functions.push(this);
+            return;
+        }
+            
+            
+        memberOf.methods.push(this);
+        keylist.push(this.name);
+            
+        
+            
+    },
+    Basic, 
+    { }
+);
\ No newline at end of file