1 //<script type="text/javascript">
2 const GI = imports.gi.GIRepository;
5 const XObject = imports.XObject.XObject;
6 const console = imports.console.console;
8 const NameSpace = imports.Introspect.NameSpace.NameSpace;
9 const Basic = imports.Introspect.Basic.Basic;
13 * Methods, functions or consturctors
19 var Method = XObject.define(
20 function(m, memberOf, saveto, keylist) {
21 this.propertyType = 'Method';
23 var flags = GI.function_info_get_flags (m);
25 var n_original = n + '';
27 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
28 return false; // skip these!
37 type : this.typeToName(GI.callable_info_get_return_type(m)),
38 desc : NameSpace.doc(memberOf.alias + '.' + n_original + '.return-value')
41 var args = this.argsToArrays(m, retval);
43 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
45 memberOf.constructors[0].doc = NameSpace.doc(memberOf.alias + '.' + n_original);
47 return false; // skip.
50 //console.log(GI.base_info_get_name(m));
51 // console.dump(GI.base_info_get_attribute(m, 'doc') );
53 // this is a bit messy, as we probably loose the doc's on new..
55 XObject.extend(this, {
59 isConstructor : flags & GI.FunctionInfoFlags.IS_CONSTRUCTOR,
60 isStatic : !(flags & GI.FunctionInfoFlags.IS_METHOD),
61 memberOf : memberOf.alias,
63 desc : NameSpace.doc(memberOf.alias + '.' + n_original)
65 // add descriptions to the arguments..
66 this.params.map(function(p) {
67 p.desc = NameSpace.doc(memberOf.alias + '.' + n_original + '.' + p.name);
68 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
71 // collect references...
72 var addedto = [ memberOf.alias ]; // do not add to self...
74 for(var i =0; i < args.length;i++) {
75 var ty = args[i].type;
76 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
80 if (addedto.indexOf(ty) > -1) {
83 NameSpace.references[ty] = NameSpace.references[ty] || [];
84 NameSpace.references[ty].push(this);
88 // decide what to add to...
89 if (this.isConstructor) {
90 if (this.name.match(/^new_/)) {
91 this.name = this.name.substring(4);
93 memberOf.constructors.push(this);
99 // return values = only applicable to non-constructors..
100 for(var i =0; i < retval.length;i++) {
101 var ty = retval[i].type;
102 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
105 if (addedto.indexOf(ty) > -1) {
108 NameSpace.references[ty] = NameSpace.references[ty] || [];
109 NameSpace.references[ty].push(this);
114 memberOf.functions.push(this);
119 memberOf.methods.push(this);
120 keylist.push(this.name);