]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Api: remove SymbolAccessibility
authorFlorian Brosch <flo.brosch@gmail.com>
Wed, 28 Oct 2009 19:02:59 +0000 (20:02 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Wed, 28 Oct 2009 19:02:59 +0000 (20:02 +0100)
Api: Fix null-pointer bug in EnumValue-signatures
Api: Fix EnumValue and ErrorCode accessibility
html-doclet: add EnumValue and ErrorCode to documentation
html: List EnumValues and ErrorCodes the same way as other symbols

src/doclets/htm/doclet.vala
src/libvaladoc/Makefile.am
src/libvaladoc/api/enumvalue.vala
src/libvaladoc/api/errorcode.vala
src/libvaladoc/api/symbol.vala
src/libvaladoc/api/symbolaccessibility.vala [deleted file]
src/libvaladoc/html/basicdoclet.vala

index 4c4bc40d1835e2229ce67f540f63c5e1f37a914e..14cbf9075e0aa819fe4a600587c7e74795aab5b4 100755 (executable)
@@ -227,9 +227,11 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
        }
 
        public override void visit_error_code (ErrorCode item) {
+               process_node (item);
        }
 
        public override void visit_enum_value (Api.EnumValue item) {
+               process_node (item);
        }
 
        public override void visit_delegate (Delegate item) {
index ca685a50be45e72daa5284443886e9ddd234f4a6..0e617684e07a4e281c9a88a51e373903a4cc1365 100644 (file)
@@ -60,7 +60,6 @@ libvaladoc_la_VALASOURCES = \
        api/signaturebuilder.vala \
        api/struct.vala \
        api/symbol.vala \
-       api/symbolaccessibility.vala \
        api/tree.vala \
        api/typeparameter.vala \
        api/typereference.vala \
index 8cce51121f64569023c87e21a5900a4540624c57..57113b8feff05d3207fe0d2bd90edab2c778537f 100644 (file)
@@ -28,6 +28,30 @@ public class Valadoc.Api.EnumValue: Symbol {
                base (symbol, parent);
        }
 
+       public override bool is_public {
+               get {
+                       return ((Enum)parent).is_public;
+               }
+       }
+
+       public override bool is_protected {
+               get {
+                       return ((Enum)parent).is_protected;
+               }
+       }
+
+       public override bool is_internal {
+               get {
+                       return ((Enum)parent).is_internal;
+               }
+       }
+
+       public override bool is_private {
+               get {
+                       return ((Enum)parent).is_private;
+               }
+       }
+
        protected override void process_comments (Settings settings, DocumentationParser parser) {
                var source_comment = ((Vala.EnumValue) symbol).comment;
                if (source_comment != null) {
@@ -48,11 +72,15 @@ public class Valadoc.Api.EnumValue: Symbol {
        }
 
        protected override Inline build_signature () {
-               return new SignatureBuilder ()
-                       .append_symbol (this)
-                       .append ("=")
-                       .append (((Vala.EnumValue) symbol).value.to_string ())
-                       .get ();
+               var builder = new SignatureBuilder ()
+                               .append_symbol (this);
+
+               if (((Vala.EnumValue) symbol).value != null) {
+                       builder.append ("=")
+                               .append (((Vala.EnumValue) symbol).value.to_string ());
+               }
+
+               return builder.get ();
        }
 }
 
index dab600fcdb9d13f5b2b954fcc60f3c7bc69a2ae8..f6a4a79eb22f08c6ef98c6555ab749f36e05ac4e 100644 (file)
@@ -28,6 +28,30 @@ public class Valadoc.Api.ErrorCode : TypeSymbol {
                base (symbol, parent);
        }
 
+       public override bool is_public {
+               get {
+                       return ((ErrorDomain)parent).is_public;
+               }
+       }
+
+       public override bool is_protected {
+               get {
+                       return ((ErrorDomain)parent).is_protected;
+               }
+       }
+
+       public override bool is_internal {
+               get {
+                       return ((ErrorDomain)parent).is_internal;
+               }
+       }
+
+       public override bool is_private {
+               get {
+                       return ((ErrorDomain)parent).is_private;
+               }
+       }
+
        public string get_cname () {
                return ((Vala.ErrorCode) symbol).get_cname ();
        }
index dbd183095d2c742a528196f50a25deea9dacb689..6ca4d7683e15826bb607092a5955d717876c2ed0 100644 (file)
@@ -22,7 +22,7 @@
 
 using Gee;
 
-public abstract class Valadoc.Api.Symbol : Node, SymbolAccessibility {
+public abstract class Valadoc.Api.Symbol : Node {
 
        protected Vala.Symbol symbol { private set; get; }
 
@@ -65,25 +65,25 @@ public abstract class Valadoc.Api.Symbol : Node, SymbolAccessibility {
                return true;
        }
 
-       public bool is_public {
+       public virtual bool is_public {
                get {
                        return symbol.access == Vala.SymbolAccessibility.PUBLIC;
                }
        }
 
-       public bool is_protected {
+       public virtual bool is_protected {
                get {
                        return symbol.access == Vala.SymbolAccessibility.PROTECTED;
                }
        }
 
-       public bool is_internal {
+       public virtual bool is_internal {
                get {
                        return symbol.access == Vala.SymbolAccessibility.INTERNAL;
                }
        }
 
-       public bool is_private {
+       public virtual bool is_private {
                get {
                        return symbol.access == Vala.SymbolAccessibility.PRIVATE;
                }
diff --git a/src/libvaladoc/api/symbolaccessibility.vala b/src/libvaladoc/api/symbolaccessibility.vala
deleted file mode 100644 (file)
index 32f190d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* symbolaccessibility.vala
- *
- * Copyright (C) 2008  Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- *
- * Author:
- *     Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Gee;
-
-public interface Valadoc.Api.SymbolAccessibility {
-
-       public abstract bool is_public { get; }
-
-       public abstract bool is_protected { get; }
-
-       public abstract bool is_internal { get; }
-
-       public abstract bool is_private { get; }
-}
-
index a523cb8923819503538d891f4d8f0ef197f475af..3553e359ef7a383b34d6cb6ded4ddfcc5196259d 100755 (executable)
@@ -299,7 +299,9 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                       || node is Class
                       || node is Struct
                       || node is Enum
-                      || node is ErrorDomain;
+                      || node is Api.EnumValue
+                      || node is ErrorDomain
+                      || node is ErrorCode;
        }
 
        public void write_navi_packages_inline (Api.Tree tree) {
@@ -376,8 +378,8 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                                Api.NodeType.CONSTANT
                        })) {
                        writer.start_tag ("h2", {"class", css_title}).text ("Content:").end_tag ("h2");
-                       write_children_table (node, Api.NodeType.ERROR_CODE, "Error codes");
-                       write_children_table (node, Api.NodeType.ENUM_VALUE, "Enum values");
+                       write_children (node, Api.NodeType.ERROR_CODE, "Error codes", node);
+                       write_children (node, Api.NodeType.ENUM_VALUE, "Enum values", node);
                        write_children (node, Api.NodeType.CLASS, "Classes", node);
                        write_children (node, Api.NodeType.STRUCT, "Structs", node);
                        write_children (node, Api.NodeType.ENUM, "Enums", node);
@@ -488,27 +490,6 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                }
        }
 
-       private void write_children_table (Api.Node node, Api.NodeType type, string type_string) {
-               Gee.Collection<Api.Node> children = node.get_children_by_type (Api.NodeType.ENUM_VALUE);
-               if (children.size > 0) {
-                       writer.start_tag ("h3", {"class", css_title}).text (type_string).text (":").end_tag ("h3");
-                       writer.start_tag ("table", {"class", get_html_css_class (node)});
-                       foreach (Api.Node child in children) {
-                               writer.start_tag ("tr");
-                               writer.start_tag ("td", {"class", get_html_css_class (child), "id", child.name});
-                               writer.text (child.name);
-                               writer.end_tag ("td");
-
-                               writer.start_tag ("td");
-                               this.write_documentation (child, node);
-                               writer.end_tag ("td");
-
-                               writer.end_tag ("tr");
-                       }
-                       writer.end_tag ("table");
-               }
-       }
-
        protected void write_image_block (Api.Node element) {
                if (!(element is Class || element is Interface || element is Struct)) {
                        return;