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
20 * Florian Brosch <flo.brosch@gmail.com>
24 using Valadoc
.Content
;
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
;
48 * Returns the name of this method as it is used in C.
50 public string?
get_cname () {
55 * Returns the dbus-name.
57 public string get_dbus_name () {
64 public TypeReference? property_type
{
70 * Specifies whether the property is virtual.
72 public bool is_virtual
{
74 return binding_type
== PropertyBindingType
.VIRTUAL
;
79 * Specifies whether the property is abstract.
81 public bool is_abstract
{
83 return binding_type
== PropertyBindingType
.ABSTRACT
;
88 * Specifies whether the property is override.
90 public bool is_override
{
92 return binding_type
== PropertyBindingType
.OVERRIDE
;
97 * Specifies whether the property is visible.
99 public bool is_dbus_visible
{
104 public PropertyAccessor? setter
{
109 public PropertyAccessor? getter
{
115 * Specifies the virtual or abstract property this property overrides.
117 public Property base_property
{
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
);
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
);
156 protected override Inline
build_signature () {
157 var signature
= new
SignatureBuilder ();
159 signature
.append_keyword (accessibility
.to_string ());
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 ();
188 public override NodeType node_type
{
189 get { return NodeType
.PROPERTY
; }
195 public override void accept (Visitor visitor
) {
196 visitor
.visit_property (this
);