1 //<script type="text/javascript">
3 GI = imports.gi.GIRepository;
6 XObject = imports.XObject.XObject;
7 console = imports.console.console;
8 NameSpace = imports.NameSpace.NameSpace;
10 Base = imports.Base.Base;
14 Introspect = imports['JSDOC/Introspect.js'].Introspect;
15 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
17 * Methods, functions or consturctors
23 Method = XObject.define(
24 function(m, memberOf, saveto, keylist) {
25 this.propertyType = 'Method';
27 var flags = GI.function_info_get_flags (m);
28 var n = GI.base_info_get_name(m);
29 var n_original = n + '';
31 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
32 return false; // skip these!
42 type : this.typeToName(GI.callable_info_get_return_type(m)),
43 desc : NameSpace.doc(memberOf.alias + '.' + n_original + '.return-value')
48 var args = this.argsToArrays(m, retval);
51 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
53 memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias + '.' + n_original);
55 return false; // skip.
62 //console.log(GI.base_info_get_name(m));
63 // console.dump(GI.base_info_get_attribute(m, 'doc') );
65 // this is a bit messy, as we probably loose the doc's on new..
68 XObject.extend(this, {
72 isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
73 isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
74 memberOf : memberOf.alias,
76 desc : NameSpace.doc(memberOf.alias + '.' + n_original)
78 // add descriptions to the arguments..
79 this.params.map(function(p) {
82 p.desc = NameSpace.doc(memberOf.alias + '.' + n_original + '.' + p.name);
83 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
88 // collect references...
89 var addedto = [ memberOf.alias ]; // do not add to self...
91 for(var i =0; i < args.length;i++) {
92 var ty = args[i].type;
93 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
96 if (addedto.indexOf(ty) > -1) {
102 NameSpace.references[ty] = NameSpace.references[ty] || [];
103 NameSpace.references[ty].push(this);
108 // decide what to add to...
110 if (this.isConstructor) {
112 if (this.name.match(/^new_/)) {
113 this.name = this.name.substring(4);
117 memberOf.constructors.push(this);
120 // return values = only applicable to non-constructors..
121 for(var i =0; i < retval.length;i++) {
122 var ty = retval[i].type;
123 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
126 if (addedto.indexOf(ty) > -1) {
132 NameSpace.references[ty] = NameSpace.references[ty] || [];
133 NameSpace.references[ty].push(this);
140 memberOf.functions.push(this);
145 memberOf.methods.push(this);
146 keylist.push(this.name);