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 imports['Object.js'].load(Object);
16 console = imports['console.js'].console;
19 Introspect = imports['JSDOC/Introspect.js'].Introspect;
20 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
22 * Methods, functions or consturctors
28 Method = XObject.define(
29 function(m, memberOf, saveto, keylist) {
30 this.propertyType = 'Method';
32 var flags = GI.function_info_get_flags (m);
33 var n = GI.base_info_get_name(m);
34 var n_original = n + '';
36 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
37 return false; // skip these!
47 type : this.typeToName(GI.callable_info_get_return_type(m)),
48 desc : Introspect.doc(memberOf.alias + '.' + n_original + '.return-value')
53 var args = this.argsToArrays(m, retval);
56 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
58 memberOf.constructors[0].doc = Introspect.doc(memberOf.alias + '.' + n_original);
60 return false; // skip.
67 //console.log(GI.base_info_get_name(m));
68 // console.dump(GI.base_info_get_attribute(m, 'doc') );
70 // this is a bit messy, as we probably loose the doc's on new..
73 XObject.extend(this, {
77 isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
78 isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
79 memberOf : memberOf.alias,
81 desc : Introspect.doc(memberOf.alias + '.' + n_original)
83 // add descriptions to the arguments..
84 this.params.map(function(p) {
87 p.desc = Introspect.doc(memberOf.alias + '.' + n_original + '.' + p.name);
88 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
93 // collect references...
94 var addedto = [ memberOf.alias ]; // do not add to self...
96 for(var i =0; i < args.length;i++) {
97 var ty = args[i].type;
98 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
101 if (addedto.indexOf(ty) > -1) {
107 Introspect.references[ty] = Introspect.references[ty] || [];
108 Introspect.references[ty].push(this);
113 // decide what to add to...
115 if (this.isConstructor) {
117 if (this.name.match(/^new_/)) {
118 this.name = this.name.substring(4);
122 memberOf.constructors.push(this);
125 // return values = only applicable to non-constructors..
126 for(var i =0; i < retval.length;i++) {
127 var ty = retval[i].type;
128 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
131 if (addedto.indexOf(ty) > -1) {
137 Introspect.references[ty] = Introspect.references[ty] || [];
138 Introspect.references[ty].push(this);
145 memberOf.functions.push(this);
150 memberOf.methods.push(this);
151 keylist.push(this.name);