From: Florian Brosch Date: Wed, 28 Oct 2009 19:02:59 +0000 (+0100) Subject: Api: remove SymbolAccessibility X-Git-Tag: 0.37.1~3^2~509 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4aebc5ec8fc0f46eccbb6ca0e66b2aa6d3fc538;p=thirdparty%2Fvala.git Api: remove SymbolAccessibility 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 --- diff --git a/src/doclets/htm/doclet.vala b/src/doclets/htm/doclet.vala index 4c4bc40d1..14cbf9075 100755 --- a/src/doclets/htm/doclet.vala +++ b/src/doclets/htm/doclet.vala @@ -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) { diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am index ca685a50b..0e617684e 100644 --- a/src/libvaladoc/Makefile.am +++ b/src/libvaladoc/Makefile.am @@ -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 \ diff --git a/src/libvaladoc/api/enumvalue.vala b/src/libvaladoc/api/enumvalue.vala index 8cce51121..57113b8fe 100644 --- a/src/libvaladoc/api/enumvalue.vala +++ b/src/libvaladoc/api/enumvalue.vala @@ -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 (); } } diff --git a/src/libvaladoc/api/errorcode.vala b/src/libvaladoc/api/errorcode.vala index dab600fcd..f6a4a79eb 100644 --- a/src/libvaladoc/api/errorcode.vala +++ b/src/libvaladoc/api/errorcode.vala @@ -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 (); } diff --git a/src/libvaladoc/api/symbol.vala b/src/libvaladoc/api/symbol.vala index dbd183095..6ca4d7683 100644 --- a/src/libvaladoc/api/symbol.vala +++ b/src/libvaladoc/api/symbol.vala @@ -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 index 32f190d42..000000000 --- a/src/libvaladoc/api/symbolaccessibility.vala +++ /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 - */ - -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; } -} - diff --git a/src/libvaladoc/html/basicdoclet.vala b/src/libvaladoc/html/basicdoclet.vala index a523cb892..3553e359e 100755 --- a/src/libvaladoc/html/basicdoclet.vala +++ b/src/libvaladoc/html/basicdoclet.vala @@ -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 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;