3 * Copyright (C) 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
;
26 public class Valadoc
.Api
.Attribute
: Item
{
27 private Vala
.ArrayList
<AttributeArgument
> args
= new Vala
.ArrayList
<AttributeArgument
> ();
28 private SourceFile file
;
35 public Attribute (Node parent
, SourceFile file
, string name
, Vala
.Attribute data
) {
43 public AttributeArgument?
get_argument (string name
) {
45 foreach (AttributeArgument arg
in args
) {
46 if (arg
.name
== name
) {
55 public AttributeArgument
add_boolean (string name
, bool value
, Vala
.Attribute data
) {
56 AttributeArgument arg
= new AttributeArgument
.boolean (this
, file
, name
, value
, data
);
61 public AttributeArgument
add_integer (string name
, int value
, Vala
.Attribute data
) {
62 AttributeArgument arg
= new AttributeArgument
.integer (this
, file
, name
, value
, data
);
67 public AttributeArgument
add_double (string name
, double value
, Vala
.Attribute data
) {
68 AttributeArgument arg
= new AttributeArgument
.double (this
, file
, name
, value
, data
);
73 public AttributeArgument
add_string (string name
, string value
, Vala
.Attribute data
) {
74 AttributeArgument arg
= new AttributeArgument
.string (this
, file
, name
, value
, data
);
79 public SourceFile
get_source_file () {
83 protected override Inline
build_signature () {
84 SignatureBuilder builder
= new
SignatureBuilder ();
86 builder
.append_attribute ("[");
87 builder
.append_type_name (name
);
90 builder
.append_attribute ("(");
93 foreach (AttributeArgument arg
in args
) {
95 builder
.append_attribute (", ");
97 builder
.append_content (arg
.signature
);
100 builder
.append_attribute (")");
103 builder
.append_attribute ("]");
105 return builder
.get ();