Release 0.41.92
[vala-gnome.git] / libvaladoc / api / enumvalue.vala
blob55702e1df7b77eb8196300af2873cf75687eac48
1 /* enumvalue.vala
3 * Copyright (C) 2008-2011 Florian Brosch
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Florian Brosch <flo.brosch@gmail.com>
24 using Valadoc.Content;
26 /**
27 * Represents an enum member.
29 public class Valadoc.Api.EnumValue: Symbol {
30 private SourceComment? source_comment;
31 private string? cname;
33 public Content.Run default_value {
34 get;
35 set;
38 /**
39 * Specifies whether the parameter has a default value
41 public bool has_default_value {
42 get {
43 return default_value != null;
47 public EnumValue (Enum parent, SourceFile file, string name, SourceComment? comment, string? cname, Vala.EnumValue data) {
48 base (parent, file, name, parent.accessibility, data);
50 this.source_comment = comment;
51 this.cname = cname;
54 /**
55 * {@inheritDoc}
57 internal override void parse_comments (Settings settings, DocumentationParser parser) {
58 if (documentation != null) {
59 return ;
62 if (source_comment != null) {
63 documentation = parser.parse (this, source_comment);
66 base.parse_comments (settings, parser);
69 /**
70 * {@inheritDoc}
72 internal override void check_comments (Settings settings, DocumentationParser parser) {
73 if (documentation != null) {
74 parser.check (this, documentation);
77 base.check_comments (settings, parser);
80 /**
81 * Returns the name of this enum value as it is used in C.
83 public string get_cname () {
84 return cname;
87 /**
88 * {@inheritDoc}
90 public override NodeType node_type { get { return NodeType.ENUM_VALUE; } }
92 /**
93 * {@inheritDoc}
95 public override void accept (Visitor visitor) {
96 visitor.visit_enum_value (this);
99 /**
100 * {@inheritDoc}
102 protected override Inline build_signature () {
103 var builder = new SignatureBuilder ()
104 .append_symbol (this);
106 if (has_default_value) {
107 builder.append ("=");
108 builder.append_content (default_value);
111 return builder.get ();