示例#1
0
        //=====================================================================
        /// <summary>
        /// Writes a file that documents a single global object.
        /// </summary>
        public void WriteObjectFile(String fileName, ObjectDef od)
        {
            System.Console.Out.WriteLine("writing " + fileName);

            StreamWriter w = new StreamWriter(fileName);
            w.WriteLine("<html>\r\n<head>"
                        + "<link rel=stylesheet type=\"text/css\" "
                        + "href=\"../libref.css\">"
                        + "<title>" + od.Name + "</title>"
            //                      + "<script type=\"text/javascript\" "
            //                      + "src=\"../libref.js\"></script>"
            //                      + "</head><body onload=\"frmLd()\">");
                        + "</head><body>");

            this.WriteFileTitle(w, "object", od.Name,
                                this.FileLinks(od.Source), null);

            w.WriteLine("<table class=nav><tr>");

            w.WriteLine("<td>" + Hyperlink(null, "_SuperClassTree_", null,
                                           "Superclass<br>Tree"));
            w.WriteLine("<td>" + Hyperlink(null, "_PropSummary_", null,
                                           "Property<br>Summary"));
            w.WriteLine("<td>" + Hyperlink(null, "_MethodSummary_", null,
                                           "Method<br>Summary"));
            w.WriteLine("<td>" + Hyperlink(null, "_Properties_", null,
                                           "Property<br>Details"));
            w.WriteLine("<td>" + Hyperlink(null, "_Methods_", null,
                                           "Method<br>Details"));

            w.WriteLine("</table><div class=fdesc>");

            if (od.Description == "")
                w.WriteLine("<i>no description available</i>");
            else
                w.WriteLine(EncodeEntities(od.Description));

            w.WriteLine("<p>");
            WriteObjectDecl(w, od, false);
            w.WriteLine("</div>");

            this.WriteMajorHeading(w, "_SuperClassTree_", "Superclass Tree",
                                   "(in declaration order)");
            this.WriteParentTree(w, od);

            this.WriteMajorHeading(w, "_PropSummary_",
                                   "Summary of Properties", "");
            this.WritePropertySummary(w, od);

            this.WriteMajorHeading(w, "_MethodSummary_",
                                   "Summary of Methods", "");
            this.WriteMethodSummary(w, od);

            this.WriteMajorHeading(w, "_Properties_", "Properties", "");
            if (od.Properties.Count == 0)
                w.WriteLine("<i>(none)</i>");
            else
            {
                foreach (PropertyDef p in od.Properties)
                    this.WriteProperty(w, p);
            }

            this.WriteMajorHeading(w, "_Methods_", "Methods", "");
            if (od.Methods.Count == 0)
                w.WriteLine("<i>(none)</i>");
            else
            {
                foreach (MethodDef m in od.Methods)
                    this.WriteMethod(w, m);
            }

            this.WriteHtmlFooter(w);
            w.Close();
        }
示例#2
0
文件: Parser.cs 项目: EricEve/docgen
        //=====================================================================
        /// <summary>
        /// Processes a line which appears to define a global object.
        /// identifier ":" [identifier List]
        /// </summary>
        private void ProcessObject(String name, String line, bool isTransient, bool isAction)
        {
            // note: the identifer and colon have already been parsed
            ObjectDef od = new ObjectDef(Path.GetFileName(CurrentFileName), LineNumber);
            od.Name = name;
            od.Description = LastComment;
            od.IsTransient = isTransient;
            od.isAction = isAction;
            LastComment = "";
            if (od.Name == "")
                return;     // must not be a class after all
            line = line.Trim();
            while (line != "")      // collect base class names
            {
                String t;
                t = GetNextToken(ref line);
                if (t.Contains("Action"))
                    od.isAction = true;

                od.BaseClasses.Add(t);
                t = GetNextToken(ref line);
                if (t != ",")
                    break;
            }

            SymbolTable.SetObjectFileName(od);
            SymbolTable.GlobalObjects.Add(od);
            this.CurrentSourceFile.GlobalObjects.Add(od);
            CurrClassOrObj = od;
        }