src/jsdoc/Symbol.vala
[roojspacker] / src / jsdoc / Symbol.vala
index d4eebad..319c5b4 100644 (file)
@@ -25,49 +25,77 @@ namespace JSDOC {
                        Symbol.regex_prototype = new GLib.Regex("\\.prototype\\.?");
                }
 
-               private string private_name = ""; // should not be directly accessed ??
+               private string private_string_name = "";
+               private string private_name {
+               set {
+                               var n = Symbol.regex_global(value, value.length, 0, "");
+                       n =  Symbol.regex_prototype(n,n.length, 0, "#");
+                       while (true) {
+                               if (!n.has_suffix("#")) {
+                                       break;
+                                       }
+                                       n = n.substring(0, n.length-1);
+                               }
+                       
+                       this.private_string_name = n;
+               }
                
-               private string _name {
-                       set { 
-               
-                               var n = Symbol.regex_global(value, value.length, 0, "")
-                n =  Symbol.regex_prototype(n,n.length, 0, "#");
-                while (true) {
-                       if (!n.has_suffix("#")) {
-                               break;
-                               }
-                               n = n.substring(0, n.length-1);
-                       }
-                       
-                this.private_name = n;
-            }
-             
                }
-                       
+                
         public string name {
-               get { return this.private_name; }
+               get { return this.private_string_name; }
                }
                
-        : "",
-        string defaultValue : "",
-        
-        
+      
+        string defaultValue = "";
         
-        params : [],
-        augments : [], // Doctag[]
-        exceptions : [],  // Doctag[]
-        inherits : [],  // Doctag[]
-        methods : [], // Symbol[]
-               //??
-        _params : [], //Doctag[]
-                properties : [], //Doctag[]
-        requires : [],  //Doctag[]
-        returns : [], //Doctag[]
-        see : [], //Doctag[]
-
-        srcFile : {}, //??
-        childClasses : [],
-        cfgs : {},
+               private Gee.ArrayList<DocTag> private_doctag_params;
+
+               private Gee.ArrayList<DocTag> private_params{
+                       set  {
+                               for (var i = 0; i < value.size; i++) {
+                                  
+                                   this.private_doctag_params.add(v.get(i));
+                               }
+                               //this.params = this._params;
+                       }
+               }
+     
+               Gee.ArrayList<string> private_string_params{
+                       set  {
+                               for (var i = 0; i < value.size; i++) {
+
+                                   //var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
+                                   this.private_doctag_params.add( new DocTag(value.get(i)));
+                                          
+                                  //"param"+((ty)?" {"+ty+"}":"")+" "+v.get(i).name);
+                                   
+                               }
+                               
+                       }
+               }
+               public Gee.ArrayList<DocTag> params {
+                       get {
+                               return this.private_doctag_params;
+                       }
+               
+               }
+
+               private Gee.ArrayList<DocTag>  augments ;  
+
+               private Gee.ArrayList<DocTag>  exceptions ;
+
+               private Gee.ArrayList<DocTag>  inherits; 
+               private Gee.ArrayList<DocTag>  methods;
+
+               private Gee.ArrayList<DocTag> properties;
+               private Gee.ArrayList<DocTag> requires;
+               private Gee.ArrayList<DocTag> returns;
+               private Gee.ArrayList<DocTag> see ;
+
+         
+        //childClasses : [],
+        //cfgs : {},
         
         
         DocComment comment;
@@ -95,17 +123,17 @@ namespace JSDOC {
         public bool isPrivate = false;
         public bool isStatic = false;
         
-        string memberOf : "",
+        string memberOf = "";
+
 
-        string _name : "",
 
        
-        string since : "",
+        string since = "";
 
-        string type : "",
-        string version : "",
-        
-        string srcFile = ""
+        string type = "";
+        string version = "";
+       
+        string srcFile = "";
         
         
         
@@ -115,39 +143,39 @@ namespace JSDOC {
 
             
             //this.params = [];
-            this.$args = [];
+            //this.$args = [];
             
             //this.events = [];
-            this.exceptions = [];
-            this.inherits = [];
+            this.exceptions = new Gee.ArrayList<DocTag>();
+            this.inherits = new Gee.ArrayList<DocTag>();
             //
             this.isa = "OBJECT"; // OBJECT//FUNCTION
-            this.methods = [];
-            this._params = [];
-            this.properties = [];
-            this.requires = [];
-            this.returns = [];
-            this.see = [];
+            this.methods = new Gee.ArrayList<DocTag>();
+            //this.private_params = new Gee.ArrayList<DocTag>();
+            this.properties = new Gee.ArrayList<DocTag>();
+            this.requires = new Gee.ArrayList<DocTag>();
+            this.returns = new Gee.ArrayList<DocTag>();
+            this.see = new Gee.ArrayList<DocTag>();
  
             
             
             this.cfgs = {};
             // derived later?
-            this.inheritsFrom = [];
-            this.childClasses = [];
+            //this.inheritsFrom = [];
+            //this.childClasses = [];
             
             this.comment = new DocComment();
             this.comment.isUserComment =  false;
             
                
-        },
+        }
                
                Public Symbol.new_builtin(string name)
                {
             Symbol.regexInit();
             this.initArrays();
             this.srcFile = DocParser.currentSourceFile;
-                       this._name = name;
+                       this.prviate_name =  name ;
                        this.alias = this.name;
                        this.isa = "CONSTRUCTOR";
                        this.comment = new DocComment("");
@@ -162,33 +190,6 @@ namespace JSDOC {
                }
                
 
-        //__defineSetter__("name",
-       
-        //);
-        //__defineGetter__("name",
-        getName : function() { return this._name; },
-        //);
-        //__defineSetter__("params", 
-        setParams  :function(v) {
-                for (var i = 0, l = v.length; i < l; i++) {
-                    if (v[i].constructor != DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
-                        var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
-                        this._params[i] = new DocTag(
-                            "param"+((ty)?" {"+ty+"}":"")+" "+v[i].name);
-                    }
-                    else {
-                        this._params[i] = v[i];
-                    }
-                }
-                this.params = this._params;
-            },
-        //);
-
-
-        //__defineGetter__("params",
-        public getParams : function() { 
-               return this._params; 
-               },
  
 
         public Symbol.new_populate_with_args(
@@ -199,13 +200,13 @@ namespace JSDOC {
         ) {
             Symbol.regexInit();
             this.initArrays();
-            this.$args = arguments;
+           // this.$args = arguments;
             //println("Symbol created: " + isa + ":" + name);
-            this.setName(name);
+            this.private_name = name;
             this.alias = this.getName();
-            this.setParams(params);
+            this.private_string_params = params; 
             this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
-            this.comment = comment || new DocComment("")
+            this.comment =  new DocComment(comment);
             
             this.srcFile = DocParser.currentSourceFile;
             
@@ -215,15 +216,20 @@ namespace JSDOC {
                        this.alias = this.srcFile;
                }
 
-            this.setTags();
+            this.tagsFromComment();
             
-        },
+        }
 
-        setTags : function() {
+        void tagsFromComment() {
             // @author
             var authors = this.comment.getTag("author");
-            if (authors.length) {
-                this.author = authors.map(function($){return $.desc;}).join(", ");
+            if (authors.size) {
+                       // turns author into a string....
+                       this.author = "";
+                foreach(authors as a) {
+                    this.author += (this.author == "") ? "": ", ";
+                    this.author += a.desc;
+                }
             }
             
             /*~t