summaryrefslogtreecommitdiff
path: root/libvaladoc/api
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-06-27 13:09:30 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2017-06-27 13:19:08 +0200
commit2b742fce82eb1326faaee3b2cc4ff993e701ef53 (patch)
tree44e4d274b22274029d43cd18126810551125a394 /libvaladoc/api
parent7609126be290e01dd452a3fc1bdf8d57af363569 (diff)
parent93d9fe647be1f2effc0bfeeec903b5e030182f6c (diff)
downloadvala-2b742fce82eb1326faaee3b2cc4ff993e701ef53.tar.gz
Merge valadoc 0.36.0
Consider valadoc a part of vala's toolchain and therefore let it live in the main repository. With this merge there is no need to maintain multiple driver sources since only one is required from now on. There is no dependency on gee-0.8 and vala's internal gee copy has made to be sufficient. The libvaladoc library will be suffixed with vala's version suffix too. Besides this renaming the rest of the valadoc file layout is kept the same. https://bugzilla.gnome.org/show_bug.cgi?id=782782
Diffstat (limited to 'libvaladoc/api')
-rw-r--r--libvaladoc/api/array.vala69
-rw-r--r--libvaladoc/api/attribute.vala108
-rw-r--r--libvaladoc/api/attributeargument.vala132
-rw-r--r--libvaladoc/api/browsable.vala33
-rw-r--r--libvaladoc/api/callable.vala48
-rw-r--r--libvaladoc/api/childsymbolregistrar.vala98
-rw-r--r--libvaladoc/api/class.vala360
-rw-r--r--libvaladoc/api/constant.vala81
-rw-r--r--libvaladoc/api/delegate.vala142
-rw-r--r--libvaladoc/api/driver.vala42
-rw-r--r--libvaladoc/api/enum.vala71
-rw-r--r--libvaladoc/api/enumvalue.vala114
-rw-r--r--libvaladoc/api/errorcode.vala107
-rw-r--r--libvaladoc/api/errordomain.vala100
-rw-r--r--libvaladoc/api/field.vala110
-rw-r--r--libvaladoc/api/formalparameter.vala155
-rw-r--r--libvaladoc/api/formalparametertype.vala44
-rw-r--r--libvaladoc/api/girsourcecomment.vala57
-rw-r--r--libvaladoc/api/interface.vala213
-rw-r--r--libvaladoc/api/item.vala70
-rw-r--r--libvaladoc/api/member.vala62
-rw-r--r--libvaladoc/api/method.vala265
-rw-r--r--libvaladoc/api/methodbindingtype.vala55
-rw-r--r--libvaladoc/api/namespace.vala96
-rw-r--r--libvaladoc/api/node.vala723
-rw-r--r--libvaladoc/api/nodetype.vala117
-rw-r--r--libvaladoc/api/ownership.vala47
-rw-r--r--libvaladoc/api/package.vala143
-rw-r--r--libvaladoc/api/pointer.vala54
-rw-r--r--libvaladoc/api/property.vala201
-rw-r--r--libvaladoc/api/propertyaccessor.vala133
-rw-r--r--libvaladoc/api/propertyaccessortype.vala43
-rw-r--r--libvaladoc/api/propertybindingtype.vala48
-rw-r--r--libvaladoc/api/signal.vala145
-rw-r--r--libvaladoc/api/signaturebuilder.vala180
-rw-r--r--libvaladoc/api/sourcecomment.vala85
-rw-r--r--libvaladoc/api/sourcefile.vala61
-rw-r--r--libvaladoc/api/struct.vala173
-rw-r--r--libvaladoc/api/symbol.vala157
-rw-r--r--libvaladoc/api/symbolaccessibility.vala51
-rw-r--r--libvaladoc/api/tree.vala350
-rw-r--r--libvaladoc/api/typeparameter.vala61
-rw-r--r--libvaladoc/api/typereference.vala167
-rw-r--r--libvaladoc/api/typesymbol.vala112
-rw-r--r--libvaladoc/api/visitor.vala171
45 files changed, 5854 insertions, 0 deletions
diff --git a/libvaladoc/api/array.vala b/libvaladoc/api/array.vala
new file mode 100644
index 000000000..8e3cbe5fb
--- /dev/null
+++ b/libvaladoc/api/array.vala
@@ -0,0 +1,69 @@
+/* array.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an array declaration.
+ */
+public class Valadoc.Api.Array : Item {
+
+ /**
+ * The element type.
+ */
+ public Item data_type {
+ set;
+ get;
+ }
+
+ public Array (Item parent, void* data) {
+ base (data);
+
+ this.parent = parent;
+ }
+
+ private inline bool element_is_owned () {
+ TypeReference reference = data_type as TypeReference;
+ if (reference == null) {
+ return true;
+ }
+
+ return !reference.is_unowned && !reference.is_weak;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ SignatureBuilder builder = new SignatureBuilder ();
+ if (element_is_owned ()) {
+ builder.append_content (data_type.signature);
+ } else {
+ builder.append ("(", false);
+ builder.append_content (data_type.signature, false);
+ builder.append (")", false);
+ }
+ builder.append ("[]", false);
+ return builder.get ();
+ }
+}
diff --git a/libvaladoc/api/attribute.vala b/libvaladoc/api/attribute.vala
new file mode 100644
index 000000000..da6591992
--- /dev/null
+++ b/libvaladoc/api/attribute.vala
@@ -0,0 +1,108 @@
+/* attribute.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+public class Valadoc.Api.Attribute : Item {
+ private Vala.ArrayList<AttributeArgument> args = new Vala.ArrayList<AttributeArgument> ();
+ private SourceFile file;
+
+ public string name {
+ private set;
+ get;
+ }
+
+ public Attribute (Node parent, SourceFile file, string name, void* data) {
+ base (data);
+
+ this.parent = parent;
+ this.name = name;
+ this.file = file;
+ }
+
+ public AttributeArgument? get_argument (string name) {
+ if (args != null) {
+ foreach (AttributeArgument arg in args) {
+ if (arg.name == name) {
+ return arg;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public AttributeArgument add_boolean (string name, bool value, void* data = null) {
+ AttributeArgument arg = new AttributeArgument.boolean (this, file, name, value, data);
+ args.add (arg);
+ return arg;
+ }
+
+ public AttributeArgument add_integer (string name, int value, void* data = null) {
+ AttributeArgument arg = new AttributeArgument.integer (this, file, name, value, data);
+ args.add (arg);
+ return arg;
+ }
+
+ public AttributeArgument add_double (string name, double value, void* data = null) {
+ AttributeArgument arg = new AttributeArgument.double (this, file, name, value, data);
+ args.add (arg);
+ return arg;
+ }
+
+ public AttributeArgument add_string (string name, string value, void* data = null) {
+ AttributeArgument arg = new AttributeArgument.string (this, file, name, value, data);
+ args.add (arg);
+ return arg;
+ }
+
+ public SourceFile get_source_file () {
+ return file;
+ }
+
+ protected override Inline build_signature () {
+ SignatureBuilder builder = new SignatureBuilder ();
+
+ builder.append_attribute ("[");
+ builder.append_type_name (name);
+
+ if (args.size > 0) {
+ builder.append_attribute ("(");
+ bool first = true;
+
+ foreach (AttributeArgument arg in args) {
+ if (first == false) {
+ builder.append_attribute (", ");
+ }
+ builder.append_content (arg.signature);
+ first = false;
+ }
+ builder.append_attribute (")");
+ }
+
+ builder.append_attribute ("]");
+
+ return builder.get ();
+ }
+}
+
diff --git a/libvaladoc/api/attributeargument.vala b/libvaladoc/api/attributeargument.vala
new file mode 100644
index 000000000..1a3b01fab
--- /dev/null
+++ b/libvaladoc/api/attributeargument.vala
@@ -0,0 +1,132 @@
+/* attributeargument.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+public class Valadoc.Api.AttributeArgument : Item {
+ public enum Type {
+ BOOLEAN,
+ INTEGER,
+ DOUBLE,
+ STRING
+ }
+
+ private SourceFile file;
+
+ public string name {
+ private set;
+ get;
+ }
+
+ public AttributeArgument.Type argument_type {
+ private set;
+ get;
+ }
+
+ public string value {
+ private set;
+ get;
+ }
+
+ public AttributeArgument.boolean (Attribute parent, SourceFile file, string name, bool value, void* data) {
+ this (parent, file, name, Type.BOOLEAN, value.to_string (), data);
+ }
+
+ public AttributeArgument.integer (Attribute parent, SourceFile file, string name, int value, void* data) {
+ this (parent, file, name, Type.INTEGER, value.to_string (), data);
+ }
+
+ public AttributeArgument.double (Attribute parent, SourceFile file, string name, double value, void* data) {
+ this (parent, file, name, Type.DOUBLE, value.to_string (), data);
+ }
+
+ public AttributeArgument.string (Attribute parent, SourceFile file, string name, string value, void* data) {
+ this (parent, file, name, Type.STRING, value, data);
+ }
+
+ private AttributeArgument (Attribute parent, SourceFile file, string name, Type type, string value, void* data) {
+ base (data);
+
+ this.argument_type = type;
+ this.parent = parent;
+ this.value = value;
+ this.file = file;
+ this.name = name;
+ }
+
+ public SourceFile get_source_file () {
+ return file;
+ }
+
+ public bool get_value_as_boolean () {
+ assert (argument_type == Type.BOOLEAN);
+
+ bool tmp;
+
+ if (bool.try_parse (value, out tmp)) {
+ return tmp;
+ }
+
+ assert_not_reached ();
+ }
+
+ public int get_value_as_integer () {
+ assert (argument_type == Type.INTEGER);
+
+ double tmp;
+
+ if (global::double.try_parse (value, out tmp) && tmp >= int.MIN && tmp <= int.MAX) {
+ return (int) tmp;
+ }
+
+ assert_not_reached ();
+ }
+
+ public double get_value_as_double () {
+ assert (argument_type == Type.DOUBLE);
+
+ double tmp;
+
+ if (global::double.try_parse (value, out tmp)) {
+ return tmp;
+ }
+
+ assert_not_reached ();
+ }
+
+ public string get_value_as_string () {
+ assert (argument_type == Type.STRING);
+
+ return value;
+ }
+
+ protected override Inline build_signature () {
+ SignatureBuilder builder = new SignatureBuilder ();
+
+ builder.append_attribute (name);
+ builder.append_attribute ("=");
+ builder.append_literal (value);
+
+ return builder.get ();
+ }
+}
diff --git a/libvaladoc/api/browsable.vala b/libvaladoc/api/browsable.vala
new file mode 100644
index 000000000..7ae9b80fb
--- /dev/null
+++ b/libvaladoc/api/browsable.vala
@@ -0,0 +1,33 @@
+/* browsable.vala
+ *
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+/**
+ * Specifies whether users are able to browse the item.
+ */
+public interface Valadoc.Api.Browsable : Item {
+
+ /**
+ * Specifies whether users are able to browse the item.
+ */
+ public abstract bool is_browsable (Settings settings);
+}
diff --git a/libvaladoc/api/callable.vala b/libvaladoc/api/callable.vala
new file mode 100644
index 000000000..29d965dd0
--- /dev/null
+++ b/libvaladoc/api/callable.vala
@@ -0,0 +1,48 @@
+/* callable.vala
+ *
+ * Copyright (C) 2012 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc;
+
+/**
+ * Used to translate imported C-documentation
+ */
+public interface Valadoc.Api.Callable : Symbol {
+ /**
+ * The return type of this symbol.
+ *
+ * @return The return type of this symbol or null for void
+ */
+ public abstract TypeReference? return_type {
+ set;
+ get;
+ }
+
+ /**
+ * Used to avoid warnings for implicit parameters
+ */
+ internal abstract string? implicit_array_length_cparameter_name {
+ get;
+ set;
+ }
+}
+
diff --git a/libvaladoc/api/childsymbolregistrar.vala b/libvaladoc/api/childsymbolregistrar.vala
new file mode 100644
index 000000000..75b072d19
--- /dev/null
+++ b/libvaladoc/api/childsymbolregistrar.vala
@@ -0,0 +1,98 @@
+/* childsymbolregistrar.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Api;
+
+public class Valadoc.Api.ChildSymbolRegistrar : Visitor {
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_tree (Api.Tree item) {
+ item.accept_children (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_package (Package item) {
+ item.accept_all_children (this, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_namespace (Namespace item) {
+ item.accept_all_children (this, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_interface (Interface item) {
+ Vala.Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
+ foreach (var type_ref in interfaces) {
+ ((Interface) type_ref.data_type).register_related_interface (item);
+ }
+
+ if (item.base_type != null) {
+ ((Class) item.base_type.data_type).register_derived_interface (item);
+ }
+
+ item.accept_all_children (this, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_class (Class item) {
+ Vala.Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
+ foreach (TypeReference type_ref in interfaces) {
+ ((Interface) type_ref.data_type).register_implementation (item);
+ }
+
+ if (item.base_type != null) {
+ ((Class) item.base_type.data_type).register_child_class (item);
+ }
+
+ item.accept_all_children (this, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_struct (Struct item) {
+ if (item.base_type != null) {
+ ((Struct) item.base_type.data_type).register_child_struct (item);
+ }
+
+ item.accept_all_children (this, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void visit_property (Property item) {
+ item.accept_all_children (this, false);
+ }
+}
+
diff --git a/libvaladoc/api/class.vala b/libvaladoc/api/class.vala
new file mode 100644
index 000000000..4ef99ea14
--- /dev/null
+++ b/libvaladoc/api/class.vala
@@ -0,0 +1,360 @@
+/* class.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a class declaration.
+ */
+public class Valadoc.Api.Class : TypeSymbol {
+ private Vala.ArrayList<TypeReference> interfaces;
+
+ private string? dbus_name;
+ private string? take_value_function_cname;
+ private string? get_value_function_cname;
+ private string? set_value_function_cname;
+ private string? unref_function_name;
+ private string? ref_function_name;
+ private string? free_function_name;
+ private string? finalize_function_name;
+ private string? param_spec_function_name;
+ private string? type_id;
+ private string? is_class_type_macro_name;
+ private string? class_type_macro_name;
+ private string? class_macro_name;
+ private string? private_cname;
+ private string? cname;
+
+ public Class (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? private_cname, string? class_macro_name,
+ string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name,
+ string? type_function_name, string? class_type_macro_name, string? is_class_type_macro_name,
+ string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name,
+ string? unref_function_name, string? free_function_name, string? finalize_function_name,
+ string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname,
+ bool is_fundamental, bool is_abstract, bool is_basic_type, void* data)
+ {
+ base (parent, file, name, accessibility, comment, type_macro_name,
+ is_type_macro_name, type_cast_macro_name, type_function_name, is_basic_type, data);
+
+ this.interfaces = new Vala.ArrayList<TypeReference> ();
+
+ this.is_class_type_macro_name = is_class_type_macro_name;
+ this.class_type_macro_name = class_type_macro_name;
+ this.class_macro_name = class_macro_name;
+ this.private_cname = private_cname;
+ this.dbus_name = dbus_name;
+ this.type_id = type_id;
+ this.cname = cname;
+
+ this.param_spec_function_name = param_spec_function_name;
+
+ this.unref_function_name = unref_function_name;
+ this.ref_function_name = ref_function_name;
+ this.finalize_function_name = finalize_function_name;
+ this.free_function_name = free_function_name;
+
+ this.take_value_function_cname = take_value_function_cname;
+ this.get_value_function_cname = get_value_function_cname;
+ this.set_value_function_cname = set_value_function_cname;
+
+ this.is_fundamental = is_fundamental;
+ this.is_abstract = is_abstract;
+ }
+
+ /**
+ * Specifies the base class.
+ */
+ public TypeReference? base_type {
+ set;
+ get;
+ }
+
+ /**
+ * Returns the name of this class as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the name of this class' private data structure as it is used in C.
+ */
+ public string? get_private_cname () {
+ return private_cname;
+ }
+
+ /**
+ * Returns the C symbol representing the runtime type id for this data type.
+ */
+ public string? get_type_id () {
+ return type_id;
+ }
+
+ /**
+ * Returns the C function name that increments the reference count of
+ * instances of this data type.
+ *
+ * @return the name of the C function or null if this data type does not
+ * support reference counting
+ */
+ public string? get_ref_function_cname () {
+ return ref_function_name;
+ }
+
+ /**
+ * Returns the C function name that decrements the reference count of
+ * instances of this data type.
+ *
+ * @return the name of the C function or null if this data type does not
+ * support reference counting
+ */
+ public string? get_unref_function_cname () {
+ return unref_function_name;
+ }
+
+ /**
+ * Returns the C function name that frees the
+ * instances of this data type.
+ *
+ * @return the name of the C function or null
+ */
+ public string? get_free_function_name () {
+ return free_function_name;
+ }
+
+ /**
+ * Returns the C function name that finalizes the
+ * instances of this data type.
+ *
+ * @return the name of the C function or null
+ */
+ public string? get_finalize_function_name () {
+ return finalize_function_name;
+ }
+
+ /**
+ * Returns the cname of the GValue parameter spec function.
+ */
+ public string? get_param_spec_function_cname () {
+ return param_spec_function_name;
+ }
+
+ /**
+ * Returns the cname of the GValue setter function.
+ */
+ public string? get_set_value_function_cname () {
+ return set_value_function_cname;
+ }
+
+ /**
+ * Returns the cname of the GValue getter function.
+ */
+ public string? get_get_value_function_cname () {
+ return get_value_function_cname;
+ }
+
+ /**
+ * Returns the cname of the GValue taker function.
+ */
+ public string? get_take_value_function_cname () {
+ return take_value_function_cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string? get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns the class struct.
+ */
+ public string get_class_macro_name () {
+ return class_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns the type of the class.
+ */
+ public string get_class_type_macro_name () {
+ return class_type_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns whether a class instance is of a given type.
+ */
+ public string get_is_class_type_macro_name () {
+ return is_class_type_macro_name;
+ }
+
+ /**
+ * Returns a list of all newly implemented interfaces.
+ *
+ * @see get_full_implemented_interface_list
+ */
+ public Vala.Collection<TypeReference> get_implemented_interface_list () {
+ return this.interfaces;
+ }
+
+ private Vala.Collection<TypeReference> _full_implemented_interfaces = null;
+
+ /**
+ * Returns a list of all implemented interfaces.
+ *
+ * @see get_implemented_interface_list
+ */
+ public Vala.Collection<TypeReference> get_full_implemented_interface_list () {
+ if (_full_implemented_interfaces == null) {
+ _full_implemented_interfaces = new Vala.ArrayList<TypeReference> ();
+ _full_implemented_interfaces.add_all (this.interfaces);
+
+ if (base_type != null) {
+ _full_implemented_interfaces.add_all (((Class) base_type.data_type).get_full_implemented_interface_list ());
+ }
+ }
+
+ return _full_implemented_interfaces;
+ }
+
+ public void add_interface (TypeReference iface) {
+ interfaces.add (iface);
+ }
+
+ /**
+ * Specifies whether this class is abstract.
+ */
+ public bool is_abstract {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether this class is fundamental.
+ */
+ public bool is_fundamental {
+ private set;
+ get;
+ }
+
+ public bool is_compact {
+ get {
+ return base_type == null && get_attribute ("Compact") != null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type { get { return NodeType.CLASS; } }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_class (this);
+ }
+
+ private Vala.Set<Interface> _known_derived_interfaces = new Vala.HashSet<Interface> ();
+ private Vala.Set<Class> _known_child_classes = new Vala.HashSet<Class> ();
+
+ /**
+ * Returns a list of all known classes based on this class
+ */
+ public Vala.Collection<Class> get_known_child_classes () {
+ return _known_child_classes;
+ }
+
+ /**
+ * Returns a list of all known interfaces based on this class
+ */
+ public Vala.Collection<Interface> get_known_derived_interfaces () {
+ return _known_derived_interfaces;
+ }
+
+ public void register_derived_interface (Interface iface) {
+ _known_derived_interfaces.add (iface);
+ }
+
+ public void register_child_class (Class cl) {
+ if (this.base_type != null) {
+ ((Class) this.base_type.data_type).register_child_class (cl);
+ }
+
+ _known_child_classes.add (cl);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ if (is_abstract) {
+ signature.append_keyword ("abstract");
+ }
+ signature.append_keyword ("class");
+ signature.append_symbol (this);
+
+ var type_parameters = get_children_by_type (NodeType.TYPE_PARAMETER, false);
+ if (type_parameters.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_parameters) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ bool first = true;
+ if (base_type != null) {
+ signature.append (":");
+
+ signature.append_content (base_type.signature);
+ first = false;
+ }
+
+ if (interfaces.size > 0) {
+ if (first) {
+ signature.append (":");
+ }
+
+ foreach (Item implemented_interface in interfaces) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (implemented_interface.signature);
+ first = false;
+ }
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/constant.vala b/libvaladoc/api/constant.vala
new file mode 100644
index 000000000..0ff79f261
--- /dev/null
+++ b/libvaladoc/api/constant.vala
@@ -0,0 +1,81 @@
+/* constant.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a type member with a constant value.
+ */
+public class Valadoc.Api.Constant : Member {
+ private string? cname;
+
+ /**
+ * The data type of this constant.
+ */
+ public TypeReference constant_type {
+ set;
+ get;
+ }
+
+ public Constant (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, void* data)
+ {
+ base (parent, file, name, accessibility, comment, data);
+
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this constant as it is used in C.
+ */
+ public string get_cname () {
+ return cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_keyword (accessibility.to_string ())
+ .append_keyword ("const")
+ .append_content (constant_type.signature)
+ .append_symbol (this)
+ .get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.CONSTANT; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_constant (this);
+ }
+}
+
diff --git a/libvaladoc/api/delegate.vala b/libvaladoc/api/delegate.vala
new file mode 100644
index 000000000..9db4d9f10
--- /dev/null
+++ b/libvaladoc/api/delegate.vala
@@ -0,0 +1,142 @@
+/* delegate.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+
+/**
+ * Represents a Delegate.
+ */
+public class Valadoc.Api.Delegate : TypeSymbol, Callable {
+ private string? cname;
+
+ /**
+ * {@inheritDoc}
+ */
+ internal string? implicit_array_length_cparameter_name {
+ get;
+ set;
+ }
+
+
+ public Delegate (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, bool is_static, void* data)
+ {
+ base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
+
+ this.is_static = is_static;
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this delegate as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TypeReference? return_type {
+ set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.DELEGATE; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_delegate (this);
+ }
+
+ /**
+ * Specifies whether this delegate is static
+ */
+ public bool is_static {
+ private set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ signature.append_keyword ("delegate");
+ signature.append_content (return_type.signature);
+ signature.append_symbol (this);
+
+ var type_parameters = get_children_by_type (NodeType.TYPE_PARAMETER);
+ if (type_parameters.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_parameters) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ signature.append ("(");
+
+ bool first = true;
+ foreach (Node param in get_children_by_type (NodeType.FORMAL_PARAMETER, false)) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, !first);
+ first = false;
+ }
+
+ signature.append (")", false);
+
+ var exceptions = get_children_by_types ({NodeType.ERROR_DOMAIN, NodeType.CLASS});
+ if (exceptions.size > 0) {
+ signature.append_keyword ("throws");
+ first = true;
+ foreach (Node param in exceptions) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_type (param);
+ first = false;
+ }
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/driver.vala b/libvaladoc/api/driver.vala
new file mode 100644
index 000000000..dd09ed388
--- /dev/null
+++ b/libvaladoc/api/driver.vala
@@ -0,0 +1,42 @@
+/* driver.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Api;
+
+/**
+ * A plugin register function for drivers
+ *
+ * @see ModuleLoader
+ */
+[CCode (has_target = false)]
+public delegate Type Valadoc.DriverRegisterFunction (ModuleLoader module_loader);
+
+
+
+public interface Valadoc.Driver : Object {
+ public abstract void write_gir (Settings settings, ErrorReporter reporter);
+
+ public abstract Api.Tree? build (Settings settings, ErrorReporter reporter);
+}
+
+
diff --git a/libvaladoc/api/enum.vala b/libvaladoc/api/enum.vala
new file mode 100644
index 000000000..cbadb1971
--- /dev/null
+++ b/libvaladoc/api/enum.vala
@@ -0,0 +1,71 @@
+/* enum.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an enum declaration.
+ */
+public class Valadoc.Api.Enum : TypeSymbol {
+ private string cname;
+
+ public Enum (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? type_macro_name,
+ string? type_function_name, void* data)
+ {
+ base (parent, file, name, accessibility, comment, type_macro_name, null, null,
+ type_function_name, false, data);
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this enum as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type { get { return NodeType.ENUM; } }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_enum (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_keyword (accessibility.to_string ())
+ .append_keyword ("enum")
+ .append_symbol (this)
+ .get ();
+ }
+}
+
diff --git a/libvaladoc/api/enumvalue.vala b/libvaladoc/api/enumvalue.vala
new file mode 100644
index 000000000..e3ec568b9
--- /dev/null
+++ b/libvaladoc/api/enumvalue.vala
@@ -0,0 +1,114 @@
+/* enumvalue.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an enum member.
+ */
+public class Valadoc.Api.EnumValue: Symbol {
+ private SourceComment? source_comment;
+ private string? cname;
+
+ public Content.Run default_value {
+ get;
+ set;
+ }
+
+ /**
+ * Specifies whether the parameter has a default value
+ */
+ public bool has_default_value {
+ get {
+ return default_value != null;
+ }
+ }
+
+ public EnumValue (Enum parent, SourceFile file, string name, SourceComment? comment, string? cname, void* data) {
+ base (parent, file, name, parent.accessibility, data);
+
+ this.source_comment = comment;
+ this.cname = cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ return ;
+ }
+
+ if (source_comment != null) {
+ documentation = parser.parse (this, source_comment);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ parser.check (this, documentation);
+ }
+
+ base.check_comments (settings, parser);
+ }
+
+ /**
+ * Returns the name of this enum value as it is used in C.
+ */
+ public string get_cname () {
+ return cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type { get { return NodeType.ENUM_VALUE; } }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_enum_value (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var builder = new SignatureBuilder ()
+ .append_symbol (this);
+
+ if (has_default_value) {
+ builder.append ("=");
+ builder.append_content (default_value);
+ }
+
+ return builder.get ();
+ }
+}
+
diff --git a/libvaladoc/api/errorcode.vala b/libvaladoc/api/errorcode.vala
new file mode 100644
index 000000000..2d10fb6a1
--- /dev/null
+++ b/libvaladoc/api/errorcode.vala
@@ -0,0 +1,107 @@
+/* errorcode.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an errordomain member in the source code.
+ */
+public class Valadoc.Api.ErrorCode : Symbol {
+ private SourceComment? source_comment;
+ private string? dbus_name;
+ private string? cname;
+
+ public ErrorCode (ErrorDomain parent, SourceFile file, string name, SourceComment? comment,
+ string? cname, string? dbus_name, void* data)
+ {
+ base (parent, file, name, parent.accessibility, data);
+
+ this.source_comment = comment;
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ return ;
+ }
+
+ if (source_comment != null) {
+ documentation = parser.parse (this, source_comment);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ parser.check (this, documentation);
+ }
+
+ base.check_comments (settings, parser);
+ }
+
+ /**
+ * Returns the name of this class as it is used in C.
+ */
+ public string get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.ERROR_CODE; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_error_code (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_symbol (this)
+ .get ();
+ }
+}
+
diff --git a/libvaladoc/api/errordomain.vala b/libvaladoc/api/errordomain.vala
new file mode 100644
index 000000000..c469bf3a8
--- /dev/null
+++ b/libvaladoc/api/errordomain.vala
@@ -0,0 +1,100 @@
+/* errordomain.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an error domain declaration.
+ */
+public class Valadoc.Api.ErrorDomain : TypeSymbol {
+ private string? quark_function_name;
+ private string? quark_macro_name;
+ private string? dbus_name;
+ private string? cname;
+
+ public ErrorDomain (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? quark_macro_name,
+ string? quark_function_name, string? dbus_name, void* data)
+ {
+ base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
+
+ this.quark_function_name = quark_function_name;
+ this.quark_macro_name = quark_macro_name;
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this errordomain as it is used in C.
+ */
+ public string? get_cname () {
+ return this.cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string? get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * Gets the name of the quark() function which represents the error domain
+ */
+ public string get_quark_function_name () {
+ return quark_function_name;
+ }
+
+ /**
+ * Gets the name of the quark macro which represents the error domain
+ */
+ public string get_quark_macro_name () {
+ return quark_macro_name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.ERROR_DOMAIN; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_error_domain (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_keyword (accessibility.to_string ())
+ .append_keyword ("errordomain")
+ .append_symbol (this)
+ .get ();
+ }
+}
+
diff --git a/libvaladoc/api/field.vala b/libvaladoc/api/field.vala
new file mode 100644
index 000000000..d7a87a24d
--- /dev/null
+++ b/libvaladoc/api/field.vala
@@ -0,0 +1,110 @@
+/* field.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a field.
+ */
+public class Valadoc.Api.Field : Member {
+ private string? cname;
+
+ public Field (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, bool is_static, bool is_volatile,
+ void* data)
+ {
+ base (parent, file, name, accessibility, comment, data);
+
+ this.is_static = !(parent is Namespace) && is_static;
+ this.is_volatile = is_volatile;
+
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this field as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * The field type.
+ *
+ * @return The field type or null for void
+ */
+ public TypeReference? field_type {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies whether the field is static.
+ */
+ public bool is_static {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether the field is volatile.
+ */
+ public bool is_volatile {
+ private set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ if (is_static) {
+ signature.append_keyword ("static");
+ }
+ if (is_volatile) {
+ signature.append_keyword ("volatile");
+ }
+
+ signature.append_content (field_type.signature);
+ signature.append_symbol (this);
+ return signature.get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.FIELD; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_field (this);
+ }
+}
+
diff --git a/libvaladoc/api/formalparameter.vala b/libvaladoc/api/formalparameter.vala
new file mode 100644
index 000000000..58c4c42cd
--- /dev/null
+++ b/libvaladoc/api/formalparameter.vala
@@ -0,0 +1,155 @@
+/* formalparameter.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a formal parameter in method, signal and delegate signatures.
+ */
+public class Valadoc.Api.FormalParameter : Symbol {
+ public Content.Run default_value {
+ get;
+ set;
+ }
+
+ /**
+ * Used to translate imported C-documentation
+ */
+ internal string? implicit_array_length_cparameter_name {
+ get;
+ set;
+ }
+
+ /**
+ * Used to translate imported C-documentation
+ */
+ internal string? implicit_closure_cparameter_name {
+ get;
+ set;
+ }
+
+ /**
+ * Used to translate imported C-documentation
+ */
+ internal string? implicit_destroy_cparameter_name {
+ get;
+ set;
+ }
+
+ private FormalParameterType type;
+
+ public FormalParameter (Node parent, SourceFile file, string? name, SymbolAccessibility accessibility, FormalParameterType type, bool ellipsis, void* data) {
+ base (parent, file, name, accessibility, data);
+ assert ((name == null && ellipsis) || (name != null && !ellipsis));
+
+ this.ellipsis = ellipsis;
+ this.type = type;
+ }
+
+ /**
+ * Specifies whether the parameter direction is out
+ */
+ public bool is_out {
+ get {
+ return type == FormalParameterType.OUT;
+ }
+ }
+
+ /**
+ * Specifies whether the parameter direction is ref
+ */
+ public bool is_ref {
+ get {
+ return type == FormalParameterType.REF;
+ }
+ }
+
+ /**
+ * Specifies whether the parameter has a default value
+ */
+ public bool has_default_value {
+ get {
+ return default_value != null;
+ }
+ }
+
+ /**
+ * The parameter type.
+ *
+ * @return The parameter type or null for void
+ */
+ public TypeReference? parameter_type {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies whether the methods accepts a variable number of arguments
+ */
+ public bool ellipsis {
+ private set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.FORMAL_PARAMETER; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_formal_parameter (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ if (ellipsis) {
+ signature.append ("...");
+ } else {
+ if (is_out) {
+ signature.append_keyword ("out");
+ } else if (is_ref) {
+ signature.append_keyword ("ref");
+ }
+
+ signature.append_content (parameter_type.signature);
+ signature.append (name);
+
+ if (has_default_value) {
+ signature.append ("=");
+ signature.append_content (default_value);
+ }
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/formalparametertype.vala b/libvaladoc/api/formalparametertype.vala
new file mode 100644
index 000000000..d95cc0f5f
--- /dev/null
+++ b/libvaladoc/api/formalparametertype.vala
@@ -0,0 +1,44 @@
+/* formalparametertype.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+public enum Valadoc.Api.FormalParameterType {
+ IN,
+ OUT,
+ REF;
+
+ public string to_string () {
+ switch (this) {
+ case FormalParameterType.OUT:
+ return "out";
+
+ case FormalParameterType.REF:
+ return "ref";
+
+ case FormalParameterType.IN:
+ return "";
+
+ }
+
+ assert_not_reached ();
+ }
+}
+
diff --git a/libvaladoc/api/girsourcecomment.vala b/libvaladoc/api/girsourcecomment.vala
new file mode 100644
index 000000000..d6ffa5ae6
--- /dev/null
+++ b/libvaladoc/api/girsourcecomment.vala
@@ -0,0 +1,57 @@
+/* sourcecomment.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+/**
+ * A documentation comment used by valadoc
+ */
+public class Valadoc.Api.GirSourceComment : SourceComment {
+ private Vala.Map<string, SourceComment> parameters = new Vala.HashMap<string, SourceComment> (str_hash, str_equal);
+
+ public string? instance_param_name { set; get; }
+ public SourceComment? return_comment { set; get; }
+ public SourceComment? deprecated_comment { set; get; }
+ public SourceComment? version_comment { get; set; }
+ public SourceComment? stability_comment { get; set; }
+
+
+ public Vala.MapIterator<string, SourceComment> parameter_iterator () {
+ return parameters.map_iterator ();
+ }
+
+ public void add_parameter_content (string param_name, SourceComment comment) {
+ this.parameters.set (param_name, comment);
+ }
+
+ public SourceComment? get_parameter_comment (string param_name) {
+ if (parameters == null) {
+ return null;
+ }
+
+ return parameters.get (param_name);
+ }
+
+ public GirSourceComment (string content, SourceFile file, int first_line, int first_column, int last_line, int last_column) {
+ base (content, file, first_line, first_column, last_line, last_column);
+ }
+}
+
diff --git a/libvaladoc/api/interface.vala b/libvaladoc/api/interface.vala
new file mode 100644
index 000000000..ede696cf9
--- /dev/null
+++ b/libvaladoc/api/interface.vala
@@ -0,0 +1,213 @@
+/* interface.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a interface declaration in the source code.
+ */
+public class Valadoc.Api.Interface : TypeSymbol {
+ private string? interface_macro_name;
+ private string? dbus_name;
+ private string? cname;
+
+
+ public Interface (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? type_macro_name, string? is_type_macro_name,
+ string? type_cast_macro_name, string? type_function_name, string interface_macro_name,
+ string? dbus_name, void* data)
+ {
+ base (parent, file, name, accessibility, comment, type_macro_name, is_type_macro_name,
+ type_cast_macro_name, type_function_name, false, data);
+
+ this.interface_macro_name = interface_macro_name;
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+ }
+
+ /**
+ * A list of preconditioned interfaces
+ */
+ private Vala.ArrayList<TypeReference> interfaces = new Vala.ArrayList<TypeReference> ();
+
+ /**
+ * Add a newpreconditioned interface to the list
+ */
+ public void add_interface (TypeReference iface) {
+ interfaces.add (iface);
+ }
+
+ /**
+ * Returns a list of newly preconditioned interfaces
+ */
+ public Vala.Collection<TypeReference> get_implemented_interface_list () {
+ return this.interfaces;
+ }
+
+
+ /**
+ * A list of all preconditioned interfaces
+ */
+ private Vala.Collection<TypeReference> _full_implemented_interfaces = null;
+
+ /**
+ * Returns a list of all preconditioned interfaces
+ */
+ public Vala.Collection<TypeReference> get_full_implemented_interface_list () {
+ if (_full_implemented_interfaces == null) {
+ _full_implemented_interfaces = new Vala.ArrayList<TypeReference> ();
+ _full_implemented_interfaces.add_all (this.interfaces);
+
+ if (base_type != null) {
+ _full_implemented_interfaces.add_all (((Class) base_type.data_type).get_full_implemented_interface_list ());
+ }
+ }
+
+ return _full_implemented_interfaces;
+ }
+
+ /**
+ * Returns the name of this interface as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string? get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns the interface struct.
+ */
+ public string get_interface_macro_name () {
+ return interface_macro_name;
+ }
+
+ /**
+ * A preconditioned class or null
+ */
+ public TypeReference? base_type {
+ set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.INTERFACE; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_interface (this);
+ }
+
+ /**
+ * A list of all known related (sub-)interfaces
+ */
+ private Vala.Set<Interface> _known_related_interfaces = new Vala.HashSet<Interface> ();
+
+ /**
+ * A list of all known implementations of this interface
+ */
+ private Vala.Set<Class> _known_implementations = new Vala.HashSet<Class> ();
+
+ /**
+ * Returns a list of all known implementations of this interface
+ */
+ public Vala.Collection<Class> get_known_implementations () {
+ return _known_implementations;
+ }
+
+ /**
+ * Returns a list of all known related (sub-)interfaces
+ */
+ public Vala.Collection<Interface> get_known_related_interfaces () {
+ return _known_related_interfaces;
+ }
+
+ public void register_related_interface (Interface iface) {
+ _known_related_interfaces.add (iface);
+ }
+
+ public void register_implementation (Class cl) {
+ _known_implementations.add (cl);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ signature.append_keyword ("interface");
+ signature.append_symbol (this);
+
+ var type_parameters = get_children_by_type (NodeType.TYPE_PARAMETER, false);
+ if (type_parameters.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_parameters) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ bool first = true;
+ if (base_type != null) {
+ signature.append (":");
+
+ signature.append_content (base_type.signature);
+ first = false;
+ }
+
+ if (interfaces.size > 0) {
+ if (first) {
+ signature.append (":");
+ }
+
+ foreach (Item implemented_interface in interfaces) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (implemented_interface.signature);
+ first = false;
+ }
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/item.vala b/libvaladoc/api/item.vala
new file mode 100644
index 000000000..60967a7c1
--- /dev/null
+++ b/libvaladoc/api/item.vala
@@ -0,0 +1,70 @@
+/* item.vala
+ *
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a node in the api tree.
+ */
+public abstract class Valadoc.Api.Item : Object {
+ private Inline _signature;
+
+ public void* data {
+ private set;
+ get;
+ }
+
+ /**
+ * The parent of this item.
+ */
+ public Item parent {
+ protected set;
+ get;
+ }
+
+ public Item (void* data) {
+ this.data = data;
+ }
+
+ internal virtual void parse_comments (Settings settings, DocumentationParser parser) {
+ }
+
+ internal virtual void check_comments (Settings settings, DocumentationParser parser) {
+ }
+
+
+ /**
+ * The signature of this item.
+ */
+ public Inline signature {
+ get {
+ if (_signature == null) {
+ _signature = build_signature ();
+ }
+ return _signature;
+ }
+ }
+
+ protected abstract Inline build_signature ();
+}
+
diff --git a/libvaladoc/api/member.vala b/libvaladoc/api/member.vala
new file mode 100644
index 000000000..fcabbea6b
--- /dev/null
+++ b/libvaladoc/api/member.vala
@@ -0,0 +1,62 @@
+/* member.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+public abstract class Valadoc.Api.Member : Symbol {
+ private SourceComment? source_comment;
+
+ public Member (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, void* data)
+ {
+ base (parent, file, name, accessibility, data);
+
+ this.source_comment = comment;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ return ;
+ }
+
+ if (source_comment != null) {
+ documentation = parser.parse (this, source_comment);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ parser.check (this, documentation);
+ }
+
+ base.check_comments (settings, parser);
+ }
+}
diff --git a/libvaladoc/api/method.vala b/libvaladoc/api/method.vala
new file mode 100644
index 000000000..bccbac5fb
--- /dev/null
+++ b/libvaladoc/api/method.vala
@@ -0,0 +1,265 @@
+/* method.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a function or a method.
+ */
+public class Valadoc.Api.Method : Member, Callable {
+ private string? finish_function_cname;
+ private string? dbus_result_name;
+ private string? dbus_name;
+ private string? cname;
+
+ private MethodBindingType binding_type;
+
+ /**
+ * {@inheritDoc}
+ */
+ internal string? implicit_array_length_cparameter_name {
+ get;
+ set;
+ }
+
+
+ public Method (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? dbus_name, string? dbus_result_name,
+ string? finish_function_cname, MethodBindingType binding_type, bool is_yields,
+ bool is_dbus_visible, bool is_constructor, void* data)
+ {
+ base (parent, file, name, accessibility, comment, data);
+
+ this.finish_function_cname = finish_function_cname;
+ this.dbus_result_name = dbus_result_name;
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+
+ this.binding_type = binding_type;
+ this.is_dbus_visible = is_dbus_visible;
+ this.is_constructor = is_constructor;
+ this.is_yields = is_yields;
+ }
+
+ /**
+ * Returns the name of this method as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the name of the finish function as it is used in C.
+ */
+ public string? get_finish_function_cname () {
+ return finish_function_cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string get_dbus_name () {
+ return dbus_name;
+ }
+
+ public string get_dbus_result_name () {
+ return dbus_result_name;
+ }
+
+ /**
+ * Specifies the virtual or abstract method this method overrides.
+ */
+ public weak Method? base_method {
+ set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TypeReference? return_type {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies whether this method is asynchronous
+ */
+ public bool is_yields {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether this method is abstract
+ */
+ public bool is_abstract {
+ get {
+ return binding_type == MethodBindingType.ABSTRACT;
+ }
+ }
+
+ /**
+ * Specifies whether this method is virtual
+ */
+ public bool is_virtual {
+ get {
+ return binding_type == MethodBindingType.VIRTUAL;
+ }
+ }
+
+ /**
+ * Specifies whether this method overrides another one
+ */
+ public bool is_override {
+ get {
+ return binding_type == MethodBindingType.OVERRIDE;
+ }
+ }
+
+ /**
+ * Specifies whether this method is static
+ */
+ public bool is_static {
+ get {
+ return !is_constructor && binding_type == MethodBindingType.STATIC
+ && parent is Namespace == false;
+ }
+ }
+
+ /**
+ * Specifies whether this method is a creation method
+ */
+ public bool is_constructor {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether this method is inline
+ */
+ public bool is_inline {
+ get {
+ return binding_type == MethodBindingType.INLINE;
+ }
+ }
+
+ /**
+ * Specifies whether this method is visible for dbus
+ */
+ public bool is_dbus_visible {
+ private set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+
+ if (!is_constructor) {
+ if (is_static) {
+ signature.append_keyword ("static");
+ } else if (is_abstract) {
+ signature.append_keyword ("abstract");
+ } else if (is_override) {
+ signature.append_keyword ("override");
+ } else if (is_virtual) {
+ signature.append_keyword ("virtual");
+ }
+ if (is_inline) {
+ signature.append_keyword ("inline");
+ }
+ if (is_yields) {
+ signature.append_keyword ("async");
+ }
+
+ signature.append_content (return_type.signature);
+ }
+
+ signature.append_symbol (this);
+
+ var type_parameters = get_children_by_type (NodeType.TYPE_PARAMETER, false);
+ if (type_parameters.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_parameters) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ signature.append ("(");
+
+ bool first = true;
+ foreach (Node param in get_children_by_type (NodeType.FORMAL_PARAMETER, false)) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, !first);
+ first = false;
+ }
+
+ signature.append (")", false);
+
+ var exceptions = get_children_by_types ({NodeType.ERROR_DOMAIN, NodeType.CLASS});
+ if (exceptions.size > 0) {
+ signature.append_keyword ("throws");
+ first = true;
+ foreach (Node param in exceptions) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_type (param);
+ first = false;
+ }
+ }
+
+ return signature.get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get {
+ return is_constructor ? NodeType.CREATION_METHOD :
+ is_static ? NodeType.STATIC_METHOD : NodeType.METHOD;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_method (this);
+ }
+}
+
diff --git a/libvaladoc/api/methodbindingtype.vala b/libvaladoc/api/methodbindingtype.vala
new file mode 100644
index 000000000..c340c30b6
--- /dev/null
+++ b/libvaladoc/api/methodbindingtype.vala
@@ -0,0 +1,55 @@
+/* methodbindingtype.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Brosch Florian <flo.brosch@gmail.com>
+ */
+
+
+public enum Valadoc.MethodBindingType {
+ UNMODIFIED,
+ OVERRIDE,
+ ABSTRACT,
+ VIRTUAL,
+ INLINE,
+ STATIC;
+
+ public string to_string () {
+ switch (this) {
+ case OVERRIDE:
+ return "override";
+
+ case ABSTRACT:
+ return "abstract";
+
+ case VIRTUAL:
+ return "virtual";
+
+ case INLINE:
+ return "inline";
+
+ case STATIC:
+ return "static";
+
+ case UNMODIFIED:
+ return "";
+ }
+
+ assert_not_reached ();
+ }
+}
diff --git a/libvaladoc/api/namespace.vala b/libvaladoc/api/namespace.vala
new file mode 100644
index 000000000..7e3516605
--- /dev/null
+++ b/libvaladoc/api/namespace.vala
@@ -0,0 +1,96 @@
+/* namespace.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a namespace declaration.
+ */
+public class Valadoc.Api.Namespace : Symbol {
+ private SourceComment? source_comment;
+
+ public Namespace (Api.Node parent, SourceFile file, string? name, SourceComment? comment, void* data) {
+ base (parent, file, name, SymbolAccessibility.PUBLIC, data);
+
+ this.source_comment = comment;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ return ;
+ }
+
+ if (source_comment != null) {
+ documentation = parser.parse (this, source_comment);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ parser.check (this, documentation);
+ }
+
+ base.check_comments (settings, parser);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_keyword (accessibility.to_string ())
+ .append_keyword ("namespace")
+ .append_symbol (this)
+ .get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type { get { return NodeType.NAMESPACE; } }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_namespace (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override bool is_browsable (Settings settings) {
+ return has_visible_children (settings);
+ }
+}
+
diff --git a/libvaladoc/api/node.vala b/libvaladoc/api/node.vala
new file mode 100644
index 000000000..f1bbd2c62
--- /dev/null
+++ b/libvaladoc/api/node.vala
@@ -0,0 +1,723 @@
+/* node.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ * Copyright (C) 20011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+/**
+ * Represents a node in the api tree.
+ */
+public abstract class Valadoc.Api.Node : Item, Browsable, Documentation {
+ protected bool do_document = false;
+ private SourceFile file;
+
+ /**
+ * The name of the node
+ */
+ public string? name {
+ private set;
+ get;
+ }
+
+ public SourceFile get_source_file () {
+ return file;
+ }
+
+ /**
+ * Returns the type of this node
+ */
+ public abstract NodeType node_type { get; }
+
+ private Vala.Map<string, Node> per_name_children;
+ private Vala.Map<NodeType, Vala.List<Node>> per_type_children;
+
+
+ public Node (Node? parent, SourceFile? file, string? name, void* data) {
+ base (data);
+
+ per_name_children = new Vala.HashMap<string, Node> (str_hash, str_equal);
+ per_type_children = new Vala.HashMap<NodeType, Vala.List<Node>> ();
+
+ if (name != null && (is_keyword (name) || name[0].isdigit ())) {
+ this.name = "@" + name;
+ } else {
+ this.name = name;
+ }
+
+ this.parent = parent;
+ this.file = file;
+ }
+
+ /**
+ * Visits this node with the specified Visitor.
+ *
+ * @param visitor the visitor to be called while traversing
+ */
+ public abstract void accept (Visitor visitor);
+
+ /**
+ * {@inheritDoc}
+ */
+ // TODO: rename to is_visible
+ public abstract bool is_browsable (Settings settings);
+
+ /**
+ * {@inheritDoc}
+ */
+ public string? get_filename () {
+ if (file == null) {
+ return null;
+ }
+
+ return file.relative_path;
+ }
+
+ public void add_child (Symbol child) {
+ if (child.name != null) {
+ if (child.name[0] == '@') {
+ per_name_children.set (child.name.next_char (), child);
+ } else {
+ per_name_children.set (child.name, child);
+ }
+ } else {
+ // Special case for the root namespace
+ per_name_children.set ("", child);
+ }
+
+ Vala.List<Node> children = per_type_children.get (child.node_type);
+ if (children == null) {
+ children = new Vala.ArrayList<Node> ();
+ per_type_children.set (child.node_type, children);
+ }
+
+ children.add (child);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ do_document = true;
+
+ foreach (Node node in per_name_children.get_values ()) {
+ if (node.is_browsable (settings)) {
+ node.parse_comments (settings, parser);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+
+ foreach (Node node in per_name_children.get_values ()) {
+ if (node.is_browsable (settings)) {
+ node.check_comments (settings, parser);
+ }
+ }
+ }
+
+
+ /**
+ * Specifies whether this node has at least one visible child with the given type
+ *
+ * @param type a node type
+ */
+ public bool has_visible_children_by_type (NodeType type, Settings settings) {
+ Vala.List<Node>? all_children = per_type_children.get (type);
+ if (all_children != null) {
+ foreach (Node node in all_children) {
+ if (node.is_browsable (settings)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Specifies whether this node has at least one visible child with the given types
+ *
+ * @param types a list of node types
+ */
+ public bool has_visible_children_by_types (NodeType[] types, Settings settings) {
+ foreach (NodeType type in types) {
+ if (has_visible_children_by_type (type, settings)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Specifies whether this node has at least one visible child
+ */
+ public bool has_visible_children (Settings settings) {
+ return has_visible_children_by_types (per_type_children.get_keys ().to_array (), settings);
+ }
+
+ /**
+ * Specifies whether this node has at least one child with the given type
+ *
+ * @param type a node type
+ */
+ public bool has_children_by_type (NodeType type) {
+ Vala.List<Node>? all_children = per_type_children.get (type);
+ return all_children != null && !all_children.is_empty;
+ }
+
+ /**
+ * Specifies whether this node has at least one child with the given types
+ *
+ * @param types a list of node types
+ */
+ public bool has_children (NodeType[] types) {
+ foreach (NodeType type in types) {
+ if (has_children_by_type (type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns a list of all children with the given type.
+ *
+ * @param type a node type
+ * @param filtered specifies whether nodes which are not browsable should appear in the list
+ */
+ public Vala.List<Node> get_children_by_type (NodeType type, bool filtered = true) {
+ var children = new Vala.ArrayList<Node> ();
+
+ Vala.List<Node> all_children = per_type_children.get (type);
+ if (all_children != null) {
+ foreach (Node node in all_children) {
+ if (node.do_document || !filtered) {
+ children.add (node);
+ }
+ }
+ }
+
+ return children;
+ }
+
+ /**
+ * Returns a list of all children with the given types.
+ *
+ * @param types a list of node types
+ * @param filtered specifies whether nodes which are not browsable should appear in the list
+ */
+ public Vala.List<Node> get_children_by_types (NodeType[] types, bool filtered = true) {
+ var children = new Vala.ArrayList<Node> ();
+
+ foreach (NodeType type in types) {
+ children.add_all (get_children_by_type (type, filtered));
+ }
+
+ return children;
+ }
+
+ /**
+ * Visits all children of this node with the given type with the specified Visitor.
+ *
+ * @param type a node type
+ * @param visitor the visitor to be called while traversing
+ * @param filtered specifies whether nodes which are not browsable should appear in the list
+ */
+ public void accept_children_by_type (NodeType type, Visitor visitor, bool filtered = true) {
+ Vala.List<Node> all_children = per_type_children.get (type);
+ if (all_children != null) {
+ foreach (Node node in all_children) {
+ if (node.do_document || !filtered) {
+ node.accept (visitor);
+ }
+ }
+ }
+ }
+
+ /**
+ * Visits all children of this node with the given types with the specified Visitor.
+ *
+ * @param types a list of node types
+ * @param visitor the visitor to be called while traversing
+ * @param filtered specifies whether nodes which are not browsable should appear in the list
+ */
+ public void accept_children (NodeType[] types, Visitor visitor, bool filtered = true) {
+ foreach (NodeType type in types) {
+ accept_children_by_type (type, visitor, filtered);
+ }
+ }
+
+ /**
+ * Visits all children of this node with the specified Visitor.
+ *
+ * @param visitor the visitor to be called while traversing
+ * @param filtered specifies whether nodes which are not browsable should appear in the list
+ */
+ public void accept_all_children (Visitor visitor, bool filtered = true) {
+ foreach (Vala.List<Node> children in per_type_children.get_values ()) {
+ foreach (Node node in children) {
+ if (node.do_document || !filtered) {
+ node.accept (visitor);
+ }
+ }
+ }
+ }
+
+ public Node? find_by_name (string name) {
+ if (name[0] == '@') {
+ return per_name_children.get (name.next_char ());
+ } else {
+ return per_name_children.get (name);
+ }
+ }
+
+ private Namespace? _nspace = null;
+ private Package? _package = null;
+ private string _full_name = null;
+
+ /**
+ * The corresponding namespace
+ */
+ public Namespace? nspace {
+ get {
+ if (this._nspace == null) {
+ Api.Item ast = this;
+ while (ast is Valadoc.Api.Namespace == false) {
+ ast = ast.parent;
+ if (ast == null) {
+ return null;
+ }
+ }
+ this._nspace = (Valadoc.Api.Namespace)ast;
+ }
+ return this._nspace;
+ }
+ }
+
+ /**
+ * The corresponding package such as a vapi or gir file
+ */
+ public Package? package {
+ get {
+ if (this._package == null) {
+ Api.Item ast = this;
+ while (ast is Valadoc.Api.Package == false) {
+ ast = ast.parent;
+ if (ast == null) {
+ return null;
+ }
+ }
+ this._package = (Valadoc.Api.Package)ast;
+ }
+ return this._package;
+ }
+ }
+
+ public Content.Comment? documentation {
+ internal set;
+ get;
+ }
+
+ /**
+ * Returns canonicalized absolute name (GLib.FileStream for instance)
+ */
+ public string? get_full_name () {
+ if (this._full_name == null) {
+ if (this.name == null) {
+ return null;
+ }
+
+ GLib.StringBuilder full_name = new GLib.StringBuilder (this.name);
+
+ if (this.parent != null) {
+ for (Item pos = this.parent; pos is Package == false ; pos = pos.parent) {
+ string name = ((Node)pos).name;
+ if (name != null) {
+ full_name.prepend_unichar ('.');
+ full_name.prepend (name);
+ }
+ }
+ }
+ this._full_name = full_name.str;
+ }
+ return this._full_name;
+ }
+
+ /**
+ * A comparison function used to sort nodes in alphabetical order
+ */
+ public int compare_to (Node node) {
+ return strcmp (name, node.name);
+ }
+
+ private bool is_keyword (string name) {
+ switch (name[0]) {
+ case 'a':
+ switch (name[1]) {
+ case 'b':
+ return name == "abstract";
+
+ case 's':
+ if (name[2] == '\0') {
+ return true;
+ }
+
+ return name == "async";
+ }
+ break;
+
+ case 'b':
+ switch (name[1]) {
+ case 'a':
+ return name == "base";
+
+ case 'r':
+ return name == "break";
+ }
+ break;
+
+ case 'c':
+ switch (name[1]) {
+ case 'a':
+ switch (name[2]) {
+ case 's':
+ return name == "case";
+
+ case 't':
+ return name == "catch";
+ }
+ break;
+
+ case 'l':
+ return name == "class";
+
+ case 'o':
+ if (name[2] != 'n') {
+ return false;
+ }
+
+ switch (name[3]) {
+ case 's':
+ if (name[4] == 't') {
+ switch (name[5]) {
+ case '\0':
+ return true;
+
+ case 'r':
+ return name == "construct";
+ }
+ }
+ break;
+
+ case 't':
+ return name == "continue";
+ }
+ break;
+ }
+ break;
+
+ case 'd':
+ switch (name[1]) {
+ case 'e':
+ switch (name[2]) {
+ case 'f':
+ return name == "default";
+
+ case 'l':
+ if (name[3] != 'e') {
+ return false;
+ }
+
+ switch (name[4]) {
+ case 'g':
+ return name == "delegate";
+
+ case 't':
+ return name == "delete";
+ }
+ break;
+ }
+ break;
+
+ case 'o':
+ return name[2] == '\0';
+
+ case 'y':
+ return name == "dynamic";
+ }
+ break;
+
+ case 'e':
+ switch (name[1]) {
+ case 'l':
+ return name == "else";
+
+ case 'n':
+ switch (name[2]) {
+ case 's':
+ return name == "ensures";
+
+ case 'u':
+ return name == "enum";
+ }
+ break;
+
+ case 'r':
+ return name == "errordomain";
+
+ case 'x':
+ return name == "extern";
+ }
+ break;
+
+ case 'f':
+ switch (name[1]) {
+ case 'a':
+ return name == "false";
+
+ case 'i':
+ return name == "finally";
+
+ case 'o':
+ if (name[2] != 'r') {
+ return false;
+ }
+
+ switch (name[3]) {
+ case '\0':
+ return true;
+
+ case 'e':
+ return name == "foreach";
+ }
+ break;
+ }
+ break;
+
+ case 'g':
+ return name == "get";
+
+ case 'i':
+ switch (name[1]) {
+ case 'f':
+ return name[2] == '\0';
+
+ case 'n':
+ switch (name[2]) {
+ case '\0':
+ return true;
+
+ case 'l':
+ return name == "inline";
+
+ case 't':
+ return name == "interface" || name == "internal";
+ }
+ break;
+
+ case 's':
+ return name[2] == '\0';
+ }
+ break;
+
+ case 'l':
+ return name == "lock";
+
+ case 'n':
+ switch (name[1]) {
+ case 'a':
+ return name == "namespace";
+
+ case 'e':
+ return name == "new";
+
+ case 'u':
+ return name == "null";
+ }
+ break;
+
+ case 'o':
+ switch (name[1]) {
+ case 'u':
+ return name == "out";
+
+ case 'v':
+ return name == "override";
+
+ case 'w':
+ return name == "owned";
+ }
+ break;
+
+ case 'p':
+ switch (name[1]) {
+ case 'a':
+ return name == "params";
+
+ case 'r':
+ switch (name[2]) {
+ case 'i':
+ return name == "private";
+
+ case 'o':
+ return name == "protected";
+ }
+ break;
+ case 'u':
+ return name == "public";
+ }
+ break;
+
+ case 'r':
+ if (name[1] != 'e') {
+ return false;
+ }
+
+ switch (name[2]) {
+ case 'f':
+ return name[3] == '\0';
+
+ case 'q':
+ return name == "requires";
+
+ case 't':
+ return name == "return";
+ }
+ break;
+
+ case 's':
+ switch (name[1]) {
+ case 'e':
+ switch (name[2]) {
+ case 'a':
+ return name == "sealed";
+
+ case 't':
+ return name[3] == '\0';
+ }
+ break;
+
+ case 'i':
+ switch (name[2]) {
+ case 'g':
+ return name == "signal";
+ case 'z':
+ return name == "sizeof";
+ }
+ break;
+
+ case 't':
+ switch (name[2]) {
+ case 'a':
+ return name == "static";
+
+ case 'r':
+ return name == "struct";
+ }
+ break;
+
+ case 'w':
+ return name == "switch";
+ }
+ break;
+
+ case 't':
+ switch (name[1]) {
+ case 'h':
+ switch (name[2]) {
+ case 'i':
+ return name == "this";
+
+ case 'r':
+ if (name[3] == 'o' && name[4] == 'w') {
+ return name[5] == '\0' || (name[5] == 's' && name[6] == '\0');
+ }
+ break;
+ }
+ break;
+
+ case 'r':
+ switch (name[2]) {
+ case 'u':
+ return name == "true";
+
+ case 'y':
+ return name[3] == '\0';
+ }
+ break;
+
+ case 'y':
+ return name == "typeof";
+ }
+ break;
+
+ case 'u':
+ switch (name[1]) {
+ case 'n':
+ return name == "unowned";
+
+ case 's':
+ return name == "using";
+ }
+ break;
+
+ case 'v':
+ switch (name[1]) {
+ case 'a':
+ return name == "var";
+
+ case 'i':
+ return name == "virtual";
+
+ case 'o':
+ switch (name[2]) {
+ case 'i':
+ return name == "void";
+
+ case 'l':
+ return name == "volatile";
+ }
+ break;
+ }
+ break;
+
+ case 'w':
+ switch (name[1]) {
+ case 'e':
+ return name == "weak";
+
+ case 'h':
+ return name == "while";
+ }
+ break;
+
+ case 'y':
+ return name == "yield";
+ }
+
+ return false;
+ }
+}
+
diff --git a/libvaladoc/api/nodetype.vala b/libvaladoc/api/nodetype.vala
new file mode 100644
index 000000000..dc515fa25
--- /dev/null
+++ b/libvaladoc/api/nodetype.vala
@@ -0,0 +1,117 @@
+/* node.vala
+ *
+ * Copyright (C) 2008-2009 Didier Villevalois
+ * Copyright (C) 2007-20012 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+/**
+ * Specifies the context of a node.
+ */
+public enum Valadoc.Api.NodeType {
+ CLASS,
+ CONSTANT,
+ CREATION_METHOD,
+ DELEGATE,
+ ENUM,
+ ENUM_VALUE,
+ ERROR_CODE,
+ ERROR_DOMAIN,
+ FIELD,
+ FORMAL_PARAMETER,
+ INTERFACE,
+ METHOD,
+ NAMESPACE,
+ PACKAGE,
+ PROPERTY,
+ PROPERTY_ACCESSOR,
+ SIGNAL,
+ STATIC_METHOD,
+ STRUCT,
+ TYPE_PARAMETER;
+
+ public string to_string () {
+ switch (this) {
+ case CLASS:
+ return "CLASS";
+
+ case CONSTANT:
+ return "CONSTANT";
+
+ case CREATION_METHOD:
+ return "CREATION_METHOD";
+
+ case DELEGATE:
+ return "DELEGATE";
+
+ case ENUM:
+ return "ENUM";
+
+ case ENUM_VALUE:
+ return "ENUM_VALUE";
+
+ case ERROR_CODE:
+ return "ERROR_CODE";
+
+ case ERROR_DOMAIN:
+ return "ERROR_DOMAIN";
+
+ case FIELD:
+ return "FIELD";
+
+ case FORMAL_PARAMETER:
+ return "FORMAL_PARAMETER";
+
+ case INTERFACE:
+ return "INTERFACE";
+
+ case METHOD:
+ return "METHOD";
+
+ case NAMESPACE:
+ return "NAMESPACE";
+
+ case PACKAGE:
+ return "PACKAGE";
+
+ case PROPERTY:
+ return "PROPERTY";
+
+ case PROPERTY_ACCESSOR:
+ return "PROPERTY_ACCESSOR";
+
+ case SIGNAL:
+ return "SIGNAL";
+
+ case STATIC_METHOD:
+ return "STATIC_METHOD";
+
+ case STRUCT:
+ return "STRUCT";
+
+ case TYPE_PARAMETER:
+ return "TYPE_PARAMETER";
+
+ default:
+ assert_not_reached ();
+ }
+ }
+}
+
diff --git a/libvaladoc/api/ownership.vala b/libvaladoc/api/ownership.vala
new file mode 100644
index 000000000..eb4f5b0fc
--- /dev/null
+++ b/libvaladoc/api/ownership.vala
@@ -0,0 +1,47 @@
+/* ownership.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+public enum Valadoc.Api.Ownership {
+ DEFAULT,
+ UNOWNED,
+ OWNED,
+ WEAK;
+
+ public string to_string () {
+ switch (this) {
+ case Ownership.UNOWNED:
+ return "unowned";
+
+ case Ownership.OWNED:
+ return "owned";
+
+ case Ownership.WEAK:
+ return "weak";
+
+ case Ownership.DEFAULT:
+ return "";
+ }
+
+ assert_not_reached ();
+ }
+}
diff --git a/libvaladoc/api/package.vala b/libvaladoc/api/package.vala
new file mode 100644
index 000000000..821230ecf
--- /dev/null
+++ b/libvaladoc/api/package.vala
@@ -0,0 +1,143 @@
+/* package.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+using Valadoc.Importer;
+
+public class Valadoc.Api.Package : Node {
+
+ /**
+ * Specifies whether this package is a dependency
+ */
+ public bool is_package {
+ private set;
+ get;
+ }
+
+ internal void set_dependency_list (Vala.ArrayList<Package> list) {
+ this._dependencies = list;
+ }
+
+ private Vala.ArrayList<Package> _dependencies;
+
+ /**
+ * Returns a list with all dependencies
+ */
+ public Vala.Collection<Package> get_full_dependency_list () {
+ Vala.ArrayList<Package> list = new Vala.ArrayList<Package> ();
+
+ if (this._dependencies == null) {
+ return list;
+ }
+
+ foreach (Package pkg in this._dependencies) {
+ if (list.contains ( pkg ) == false) {
+ list.add (pkg);
+ }
+
+ var pkg_list = pkg.get_full_dependency_list ();
+ foreach (Package pkg2 in pkg_list) {
+ if (list.contains (pkg2) == false) {
+ list.add (pkg2);
+ }
+ }
+ }
+ return list;
+ }
+
+ public Vala.Collection<Package> get_dependency_list () {
+ if (this._dependencies == null) {
+ return new Vala.ArrayList<Package> ();
+ }
+
+ return this._dependencies;
+ }
+
+ public Package (string name, bool is_package, void* data) {
+ base (null, null, name, data);
+
+ this.is_package = is_package;
+ this.parent = null;
+ }
+
+ // <version, symbols>
+ private Vala.HashMap<string, Vala.ArrayList<Symbol>> deprecated;
+
+ internal void register_deprecated_symbol (Symbol symbol, string? version) {
+ if (deprecated == null) {
+ deprecated = new Vala.HashMap<string, Vala.ArrayList<Symbol>> (str_hash, str_equal);
+ }
+
+ if (version == null) {
+ version = "0xdeadbeef";
+ }
+
+ Vala.ArrayList<Symbol> list = deprecated.get (version);
+ if (list == null) {
+ list = new Vala.ArrayList<Symbol> ();
+ deprecated.set (version, list);
+ }
+
+ list.add (symbol);
+ }
+
+ public Vala.Map<string, Vala.Collection<Symbol>> get_deprecated_symbols () {
+ if (deprecated == null) {
+ return new Vala.HashMap<string, Vala.Collection<Symbol>> (str_hash, str_equal);
+ }
+
+ return deprecated;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override bool is_browsable (Settings settings) {
+ return !(this.is_package && settings.with_deps == false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.PACKAGE; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_package (this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_keyword ("package")
+ .append (name)
+ .get ();
+ }
+}
+
diff --git a/libvaladoc/api/pointer.vala b/libvaladoc/api/pointer.vala
new file mode 100644
index 000000000..954acd949
--- /dev/null
+++ b/libvaladoc/api/pointer.vala
@@ -0,0 +1,54 @@
+/* pointer.vala
+ *
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a pointer declaration.
+ */
+public class Valadoc.Api.Pointer : Item {
+
+ /**
+ * The type the pointer is referring to.
+ */
+ public Item data_type {
+ set;
+ get;
+ }
+
+ public Pointer (Item parent, void* data) {
+ base (data);
+
+ this.parent = parent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_content (data_type.signature)
+ .append ("*", false)
+ .get ();
+ }
+}
diff --git a/libvaladoc/api/property.vala b/libvaladoc/api/property.vala
new file mode 100644
index 000000000..235292f20
--- /dev/null
+++ b/libvaladoc/api/property.vala
@@ -0,0 +1,201 @@
+/* property.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a property declaration.
+ */
+public class Valadoc.Api.Property : Member {
+ private PropertyBindingType binding_type;
+ private string? dbus_name;
+ private string? cname;
+
+ public Property (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? dbus_name, bool is_dbus_visible,
+ PropertyBindingType binding_type, void* data)
+ {
+ base (parent, file, name, accessibility, comment, data);
+
+ this.is_dbus_visible = is_dbus_visible;
+ this.binding_type = binding_type;
+
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+ }
+
+ /**
+ * Returns the name of this method as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * The property type.
+ *
+ * @return The property type or null for void
+ */
+ public TypeReference? property_type {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies whether the property is virtual.
+ */
+ public bool is_virtual {
+ get {
+ return binding_type == PropertyBindingType.VIRTUAL;
+ }
+ }
+
+ /**
+ * Specifies whether the property is abstract.
+ */
+ public bool is_abstract {
+ get {
+ return binding_type == PropertyBindingType.ABSTRACT;
+ }
+ }
+
+ /**
+ * Specifies whether the property is override.
+ */
+ public bool is_override {
+ get {
+ return binding_type == PropertyBindingType.OVERRIDE;
+ }
+ }
+
+ /**
+ * Specifies whether the property is visible.
+ */
+ public bool is_dbus_visible {
+ private set;
+ get;
+ }
+
+ public PropertyAccessor? setter {
+ set;
+ get;
+ }
+
+ public PropertyAccessor? getter {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies the virtual or abstract property this property overrides.
+ */
+ public Property base_property {
+ set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (getter != null && getter.is_browsable (settings)) {
+ getter.parse_comments (settings, parser);
+ }
+
+ if (setter != null && setter.is_browsable (settings)) {
+ setter.parse_comments (settings, parser);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (getter != null && getter.is_browsable (settings)) {
+ getter.check_comments (settings, parser);
+ }
+
+ if (setter != null && setter.is_browsable (settings)) {
+ setter.check_comments (settings, parser);
+ }
+
+ base.check_comments (settings, parser);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ if (is_abstract) {
+ signature.append_keyword ("abstract");
+ } else if (is_override) {
+ signature.append_keyword ("override");
+ } else if (is_virtual) {
+ signature.append_keyword ("virtual");
+ }
+
+ signature.append_content (property_type.signature);
+ signature.append_symbol (this);
+ signature.append ("{");
+
+ if (setter != null && setter.do_document) {
+ signature.append_content (setter.signature);
+ }
+
+ if (getter != null && getter.do_document) {
+ signature.append_content (getter.signature);
+ }
+
+ signature.append ("}");
+
+ return signature.get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.PROPERTY; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_property (this);
+ }
+}
+
diff --git a/libvaladoc/api/propertyaccessor.vala b/libvaladoc/api/propertyaccessor.vala
new file mode 100644
index 000000000..173edd89d
--- /dev/null
+++ b/libvaladoc/api/propertyaccessor.vala
@@ -0,0 +1,133 @@
+/* propertyaccessor.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a get or set accessor of a property.
+ */
+public class Valadoc.Api.PropertyAccessor : Symbol {
+ private PropertyAccessorType type;
+ private Ownership ownership;
+ private string? cname;
+
+ public PropertyAccessor (Property parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ string? cname, PropertyAccessorType type, Ownership ownership, void* data)
+ {
+ base (parent, file, name, accessibility, data);
+
+ this.ownership = ownership;
+ this.cname = cname;
+ this.type = type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.PROPERTY_ACCESSOR; }
+ }
+
+ /**
+ * Returns the name of this property accessor as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ }
+
+ /**
+ * Specifies whether this accessor may be used to construct the property.
+ */
+ public bool is_construct {
+ get {
+ return (type & PropertyAccessorType.CONSTRUCT) != 0;
+ }
+ }
+
+ /**
+ * Specifies whether this accessor is a setter.
+ */
+ public bool is_set {
+ get {
+ return (type & PropertyAccessorType.SET) != 0;
+ }
+ }
+
+ /**
+ * Specifies whether this accessor is a getter.
+ */
+ public bool is_get {
+ get {
+ return (type & PropertyAccessorType.GET) != 0;
+ }
+ }
+
+ /**
+ * Specifies whether the property is owned.
+ */
+ public bool is_owned {
+ get {
+ return ownership == Ownership.OWNED;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ // FIXME
+ if (!do_document) {
+ return signature.get ();
+ }
+
+ if (((Property) parent).accessibility != accessibility) {
+ signature.append_keyword (accessibility.to_string ());
+ }
+
+ if (is_set || is_construct) {
+ if (is_construct) {
+ signature.append_keyword ("construct");
+ }
+ if (is_set) {
+ signature.append_keyword ("set");
+ }
+ } else if (is_get) {
+ if (is_owned) {
+ signature.append_keyword ("owned");
+ }
+ signature.append_keyword ("get");
+ }
+ signature.append (";", false);
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/propertyaccessortype.vala b/libvaladoc/api/propertyaccessortype.vala
new file mode 100644
index 000000000..8453ca502
--- /dev/null
+++ b/libvaladoc/api/propertyaccessortype.vala
@@ -0,0 +1,43 @@
+/* propertyaccessor.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+public enum Valadoc.Api.PropertyAccessorType {
+ CONSTRUCT = 1 << 0,
+ SET = 1 << 1,
+ GET = 1 << 2;
+
+ public string to_string () {
+ if ((this & PropertyAccessorType.CONSTRUCT) != 0) {
+ if ((this & PropertyAccessorType.SET) != 0) {
+ return "construct set";
+ }
+ return "construct";
+ } else if ((this & PropertyAccessorType.SET) != 0) {
+ return "set";
+ } else if ((this & PropertyAccessorType.GET) != 0) {
+ return "get";
+ }
+
+ assert_not_reached ();
+ }
+}
diff --git a/libvaladoc/api/propertybindingtype.vala b/libvaladoc/api/propertybindingtype.vala
new file mode 100644
index 000000000..a8ce1617b
--- /dev/null
+++ b/libvaladoc/api/propertybindingtype.vala
@@ -0,0 +1,48 @@
+/* propertybindingtype.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+public enum Valadoc.Api.PropertyBindingType {
+ UNMODIFIED,
+ OVERRIDE,
+ ABSTRACT,
+ VIRTUAL;
+
+ public string to_string () {
+ switch (this) {
+ case OVERRIDE:
+ return "override";
+
+ case ABSTRACT:
+ return "abstract";
+
+ case VIRTUAL:
+ return "virtual";
+
+ case UNMODIFIED:
+ return "";
+ }
+
+ assert_not_reached ();
+ }
+}
+
diff --git a/libvaladoc/api/signal.vala b/libvaladoc/api/signal.vala
new file mode 100644
index 000000000..6e6f8855f
--- /dev/null
+++ b/libvaladoc/api/signal.vala
@@ -0,0 +1,145 @@
+/* signal.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents an signal.
+ */
+public class Valadoc.Api.Signal : Member, Callable {
+ private string? default_impl_cname;
+ private string? dbus_name;
+ private string? cname;
+
+
+ /**
+ * {@inheritDoc}
+ */
+ internal string? implicit_array_length_cparameter_name {
+ get;
+ set;
+ }
+
+
+ public Signal (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? default_impl_cname, string? dbus_name, bool is_dbus_visible,
+ bool is_virtual, void* data)
+ {
+ base (parent, file, name, accessibility, comment, data);
+
+ this.default_impl_cname = default_impl_cname;
+ this.dbus_name = dbus_name;
+ this.cname = cname;
+
+ this.is_dbus_visible = is_dbus_visible;
+ this.is_virtual = is_virtual;
+ }
+
+ /**
+ * Returns the name of this signal as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ public string? get_default_impl_cname () {
+ return default_impl_cname;
+ }
+
+ /**
+ * Returns the dbus-name.
+ */
+ public string get_dbus_name () {
+ return dbus_name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TypeReference? return_type {
+ set;
+ get;
+ }
+
+ /**
+ * Specifies whether this signal is virtual
+ */
+ public bool is_virtual {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether this signal is visible for dbus
+ */
+ public bool is_dbus_visible {
+ private set;
+ get;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ if (is_virtual) {
+ signature.append_keyword ("virtual");
+ }
+
+ signature.append_keyword ("signal");
+
+ signature.append_content (return_type.signature);
+ signature.append_symbol (this);
+ signature.append ("(");
+
+ bool first = true;
+ foreach (Node param in get_children_by_type (NodeType.FORMAL_PARAMETER, false)) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, !first);
+ first = false;
+ }
+
+ signature.append (")", false);
+
+ return signature.get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.SIGNAL; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_signal (this);
+ }
+}
+
diff --git a/libvaladoc/api/signaturebuilder.vala b/libvaladoc/api/signaturebuilder.vala
new file mode 100644
index 000000000..a897dae6b
--- /dev/null
+++ b/libvaladoc/api/signaturebuilder.vala
@@ -0,0 +1,180 @@
+/* signaturebuilder.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Builds up a signature from the given items.
+ */
+public class Valadoc.Api.SignatureBuilder {
+ private Run run;
+ private Inline last_appended;
+
+ /**
+ * Creates a new SignatureBuilder
+ */
+ public SignatureBuilder () {
+ run = new Run (Run.Style.NONE);
+ }
+
+ private void append_text (string text) {
+ if (last_appended is Text) {
+ ((Text) last_appended).content += text;
+ } else {
+ run.content.add (last_appended = new Text (text));
+ }
+ }
+
+ /**
+ * Adds text onto the end of the builder.
+ *
+ * @param text a string
+ * @param spaced add a space at the front of the string if necessary
+ * @return this
+ */
+ public SignatureBuilder append (string text, bool spaced = true) {
+ string content = (last_appended != null && spaced ? " " : "") + text;
+ append_text (content);
+ return this;
+ }
+
+ /**
+ * Adds text onto the end of the builder.
+ *
+ * @param text a string
+ * @param spaced add a space at the front of the string if necessary
+ * @return this
+ */
+ public SignatureBuilder append_attribute (string text, bool spaced = true) {
+ string content = (last_appended != null && spaced ? " " : "") + text;
+ append_text (content);
+ return this;
+ }
+
+ /**
+ * Adds highlighted text onto the end of the builder.
+ *
+ * @param text a string
+ * @param spaced add a space at the front of the string if necessary
+ * @return this
+ */
+ public SignatureBuilder append_highlighted (string text, bool spaced = true) {
+ string content = (last_appended != null && spaced ? " " : "") + text;
+ Run inner = new Run (Run.Style.ITALIC);
+ inner.content.add (new Text (content));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * Adds a Inline onto the end of the builder.
+ *
+ * @param content a content
+ * @param spaced add a space at the front of the inline if necessary
+ * @return this
+ */
+ public SignatureBuilder append_content (Inline content, bool spaced = true) {
+ if (last_appended != null && spaced) {
+ append_text (" ");
+ }
+ run.content.add (last_appended = content);
+ return this;
+ }
+
+ /**
+ * Adds a keyword onto the end of the builder.
+ *
+ * @param keyword a keyword
+ * @param spaced add a space at the front of the keyword if necessary
+ * @return this
+ */
+ public SignatureBuilder append_keyword (string keyword, bool spaced = true) {
+ Run inner = new Run (Run.Style.LANG_KEYWORD);
+ inner.content.add (new Text (keyword));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * Adds a symbol onto the end of the builder.
+ *
+ * @param node a node
+ * @param spaced add a space at the front of the node if necessary
+ * @return this
+ */
+ public SignatureBuilder append_symbol (Node node, bool spaced = true) {
+ Run inner = new Run (Run.Style.BOLD);
+ inner.content.add (new SymbolLink (node, node.name));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * Adds a type onto the end of the builder.
+ *
+ * @param node a node
+ * @param spaced add a space at the front of the node if necessary
+ * @return this
+ */
+ public SignatureBuilder append_type (Node node, bool spaced = true) {
+ Run.Style style = Run.Style.LANG_TYPE;
+ if (node is TypeSymbol && ((TypeSymbol)node).is_basic_type) {
+ style = Run.Style.LANG_BASIC_TYPE;
+ }
+
+ Run inner = new Run (style);
+ inner.content.add (new SymbolLink (node, node.name));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * Adds a type name onto the end of the builder.
+ *
+ * @param name a type name
+ * @param spaced add a space at the front of the type name if necessary
+ * @return this
+ */
+ public SignatureBuilder append_type_name (string name, bool spaced = true) {
+ Run inner = new Run (Run.Style.LANG_TYPE);
+ inner.content.add (new Text (name));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * Adds a literal onto the end of the builder.
+ *
+ * @param literal a literal
+ * @param spaced add a space at the front of the literal if necessary
+ * @return this
+ */
+ public SignatureBuilder append_literal (string literal, bool spaced = true) {
+ Run inner = new Run (Run.Style.LANG_LITERAL);
+ inner.content.add (new Text (literal));
+ return append_content (inner, spaced);
+ }
+
+ /**
+ * The content
+ */
+ public new Run get () {
+ return run;
+ }
+}
+
diff --git a/libvaladoc/api/sourcecomment.vala b/libvaladoc/api/sourcecomment.vala
new file mode 100644
index 000000000..2d8eb1485
--- /dev/null
+++ b/libvaladoc/api/sourcecomment.vala
@@ -0,0 +1,85 @@
+/* sourcecomment.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+/**
+ * A documentation comment used by valadoc
+ */
+public class Valadoc.Api.SourceComment {
+ public SourceFile file {
+ private set;
+ get;
+ }
+
+ /**
+ * The text describing the referenced source code.
+ */
+ public string content {
+ private set;
+ get;
+ }
+
+ /**
+ * The first line number of the referenced source code.
+ */
+ public int first_line {
+ private set;
+ get;
+ }
+
+ /**
+ * The first column number of the referenced source code.
+ */
+ public int first_column {
+ private set;
+ get;
+ }
+
+ /**
+ * The last line number of the referenced source code.
+ */
+ public int last_line {
+ private set;
+ get;
+ }
+
+ /**
+ * The last column number of the referenced source code.
+ */
+ public int last_column {
+ private set;
+ get;
+ }
+
+ public SourceComment (string content, SourceFile file, int first_line, int first_column,
+ int last_line, int last_column)
+ {
+ this.first_column = first_column;
+ this.last_column = last_column;
+ this.first_line = first_line;
+ this.last_line = last_line;
+ this.content = content;
+ this.file = file;
+ }
+}
+
+
diff --git a/libvaladoc/api/sourcefile.vala b/libvaladoc/api/sourcefile.vala
new file mode 100644
index 000000000..9c3401145
--- /dev/null
+++ b/libvaladoc/api/sourcefile.vala
@@ -0,0 +1,61 @@
+/* sourcefile.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Brosch Florian <flo.brosch@gmail.com>
+ */
+
+
+/**
+ * Represents a source file
+ */
+public class Valadoc.Api.SourceFile : Object {
+
+ public Package package {
+ private set;
+ get;
+ }
+
+ public string relative_path {
+ private set;
+ get;
+ }
+
+ public string? relative_c_path {
+ private set;
+ get;
+ }
+
+ public string get_name () {
+ return Path.get_basename (relative_path);
+ }
+
+ public void* data {
+ private set;
+ get;
+ }
+
+ public SourceFile (Package package, string relative_path, string? relative_c_path, void* data) {
+ this.relative_c_path = relative_c_path;
+ this.relative_path = relative_path;
+ this.package = package;
+ this.data = data;
+ }
+}
+
+
diff --git a/libvaladoc/api/struct.vala b/libvaladoc/api/struct.vala
new file mode 100644
index 000000000..93bbce778
--- /dev/null
+++ b/libvaladoc/api/struct.vala
@@ -0,0 +1,173 @@
+/* struct.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a struct declaration.
+ */
+public class Valadoc.Api.Struct : TypeSymbol {
+ private string? dup_function_cname;
+ private string? copy_function_cname;
+ private string? free_function_cname;
+ private string? destroy_function_cname;
+ private string? type_id;
+ private string? cname;
+
+ public Struct (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? cname, string? type_macro_name,
+ string? type_function_name, string? type_id, string? dup_function_cname,
+ string? copy_function_cname, string? destroy_function_cname,
+ string? free_function_cname, bool is_basic_type, void* data)
+ {
+ base (parent, file, name, accessibility, comment, type_macro_name, null, null,
+ type_function_name, is_basic_type, data);
+
+ this.dup_function_cname = dup_function_cname;
+ this.copy_function_cname = copy_function_cname;
+ this.free_function_cname = free_function_cname;
+ this.destroy_function_cname = destroy_function_cname;
+
+ this.cname = cname;
+ }
+
+ /**
+ * Specifies the base struct.
+ */
+ public TypeReference? base_type {
+ set;
+ get;
+ }
+
+
+ /**
+ * Returns the name of this struct as it is used in C.
+ */
+ public string? get_cname () {
+ return cname;
+ }
+
+ /**
+ * Returns the C symbol representing the runtime type id for this data type.
+ */
+ public string? get_type_id () {
+ return type_id;
+ }
+
+ /**
+ * Returns the C function name that duplicates instances of this data
+ * type.
+ */
+ public string? get_dup_function_cname () {
+ return dup_function_cname;
+ }
+
+ /**
+ * Returns the C function name that copies instances of this data
+ * type.
+ */
+ public string? get_copy_function_cname () {
+ return copy_function_cname;
+ }
+
+ /**
+ * Returns the C function name that frees instances of this data type.
+ */
+ public string? get_free_function_cname () {
+ return free_function_cname;
+ }
+
+ /**
+ * Returns the C function name that destroys instances of this data type.
+ */
+ public string? get_destroy_function_cname () {
+ return destroy_function_cname;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type {
+ get { return NodeType.STRUCT; }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_struct (this);
+ }
+
+
+ private Vala.Set<Struct> _known_child_structs = new Vala.HashSet<Struct> ();
+
+ /**
+ * Returns a list of all known structs based on this struct
+ */
+ public Vala.Collection<Struct> get_known_child_structs () {
+ return _known_child_structs;
+ }
+
+ public void register_child_struct (Struct stru) {
+ if (this.base_type != null) {
+ ((Struct) this.base_type.data_type).register_child_struct (stru);
+ }
+
+ _known_child_structs.add (stru);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ signature.append_keyword (accessibility.to_string ());
+ signature.append_keyword ("struct");
+ signature.append_symbol (this);
+
+ var type_parameters = get_children_by_type (NodeType.TYPE_PARAMETER, false);
+ if (type_parameters.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_parameters) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ if (base_type != null) {
+ signature.append (":");
+
+ signature.append_content (base_type.signature);
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/symbol.vala b/libvaladoc/api/symbol.vala
new file mode 100644
index 000000000..020c28ab1
--- /dev/null
+++ b/libvaladoc/api/symbol.vala
@@ -0,0 +1,157 @@
+/* symbol.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+/**
+ * Represents a node in the symbol tree.
+ */
+public abstract class Valadoc.Api.Symbol : Node {
+ private Vala.ArrayList<Attribute> attributes;
+
+ public bool is_deprecated {
+ default = false;
+ private set;
+ get;
+ }
+
+ public Symbol (Node parent, SourceFile file, string? name, SymbolAccessibility accessibility,
+ void* data)
+ {
+ base (parent, file, name, data);
+
+ this.accessibility = accessibility;
+ }
+
+ public void add_attribute (Attribute att) {
+ if (attributes == null) {
+ attributes = new Vala.ArrayList<Attribute> ();
+ }
+
+ // register deprecated symbols:
+ if (att.name == "Version") {
+ AttributeArgument? deprecated = att.get_argument ("deprecated");
+ AttributeArgument? version = att.get_argument ("deprecated_since");
+ if ((deprecated != null && deprecated.get_value_as_boolean ()) || version != null) {
+ string? version_str = (version != null) ? version.get_value_as_string () : null;
+
+ package.register_deprecated_symbol (this, version_str);
+ is_deprecated = true;
+ }
+ } else if (att.name == "Deprecated") {
+ AttributeArgument? version = att.get_argument ("version");
+ string? version_str = (version != null) ? version.get_value_as_string () : null;
+
+ package.register_deprecated_symbol (this, version_str);
+ is_deprecated = true;
+ }
+
+ attributes.add (att);
+ }
+
+ public Vala.Collection<Attribute> get_attributes () {
+ if (attributes == null) {
+ return new Vala.ArrayList<Attribute> ();
+ } else {
+ return attributes;
+ }
+ }
+
+ public Attribute? get_attribute (string name) {
+ if (attributes != null) {
+ foreach (Attribute att in attributes) {
+ if (att.name == name) {
+ return att;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override bool is_browsable (Settings settings) {
+ if (!settings._private && this.is_private) {
+ return false;
+ }
+ if (!settings._internal && this.is_internal) {
+ return false;
+ }
+ if (!settings._protected && this.is_protected) {
+ return false;
+ }
+
+ Item? pos = parent;
+ while (pos != null && pos is Symbol && pos is Namespace == false) {
+ if (((Symbol) pos).is_browsable (settings) == false) {
+ return false;
+ }
+ pos = pos.parent;
+ }
+
+ return true;
+ }
+
+ public SymbolAccessibility accessibility {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies whether this symbol is public.
+ */
+ public bool is_public {
+ get {
+ return accessibility == SymbolAccessibility.PUBLIC;
+ }
+ }
+
+ /**
+ * Specifies whether this symbol is protected.
+ */
+ public bool is_protected {
+ get {
+ return accessibility == SymbolAccessibility.PROTECTED;
+ }
+ }
+
+ /**
+ * Specifies whether this symbol is internal.
+ */
+ public bool is_internal {
+ get {
+ return accessibility == SymbolAccessibility.INTERNAL;
+ }
+ }
+
+ /**
+ * Specifies whether this symbol is private.
+ */
+ public bool is_private {
+ get {
+ return accessibility == SymbolAccessibility.PRIVATE;
+ }
+ }
+}
+
diff --git a/libvaladoc/api/symbolaccessibility.vala b/libvaladoc/api/symbolaccessibility.vala
new file mode 100644
index 000000000..9b78aa671
--- /dev/null
+++ b/libvaladoc/api/symbolaccessibility.vala
@@ -0,0 +1,51 @@
+/* SymbolAccessibility.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+/**
+ * The access modifier
+ */
+public enum Valadoc.Api.SymbolAccessibility {
+ PROTECTED,
+ INTERNAL,
+ PRIVATE,
+ PUBLIC;
+
+ public string to_string () {
+ switch (this) {
+ case SymbolAccessibility.PROTECTED:
+ return "protected";
+
+ case SymbolAccessibility.INTERNAL:
+ return "internal";
+
+ case SymbolAccessibility.PRIVATE:
+ return "private";
+
+ case SymbolAccessibility.PUBLIC:
+ return "public";
+
+ default:
+ assert_not_reached ();
+ }
+ }
+}
diff --git a/libvaladoc/api/tree.vala b/libvaladoc/api/tree.vala
new file mode 100644
index 000000000..4344c2e46
--- /dev/null
+++ b/libvaladoc/api/tree.vala
@@ -0,0 +1,350 @@
+/* tree.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Importer;
+
+/**
+ * The root of the code tree.
+ */
+public class Valadoc.Api.Tree {
+ private Vala.List<InheritDocContainer> inheritdocs = new Vala.ArrayList<InheritDocContainer> ();
+ private Vala.ArrayList<string> external_c_files = new Vala.ArrayList<string>(str_equal);
+ private Vala.ArrayList<Package> packages = new Vala.ArrayList<Package>();
+ private Package source_package = null;
+ private Settings settings;
+ private ErrorReporter reporter;
+ private Highlighter.Highlighter _highlighter;
+ private CTypeResolver _cresolver = null;
+ private Package _source_package;
+
+
+ private class InheritDocContainer {
+ public unowned Taglets.InheritDoc taglet;
+ public unowned Api.Node taglet_container;
+
+ public InheritDocContainer (Api.Node taglet_container, Taglets.InheritDoc taglet) {
+ this.taglet_container = taglet_container;
+ this.taglet = taglet;
+ }
+ }
+
+
+ public void add_package(Package package) {
+ this.packages.add (package);
+ }
+
+ public void* data {
+ set;
+ get;
+ }
+
+ public Highlighter.Highlighter highlighter {
+ get {
+ if (_highlighter == null) {
+ _highlighter = new Highlighter.Highlighter ();
+ }
+
+ return _highlighter;
+ }
+ }
+
+ /**
+ * The root of the wiki tree.
+ */
+ public WikiPageTree? wikitree {
+ private set;
+ get;
+ }
+
+ /**
+ * Returns a list of C source files.
+ *
+ * @return list of C source files
+ */
+ public Vala.Collection<string> get_external_c_files () {
+ return external_c_files;
+ }
+
+ public void add_external_c_files (string name) {
+ external_c_files.add (name);
+ }
+
+
+ /**
+ * Returns a list of all packages in the tree
+ *
+ * @return list of all packages
+ */
+ public Vala.Collection<Package> get_package_list () {
+ return this.packages;
+ }
+
+ private void add_dependencies_to_source_package () {
+ if ( this.source_package != null ) {
+ Vala.ArrayList<Package> deplst = new Vala.ArrayList<Package> ();
+ foreach (Package pkg in this.packages) {
+ if (pkg != this.source_package) {
+ deplst.add (pkg);
+ }
+ }
+ this.source_package.set_dependency_list (deplst);
+ }
+ }
+
+ /**
+ * Visits this node with the specified Visitor.
+ *
+ * @param visitor the visitor to be called while traversing
+ */
+ public void accept (Visitor visitor) {
+ visitor.visit_tree (this);
+ }
+
+ /**
+ * Visits all children of this node with the given types with the specified Visitor.
+ *
+ * @param visitor the visitor to be called while traversing
+ */
+ public void accept_children (Visitor visitor) {
+ foreach (Node node in packages) {
+ node.accept (visitor);
+ }
+ }
+
+ private Node? search_relative_to (Node element, string[] path) {
+ Api.Node? node = element;
+
+ foreach (string name in path) {
+ node = node.find_by_name (name);
+ if (node == null) {
+ break;
+ }
+ }
+
+ if (node == null && element.parent != null) {
+ node = search_relative_to ((Node) element.parent, path);
+ }
+
+ return node;
+ }
+
+ public Node? search_symbol_path (Node? element, string[] path) {
+ Api.Node? node = null;
+
+ // relative to element
+ if (element != null) {
+ node = search_relative_to (element, path);
+ if (node != null) {
+ return node;
+ }
+ }
+
+
+ // absolute
+ foreach (Package package in packages) {
+ // search in root namespace
+
+ Node? global = package.find_by_name ("");
+ if (global != null) {
+ node = search_relative_to (global, path);
+ if (node != null) {
+ return node;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public TypeSymbol? search_symbol_type_cstr (string cname) {
+ if (_cresolver == null) {
+ _cresolver = new CTypeResolver (this);
+ }
+
+ return _cresolver.resolve_symbol_type (cname);
+ }
+
+ public Node? search_symbol_cstr (Node? element, string cname) {
+ if (_cresolver == null) {
+ _cresolver = new CTypeResolver (this);
+ }
+
+ return _cresolver.resolve_symbol (element, cname);
+ }
+
+ public Node? search_symbol_str (Node? element, string symname) {
+ string[] path = split_name (symname);
+
+ var node = search_symbol_path (element, path);
+ if (node != null) {
+ return node;
+ }
+
+ if (path.length >= 2 && path[path.length-2] == path[path.length-2]) {
+ path[path.length-2] = path[path.length-2]+"."+path[path.length-1];
+ path.resize (path.length-1);
+ return search_symbol_path (element, path);
+ }
+
+ return null;
+ }
+
+ private string[] split_name (string full_name) {
+ string[] params = (full_name).split (".", -1);
+ int i = 0; while (params[i] != null) i++;
+ params.length = i;
+ return params;
+ }
+
+ public Tree (ErrorReporter reporter, Settings settings, void* data = null) {
+ this.settings = settings;
+ this.reporter = reporter;
+ this.data = data;
+ }
+
+ // copied from valacodecontext.vala
+ private string? get_file_path (string basename, string[] directories) {
+ string filename = null;
+
+ if (directories != null) {
+ foreach (string dir in directories) {
+ filename = Path.build_filename (dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+ }
+
+ foreach (string dir in Environment.get_system_data_dirs ()) {
+ filename = Path.build_filename (dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+
+ return null;
+ }
+
+ public bool create_tree ( ) {
+ this.add_dependencies_to_source_package ();
+ return true;
+ }
+
+ private Package? get_source_package () {
+ if (_source_package == null) {
+ foreach (Package pkg in packages) {
+ if (!pkg.is_package) {
+ _source_package = pkg;
+ break;
+ }
+ }
+ }
+
+ return _source_package;
+ }
+
+ private void parse_wiki (DocumentationParser docparser) {
+ this.wikitree = new WikiPageTree ();
+ var pkg = get_source_package ();
+ if (pkg != null) {
+ wikitree.parse (settings, docparser, pkg, reporter);
+ }
+ }
+
+ private void check_wiki (DocumentationParser docparser) {
+ Package pkg = get_source_package ();
+ if (pkg != null) {
+ wikitree.check (settings, docparser, pkg);
+ }
+ }
+
+ public void parse_comments (DocumentationParser docparser) {
+ parse_wiki (docparser);
+
+ foreach (Package pkg in this.packages) {
+ if (pkg.is_browsable (settings)) {
+ pkg.parse_comments (settings, docparser);
+ }
+ }
+ }
+
+ public void check_comments (DocumentationParser docparser) {
+ check_wiki (docparser);
+
+ foreach (Package pkg in this.packages) {
+ if (pkg.is_browsable (settings)) {
+ pkg.check_comments (settings, docparser);
+ postprocess_inheritdoc (docparser);
+ }
+ }
+ }
+
+ internal void register_inheritdoc (Api.Node container, Taglets.InheritDoc taglet) {
+ inheritdocs.add (new InheritDocContainer (container, taglet));
+ }
+
+ private void postprocess_inheritdoc (DocumentationParser docparser) {
+ while (!this.inheritdocs.is_empty) {
+ InheritDocContainer container = this.inheritdocs.remove_at (0);
+
+ docparser.transform_inheritdoc (container.taglet_container, container.taglet);
+ }
+ }
+
+
+ /**
+ * Import documentation from various sources
+ *
+ * @param importers a list of importers
+ * @param packages sources
+ * @param import_directories List of directories where to find the files
+ */
+ public void import_comments (DocumentationImporter[] importers, string[] packages,
+ string[] import_directories)
+ {
+ Vala.HashSet<string> processed = new Vala.HashSet<string> ();
+ foreach (string pkg_name in packages) {
+ bool imported = false;
+ foreach (DocumentationImporter importer in importers) {
+ string? path = get_file_path ("%s.%s".printf (pkg_name, importer.file_extension),
+ import_directories);
+ if (path == null) {
+ continue;
+ }
+
+ path = realpath (path);
+ imported = true;
+
+ if (!processed.contains (path)) {
+ importer.process (path);
+ processed.add (path);
+ }
+ }
+
+ if (imported == false) {
+ reporter.simple_error (null, "'%s' not found in specified import directories", pkg_name);
+ }
+ }
+ }
+}
+
diff --git a/libvaladoc/api/typeparameter.vala b/libvaladoc/api/typeparameter.vala
new file mode 100644
index 000000000..9cfe86482
--- /dev/null
+++ b/libvaladoc/api/typeparameter.vala
@@ -0,0 +1,61 @@
+/* typeparameter.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * Represents a generic type parameter in the source code.
+ */
+public class Valadoc.Api.TypeParameter : Symbol {
+
+ public TypeParameter (Node parent, SourceFile file, string name, void* data) {
+ base (parent, file, name, SymbolAccessibility.PUBLIC, data);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ return new SignatureBuilder ()
+ .append_symbol (this)
+ .get ();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override NodeType node_type { get { return NodeType.TYPE_PARAMETER; } }
+
+ /**
+ * {@inheritDoc}
+ */
+ public override void accept (Visitor visitor) {
+ visitor.visit_type_parameter (this);
+ }
+
+ public override bool is_browsable (Settings settings) {
+ return false;
+ }
+
+}
+
diff --git a/libvaladoc/api/typereference.vala b/libvaladoc/api/typereference.vala
new file mode 100644
index 000000000..3fd975c4b
--- /dev/null
+++ b/libvaladoc/api/typereference.vala
@@ -0,0 +1,167 @@
+/* typereference.vala
+ *
+ * Copyright (C) 2008-2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+
+using Valadoc.Content;
+
+/**
+ * A reference to a data type.
+ */
+public class Valadoc.Api.TypeReference : Item {
+ private Vala.ArrayList<TypeReference> type_arguments = new Vala.ArrayList<TypeReference> ();
+ private string? dbus_type_signature;
+ private Ownership ownership;
+
+ public TypeReference (Item parent, Ownership ownership, bool pass_ownership, bool is_dynamic,
+ bool is_nullable, string? dbus_type_signature, void* data)
+ {
+ base (data);
+
+ this.dbus_type_signature = dbus_type_signature;
+ this.pass_ownership = pass_ownership;
+ this.is_nullable = is_nullable;
+ this.is_dynamic = is_dynamic;
+ this.ownership = ownership;
+ this.parent = parent;
+ }
+
+ /**
+ * Returns a copy of the list of generic type arguments.
+ *
+ * @return type argument list
+ */
+ public Vala.Collection<TypeReference> get_type_arguments () {
+ return this.type_arguments;
+ }
+
+ public void add_type_argument (TypeReference type_ref) {
+ type_arguments.add (type_ref);
+ }
+
+ /**
+ * The referred data type.
+ */
+ public Item? data_type {
+ set;
+ get;
+ }
+
+ public bool pass_ownership {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies that the expression is owned.
+ */
+ public bool is_owned {
+ get {
+ return ownership == Ownership.OWNED;
+ }
+ }
+
+ /**
+ * Specifies that the expression is weak.
+ */
+ public bool is_weak {
+ get {
+ return ownership == Ownership.WEAK;
+ }
+ }
+
+ /**
+ * Specifies that the expression is unwoned.
+ */
+ public bool is_unowned {
+ get {
+ return ownership == Ownership.UNOWNED;
+ }
+ }
+
+
+ /**
+ * Specifies that the expression is dynamic.
+ */
+ public bool is_dynamic {
+ private set;
+ get;
+ }
+
+ /**
+ * Specifies that the expression may be null.
+ */
+ public bool is_nullable {
+ private set;
+ get;
+ }
+
+ public string? get_dbus_type_signature () {
+ return dbus_type_signature;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected override Inline build_signature () {
+ var signature = new SignatureBuilder ();
+
+ if (is_dynamic) {
+ signature.append_keyword ("dynamic");
+ }
+
+ if (is_weak) {
+ signature.append_keyword ("weak");
+ } else if (is_owned) {
+ signature.append_keyword ("owned");
+ } else if (is_unowned) {
+ signature.append_keyword ("unowned");
+ }
+
+ if (data_type == null) {
+ signature.append_keyword ("void");
+ } else if (data_type is Symbol) {
+ signature.append_type ((Symbol) data_type);
+ } else {
+ signature.append_content (data_type.signature);
+ }
+
+ if (type_arguments.size > 0) {
+ signature.append ("<", false);
+ bool first = true;
+ foreach (Item param in type_arguments) {
+ if (!first) {
+ signature.append (",", false);
+ }
+ signature.append_content (param.signature, false);
+ first = false;
+ }
+ signature.append (">", false);
+ }
+
+ if (is_nullable) {
+ signature.append ("?", false);
+ }
+
+ return signature.get ();
+ }
+}
+
diff --git a/libvaladoc/api/typesymbol.vala b/libvaladoc/api/typesymbol.vala
new file mode 100644
index 000000000..c7274ba01
--- /dev/null
+++ b/libvaladoc/api/typesymbol.vala
@@ -0,0 +1,112 @@
+/* typesymbol.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+/**
+ * Represents a runtime data type.
+ */
+public abstract class Valadoc.Api.TypeSymbol : Symbol {
+ private SourceComment? source_comment;
+ private string? type_macro_name;
+ private string? is_type_macro_name;
+ private string? type_cast_macro_name;
+ private string? type_function_name;
+
+ public TypeSymbol (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
+ SourceComment? comment, string? type_macro_name, string? is_type_macro_name,
+ string? type_cast_macro_name, string? type_function_name, bool is_basic_type,
+ void* data)
+ {
+ base (parent, file, name, accessibility, data);
+
+ this.type_cast_macro_name = type_cast_macro_name;
+ this.is_type_macro_name = is_type_macro_name;
+ this.type_function_name = type_function_name;
+ this.type_macro_name = type_macro_name;
+
+ this.is_basic_type = is_basic_type;
+ this.source_comment = comment;
+ }
+
+ /**
+ * Specifies whether this symbol is a basic type (string, int, char, etc)
+ */
+ public bool is_basic_type {
+ private set;
+ get;
+ }
+
+ /**
+ * Gets the name of the GType macro which represents the type symbol
+ */
+ public string get_type_macro_name () {
+ return type_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which casts a type instance to the given type.
+ */
+ public string get_type_cast_macro_name () {
+ return type_cast_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which determines whether a type instance is of a given type.
+ */
+ public string get_is_type_macro_name () {
+ return is_type_macro_name;
+ }
+
+ /**
+ * Gets the name of the get_type() function which represents the type symbol
+ */
+ public string get_type_function_name () {
+ return type_function_name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void parse_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ return ;
+ }
+
+ if (source_comment != null) {
+ documentation = parser.parse (this, source_comment);
+ }
+
+ base.parse_comments (settings, parser);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ internal override void check_comments (Settings settings, DocumentationParser parser) {
+ if (documentation != null) {
+ parser.check (this, documentation);
+ }
+
+ base.check_comments (settings, parser);
+ }
+}
diff --git a/libvaladoc/api/visitor.vala b/libvaladoc/api/visitor.vala
new file mode 100644
index 000000000..bf66a456b
--- /dev/null
+++ b/libvaladoc/api/visitor.vala
@@ -0,0 +1,171 @@
+/* visitor.vala
+ *
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+
+/**
+ * Abstract visitor for traversing API.
+ */
+public abstract class Valadoc.Api.Visitor : GLib.Object {
+ /**
+ * Visit operation called for api trees.
+ *
+ * @param item a tree
+ */
+ public virtual void visit_tree (Tree item) {
+ }
+
+ /**
+ * Visit operation called for packages like gir-files and vapi-files.
+ *
+ * @param item a package
+ */
+ public virtual void visit_package (Package item) {
+ }
+
+ /**
+ * Visit operation called for namespaces
+ *
+ * @param item a namespace
+ */
+ public virtual void visit_namespace (Namespace item) {
+ }
+
+ /**
+ * Visit operation called for interfaces.
+ *
+ * @param item a interface
+ */
+ public virtual void visit_interface (Interface item) {
+ }
+
+ /**
+ * Visit operation called for classes.
+ *
+ * @param item a class
+ */
+ public virtual void visit_class (Class item) {
+ }
+
+ /**
+ * Visit operation called for structs.
+ *
+ * @param item a struct
+ */
+ public virtual void visit_struct (Struct item) {
+ }
+
+ /**
+ * Visit operation called for properties.
+ *
+ * @param item a property
+ */
+ public virtual void visit_property (Property item) {
+ }
+
+ /**
+ * Visit operation called for fields.
+ *
+ * @param item a field
+ */
+ public virtual void visit_field (Field item) {
+ }
+
+ /**
+ * Visit operation called for constants.
+ *
+ * @param item a constant
+ */
+ public virtual void visit_constant (Constant item) {
+ }
+
+ /**
+ * Visit operation called for delegates.
+ *
+ * @param item a delegate
+ */
+ public virtual void visit_delegate (Delegate item) {
+ }
+
+ /**
+ * Visit operation called for signals.
+ *
+ * @param item a signal
+ */
+ public virtual void visit_signal (Signal item) {
+ }
+
+ /**
+ * Visit operation called for methods.
+ *
+ * @param item a method
+ */
+ public virtual void visit_method (Method item) {
+ }
+
+ /**
+ * Visit operation called for type parameters.
+ *
+ * @param item a type parameter
+ */
+ public virtual void visit_type_parameter (TypeParameter item) {
+ }
+
+ /**
+ * Visit operation called for formal parameters.
+ *
+ * @param item a formal parameter
+ */
+ public virtual void visit_formal_parameter (FormalParameter item) {
+ }
+
+ /**
+ * Visit operation called for error domains.
+ *
+ * @param item a error domain
+ */
+ public virtual void visit_error_domain (ErrorDomain item) {
+ }
+
+ /**
+ * Visit operation called for error codes.
+ *
+ * @param item a error code
+ */
+ public virtual void visit_error_code (ErrorCode item) {
+ }
+
+ /**
+ * Visit operation called for enums.
+ *
+ * @param item a enum
+ */
+ public virtual void visit_enum (Enum item) {
+ }
+
+ /**
+ * Visit operation called for enum values.
+ *
+ * @param item a enum value
+ */
+ public virtual void visit_enum_value (EnumValue item) {
+ }
+}