Release 0.41.92
[vala-gnome.git] / libvaladoc / api / signal.vala
blob7da544bbd8dd401ca6b4fd81e8b800977264af70
1 /* signal.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 signal.
29 public class Valadoc.Api.Signal : Member, Callable {
30 private string? default_impl_cname;
31 private string? dbus_name;
32 private string? cname;
35 /**
36 * {@inheritDoc}
38 internal string? implicit_array_length_cparameter_name {
39 get;
40 set;
44 public Signal (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
45 SourceComment? comment, string? cname, string? default_impl_cname, string? dbus_name, bool is_dbus_visible,
46 bool is_virtual, Vala.Signal data)
48 base (parent, file, name, accessibility, comment, data);
50 this.default_impl_cname = default_impl_cname;
51 this.dbus_name = dbus_name;
52 this.cname = cname;
54 this.is_dbus_visible = is_dbus_visible;
55 this.is_virtual = is_virtual;
58 /**
59 * Returns the name of this signal as it is used in C.
61 public string? get_cname () {
62 return cname;
65 public string? get_default_impl_cname () {
66 return default_impl_cname;
69 /**
70 * Returns the dbus-name.
72 public string get_dbus_name () {
73 return dbus_name;
76 /**
77 * {@inheritDoc}
79 public TypeReference? return_type {
80 set;
81 get;
84 /**
85 * Specifies whether this signal is virtual
87 public bool is_virtual {
88 private set;
89 get;
92 /**
93 * Specifies whether this signal is visible for dbus
95 public bool is_dbus_visible {
96 private set;
97 get;
101 * {@inheritDoc}
103 protected override Inline build_signature () {
104 var signature = new SignatureBuilder ();
106 signature.append_keyword (accessibility.to_string ());
107 if (is_virtual) {
108 signature.append_keyword ("virtual");
111 signature.append_keyword ("signal");
113 signature.append_content (return_type.signature);
114 signature.append_symbol (this);
115 signature.append ("(");
117 bool first = true;
118 foreach (Node param in get_children_by_type (NodeType.FORMAL_PARAMETER, false)) {
119 if (!first) {
120 signature.append (",", false);
122 signature.append_content (param.signature, !first);
123 first = false;
126 signature.append (")", false);
128 return signature.get ();
132 * {@inheritDoc}
134 public override NodeType node_type {
135 get { return NodeType.SIGNAL; }
139 * {@inheritDoc}
141 public override void accept (Visitor visitor) {
142 visitor.visit_signal (this);