Release 0.41.92
[vala-gnome.git] / libvaladoc / api / property.vala
blobc50b2b2711396706c6ff62763ac2d75e328c7c2a
1 /* property.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 a property declaration.
29 public class Valadoc.Api.Property : Member {
30 private PropertyBindingType binding_type;
31 private string? dbus_name;
32 private string? cname;
34 public Property (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
35 SourceComment? comment, string? cname, string? dbus_name, bool is_dbus_visible,
36 PropertyBindingType binding_type, Vala.Property data)
38 base (parent, file, name, accessibility, comment, data);
40 this.is_dbus_visible = is_dbus_visible;
41 this.binding_type = binding_type;
43 this.dbus_name = dbus_name;
44 this.cname = cname;
47 /**
48 * Returns the name of this method as it is used in C.
50 public string? get_cname () {
51 return cname;
54 /**
55 * Returns the dbus-name.
57 public string get_dbus_name () {
58 return dbus_name;
61 /**
62 * The property type.
64 public TypeReference? property_type {
65 set;
66 get;
69 /**
70 * Specifies whether the property is virtual.
72 public bool is_virtual {
73 get {
74 return binding_type == PropertyBindingType.VIRTUAL;
78 /**
79 * Specifies whether the property is abstract.
81 public bool is_abstract {
82 get {
83 return binding_type == PropertyBindingType.ABSTRACT;
87 /**
88 * Specifies whether the property is override.
90 public bool is_override {
91 get {
92 return binding_type == PropertyBindingType.OVERRIDE;
96 /**
97 * Specifies whether the property is visible.
99 public bool is_dbus_visible {
100 private set;
101 get;
104 public PropertyAccessor? setter {
105 set;
106 get;
109 public PropertyAccessor? getter {
110 set;
111 get;
115 * Specifies the virtual or abstract property this property overrides.
117 public Property base_property {
118 set;
119 get;
123 * {@inheritDoc}
125 internal override void parse_comments (Settings settings, DocumentationParser parser) {
126 if (getter != null && getter.is_browsable (settings)) {
127 getter.parse_comments (settings, parser);
130 if (setter != null && setter.is_browsable (settings)) {
131 setter.parse_comments (settings, parser);
134 base.parse_comments (settings, parser);
138 * {@inheritDoc}
140 internal override void check_comments (Settings settings, DocumentationParser parser) {
141 if (getter != null && getter.is_browsable (settings)) {
142 getter.check_comments (settings, parser);
145 if (setter != null && setter.is_browsable (settings)) {
146 setter.check_comments (settings, parser);
149 base.check_comments (settings, parser);
154 * {@inheritDoc}
156 protected override Inline build_signature () {
157 var signature = new SignatureBuilder ();
159 signature.append_keyword (accessibility.to_string ());
160 if (is_abstract) {
161 signature.append_keyword ("abstract");
162 } else if (is_override) {
163 signature.append_keyword ("override");
164 } else if (is_virtual) {
165 signature.append_keyword ("virtual");
168 signature.append_content (property_type.signature);
169 signature.append_symbol (this);
170 signature.append ("{");
172 if (setter != null && setter.do_document) {
173 signature.append_content (setter.signature);
176 if (getter != null && getter.do_document) {
177 signature.append_content (getter.signature);
180 signature.append ("}");
182 return signature.get ();
186 * {@inheritDoc}
188 public override NodeType node_type {
189 get { return NodeType.PROPERTY; }
193 * {@inheritDoc}
195 public override void accept (Visitor visitor) {
196 visitor.visit_property (this);