summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Brosch <flo.brosch@gmail.com>2009-09-16 19:47:29 +0200
committerFlorian Brosch <flo.brosch@gmail.com>2009-09-16 19:47:29 +0200
commit3a61c2360eb23d994bc8668a5a62a52f7bee5afb (patch)
treecf44f480a7c5ad5986dcb6b31c33a089f668bdab
parent7cdce6cf33d045e2c465f852c14c75fd8dff0ff1 (diff)
downloadvala-3a61c2360eb23d994bc8668a5a62a52f7bee5afb.tar.gz
- repository reorganisation
- .gitignore
-rw-r--r--.gitignore28
-rw-r--r--configure.in12
-rw-r--r--src/Makefile.am11
-rwxr-xr-xsrc/doclets/htmlhelpers/doclet/langlet.vala36
-rwxr-xr-xsrc/doclets/htmlhelpers/languages/vala.vala39
-rwxr-xr-xsrc/doclets/htmlhelpers/taglets/constants/Makefile.am56
-rwxr-xr-xsrc/doclets/valadoc.org/doclet/template.vala4
-rw-r--r--src/libvaladoc/Makefile.am64
-rwxr-xr-xsrc/libvaladoc/apitree.vala4612
-rw-r--r--src/libvaladoc/apitree/apitree.vala503
-rw-r--r--src/libvaladoc/apitree/array.vala62
-rw-r--r--src/libvaladoc/apitree/basic.vala46
-rw-r--r--src/libvaladoc/apitree/class.vala335
-rw-r--r--src/libvaladoc/apitree/classhandler.vala104
-rw-r--r--src/libvaladoc/apitree/constant.vala73
-rw-r--r--src/libvaladoc/apitree/constanthandler.vala102
-rw-r--r--src/libvaladoc/apitree/constructionmethodhandler.vala112
-rw-r--r--src/libvaladoc/apitree/delegate.vala105
-rw-r--r--src/libvaladoc/apitree/delegatehandler.vala99
-rw-r--r--src/libvaladoc/apitree/documentedelement.vala135
-rw-r--r--src/libvaladoc/apitree/enum.vala176
-rw-r--r--src/libvaladoc/apitree/enumhandler.vala91
-rw-r--r--src/libvaladoc/apitree/enumvalue.vala58
-rw-r--r--src/libvaladoc/apitree/errorcode.vala58
-rw-r--r--src/libvaladoc/apitree/errordomain.vala171
-rw-r--r--src/libvaladoc/apitree/errordomainhandler.vala99
-rw-r--r--src/libvaladoc/apitree/exceptionlisthandler.vala49
-rw-r--r--src/libvaladoc/apitree/field.vala88
-rw-r--r--src/libvaladoc/apitree/fieldhandler.vala105
-rw-r--r--src/libvaladoc/apitree/formalparameter.vala86
-rw-r--r--src/libvaladoc/apitree/interface.vala277
-rw-r--r--src/libvaladoc/apitree/interfacehandler.vala91
-rw-r--r--src/libvaladoc/apitree/method.vala196
-rw-r--r--src/libvaladoc/apitree/methodhandler.vala103
-rw-r--r--src/libvaladoc/apitree/namespace.vala274
-rw-r--r--src/libvaladoc/apitree/namespacehandler.vala139
-rw-r--r--src/libvaladoc/apitree/package.vala164
-rw-r--r--src/libvaladoc/apitree/parameterlisthandler.vala49
-rw-r--r--src/libvaladoc/apitree/pointer.vala66
-rw-r--r--src/libvaladoc/apitree/property.vala143
-rw-r--r--src/libvaladoc/apitree/propertyaccessor.vala107
-rw-r--r--src/libvaladoc/apitree/propertyhandler.vala111
-rw-r--r--src/libvaladoc/apitree/returntypehandler.vala45
-rw-r--r--src/libvaladoc/apitree/signal.vala89
-rw-r--r--src/libvaladoc/apitree/signalhandler.vala98
-rw-r--r--src/libvaladoc/apitree/struct.vala196
-rw-r--r--src/libvaladoc/apitree/structhandler.vala92
-rw-r--r--src/libvaladoc/apitree/symbolaccessibility.vala55
-rw-r--r--src/libvaladoc/apitree/templateparameterlisthandler.vala61
-rw-r--r--src/libvaladoc/apitree/typeparameter.vala59
-rw-r--r--src/libvaladoc/apitree/typereference.vala242
-rw-r--r--src/libvaladoc/apitree/visitable.vala57
-rwxr-xr-xsrc/libvaladoc/documentation/doctree.vala (renamed from src/libvaladoc/doctree.vala)2
-rwxr-xr-xsrc/libvaladoc/documentation/errorreporter.vala (renamed from src/libvaladoc/errorreporter.vala)0
-rwxr-xr-xsrc/libvaladoc/documentation/moduleloader.vala (renamed from src/libvaladoc/moduleloader.vala)0
-rwxr-xr-xsrc/libvaladoc/documentation/parser.vala (renamed from src/libvaladoc/parser.vala)409
-rwxr-xr-xsrc/libvaladoc/documentation/wiki.vala (renamed from src/libvaladoc/wiki.vala)0
-rwxr-xr-xsrc/libvaladoc/langlet.vala49
58 files changed, 5776 insertions, 4917 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..29288f713
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,28 @@
+Makefile.in
+Makefile
+*~
+*.o
+*.lo
+*.la
+*.c
+*.h
+*.stamp
+*.gir
+.deps
+.libs
+
+config.*
+aclocal.m4
+autom4te.cache
+ChangeLog
+configure
+depcomp
+libtool
+install-sh
+m4
+missing
+ltmain.sh
+ylwrap
+compile
+stamp-h1
+*.pc
diff --git a/configure.in b/configure.in
index 1b98a5cf6..eb36a2dae 100644
--- a/configure.in
+++ b/configure.in
@@ -5,10 +5,11 @@ AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/valadoc/valadoc.vala])
AC_CONFIG_HEADER([config.h])
-# Checks for programs.
+
AC_PROG_CC
AC_PROG_LIBTOOL
+
AC_PATH_PROG(VALAC, valac, valac)
AC_SUBST(VALAC)
@@ -20,8 +21,6 @@ AM_CONDITIONAL(ENABLE_VALADOCORG, test x$enable_valadocorg = xyes)
-
-# Checks for libraries.
LIBVALA_REQUIRED=0.3.4
LIBGVC_REQUIRED=2.16
GLIB_REQUIRED=2.12.0
@@ -56,13 +55,6 @@ AC_SUBST(LIBGDKPIXBUF_LIBS)
-# Checks for header files.
-
-# Checks for typedefs, structures, and compiler characteristics.
-
-# Checks for library functions.
-
-
AC_CONFIG_FILES([Makefile
src/libvaladoc/valadoc-1.0.pc
src/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index a16f827dd..a8c69a641 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,10 +3,11 @@
NULL =
-SUBDIRS = libvaladoc \
- vapi \
- doclets \
- valadoc \
- $(NULL)
+SUBDIRS = \
+ libvaladoc \
+ vapi \
+ valadoc \
+ doclets \
+ $(NULL)
diff --git a/src/doclets/htmlhelpers/doclet/langlet.vala b/src/doclets/htmlhelpers/doclet/langlet.vala
index 8e321de2d..8833bb222 100755
--- a/src/doclets/htmlhelpers/doclet/langlet.vala
+++ b/src/doclets/htmlhelpers/doclet/langlet.vala
@@ -447,14 +447,29 @@ public class Valadoc.Html.BasicLanglet : Valadoc.Langlet {
this.write_inheritance_list ( stru, file );
}
- public override void write_inheritance_list ( Inheritable dtype, void* ptr ) {
+ public override void write_inheritance_list ( DocumentedElement dtype, void* ptr ) {
weak GLib.FileStream file = (GLib.FileStream)ptr;
- Gee.Collection<Interface> lst = dtype.get_implemented_interface_list ( );
- Inheritable? base_type = dtype.base_type;
- int size = lst.size;
+ Gee.Collection<Interface> lst = null;
+ DocumentedElement? base_type = null;
+ int size = 0;
int i = 1;
+ if (dtype is Class) {
+ lst = ((Class)dtype).get_implemented_interface_list ();
+ base_type = ((Class)dtype).base_type;
+ size = lst.size;
+ }
+ else if (dtype is Interface) {
+ lst = ((Interface)dtype).get_implemented_interface_list ();
+ base_type = ((Interface)dtype).base_type;
+ size = lst.size;
+ }
+ else if (dtype is Struct) {
+ base_type = ((Struct)dtype).base_type;
+ }
+
+
if ( size == 0 && base_type == null )
return ;
@@ -467,14 +482,15 @@ public class Valadoc.Html.BasicLanglet : Valadoc.Langlet {
}
}
- foreach ( Interface cntype in lst ) {
- this.write_type_name ( cntype, file );
- if ( size > i )
- file.puts ( ", " );
+ if (lst != null) {
+ foreach ( Interface cntype in lst ) {
+ this.write_type_name ( cntype, file );
+ if ( size > i )
+ file.puts ( ", " );
- i++;
+ i++;
+ }
}
-
file.putc ( ' ' );
}
diff --git a/src/doclets/htmlhelpers/languages/vala.vala b/src/doclets/htmlhelpers/languages/vala.vala
index da848441e..fa266951e 100755
--- a/src/doclets/htmlhelpers/languages/vala.vala
+++ b/src/doclets/htmlhelpers/languages/vala.vala
@@ -23,15 +23,28 @@ public class Valadoc.Html.Api.Vala {
return span;
}
- private Entry parents (Inheritable type) {
+ private Entry parents (DocumentedElement type) {
Span span = new Span ();
span.add_attribute (this.cssparentlist);
- Gee.Collection<Interface> interfaces = type.get_implemented_interface_list ();
- Basic? basetype = type.base_type;
+ Gee.Collection<Interface>? interfaces = null;
+ Basic? basetype = null;
+
bool documentedelement;
- if (basetype != null || interfaces.size > 0) {
+ if (type is Interface) {
+ interfaces = ((Interface)type).get_implemented_interface_list ();
+ basetype = ((Interface)type).base_type;
+ }
+ else if (type is Class) {
+ interfaces = ((Class)type).get_implemented_interface_list ();
+ basetype = ((Class)type).base_type;
+ }
+ else if (type is Struct) {
+ basetype = ((Struct)type).base_type;
+ }
+
+ if (basetype != null || (interfaces != null && interfaces.size > 0)) {
span.add_child (new String (" : "));
}
@@ -39,16 +52,18 @@ public class Valadoc.Html.Api.Vala {
span.add_child (this.type (basetype, out documentedelement));
}
- if (basetype != null && interfaces.size > 0) {
- span.add_child (new String (", "));
- }
-
- int i = 0;
- foreach (Interface iface in interfaces) {
- span.add_child (this.type (iface, out documentedelement));
- if (interfaces.size < ++i) {
+ if (interfaces != null) {
+ if (basetype != null && interfaces.size > 0) {
span.add_child (new String (", "));
}
+
+ int i = 0;
+ foreach (Interface iface in interfaces) {
+ span.add_child (this.type (iface, out documentedelement));
+ if (interfaces.size < ++i) {
+ span.add_child (new String (", "));
+ }
+ }
}
return span;
diff --git a/src/doclets/htmlhelpers/taglets/constants/Makefile.am b/src/doclets/htmlhelpers/taglets/constants/Makefile.am
new file mode 100755
index 000000000..46c44a023
--- /dev/null
+++ b/src/doclets/htmlhelpers/taglets/constants/Makefile.am
@@ -0,0 +1,56 @@
+NULL =
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../doclet/ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletcodeconstant.vala.stamp
+
+
+tagletcodeconstantdir = $(libdir)/valadoc/plugins/htmlhelpers/taglets/
+
+
+tagletcodeconstant_LTLIBRARIES = \
+ libtagletcodeconstant.la \
+ $(NULL)
+
+
+libtagletcodeconstant_la_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+libtagletcodeconstant_la_SOURCES = \
+ libtagletcodeconstant.vala.stamp \
+ $(libtagletcodeconstant_la_VALASOURCES:.vala=.c) \
+ $(NULL)
+
+
+libtagletcodeconstant.vala.stamp: $(libtagletcodeconstant_la_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../doclet/ --pkg libhtmlhelpers-1.0 --basedir . $^
+ touch $@
+
+
+libtagletcodeconstant_la_LDFLAGS = -module -avoid-version
+
+
+libtagletcodeconstant_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ $(LIBGVC_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(GLIB_LIBS) \
+ $(NULL)
+
+
+EXTRA_DIST = $(libtagletcodeconstant_la_VALASOURCES) libtagletcodeconstant.vala.stamp
+
+
+MAINTAINERCLEANFILES = \
+ $(libtagletcodeconstant_la_VALASOURCES:.vala=.c) \
+ $(NULL)
+
diff --git a/src/doclets/valadoc.org/doclet/template.vala b/src/doclets/valadoc.org/doclet/template.vala
index af6c29e05..cc66d6256 100755
--- a/src/doclets/valadoc.org/doclet/template.vala
+++ b/src/doclets/valadoc.org/doclet/template.vala
@@ -36,14 +36,14 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet {
if(element.documentation == null) {
return ;
}
-stdout.printf("foooo 1\n");
+
string path = Path.build_filename (this.settings.path, element.package.name, "documentation", element.full_name ());
FileStream file = FileStream.open (path, "w");
if (file == null) {
this.run = false;
return ;
}
-stdout.printf("foooo 2\n");
+
element.documentation.write_brief (file);
element.documentation.write_content (file);
}
diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am
index 6782118c9..175ae3749 100644
--- a/src/libvaladoc/Makefile.am
+++ b/src/libvaladoc/Makefile.am
@@ -21,17 +21,59 @@ valadocdir = $(libdir)/valadoc/
libvaladoc_la_VALASOURCES = \
- filehelper.vala \
- drawer.vala \
- settings.vala \
- doclet.vala \
- errorreporter.vala \
- doctree.vala \
- moduleloader.vala \
- parser.vala \
- apitree.vala \
- langlet.vala \
- wiki.vala \
+ doclet.vala \
+ drawer.vala \
+ filehelper.vala \
+ langlet.vala \
+ settings.vala \
+ documentation/doctree.vala \
+ documentation/errorreporter.vala \
+ documentation/moduleloader.vala \
+ documentation/parser.vala \
+ documentation/wiki.vala \
+ apitree/apitree.vala \
+ apitree/array.vala \
+ apitree/basic.vala \
+ apitree/class.vala \
+ apitree/classhandler.vala \
+ apitree/constant.vala \
+ apitree/constanthandler.vala \
+ apitree/constructionmethodhandler.vala \
+ apitree/delegate.vala \
+ apitree/delegatehandler.vala \
+ apitree/documentedelement.vala \
+ apitree/enum.vala \
+ apitree/enumhandler.vala \
+ apitree/enumvalue.vala \
+ apitree/errorcode.vala \
+ apitree/errordomain.vala \
+ apitree/errordomainhandler.vala \
+ apitree/exceptionlisthandler.vala \
+ apitree/field.vala \
+ apitree/fieldhandler.vala \
+ apitree/formalparameter.vala \
+ apitree/interface.vala \
+ apitree/interfacehandler.vala \
+ apitree/method.vala \
+ apitree/methodhandler.vala \
+ apitree/namespace.vala \
+ apitree/namespacehandler.vala \
+ apitree/package.vala \
+ apitree/parameterlisthandler.vala \
+ apitree/pointer.vala \
+ apitree/property.vala \
+ apitree/propertyaccessor.vala \
+ apitree/propertyhandler.vala \
+ apitree/returntypehandler.vala \
+ apitree/signal.vala \
+ apitree/signalhandler.vala \
+ apitree/struct.vala \
+ apitree/structhandler.vala \
+ apitree/symbolaccessibility.vala \
+ apitree/templateparameterlisthandler.vala \
+ apitree/typeparameter.vala \
+ apitree/typereference.vala \
+ apitree/visitable.vala \
$(NULL)
diff --git a/src/libvaladoc/apitree.vala b/src/libvaladoc/apitree.vala
deleted file mode 100755
index a0f5699e0..000000000
--- a/src/libvaladoc/apitree.vala
+++ /dev/null
@@ -1,4612 +0,0 @@
-/*
- * Valadoc - a documentation tool for vala.
- * Copyright (C) 2008 Florian Brosch
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-
-using Vala;
-using GLib;
-using Gee;
-
-
-// private
-public Valadoc.Class glib_error = null;
-
-
-
-public abstract class Valadoc.Basic : Object {
- public Valadoc.Settings settings {
- protected get;
- set;
- }
-
- public Basic parent {
- set;
- get;
- }
-
- public Tree head {
- set;
- get;
- }
-
- //TODO: Vala.CodeNode => PropertySetter
- protected Vala.Symbol vsymbol {
- protected get;
- set;
- }
-}
-
-public class Valadoc.Array : Basic {
- private Vala.ArrayType vtype;
-
- public Basic data_type {
- private set;
- get;
- }
-
- public Array (Valadoc.Settings settings, Vala.ArrayType vtyperef, Basic parent, Tree head) {
- this.settings = settings;
- this.vtype = vtyperef;
- this.parent = parent;
- this.head = head;
-
- Vala.DataType vntype = vtyperef.element_type;
- if ( vntype is Vala.ArrayType )
- this.data_type = new Array (settings, (Vala.ArrayType)vntype, this, head);
- else
- this.data_type = new TypeReference (settings, vntype, this, head);
- }
-
- public void write (Langlet langlet, void* ptr, DocumentedElement parent) {
- langlet.write_array (this, ptr, parent);
- }
-
- public void set_type_references () {
- if ( this.data_type == null )
- /*TODO:possible?*/;
- else if ( this.data_type is Array )
- ((Array)this.data_type).set_type_references ();
- else if ( this.data_type is Pointer )
- ((Pointer)this.data_type).set_type_references ();
- else
- ((TypeReference)this.data_type).set_type_references ();
- }
-}
-
-public class Valadoc.Pointer : Basic {
- private Vala.PointerType vtype;
-
- public Basic data_type {
- private set;
- get;
- }
-
- public Pointer (Valadoc.Settings settings, Vala.PointerType vtyperef, Basic parent, Tree head) {
- this.settings = settings;
- this.vtype = vtyperef;
- this.parent = parent;
- this.head = head;
-
- Vala.DataType vntype = vtype.base_type;
- if (vntype is Vala.PointerType)
- this.data_type = new Pointer (settings, (Vala.PointerType)vntype, this, head);
- else if (vntype is Vala.ArrayType)
- this.data_type = new Array (settings, (Vala.ArrayType)vntype, this, head);
- else
- this.data_type = new TypeReference (settings, vntype, this, head);
- }
-
- public void write (Langlet langlet, void* ptr, DocumentedElement parent) {
- langlet.write_pointer (this, ptr, parent);
- }
-
- public void set_type_references () {
- Basic type = this.data_type;
- if ( type == null )
- ;
- else if ( type is Array )
- ((Array)type).set_type_references ();
- else if ( type is Pointer )
- ((Pointer)type ).set_type_references ();
- else
- ((TypeReference)type).set_type_references ();
- }
-}
-
-
-public abstract class Valadoc.DocumentedElement : Basic, Documented {
- private Namespace? _nspace = null;
- private Package? _package = null;
- private string _full_name = null;
- private int _line = -1;
-
- public Namespace? nspace {
- get {
- if (this._nspace == null) {
- Valadoc.Basic ast = this;
- while (ast is Valadoc.Namespace == false) {
- ast = ast.parent;
- if (ast == null)
- return null;
- }
- this._nspace = (Valadoc.Namespace)ast;
- }
- return this._nspace;
- }
- }
-
-
- public Package? package {
- get {
- if (this._package == null) {
- Valadoc.Basic ast = this;
- while (ast is Valadoc.Package == false) {
- ast = ast.parent;
- if (ast == null)
- return null;
- }
- this._package = (Valadoc.Package)ast;
- }
- return this._package;
- }
- }
-
- public int line {
- get {
- if (this._line == -1) {
- Vala.SourceReference vsref = this.vsymbol.source_reference;
- this._line = (vsref == null)? 0 : vsref.first_line;
- }
- return this._line;
- }
- }
-
- protected Vala.Comment vcomment {
- get; set;
- }
-
- public DocumentationTree? documentation {
- protected set;
- get;
- }
-
- public virtual string? name {
- owned get {
- return this.vsymbol.name;
- }
- }
-
- // rename to get_full_name
- public string? 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 (Basic pos = this.parent; pos is Package == false ; pos = pos.parent) {
- string name = ((DocumentedElement)pos).name;
- if (name != null) {
- full_name.prepend_unichar ('.');
- full_name.prepend (name);
- }
- }
- }
- this._full_name = full_name.str;
- }
- return this._full_name;
- }
-
- public string? get_filename () {
- SourceReference? sref = this.vsymbol.source_reference;
- if ( sref == null )
- return null;
-
- Vala.SourceFile? file = sref.file;
- if ( file == null )
- return null;
-
- string path = sref.file.filename;
- return GLib.Path.get_basename ( path );
- }
-/*
- // rename to file_name
- public string? filename {
- owned get {
- SourceReference? sref = this.vsymbol.source_reference;
- if ( sref == null )
- return null;
-
- Vala.SourceFile? file = sref.file;
- if ( file == null )
- return null;
-
- string path = sref.file.filename;
- return GLib.Path.get_basename ( path );
- }
- }
-*/
- protected void parse_comment_helper ( Valadoc.Parser docparser ) {
- this.documentation = docparser.parse ( this );
- }
-
- // internal
- public virtual DocumentedElement? search_element ( string[] params, int pos ) {
- return null;
- }
-
- // internal
- public virtual DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> list, int pos ) {
- return null;
- }
-}
-
-// remove
-public interface Valadoc.Inheritable : Valadoc.DocumentedElement {
- protected abstract Inheritable? base_type {
- set;
- get;
- }
-
- public abstract Gee.Collection<Interface> get_implemented_interface_list ( );
-}
-
-
-public interface Valadoc.EnumHandler : Basic {
- protected abstract Gee.ArrayList<Enum> enums {
- set;
- get;
- }
-
- protected void set_enum_type_references ( ) {
- foreach ( Enum en in this.enums ) {
- en.set_type_references ( );
- }
- }
-
- protected DocumentedElement? search_enum_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- foreach ( Enum en in this.enums ) {
- DocumentedElement element = en.search_element_vala ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- protected DocumentedElement? search_enum ( string[] params, int pos ) {
- foreach ( Enum en in this.enums ) {
- DocumentedElement element = en.search_element ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- public Gee.Collection<Enum> get_enum_list ( ) {
- var lst = new Gee.ArrayList<Enum> ();
- foreach ( Enum en in this.enums ) {
- if ( !en.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( en );
- }
-
- return new Gee.ReadOnlyCollection<Enum>( lst );
- }
-
- public void visit_enums ( Doclet doclet ) {
- foreach ( Enum en in this.enums ) {
- en.visit( doclet );
- }
- }
-
- public void add_enums ( Gee.Collection<Vala.Enum> venums ) {
- foreach ( Vala.Enum venum in venums ) {
- this.add_enum ( venum );
- }
- }
-
- public void add_enum ( Vala.Enum venum ) {
- Enum tmp = new Enum ( this.settings, venum, this, this.head );
- this.enums.add( tmp );
- }
-
- protected void parse_enum_comments ( Valadoc.Parser docparser ) {
- foreach ( Enum en in this.enums ) {
- en.parse_comments ( docparser );
- }
- }
-}
-
-public interface Valadoc.DelegateHandler : Basic {
- protected abstract Gee.ArrayList<Delegate> delegates {
- set;
- get;
- }
-
- protected DocumentedElement? search_delegate_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Delegate == false )
- return null;
-
- foreach ( Delegate del in this.delegates ) {
- if ( del.is_vdelegate ( (Vala.Delegate)velement ) ) {
- return del;
- }
- }
- return null;
- }
-
- protected DocumentedElement? search_delegate ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Delegate del in this.delegates ) {
- if ( del.name == params[pos] )
- return del;
- }
- return null;
- }
-
- public Gee.Collection<Delegate> get_delegate_list ( ) {
- var lst = new Gee.ArrayList<Delegate> ();
- foreach ( Delegate del in this.delegates ) {
- if ( !del.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( del );
- }
-
- return new Gee.ReadOnlyCollection<Delegate>( lst );
- }
-
- public void visit_delegates ( Doclet doclet ) {
- foreach ( Delegate del in this.delegates ) {
- del.visit ( doclet );
- }
- }
-
- public void add_delegates ( Gee.Collection<Vala.Delegate> vdels ) {
- foreach ( Vala.Delegate vdel in vdels ) {
- this.add_delegate ( vdel );
- }
- }
-
- public void add_delegate ( Vala.Delegate vdel ) {
- var tmp = new Delegate ( this.settings, vdel, this, this.head );
- this.delegates.add ( tmp );
- }
-
- public void set_delegate_type_references ( ) {
- foreach ( Delegate del in this.delegates ) {
- del.set_type_references ( );
- }
- }
-
- public void parse_delegate_comments ( Valadoc.Parser docparser ) {
- foreach ( Delegate del in this.delegates ) {
- del.parse_comment ( docparser );
- }
- }
-}
-
-public interface Valadoc.InterfaceHandler : Basic {
- protected abstract Gee.ArrayList<Interface> interfaces {
- set;
- get;
- }
-
- protected DocumentedElement? search_interface_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- foreach ( Interface iface in this.interfaces ) {
- DocumentedElement? element = iface.search_element_vala ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- protected DocumentedElement? search_interface ( string[] params, int pos ) {
- foreach ( Interface iface in this.interfaces ) {
- DocumentedElement? element = iface.search_element ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- public Gee.Collection<Interface> get_interface_list ( ) {
- var lst = new Gee.ArrayList<Interface> ();
- foreach ( Interface iface in this.interfaces ) {
- if ( !iface.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( iface );
- }
-
- return new Gee.ReadOnlyCollection<Interface>( lst );
- }
-
- public void visit_interfaces ( Doclet doclet ) {
- foreach ( Interface iface in this.interfaces ) {
- iface.visit( doclet );
- }
- }
-
- protected void add_interfaces ( Gee.Collection<Vala.Interface> vifaces ) {
- foreach ( Vala.Interface viface in vifaces ) {
- this.add_interface ( viface );
- }
- }
-
- // internal
- public void add_interface ( Vala.Interface viface ) {
- var tmp = new Interface ( this.settings, viface, this, this.head );
- this.interfaces.add ( tmp );
- }
-
- protected void set_interface_type_references ( ) {
- foreach ( Interface iface in this.interfaces ) {
- iface.set_type_references ( );
- }
- }
-
- protected void parse_interface_comments ( Valadoc.Parser docparser ) {
- foreach ( Interface iface in this.interfaces ) {
- iface.parse_comments ( docparser );
- }
- }
-}
-
-
-
-public interface Valadoc.ErrorDomainHandler : Basic {
- protected abstract Gee.ArrayList<ErrorDomain> errdoms {
- set;
- get;
- }
-
- protected DocumentedElement? search_error_domain_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- DocumentedElement? element = errdom.search_element_vala ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- protected DocumentedElement? search_error_domain ( string[] params, int pos ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- DocumentedElement? element = errdom.search_element ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- public Gee.Collection<ErrorDomain> get_error_domain_list ( ) {
- var lst = new Gee.ArrayList<ErrorDomain> ();
- foreach ( ErrorDomain errdom in this.errdoms ) {
- if ( !errdom.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( errdom );
- }
-
- return new Gee.ReadOnlyCollection<ErrorDomain>( lst );
- }
-
- // internal
- public ErrorDomain? find_errordomain ( Vala.ErrorDomain ver ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- if ( errdom.is_verrordomain( ver ) )
- return errdom;
- }
- return null;
- }
-
- public void visit_error_domains ( Doclet doclet ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- errdom.visit ( doclet );
- }
- }
-
- public void add_error_domains ( Gee.Collection<Vala.ErrorDomain> verrdoms ) {
- foreach ( Vala.ErrorDomain verrdom in verrdoms ) {
- this.add_error_domain ( verrdom );
- }
- }
-
- public void add_error_domain ( Vala.ErrorDomain verrdom ) {
- var tmp = new ErrorDomain ( this.settings, verrdom, this, this.head );
- this.errdoms.add ( tmp );
- }
-
- protected void set_errordomain_type_referenes ( ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- errdom.set_type_references ( );
- }
- }
-
- protected void parse_errordomain_comments ( Valadoc.Parser docparser ) {
- foreach ( ErrorDomain errdom in this.errdoms ) {
- errdom.parse_comments ( docparser );
- }
- }
-}
-
-// rename
-public interface Valadoc.Writeable : Basic {
- public abstract DocumentationTree? documentation {
- protected set;
- get;
- }
-}
-
-public interface Valadoc.NamespaceHandler : Basic {
- public abstract Gee.ArrayList<Namespace> namespaces {
- set;
- get;
- }
-
- public Gee.ReadOnlyCollection<Namespace> get_namespace_list () {
- return new Gee.ReadOnlyCollection<Namespace> ( this.namespaces );
- }
-
- public void visit_namespaces ( Doclet doclet ) {
- foreach ( Namespace ns in this.namespaces ) {
- ns.visit ( doclet );
- }
- }
-
- private Gee.ArrayList<Vala.Namespace> create_parent_vnamespace_list ( Vala.Symbol vsymbol ) {
- var lst = new Gee.ArrayList<Vala.Namespace> ();
-
- while ( vsymbol != null ) {
- if ( vsymbol is Vala.Namespace ) {
- lst.insert ( 0, (Vala.Namespace)vsymbol );
- }
- vsymbol = vsymbol.parent_symbol;
- }
- return lst;
- }
-
- // internal
- public Namespace get_namespace_helper ( Vala.Symbol node, Gee.List<Vala.Namespace> vnspaces, int pos ) {
- Vala.Namespace vns = vnspaces.get( pos );
-
- Namespace ns = this.find_namespace_without_childs ( vns );
- if ( ns == null ) {
- ns = new Namespace( this.settings, vns, this, this.head );
- this.namespaces.add ( ns );
- }
-
- if ( vnspaces.size == pos+1 ) {
- return ns;
- }
-
- return ns.get_namespace_helper ( node, vnspaces, pos+1 );
- }
-
- protected Namespace get_namespace ( Vala.Symbol node ) {
- Vala.Symbol vnd = ((Vala.Symbol)node).parent_symbol;
- if ( vnd is Vala.Namespace == false )
- vnd = vnd.parent_symbol;
-
- Vala.Namespace vnspace = (Vala.Namespace)vnd;
- var nspace = this.find_namespace ( vnspace );
- if ( nspace != null )
- return nspace;
-
-
- var vnspaces = this.create_parent_vnamespace_list ( node );
-
- if ( vnspaces.size > 2 ) {
- return this.get_namespace_helper ( node, vnspaces, 1 );
- }
- else {
- var ns = new Namespace( this.settings, vnspace, this, this.head );
- this.namespaces.add( ns );
- return ns;
- }
- }
-
- // internal
- public Namespace? find_vnamespace_helper ( Gee.List<Vala.Namespace> vnspaces, int pos ) {
- Vala.Namespace? vns = vnspaces.get ( pos );
- if ( vns == null )
- return null;
-
- foreach ( Namespace ns in this.namespaces ) {
- if ( !ns.is_vnspace( vns ) )
- continue ;
-
- if ( pos+1 == vnspaces.size )
- return ns;
-
- return ns.find_vnamespace_helper ( vnspaces, pos+1 );
- }
-
- return null;
- }
-
- // internal?
- private Namespace find_namespace_without_childs ( Vala.Namespace vns ) {
- Namespace ns2 = null;
-
- foreach ( Namespace ns in this.namespaces ) {
- if ( ns.is_vnspace(vns) )
- ns2 = ns;
- }
-
- return ns2;
- }
-
- // internal
- public Namespace find_namespace ( Vala.Namespace vns ) {
- var vnspaces = this.create_parent_vnamespace_list ( vns );
-
- return this.find_vnamespace_helper ( vnspaces, vnspaces.index_of( vns ) );
- }
-
- // internal
- public void set_namespace_type_references ( ) {
- foreach ( Namespace ns in this.namespaces ){
- ns.set_type_references ();
- }
- }
-
- // internal
- public void namespace_inheritance ( ) {
- foreach ( Namespace ns in this.namespaces ){
- ns.inheritance( );
- }
- }
-
- // internal
- public void parse_namespace_comments ( Valadoc.Parser docparser ) {
- foreach ( Namespace ns in this.namespaces ){
- ns.parse_comments ( docparser );
- }
- }
-}
-
-
-
-public interface Valadoc.ClassHandler : Basic {
- protected abstract Gee.ArrayList<Class> classes {
- set;
- get;
- }
-
- protected DocumentedElement? search_class_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- foreach ( Class cl in this.classes ) {
- DocumentedElement? element = cl.search_element_vala ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- protected DocumentedElement? search_class ( string[] params, int pos ) {
- foreach ( Class cl in this.classes ) {
- DocumentedElement? element = cl.search_element ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- protected Class? find_vclass ( Vala.Class vcl ) {
- foreach ( Class cl in this.classes ) {
- if ( cl.is_vclass ( vcl ) )
- return cl;
-
- var tmp = cl.find_vclass ( vcl );
- if ( tmp != null )
- return tmp;
- }
- return null;
- }
-
- public Gee.ReadOnlyCollection<Class> get_class_list ( ) {
- var lst = new Gee.ArrayList<Class> ();
- foreach ( Class cl in this.classes ) {
- if ( !cl.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( cl );
- }
-
- return new Gee.ReadOnlyCollection<Class>( lst );
- }
-
- // internal
- public void add_class ( Vala.Class vcl ) {
- Class cl = new Class ( this.settings, vcl, this, this.head );
- this.classes.add ( cl );
- }
-
- public void add_classes ( Gee.Collection<Vala.Class> vclasses ) {
- foreach ( Vala.Class vcl in vclasses ) {
- this.add_class ( vcl );
- }
- }
-
-
- public void visit_classes ( Doclet doclet ) {
- foreach ( Class cl in this.get_class_list() ) {
- cl.visit ( doclet );
- }
- }
-
- protected void set_class_type_references ( ) {
- foreach ( Class cl in this.classes ) {
- cl.set_type_references ();
- }
- }
-
- protected void parse_class_comments ( Valadoc.Parser docparser ) {
- foreach ( Class cl in this.classes ) {
- cl.parse_comments ( docparser );
- }
- }
-}
-
-
-
-public interface Valadoc.PropertyHandler : Basic {
- protected abstract Gee.ArrayList<Property> properties {
- get;
- set;
- }
-
- protected DocumentedElement? search_property_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Property == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Property prop in this.properties ) {
- if ( prop.is_vproperty ( (Vala.Property)velement ) ) {
- return prop;
- }
- }
- return null;
- }
-
- protected DocumentedElement? search_property ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Property prop in this.properties ) {
- if ( prop.name == params[pos] )
- return prop;
- }
- return null;
- }
-
- protected bool is_overwritten_property ( Property prop ) {
- foreach ( Property p in this.properties ) {
- if ( p.parent != this )
- continue ;
-
- if ( !p.is_override )
- continue ;
-
- if ( p.equals ( prop ) )
- return true;
- }
- return false;
- }
-
- public Gee.ReadOnlyCollection<Property> get_property_list ( ) {
- var lst = new Gee.ArrayList<Property> ();
- foreach ( Property p in this.properties ) {
- if ( !p.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( p );
- }
-
- return new Gee.ReadOnlyCollection<Property>( lst );
- }
-
- protected void parse_property_comments ( Valadoc.Parser docparser ) {
- foreach ( Property prop in this.properties ) {
- prop.parse_comment ( docparser );
- }
- }
-
- public void visit_properties ( Doclet doclet ) {
- foreach ( Property prop in this.get_property_list () )
- prop.visit ( doclet );
- }
-
- // rename to set_property_type_references
- protected void set_property_type_reference () {
- foreach ( Property prop in this.properties ) {
- prop.set_type_references ( );
- }
- }
-
- protected void add_properties ( Gee.Collection<Vala.Property> vproperties ) {
- foreach ( Vala.Property vprop in vproperties ) {
- var tmp = new Property ( this.settings, vprop, this, this.head );
- this.properties.add ( tmp );
- }
- }
-}
-
-
-public interface Valadoc.ConstructionMethodHandler : Basic, MethodHandler {
- protected abstract Gee.ArrayList<Method> construction_methods {
- set;
- get;
- }
-
- protected DocumentedElement? search_construction_method_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Method == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Method m in this.methods ) {
- if ( m.is_vmethod ( (Vala.Method)velement ) ) {
- return m;
- }
- }
- return null;
- }
-
- protected DocumentedElement? search_construction_method ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] == null )
- return null;
-
- if ( params[pos+2] != null )
- return null;
-
- string name = params[pos] + "." + params[pos+1];
-
- foreach ( Method m in this.construction_methods ) {
- if ( m.name == name )
- return m;
- }
- return null;
- }
-
- public Gee.ReadOnlyCollection<Method> get_construction_method_list ( ) {
- var lst = new Gee.ArrayList<Method> ();
- foreach ( Method cm in this.construction_methods ) {
- if ( !cm.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( cm );
- }
-
- return new Gee.ReadOnlyCollection<Method>( lst );
- }
-
- protected void parse_construction_method_comments ( Valadoc.Parser docparser ) {
- foreach ( Method cm in this.construction_methods ) {
- cm.parse_comment ( docparser );
- }
- }
-
- protected void set_construction_method_references ( ) {
- foreach ( Method cm in this.construction_methods ) {
- cm.set_type_references ( );
- }
- }
-
- public void visit_construction_methods ( Doclet doclet ) {
- foreach ( Method m in this.get_construction_method_list() ) {
- m.visit ( doclet, this );
- }
- }
-
- protected void add_construction_method ( Vala.CreationMethod vm ) {
- var tmp = new Method ( this.settings, vm, this, this.head );
- this.construction_methods.add ( tmp );
- }
-
- protected void add_methods_and_construction_methods ( Gee.Collection<Vala.Method> vmethods ) {
- foreach ( Vala.Method vm in vmethods ) {
- if ( vm is Vala.CreationMethod ) {
- //if ( ((Vala.CreationMethod)vm).generated == false ) {
- this.add_construction_method ( (Vala.CreationMethod)vm );
- //}
- }
- else {
- this.add_method ( vm );
- }
- }
- }
-}
-
-public interface Valadoc.SignalHandler : Basic {
- protected abstract Gee.ArrayList<Signal> signals {
- get;
- set;
- }
-
- protected DocumentedElement? search_signal_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Signal == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Signal sig in this.signals ) {
- if ( sig.is_vsignal ( (Vala.Signal)velement ) ) {
- return sig;
- }
- }
- return null;
- }
-
- protected DocumentedElement? search_signal ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Signal sig in this.signals ) {
- if ( sig.name == params[pos] )
- return sig;
- }
- return null;
- }
-
- // internal
- public void add_signals ( Gee.Collection<Vala.Signal> vsignals ) {
- foreach ( Vala.Signal vsig in vsignals ) {
- var tmp = new Signal ( this.settings, vsig, this, this.head );
- this.signals.add ( tmp );
- }
- }
-
- public void visit_signals ( Doclet doclet ) {
- foreach ( Signal sig in this.get_signal_list ( ) ) {
- sig.visit ( doclet );
- }
- }
-
- public Gee.ReadOnlyCollection<Signal> get_signal_list () {
- var lst = new Gee.ArrayList<Signal> ();
- foreach ( Signal sig in this.signals ) {
- if ( !sig.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( sig );
- }
-
- return new Gee.ReadOnlyCollection<Signal>( lst );
- }
-
- // internal
- protected void set_signal_type_references () {
- foreach ( Signal sig in this.signals ) {
- sig.set_type_references ( );
- }
- }
-
- // internal
- protected void parse_signal_comments ( Valadoc.Parser docparser ) {
- foreach ( Signal sig in this.signals ) {
- sig.parse_comment ( docparser );
- }
- }
-}
-
-
-
-public interface Valadoc.StructHandler : Basic {
- protected abstract Gee.ArrayList<Struct> structs {
- set;
- get;
- }
-
- protected DocumentedElement? search_struct_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- foreach ( Struct stru in this.structs ) {
- DocumentedElement? element = stru.search_element_vala ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
-
- protected DocumentedElement? search_struct ( string[] params, int pos ) {
- foreach ( Struct stru in this.structs ) {
- DocumentedElement? element = stru.search_element ( params, pos+1 );
- if ( element != null )
- return element;
- }
- return null;
- }
-
- public Gee.Collection<Struct> get_struct_list ( ) {
- var lst = new Gee.ArrayList<Struct> ();
- foreach ( Struct stru in this.structs ) {
- if ( !stru.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( stru );
- }
-
- return new Gee.ReadOnlyCollection<Struct>( lst );
- }
-
- public void add_struct ( Vala.Struct vstru ) {
- Struct stru = new Struct ( this.settings, vstru, this, this.head );
- this.structs.add( stru );
- }
-
- public void add_structs ( Gee.Collection<Vala.Struct> vstructs ) {
- foreach ( Vala.Struct vstru in vstructs ) {
- this.add_struct ( vstru );
- }
- }
-
- public void visit_structs ( Doclet doclet ) {
- foreach ( Struct stru in this.get_struct_list() ) {
- stru.visit ( doclet );
- }
- }
-
- protected void set_struct_type_references ( ) {
- foreach ( Struct stru in this.structs ) {
- stru.set_type_references ( );
- }
- }
-
- protected void parse_struct_comments ( Valadoc.Parser docparser ) {
- foreach ( Struct stru in this.structs ) {
- stru.parse_comments ( docparser );
- }
- }
-}
-
-
-
-public interface Valadoc.Visitable : Basic, SymbolAccessibility {
- protected bool is_type_visitor_accessible (Valadoc.Basic element) {
- if (!this.settings._private && this.is_private)
- return false;
-
- if (!this.settings._internal && this.is_internal)
- return false;
-
- if (!this.settings._protected && this.is_protected)
- return false;
-
- if (this.parent != element && !this.settings.add_inherited)
- return false;
-
- return true;
- }
-
- public bool is_visitor_accessible ( ) {
- if (!this.settings._private && this.is_private)
- return false;
-
- if (!this.settings._internal && this.is_internal)
- return false;
-
- if (!this.settings._protected && this.is_protected)
- return false;
-
- return true;
- }
-}
-
-
-public interface Valadoc.SymbolAccessibility : Basic {
- public bool is_public {
- get {
- Vala.SymbolAccessibility access = vsymbol.access;
- return ( access == Vala.SymbolAccessibility.PUBLIC );
- }
- }
-
- public bool is_protected {
- get {
- Vala.SymbolAccessibility access = vsymbol.access;
- return (access == Vala.SymbolAccessibility.PROTECTED);
- }
- }
-
- public bool is_internal {
- get {
- Vala.SymbolAccessibility access = vsymbol.access;
- return (access == Vala.SymbolAccessibility.INTERNAL);
- }
- }
-
- public bool is_private {
- get {
- Vala.SymbolAccessibility access = vsymbol.access;
- return (access == Vala.SymbolAccessibility.PRIVATE);
- }
- }
-}
-
-
-
-public interface Valadoc.ReturnTypeHandler : Basic {
- public abstract TypeReference? type_reference {
- protected set;
- get;
- }
-
- // internal
- public void set_return_type_references ( ) {
- if ( this.type_reference == null )
- return ;
-
- this.type_reference.set_type_references ( );
- }
-
- // internal, rename
- protected void set_ret_type ( Vala.DataType? vtref ) {
- var tmp = new TypeReference ( this.settings, vtref, this, this.head );
- this.type_reference = tmp;
- }
-}
-
-public interface Valadoc.ConstantHandler : Basic {
- protected abstract Gee.ArrayList<Constant> constants {
- protected set;
- get;
- }
-
- protected DocumentedElement? search_constant_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Constant == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Constant c in this.constants ) {
- if ( c.is_vconstant ( (Vala.Constant)velement ) ) {
- return c;
- }
- }
- return null;
- }
-
- // internal
- protected DocumentedElement? search_constant ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Constant c in this.constants ) {
- if ( c.name == params[pos] )
- return c;
- }
- return null;
- }
-
- public Gee.ReadOnlyCollection<Constant> get_constant_list ( ) {
- var lstd = new Gee.ArrayList<Constant> ();
- foreach (Constant c in this.constants) {
- if (!c.is_type_visitor_accessible (this) )
- continue ;
-
- lstd.add (c);
- }
-
- return new Gee.ReadOnlyCollection<Constant>(lstd);
- }
-
- // internal
- public void add_constants (Gee.Collection<Vala.Constant> vconstants) {
- foreach (Vala.Constant vc in vconstants) {
- this.add_constant (vc);
- }
- }
-
- // internal
- public void add_constant (Vala.Constant vc) {
- var tmp = new Constant (this.settings, vc, this, this.head);
- this.constants.add ( tmp );
- }
-
- // internal
- public void set_constant_type_references ( ) {
- foreach ( Constant c in this.constants ) {
- c.set_type_references ( );
- }
- }
-
- // internal
- public void parse_constant_comments ( Valadoc.Parser docparser ) {
- foreach ( Constant c in this.constants ) {
- c.parse_comment ( docparser );
- }
- }
-
- public void visit_constants ( Doclet doclet ) {
- foreach ( Constant c in this.get_constant_list() ) {
- c.visit ( doclet, this );
- }
- }
-}
-
-
-public interface Valadoc.FieldHandler : Basic {
- protected abstract Gee.ArrayList<Field> fields {
- protected set;
- get;
- }
-
- protected DocumentedElement? search_field_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Field == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Field f in this.fields ) {
- if ( f.is_vfield ( (Vala.Field)velement ) ) {
- return f;
- }
- }
- return null;
- }
-
- // internal
- protected DocumentedElement? search_field ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Field f in this.fields ) {
- if ( f.name == params[pos] )
- return f;
- }
- return null;
- }
-
- public Gee.ReadOnlyCollection<Field> get_field_list ( ) {
- var lstd = new Gee.ArrayList<Field> ();
- foreach ( Field f in this.fields ) {
- if ( !f.is_type_visitor_accessible ( this ) )
- continue ;
-
- lstd.add ( f );
- }
-
- return new Gee.ReadOnlyCollection<Field>( lstd );
- }
-
- // internal
- public void add_fields ( Gee.Collection<Vala.Field> vfields ) {
- foreach ( Vala.Field vf in vfields ) {
- this.add_field ( vf );
- }
- }
-
- // internal
- public void add_field ( Vala.Field vf ) {
- //if ( vf.generated == true )
- // return ;
-
- var tmp = new Field ( this.settings, vf, this, this.head );
- this.fields.add ( tmp );
- }
-
- // internal
- public void set_field_type_references ( ) {
- foreach ( Field field in this.fields ) {
- field.set_type_references ( );
- }
- }
-
- // internal
- public void parse_field_comments ( Valadoc.Parser docparser ) {
- foreach ( Field field in this.fields ) {
- field.parse_comment ( docparser );
- }
- }
-
- public void visit_fields ( Doclet doclet ) {
- foreach ( Field field in this.get_field_list() ) {
- field.visit ( doclet, this );
- }
- }
-}
-
-// rename to ExceptionListHandler
-public interface Valadoc.ExceptionHandler : Basic {
- protected abstract Gee.ArrayList<DocumentedElement> err_domains {
- protected set;
- get;
- }
-
- public Gee.ReadOnlyCollection<DocumentedElement> get_error_domains ( ) {
- return new Gee.ReadOnlyCollection<DocumentedElement> ( this.err_domains );
- }
-
- public void add_exception_list ( Gee.Collection<Vala.DataType> vexceptions ) {
- foreach ( Vala.DataType vtype in vexceptions ) {
- if ( ((Vala.ErrorType)vtype).error_domain == null ) {
- this.err_domains.add ( glib_error );
- }
- else {
- ErrorDomain type = (ErrorDomain)this.head.search_vala_symbol ( ((Vala.ErrorType)vtype).error_domain );
- this.err_domains.add ( type );
- }
- }
- }
-}
-
-public interface Valadoc.ParameterListHandler : Basic {
- protected abstract Gee.ArrayList<FormalParameter> param_list {
- protected set;
- get;
- }
-
- public Gee.ReadOnlyCollection<FormalParameter> get_parameter_list ( ) {
- return new Gee.ReadOnlyCollection<FormalParameter> ( this.param_list );
- }
-
- protected void add_parameter_list ( Gee.Collection<Vala.FormalParameter> vparams ) {
- foreach ( Vala.FormalParameter vfparam in vparams ) {
- var tmp = new FormalParameter ( this.settings, vfparam, this, this.head );
- this.param_list.add ( tmp );
- }
- }
-
- // internal
- public void set_parameter_list_type_references ( ) {
- foreach ( FormalParameter fparam in this.param_list ) {
- fparam.set_type_references ( );
- }
- }
-}
-
-
-
-public interface Valadoc.MethodHandler : Basic {
- protected abstract Gee.ArrayList<Method> methods {
- set;
- get;
- }
-
- protected DocumentedElement? search_method_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.Method == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( Method m in this.methods ) {
- if ( m.is_vmethod ( (Vala.Method)velement ) ) {
- return m;
- }
- }
- return null;
- }
-
- // internal
- protected DocumentedElement? search_method ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( Method m in this.methods ) {
- if ( m.name == params[pos] )
- return m;
- }
- return null;
- }
-
- // internal
- public void set_method_type_references ( ) {
- foreach ( Method m in this.methods ) {
- m.set_type_references ( );
- }
- }
-
- // internal
- public void parse_method_comments ( Valadoc.Parser docparser ) {
- foreach ( Method m in this.methods ) {
- m.parse_comment ( docparser );
- }
- }
-
- protected void add_method ( Vala.Method vmethod ) {
- var tmp = new Method ( this.settings, vmethod, this, this.head );
- this.methods.add ( tmp );
- }
-
- protected void add_methods ( Gee.Collection<Vala.Method> vmethods ) {
- foreach ( Vala.Method vm in vmethods ) {
- this.add_method ( vm );
- }
- }
-
- public void visit_methods ( Doclet doclet ) {
- foreach ( Method m in this.get_method_list() ) {
- m.visit ( doclet, this );
- }
- }
-
- public Gee.ReadOnlyCollection<Method> get_method_list ( ) {
- var lst = new Gee.ArrayList<Method> ();
- foreach ( Method m in this.methods ) {
- if ( !m.is_type_visitor_accessible ( this ) )
- continue ;
-
- lst.add ( m );
- }
-
- return new Gee.ReadOnlyCollection<Method>( lst );
- }
-}
-
-
-
-public interface Valadoc.TemplateParameterListHandler : Basic {
- protected abstract Gee.ArrayList<TypeParameter> template_param_lst {
- set;
- get;
- }
-
- public TypeParameter? find_vtemplateparameter ( Vala.GenericType vttype ) {
- foreach ( TypeParameter tparam in this.template_param_lst ) {
- if ( tparam.is_vtypeparam ( vttype.type_parameter ) )
- return tparam;
- }
-
- if ( this.parent is TemplateParameterListHandler )
- return ((TemplateParameterListHandler)this.parent).find_vtemplateparameter ( vttype );
-
- return null;
- }
-
- public Gee.ReadOnlyCollection<TypeParameter> get_template_param_list ( ) {
- return new Gee.ReadOnlyCollection<TypeParameter> ( this.template_param_lst );
- }
-
- // internal
- public void set_template_parameter_list ( Gee.Collection<Vala.TypeParameter> vtparams ) {
- foreach ( Vala.TypeParameter vtparam in vtparams ) {
- var tmp = new TypeParameter ( this.settings, vtparam, this, this.head );
- this.template_param_lst.add ( tmp );
- }
- }
-
- // internal
- public void set_template_parameter_list_references ( ) {
- foreach ( TypeParameter tparam in this.template_param_lst ) {
- tparam.set_type_reference ( );
- }
- }
-}
-
-public class Valadoc.Constant : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
- private Vala.Constant vconst;
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public bool is_vconstant ( Vala.Constant vconst ) {
- return ( this.vconst == vconst );
- }
-
- public Constant ( Valadoc.Settings settings, Vala.Constant vconst, ConstantHandler parent, Tree head ) {
- this.vcomment = vconst.comment;
- this.settings = settings;
- this.vsymbol = vconst;
- this.vconst = vconst;
- this.parent = parent;
- this.head = head;
-
- var vret = this.vconst.type_reference;
- this.set_ret_type ( vret );
- }
-
- public string get_cname () {
- return this.vconst.get_cname ();
- }
-
- // internal
- public void set_type_references ( ) {
- ((ReturnTypeHandler)this).set_return_type_references ( );
- }
-
- // internal
- public void parse_comment ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- }
-
- public void visit ( Doclet doclet, ConstantHandler? parent ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_constant ( this, parent );
- }
-
- public void write ( Langlet langlet, void* ptr, ConstantHandler parent ) {
- langlet.write_constant ( this, parent, ptr );
- }
-}
-
-
-public class Valadoc.Field : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
- private Vala.Field vfield;
-
- public Field ( Valadoc.Settings settings, Vala.Field vfield, FieldHandler parent, Tree head ) {
- this.vcomment = vfield.comment;
- this.settings = settings;
- this.vsymbol = vfield;
- this.vfield = vfield;
- this.parent = parent;
- this.head = head;
-
- var vret = this.vfield.field_type;
- this.set_ret_type ( vret );
- }
-
- // internal
- public bool is_vfield ( Vala.Field vfield ) {
- return ( this.vfield == vfield );
- }
-
- public string? get_cname () {
- return this.vfield.get_cname();
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public bool is_static {
- get {
- if ( this.parent is Namespace )
- return false;
-
- return this.vfield.binding == MemberBinding.STATIC;
- }
- }
-
- public bool is_volatile {
- get {
- return this.vfield.is_volatile;
- }
- }
-
- // internal
- public void set_type_references ( ) {
- ((ReturnTypeHandler)this).set_return_type_references ( );
- }
-
- // internal
- public void parse_comment ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- }
-
- public void visit ( Doclet doclet, FieldHandler? parent ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_field ( this, parent );
- }
-
- public void write ( Langlet langlet, void* ptr, FieldHandler parent ) {
- langlet.write_field ( this, parent, ptr );
- }
-}
-
-
-public class Valadoc.TypeReference : Basic {
- private Gee.ArrayList<TypeReference> type_arguments = new Gee.ArrayList<TypeReference> ();
- private Vala.DataType? vtyperef;
-
- public TypeReference ( Valadoc.Settings settings, Vala.DataType? vtyperef, Basic parent, Tree head ) {
- this.settings = settings;
- this.vtyperef = vtyperef;
- this.parent = parent;
- this.head = head;
- }
-
- public Gee.ReadOnlyCollection<TypeReference> get_type_arguments ( ) {
- return new Gee.ReadOnlyCollection<TypeReference> ( this.type_arguments );
- }
-
- private void set_template_argument_list ( Gee.Collection<Vala.DataType> varguments ) {
- foreach ( Vala.DataType vdtype in varguments ) {
- var dtype = new TypeReference ( this.settings, vdtype, this, this.head );
- dtype.set_type_references ( );
- this.type_arguments.add ( dtype );
- }
- }
-
- public Basic? data_type {
- private set;
- get;
- }
-
- public bool pass_ownership {
- get {
- Vala.CodeNode? node = this.vtyperef.parent_node;
- if ( node == null )
- return false;
-
- if ( node is Vala.FormalParameter ) {
- return ( ((Vala.FormalParameter)node).direction == ParameterDirection.IN &&
- ((Vala.FormalParameter)node).parameter_type.value_owned );
- }
-
- if ( node is Vala.Property ) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
- }
-
- public bool is_owned {
- get {
- Vala.CodeNode parent = this.vtyperef.parent_node;
-
- // parameter:
- if ( parent is Vala.FormalParameter ) {
- if ( ((Vala.FormalParameter)parent).direction != ParameterDirection.IN )
- return false;
-
- return ((Vala.FormalParameter)parent).parameter_type.value_owned;
- }
- return false;
- }
- }
-
- public bool is_unowned {
- get {
- Vala.CodeNode parent = this.vtyperef.parent_node;
-
- // parameter:
- if ( parent is Vala.FormalParameter ) {
- if ( ((Vala.FormalParameter)parent).direction == ParameterDirection.IN )
- return false;
-
- return this.is_weak_helper ( ((Vala.FormalParameter)parent).parameter_type );
- }
-
- return false;
- }
- }
-
-
- // from vala/valacodewriter.vala
- private bool is_weak_helper ( Vala.DataType type ) {
- if (type.value_owned) {
- return false;
- } else if (type is Vala.VoidType || type is Vala.PointerType) {
- return false;
- } else if (type is Vala.ValueType) {
- if (type.nullable) {
- // nullable structs are heap allocated
- return true;
- }
-
- // TODO return true for structs with destroy
- return false;
- }
-
- return true;
- }
-
- public bool is_dynamic {
- get {
- return this.vtyperef.is_dynamic;
- }
- }
-
- public bool is_weak {
- get {
- Vala.CodeNode parent = this.vtyperef.parent_node;
-
- if (parent is Vala.FormalParameter) {
- return false;
- }
-
- if (parent is Vala.Method == true) {
- return this.is_weak_helper ( ((Vala.Method)parent).return_type );
- }
- else if (parent is Vala.Signal == true) {
- return this.is_weak_helper ( ((Vala.Signal)parent).return_type );
- }
- else if (parent is Vala.Delegate == true) {
- return this.is_weak_helper ( ((Vala.Delegate)parent).return_type );
- }
-
- return ( this.vtyperef.parent_node is Field )? this.is_weak_helper( this.vtyperef ) : false;
- }
- }
-
- public bool is_nullable {
- get {
- return this.vtyperef.nullable && this.vtyperef is Vala.PointerType == false;
- }
- }
-
- // remove
- private string extract_type_name ( Vala.DataType vdtype ) {
- if ( vdtype is Vala.VoidType ) {
- return "void";
- }
- else if ( vdtype is Vala.PointerType ) {
- return this.extract_type_name ( ((Vala.PointerType)vdtype).base_type );
- }
- else if ( vdtype is Vala.DelegateType ) {
- return ((Vala.DelegateType)this.vtyperef).delegate_symbol.name;
- }
- else if ( vdtype is Vala.MethodType ) {
- return ((Vala.MethodType)this.vtyperef).method_symbol.name;
- }
- else if ( vdtype is Vala.SignalType ) {
- return ((Vala.SignalType)this.vtyperef).signal_symbol.name;
- }
- else if ( vdtype is Vala.ArrayType ) {
- this.extract_type_name ( ((Vala.ArrayType)vdtype).element_type );
- }
- return vtyperef.to_string();
- }
-
- // remove
- public string type_name {
- owned get {
- return this.extract_type_name ( this.vtyperef );
- }
- }
-
- private TypeParameter? find_template_parameter ( GenericType vtyperef ) {
-
- Basic? element = this.parent;
- while ( !(element is TemplateParameterListHandler || element == null) ) {
- element = element.parent;
- }
-
- if ( element == null )
- return null;
-
- return ((TemplateParameterListHandler)element).find_vtemplateparameter ( (GenericType)vtyperef );
- }
-
- // internal
- public void set_type_references ( ) {
- if ( this.vtyperef != null ) {
- if ( this.vtyperef is PointerType )
- this.data_type = new Pointer ( settings, (Vala.PointerType)this.vtyperef, this, head );
- else if ( vtyperef is ArrayType )
- this.data_type = new Array ( settings, (Vala.ArrayType)this.vtyperef, this, head );
- else if ( vtyperef is GenericType )
- this.data_type = find_template_parameter ( (GenericType)vtyperef );
- }
-
-
- if ( this.data_type == null ) {
- Vala.DataType vtype = this.vtyperef;
- this.set_template_argument_list ( vtype.get_type_arguments () );
- // still necessary?
- if ( vtype is Vala.ErrorType ) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType)vtype).error_domain;
- if ( verrdom != null )
- this.data_type = this.head.search_vala_symbol ( verrdom );
- else
- this.data_type = glib_error;
- }
- // necessary?
- else if (vtype is Vala.DelegateType ) {
- this.data_type = this.head.search_vala_symbol ( ((Vala.DelegateType)vtype).delegate_symbol );
- }
- else {
- this.data_type = this.head.search_vala_symbol ( vtype.data_type );
- }
- }
- else if ( this.data_type is Pointer ) {
- ((Pointer)this.data_type).set_type_references ();
- }
- else if ( this.data_type is Array ) {
- ((Array)this.data_type).set_type_references ();
- }
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_type_reference ( this, ptr );
- }
-}
-
-
-
-public class Valadoc.TypeParameter : Basic, ReturnTypeHandler {
- private Vala.TypeParameter vtypeparam;
-
- public bool is_vtypeparam ( Vala.TypeParameter vtypeparam ) {
- return this.vtypeparam == vtypeparam;
- }
-
- public TypeParameter ( Valadoc.Settings settings, Vala.TypeParameter vtypeparam, Basic parent, Tree head ) {
- this.vtypeparam = vtypeparam;
- this.vsymbol = vtypeparam;
- this.settings = settings;
- this.parent = parent;
- this.head = head;
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_type_parameter ( this, ptr );
- }
-
- public string? name {
- owned get {
- return this.vtypeparam.name;
- }
- }
-
- // internal
- public void set_type_reference ( ) {
- }
-}
-
-
-public class Valadoc.FormalParameter : Basic, ReturnTypeHandler {
- private Vala.FormalParameter vformalparam;
-
- public FormalParameter ( Valadoc.Settings settings, Vala.FormalParameter vformalparam, Basic parent, Tree head ) {
- this.settings = settings;
- this.vformalparam = vformalparam;
- this.vsymbol = vformalparam;
- this.parent = parent;
- this.head = head;
-
- var vformparam = this.vformalparam.parameter_type;
- this.set_ret_type ( vformparam );
- }
-
- public bool is_out {
- get {
- return this.vformalparam.direction == ParameterDirection.OUT;
- }
- }
-
- public bool is_ref {
- get {
- return this.vformalparam.direction == ParameterDirection.REF;
- }
- }
-
- public bool has_default_value {
- get {
- return this.vformalparam.default_expression != null;
- }
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public bool ellipsis {
- get {
- return this.vformalparam.ellipsis;
- }
- }
-
- public string? name {
- owned get {
- return ( this.vformalparam.name == null )? "" : this.vformalparam.name;
- }
- }
-
- // internal
- public void set_type_references ( ) {
- if ( this.vformalparam.ellipsis )
- return ;
-
- ((ReturnTypeHandler)this).set_return_type_references ( );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_formal_parameter ( this, ptr );
- }
-}
-
-
-public class Valadoc.PropertyAccessor : Object {
- private Vala.PropertyAccessor vpropacc;
-
- public PropertyAccessor ( Valadoc.Settings settings, Vala.PropertyAccessor vpropacc, Property parent, Tree head ) {
- this.settings = settings;
- this.vpropacc = vpropacc;
- this.parent = parent;
- this.head = head;
- }
-
- public Tree head {
- set;
- get;
- }
-
- public Settings settings {
- set;
- get;
- }
-
- public Property parent {
- private set;
- get;
- }
-
- public Tree tree {
- set;
- get;
- }
-
- public bool is_construct {
- get {
- return this.vpropacc.construction;
- }
- }
-
- public bool is_protected {
- get {
- return this.vpropacc.access == Vala.SymbolAccessibility.PROTECTED;
- }
- }
-
- public bool is_public {
- get {
- return this.vpropacc.access == Vala.SymbolAccessibility.PUBLIC;
- }
- }
-
- public bool is_private {
- get {
- return this.vpropacc.access == Vala.SymbolAccessibility.PRIVATE;
- }
- }
-
- public bool is_internal {
- get {
- return this.vpropacc.access == Vala.SymbolAccessibility.INTERNAL;
- }
- }
-
- public bool is_set {
- get {
- return this.vpropacc.writable;
- }
- }
-
- public bool is_get {
- get {
- return this.vpropacc.readable;
- }
- }
-
- public bool is_owned {
- get {
- return this.vpropacc.value_type.value_owned;
- }
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_property_accessor (this, ptr);
- }
-}
-
-public class Valadoc.Property : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
- private Vala.Property vproperty;
-
- public Property (Valadoc.Settings settings, Vala.Property vproperty, PropertyHandler parent, Tree head) {
- this.vcomment = vproperty.comment;
- this.settings = settings;
- this.parent = parent;
- this.head = head;
-
- this.vsymbol = vproperty;
- this.vproperty = vproperty;
-
- var ret = this.vproperty.property_type;
- this.set_ret_type (ret);
-
- if (this.vproperty.get_accessor != null) {
- this.getter = new PropertyAccessor (this.settings, this.vproperty.get_accessor, this, this.head);
- }
-
- if (this.vproperty.set_accessor != null) {
- this.setter = new PropertyAccessor (this.settings, this.vproperty.set_accessor, this, this.head);
- }
- }
-
- public bool is_vproperty (Vala.Property vprop) {
- return (this.vproperty == vprop);
- }
-
- public string? get_cname () {
- return this.vproperty.nick;
- }
-
- public bool equals ( Property p ) {
- return this.vproperty.equals ( p.vproperty );
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public bool is_virtual {
- get {
- return this.vproperty.is_virtual;
- }
- }
-
- public bool is_abstract {
- get {
- return this.vproperty.is_abstract;
- }
- }
-
- public bool is_override {
- get {
- return this.vproperty.overrides;
- }
- }
-
- public PropertyAccessor setter {
- private set;
- get;
- }
-
- public PropertyAccessor getter {
- private set;
- get;
- }
-
- public Property base_property {
- private set;
- get;
- }
-
- // internal
- public void set_type_references ( ) {
- Vala.Property? vp = null;
- if (vproperty.base_property != null) {
- vp = vproperty.base_property;
- } else if (vproperty.base_interface_property != null) {
- vp = vproperty.base_interface_property;
- }
- if (vp == vproperty && vproperty.base_interface_property != null) {
- vp = vproperty.base_interface_property;
- }
- if (vp != null) {
- this.base_property = (Property?) this.head.search_vala_symbol (vp);
- }
- this.set_return_type_references ( );
- }
-
- public void parse_comment (Valadoc.Parser docparser) {
- if (this.documentation != null)
- return ;
-
- if (this.vcomment == null)
- return ;
-
- if (this.base_property != null && docparser.is_inherit_doc (this)) {
- this.base_property.parse_comment (docparser);
- this.documentation = this.base_property.documentation;
- return ;
- }
-
- this.parse_comment_helper (docparser);
- }
-
- public void visit (Doclet doclet) {
- if (!this.is_visitor_accessible ())
- return ;
-
- doclet.visit_property (this);
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_property (this, ptr);
- }
-}
-
-
-
-public class Valadoc.Signal : DocumentedElement, ParameterListHandler, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
- private Vala.Signal vsignal;
-
- public Signal (Valadoc.Settings settings, Vala.Signal vsignal, SignalHandler parent, Tree head) {
- this.param_list = new Gee.ArrayList<FormalParameter> ();
-
- this.vcomment = vsignal.comment;
- this.settings = settings;
- this.vsymbol = vsignal;
- this.vsignal = vsignal;
- this.parent = parent;
- this.head = head;
-
- var vparamlst = this.vsignal.get_parameters ();
- this.add_parameter_list (vparamlst);
-
- var ret = this.vsignal.return_type;
- this.set_ret_type (ret);
- }
-
- // internal
- public bool is_vsignal (Vala.Signal vsig) {
- return (this.vsignal == vsig);
- }
-
- public string? get_cname () {
- return this.vsignal.get_cname();
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- protected Gee.ArrayList<FormalParameter> param_list {
- protected set;
- get;
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_parameter_list_type_references ( );
- this.set_return_type_references ( );
- }
-
- // internal
- public void parse_comment (Valadoc.Parser docparser) {
- this.parse_comment_helper (docparser);
- }
-
- public bool is_virtual {
- get {
- return this.vsignal.is_virtual;
- }
- }
-
- public void visit (Doclet doclet) {
- if ( !this.is_visitor_accessible () )
- return ;
-
- doclet.visit_signal (this);
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_signal (this, ptr);
- }
-}
-
-
-
-public class Valadoc.Method : DocumentedElement, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
- private Vala.Method vmethod;
-
- public Method (Valadoc.Settings settings, Vala.Method vmethod, MethodHandler parent, Tree head) {
- this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
- this.param_list = new Gee.ArrayList<FormalParameter> ();
- this.err_domains = new Gee.ArrayList<DocumentedElement> ();
-
- this.vcomment = vmethod.comment;
- this.settings = settings;
- this.vsymbol = vmethod;
- this.vmethod = vmethod;
- this.parent = parent;
- this.head = head;
-
- var vret = this.vmethod.return_type;
- this.set_ret_type (vret);
-
- var vparamlst = this.vmethod.get_parameters ();
- this.add_parameter_list (vparamlst);
-
- var vtparams = this.vmethod.get_type_parameters ();
- this.set_template_parameter_list (vtparams);
- }
-
- // intern
- public bool is_vmethod (Vala.Method vm) {
- return (this.vmethod == vm);
- }
-
- public string? get_cname () {
- return this.vmethod.get_cname ();
- }
-
- public Method? base_method {
- private set;
- get;
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public Gee.ArrayList<TypeParameter> template_param_lst {
- protected set;
- get;
- }
-
- public Gee.ArrayList<FormalParameter> param_list {
- protected set;
- get;
- }
-
- public Gee.ArrayList<DocumentedElement> err_domains {
- protected set;
- get;
- }
-
- // intern
- public bool equals (Method m) {
- return (m.vmethod == this.vmethod);
- }
-
- // intern
- public void parse_comment (Valadoc.Parser docparser) {
- if (this.documentation != null)
- return ;
-
- if (this.vcomment == null)
- return ;
-
- if (this.base_method != null && docparser.is_inherit_doc (this)) {
- this.base_method.parse_comment (docparser);
- this.documentation = this.base_method.documentation;
- return ;
- }
-
- this.parse_comment_helper (docparser);
- }
-
- public bool is_yields {
- get {
- return this.vmethod.coroutine;
- }
- }
-
- public bool is_abstract {
- get {
- return this.vmethod.is_abstract;
- }
- }
-
- public bool is_virtual {
- get {
- return this.vmethod.is_virtual;
- }
- }
-
- public bool is_override {
- get {
- return this.vmethod.overrides;
- }
- }
-
- public bool is_static {
- get {
- if (this.parent is Namespace || this.is_constructor)
- return false;
-
- return this.vmethod.binding == MemberBinding.STATIC;
- }
- }
-
- public bool is_constructor {
- get {
- return ( this.vmethod is Vala.CreationMethod );
- }
- }
-
- public bool is_inline {
- get {
- return this.vmethod.is_inline;
- }
- }
-
- public override string? name {
- owned get {
- if (this.is_constructor) {
- if (this.vmethod.name == ".new")
- return ((DocumentedElement)this.parent).name;
- else
- return ((DocumentedElement)this.parent).name + "." + this.vmethod.name;
- }
- else {
- return this.vmethod.name;
- }
- }
- }
-
- // internal
- public void set_type_references ( ) {
- Vala.Method? vm = null;
- if (vmethod.base_method != null) {
- vm = vmethod.base_method;
- } else if (vmethod.base_interface_method != null) {
- vm = vmethod.base_interface_method;
- }
- if (vm == vmethod && vmethod.base_interface_method != null) {
- vm = vmethod.base_interface_method;
- }
- if (vm != null) {
- this.base_method = (Method?) this.head.search_vala_symbol (vm);
- }
-
- this.set_return_type_references ();
- this.set_parameter_list_type_references ();
- this.set_template_parameter_list_references ();
-
- var vexceptionlst = this.vmethod.get_error_types ();
- this.add_exception_list ( vexceptionlst );
- }
-
- public void visit ( Doclet doclet, Valadoc.MethodHandler in_type ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_method ( this, in_type );
- }
-
- public void write ( Langlet langlet, void* ptr, Valadoc.MethodHandler parent ) {
- langlet.write_method ( ptr, this, parent );
- }
-}
-
-
-public class Valadoc.EnumValue: DocumentedElement, Writeable {
- private Vala.EnumValue venval;
-
- public EnumValue ( Valadoc.Settings settings, Vala.EnumValue venval, Enum parent, Tree head ) {
- this.vcomment = venval.comment;
- this.settings = settings;
- this.vsymbol = venval;
- this.venval = venval;
- this.parent = parent;
- this.head = head;
- }
-
- public string get_cname () {
- return this.venval.get_cname ();
- }
-
- public bool is_venumvalue ( Vala.EnumValue venval ) {
- return ( this.venval == venval );
- }
-
- public void parse_comment ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_enum_value ( this, ptr );
- }
-
- public void visit ( Doclet doclet ) {
- doclet.visit_enum_value ( this );
- }
-}
-
-
-
-public class Valadoc.ErrorCode : DocumentedElement, Writeable {
- private Vala.ErrorCode verrcode;
-
- public ErrorCode ( Valadoc.Settings settings, Vala.ErrorCode verrcode, ErrorDomain parent, Tree head ) {
- this.vcomment = verrcode.comment;
- this.settings = settings;
- this.verrcode = verrcode;
- this.vsymbol = verrcode;
- this.parent = parent;
- this.head = head;
- }
-
- public string get_cname () {
- return this.verrcode.get_cname ();
- }
-
- public bool is_verrorcode ( Vala.ErrorCode verrcode ) {
- return ( this.verrcode == verrcode );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_error_code ( this, ptr );
- }
-
- public void parse_comment ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- }
-
- public void visit ( Doclet doclet ) {
- doclet.visit_error_code ( this );
- }
-}
-
-
-
-public class Valadoc.Delegate : DocumentedElement, SymbolAccessibility, Visitable, Writeable, ParameterListHandler, ReturnTypeHandler, TemplateParameterListHandler, ExceptionHandler {
- private Vala.Delegate vdelegate;
-
- public Delegate ( Valadoc.Settings settings, Vala.Delegate vdelegate, DelegateHandler parent, Tree head ) {
- this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
- this.param_list = new Gee.ArrayList<FormalParameter>();
- this.err_domains = new Gee.ArrayList<DocumentedElement>();
-
- this.vcomment = vdelegate.comment;
- this.settings = settings;
- this.vdelegate = vdelegate;
- this.vsymbol = vdelegate;
- this.parent = parent;
- this.head = head;
-
- var ret = this.vdelegate.return_type;
- this.set_ret_type ( ret );
-
- var vparamlst = this.vdelegate.get_parameters ();
- this.add_parameter_list ( vparamlst );
- }
-
- public string? get_cname () {
- return this.vdelegate.get_cname();
- }
-
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_delegate ( this );
- }
-
- public Gee.ArrayList<TypeParameter> template_param_lst {
- protected set;
- get;
- }
-
- protected Gee.ArrayList<FormalParameter> param_list {
- protected set;
- get;
- }
-
- protected Gee.ArrayList<DocumentedElement> err_domains {
- protected set;
- get;
- }
-
- public bool is_static {
- get {
- return this.vdelegate.has_target;
- }
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_return_type_references ( );
- this.set_parameter_list_type_references ( );
-
- var vexceptionlst = this.vdelegate.get_error_types ();
- this.add_exception_list ( vexceptionlst );
- }
-
- // internal
- public void parse_comment ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- }
-
- // internal
- public bool is_vdelegate ( Vala.Delegate vdel ) {
- return ( this.vdelegate == vdel );
- }
-
- // new parameter: DelegateHandler parent
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_delegate ( this, ptr );
- }
-}
-
-
-public class Valadoc.Class : DocumentedElement, SymbolAccessibility, Writeable, Visitable, ClassHandler, StructHandler, SignalHandler, Inheritable, MethodHandler, EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler, DelegateHandler, ConstantHandler, TemplateParameterListHandler {
- // rename
- private Gee.ArrayList<Interface> parent_types;
- private bool inherited = false;
- private Vala.Class vclass;
-
- public Class ( Valadoc.Settings settings, Vala.Class vclass, ClassHandler parent, Tree head ) {
- this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
- this.parent_types = new Gee.ArrayList<Interface>();
- this.methods = new Gee.ArrayList<Method> ();
-
- this.vcomment = vclass.comment;
- this.settings = settings;
- this.vsymbol = vclass;
- this.vclass = vclass;
- this.parent = parent;
- this.head = head;
-
- if ( glib_error == null ) {
- if ( this.full_name () == "GLib.Error" ) {
- glib_error = this;
- }
- }
-
- var vtparams = this.vclass.get_type_parameters ();
- this.set_template_parameter_list ( vtparams );
-
- Gee.Collection<Vala.Enum> venums = this.vclass.get_enums ();
- this.enums = new Gee.ArrayList<Enum> ();
- this.add_enums ( venums );
-
- Gee.Collection<Vala.Delegate> vdelegates = this.vclass.get_delegates ();
- this.delegates = new Gee.ArrayList<Delegate> ();
- this.add_delegates ( vdelegates );
-
- Gee.Collection<Vala.Class> vclasses = this.vclass.get_classes();
- this.classes = new Gee.ArrayList<Class> ();
- this.add_classes ( vclasses );
-
- Gee.Collection<Vala.Struct> vstructs = this.vclass.get_structs();
- this.structs = new Gee.ArrayList<Struct> ();
- this.add_structs ( vstructs );
-
- Gee.Collection<Vala.Field> vfields = this.vclass.get_fields();
- this.fields = new Gee.ArrayList<Field> ();
- this.add_fields ( vfields );
-
- Gee.Collection<Vala.Method> vmethods = this.vclass.get_methods ();
- this.construction_methods = new Gee.ArrayList<Method>();
- this.add_methods_and_construction_methods ( vmethods );
-
- Gee.Collection<Vala.Signal> vsignals = this.vclass.get_signals();
- this.signals = new Gee.ArrayList<Signal>();
- this.add_signals ( vsignals );
-
- Gee.Collection<Vala.Property> vproperties = this.vclass.get_properties();
- this.properties = new Gee.ArrayList<Property>();
- this.add_properties ( vproperties );
-
- Gee.Collection<Vala.Constant> vconstants = this.vclass.get_constants();
- this.constants = new Gee.ArrayList<Constant>();
- this.add_constants ( vconstants );
- }
-
- protected Inheritable? base_type {
- private set;
- get;
- }
-
- protected Gee.ArrayList<TypeParameter> template_param_lst {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> methods {
- set;
- get;
- }
-
- protected Gee.ArrayList<Delegate> delegates {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Enum> enums {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Field> fields {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> construction_methods {
- set;
- get;
- }
-
- protected Gee.ArrayList<Property> properties {
- get;
- set;
- }
-
- protected Gee.ArrayList<Class> classes {
- set;
- get;
- }
-
- protected Gee.ArrayList<Struct> structs {
- set;
- get;
- }
-
- protected Gee.ArrayList<Signal> signals {
- get;
- set;
- }
-
- protected Gee.ArrayList<Constant> constants {
- get;
- set;
- }
-
- public string? get_cname () {
- return this.vclass.get_cname();
- }
-
- public Gee.Collection<Interface> get_implemented_interface_list ( ) {
- return this.parent_types;
- }
-
- // internal
- public override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos];
-
- if ( velement is Vala.Class == false )
- return null;
-
- if ( !this.is_vclass( (Vala.Class)velement ) )
- return null;
-
- if ( params.size == pos+1 )
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if ( velement is Vala.Field ) {
- element = this.search_field_vala ( params, pos );
- }
- else if ( velement is Vala.Method ) {
- element = this.search_method_vala ( params, pos );
- }
- else if ( velement is Vala.Delegate ) {
- element = this.search_delegate_vala ( params, pos );
- }
- else if ( velement is Vala.CreationMethod ) {
- element = this.search_construction_method_vala ( params, pos );
- }
- else if ( velement is Vala.Signal ) {
- element = this.search_signal_vala ( params, pos );
- }
- else if ( velement is Vala.Property ) {
- element = this.search_property_vala ( params, pos );
- }
- else if ( velement is Vala.Struct ) {
- element = this.search_struct_vala ( params, pos );
- }
- else if ( velement is Vala.Class ) {
- element = this.search_class_vala ( params, pos );
- }
- else if ( velement is Vala.Enum ) {
- element = this.search_enum_vala ( params, pos );
- }
- else if ( velement is Vala.Constant ) {
- element = this.search_constant_vala ( params, pos );
- }
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( !(this.name == params[pos] || params[0] == "this") )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
- DocumentedElement? element = this.search_field ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_delegate ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_construction_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_signal ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_property ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_struct ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_class ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_enum ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_constant ( params, pos );
- if ( element != null )
- return element;
-
- return null;
- }
-
- // internal
- public bool is_vclass ( Vala.Class vcl ) {
- return this.vclass == vcl;
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_class ( this, ptr );
- }
-
- public bool is_abstract {
- get {
- return this.vclass.is_abstract;
- }
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_class ( this );
- }
-
- // internal
- public void parse_comments ( Valadoc.Parser docparser ) {
- if ( this.documentation != null )
- return ;
-
- if ( this.vcomment != null ) {
- if ( docparser.is_inherit_doc ( this ) && this.base_type != null ) {
- ((Class)this.base_type).parse_comments ( docparser );
- this.documentation = this.base_type.documentation;
- }
- else {
- this.parse_comment_helper ( docparser );
- }
- }
-
- this.parse_construction_method_comments ( docparser );
- this.parse_delegate_comments ( docparser );
- this.parse_constant_comments ( docparser );
- this.parse_property_comments ( docparser );
- this.parse_method_comments ( docparser );
- this.parse_struct_comments ( docparser );
- this.parse_signal_comments ( docparser );
- this.parse_class_comments ( docparser );
- this.parse_field_comments ( docparser );
- this.parse_enum_comments ( docparser );
- }
-
- private void set_parent_type_references ( Gee.Collection<Vala.DataType> lst ) {
- if ( ((Gee.Collection)this.parent_types).size != 0 )
- return ;
-
- foreach ( Vala.DataType vtyperef in lst ) {
- Inheritable? element = (Inheritable?)this.head.search_vala_symbol ( vtyperef.data_type );
- if ( element is Class ) {
- this.base_type = (Class)element;
- }
- else {
- this.parent_types.add ( (Interface)element );
- }
- }
- }
-
- // internal
- public void set_type_references ( ) {
- var lst = this.vclass.get_base_types ();
- this.set_parent_type_references ( lst );
-
- this.set_template_parameter_list_references ( );
- this.set_construction_method_references ( );
- this.set_constant_type_references ( );
- this.set_delegate_type_references ( );
- this.set_property_type_reference ( );
- this.set_method_type_references ( );
- this.set_signal_type_references ( );
- this.set_field_type_references ( );
- this.set_enum_type_references ( );
- this.set_struct_type_references ( );
- this.set_class_type_references ( );
- }
-
- private void inheritance_class ( Class dtype ) {
- dtype.inheritance ( );
-
- var flst = dtype.get_field_list ( );
- foreach ( Field f in flst ) {
- this.fields.add ( f );
- }
- /*
- var plst = dtype.get_property_list ( );
- foreach ( Property prop in plst ) {
- this.properties.add ( prop );
- }
- */
- var proplst = dtype.get_property_list ( );
- foreach ( Property p in proplst ) {
- if ( p.is_private )
- continue ;
-
- if ( p.is_override ) {
- if ( this.is_overwritten_property ( p ) )
- continue ;
- }
-
- this.properties.add ( p );
- }
-
- var mlst = dtype.get_method_list ( );
- foreach ( Method m in mlst ) {
- if ( m.is_private )
- continue ;
-
- this.methods.add ( m );
- }
- }
-
- private void inheritance_interface ( Interface dtype ) {
- var plst = dtype.get_property_list ( );
-
- foreach ( Property p in plst ) {
- if ( p.is_private )
- continue ;
-
- if ( p.is_abstract )
- continue ;
-
- this.properties.add ( p );
- }
-
- var mlst = dtype.get_method_list ( );
- foreach ( Method m in mlst ) {
- if ( m.is_private )
- continue ;
-
- if ( m.is_abstract )
- continue ;
-
- this.methods.add ( m );
- }
-
- var slst = dtype.get_signal_list ( );
- foreach ( Signal sig in slst ) {
- if ( sig.is_private )
- continue ;
-
- this.signals.add ( sig );
- }
- }
-
- // internal
- public void inheritance ( ) {
- if ( inherited == true )
- return ;
-
-
- inherited = true;
-
-
- if ( this.base_type != null )
- this.inheritance_class ( (Class)this.base_type );
-
- foreach ( Interface dtype in this.parent_types ) {
- this.inheritance_interface ( (Interface)dtype );
- }
-
- foreach ( Class cl in this.classes ) {
- cl.inheritance( );
- }
- }
-}
-
-
-public class Valadoc.ErrorDomain : DocumentedElement, SymbolAccessibility, Visitable, Writeable, MethodHandler {
- private Gee.ArrayList<ErrorCode> errcodes = new Gee.ArrayList<ErrorCode> ();
- private Vala.ErrorDomain verrdom;
-
- public ErrorDomain ( Valadoc.Settings settings, Vala.ErrorDomain verrdom, ErrorDomainHandler parent, Tree head ) {
- this.vcomment = verrdom.comment;
- this.settings = settings;
- this.vsymbol = verrdom;
- this.verrdom = verrdom;
- this.parent = parent;
- this.head = head;
-
- Gee.Collection<Vala.Method> vmethods = this.verrdom.get_methods ();
- this.methods = new Gee.ArrayList<Method> ();
- this.add_methods ( vmethods );
-
- Gee.Collection<Vala.ErrorCode> verrcodes = this.verrdom.get_codes ();
- this.append_error_code ( verrcodes );
- }
-
- public string? get_cname () {
- return this.verrdom.get_cname();
- }
-
- protected Gee.ArrayList<Method> methods {
- protected set;
- get;
- }
-
- // internal
- public bool is_verrordomain ( Vala.ErrorDomain ver ) {
- return ( this.verrdom == ver );
- }
-
- private DocumentedElement? search_error_code ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( ErrorCode errcode in this.errcodes ) {
- if ( errcode.name == params[pos] )
- return errcode;
- }
- return null;
- }
-
- private DocumentedElement? search_error_code_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.ErrorCode == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( ErrorCode errc in this.errcodes ) {
- if ( errc.is_verrorcode ( (Vala.ErrorCode)velement ) ) {
- return errc;
- }
- }
- return null;
- }
-
- public override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos];
-
- if ( velement is Vala.ErrorDomain == false )
- return null;
-
- if ( !this.is_verrordomain ( (Vala.ErrorDomain)velement ) )
- return null;
-
- if ( params.size == pos+1 )
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if ( velement is Vala.ErrorCode ) {
- element = this.search_error_code_vala ( params, pos );
- }
- else if ( velement is Vala.Method ) {
- element = this.search_method_vala ( params, pos );
- }
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( this.name != params[pos] )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
- DocumentedElement? element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_error_code ( params, pos );
- if ( element != null )
- return element;
-
- return null;
- }
-
- // internal
- public void parse_comments ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- this.parse_method_comments ( docparser );
-
- foreach ( ErrorCode errcode in this.errcodes ) {
- errcode.parse_comment ( docparser );
- }
- }
-
- public void visit_error_codes ( Doclet doclet ) {
- foreach ( ErrorCode errcode in this.errcodes )
- errcode.visit ( doclet );
- }
-
- public Gee.ReadOnlyCollection<ErrorCode> get_error_code_list ( ) {
- return new Gee.ReadOnlyCollection<ErrorCode> ( this.errcodes );
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_error_domain ( this );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_error_domain ( this, ptr );
- }
-
- private inline void append_error_code ( Gee.Collection<Vala.ErrorCode> verrcodes ) {
- foreach ( Vala.ErrorCode verrcode in verrcodes ) {
- var tmp = new ErrorCode ( this.settings, verrcode, this, this.head );
- this.errcodes.add ( tmp );
- }
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_method_type_references ( );
- }
-}
-
-
-public class Valadoc.Enum : DocumentedElement, SymbolAccessibility, Visitable, Writeable, MethodHandler {
- public Enum ( Valadoc.Settings settings, Vala.Enum venum, EnumHandler parent, Tree head ) {
- this.vcomment = venum.comment;
- this.settings = settings;
- this.vsymbol = venum;
- this.venum = venum;
- this.parent = parent;
- this.head = head;
-
- Gee.Collection<Vala.Method> vmethods = this.venum.get_methods ();
- this.methods = new Gee.ArrayList<Method> ();
- this.add_methods ( vmethods );
-
- Gee.Collection<Vala.EnumValue> venvals = this.venum.get_values ();
- this.en_values = new Gee.ArrayList<EnumValue> ();
- this.add_enum_values ( venvals );
- }
-
- public string? get_cname () {
- return this.venum.get_cname();
- }
-
- private DocumentedElement? search_enum_value_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos+1];
- if ( velement is Vala.EnumValue == false )
- return null;
-
- if ( params.size != pos+2 )
- return null;
-
- foreach ( EnumValue env in this.en_values ) {
- if ( env.is_venumvalue ( (Vala.EnumValue)velement ) ) {
- return env;
- }
- }
- return null;
- }
-
- private DocumentedElement? search_enum_value ( string[] params, int pos ) {
- pos++;
-
- if ( params[pos+1] != null )
- return null;
-
- foreach ( EnumValue enval in this.en_values ) {
- if ( enval.name == params[pos] )
- return enval;
- }
- return null;
- }
-
- public override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos];
-
- if ( velement is Vala.Enum == false )
- return null;
-
- if ( this.is_venum ( (Vala.Enum)velement ) == false )
- return null;
-
- if ( params.size == pos+1 )
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if ( velement is Vala.EnumValue ) {
- element = this.search_enum_value_vala ( params, pos );
- }
- else if ( velement is Vala.Method ) {
- element = this.search_method_vala ( params, pos );
- }
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( this.name != params[pos] )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
-
- DocumentedElement? element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_enum_value ( params, pos );
- if ( element != null )
- return element;
-
- return null;
- }
-
- // internal
- public void set_type_references () {
- this.set_method_type_references ();
- }
-
- protected Gee.ArrayList<Method> methods {
- protected set;
- get;
- }
-
- private Gee.ArrayList<EnumValue> en_values;
-
- // rename: get_enum_value_list
- public Gee.ReadOnlyCollection<EnumValue> get_enum_values () {
- return new Gee.ReadOnlyCollection<EnumValue>( this.en_values );
- }
-
- // internal
- public void parse_comments ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
-
- foreach ( EnumValue enval in this.en_values ) {
- enval.parse_comment ( docparser );
- }
-
- this.parse_method_comments ( docparser );
- }
-
- private inline void add_enum_values ( Gee.Collection<Vala.EnumValue> venvals ) {
- foreach ( Vala.EnumValue venval in venvals ) {
- var tmp = new EnumValue ( this.settings, venval, this, this.head );
- this.en_values.add ( tmp );
- }
- }
-
- public void visit_enum_values ( Doclet doclet ) {
- foreach ( EnumValue enval in this.en_values )
- enval.visit ( doclet );
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_enum ( this );
- }
-
- private Vala.Enum venum;
-
- // internal
- public bool is_venum ( Vala.Enum ven ) {
- return ( this.venum == ven );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_enum ( this, ptr );
- }
-}
-
-
-
-public class Valadoc.Struct : DocumentedElement, SymbolAccessibility, Writeable, Visitable, MethodHandler, ConstructionMethodHandler, FieldHandler, ConstantHandler, Inheritable, TemplateParameterListHandler {
- public Struct (Valadoc.Settings settings, Vala.Struct vstruct, StructHandler parent, Tree head) {
- this.vcomment = vstruct.comment;
- this.settings = settings;
- this.vstruct = vstruct;
- this.vsymbol = vstruct;
- this.parent = parent;
- this.head = head;
-
- this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
- this.methods = new Gee.ArrayList<Method> ();
-
- var vtparams = this.vstruct.get_type_parameters ();
- this.set_template_parameter_list (vtparams);
-
- Gee.Collection<Vala.Field> vfields = this.vstruct.get_fields();
- this.fields = new Gee.ArrayList<Field> ();
- this.add_fields (vfields);
-
- Gee.Collection<Vala.Constant> vconstants = this.vstruct.get_constants();
- this.constants = new Gee.ArrayList<Constant> ();
- this.add_constants (vconstants);
-
- Gee.Collection<Vala.Method> vmethods = this.vstruct.get_methods ();
- this.construction_methods = new Gee.ArrayList<Method>();
- this.add_methods_and_construction_methods (vmethods);
- }
-
- protected Inheritable? base_type {
- protected set;
- get;
- }
-
- // remove
- public Gee.Collection<Interface> get_implemented_interface_list ( ) {
- return new Gee.ArrayList<Interface> ();
- }
-
- public string? get_cname () {
- return this.vstruct.get_cname();
- }
-
- protected Gee.ArrayList<TypeParameter> template_param_lst {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> methods {
- set;
- get;
- }
-
- protected Gee.ArrayList<Field> fields {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> construction_methods {
- set;
- get;
- }
-
- protected Gee.ArrayList<Constant> constants {
- set;
- get;
- }
-
- public override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos];
-
- if ( velement is Vala.Struct == false )
- return null;
-
- if ( this.is_vstruct ( (Vala.Struct)velement ) == false )
- return null;
-
- if ( params.size == pos+1 )
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if ( velement is Vala.Field ) {
- element = this.search_field_vala ( params, pos );
- }
- else if ( velement is Vala.CreationMethod ) {
- element = this.search_construction_method_vala ( params, pos );
- }
- else if ( velement is Vala.Method ) {
- element = this.search_method_vala ( params, pos );
- }
- else if ( velement is Vala.Constant ) {
- element = this.search_constant_vala ( params, pos );
- }
-
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( this.name != params[pos] )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
- DocumentedElement? element = this.search_field ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_constant ( params, pos );
- if ( element != null )
- return element;
-
- return this.search_construction_method ( params, pos );
- }
-
- private Vala.Struct vstruct;
-
- // internal
- public bool is_vstruct ( Vala.Struct vstru ) {
- return ( this.vstruct == vstru );
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_struct (this);
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_struct (this, ptr);
- }
-
- // internal
- public void parse_comments (Valadoc.Parser docparser) {
- if (this.documentation != null)
- return ;
-
- if (this.vcomment != null) {
- if ( docparser.is_inherit_doc (this) && this.base_type != null) {
- ((Valadoc.Struct)this.base_type).parse_comments (docparser);
- this.documentation = this.base_type.documentation;
- }
- else {
- this.parse_comment_helper (docparser);
- }
- }
-
- this.parse_construction_method_comments (docparser);
- this.parse_constant_comments (docparser);
- this.parse_method_comments (docparser);
- this.parse_field_comments (docparser);
- }
-
- private void set_parent_references ( ) {
- Vala.ValueType? basetype = (Vala.ValueType?)this.vstruct.base_type;
- if (basetype == null)
- return ;
-
- this.base_type = (Struct?)this.head.search_vala_symbol ( (Vala.Struct)basetype.type_symbol );
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_template_parameter_list_references ( );
- this.set_construction_method_references ( );
- this.set_constant_type_references ( );
- this.set_method_type_references ( );
- this.set_field_type_references ( );
- this.set_parent_references ( );
- }
-}
-
-
-public class Valadoc.Interface : DocumentedElement, SymbolAccessibility, Writeable, Visitable, SignalHandler, PropertyHandler, FieldHandler, TemplateParameterListHandler, MethodHandler, DelegateHandler, EnumHandler, StructHandler, ClassHandler, Inheritable {
- public Interface (Valadoc.Settings settings, Vala.Interface vinterface, InterfaceHandler parent, Tree head) {
- this.vcomment = vinterface.comment;
- this.settings = settings;
- this.vinterface = vinterface;
- this.vsymbol = vinterface;
- this.parent = parent;
- this.head = head;
-
- this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
- this.methods = new Gee.ArrayList<Method> ();
-
- var vtparams = this.vinterface.get_type_parameters ();
- this.set_template_parameter_list (vtparams);
-
- Gee.Collection<Vala.Method> methods = this.vinterface.get_methods ();
- this.methods = new Gee.ArrayList<Method>();
- this.add_methods (methods);
-
- Gee.Collection<Vala.Delegate> delegates = this.vinterface.get_delegates ();
- this.delegates = new Gee.ArrayList<Delegate>();
- this.add_delegates (delegates);
-
- Gee.Collection<Vala.Signal> signals = this.vinterface.get_signals();
- this.signals = new Gee.ArrayList<Signal>();
- this.add_signals (signals);
-
- Gee.Collection<Vala.Property> properties = this.vinterface.get_properties();
- this.properties = new Gee.ArrayList<Property>();
- this.add_properties (properties);
-
- Gee.Collection<Vala.Field> fields = this.vinterface.get_fields();
- this.fields = new Gee.ArrayList<Field>();
- this.add_fields (fields);
-
- Gee.Collection<Vala.Struct> structs = this.vinterface.get_structs();
- this.structs = new Gee.ArrayList<Struct>();
- this.add_structs (structs);
-
- Gee.Collection<Vala.Class> classes = this.vinterface.get_classes();
- this.classes = new Gee.ArrayList<Class>();
- this.add_classes (classes);
-
- Gee.Collection<Vala.Enum> enums = this.vinterface.get_enums();
- this.enums = new Gee.ArrayList<Enum>();
- this.add_enums (enums);
- }
-
- private Gee.ArrayList<Interface> parent_types = new Gee.ArrayList<Interface>();
-
- public Gee.Collection<Interface> get_implemented_interface_list ( ) {
- return this.parent_types;
- }
-
- public string? get_cname () {
- return this.vinterface.get_cname();
- }
-
- protected Inheritable? base_type {
- private set;
- get;
- }
-
- protected Gee.ArrayList<TypeParameter> template_param_lst {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> methods {
- set;
- get;
- }
-
- protected Gee.ArrayList<Property> properties {
- get;
- set;
- }
-
- protected Gee.ArrayList<Field> fields {
- get;
- set;
- }
-
- protected Gee.ArrayList<Signal> signals {
- get;
- set;
- }
-
- protected Gee.ArrayList<Enum> enums {
- get;
- set;
- }
-
- protected Gee.ArrayList<Delegate> delegates {
- get;
- set;
- }
-
- protected Gee.ArrayList<Struct> structs {
- get;
- set;
- }
-
- protected Gee.ArrayList<Class> classes {
- get;
- set;
- }
-
- private Vala.Interface vinterface;
-
- public override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
- Vala.Symbol velement = params[pos];
-
- if ( velement is Vala.Interface == false )
- return null;
-
- if ( this.is_vinterface ( (Vala.Interface)velement ) == false )
- return null;
-
- if ( params.size == pos+1 )
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if ( velement is Vala.Field ) {
- element = this.search_field_vala ( params, pos );
- }
- else if ( velement is Vala.Method ) {
- element = this.search_method_vala ( params, pos );
- }
- else if ( velement is Vala.Signal ) {
- element = this.search_signal_vala ( params, pos );
- }
- else if ( velement is Vala.Property ) {
- element = this.search_property_vala ( params, pos );
- }
- else if ( velement is Vala.Delegate ) {
- element = this.search_delegate_vala ( params, pos );
- }
- else if ( velement is Vala.Struct ) {
- element = this.search_struct_vala ( params, pos );
- }
- else if ( velement is Vala.Enum ) {
- element = this.search_enum_vala ( params, pos );
- }
- else if ( velement is Vala.Class ) {
- element = this.search_class_vala ( params, pos );
- }
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( !(this.name == params[pos] || params[0] == "this") )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
- DocumentedElement? element = this.search_field ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_signal ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_property ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_delegate ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_struct ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_enum ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_class ( params, pos );
- if ( element != null )
- return element;
-
- return null;
- }
-
- // internal
- public bool is_vinterface ( Vala.Interface viface ) {
- return ( this.vinterface == viface );
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible ( ) )
- return ;
-
- doclet.visit_interface ( this );
- }
-
- public void write ( Langlet langlet, void* ptr ) {
- langlet.write_interface ( this, ptr );
- }
-
- // internal
- public void parse_comments ( Valadoc.Parser docparser ) {
- this.parse_comment_helper ( docparser );
- this.parse_delegate_comments ( docparser );
- this.parse_property_comments ( docparser );
- this.parse_signal_comments ( docparser );
- this.parse_method_comments ( docparser );
- this.parse_struct_comments ( docparser );
- this.parse_field_comments ( docparser );
- this.parse_class_comments ( docparser );
- this.parse_enum_comments ( docparser );
- }
-
- private void set_prerequisites ( Gee.Collection<Vala.DataType> lst ) {
- if ( ((Gee.Collection)this.parent_types).size != 0 )
- return ;
-
- foreach ( Vala.DataType vtyperef in lst ) {
- Inheritable? element = (Inheritable?)this.head.search_vala_symbol ( vtyperef.data_type );
- if ( element is Class )
- this.base_type = (Class)element;
- else
- this.parent_types.add ( (Interface)element );
- }
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_template_parameter_list_references ( );
- this.set_delegate_type_references ();
- this.set_property_type_reference ();
- this.set_signal_type_references ();
- this.set_method_type_references ();
- this.set_struct_type_references ();
- this.set_field_type_references ();
- this.set_enum_type_references ();
- this.set_class_type_references ();
-
- var lst = this.vinterface.get_prerequisites ( );
- this.set_prerequisites ( lst );
- }
-}
-
-public class Valadoc.Namespace : DocumentedElement, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomainHandler,
- EnumHandler, ClassHandler, StructHandler, Writeable, InterfaceHandler,
- DelegateHandler, ConstantHandler
-{
- protected Gee.ArrayList<Constant> constants {
- protected set;
- get;
- }
-
- protected Gee.ArrayList<Enum> enums {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Interface> interfaces {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Delegate> delegates {
- private set;
- get;
- }
-
- protected Gee.ArrayList<ErrorDomain> errdoms {
- private set;
- get;
- }
-
- public Gee.ArrayList<Namespace> namespaces {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Class> classes {
- private set;
- get;
- }
-
- protected Gee.ArrayList<Struct> structs {
- private set;
- get;
- }
-
- // interface
- private DocumentedElement? search_namespace (string[] params, int pos) {
- foreach (Namespace ns in this.namespaces) {
- DocumentedElement? element = ns.search_element (params, pos+1);
- if (element != null)
- return element;
- }
- return null;
- }
-
- //interface
- private DocumentedElement? search_namespace_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
- foreach (Namespace ns in this.namespaces) {
- DocumentedElement? element = ns.search_element_vala (params, pos+1);
- if (element != null)
- return element;
- }
- return null;
- }
-
- public override DocumentedElement? search_element_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
- Vala.Symbol velement = params[pos];
-
- if (velement is Vala.Namespace == false)
- return null;
-
- if (this.is_vnspace ((Vala.Namespace)velement) == false)
- return null;
-
- if (params.size == pos+1)
- return this;
-
- velement = params[pos+1];
-
- DocumentedElement? element = null;
-
- if (velement is Vala.Namespace) {
- element = this.search_namespace_vala (params, pos);
- }
- else if (velement is Vala.Class) {
- element = this.search_class_vala (params, pos);
- }
- else if (velement is Vala.Interface) {
- element = this.search_interface_vala (params, pos);
- }
- else if (velement is Vala.Struct) {
- element = this.search_struct_vala (params, pos);
- }
- else if (velement is Vala.Enum) {
- element = this.search_enum_vala (params, pos);
- }
- else if (velement is Vala.ErrorDomain) {
- element = this.search_error_domain_vala (params, pos);
- }
- else if (velement is Vala.Method) {
- element = this.search_method_vala (params, pos);
- }
- else if (velement is Vala.Field) {
- element = this.search_field_vala (params, pos);
- }
- else if (velement is Vala.DelegateType || velement is Vala.Delegate) {
- element = this.search_delegate_vala (params, pos);
- }
- else if (velement is Vala.Constant) {
- element = this.search_constant_vala (params, pos);
- }
- return element;
- }
-
- // internal
- public override DocumentedElement? search_element ( string[] params, int pos ) {
- if ( this.name != params[pos] )
- return null;
-
- if ( params[pos+1] == null )
- return this;
-
-
- DocumentedElement? element = this.search_namespace ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_class ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_interface ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_struct ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_enum ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_error_domain ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_method ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_field ( params, pos );
- if ( element != null )
- return element;
-
- element = this.search_delegate ( params, pos );
- if ( element != null )
- return element;
-
- element = search_constant ( params, pos );
- if ( element != null )
- return element;
-
- return null;
- }
-
- protected Gee.ArrayList<Field> fields {
- set;
- get;
- }
-
- protected Gee.ArrayList<Method> methods {
- set;
- get;
- }
-
- public Namespace ( Valadoc.Settings settings, Vala.Namespace vnspace, NamespaceHandler parent, Tree head ) {
- this.settings = settings;
- this.vsymbol = vnspace;
- this.vnspace = vnspace;
- this.parent = parent;
- this.head = head;
-
- this.namespaces = new Gee.ArrayList<Namespace> ();
- this.structs = new Gee.ArrayList<Struct>();
- this.classes = new Gee.ArrayList<Class>();
-
- this.constants = new Gee.ArrayList<Constant> ();
- this.interfaces = new Gee.ArrayList<Interface>();
- this.methods = new Gee.ArrayList<Method> ();
- this.delegates = new Gee.ArrayList<Delegate>();
- this.errdoms = new Gee.ArrayList<ErrorDomain>();
- this.enums = new Gee.ArrayList<Enum>();
- this.fields = new Gee.ArrayList<Field> ();
-
- if (vnspace.source_reference != null) {
- var vfile = vnspace.source_reference.file;
- foreach (Comment c in vnspace.get_comments()) {
- if (this.package.is_vpackage (c.source_reference.file)) {
- this.vcomment = c;
- break;
- }
- }
- }
- }
-
- public void visit (Doclet doclet) {
- doclet.visit_namespace (this);
- }
-
- public Vala.Namespace vnspace {
- private get;
- set;
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_errordomain_type_referenes ();
- this.set_namespace_type_references ();
- this.set_interface_type_references ();
- this.set_delegate_type_references ();
- this.set_constant_type_references ();
- this.set_method_type_references ();
- this.set_field_type_references ();
- this.set_struct_type_references ();
- this.set_class_type_references ();
- this.set_enum_type_references ();
- }
-
- // internal
- public void inheritance () {
- this.namespace_inheritance ();
- foreach (Class cl in this.classes) {
- cl.inheritance ();
- }
- }
-
- // internal
- public void parse_comments (Valadoc.Parser docparser) {
- this.parse_comment_helper (docparser);
- this.parse_enum_comments (docparser);
- this.parse_field_comments (docparser);
- this.parse_class_comments (docparser);
- this.parse_method_comments (docparser);
- this.parse_struct_comments (docparser);
- this.parse_constant_comments (docparser);
- this.parse_delegate_comments (docparser);
- this.parse_interface_comments (docparser);
- this.parse_namespace_comments (docparser);
- this.parse_errordomain_comments (docparser);
- }
-
- // internal
- public bool is_vnspace ( Vala.Namespace vns ) {
- return (this.vnspace == vns);
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_namespace (this, ptr);
- }
-}
-
-
-public class Valadoc.Package : DocumentedElement, NamespaceHandler {
- private Gee.ArrayList<Vala.SourceFile> vfiles = new Gee.ArrayList<Vala.SourceFile> ();
-
- // internal
- public void add_file (Vala.SourceFile vfile) {
- this.vfiles.add (vfile);
- }
-
- public Gee.ArrayList<Namespace> namespaces {
- default = new Gee.ArrayList<Namespace>();
- private set;
- private get;
- }
-
- public bool is_package {
- private set;
- get;
- }
-
- // internal
- public void set_dependency_list ( Gee.ArrayList<Package> list ) {
- this._dependencies = list;
- }
-
- private Gee.ArrayList<Package> _dependencies;
-
- public Gee.ReadOnlyCollection<Package> get_full_dependency_list () {
- Gee.ArrayList<Package> list = new Gee.ArrayList<Package> ();
-
- if ( this._dependencies == null )
- return new Gee.ReadOnlyCollection<Package> ( 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 new Gee.ReadOnlyCollection<Package> ( list );
- }
-
- public Gee.ReadOnlyCollection<Package> get_dependency_list () {
- if ( this._dependencies == null ) {
- return new Gee.ReadOnlyCollection<Package> ( new Gee.ArrayList<Package> () );
- }
-
- return new Gee.ReadOnlyCollection<Package> ( this._dependencies );
- }
-
- private static string extract_package_name ( Settings settings, Vala.SourceFile vfile ) {
- if ( vfile.filename.has_suffix (".vapi") ) {
- string file_name = GLib.Path.get_basename (vfile.filename);
- return file_name.ndup ( file_name.size() - ".vapi".size() );
- }
- else if ( vfile.filename.has_suffix (".gidl") ) {
- string file_name = GLib.Path.get_basename (vfile.filename);
- return file_name.ndup ( file_name.size() - ".gidl".size() );
- }
- else {
- return settings.pkg_name;
- }
- }
-
- public Package.with_name (Valadoc.Settings settings, Vala.SourceFile vfile, string name, Tree head, bool is_package = false) {
- this.is_package = is_package;
- this.settings = settings;
- this.head = head;
-
- this.package_name = name;
-
- this.vfiles.add (vfile);
- this.parent = null;
- }
-
- public Package (Valadoc.Settings settings, Vala.SourceFile vfile, Tree head, bool is_package = false) {
- this.with_name (settings, vfile, this.extract_package_name (settings, vfile), head, is_package);
- }
-
- private string package_name;
-
- public override string? name {
- owned get {
- return package_name;
- }
- }
-
- // internal
- public override DocumentedElement? search_element (string[] params, int pos) {
- foreach (Namespace ns in this.namespaces) {
- DocumentedElement? element = ns.search_element ( params, pos );
- if (element != null) {
- return element;
- }
- }
- return null;
- }
-
- // internal
- public override DocumentedElement? search_element_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
- foreach (Namespace ns in this.namespaces) {
- DocumentedElement? element = ns.search_element_vala (params, pos);
- if (element != null) {
- return element;
- }
- }
- return null;
- }
-
- // internal
- public bool is_vpackage (Vala.SourceFile vfile) {
- return this.vfiles.contains (vfile);
- }
-
- public bool is_visitor_accessible () {
- return !( this.is_package && this.settings.with_deps == false );
- }
-
- public void visit ( Doclet doclet ) {
- if ( !this.is_visitor_accessible () ) {
- return ;
- }
- doclet.visit_package ( this );
- }
-
- // internal
- public void inheritance ( ) {
- this.namespace_inheritance ( );
- }
-
- // internal
- public void parse_comments ( Valadoc.Parser docparser ) {
- this.parse_namespace_comments ( docparser );
- }
-
- // internal
- public void set_type_references ( ) {
- this.set_namespace_type_references ( );
- }
-
- public void write (Langlet langlet, void* ptr) {
- langlet.write_file (this, ptr);
- }
-}
-
-
-
-public class Valadoc.Tree : Vala.CodeVisitor {
- private Gee.ArrayList<Package> packages = new Gee.ArrayList<Package>();
- private Package source_package = null;
- private Valadoc.Settings settings;
- private CodeContext context;
- private ErrorReporter reporter;
- private Package sourcefiles = null;
-
- public WikiPageTree? wikitree {
- private set;
- get;
- }
-
- public Gee.ReadOnlyCollection<Package> get_package_list () {
- return new Gee.ReadOnlyCollection<Package> ( this.packages );
- }
-
- private void add_dependencies_to_source_package () {
- if ( this.source_package != null ) {
- Gee.ArrayList<Package> deplst = new Gee.ArrayList<Package> ();
- foreach ( Package pkg in this.packages ) {
- if ( pkg != this.source_package ) {
- deplst.add ( pkg );
- }
- }
- this.source_package.set_dependency_list ( deplst );
- }
- }
-
- public void visit ( Doclet doclet ) {
- doclet.initialisation ( this.settings, this );
- }
-
- private DocumentedElement? search_symbol_in_type ( DocumentedElement element, string[] params, int params_offset = 0 ) {
- if ( !( element.parent is Inheritable || element.parent is Enum || element.parent is ErrorDomain ) )
- return null;
-
- if ( params[0] != "this" ) {
- string[] nparams = new string[ params.length+1 ];
- nparams[0] = "this";
- for ( int i = 0; params.length > i ; i++ ) {
- nparams [i+1] = params[i];
- }
- return this.search_symbol_in_symbol ( (DocumentedElement)element.parent, nparams, 0 );
- }
-
- return this.search_symbol_in_symbol ( (DocumentedElement)element.parent, params, 0 );
- }
-
- private DocumentedElement? search_symbol_in_symbol ( DocumentedElement element, string[] params, int params_offset = 0 ) {
- if ( element is Class || element is Interface || element is Struct ) {
- return element.search_element ( params, params_offset );
- }
- else if ( element is Enum ) {
- return element.search_element ( params, params_offset );
- }
- else if ( element is ErrorDomain ) {
- return element.search_element ( params, params_offset );
- }
- return null;
- }
-
- private DocumentedElement? search_symbol_in_global_namespaces ( DocumentedElement? element, string[] params ) {
- int param_size = 0;
- for ( param_size = 0; params[param_size] != null; param_size++ );
-
- string[] global_params = new string[param_size +1];
-
- global_params[0] = null;
- for ( int i = 0; params[i-1] != null ; i++ ) {
- global_params[i+1] = params[i];
- }
-
- foreach ( Package pkg in this.packages ) {
- DocumentedElement? element2 = pkg.search_element ( global_params, 0 );
- if ( element2 != null )
- return element2;
- }
- return null;
- }
-
- private DocumentedElement? search_symbol_in_namespaces ( DocumentedElement? element, string[] params ) {
- foreach ( Package pkg in this.packages ) {
- DocumentedElement? element2 = pkg.search_element ( params, 0 );
- if ( element2 != null )
- return element2;
- }
- return null;
- }
-
- private DocumentedElement? search_element ( DocumentedElement? element, string[] params ) {
- if ( element != null ) {
- if ( params[0] == "this" ) {
- return search_symbol_in_type ( element, params, 1 );
- }
-
- var tmp = search_symbol_in_type ( element, params );
- if ( tmp != null )
- return tmp;
- }
-
- var tmp = search_symbol_in_global_namespaces ( element, params );
- if ( tmp != null )
- return tmp;
-
- tmp = this.search_symbol_in_namespaces ( element, params );
- if ( tmp != null )
- return tmp;
-
- return null;
- }
-
- public DocumentedElement? search_symbol_str ( DocumentedElement? element, string symname ) {
- string[] params = symname.split( ".", -1 );
- int i = 0; while ( params[i] != null ) i++;
- params.length = i;
-
- return this.search_element ( element, params );
- }
-
- public override void visit_namespace ( Vala.Namespace vns ) {
- vns.accept_children ( this );
- }
-
- public override void visit_class ( Vala.Class vcl ) {
- if ( vcl.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vcl.source_reference.file;
- Package file = this.find_file(vfile);
- Namespace ns = file.get_namespace (vcl);
- ns.add_class ( vcl );
- }
-
- public override void visit_interface ( Vala.Interface viface ) {
- if ( viface.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = viface.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( viface );
- ns.add_interface ( viface );
- }
-
- public override void visit_struct ( Vala.Struct vstru ) {
- if ( vstru.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vstru.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( vstru );
- ns.add_struct ( vstru );
- }
-
- public override void visit_field ( Vala.Field vf ) {
- if ( vf.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vf.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( vf );
- ns.add_field ( vf );
- }
-
- public override void visit_method ( Vala.Method vm ) {
- if ( vm.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vm.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( vm );
- ns.add_method ( vm );
- }
-
- public override void visit_delegate ( Vala.Delegate vd ) {
- if ( vd.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vd.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( vd );
- ns.add_delegate ( vd );
- }
-
- public override void visit_enum ( Vala.Enum venum ) {
- if ( venum.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = venum.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( venum );
- ns.add_enum ( venum );
- }
-
- public override void visit_constant ( Vala.Constant vc ) {
- if ( vc.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = vc.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( vc );
- ns.add_constant ( vc );
- }
-
- public override void visit_error_domain ( Vala.ErrorDomain verrdom ) {
- if ( verrdom.parent_symbol is Vala.Namespace == false )
- return ;
-
- Vala.SourceFile vfile = verrdom.source_reference.file;
- Package file = this.find_file( vfile );
- Namespace ns = file.get_namespace ( verrdom );
- ns.add_error_domain ( verrdom );
- }
-
- public Tree ( Valadoc.ErrorReporter reporter, Valadoc.Settings settings) {
- this.context = new Vala.CodeContext ( );
- CodeContext.push (context);
-
- this.settings = settings;
- this.reporter = reporter;
-
- reporter.vreporter = this.context.report;
-
- this.context.checking = settings.enable_checking;
- this.context.deprecated = settings.deprecated;
- this.context.experimental = settings.experimental;
- this.context.non_null_experimental = settings.non_null_experimental;
- this.context.dbus_transformation = !settings.disable_dbus_transformation;
-
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- if (context.profile == Profile.POSIX) {
- /* default package */
- if (!add_package ("posix")) {
- Report.error (null, "posix not found in specified Vala API directories");
- }
- }
- else if (context.profile == Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 12;
-
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Report.error (null, "This version of valac only supports GLib 2");
- }
-
- /* default packages */
- if (!this.add_package ("glib-2.0")) { //
- Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package ("gobject-2.0")) { //
- Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
- }
-
-
- private bool add_package (string pkg) {
- if (context.has_package (pkg)) {
- // ignore multiple occurences of the same package
- return true;
- }
-
- var package_path = context.get_package_path (pkg, settings.vapi_directories);
-
- if (package_path == null) {
- return false;
- }
-
- context.add_package (pkg);
-
-
- var vfile = new SourceFile (context, package_path, true);
- context.add_source_file (vfile);
-
- Package vdpkg = new Package (this.settings, vfile, this, true);
- this.packages.add (vdpkg);
-
- var deps_filename = Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg));
- if (FileUtils.test (deps_filename, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (deps_filename, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep.strip ();
- if (dep != "") {
- if (!add_package (dep)) {
- Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg));
- }
- }
- }
- } catch (FileError e) {
- Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
-
- return true;
- }
-
-
- public void add_depencies (string[] packages) {
- foreach (string package in packages) {
- if (!add_package (package)) {
- Report.error (null, "%s not found in specified Vala API directories".printf (package));
- }
- }
- }
-
- public void add_documented_file (string[] sources) {
- if (sources == null) {
- return ;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new SourceFile (context, rpath);
-
-
- if (this.sourcefiles == null) {
- this.sourcefiles = new Package (this.settings, source_file, this, false);
- this.packages.add (this.sourcefiles);
- }
- else {
- this.sourcefiles.add_file (source_file);
- }
-
- if (context.profile == Profile.POSIX) {
- // import the Posix namespace by default (namespace of backend-specific standard library)
- source_file.add_using_directive (new UsingDirective (new UnresolvedSymbol (null, "Posix", null)));
- } else if (context.profile == Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- source_file.add_using_directive (new UsingDirective (new UnresolvedSymbol (null, "GLib", null)));
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi")) {
- var vfile = new SourceFile (context, rpath, true);
- Package vdpkg = new Package (this.settings, vfile, this);
- context.add_source_file (vfile);
- this.packages.add (vdpkg);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- } else {
- Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- public bool create_tree ( ) {
- Vala.Parser parser = new Vala.Parser ();
- parser.parse (this.context);
- if (this.context.report.get_errors () > 0) {
- return false;
- }
-
- Vala.SymbolResolver resolver = new SymbolResolver ();
- resolver.resolve(this.context);
- if (this.context.report.get_errors () > 0) {
- return false;
- }
-
- Vala.SemanticAnalyzer analyzer = new SemanticAnalyzer ( );
- analyzer.analyze(this.context);
- if (this.context.report.get_errors () > 0) {
- return false;
- }
-
- if (context.non_null_experimental) {
- Vala.NullChecker null_checker = new NullChecker ();
- null_checker.check (this.context);
-
- if (this.context.report.get_errors () > 0) {
- return false;
- }
- }
-
- this.context.accept(this);
- this.set_type_references ();
- this.inheritance (); // add a switch
- this.add_dependencies_to_source_package ();
- return true;
- }
-
- // internal
- public Package? find_file (Vala.SourceFile vfile) {
- foreach (Package pkg in this.packages) {
- if (pkg.is_vpackage(vfile))
- return pkg;
- }
- return null;
- }
-
- private void set_type_references ( ) {
- foreach (Package pkg in this.packages) {
- pkg.set_type_references( );
- }
- }
-
- private void inheritance ( ) {
- foreach (Package pkg in this.packages) {
- pkg.inheritance ();
- }
- }
-
- public void parse_comments (Valadoc.Parser docparser) {
- this.wikitree = new WikiPageTree(this.reporter, this.settings);
- wikitree.create_tree (docparser);
-
- foreach (Package pkg in this.packages) {
- pkg.parse_comments(docparser);
- }
- }
-
- // internal
- public DocumentedElement? search_vala_symbol (Vala.Symbol? vnode) {
- if (vnode == null)
- return null;
-
- Gee.ArrayList<Vala.Symbol> params = new Gee.ArrayList<Vala.Symbol> ();
- for (Vala.Symbol iter = vnode; iter != null ; iter = iter.parent_symbol) {
- if (iter is Vala.DataType)
- params.insert (0, ((Vala.DataType)iter).data_type);
- else
- params.insert (0, iter);
- }
-
- if (params.size == 0)
- return null;
-
- if (params.size >= 2) {
- if (params.get(1) is Vala.Namespace) {
- params.remove_at (0);
- }
- }
-
- Vala.SourceFile vfile = vnode.source_reference.file;
- Package file = this.find_file(vfile);
-
- return file.search_element_vala (params, 0);
- }
-
- private Package? get_external_package_by_name (string name) {
- foreach (Package pkg in this.packages) {
- if (name == pkg.name) {
- return pkg;
- }
- }
- return null;
- }
-
-}
-
diff --git a/src/libvaladoc/apitree/apitree.vala b/src/libvaladoc/apitree/apitree.vala
new file mode 100644
index 000000000..9df6d5a01
--- /dev/null
+++ b/src/libvaladoc/apitree/apitree.vala
@@ -0,0 +1,503 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+// private
+public Valadoc.Class glib_error = null;
+
+
+public class Valadoc.Tree : Vala.CodeVisitor {
+ private Gee.ArrayList<Package> packages = new Gee.ArrayList<Package>();
+ private Package source_package = null;
+ private Valadoc.Settings settings;
+ private CodeContext context;
+ private ErrorReporter reporter;
+ private Package sourcefiles = null;
+
+ public WikiPageTree? wikitree {
+ private set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<Package> get_package_list () {
+ return new Gee.ReadOnlyCollection<Package> ( this.packages );
+ }
+
+ private void add_dependencies_to_source_package () {
+ if ( this.source_package != null ) {
+ Gee.ArrayList<Package> deplst = new Gee.ArrayList<Package> ();
+ foreach ( Package pkg in this.packages ) {
+ if ( pkg != this.source_package ) {
+ deplst.add ( pkg );
+ }
+ }
+ this.source_package.set_dependency_list ( deplst );
+ }
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.initialisation ( this.settings, this );
+ }
+
+ private DocumentedElement? search_symbol_in_type ( DocumentedElement element, string[] params, int params_offset = 0 ) {
+ if (!(element.parent is Enum || element.parent is ErrorDomain))
+ return null;
+
+ if ( params[0] != "this" ) {
+ string[] nparams = new string[ params.length+1 ];
+ nparams[0] = "this";
+ for ( int i = 0; params.length > i ; i++ ) {
+ nparams [i+1] = params[i];
+ }
+ return this.search_symbol_in_symbol ( (DocumentedElement)element.parent, nparams, 0 );
+ }
+
+ return this.search_symbol_in_symbol ( (DocumentedElement)element.parent, params, 0 );
+ }
+
+ private DocumentedElement? search_symbol_in_symbol ( DocumentedElement element, string[] params, int params_offset = 0 ) {
+ if ( element is Class || element is Interface || element is Struct ) {
+ return element.search_element ( params, params_offset );
+ }
+ else if ( element is Enum ) {
+ return element.search_element ( params, params_offset );
+ }
+ else if ( element is ErrorDomain ) {
+ return element.search_element ( params, params_offset );
+ }
+ return null;
+ }
+
+ private DocumentedElement? search_symbol_in_global_namespaces ( DocumentedElement? element, string[] params ) {
+ int param_size = 0;
+ for ( param_size = 0; params[param_size] != null; param_size++ );
+
+ string[] global_params = new string[param_size +1];
+
+ global_params[0] = null;
+ for ( int i = 0; params[i-1] != null ; i++ ) {
+ global_params[i+1] = params[i];
+ }
+
+ foreach ( Package pkg in this.packages ) {
+ DocumentedElement? element2 = pkg.search_element ( global_params, 0 );
+ if ( element2 != null )
+ return element2;
+ }
+ return null;
+ }
+
+ private DocumentedElement? search_symbol_in_namespaces ( DocumentedElement? element, string[] params ) {
+ foreach ( Package pkg in this.packages ) {
+ DocumentedElement? element2 = pkg.search_element ( params, 0 );
+ if ( element2 != null )
+ return element2;
+ }
+ return null;
+ }
+
+ private DocumentedElement? search_element ( DocumentedElement? element, string[] params ) {
+ if ( element != null ) {
+ if ( params[0] == "this" ) {
+ return search_symbol_in_type ( element, params, 1 );
+ }
+
+ var tmp = search_symbol_in_type ( element, params );
+ if ( tmp != null )
+ return tmp;
+ }
+
+ var tmp = search_symbol_in_global_namespaces ( element, params );
+ if ( tmp != null )
+ return tmp;
+
+ tmp = this.search_symbol_in_namespaces ( element, params );
+ if ( tmp != null )
+ return tmp;
+
+ return null;
+ }
+
+ public DocumentedElement? search_symbol_str ( DocumentedElement? element, string symname ) {
+ string[] params = symname.split( ".", -1 );
+ int i = 0; while ( params[i] != null ) i++;
+ params.length = i;
+
+ return this.search_element ( element, params );
+ }
+
+ public override void visit_namespace ( Vala.Namespace vns ) {
+ vns.accept_children ( this );
+ }
+
+ public override void visit_class ( Vala.Class vcl ) {
+ if ( vcl.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vcl.source_reference.file;
+ Package file = this.find_file(vfile);
+ Namespace ns = file.get_namespace (vcl);
+ ns.add_class ( vcl );
+ }
+
+ public override void visit_interface ( Vala.Interface viface ) {
+ if ( viface.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = viface.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( viface );
+ ns.add_interface ( viface );
+ }
+
+ public override void visit_struct ( Vala.Struct vstru ) {
+ if ( vstru.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vstru.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( vstru );
+ ns.add_struct ( vstru );
+ }
+
+ public override void visit_field ( Vala.Field vf ) {
+ if ( vf.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vf.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( vf );
+ ns.add_field ( vf );
+ }
+
+ public override void visit_method ( Vala.Method vm ) {
+ if ( vm.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vm.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( vm );
+ ns.add_method ( vm );
+ }
+
+ public override void visit_delegate ( Vala.Delegate vd ) {
+ if ( vd.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vd.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( vd );
+ ns.add_delegate ( vd );
+ }
+
+ public override void visit_enum ( Vala.Enum venum ) {
+ if ( venum.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = venum.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( venum );
+ ns.add_enum ( venum );
+ }
+
+ public override void visit_constant ( Vala.Constant vc ) {
+ if ( vc.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = vc.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( vc );
+ ns.add_constant ( vc );
+ }
+
+ public override void visit_error_domain ( Vala.ErrorDomain verrdom ) {
+ if ( verrdom.parent_symbol is Vala.Namespace == false )
+ return ;
+
+ Vala.SourceFile vfile = verrdom.source_reference.file;
+ Package file = this.find_file( vfile );
+ Namespace ns = file.get_namespace ( verrdom );
+ ns.add_error_domain ( verrdom );
+ }
+
+ public Tree ( Valadoc.ErrorReporter reporter, Valadoc.Settings settings) {
+ this.context = new Vala.CodeContext ( );
+ CodeContext.push (context);
+
+ this.settings = settings;
+ this.reporter = reporter;
+
+ reporter.vreporter = this.context.report;
+
+ this.context.checking = settings.enable_checking;
+ this.context.deprecated = settings.deprecated;
+ this.context.experimental = settings.experimental;
+ this.context.non_null_experimental = settings.non_null_experimental;
+ this.context.dbus_transformation = !settings.disable_dbus_transformation;
+
+
+ if (settings.basedir == null) {
+ context.basedir = realpath (".");
+ } else {
+ context.basedir = realpath (settings.basedir);
+ }
+
+ if (settings.directory != null) {
+ context.directory = realpath (settings.directory);
+ } else {
+ context.directory = context.basedir;
+ }
+
+ if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
+ context.profile = Profile.GOBJECT;
+ context.add_define ("GOBJECT");
+ }
+
+ if (settings.defines != null) {
+ foreach (string define in settings.defines) {
+ context.add_define (define);
+ }
+ }
+
+ if (context.profile == Profile.POSIX) {
+ /* default package */
+ if (!add_package ("posix")) {
+ Report.error (null, "posix not found in specified Vala API directories");
+ }
+ }
+ else if (context.profile == Profile.GOBJECT) {
+ int glib_major = 2;
+ int glib_minor = 12;
+
+
+ context.target_glib_major = glib_major;
+ context.target_glib_minor = glib_minor;
+ if (context.target_glib_major != 2) {
+ Report.error (null, "This version of valac only supports GLib 2");
+ }
+
+ /* default packages */
+ if (!this.add_package ("glib-2.0")) { //
+ Report.error (null, "glib-2.0 not found in specified Vala API directories");
+ }
+
+ if (!this.add_package ("gobject-2.0")) { //
+ Report.error (null, "gobject-2.0 not found in specified Vala API directories");
+ }
+ }
+ }
+
+
+ private bool add_package (string pkg) {
+ if (context.has_package (pkg)) {
+ // ignore multiple occurences of the same package
+ return true;
+ }
+
+ var package_path = context.get_package_path (pkg, settings.vapi_directories);
+
+ if (package_path == null) {
+ return false;
+ }
+
+ context.add_package (pkg);
+
+
+ var vfile = new SourceFile (context, package_path, true);
+ context.add_source_file (vfile);
+
+ Package vdpkg = new Package (this.settings, vfile, this, true);
+ this.packages.add (vdpkg);
+
+ var deps_filename = Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg));
+ if (FileUtils.test (deps_filename, FileTest.EXISTS)) {
+ try {
+ string deps_content;
+ ulong deps_len;
+ FileUtils.get_contents (deps_filename, out deps_content, out deps_len);
+ foreach (string dep in deps_content.split ("\n")) {
+ dep.strip ();
+ if (dep != "") {
+ if (!add_package (dep)) {
+ Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg));
+ }
+ }
+ }
+ } catch (FileError e) {
+ Report.error (null, "Unable to read dependency file: %s".printf (e.message));
+ }
+ }
+
+ return true;
+ }
+
+
+ public void add_depencies (string[] packages) {
+ foreach (string package in packages) {
+ if (!add_package (package)) {
+ Report.error (null, "%s not found in specified Vala API directories".printf (package));
+ }
+ }
+ }
+
+ public void add_documented_file (string[] sources) {
+ if (sources == null) {
+ return ;
+ }
+
+ foreach (string source in sources) {
+ if (FileUtils.test (source, FileTest.EXISTS)) {
+ var rpath = realpath (source);
+ if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
+ var source_file = new SourceFile (context, rpath);
+
+
+ if (this.sourcefiles == null) {
+ this.sourcefiles = new Package (this.settings, source_file, this, false);
+ this.packages.add (this.sourcefiles);
+ }
+ else {
+ this.sourcefiles.add_file (source_file);
+ }
+
+ if (context.profile == Profile.POSIX) {
+ // import the Posix namespace by default (namespace of backend-specific standard library)
+ source_file.add_using_directive (new UsingDirective (new UnresolvedSymbol (null, "Posix", null)));
+ } else if (context.profile == Profile.GOBJECT) {
+ // import the GLib namespace by default (namespace of backend-specific standard library)
+ source_file.add_using_directive (new UsingDirective (new UnresolvedSymbol (null, "GLib", null)));
+ }
+
+ context.add_source_file (source_file);
+ } else if (source.has_suffix (".vapi")) {
+ var vfile = new SourceFile (context, rpath, true);
+ Package vdpkg = new Package (this.settings, vfile, this);
+ context.add_source_file (vfile);
+ this.packages.add (vdpkg);
+ } else if (source.has_suffix (".c")) {
+ context.add_c_source_file (rpath);
+ } else {
+ Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
+ }
+ } else {
+ Report.error (null, "%s not found".printf (source));
+ }
+ }
+ }
+
+ public bool create_tree ( ) {
+ Vala.Parser parser = new Vala.Parser ();
+ parser.parse (this.context);
+ if (this.context.report.get_errors () > 0) {
+ return false;
+ }
+
+ Vala.SymbolResolver resolver = new SymbolResolver ();
+ resolver.resolve(this.context);
+ if (this.context.report.get_errors () > 0) {
+ return false;
+ }
+
+ Vala.SemanticAnalyzer analyzer = new SemanticAnalyzer ( );
+ analyzer.analyze(this.context);
+ if (this.context.report.get_errors () > 0) {
+ return false;
+ }
+
+ if (context.non_null_experimental) {
+ Vala.NullChecker null_checker = new NullChecker ();
+ null_checker.check (this.context);
+
+ if (this.context.report.get_errors () > 0) {
+ return false;
+ }
+ }
+
+ this.context.accept(this);
+ this.set_type_references ();
+ this.add_dependencies_to_source_package ();
+ return true;
+ }
+
+ internal Package? find_file (Vala.SourceFile vfile) {
+ foreach (Package pkg in this.packages) {
+ if (pkg.is_vpackage(vfile))
+ return pkg;
+ }
+ return null;
+ }
+
+ private void set_type_references ( ) {
+ foreach (Package pkg in this.packages) {
+ pkg.set_type_references( );
+ }
+ }
+
+ public void parse_comments (Valadoc.Parser docparser) {
+ this.wikitree = new WikiPageTree(this.reporter, this.settings);
+ wikitree.create_tree (docparser);
+
+ foreach (Package pkg in this.packages) {
+ pkg.parse_comments(docparser);
+ }
+ }
+
+ internal DocumentedElement? search_vala_symbol (Vala.Symbol? vnode) {
+ if (vnode == null)
+ return null;
+
+ Gee.ArrayList<Vala.Symbol> params = new Gee.ArrayList<Vala.Symbol> ();
+ for (Vala.Symbol iter = vnode; iter != null ; iter = iter.parent_symbol) {
+ if (iter is Vala.DataType)
+ params.insert (0, ((Vala.DataType)iter).data_type);
+ else
+ params.insert (0, iter);
+ }
+
+ if (params.size == 0)
+ return null;
+
+ if (params.size >= 2) {
+ if (params.get(1) is Vala.Namespace) {
+ params.remove_at (0);
+ }
+ }
+
+ Vala.SourceFile vfile = vnode.source_reference.file;
+ Package file = this.find_file(vfile);
+
+ return file.search_element_vala (params, 0);
+ }
+
+ private Package? get_external_package_by_name (string name) {
+ foreach (Package pkg in this.packages) {
+ if (name == pkg.name) {
+ return pkg;
+ }
+ }
+ return null;
+ }
+
+}
+
diff --git a/src/libvaladoc/apitree/array.vala b/src/libvaladoc/apitree/array.vala
new file mode 100644
index 000000000..55c1fde84
--- /dev/null
+++ b/src/libvaladoc/apitree/array.vala
@@ -0,0 +1,62 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Array : Basic {
+ private Vala.ArrayType vtype;
+
+ public Basic data_type {
+ private set;
+ get;
+ }
+
+ public Array (Valadoc.Settings settings, Vala.ArrayType vtyperef, Basic parent, Tree head) {
+ this.settings = settings;
+ this.vtype = vtyperef;
+ this.parent = parent;
+ this.head = head;
+
+ Vala.DataType vntype = vtyperef.element_type;
+ if ( vntype is Vala.ArrayType )
+ this.data_type = new Array (settings, (Vala.ArrayType)vntype, this, head);
+ else
+ this.data_type = new TypeReference (settings, vntype, this, head);
+ }
+
+ public void write (Langlet langlet, void* ptr, DocumentedElement parent) {
+ langlet.write_array (this, ptr, parent);
+ }
+
+ public void set_type_references () {
+ if ( this.data_type == null )
+ /*TODO:possible?*/;
+ else if ( this.data_type is Array )
+ ((Array)this.data_type).set_type_references ();
+ else if ( this.data_type is Pointer )
+ ((Pointer)this.data_type).set_type_references ();
+ else
+ ((TypeReference)this.data_type).set_type_references ();
+ }
+}
+
diff --git a/src/libvaladoc/apitree/basic.vala b/src/libvaladoc/apitree/basic.vala
new file mode 100644
index 000000000..c350dc594
--- /dev/null
+++ b/src/libvaladoc/apitree/basic.vala
@@ -0,0 +1,46 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public abstract class Valadoc.Basic : Object {
+ public Valadoc.Settings settings {
+ protected get;
+ set;
+ }
+
+ public Basic parent {
+ set;
+ get;
+ }
+
+ public Tree head {
+ set;
+ get;
+ }
+
+ protected Vala.Symbol vsymbol {
+ protected get;
+ set;
+ }
+}
+
diff --git a/src/libvaladoc/apitree/class.vala b/src/libvaladoc/apitree/class.vala
new file mode 100644
index 000000000..d5ed8c345
--- /dev/null
+++ b/src/libvaladoc/apitree/class.vala
@@ -0,0 +1,335 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Class : DocumentedElement, SymbolAccessibility, Visitable, ClassHandler, StructHandler, SignalHandler, MethodHandler, EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler, DelegateHandler, ConstantHandler, TemplateParameterListHandler {
+ private Gee.ArrayList<Interface> interfaces;
+ private bool inherited = false;
+ private Vala.Class vclass;
+
+ public Class ( Valadoc.Settings settings, Vala.Class vclass, ClassHandler parent, Tree head ) {
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.interfaces = new Gee.ArrayList<Interface>();
+ this.methods = new Gee.ArrayList<Method> ();
+
+ this.vcomment = vclass.comment;
+ this.settings = settings;
+ this.vsymbol = vclass;
+ this.vclass = vclass;
+ this.parent = parent;
+ this.head = head;
+
+ if ( glib_error == null ) {
+ if ( this.full_name () == "GLib.Error" ) {
+ glib_error = this;
+ }
+ }
+
+ var vtparams = this.vclass.get_type_parameters ();
+ this.set_template_parameter_list ( vtparams );
+
+ Gee.Collection<Vala.Enum> venums = this.vclass.get_enums ();
+ this.enums = new Gee.ArrayList<Enum> ();
+ this.add_enums ( venums );
+
+ Gee.Collection<Vala.Delegate> vdelegates = this.vclass.get_delegates ();
+ this.delegates = new Gee.ArrayList<Delegate> ();
+ this.add_delegates ( vdelegates );
+
+ Gee.Collection<Vala.Class> vclasses = this.vclass.get_classes();
+ this.classes = new Gee.ArrayList<Class> ();
+ this.add_classes ( vclasses );
+
+ Gee.Collection<Vala.Struct> vstructs = this.vclass.get_structs();
+ this.structs = new Gee.ArrayList<Struct> ();
+ this.add_structs ( vstructs );
+
+ Gee.Collection<Vala.Field> vfields = this.vclass.get_fields();
+ this.fields = new Gee.ArrayList<Field> ();
+ this.add_fields ( vfields );
+
+ Gee.Collection<Vala.Method> vmethods = this.vclass.get_methods ();
+ this.construction_methods = new Gee.ArrayList<Method>();
+ this.add_methods_and_construction_methods ( vmethods );
+
+ Gee.Collection<Vala.Signal> vsignals = this.vclass.get_signals();
+ this.signals = new Gee.ArrayList<Signal>();
+ this.add_signals ( vsignals );
+
+ Gee.Collection<Vala.Property> vproperties = this.vclass.get_properties();
+ this.properties = new Gee.ArrayList<Property>();
+ this.add_properties ( vproperties );
+
+ Gee.Collection<Vala.Constant> vconstants = this.vclass.get_constants();
+ this.constants = new Gee.ArrayList<Constant>();
+ this.add_constants ( vconstants );
+ }
+
+ protected Class? base_type {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Delegate> delegates {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Enum> enums {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Property> properties {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Class> classes {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Struct> structs {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Signal> signals {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Constant> constants {
+ get;
+ set;
+ }
+
+ public string? get_cname () {
+ return this.vclass.get_cname();
+ }
+
+ public Gee.Collection<Interface> get_implemented_interface_list ( ) {
+ return this.interfaces;
+ }
+
+ internal override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos];
+
+ if ( velement is Vala.Class == false )
+ return null;
+
+ if ( !this.is_vclass( (Vala.Class)velement ) )
+ return null;
+
+ if ( params.size == pos+1 )
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if ( velement is Vala.Field ) {
+ element = this.search_field_vala ( params, pos );
+ }
+ else if ( velement is Vala.Method ) {
+ element = this.search_method_vala ( params, pos );
+ }
+ else if ( velement is Vala.Delegate ) {
+ element = this.search_delegate_vala ( params, pos );
+ }
+ else if ( velement is Vala.CreationMethod ) {
+ element = this.search_construction_method_vala ( params, pos );
+ }
+ else if ( velement is Vala.Signal ) {
+ element = this.search_signal_vala ( params, pos );
+ }
+ else if ( velement is Vala.Property ) {
+ element = this.search_property_vala ( params, pos );
+ }
+ else if ( velement is Vala.Struct ) {
+ element = this.search_struct_vala ( params, pos );
+ }
+ else if ( velement is Vala.Class ) {
+ element = this.search_class_vala ( params, pos );
+ }
+ else if ( velement is Vala.Enum ) {
+ element = this.search_enum_vala ( params, pos );
+ }
+ else if ( velement is Vala.Constant ) {
+ element = this.search_constant_vala ( params, pos );
+ }
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ DocumentedElement? element = this.search_field ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_delegate ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_construction_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_signal ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_property ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_struct ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_class ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_enum ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_constant ( params, pos );
+ if ( element != null )
+ return element;
+
+ return null;
+ }
+
+ internal bool is_vclass ( Vala.Class vcl ) {
+ return this.vclass == vcl;
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_class ( this, ptr );
+ }
+
+ public bool is_abstract {
+ get {
+ return this.vclass.is_abstract;
+ }
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_class ( this );
+ }
+
+ internal void parse_comments ( Valadoc.Parser docparser ) {
+ if ( this.documentation != null )
+ return ;
+
+ if ( this.vcomment != null ) {
+ if ( docparser.is_inherit_doc ( this ) && this.base_type != null ) {
+ ((Class)this.base_type).parse_comments ( docparser );
+ this.documentation = this.base_type.documentation;
+ }
+ else {
+ this.parse_comment_helper ( docparser );
+ }
+ }
+
+ this.parse_construction_method_comments ( docparser );
+ this.parse_delegate_comments ( docparser );
+ this.parse_constant_comments ( docparser );
+ this.parse_property_comments ( docparser );
+ this.parse_method_comments ( docparser );
+ this.parse_struct_comments ( docparser );
+ this.parse_signal_comments ( docparser );
+ this.parse_class_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ this.parse_enum_comments ( docparser );
+ }
+
+ private void set_parent_type_references ( Gee.Collection<Vala.DataType> lst ) {
+ if (this.interfaces.size != 0)
+ return ;
+
+ foreach ( Vala.DataType vtyperef in lst ) {
+ Basic? element = this.head.search_vala_symbol ( vtyperef.data_type );
+ if ( element is Class ) {
+ this.base_type = (Class)element;
+ }
+ else {
+ this.interfaces.add ( (Interface)element );
+ }
+ }
+ }
+
+ internal void set_type_references ( ) {
+ var lst = this.vclass.get_base_types ();
+ this.set_parent_type_references ( lst );
+
+ this.set_template_parameter_list_references ( );
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_delegate_type_references ( );
+ this.set_property_type_references ( );
+ this.set_method_type_references ( );
+ this.set_signal_type_references ( );
+ this.set_field_type_references ( );
+ this.set_enum_type_references ( );
+ this.set_struct_type_references ( );
+ this.set_class_type_references ( );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/classhandler.vala b/src/libvaladoc/apitree/classhandler.vala
new file mode 100644
index 000000000..04f8f7063
--- /dev/null
+++ b/src/libvaladoc/apitree/classhandler.vala
@@ -0,0 +1,104 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ClassHandler : Basic {
+ protected abstract Gee.ArrayList<Class> classes {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_class_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Class cl in this.classes ) {
+ DocumentedElement? element = cl.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_class ( string[] params, int pos ) {
+ foreach ( Class cl in this.classes ) {
+ DocumentedElement? element = cl.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected Class? find_vclass ( Vala.Class vcl ) {
+ foreach ( Class cl in this.classes ) {
+ if ( cl.is_vclass ( vcl ) )
+ return cl;
+
+ var tmp = cl.find_vclass ( vcl );
+ if ( tmp != null )
+ return tmp;
+ }
+ return null;
+ }
+
+ public Gee.ReadOnlyCollection<Class> get_class_list ( ) {
+ var lst = new Gee.ArrayList<Class> ();
+ foreach ( Class cl in this.classes ) {
+ if ( !cl.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( cl );
+ }
+
+ return new Gee.ReadOnlyCollection<Class>( lst );
+ }
+
+ internal void add_class ( Vala.Class vcl ) {
+ Class cl = new Class ( this.settings, vcl, this, this.head );
+ this.classes.add ( cl );
+ }
+
+ public void add_classes ( Gee.Collection<Vala.Class> vclasses ) {
+ foreach ( Vala.Class vcl in vclasses ) {
+ this.add_class ( vcl );
+ }
+ }
+
+
+ public void visit_classes ( Doclet doclet ) {
+ foreach ( Class cl in this.get_class_list() ) {
+ cl.visit ( doclet );
+ }
+ }
+
+ protected void set_class_type_references ( ) {
+ foreach ( Class cl in this.classes ) {
+ cl.set_type_references ();
+ }
+ }
+
+ protected void parse_class_comments ( Valadoc.Parser docparser ) {
+ foreach ( Class cl in this.classes ) {
+ cl.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/constant.vala b/src/libvaladoc/apitree/constant.vala
new file mode 100644
index 000000000..b8d1bcebd
--- /dev/null
+++ b/src/libvaladoc/apitree/constant.vala
@@ -0,0 +1,73 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Constant : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable {
+ private Vala.Constant vconst;
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public bool is_vconstant ( Vala.Constant vconst ) {
+ return ( this.vconst == vconst );
+ }
+
+ public Constant ( Valadoc.Settings settings, Vala.Constant vconst, ConstantHandler parent, Tree head ) {
+ this.vcomment = vconst.comment;
+ this.settings = settings;
+ this.vsymbol = vconst;
+ this.vconst = vconst;
+ this.parent = parent;
+ this.head = head;
+
+ var vret = this.vconst.type_reference;
+ this.set_ret_type ( vret );
+ }
+
+ public string get_cname () {
+ return this.vconst.get_cname ();
+ }
+
+ internal void set_type_references ( ) {
+ ((ReturnTypeHandler)this).set_return_type_references ( );
+ }
+
+ internal void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ }
+
+ public void visit ( Doclet doclet, ConstantHandler? parent ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_constant ( this, parent );
+ }
+
+ public void write ( Langlet langlet, void* ptr, ConstantHandler parent ) {
+ langlet.write_constant ( this, parent, ptr );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/constanthandler.vala b/src/libvaladoc/apitree/constanthandler.vala
new file mode 100644
index 000000000..310394c7d
--- /dev/null
+++ b/src/libvaladoc/apitree/constanthandler.vala
@@ -0,0 +1,102 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ConstantHandler : Basic {
+ protected abstract Gee.ArrayList<Constant> constants {
+ protected set;
+ get;
+ }
+
+ protected DocumentedElement? search_constant_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Constant == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Constant c in this.constants ) {
+ if ( c.is_vconstant ( (Vala.Constant)velement ) ) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ internal DocumentedElement? search_constant ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Constant c in this.constants ) {
+ if ( c.name == params[pos] )
+ return c;
+ }
+ return null;
+ }
+
+ public Gee.ReadOnlyCollection<Constant> get_constant_list ( ) {
+ var lstd = new Gee.ArrayList<Constant> ();
+ foreach (Constant c in this.constants) {
+ if (!c.is_type_visitor_accessible (this) )
+ continue ;
+
+ lstd.add (c);
+ }
+
+ return new Gee.ReadOnlyCollection<Constant>(lstd);
+ }
+
+ internal void add_constants (Gee.Collection<Vala.Constant> vconstants) {
+ foreach (Vala.Constant vc in vconstants) {
+ this.add_constant (vc);
+ }
+ }
+
+ internal void add_constant (Vala.Constant vc) {
+ var tmp = new Constant (this.settings, vc, this, this.head);
+ this.constants.add ( tmp );
+ }
+
+ internal void set_constant_type_references ( ) {
+ foreach ( Constant c in this.constants ) {
+ c.set_type_references ( );
+ }
+ }
+
+ internal void parse_constant_comments ( Valadoc.Parser docparser ) {
+ foreach ( Constant c in this.constants ) {
+ c.parse_comment ( docparser );
+ }
+ }
+
+ public void visit_constants ( Doclet doclet ) {
+ foreach ( Constant c in this.get_constant_list() ) {
+ c.visit ( doclet, this );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/constructionmethodhandler.vala b/src/libvaladoc/apitree/constructionmethodhandler.vala
new file mode 100644
index 000000000..6262fa0b1
--- /dev/null
+++ b/src/libvaladoc/apitree/constructionmethodhandler.vala
@@ -0,0 +1,112 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ConstructionMethodHandler : Basic, MethodHandler {
+ protected abstract Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_construction_method_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Method == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Method m in this.methods ) {
+ if ( m.is_vmethod ( (Vala.Method)velement ) ) {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_construction_method ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] == null )
+ return null;
+
+ if ( params[pos+2] != null )
+ return null;
+
+ string name = params[pos] + "." + params[pos+1];
+
+ foreach ( Method m in this.construction_methods ) {
+ if ( m.name == name )
+ return m;
+ }
+ return null;
+ }
+
+ public Gee.ReadOnlyCollection<Method> get_construction_method_list ( ) {
+ var lst = new Gee.ArrayList<Method> ();
+ foreach ( Method cm in this.construction_methods ) {
+ if ( !cm.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( cm );
+ }
+
+ return new Gee.ReadOnlyCollection<Method>( lst );
+ }
+
+ protected void parse_construction_method_comments ( Valadoc.Parser docparser ) {
+ foreach ( Method cm in this.construction_methods ) {
+ cm.parse_comment ( docparser );
+ }
+ }
+
+ protected void set_construction_method_references ( ) {
+ foreach ( Method cm in this.construction_methods ) {
+ cm.set_type_references ( );
+ }
+ }
+
+ public void visit_construction_methods ( Doclet doclet ) {
+ foreach ( Method m in this.get_construction_method_list() ) {
+ m.visit ( doclet, this );
+ }
+ }
+
+ protected void add_construction_method ( Vala.CreationMethod vm ) {
+ var tmp = new Method ( this.settings, vm, this, this.head );
+ this.construction_methods.add ( tmp );
+ }
+
+ protected void add_methods_and_construction_methods ( Gee.Collection<Vala.Method> vmethods ) {
+ foreach ( Vala.Method vm in vmethods ) {
+ if ( vm is Vala.CreationMethod ) {
+ this.add_construction_method ( (Vala.CreationMethod)vm );
+ }
+ else {
+ this.add_method ( vm );
+ }
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/delegate.vala b/src/libvaladoc/apitree/delegate.vala
new file mode 100644
index 000000000..c0a151625
--- /dev/null
+++ b/src/libvaladoc/apitree/delegate.vala
@@ -0,0 +1,105 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Delegate : DocumentedElement, SymbolAccessibility, Visitable, ParameterListHandler, ReturnTypeHandler, TemplateParameterListHandler, ExceptionHandler {
+ private Vala.Delegate vdelegate;
+
+ public Delegate ( Valadoc.Settings settings, Vala.Delegate vdelegate, DelegateHandler parent, Tree head ) {
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.param_list = new Gee.ArrayList<FormalParameter>();
+ this.err_domains = new Gee.ArrayList<DocumentedElement>();
+
+ this.vcomment = vdelegate.comment;
+ this.settings = settings;
+ this.vdelegate = vdelegate;
+ this.vsymbol = vdelegate;
+ this.parent = parent;
+ this.head = head;
+
+ var ret = this.vdelegate.return_type;
+ this.set_ret_type ( ret );
+
+ var vparamlst = this.vdelegate.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+ }
+
+ public string? get_cname () {
+ return this.vdelegate.get_cname();
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_delegate ( this );
+ }
+
+ public Gee.ArrayList<TypeParameter> template_param_lst {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<DocumentedElement> err_domains {
+ protected set;
+ get;
+ }
+
+ public bool is_static {
+ get {
+ return this.vdelegate.has_target;
+ }
+ }
+
+ internal void set_type_references ( ) {
+ this.set_return_type_references ( );
+ this.set_parameter_list_type_references ( );
+
+ var vexceptionlst = this.vdelegate.get_error_types ();
+ this.add_exception_list ( vexceptionlst );
+ }
+
+ internal void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ }
+
+ internal bool is_vdelegate (Vala.Delegate vdel) {
+ return (this.vdelegate == vdel);
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_delegate (this, ptr);
+ }
+}
+
diff --git a/src/libvaladoc/apitree/delegatehandler.vala b/src/libvaladoc/apitree/delegatehandler.vala
new file mode 100644
index 000000000..906b3cd0c
--- /dev/null
+++ b/src/libvaladoc/apitree/delegatehandler.vala
@@ -0,0 +1,99 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.DelegateHandler : Basic {
+ protected abstract Gee.ArrayList<Delegate> delegates {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_delegate_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Delegate == false )
+ return null;
+
+ foreach ( Delegate del in this.delegates ) {
+ if ( del.is_vdelegate ( (Vala.Delegate)velement ) ) {
+ return del;
+ }
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_delegate ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Delegate del in this.delegates ) {
+ if ( del.name == params[pos] )
+ return del;
+ }
+ return null;
+ }
+
+ public Gee.Collection<Delegate> get_delegate_list ( ) {
+ var lst = new Gee.ArrayList<Delegate> ();
+ foreach ( Delegate del in this.delegates ) {
+ if ( !del.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( del );
+ }
+
+ return new Gee.ReadOnlyCollection<Delegate>( lst );
+ }
+
+ public void visit_delegates ( Doclet doclet ) {
+ foreach ( Delegate del in this.delegates ) {
+ del.visit ( doclet );
+ }
+ }
+
+ public void add_delegates ( Gee.Collection<Vala.Delegate> vdels ) {
+ foreach ( Vala.Delegate vdel in vdels ) {
+ this.add_delegate ( vdel );
+ }
+ }
+
+ public void add_delegate ( Vala.Delegate vdel ) {
+ var tmp = new Delegate ( this.settings, vdel, this, this.head );
+ this.delegates.add ( tmp );
+ }
+
+ public void set_delegate_type_references ( ) {
+ foreach ( Delegate del in this.delegates ) {
+ del.set_type_references ( );
+ }
+ }
+
+ public void parse_delegate_comments ( Valadoc.Parser docparser ) {
+ foreach ( Delegate del in this.delegates ) {
+ del.parse_comment ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/documentedelement.vala b/src/libvaladoc/apitree/documentedelement.vala
new file mode 100644
index 000000000..0f0c4b7aa
--- /dev/null
+++ b/src/libvaladoc/apitree/documentedelement.vala
@@ -0,0 +1,135 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public abstract class Valadoc.DocumentedElement : Basic, Documented {
+ private Namespace? _nspace = null;
+ private Package? _package = null;
+ private string _full_name = null;
+ private int _line = -1;
+
+ public Namespace? nspace {
+ get {
+ if (this._nspace == null) {
+ Valadoc.Basic ast = this;
+ while (ast is Valadoc.Namespace == false) {
+ ast = ast.parent;
+ if (ast == null)
+ return null;
+ }
+ this._nspace = (Valadoc.Namespace)ast;
+ }
+ return this._nspace;
+ }
+ }
+
+
+ public Package? package {
+ get {
+ if (this._package == null) {
+ Valadoc.Basic ast = this;
+ while (ast is Valadoc.Package == false) {
+ ast = ast.parent;
+ if (ast == null)
+ return null;
+ }
+ this._package = (Valadoc.Package)ast;
+ }
+ return this._package;
+ }
+ }
+
+ public int line {
+ get {
+ if (this._line == -1) {
+ Vala.SourceReference vsref = this.vsymbol.source_reference;
+ this._line = (vsref == null)? 0 : vsref.first_line;
+ }
+ return this._line;
+ }
+ }
+
+ protected Vala.Comment vcomment {
+ get; set;
+ }
+
+ public DocumentationTree? documentation {
+ protected set;
+ get;
+ }
+
+ public virtual string? name {
+ owned get {
+ return this.vsymbol.name;
+ }
+ }
+
+ // rename to get_full_name
+ public string? 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 (Basic pos = this.parent; pos is Package == false ; pos = pos.parent) {
+ string name = ((DocumentedElement)pos).name;
+ if (name != null) {
+ full_name.prepend_unichar ('.');
+ full_name.prepend (name);
+ }
+ }
+ }
+ this._full_name = full_name.str;
+ }
+ return this._full_name;
+ }
+
+ public string? get_filename () {
+ SourceReference? sref = this.vsymbol.source_reference;
+ if ( sref == null )
+ return null;
+
+ Vala.SourceFile? file = sref.file;
+ if ( file == null )
+ return null;
+
+ string path = sref.file.filename;
+ return GLib.Path.get_basename ( path );
+ }
+
+ protected void parse_comment_helper ( Valadoc.Parser docparser ) {
+ this.documentation = docparser.parse ( this );
+ }
+
+ internal virtual DocumentedElement? search_element ( string[] params, int pos ) {
+ return null;
+ }
+
+ internal virtual DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> list, int pos ) {
+ return null;
+ }
+}
+
diff --git a/src/libvaladoc/apitree/enum.vala b/src/libvaladoc/apitree/enum.vala
new file mode 100644
index 000000000..b3c714321
--- /dev/null
+++ b/src/libvaladoc/apitree/enum.vala
@@ -0,0 +1,176 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Enum : DocumentedElement, SymbolAccessibility, Visitable, MethodHandler {
+ private Gee.ArrayList<EnumValue> en_values;
+
+ public Enum ( Valadoc.Settings settings, Vala.Enum venum, EnumHandler parent, Tree head ) {
+ this.vcomment = venum.comment;
+ this.settings = settings;
+ this.vsymbol = venum;
+ this.venum = venum;
+ this.parent = parent;
+ this.head = head;
+
+ Gee.Collection<Vala.Method> vmethods = this.venum.get_methods ();
+ this.methods = new Gee.ArrayList<Method> ();
+ this.add_methods ( vmethods );
+
+ Gee.Collection<Vala.EnumValue> venvals = this.venum.get_values ();
+ this.en_values = new Gee.ArrayList<EnumValue> ();
+ this.add_enum_values ( venvals );
+ }
+
+ public string? get_cname () {
+ return this.venum.get_cname();
+ }
+
+ private DocumentedElement? search_enum_value_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.EnumValue == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( EnumValue env in this.en_values ) {
+ if ( env.is_venumvalue ( (Vala.EnumValue)velement ) ) {
+ return env;
+ }
+ }
+ return null;
+ }
+
+ private DocumentedElement? search_enum_value ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( EnumValue enval in this.en_values ) {
+ if ( enval.name == params[pos] )
+ return enval;
+ }
+ return null;
+ }
+
+ internal override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos];
+
+ if ( velement is Vala.Enum == false )
+ return null;
+
+ if ( this.is_venum ( (Vala.Enum)velement ) == false )
+ return null;
+
+ if ( params.size == pos+1 )
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if ( velement is Vala.EnumValue ) {
+ element = this.search_enum_value_vala ( params, pos );
+ }
+ else if ( velement is Vala.Method ) {
+ element = this.search_method_vala ( params, pos );
+ }
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ DocumentedElement? element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_enum_value ( params, pos );
+ if ( element != null )
+ return element;
+
+ return null;
+ }
+
+ internal void set_type_references () {
+ this.set_method_type_references ();
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ // rename: get_enum_value_list
+ public Gee.ReadOnlyCollection<EnumValue> get_enum_values () {
+ return new Gee.ReadOnlyCollection<EnumValue>( this.en_values );
+ }
+
+ internal void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+
+ foreach ( EnumValue enval in this.en_values ) {
+ enval.parse_comment ( docparser );
+ }
+
+ this.parse_method_comments ( docparser );
+ }
+
+ private inline void add_enum_values ( Gee.Collection<Vala.EnumValue> venvals ) {
+ foreach ( Vala.EnumValue venval in venvals ) {
+ var tmp = new EnumValue ( this.settings, venval, this, this.head );
+ this.en_values.add ( tmp );
+ }
+ }
+
+ public void visit_enum_values ( Doclet doclet ) {
+ foreach ( EnumValue enval in this.en_values )
+ enval.visit ( doclet );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_enum ( this );
+ }
+
+ private Vala.Enum venum;
+
+ internal bool is_venum ( Vala.Enum ven ) {
+ return ( this.venum == ven );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_enum ( this, ptr );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/enumhandler.vala b/src/libvaladoc/apitree/enumhandler.vala
new file mode 100644
index 000000000..10020bd34
--- /dev/null
+++ b/src/libvaladoc/apitree/enumhandler.vala
@@ -0,0 +1,91 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.EnumHandler : Basic {
+ protected abstract Gee.ArrayList<Enum> enums {
+ set;
+ get;
+ }
+
+ protected void set_enum_type_references ( ) {
+ foreach ( Enum en in this.enums ) {
+ en.set_type_references ( );
+ }
+ }
+
+ protected DocumentedElement? search_enum_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Enum en in this.enums ) {
+ DocumentedElement element = en.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_enum ( string[] params, int pos ) {
+ foreach ( Enum en in this.enums ) {
+ DocumentedElement element = en.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ public Gee.Collection<Enum> get_enum_list ( ) {
+ var lst = new Gee.ArrayList<Enum> ();
+ foreach ( Enum en in this.enums ) {
+ if ( !en.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( en );
+ }
+
+ return new Gee.ReadOnlyCollection<Enum>( lst );
+ }
+
+ public void visit_enums ( Doclet doclet ) {
+ foreach ( Enum en in this.enums ) {
+ en.visit( doclet );
+ }
+ }
+
+ public void add_enums ( Gee.Collection<Vala.Enum> venums ) {
+ foreach ( Vala.Enum venum in venums ) {
+ this.add_enum ( venum );
+ }
+ }
+
+ public void add_enum ( Vala.Enum venum ) {
+ Enum tmp = new Enum ( this.settings, venum, this, this.head );
+ this.enums.add( tmp );
+ }
+
+ protected void parse_enum_comments ( Valadoc.Parser docparser ) {
+ foreach ( Enum en in this.enums ) {
+ en.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/enumvalue.vala b/src/libvaladoc/apitree/enumvalue.vala
new file mode 100644
index 000000000..ceac5e368
--- /dev/null
+++ b/src/libvaladoc/apitree/enumvalue.vala
@@ -0,0 +1,58 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.EnumValue: DocumentedElement {
+ private Vala.EnumValue venval;
+
+ public EnumValue ( Valadoc.Settings settings, Vala.EnumValue venval, Enum parent, Tree head ) {
+ this.vcomment = venval.comment;
+ this.settings = settings;
+ this.vsymbol = venval;
+ this.venval = venval;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string get_cname () {
+ return this.venval.get_cname ();
+ }
+
+ public bool is_venumvalue ( Vala.EnumValue venval ) {
+ return ( this.venval == venval );
+ }
+
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_enum_value ( this, ptr );
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_enum_value ( this );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/errorcode.vala b/src/libvaladoc/apitree/errorcode.vala
new file mode 100644
index 000000000..ca4f0faa9
--- /dev/null
+++ b/src/libvaladoc/apitree/errorcode.vala
@@ -0,0 +1,58 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.ErrorCode : DocumentedElement {
+ private Vala.ErrorCode verrcode;
+
+ public ErrorCode ( Valadoc.Settings settings, Vala.ErrorCode verrcode, ErrorDomain parent, Tree head ) {
+ this.vcomment = verrcode.comment;
+ this.settings = settings;
+ this.verrcode = verrcode;
+ this.vsymbol = verrcode;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string get_cname () {
+ return this.verrcode.get_cname ();
+ }
+
+ public bool is_verrorcode ( Vala.ErrorCode verrcode ) {
+ return ( this.verrcode == verrcode );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_error_code ( this, ptr );
+ }
+
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_error_code ( this );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/errordomain.vala b/src/libvaladoc/apitree/errordomain.vala
new file mode 100644
index 000000000..b0190e834
--- /dev/null
+++ b/src/libvaladoc/apitree/errordomain.vala
@@ -0,0 +1,171 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.ErrorDomain : DocumentedElement, SymbolAccessibility, Visitable, MethodHandler {
+ private Gee.ArrayList<ErrorCode> errcodes = new Gee.ArrayList<ErrorCode> ();
+ private Vala.ErrorDomain verrdom;
+
+ public ErrorDomain ( Valadoc.Settings settings, Vala.ErrorDomain verrdom, ErrorDomainHandler parent, Tree head ) {
+ this.vcomment = verrdom.comment;
+ this.settings = settings;
+ this.vsymbol = verrdom;
+ this.verrdom = verrdom;
+ this.parent = parent;
+ this.head = head;
+
+ Gee.Collection<Vala.Method> vmethods = this.verrdom.get_methods ();
+ this.methods = new Gee.ArrayList<Method> ();
+ this.add_methods ( vmethods );
+
+ Gee.Collection<Vala.ErrorCode> verrcodes = this.verrdom.get_codes ();
+ this.append_error_code ( verrcodes );
+ }
+
+ public string? get_cname () {
+ return this.verrdom.get_cname();
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ internal bool is_verrordomain ( Vala.ErrorDomain ver ) {
+ return ( this.verrdom == ver );
+ }
+
+ private DocumentedElement? search_error_code ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( ErrorCode errcode in this.errcodes ) {
+ if ( errcode.name == params[pos] )
+ return errcode;
+ }
+ return null;
+ }
+
+ private DocumentedElement? search_error_code_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.ErrorCode == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( ErrorCode errc in this.errcodes ) {
+ if ( errc.is_verrorcode ( (Vala.ErrorCode)velement ) ) {
+ return errc;
+ }
+ }
+ return null;
+ }
+
+ internal override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos];
+
+ if ( velement is Vala.ErrorDomain == false )
+ return null;
+
+ if ( !this.is_verrordomain ( (Vala.ErrorDomain)velement ) )
+ return null;
+
+ if ( params.size == pos+1 )
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if ( velement is Vala.ErrorCode ) {
+ element = this.search_error_code_vala ( params, pos );
+ }
+ else if ( velement is Vala.Method ) {
+ element = this.search_method_vala ( params, pos );
+ }
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ DocumentedElement? element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_error_code ( params, pos );
+ if ( element != null )
+ return element;
+
+ return null;
+ }
+
+ internal void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ this.parse_method_comments ( docparser );
+
+ foreach ( ErrorCode errcode in this.errcodes ) {
+ errcode.parse_comment ( docparser );
+ }
+ }
+
+ public void visit_error_codes ( Doclet doclet ) {
+ foreach ( ErrorCode errcode in this.errcodes )
+ errcode.visit ( doclet );
+ }
+
+ public Gee.ReadOnlyCollection<ErrorCode> get_error_code_list ( ) {
+ return new Gee.ReadOnlyCollection<ErrorCode> ( this.errcodes );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_error_domain ( this );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_error_domain ( this, ptr );
+ }
+
+ private inline void append_error_code ( Gee.Collection<Vala.ErrorCode> verrcodes ) {
+ foreach ( Vala.ErrorCode verrcode in verrcodes ) {
+ var tmp = new ErrorCode ( this.settings, verrcode, this, this.head );
+ this.errcodes.add ( tmp );
+ }
+ }
+
+ internal void set_type_references ( ) {
+ this.set_method_type_references ( );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/errordomainhandler.vala b/src/libvaladoc/apitree/errordomainhandler.vala
new file mode 100644
index 000000000..32d603fb6
--- /dev/null
+++ b/src/libvaladoc/apitree/errordomainhandler.vala
@@ -0,0 +1,99 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ErrorDomainHandler : Basic {
+ protected abstract Gee.ArrayList<ErrorDomain> errdoms {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_error_domain_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ DocumentedElement? element = errdom.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_error_domain ( string[] params, int pos ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ DocumentedElement? element = errdom.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ public Gee.Collection<ErrorDomain> get_error_domain_list ( ) {
+ var lst = new Gee.ArrayList<ErrorDomain> ();
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ if ( !errdom.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( errdom );
+ }
+
+ return new Gee.ReadOnlyCollection<ErrorDomain>( lst );
+ }
+
+ internal ErrorDomain? find_errordomain ( Vala.ErrorDomain ver ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ if ( errdom.is_verrordomain( ver ) )
+ return errdom;
+ }
+ return null;
+ }
+
+ public void visit_error_domains ( Doclet doclet ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ errdom.visit ( doclet );
+ }
+ }
+
+ public void add_error_domains ( Gee.Collection<Vala.ErrorDomain> verrdoms ) {
+ foreach ( Vala.ErrorDomain verrdom in verrdoms ) {
+ this.add_error_domain ( verrdom );
+ }
+ }
+
+ public void add_error_domain ( Vala.ErrorDomain verrdom ) {
+ var tmp = new ErrorDomain ( this.settings, verrdom, this, this.head );
+ this.errdoms.add ( tmp );
+ }
+
+ protected void set_errordomain_type_referenes ( ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ errdom.set_type_references ( );
+ }
+ }
+
+ protected void parse_errordomain_comments ( Valadoc.Parser docparser ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ errdom.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/exceptionlisthandler.vala b/src/libvaladoc/apitree/exceptionlisthandler.vala
new file mode 100644
index 000000000..be7d27637
--- /dev/null
+++ b/src/libvaladoc/apitree/exceptionlisthandler.vala
@@ -0,0 +1,49 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+// rename to ExceptionListHandler
+public interface Valadoc.ExceptionHandler : Basic {
+ protected abstract Gee.ArrayList<DocumentedElement> err_domains {
+ protected set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<DocumentedElement> get_error_domains ( ) {
+ return new Gee.ReadOnlyCollection<DocumentedElement> ( this.err_domains );
+ }
+
+ public void add_exception_list ( Gee.Collection<Vala.DataType> vexceptions ) {
+ foreach ( Vala.DataType vtype in vexceptions ) {
+ if ( ((Vala.ErrorType)vtype).error_domain == null ) {
+ this.err_domains.add ( glib_error );
+ }
+ else {
+ ErrorDomain type = (ErrorDomain)this.head.search_vala_symbol ( ((Vala.ErrorType)vtype).error_domain );
+ this.err_domains.add ( type );
+ }
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/field.vala b/src/libvaladoc/apitree/field.vala
new file mode 100644
index 000000000..36b72a511
--- /dev/null
+++ b/src/libvaladoc/apitree/field.vala
@@ -0,0 +1,88 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Field : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable {
+ private Vala.Field vfield;
+
+ public Field ( Valadoc.Settings settings, Vala.Field vfield, FieldHandler parent, Tree head ) {
+ this.vcomment = vfield.comment;
+ this.settings = settings;
+ this.vsymbol = vfield;
+ this.vfield = vfield;
+ this.parent = parent;
+ this.head = head;
+
+ var vret = this.vfield.field_type;
+ this.set_ret_type ( vret );
+ }
+
+ internal bool is_vfield ( Vala.Field vfield ) {
+ return ( this.vfield == vfield );
+ }
+
+ public string? get_cname () {
+ return this.vfield.get_cname();
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public bool is_static {
+ get {
+ if ( this.parent is Namespace )
+ return false;
+
+ return this.vfield.binding == MemberBinding.STATIC;
+ }
+ }
+
+ public bool is_volatile {
+ get {
+ return this.vfield.is_volatile;
+ }
+ }
+
+ internal void set_type_references ( ) {
+ ((ReturnTypeHandler)this).set_return_type_references ( );
+ }
+
+ internal void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ }
+
+ public void visit ( Doclet doclet, FieldHandler? parent ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_field ( this, parent );
+ }
+
+ public void write ( Langlet langlet, void* ptr, FieldHandler parent ) {
+ langlet.write_field ( this, parent, ptr );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/fieldhandler.vala b/src/libvaladoc/apitree/fieldhandler.vala
new file mode 100644
index 000000000..e429336ff
--- /dev/null
+++ b/src/libvaladoc/apitree/fieldhandler.vala
@@ -0,0 +1,105 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.FieldHandler : Basic {
+ protected abstract Gee.ArrayList<Field> fields {
+ protected set;
+ get;
+ }
+
+ protected DocumentedElement? search_field_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Field == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Field f in this.fields ) {
+ if ( f.is_vfield ( (Vala.Field)velement ) ) {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ internal DocumentedElement? search_field ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Field f in this.fields ) {
+ if ( f.name == params[pos] )
+ return f;
+ }
+ return null;
+ }
+
+ public Gee.ReadOnlyCollection<Field> get_field_list ( ) {
+ var lstd = new Gee.ArrayList<Field> ();
+ foreach ( Field f in this.fields ) {
+ if ( !f.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lstd.add ( f );
+ }
+
+ return new Gee.ReadOnlyCollection<Field>( lstd );
+ }
+
+ internal void add_fields ( Gee.Collection<Vala.Field> vfields ) {
+ foreach ( Vala.Field vf in vfields ) {
+ this.add_field ( vf );
+ }
+ }
+
+ internal void add_field ( Vala.Field vf ) {
+ //if ( vf.generated == true )
+ // return ;
+
+ var tmp = new Field ( this.settings, vf, this, this.head );
+ this.fields.add ( tmp );
+ }
+
+ internal void set_field_type_references ( ) {
+ foreach ( Field field in this.fields ) {
+ field.set_type_references ( );
+ }
+ }
+
+ internal void parse_field_comments ( Valadoc.Parser docparser ) {
+ foreach ( Field field in this.fields ) {
+ field.parse_comment ( docparser );
+ }
+ }
+
+ public void visit_fields ( Doclet doclet ) {
+ foreach ( Field field in this.get_field_list() ) {
+ field.visit ( doclet, this );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/formalparameter.vala b/src/libvaladoc/apitree/formalparameter.vala
new file mode 100644
index 000000000..948c0af1b
--- /dev/null
+++ b/src/libvaladoc/apitree/formalparameter.vala
@@ -0,0 +1,86 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.FormalParameter : Basic, ReturnTypeHandler {
+ private Vala.FormalParameter vformalparam;
+
+ public FormalParameter ( Valadoc.Settings settings, Vala.FormalParameter vformalparam, Basic parent, Tree head ) {
+ this.settings = settings;
+ this.vformalparam = vformalparam;
+ this.vsymbol = vformalparam;
+ this.parent = parent;
+ this.head = head;
+
+ var vformparam = this.vformalparam.parameter_type;
+ this.set_ret_type ( vformparam );
+ }
+
+ public bool is_out {
+ get {
+ return this.vformalparam.direction == ParameterDirection.OUT;
+ }
+ }
+
+ public bool is_ref {
+ get {
+ return this.vformalparam.direction == ParameterDirection.REF;
+ }
+ }
+
+ public bool has_default_value {
+ get {
+ return this.vformalparam.default_expression != null;
+ }
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public bool ellipsis {
+ get {
+ return this.vformalparam.ellipsis;
+ }
+ }
+
+ public string? name {
+ owned get {
+ return ( this.vformalparam.name == null )? "" : this.vformalparam.name;
+ }
+ }
+
+ internal void set_type_references ( ) {
+ if ( this.vformalparam.ellipsis )
+ return ;
+
+ ((ReturnTypeHandler)this).set_return_type_references ( );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_formal_parameter ( this, ptr );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/interface.vala b/src/libvaladoc/apitree/interface.vala
new file mode 100644
index 000000000..0bab14076
--- /dev/null
+++ b/src/libvaladoc/apitree/interface.vala
@@ -0,0 +1,277 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Interface : DocumentedElement, SymbolAccessibility, Visitable, SignalHandler, PropertyHandler, FieldHandler, TemplateParameterListHandler, MethodHandler, DelegateHandler, EnumHandler, StructHandler, ClassHandler {
+ public Interface (Valadoc.Settings settings, Vala.Interface vinterface, InterfaceHandler parent, Tree head) {
+ this.vcomment = vinterface.comment;
+ this.settings = settings;
+ this.vinterface = vinterface;
+ this.vsymbol = vinterface;
+ this.parent = parent;
+ this.head = head;
+
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.methods = new Gee.ArrayList<Method> ();
+
+ var vtparams = this.vinterface.get_type_parameters ();
+ this.set_template_parameter_list (vtparams);
+
+ Gee.Collection<Vala.Method> methods = this.vinterface.get_methods ();
+ this.methods = new Gee.ArrayList<Method>();
+ this.add_methods (methods);
+
+ Gee.Collection<Vala.Delegate> delegates = this.vinterface.get_delegates ();
+ this.delegates = new Gee.ArrayList<Delegate>();
+ this.add_delegates (delegates);
+
+ Gee.Collection<Vala.Signal> signals = this.vinterface.get_signals();
+ this.signals = new Gee.ArrayList<Signal>();
+ this.add_signals (signals);
+
+ Gee.Collection<Vala.Property> properties = this.vinterface.get_properties();
+ this.properties = new Gee.ArrayList<Property>();
+ this.add_properties (properties);
+
+ Gee.Collection<Vala.Field> fields = this.vinterface.get_fields();
+ this.fields = new Gee.ArrayList<Field>();
+ this.add_fields (fields);
+
+ Gee.Collection<Vala.Struct> structs = this.vinterface.get_structs();
+ this.structs = new Gee.ArrayList<Struct>();
+ this.add_structs (structs);
+
+ Gee.Collection<Vala.Class> classes = this.vinterface.get_classes();
+ this.classes = new Gee.ArrayList<Class>();
+ this.add_classes (classes);
+
+ Gee.Collection<Vala.Enum> enums = this.vinterface.get_enums();
+ this.enums = new Gee.ArrayList<Enum>();
+ this.add_enums (enums);
+ }
+
+ private Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface>();
+
+ public Gee.Collection<Interface> get_implemented_interface_list ( ) {
+ return this.interfaces;
+ }
+
+ public string? get_cname () {
+ return this.vinterface.get_cname();
+ }
+
+ protected Class? base_type {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Property> properties {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Signal> signals {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Enum> enums {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Delegate> delegates {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Struct> structs {
+ get;
+ set;
+ }
+
+ protected Gee.ArrayList<Class> classes {
+ get;
+ set;
+ }
+
+ private Vala.Interface vinterface;
+
+ internal override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos];
+
+ if ( velement is Vala.Interface == false )
+ return null;
+
+ if ( this.is_vinterface ( (Vala.Interface)velement ) == false )
+ return null;
+
+ if ( params.size == pos+1 )
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if ( velement is Vala.Field ) {
+ element = this.search_field_vala ( params, pos );
+ }
+ else if ( velement is Vala.Method ) {
+ element = this.search_method_vala ( params, pos );
+ }
+ else if ( velement is Vala.Signal ) {
+ element = this.search_signal_vala ( params, pos );
+ }
+ else if ( velement is Vala.Property ) {
+ element = this.search_property_vala ( params, pos );
+ }
+ else if ( velement is Vala.Delegate ) {
+ element = this.search_delegate_vala ( params, pos );
+ }
+ else if ( velement is Vala.Struct ) {
+ element = this.search_struct_vala ( params, pos );
+ }
+ else if ( velement is Vala.Enum ) {
+ element = this.search_enum_vala ( params, pos );
+ }
+ else if ( velement is Vala.Class ) {
+ element = this.search_class_vala ( params, pos );
+ }
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ DocumentedElement? element = this.search_field ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_signal ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_property ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_delegate ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_struct ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_enum ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_class ( params, pos );
+ if ( element != null )
+ return element;
+
+ return null;
+ }
+
+ internal bool is_vinterface ( Vala.Interface viface ) {
+ return ( this.vinterface == viface );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_interface ( this );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_interface ( this, ptr );
+ }
+
+ internal void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser );
+ this.parse_delegate_comments ( docparser );
+ this.parse_property_comments ( docparser );
+ this.parse_signal_comments ( docparser );
+ this.parse_method_comments ( docparser );
+ this.parse_struct_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ this.parse_class_comments ( docparser );
+ this.parse_enum_comments ( docparser );
+ }
+
+ private void set_prerequisites ( Gee.Collection<Vala.DataType> lst ) {
+ if ( ((Gee.Collection)this.interfaces).size != 0 )
+ return ;
+
+ foreach ( Vala.DataType vtyperef in lst ) {
+ Basic? element = this.head.search_vala_symbol ( vtyperef.data_type );
+ if ( element is Class )
+ this.base_type = (Class)element;
+ else
+ this.interfaces.add ( (Interface)element );
+ }
+ }
+
+ internal void set_type_references ( ) {
+ this.set_template_parameter_list_references ( );
+ this.set_delegate_type_references ();
+ this.set_property_type_references ();
+ this.set_signal_type_references ();
+ this.set_method_type_references ();
+ this.set_struct_type_references ();
+ this.set_field_type_references ();
+ this.set_enum_type_references ();
+ this.set_class_type_references ();
+
+ var lst = this.vinterface.get_prerequisites ( );
+ this.set_prerequisites ( lst );
+ }
+}
+
+
diff --git a/src/libvaladoc/apitree/interfacehandler.vala b/src/libvaladoc/apitree/interfacehandler.vala
new file mode 100644
index 000000000..35f3f9375
--- /dev/null
+++ b/src/libvaladoc/apitree/interfacehandler.vala
@@ -0,0 +1,91 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.InterfaceHandler : Basic {
+ protected abstract Gee.ArrayList<Interface> interfaces {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_interface_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Interface iface in this.interfaces ) {
+ DocumentedElement? element = iface.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_interface ( string[] params, int pos ) {
+ foreach ( Interface iface in this.interfaces ) {
+ DocumentedElement? element = iface.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ public Gee.Collection<Interface> get_interface_list ( ) {
+ var lst = new Gee.ArrayList<Interface> ();
+ foreach ( Interface iface in this.interfaces ) {
+ if ( !iface.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( iface );
+ }
+
+ return new Gee.ReadOnlyCollection<Interface>( lst );
+ }
+
+ public void visit_interfaces ( Doclet doclet ) {
+ foreach ( Interface iface in this.interfaces ) {
+ iface.visit( doclet );
+ }
+ }
+
+ protected void add_interfaces ( Gee.Collection<Vala.Interface> vifaces ) {
+ foreach ( Vala.Interface viface in vifaces ) {
+ this.add_interface ( viface );
+ }
+ }
+
+ internal void add_interface ( Vala.Interface viface ) {
+ var tmp = new Interface ( this.settings, viface, this, this.head );
+ this.interfaces.add ( tmp );
+ }
+
+ protected void set_interface_type_references ( ) {
+ foreach ( Interface iface in this.interfaces ) {
+ iface.set_type_references ( );
+ }
+ }
+
+ protected void parse_interface_comments ( Valadoc.Parser docparser ) {
+ foreach ( Interface iface in this.interfaces ) {
+ iface.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/method.vala b/src/libvaladoc/apitree/method.vala
new file mode 100644
index 000000000..4fd47668a
--- /dev/null
+++ b/src/libvaladoc/apitree/method.vala
@@ -0,0 +1,196 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Method : DocumentedElement, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler, SymbolAccessibility, ReturnTypeHandler, Visitable {
+ private Vala.Method vmethod;
+
+ public Method (Valadoc.Settings settings, Vala.Method vmethod, MethodHandler parent, Tree head) {
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+ this.err_domains = new Gee.ArrayList<DocumentedElement> ();
+
+ this.vcomment = vmethod.comment;
+ this.settings = settings;
+ this.vsymbol = vmethod;
+ this.vmethod = vmethod;
+ this.parent = parent;
+ this.head = head;
+
+ var vret = this.vmethod.return_type;
+ this.set_ret_type (vret);
+
+ var vparamlst = this.vmethod.get_parameters ();
+ this.add_parameter_list (vparamlst);
+
+ var vtparams = this.vmethod.get_type_parameters ();
+ this.set_template_parameter_list (vtparams);
+ }
+
+ internal bool is_vmethod (Vala.Method vm) {
+ return (this.vmethod == vm);
+ }
+
+ public string? get_cname () {
+ return this.vmethod.get_cname ();
+ }
+
+ public Method? base_method {
+ private set;
+ get;
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public Gee.ArrayList<TypeParameter> template_param_lst {
+ protected set;
+ get;
+ }
+
+ public Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ public Gee.ArrayList<DocumentedElement> err_domains {
+ protected set;
+ get;
+ }
+
+ internal bool equals (Method m) {
+ return (m.vmethod == this.vmethod);
+ }
+
+ internal void parse_comment (Valadoc.Parser docparser) {
+ if (this.documentation != null)
+ return ;
+
+ if (this.vcomment == null)
+ return ;
+
+ if (this.base_method != null && docparser.is_inherit_doc (this)) {
+ this.base_method.parse_comment (docparser);
+ this.documentation = this.base_method.documentation;
+ return ;
+ }
+
+ this.parse_comment_helper (docparser);
+ }
+
+ public bool is_yields {
+ get {
+ return this.vmethod.coroutine;
+ }
+ }
+
+ public bool is_abstract {
+ get {
+ return this.vmethod.is_abstract;
+ }
+ }
+
+ public bool is_virtual {
+ get {
+ return this.vmethod.is_virtual;
+ }
+ }
+
+ public bool is_override {
+ get {
+ return this.vmethod.overrides;
+ }
+ }
+
+ public bool is_static {
+ get {
+ if (this.parent is Namespace || this.is_constructor)
+ return false;
+
+ return this.vmethod.binding == MemberBinding.STATIC;
+ }
+ }
+
+ public bool is_constructor {
+ get {
+ return ( this.vmethod is Vala.CreationMethod );
+ }
+ }
+
+ public bool is_inline {
+ get {
+ return this.vmethod.is_inline;
+ }
+ }
+
+ public override string? name {
+ owned get {
+ if (this.is_constructor) {
+ if (this.vmethod.name == ".new")
+ return ((DocumentedElement)this.parent).name;
+ else
+ return ((DocumentedElement)this.parent).name + "." + this.vmethod.name;
+ }
+ else {
+ return this.vmethod.name;
+ }
+ }
+ }
+
+ internal void set_type_references ( ) {
+ Vala.Method? vm = null;
+ if (vmethod.base_method != null) {
+ vm = vmethod.base_method;
+ } else if (vmethod.base_interface_method != null) {
+ vm = vmethod.base_interface_method;
+ }
+ if (vm == vmethod && vmethod.base_interface_method != null) {
+ vm = vmethod.base_interface_method;
+ }
+ if (vm != null) {
+ this.base_method = (Method?) this.head.search_vala_symbol (vm);
+ }
+
+ this.set_return_type_references ();
+ this.set_parameter_list_type_references ();
+ this.set_template_parameter_list_references ();
+
+ var vexceptionlst = this.vmethod.get_error_types ();
+ this.add_exception_list ( vexceptionlst );
+ }
+
+ public void visit ( Doclet doclet, Valadoc.MethodHandler in_type ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_method ( this, in_type );
+ }
+
+ public void write ( Langlet langlet, void* ptr, Valadoc.MethodHandler parent ) {
+ langlet.write_method ( ptr, this, parent );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/methodhandler.vala b/src/libvaladoc/apitree/methodhandler.vala
new file mode 100644
index 000000000..a882a402e
--- /dev/null
+++ b/src/libvaladoc/apitree/methodhandler.vala
@@ -0,0 +1,103 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.MethodHandler : Basic {
+ protected abstract Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_method_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Method == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Method m in this.methods ) {
+ if ( m.is_vmethod ( (Vala.Method)velement ) ) {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ internal DocumentedElement? search_method ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Method m in this.methods ) {
+ if ( m.name == params[pos] )
+ return m;
+ }
+ return null;
+ }
+
+ internal void set_method_type_references ( ) {
+ foreach ( Method m in this.methods ) {
+ m.set_type_references ( );
+ }
+ }
+
+ internal void parse_method_comments ( Valadoc.Parser docparser ) {
+ foreach ( Method m in this.methods ) {
+ m.parse_comment ( docparser );
+ }
+ }
+
+ protected void add_method ( Vala.Method vmethod ) {
+ var tmp = new Method ( this.settings, vmethod, this, this.head );
+ this.methods.add ( tmp );
+ }
+
+ protected void add_methods ( Gee.Collection<Vala.Method> vmethods ) {
+ foreach ( Vala.Method vm in vmethods ) {
+ this.add_method ( vm );
+ }
+ }
+
+ public void visit_methods ( Doclet doclet ) {
+ foreach ( Method m in this.get_method_list() ) {
+ m.visit ( doclet, this );
+ }
+ }
+
+ public Gee.ReadOnlyCollection<Method> get_method_list ( ) {
+ var lst = new Gee.ArrayList<Method> ();
+ foreach ( Method m in this.methods ) {
+ if ( !m.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( m );
+ }
+
+ return new Gee.ReadOnlyCollection<Method>( lst );
+ }
+}
+
+
diff --git a/src/libvaladoc/apitree/namespace.vala b/src/libvaladoc/apitree/namespace.vala
new file mode 100644
index 000000000..904b64f06
--- /dev/null
+++ b/src/libvaladoc/apitree/namespace.vala
@@ -0,0 +1,274 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Namespace : DocumentedElement, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomainHandler,
+ EnumHandler, ClassHandler, StructHandler, InterfaceHandler,
+ DelegateHandler, ConstantHandler
+{
+ protected Gee.ArrayList<Constant> constants {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<Enum> enums {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Interface> interfaces {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Delegate> delegates {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<ErrorDomain> errdoms {
+ private set;
+ get;
+ }
+
+ public Gee.ArrayList<Namespace> namespaces {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Class> classes {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Struct> structs {
+ private set;
+ get;
+ }
+
+ internal DocumentedElement? search_namespace (string[] params, int pos) {
+ foreach (Namespace ns in this.namespaces) {
+ DocumentedElement? element = ns.search_element (params, pos+1);
+ if (element != null)
+ return element;
+ }
+ return null;
+ }
+
+ internal DocumentedElement? search_namespace_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
+ foreach (Namespace ns in this.namespaces) {
+ DocumentedElement? element = ns.search_element_vala (params, pos+1);
+ if (element != null)
+ return element;
+ }
+ return null;
+ }
+
+ internal override DocumentedElement? search_element_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
+ Vala.Symbol velement = params[pos];
+
+ if (velement is Vala.Namespace == false)
+ return null;
+
+ if (this.is_vnspace ((Vala.Namespace)velement) == false)
+ return null;
+
+ if (params.size == pos+1)
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if (velement is Vala.Namespace) {
+ element = this.search_namespace_vala (params, pos);
+ }
+ else if (velement is Vala.Class) {
+ element = this.search_class_vala (params, pos);
+ }
+ else if (velement is Vala.Interface) {
+ element = this.search_interface_vala (params, pos);
+ }
+ else if (velement is Vala.Struct) {
+ element = this.search_struct_vala (params, pos);
+ }
+ else if (velement is Vala.Enum) {
+ element = this.search_enum_vala (params, pos);
+ }
+ else if (velement is Vala.ErrorDomain) {
+ element = this.search_error_domain_vala (params, pos);
+ }
+ else if (velement is Vala.Method) {
+ element = this.search_method_vala (params, pos);
+ }
+ else if (velement is Vala.Field) {
+ element = this.search_field_vala (params, pos);
+ }
+ else if (velement is Vala.DelegateType || velement is Vala.Delegate) {
+ element = this.search_delegate_vala (params, pos);
+ }
+ else if (velement is Vala.Constant) {
+ element = this.search_constant_vala (params, pos);
+ }
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ DocumentedElement? element = this.search_namespace ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_class ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_interface ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_struct ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_enum ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_error_domain ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_field ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_delegate ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = search_constant ( params, pos );
+ if ( element != null )
+ return element;
+
+ return null;
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ public Namespace ( Valadoc.Settings settings, Vala.Namespace vnspace, NamespaceHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vsymbol = vnspace;
+ this.vnspace = vnspace;
+ this.parent = parent;
+ this.head = head;
+
+ this.namespaces = new Gee.ArrayList<Namespace> ();
+ this.structs = new Gee.ArrayList<Struct>();
+ this.classes = new Gee.ArrayList<Class>();
+
+ this.constants = new Gee.ArrayList<Constant> ();
+ this.interfaces = new Gee.ArrayList<Interface>();
+ this.methods = new Gee.ArrayList<Method> ();
+ this.delegates = new Gee.ArrayList<Delegate>();
+ this.errdoms = new Gee.ArrayList<ErrorDomain>();
+ this.enums = new Gee.ArrayList<Enum>();
+ this.fields = new Gee.ArrayList<Field> ();
+
+ if (vnspace.source_reference != null) {
+ var vfile = vnspace.source_reference.file;
+ foreach (Comment c in vnspace.get_comments()) {
+ if (this.package.is_vpackage (c.source_reference.file)) {
+ this.vcomment = c;
+ break;
+ }
+ }
+ }
+ }
+
+ public void visit (Doclet doclet) {
+ doclet.visit_namespace (this);
+ }
+
+ public Vala.Namespace vnspace {
+ private get;
+ set;
+ }
+
+ internal void set_type_references ( ) {
+ this.set_errordomain_type_referenes ();
+ this.set_namespace_type_references ();
+ this.set_interface_type_references ();
+ this.set_delegate_type_references ();
+ this.set_constant_type_references ();
+ this.set_method_type_references ();
+ this.set_field_type_references ();
+ this.set_struct_type_references ();
+ this.set_class_type_references ();
+ this.set_enum_type_references ();
+ }
+
+ internal void parse_comments (Valadoc.Parser docparser) {
+ this.parse_comment_helper (docparser);
+ this.parse_enum_comments (docparser);
+ this.parse_field_comments (docparser);
+ this.parse_class_comments (docparser);
+ this.parse_method_comments (docparser);
+ this.parse_struct_comments (docparser);
+ this.parse_constant_comments (docparser);
+ this.parse_delegate_comments (docparser);
+ this.parse_interface_comments (docparser);
+ this.parse_namespace_comments (docparser);
+ this.parse_errordomain_comments (docparser);
+ }
+
+ internal bool is_vnspace ( Vala.Namespace vns ) {
+ return (this.vnspace == vns);
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_namespace (this, ptr);
+ }
+}
+
+
+
diff --git a/src/libvaladoc/apitree/namespacehandler.vala b/src/libvaladoc/apitree/namespacehandler.vala
new file mode 100644
index 000000000..1f0abc48a
--- /dev/null
+++ b/src/libvaladoc/apitree/namespacehandler.vala
@@ -0,0 +1,139 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.NamespaceHandler : Basic {
+ public abstract Gee.ArrayList<Namespace> namespaces {
+ set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<Namespace> get_namespace_list () {
+ return new Gee.ReadOnlyCollection<Namespace> ( this.namespaces );
+ }
+
+ public void visit_namespaces ( Doclet doclet ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ ns.visit ( doclet );
+ }
+ }
+
+ private Gee.ArrayList<Vala.Namespace> create_parent_vnamespace_list ( Vala.Symbol vsymbol ) {
+ var lst = new Gee.ArrayList<Vala.Namespace> ();
+
+ while ( vsymbol != null ) {
+ if ( vsymbol is Vala.Namespace ) {
+ lst.insert ( 0, (Vala.Namespace)vsymbol );
+ }
+ vsymbol = vsymbol.parent_symbol;
+ }
+ return lst;
+ }
+
+ internal Namespace get_namespace_helper ( Vala.Symbol node, Gee.List<Vala.Namespace> vnspaces, int pos ) {
+ Vala.Namespace vns = vnspaces.get( pos );
+
+ Namespace ns = this.find_namespace_without_childs ( vns );
+ if ( ns == null ) {
+ ns = new Namespace( this.settings, vns, this, this.head );
+ this.namespaces.add ( ns );
+ }
+
+ if ( vnspaces.size == pos+1 ) {
+ return ns;
+ }
+
+ return ns.get_namespace_helper ( node, vnspaces, pos+1 );
+ }
+
+ protected Namespace get_namespace ( Vala.Symbol node ) {
+ Vala.Symbol vnd = ((Vala.Symbol)node).parent_symbol;
+ if ( vnd is Vala.Namespace == false )
+ vnd = vnd.parent_symbol;
+
+ Vala.Namespace vnspace = (Vala.Namespace)vnd;
+ var nspace = this.find_namespace ( vnspace );
+ if ( nspace != null )
+ return nspace;
+
+ var vnspaces = this.create_parent_vnamespace_list ( node );
+
+ if ( vnspaces.size > 2 ) {
+ return this.get_namespace_helper ( node, vnspaces, 1 );
+ }
+ else {
+ var ns = new Namespace( this.settings, vnspace, this, this.head );
+ this.namespaces.add( ns );
+ return ns;
+ }
+ }
+
+ internal Namespace? find_vnamespace_helper ( Gee.List<Vala.Namespace> vnspaces, int pos ) {
+ Vala.Namespace? vns = vnspaces.get ( pos );
+ if ( vns == null )
+ return null;
+
+ foreach ( Namespace ns in this.namespaces ) {
+ if ( !ns.is_vnspace( vns ) )
+ continue ;
+
+ if ( pos+1 == vnspaces.size )
+ return ns;
+
+ return ns.find_vnamespace_helper ( vnspaces, pos+1 );
+ }
+
+ return null;
+ }
+
+ internal Namespace find_namespace_without_childs ( Vala.Namespace vns ) {
+ Namespace ns2 = null;
+
+ foreach ( Namespace ns in this.namespaces ) {
+ if ( ns.is_vnspace(vns) )
+ ns2 = ns;
+ }
+
+ return ns2;
+ }
+
+ internal Namespace find_namespace ( Vala.Namespace vns ) {
+ var vnspaces = this.create_parent_vnamespace_list ( vns );
+
+ return this.find_vnamespace_helper ( vnspaces, vnspaces.index_of( vns ) );
+ }
+
+ internal void set_namespace_type_references ( ) {
+ foreach ( Namespace ns in this.namespaces ){
+ ns.set_type_references ();
+ }
+ }
+
+ internal void parse_namespace_comments ( Valadoc.Parser docparser ) {
+ foreach ( Namespace ns in this.namespaces ){
+ ns.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/package.vala b/src/libvaladoc/apitree/package.vala
new file mode 100644
index 000000000..02e6b32e0
--- /dev/null
+++ b/src/libvaladoc/apitree/package.vala
@@ -0,0 +1,164 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+
+public class Valadoc.Package : DocumentedElement, NamespaceHandler {
+ private Gee.ArrayList<Vala.SourceFile> vfiles = new Gee.ArrayList<Vala.SourceFile> ();
+
+ internal void add_file (Vala.SourceFile vfile) {
+ this.vfiles.add (vfile);
+ }
+
+ public Gee.ArrayList<Namespace> namespaces {
+ default = new Gee.ArrayList<Namespace>();
+ private set;
+ private get;
+ }
+
+ public bool is_package {
+ private set;
+ get;
+ }
+
+ internal void set_dependency_list ( Gee.ArrayList<Package> list ) {
+ this._dependencies = list;
+ }
+
+ private Gee.ArrayList<Package> _dependencies;
+
+ public Gee.ReadOnlyCollection<Package> get_full_dependency_list () {
+ Gee.ArrayList<Package> list = new Gee.ArrayList<Package> ();
+
+ if ( this._dependencies == null )
+ return new Gee.ReadOnlyCollection<Package> ( 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 new Gee.ReadOnlyCollection<Package> ( list );
+ }
+
+ public Gee.ReadOnlyCollection<Package> get_dependency_list () {
+ if ( this._dependencies == null ) {
+ return new Gee.ReadOnlyCollection<Package> ( new Gee.ArrayList<Package> () );
+ }
+
+ return new Gee.ReadOnlyCollection<Package> ( this._dependencies );
+ }
+
+ private static string extract_package_name ( Settings settings, Vala.SourceFile vfile ) {
+ if ( vfile.filename.has_suffix (".vapi") ) {
+ string file_name = GLib.Path.get_basename (vfile.filename);
+ return file_name.ndup ( file_name.size() - ".vapi".size() );
+ }
+ else if ( vfile.filename.has_suffix (".gidl") ) {
+ string file_name = GLib.Path.get_basename (vfile.filename);
+ return file_name.ndup ( file_name.size() - ".gidl".size() );
+ }
+ else {
+ return settings.pkg_name;
+ }
+ }
+
+ public Package.with_name (Valadoc.Settings settings, Vala.SourceFile vfile, string name, Tree head, bool is_package = false) {
+ this.is_package = is_package;
+ this.settings = settings;
+ this.head = head;
+
+ this.package_name = name;
+
+ this.vfiles.add (vfile);
+ this.parent = null;
+ }
+
+ public Package (Valadoc.Settings settings, Vala.SourceFile vfile, Tree head, bool is_package = false) {
+ this.with_name (settings, vfile, this.extract_package_name (settings, vfile), head, is_package);
+ }
+
+ private string package_name;
+
+ public override string? name {
+ owned get {
+ return package_name;
+ }
+ }
+
+ internal override DocumentedElement? search_element (string[] params, int pos) {
+ foreach (Namespace ns in this.namespaces) {
+ DocumentedElement? element = ns.search_element ( params, pos );
+ if (element != null) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ internal override DocumentedElement? search_element_vala (Gee.ArrayList<Vala.Symbol> params, int pos) {
+ foreach (Namespace ns in this.namespaces) {
+ DocumentedElement? element = ns.search_element_vala (params, pos);
+ if (element != null) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ internal bool is_vpackage (Vala.SourceFile vfile) {
+ return this.vfiles.contains (vfile);
+ }
+
+ public bool is_visitor_accessible () {
+ return !( this.is_package && this.settings.with_deps == false );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible () ) {
+ return ;
+ }
+ doclet.visit_package ( this );
+ }
+
+ internal void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_namespace_comments ( docparser );
+ }
+
+ internal void set_type_references ( ) {
+ this.set_namespace_type_references ( );
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_file (this, ptr);
+ }
+}
+
diff --git a/src/libvaladoc/apitree/parameterlisthandler.vala b/src/libvaladoc/apitree/parameterlisthandler.vala
new file mode 100644
index 000000000..5d1dbddaa
--- /dev/null
+++ b/src/libvaladoc/apitree/parameterlisthandler.vala
@@ -0,0 +1,49 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ParameterListHandler : Basic {
+ protected abstract Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<FormalParameter> get_parameter_list ( ) {
+ return new Gee.ReadOnlyCollection<FormalParameter> ( this.param_list );
+ }
+
+ protected void add_parameter_list ( Gee.Collection<Vala.FormalParameter> vparams ) {
+ foreach ( Vala.FormalParameter vfparam in vparams ) {
+ var tmp = new FormalParameter ( this.settings, vfparam, this, this.head );
+ this.param_list.add ( tmp );
+ }
+ }
+
+ internal void set_parameter_list_type_references ( ) {
+ foreach ( FormalParameter fparam in this.param_list ) {
+ fparam.set_type_references ( );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/pointer.vala b/src/libvaladoc/apitree/pointer.vala
new file mode 100644
index 000000000..55d285bfe
--- /dev/null
+++ b/src/libvaladoc/apitree/pointer.vala
@@ -0,0 +1,66 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+
+public class Valadoc.Pointer : Basic {
+ private Vala.PointerType vtype;
+
+ public Basic data_type {
+ private set;
+ get;
+ }
+
+ public Pointer (Valadoc.Settings settings, Vala.PointerType vtyperef, Basic parent, Tree head) {
+ this.settings = settings;
+ this.vtype = vtyperef;
+ this.parent = parent;
+ this.head = head;
+
+ Vala.DataType vntype = vtype.base_type;
+ if (vntype is Vala.PointerType)
+ this.data_type = new Pointer (settings, (Vala.PointerType)vntype, this, head);
+ else if (vntype is Vala.ArrayType)
+ this.data_type = new Array (settings, (Vala.ArrayType)vntype, this, head);
+ else
+ this.data_type = new TypeReference (settings, vntype, this, head);
+ }
+
+ public void write (Langlet langlet, void* ptr, DocumentedElement parent) {
+ langlet.write_pointer (this, ptr, parent);
+ }
+
+ public void set_type_references () {
+ Basic type = this.data_type;
+ if ( type == null )
+ ;
+ else if ( type is Array )
+ ((Array)type).set_type_references ();
+ else if ( type is Pointer )
+ ((Pointer)type ).set_type_references ();
+ else
+ ((TypeReference)type).set_type_references ();
+ }
+}
+
diff --git a/src/libvaladoc/apitree/property.vala b/src/libvaladoc/apitree/property.vala
new file mode 100644
index 000000000..9861f8644
--- /dev/null
+++ b/src/libvaladoc/apitree/property.vala
@@ -0,0 +1,143 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Property : DocumentedElement, SymbolAccessibility, ReturnTypeHandler, Visitable {
+ private Vala.Property vproperty;
+
+ public Property (Valadoc.Settings settings, Vala.Property vproperty, PropertyHandler parent, Tree head) {
+ this.vcomment = vproperty.comment;
+ this.settings = settings;
+ this.parent = parent;
+ this.head = head;
+
+ this.vsymbol = vproperty;
+ this.vproperty = vproperty;
+
+ var ret = this.vproperty.property_type;
+ this.set_ret_type (ret);
+
+ if (this.vproperty.get_accessor != null) {
+ this.getter = new PropertyAccessor (this.settings, this.vproperty.get_accessor, this, this.head);
+ }
+
+ if (this.vproperty.set_accessor != null) {
+ this.setter = new PropertyAccessor (this.settings, this.vproperty.set_accessor, this, this.head);
+ }
+ }
+
+ public bool is_vproperty (Vala.Property vprop) {
+ return (this.vproperty == vprop);
+ }
+
+ public string? get_cname () {
+ return this.vproperty.nick;
+ }
+
+ public bool equals ( Property p ) {
+ return this.vproperty.equals ( p.vproperty );
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public bool is_virtual {
+ get {
+ return this.vproperty.is_virtual;
+ }
+ }
+
+ public bool is_abstract {
+ get {
+ return this.vproperty.is_abstract;
+ }
+ }
+
+ public bool is_override {
+ get {
+ return this.vproperty.overrides;
+ }
+ }
+
+ public PropertyAccessor setter {
+ private set;
+ get;
+ }
+
+ public PropertyAccessor getter {
+ private set;
+ get;
+ }
+
+ public Property base_property {
+ private set;
+ get;
+ }
+
+ internal void set_type_references ( ) {
+ Vala.Property? vp = null;
+ if (vproperty.base_property != null) {
+ vp = vproperty.base_property;
+ } else if (vproperty.base_interface_property != null) {
+ vp = vproperty.base_interface_property;
+ }
+ if (vp == vproperty && vproperty.base_interface_property != null) {
+ vp = vproperty.base_interface_property;
+ }
+ if (vp != null) {
+ this.base_property = (Property?) this.head.search_vala_symbol (vp);
+ }
+ this.set_return_type_references ( );
+ }
+
+ public void parse_comment (Valadoc.Parser docparser) {
+ if (this.documentation != null)
+ return ;
+
+ if (this.vcomment == null)
+ return ;
+
+ if (this.base_property != null && docparser.is_inherit_doc (this)) {
+ this.base_property.parse_comment (docparser);
+ this.documentation = this.base_property.documentation;
+ return ;
+ }
+
+ this.parse_comment_helper (docparser);
+ }
+
+ public void visit (Doclet doclet) {
+ if (!this.is_visitor_accessible ())
+ return ;
+
+ doclet.visit_property (this);
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_property (this, ptr);
+ }
+}
+
diff --git a/src/libvaladoc/apitree/propertyaccessor.vala b/src/libvaladoc/apitree/propertyaccessor.vala
new file mode 100644
index 000000000..917840700
--- /dev/null
+++ b/src/libvaladoc/apitree/propertyaccessor.vala
@@ -0,0 +1,107 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.PropertyAccessor : Object {
+ private Vala.PropertyAccessor vpropacc;
+
+ public PropertyAccessor ( Valadoc.Settings settings, Vala.PropertyAccessor vpropacc, Property parent, Tree head ) {
+ this.settings = settings;
+ this.vpropacc = vpropacc;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public Tree head {
+ set;
+ get;
+ }
+
+ public Settings settings {
+ set;
+ get;
+ }
+
+ public Property parent {
+ private set;
+ get;
+ }
+
+ public Tree tree {
+ set;
+ get;
+ }
+
+ public bool is_construct {
+ get {
+ return this.vpropacc.construction;
+ }
+ }
+
+ public bool is_protected {
+ get {
+ return this.vpropacc.access == Vala.SymbolAccessibility.PROTECTED;
+ }
+ }
+
+ public bool is_public {
+ get {
+ return this.vpropacc.access == Vala.SymbolAccessibility.PUBLIC;
+ }
+ }
+
+ public bool is_private {
+ get {
+ return this.vpropacc.access == Vala.SymbolAccessibility.PRIVATE;
+ }
+ }
+
+ public bool is_internal {
+ get {
+ return this.vpropacc.access == Vala.SymbolAccessibility.INTERNAL;
+ }
+ }
+
+ public bool is_set {
+ get {
+ return this.vpropacc.writable;
+ }
+ }
+
+ public bool is_get {
+ get {
+ return this.vpropacc.readable;
+ }
+ }
+
+ public bool is_owned {
+ get {
+ return this.vpropacc.value_type.value_owned;
+ }
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_property_accessor (this, ptr);
+ }
+}
diff --git a/src/libvaladoc/apitree/propertyhandler.vala b/src/libvaladoc/apitree/propertyhandler.vala
new file mode 100644
index 000000000..8083fa4cc
--- /dev/null
+++ b/src/libvaladoc/apitree/propertyhandler.vala
@@ -0,0 +1,111 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.PropertyHandler : Basic {
+ protected abstract Gee.ArrayList<Property> properties {
+ get;
+ set;
+ }
+
+ protected DocumentedElement? search_property_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Property == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Property prop in this.properties ) {
+ if ( prop.is_vproperty ( (Vala.Property)velement ) ) {
+ return prop;
+ }
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_property ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Property prop in this.properties ) {
+ if ( prop.name == params[pos] )
+ return prop;
+ }
+ return null;
+ }
+
+ protected bool is_overwritten_property ( Property prop ) {
+ foreach ( Property p in this.properties ) {
+ if ( p.parent != this )
+ continue ;
+
+ if ( !p.is_override )
+ continue ;
+
+ if ( p.equals ( prop ) )
+ return true;
+ }
+ return false;
+ }
+
+ public Gee.ReadOnlyCollection<Property> get_property_list ( ) {
+ var lst = new Gee.ArrayList<Property> ();
+ foreach ( Property p in this.properties ) {
+ if ( !p.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( p );
+ }
+
+ return new Gee.ReadOnlyCollection<Property>( lst );
+ }
+
+ protected void parse_property_comments ( Valadoc.Parser docparser ) {
+ foreach ( Property prop in this.properties ) {
+ prop.parse_comment ( docparser );
+ }
+ }
+
+ public void visit_properties ( Doclet doclet ) {
+ foreach ( Property prop in this.get_property_list () )
+ prop.visit ( doclet );
+ }
+
+ protected void set_property_type_references () {
+ foreach ( Property prop in this.properties ) {
+ prop.set_type_references ( );
+ }
+ }
+
+ protected void add_properties ( Gee.Collection<Vala.Property> vproperties ) {
+ foreach ( Vala.Property vprop in vproperties ) {
+ var tmp = new Property ( this.settings, vprop, this, this.head );
+ this.properties.add ( tmp );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/returntypehandler.vala b/src/libvaladoc/apitree/returntypehandler.vala
new file mode 100644
index 000000000..00dbd3a0d
--- /dev/null
+++ b/src/libvaladoc/apitree/returntypehandler.vala
@@ -0,0 +1,45 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.ReturnTypeHandler : Basic {
+ public abstract TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ internal void set_return_type_references ( ) {
+ if ( this.type_reference == null )
+ return ;
+
+ this.type_reference.set_type_references ( );
+ }
+
+ // rename
+ internal void set_ret_type ( Vala.DataType? vtref ) {
+ var tmp = new TypeReference ( this.settings, vtref, this, this.head );
+ this.type_reference = tmp;
+ }
+}
+
diff --git a/src/libvaladoc/apitree/signal.vala b/src/libvaladoc/apitree/signal.vala
new file mode 100644
index 000000000..67df44692
--- /dev/null
+++ b/src/libvaladoc/apitree/signal.vala
@@ -0,0 +1,89 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Signal : DocumentedElement, ParameterListHandler, SymbolAccessibility, ReturnTypeHandler, Visitable {
+ private Vala.Signal vsignal;
+
+ public Signal (Valadoc.Settings settings, Vala.Signal vsignal, SignalHandler parent, Tree head) {
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+
+ this.vcomment = vsignal.comment;
+ this.settings = settings;
+ this.vsymbol = vsignal;
+ this.vsignal = vsignal;
+ this.parent = parent;
+ this.head = head;
+
+ var vparamlst = this.vsignal.get_parameters ();
+ this.add_parameter_list (vparamlst);
+
+ var ret = this.vsignal.return_type;
+ this.set_ret_type (ret);
+ }
+
+ internal bool is_vsignal (Vala.Signal vsig) {
+ return (this.vsignal == vsig);
+ }
+
+ public string? get_cname () {
+ return this.vsignal.get_cname();
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ internal void set_type_references ( ) {
+ this.set_parameter_list_type_references ( );
+ this.set_return_type_references ( );
+ }
+
+ internal void parse_comment (Valadoc.Parser docparser) {
+ this.parse_comment_helper (docparser);
+ }
+
+ public bool is_virtual {
+ get {
+ return this.vsignal.is_virtual;
+ }
+ }
+
+ public void visit (Doclet doclet) {
+ if ( !this.is_visitor_accessible () )
+ return ;
+
+ doclet.visit_signal (this);
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_signal (this, ptr);
+ }
+}
diff --git a/src/libvaladoc/apitree/signalhandler.vala b/src/libvaladoc/apitree/signalhandler.vala
new file mode 100644
index 000000000..03cc9c02c
--- /dev/null
+++ b/src/libvaladoc/apitree/signalhandler.vala
@@ -0,0 +1,98 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.SignalHandler : Basic {
+ protected abstract Gee.ArrayList<Signal> signals {
+ get;
+ set;
+ }
+
+ protected DocumentedElement? search_signal_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos+1];
+ if ( velement is Vala.Signal == false )
+ return null;
+
+ if ( params.size != pos+2 )
+ return null;
+
+ foreach ( Signal sig in this.signals ) {
+ if ( sig.is_vsignal ( (Vala.Signal)velement ) ) {
+ return sig;
+ }
+ }
+ return null;
+ }
+
+ protected DocumentedElement? search_signal ( string[] params, int pos ) {
+ pos++;
+
+ if ( params[pos+1] != null )
+ return null;
+
+ foreach ( Signal sig in this.signals ) {
+ if ( sig.name == params[pos] )
+ return sig;
+ }
+ return null;
+ }
+
+ internal void add_signals ( Gee.Collection<Vala.Signal> vsignals ) {
+ foreach ( Vala.Signal vsig in vsignals ) {
+ var tmp = new Signal ( this.settings, vsig, this, this.head );
+ this.signals.add ( tmp );
+ }
+ }
+
+ public void visit_signals ( Doclet doclet ) {
+ foreach ( Signal sig in this.get_signal_list ( ) ) {
+ sig.visit ( doclet );
+ }
+ }
+
+ public Gee.ReadOnlyCollection<Signal> get_signal_list () {
+ var lst = new Gee.ArrayList<Signal> ();
+ foreach ( Signal sig in this.signals ) {
+ if ( !sig.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( sig );
+ }
+
+ return new Gee.ReadOnlyCollection<Signal>( lst );
+ }
+
+ internal void set_signal_type_references () {
+ foreach ( Signal sig in this.signals ) {
+ sig.set_type_references ( );
+ }
+ }
+
+ internal void parse_signal_comments ( Valadoc.Parser docparser ) {
+ foreach ( Signal sig in this.signals ) {
+ sig.parse_comment ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/struct.vala b/src/libvaladoc/apitree/struct.vala
new file mode 100644
index 000000000..28e5d6911
--- /dev/null
+++ b/src/libvaladoc/apitree/struct.vala
@@ -0,0 +1,196 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.Struct : DocumentedElement, SymbolAccessibility, Visitable, MethodHandler, ConstructionMethodHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler {
+ private Vala.Struct vstruct;
+
+ public Struct (Valadoc.Settings settings, Vala.Struct vstruct, StructHandler parent, Tree head) {
+ this.vcomment = vstruct.comment;
+ this.settings = settings;
+ this.vstruct = vstruct;
+ this.vsymbol = vstruct;
+ this.parent = parent;
+ this.head = head;
+
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.methods = new Gee.ArrayList<Method> ();
+
+ var vtparams = this.vstruct.get_type_parameters ();
+ this.set_template_parameter_list (vtparams);
+
+ Gee.Collection<Vala.Field> vfields = this.vstruct.get_fields();
+ this.fields = new Gee.ArrayList<Field> ();
+ this.add_fields (vfields);
+
+ Gee.Collection<Vala.Constant> vconstants = this.vstruct.get_constants();
+ this.constants = new Gee.ArrayList<Constant> ();
+ this.add_constants (vconstants);
+
+ Gee.Collection<Vala.Method> vmethods = this.vstruct.get_methods ();
+ this.construction_methods = new Gee.ArrayList<Method>();
+ this.add_methods_and_construction_methods (vmethods);
+ }
+
+ protected Struct? base_type {
+ protected set;
+ get;
+ }
+
+ public string? get_cname () {
+ return this.vstruct.get_cname();
+ }
+
+ protected Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Constant> constants {
+ set;
+ get;
+ }
+
+ internal override DocumentedElement? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ Vala.Symbol velement = params[pos];
+
+ if ( velement is Vala.Struct == false )
+ return null;
+
+ if ( this.is_vstruct ( (Vala.Struct)velement ) == false )
+ return null;
+
+ if ( params.size == pos+1 )
+ return this;
+
+ velement = params[pos+1];
+
+ DocumentedElement? element = null;
+
+ if ( velement is Vala.Field ) {
+ element = this.search_field_vala ( params, pos );
+ }
+ else if ( velement is Vala.CreationMethod ) {
+ element = this.search_construction_method_vala ( params, pos );
+ }
+ else if ( velement is Vala.Method ) {
+ element = this.search_method_vala ( params, pos );
+ }
+ else if ( velement is Vala.Constant ) {
+ element = this.search_constant_vala ( params, pos );
+ }
+
+ return element;
+ }
+
+ internal override DocumentedElement? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ DocumentedElement? element = this.search_field ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_method ( params, pos );
+ if ( element != null )
+ return element;
+
+ element = this.search_constant ( params, pos );
+ if ( element != null )
+ return element;
+
+ return this.search_construction_method ( params, pos );
+ }
+
+ internal bool is_vstruct ( Vala.Struct vstru ) {
+ return ( this.vstruct == vstru );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_struct (this);
+ }
+
+ public void write (Langlet langlet, void* ptr) {
+ langlet.write_struct (this, ptr);
+ }
+
+ internal void parse_comments (Valadoc.Parser docparser) {
+ if (this.documentation != null)
+ return ;
+
+ if (this.vcomment != null) {
+ if ( docparser.is_inherit_doc (this) && this.base_type != null) {
+ ((Valadoc.Struct)this.base_type).parse_comments (docparser);
+ this.documentation = this.base_type.documentation;
+ }
+ else {
+ this.parse_comment_helper (docparser);
+ }
+ }
+
+ this.parse_construction_method_comments (docparser);
+ this.parse_constant_comments (docparser);
+ this.parse_method_comments (docparser);
+ this.parse_field_comments (docparser);
+ }
+
+ private void set_parent_references ( ) {
+ Vala.ValueType? basetype = (Vala.ValueType?)this.vstruct.base_type;
+ if (basetype == null)
+ return ;
+
+ this.base_type = (Struct?)this.head.search_vala_symbol ( (Vala.Struct)basetype.type_symbol );
+ }
+
+ internal void set_type_references ( ) {
+ this.set_template_parameter_list_references ( );
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_method_type_references ( );
+ this.set_field_type_references ( );
+ this.set_parent_references ( );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/structhandler.vala b/src/libvaladoc/apitree/structhandler.vala
new file mode 100644
index 000000000..2124b7361
--- /dev/null
+++ b/src/libvaladoc/apitree/structhandler.vala
@@ -0,0 +1,92 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.StructHandler : Basic {
+ protected abstract Gee.ArrayList<Struct> structs {
+ set;
+ get;
+ }
+
+ protected DocumentedElement? search_struct_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Struct stru in this.structs ) {
+ DocumentedElement? element = stru.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+
+ protected DocumentedElement? search_struct ( string[] params, int pos ) {
+ foreach ( Struct stru in this.structs ) {
+ DocumentedElement? element = stru.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ public Gee.Collection<Struct> get_struct_list ( ) {
+ var lst = new Gee.ArrayList<Struct> ();
+ foreach ( Struct stru in this.structs ) {
+ if ( !stru.is_type_visitor_accessible ( this ) )
+ continue ;
+
+ lst.add ( stru );
+ }
+
+ return new Gee.ReadOnlyCollection<Struct>( lst );
+ }
+
+ public void add_struct ( Vala.Struct vstru ) {
+ Struct stru = new Struct ( this.settings, vstru, this, this.head );
+ this.structs.add( stru );
+ }
+
+ public void add_structs ( Gee.Collection<Vala.Struct> vstructs ) {
+ foreach ( Vala.Struct vstru in vstructs ) {
+ this.add_struct ( vstru );
+ }
+ }
+
+ public void visit_structs ( Doclet doclet ) {
+ foreach ( Struct stru in this.get_struct_list() ) {
+ stru.visit ( doclet );
+ }
+ }
+
+ protected void set_struct_type_references ( ) {
+ foreach ( Struct stru in this.structs ) {
+ stru.set_type_references ( );
+ }
+ }
+
+ protected void parse_struct_comments ( Valadoc.Parser docparser ) {
+ foreach ( Struct stru in this.structs ) {
+ stru.parse_comments ( docparser );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/symbolaccessibility.vala b/src/libvaladoc/apitree/symbolaccessibility.vala
new file mode 100644
index 000000000..6ff4f738e
--- /dev/null
+++ b/src/libvaladoc/apitree/symbolaccessibility.vala
@@ -0,0 +1,55 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.SymbolAccessibility : Basic {
+ public bool is_public {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return ( access == Vala.SymbolAccessibility.PUBLIC );
+ }
+ }
+
+ public bool is_protected {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return (access == Vala.SymbolAccessibility.PROTECTED);
+ }
+ }
+
+ public bool is_internal {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return (access == Vala.SymbolAccessibility.INTERNAL);
+ }
+ }
+
+ public bool is_private {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return (access == Vala.SymbolAccessibility.PRIVATE);
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/templateparameterlisthandler.vala b/src/libvaladoc/apitree/templateparameterlisthandler.vala
new file mode 100644
index 000000000..5b0bb9bd8
--- /dev/null
+++ b/src/libvaladoc/apitree/templateparameterlisthandler.vala
@@ -0,0 +1,61 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public interface Valadoc.TemplateParameterListHandler : Basic {
+ protected abstract Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ public TypeParameter? find_vtemplateparameter ( Vala.GenericType vttype ) {
+ foreach ( TypeParameter tparam in this.template_param_lst ) {
+ if ( tparam.is_vtypeparam ( vttype.type_parameter ) )
+ return tparam;
+ }
+
+ if ( this.parent is TemplateParameterListHandler )
+ return ((TemplateParameterListHandler)this.parent).find_vtemplateparameter ( vttype );
+
+ return null;
+ }
+
+ public Gee.ReadOnlyCollection<TypeParameter> get_template_param_list ( ) {
+ return new Gee.ReadOnlyCollection<TypeParameter> ( this.template_param_lst );
+ }
+
+ internal void set_template_parameter_list ( Gee.Collection<Vala.TypeParameter> vtparams ) {
+ foreach ( Vala.TypeParameter vtparam in vtparams ) {
+ var tmp = new TypeParameter ( this.settings, vtparam, this, this.head );
+ this.template_param_lst.add ( tmp );
+ }
+ }
+
+ internal void set_template_parameter_list_references ( ) {
+ foreach ( TypeParameter tparam in this.template_param_lst ) {
+ tparam.set_type_reference ( );
+ }
+ }
+}
+
diff --git a/src/libvaladoc/apitree/typeparameter.vala b/src/libvaladoc/apitree/typeparameter.vala
new file mode 100644
index 000000000..a8e438a7d
--- /dev/null
+++ b/src/libvaladoc/apitree/typeparameter.vala
@@ -0,0 +1,59 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.TypeParameter : Basic, ReturnTypeHandler {
+ private Vala.TypeParameter vtypeparam;
+
+ public bool is_vtypeparam ( Vala.TypeParameter vtypeparam ) {
+ return this.vtypeparam == vtypeparam;
+ }
+
+ public TypeParameter ( Valadoc.Settings settings, Vala.TypeParameter vtypeparam, Basic parent, Tree head ) {
+ this.vtypeparam = vtypeparam;
+ this.vsymbol = vtypeparam;
+ this.settings = settings;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public TypeReference? type_reference {
+ protected set;
+ get;
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_type_parameter ( this, ptr );
+ }
+
+ public string? name {
+ owned get {
+ return this.vtypeparam.name;
+ }
+ }
+
+ internal void set_type_reference ( ) {
+ }
+}
+
diff --git a/src/libvaladoc/apitree/typereference.vala b/src/libvaladoc/apitree/typereference.vala
new file mode 100644
index 000000000..828348e3a
--- /dev/null
+++ b/src/libvaladoc/apitree/typereference.vala
@@ -0,0 +1,242 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+public class Valadoc.TypeReference : Basic {
+ private Gee.ArrayList<TypeReference> type_arguments = new Gee.ArrayList<TypeReference> ();
+ private Vala.DataType? vtyperef;
+
+ public TypeReference ( Valadoc.Settings settings, Vala.DataType? vtyperef, Basic parent, Tree head ) {
+ this.settings = settings;
+ this.vtyperef = vtyperef;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public Gee.ReadOnlyCollection<TypeReference> get_type_arguments ( ) {
+ return new Gee.ReadOnlyCollection<TypeReference> ( this.type_arguments );
+ }
+
+ private void set_template_argument_list ( Gee.Collection<Vala.DataType> varguments ) {
+ foreach ( Vala.DataType vdtype in varguments ) {
+ var dtype = new TypeReference ( this.settings, vdtype, this, this.head );
+ dtype.set_type_references ( );
+ this.type_arguments.add ( dtype );
+ }
+ }
+
+ public Basic? data_type {
+ private set;
+ get;
+ }
+
+ public bool pass_ownership {
+ get {
+ Vala.CodeNode? node = this.vtyperef.parent_node;
+ if ( node == null )
+ return false;
+
+ if ( node is Vala.FormalParameter ) {
+ return ( ((Vala.FormalParameter)node).direction == ParameterDirection.IN &&
+ ((Vala.FormalParameter)node).parameter_type.value_owned );
+ }
+
+ if ( node is Vala.Property ) {
+ return ((Vala.Property)node).property_type.value_owned;
+ }
+
+ return false;
+ }
+ }
+
+ public bool is_owned {
+ get {
+ Vala.CodeNode parent = this.vtyperef.parent_node;
+
+ // parameter:
+ if ( parent is Vala.FormalParameter ) {
+ if ( ((Vala.FormalParameter)parent).direction != ParameterDirection.IN )
+ return false;
+
+ return ((Vala.FormalParameter)parent).parameter_type.value_owned;
+ }
+ return false;
+ }
+ }
+
+ public bool is_unowned {
+ get {
+ Vala.CodeNode parent = this.vtyperef.parent_node;
+
+ // parameter:
+ if ( parent is Vala.FormalParameter ) {
+ if ( ((Vala.FormalParameter)parent).direction == ParameterDirection.IN )
+ return false;
+
+ return this.is_weak_helper ( ((Vala.FormalParameter)parent).parameter_type );
+ }
+
+ return false;
+ }
+ }
+
+
+ // from vala/valacodewriter.vala
+ private bool is_weak_helper ( Vala.DataType type ) {
+ if (type.value_owned) {
+ return false;
+ } else if (type is Vala.VoidType || type is Vala.PointerType) {
+ return false;
+ } else if (type is Vala.ValueType) {
+ if (type.nullable) {
+ // nullable structs are heap allocated
+ return true;
+ }
+
+ // TODO return true for structs with destroy
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool is_dynamic {
+ get {
+ return this.vtyperef.is_dynamic;
+ }
+ }
+
+ public bool is_weak {
+ get {
+ Vala.CodeNode parent = this.vtyperef.parent_node;
+
+ if (parent is Vala.FormalParameter) {
+ return false;
+ }
+
+ if (parent is Vala.Method == true) {
+ return this.is_weak_helper ( ((Vala.Method)parent).return_type );
+ }
+ else if (parent is Vala.Signal == true) {
+ return this.is_weak_helper ( ((Vala.Signal)parent).return_type );
+ }
+ else if (parent is Vala.Delegate == true) {
+ return this.is_weak_helper ( ((Vala.Delegate)parent).return_type );
+ }
+
+ return ( this.vtyperef.parent_node is Field )? this.is_weak_helper( this.vtyperef ) : false;
+ }
+ }
+
+ public bool is_nullable {
+ get {
+ return this.vtyperef.nullable && this.vtyperef is Vala.PointerType == false;
+ }
+ }
+
+ // remove
+ private string extract_type_name ( Vala.DataType vdtype ) {
+ if ( vdtype is Vala.VoidType ) {
+ return "void";
+ }
+ else if ( vdtype is Vala.PointerType ) {
+ return this.extract_type_name ( ((Vala.PointerType)vdtype).base_type );
+ }
+ else if ( vdtype is Vala.DelegateType ) {
+ return ((Vala.DelegateType)this.vtyperef).delegate_symbol.name;
+ }
+ else if ( vdtype is Vala.MethodType ) {
+ return ((Vala.MethodType)this.vtyperef).method_symbol.name;
+ }
+ else if ( vdtype is Vala.SignalType ) {
+ return ((Vala.SignalType)this.vtyperef).signal_symbol.name;
+ }
+ else if ( vdtype is Vala.ArrayType ) {
+ this.extract_type_name ( ((Vala.ArrayType)vdtype).element_type );
+ }
+ return vtyperef.to_string();
+ }
+
+ // remove
+ public string type_name {
+ owned get {
+ return this.extract_type_name ( this.vtyperef );
+ }
+ }
+
+ private TypeParameter? find_template_parameter ( GenericType vtyperef ) {
+ Basic? element = this.parent;
+ while ( !(element is TemplateParameterListHandler || element == null) ) {
+ element = element.parent;
+ }
+
+ if ( element == null )
+ return null;
+
+ return ((TemplateParameterListHandler)element).find_vtemplateparameter ( (GenericType)vtyperef );
+ }
+
+ internal void set_type_references ( ) {
+ if ( this.vtyperef != null ) {
+ if ( this.vtyperef is PointerType )
+ this.data_type = new Pointer ( settings, (Vala.PointerType)this.vtyperef, this, head );
+ else if ( vtyperef is ArrayType )
+ this.data_type = new Array ( settings, (Vala.ArrayType)this.vtyperef, this, head );
+ else if ( vtyperef is GenericType )
+ this.data_type = find_template_parameter ( (GenericType)vtyperef );
+ }
+
+
+ if ( this.data_type == null ) {
+ Vala.DataType vtype = this.vtyperef;
+ this.set_template_argument_list ( vtype.get_type_arguments () );
+ // still necessary?
+ if ( vtype is Vala.ErrorType ) {
+ Vala.ErrorDomain verrdom = ((Vala.ErrorType)vtype).error_domain;
+ if ( verrdom != null )
+ this.data_type = this.head.search_vala_symbol ( verrdom );
+ else
+ this.data_type = glib_error;
+ }
+ // necessary?
+ else if (vtype is Vala.DelegateType ) {
+ this.data_type = this.head.search_vala_symbol ( ((Vala.DelegateType)vtype).delegate_symbol );
+ }
+ else {
+ this.data_type = this.head.search_vala_symbol ( vtype.data_type );
+ }
+ }
+ else if ( this.data_type is Pointer ) {
+ ((Pointer)this.data_type).set_type_references ();
+ }
+ else if ( this.data_type is Array ) {
+ ((Array)this.data_type).set_type_references ();
+ }
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_type_reference ( this, ptr );
+ }
+}
+
diff --git a/src/libvaladoc/apitree/visitable.vala b/src/libvaladoc/apitree/visitable.vala
new file mode 100644
index 000000000..5ea1fcb36
--- /dev/null
+++ b/src/libvaladoc/apitree/visitable.vala
@@ -0,0 +1,57 @@
+/*
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008 Florian Brosch
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+using Vala;
+using GLib;
+using Gee;
+
+
+
+public interface Valadoc.Visitable : Basic, SymbolAccessibility {
+ protected bool is_type_visitor_accessible (Valadoc.Basic element) {
+ if (!this.settings._private && this.is_private)
+ return false;
+
+ if (!this.settings._internal && this.is_internal)
+ return false;
+
+ if (!this.settings._protected && this.is_protected)
+ return false;
+
+ if (this.parent != element && !this.settings.add_inherited)
+ return false;
+
+ return true;
+ }
+
+ public bool is_visitor_accessible ( ) {
+ if (!this.settings._private && this.is_private)
+ return false;
+
+ if (!this.settings._internal && this.is_internal)
+ return false;
+
+ if (!this.settings._protected && this.is_protected)
+ return false;
+
+ return true;
+ }
+}
+
diff --git a/src/libvaladoc/doctree.vala b/src/libvaladoc/documentation/doctree.vala
index 664871195..55114d0b4 100755
--- a/src/libvaladoc/doctree.vala
+++ b/src/libvaladoc/documentation/doctree.vala
@@ -53,7 +53,7 @@ public enum Valadoc.ListType {
}
-
+/* deprecated */
public interface Valadoc.Documented : Object {
public abstract string? get_filename ();
}
diff --git a/src/libvaladoc/errorreporter.vala b/src/libvaladoc/documentation/errorreporter.vala
index 88ade6828..88ade6828 100755
--- a/src/libvaladoc/errorreporter.vala
+++ b/src/libvaladoc/documentation/errorreporter.vala
diff --git a/src/libvaladoc/moduleloader.vala b/src/libvaladoc/documentation/moduleloader.vala
index 98f2c069b..98f2c069b 100755
--- a/src/libvaladoc/moduleloader.vala
+++ b/src/libvaladoc/documentation/moduleloader.vala
diff --git a/src/libvaladoc/parser.vala b/src/libvaladoc/documentation/parser.vala
index 4c3c9ef7c..d073f8ef8 100755
--- a/src/libvaladoc/parser.vala
+++ b/src/libvaladoc/documentation/parser.vala
@@ -43,72 +43,72 @@ public class Valadoc.Parser : Object {
{ ErrorLevel.ERROR, "Taglet is not allowed in this context" }
};
- private void printr (ErrorNumber errno, string filename, string str, long strlen, long line, long linestartpos, long pos, long len) {
- this.printr_custom (errmsg[(int)errno].lvl, filename, str, strlen, line, linestartpos, pos, len, errmsg[(int)errno].msg);
+ private void printr ( ErrorNumber errno, string filename, string str, long strlen, long line, long linestartpos, long pos, long len ) {
+ this.printr_custom ( errmsg[(int)errno].lvl, filename, str, strlen, line, linestartpos, pos, len, errmsg[(int)errno].msg );
}
- private void printr_custom (ErrorLevel errlvl, string filename, string str, long strlen, long line, long linestartpos, long pos, long len, string errmsg) {
- if (this.settings.verbose == false && errlvl == ErrorLevel.ASSUMPTION) {
- return;
+ private void printr_custom ( ErrorLevel errlvl, string filename, string str, long strlen, long line, long linestartpos, long pos, long len, string errmsg ) {
+ if ( this.settings.verbose == false && errlvl == ErrorLevel.ASSUMPTION ) {
+ return ;
}
- weak string linestr = str.offset(linestartpos);
+ weak string linestr = str.offset( linestartpos );
if (linestr[0] == '\r') {
linestr = linestr.offset(1);
// linestartpos++;
len--;
}
- if (linestr[0] == '\n') {
+ if ( linestr[0] == '\n' ) {
linestr = linestr.offset(1);
// linestartpos++;
len--;
}
- weak string end = linestr.chr(-1, '\n');
+ weak string end = linestr.chr( -1, '\n' );
long linelen = (end == null)? (long)linestr.len() : linestr.pointer_to_offset(end);
long underlinestartpos = pos-linestartpos;
long underlineendpos = underlinestartpos+((len == -1)?(linelen-(pos-linestartpos)):len);
- if (errlvl == ErrorLevel.ERROR) {
- this.err.error (filename, line, underlinestartpos, /*pos-linestartpos*/ underlineendpos, linestr.ndup(linelen), errmsg);
+ if ( errlvl == ErrorLevel.ERROR ) {
+ this.err.error ( filename, line, underlinestartpos, /*pos-linestartpos*/ underlineendpos, linestr.ndup(linelen), errmsg );
}
else {
- this.err.warning (filename, line, underlinestartpos, /*pos-linestartpos*/ underlineendpos, linestr.ndup(linelen), errmsg);
+ this.err.warning ( filename, line, underlinestartpos, /*pos-linestartpos*/ underlineendpos, linestr.ndup(linelen), errmsg );
}
}
/* == helpers == */
- private StringTaglet create_string_taglet (string str, long strlen, ref long startpos, long pos, long lpos, StringBuilder buf) {
+ private StringTaglet create_string_taglet (string str, long strlen, ref long startpos, long pos, long lpos, StringBuilder buf ) {
buf.append_len (str.offset(startpos), lpos-startpos);
- StringTaglet strtag = (StringTaglet)GLib.Object.new (this.modules.strtag);
- strtag.parse (buf.str);
- buf.erase (0, -1);
+ StringTaglet strtag = (StringTaglet)GLib.Object.new ( this.modules.strtag );
+ strtag.parse ( buf.str );
+ buf.erase ( 0, -1 );
startpos = pos+1;
return strtag;
}
- private void prepend_string_taglet (string str, long strlen, Gee.ArrayList<DocElement> content, ref long startpos, long pos, long lpos, StringBuilder buf) {
- StringTaglet strtag = this.create_string_taglet (str, strlen, ref startpos, pos, lpos, buf);
+ private void prepend_string_taglet (string str, long strlen, Gee.ArrayList<DocElement> content, ref long startpos, long pos, long lpos, StringBuilder buf ) {
+ StringTaglet strtag = this.create_string_taglet (str, strlen, ref startpos, pos, lpos, buf );
content.insert (content.size-1, strtag);
}
private void append_string_taglet (string str, long strlen, Gee.ArrayList<DocElement> content, ref long startpos, long pos, long lpos, StringBuilder buf ) {
- StringTaglet strtag = this.create_string_taglet (str, strlen, ref startpos, pos, lpos, buf);
- content.add (strtag);
+ StringTaglet strtag = this.create_string_taglet ( str, strlen, ref startpos, pos, lpos, buf );
+ content.add ( strtag );
}
/* == rules: == */
- private bool skip_deadzone_pos (string str, long strlen, ref long pos, ref long line, ref long linestartpos, bool wikimode) {
+ private bool skip_deadzone_pos ( string str, long strlen, ref long pos, ref long line, ref long linestartpos, bool wikimode ) {
linestartpos=pos;
- for (pos++; str[pos]==' '||str[pos]=='\t' ; pos++);
+ for ( pos++; str[pos]==' '||str[pos]=='\t' ; pos++ );
line++;
- if (wikimode == false) {
- if (str[pos]=='*') {
+ if ( wikimode == false ) {
+ if ( str[pos]=='*' ) {
linestartpos = pos;
return true;
}
@@ -118,25 +118,25 @@ public class Valadoc.Parser : Object {
return true;
}
- private bool parse_newline_pos (string str, long strlen, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode) {
- if (str[npos] == '\n') {
+ private bool parse_newline_pos ( string str, long strlen, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode ) {
+ if ( str[npos] == '\n' ) {
return this.skip_deadzone_pos (str, strlen, ref npos, ref nline, ref nnewlinepos, wikimode);
}
return false;
}
- private bool parse_linebreak_pos (string str, long strlen, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode) {
- if (str[npos] == '\\') {
+ private bool parse_linebreak_pos ( string str, long strlen, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode) {
+ if ( str[npos] == '\\' ) {
long newlinepos = nnewlinepos;
long line = nline;
long pos = npos;
long mpos = pos+1;
- for (; str[mpos]==' '||str[mpos]=='\t' ; mpos++);
- if (str[mpos]=='\r')
+ for ( ; str[mpos]==' '||str[mpos]=='\t' ; mpos++ );
+ if ( str[mpos]=='\r' )
mpos++;
- if (str[mpos]=='\n') {
+ if ( str[mpos]=='\n' ) {
pos = mpos;
if (this.skip_deadzone_pos (str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
nnewlinepos = newlinepos;
@@ -162,8 +162,8 @@ public class Valadoc.Parser : Object {
return str.substring (startpos, pos-startpos);
}
- private bool parse_inline_taglet_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode) {
- if (str[npos] != '{') {
+ private bool parse_inline_taglet_pos ( Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode ) {
+ if ( str[npos] != '{' ) {
return false;
}
@@ -178,13 +178,13 @@ public class Valadoc.Parser : Object {
}
if(this.parse_linebreak_pos(str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
- continue;
+ continue ;
}
return false;
}
- if (str[pos]!='@') {
+ if ( str[pos]!='@' ) {
return false;
}
@@ -194,25 +194,25 @@ public class Valadoc.Parser : Object {
pos++;
string keyword = this.parse_taglet_name (curelement, str, strlen, ref pos, line, newlinepos, npos, true);
- if (keyword == null) {
+ if ( keyword == null ) {
return false;
}
- if ( !this.modules.taglets.contains(keyword)) {
- this.printr (ErrorNumber.UNKNOWN_TAGLET, curelement.get_filename (), str, strlen, line, newlinepos, keywordstartpos, keyword.len()+1);
+ if ( !this.modules.taglets.contains(keyword) ) {
+ this.printr ( ErrorNumber.UNKNOWN_TAGLET, curelement.get_filename (), str, strlen, line, newlinepos, keywordstartpos, keyword.len()+1 );
return false;
}
- Taglet taglet = (Taglet)GLib.Object.new (this.modules.taglets.get (keyword));
- if (taglet is InlineTaglet == false) {
- this.printr (ErrorNumber.CONTEXT, curelement.get_filename (), str, strlen, line, newlinepos, keywordstartpos, keyword.len()+1);
+ Taglet taglet = (Taglet)GLib.Object.new ( this.modules.taglets.get (keyword) );
+ if ( taglet is InlineTaglet == false) {
+ this.printr ( ErrorNumber.CONTEXT, curelement.get_filename (), str, strlen, line, newlinepos, keywordstartpos, keyword.len()+1 );
return false;
}
- for (; str[pos]==' '||str[pos]=='\t'; pos++);
- if (str[pos]=='\0' ) {
- this.printr (ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, line, newlinepos, npos, -1);
+ for ( ; str[pos]==' '||str[pos]=='\t'; pos++ );
+ if ( str[pos]=='\0' ) {
+ this.printr ( ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, line, newlinepos, npos, -1 );
return false;
}
@@ -222,25 +222,25 @@ public class Valadoc.Parser : Object {
for ( ;str[pos]!='}'; pos++ ) {
long looppos = pos;
if(this.parse_linebreak_pos(str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
- strcontent.append (str.substring ( contentstartpos, looppos-contentstartpos));
+ strcontent.append ( str.substring ( contentstartpos, looppos-contentstartpos) );
contentstartpos = pos+1;
}
- else if (str[pos]=='\0'||str[pos]=='\n') {
- this.printr (ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, line, newlinepos, npos, -1);
+ else if ( str[pos]=='\0'||str[pos]=='\n' ) {
+ this.printr ( ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, line, newlinepos, npos, -1 );
return false;
}
}
- strcontent.append (str.substring (contentstartpos, pos-contentstartpos));
+ strcontent.append ( str.substring ( contentstartpos, pos-contentstartpos ) );
ErrorLevel errlvl = ErrorLevel.ASSUMPTION;
string? errmsg;
- if( !((InlineTaglet)taglet).parse (this.settings, this.tree, curelement, strcontent.str, ref errlvl, out errmsg)) {
- this.printr_custom (errlvl, curelement.get_filename (), str, strlen, keywordline, keywordnewlinepos, keywordstartpos, keyword.len()+1, errmsg);
+ if( !((InlineTaglet)taglet).parse ( this.settings, this.tree, curelement, strcontent.str, ref errlvl, out errmsg ) ) {
+ this.printr_custom ( errlvl, curelement.get_filename (), str, strlen, keywordline, keywordnewlinepos, keywordstartpos, keyword.len()+1, errmsg );
}
- content.add (taglet);
+ content.add ( taglet );
nnewlinepos = newlinepos;
nline = line;
@@ -248,39 +248,39 @@ public class Valadoc.Parser : Object {
return true;
}
- private bool parse_align_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long pos, ref long line, ref long newlinepos, ref long space, bool wikimode) {
- if ( this.parse_align_helper (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, wikimode, this.modules.righttag, "))")) {
+ private bool parse_align_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long pos, ref long line, ref long newlinepos, ref long space, bool wikimode ) {
+ if ( this.parse_align_helper (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, wikimode, this.modules.righttag, "))" ) ) {
return true;
}
- if ( this.parse_align_helper (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, wikimode, this.modules.centertag, ")(" )) {
+ if ( this.parse_align_helper (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, wikimode, this.modules.centertag, ")(" ) ) {
return true;
}
return false;
}
- private bool parse_highlighting_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long pos, ref long line, ref long newlinepos, bool wikimode) {
- if (this.parse_bold_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
+ private bool parse_highlighting_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long pos, ref long line, ref long newlinepos, bool wikimode ) {
+ if ( this.parse_bold_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode) ) {
return true;
}
- else if (this.parse_italic_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
+ else if ( this.parse_italic_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode) ) {
return true;
}
- else if (this.parse_underline_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
+ else if ( this.parse_underline_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode) ) {
return true;
}
return false;
}
- private bool parse_align_helper (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, ref long space, bool wikimode, GLib.Type tagtype, string tag) {
+ private bool parse_align_helper ( Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, ref long space, bool wikimode, GLib.Type tagtype, string tag ) {
long newlinepos = nnewlinepos;
long line = nline;
long pos = npos;
- if (!str.offset(pos).has_prefix(tag))
+ if ( !str.offset(pos).has_prefix(tag) )
return false;
- for (; str[pos]==' '||str[pos]=='\t'; pos++);
+ for ( ; str[pos]==' '||str[pos]=='\t'; pos++ );
Gee.ArrayList<DocElement> subcontent = new Gee.ArrayList<DocElement> ();
StringBuilder buf = new StringBuilder ();
@@ -288,7 +288,7 @@ public class Valadoc.Parser : Object {
long lpos = startpos;
- for (; pos<strlen; pos++) {
+ for (; pos<strlen; pos++ ) {
lpos = pos;
if (this.parse_linebreak_pos(str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
buf.append_len (str.offset(startpos), lpos-startpos);
@@ -307,21 +307,18 @@ public class Valadoc.Parser : Object {
else if (this.parse_inline_taglet_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode)) {
this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
+ else if ( this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos) ) {
this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (this.parse_img_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
+ else if ( this.parse_img_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos) ) {
this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
- else if (this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
+ else if ( this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode) ) {
+ this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
}
- this.append_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
+ this.append_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
for (space=++pos;str[pos]==' '||str[pos]=='\t';pos++);
space = pos-space;
@@ -330,9 +327,9 @@ public class Valadoc.Parser : Object {
nline = nline;
npos = pos-1;
- ContentPositionDocElement aligntag = (ContentPositionDocElement)GLib.Object.new (tagtype);
- aligntag.parse (subcontent);
- content.add (aligntag);
+ ContentPositionDocElement aligntag = (ContentPositionDocElement)GLib.Object.new ( tagtype );
+ aligntag.parse ( subcontent );
+ content.add ( aligntag );
return true;
}
@@ -403,9 +400,9 @@ public class Valadoc.Parser : Object {
else if ( this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos) ) {
this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
+ //else if ( this.parse_img_pos (subcontent, ref pos, ref line, ref newlinepos) ) {
+ // this.prepend_string_taglet ( subcontent, ref startpos, pos, lpos, buf );
+ //}
else if ( this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode) ) {
this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
@@ -474,9 +471,9 @@ public class Valadoc.Parser : Object {
return this.parse_highlighting_helper_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos, wikimode, this.modules.underlinedtag, "__" );
}
- private bool parse_highlighting_helper_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode, GLib.Type tagtype, string markup) {
- weak string strpos = str.offset(npos);
- if (!strpos.has_prefix(markup)) {
+ private bool parse_highlighting_helper_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, bool wikimode, GLib.Type tagtype, string markup ) {
+ weak string strpos = str.offset( npos );
+ if ( !strpos.has_prefix( markup ) ) {
return false;
}
@@ -488,13 +485,14 @@ public class Valadoc.Parser : Object {
long newlinepos = nnewlinepos;
long line = nline;
- for (; pos<strlen ; pos++) {
+
+ for ( ; pos<strlen ; pos++ ) {
long lpos = pos;
- if (str.offset(pos).has_prefix(markup)) {
- this.append_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
- HighlightedDocElement htag = (HighlightedDocElement)GLib.Object.new (tagtype);
- htag.parse (subcontent);
- content.add (htag);
+ if ( str.offset(pos).has_prefix(markup) ) {
+ this.append_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
+ HighlightedDocElement htag = (HighlightedDocElement)GLib.Object.new ( tagtype );
+ htag.parse ( subcontent );
+ content.add ( htag );
nnewlinepos = newlinepos;
npos = startpos;
@@ -502,24 +500,21 @@ public class Valadoc.Parser : Object {
return true;
}
- if (this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
+ if ( this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode) ) {
+ this.prepend_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
else if (this.parse_linebreak_pos(str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
buf.append_len (str.offset(startpos), lpos-startpos);
startpos=pos+1;
continue;
}
- else if (this.parse_code_constant_pos (str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
- else if ( this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
+ else if ( this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos) ) {
+ this.prepend_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
else if (this.parse_inline_taglet_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, subcontent, ref startpos, pos, lpos, buf);
+ this.prepend_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (str[pos]=='\n') {
+ else if ( str[pos]=='\n' ) {
break;
}
}
@@ -527,40 +522,37 @@ public class Valadoc.Parser : Object {
return false;
}
- private bool parse_short_desc_pos (DocumentedElement curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long line, ref long newlinepos, ref long space, bool wikimode) {
+ private bool parse_short_desc_pos (DocumentedElement curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long line, ref long newlinepos, ref long space, bool wikimode ) {
StringBuilder buf = new StringBuilder ();
long startpos = npos;
long lpos = npos;
- for (; npos < strlen ; npos++) {
+ for (; npos < strlen ; npos++ ) {
lpos = npos;
- if (this.parse_linebreak_pos (str, strlen, ref npos, ref line, ref newlinepos, wikimode)) {
+ if (this.parse_linebreak_pos (str, strlen, ref npos, ref line, ref newlinepos, wikimode) ) {
buf.append_len (str.offset(startpos), lpos-startpos);
startpos=npos+1;
continue;
}
- if (this.parse_newline_pos (str, strlen, ref npos, ref line, ref newlinepos, wikimode)) {
+ if (this.parse_newline_pos ( str, strlen, ref npos, ref line, ref newlinepos, wikimode)) {
npos++;
break;
}
if (this.parse_inline_taglet_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, npos, lpos, buf);
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, npos, lpos, buf );
}
- else if (this.parse_url_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, npos, lpos, buf);
+ else if ( this.parse_url_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, npos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
- else if (this.parse_highlighting_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, npos, lpos, buf);
+ else if ( this.parse_highlighting_pos (curelement, str, strlen, content, ref npos, ref line, ref newlinepos, wikimode) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, npos, lpos, buf );
}
}
- this.append_string_taglet (str, strlen, content, ref startpos, lpos, lpos, buf);
- for (; str[npos]==' '||str[npos]=='\t' ; npos++, space++);
+ this.append_string_taglet ( str, strlen, content, ref startpos, lpos, lpos, buf );
+ for ( ; str[npos]==' '||str[npos]=='\t' ; npos++, space++ );
return true;
}
@@ -572,8 +564,8 @@ public class Valadoc.Parser : Object {
return url.has_prefix("http://") || url.has_prefix("http://") || (url.has_prefix("/")&&url.has_suffix(".valadoc"));
}
- private bool parse_url_pos (Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long rpos, ref long nline, ref long newlinepos) {
- if (!str.offset(rpos).has_prefix ("[["))
+ private bool parse_url_pos ( Documented curelement, string str, long strlen, Gee.ArrayList<DocElement> content, ref long rpos, ref long nline, ref long newlinepos ) {
+ if ( !str.offset(rpos).has_prefix ("[[") )
return false;
@@ -582,23 +574,23 @@ public class Valadoc.Parser : Object {
long urlend = -1;
long line = nline;
- for (; pos<strlen ; pos++) {
- switch (str[pos]) {
+ for ( ; pos<strlen ; pos++ ) {
+ switch ( str[pos] ) {
case '|':
urlend= pos;
break;
case ']':
if (str[pos+1]==']') {
- string url = str.substring (rpos+2, ((urlend==-1)? pos : urlend)-rpos-2);
- if ( !this.check_url (url)) {
- this.printr (ErrorNumber.INVALID_LINK, curelement.get_filename (), str, strlen, nline, newlinepos, rpos+2, pos-rpos-2);
+ string url = str.substring ( rpos+2, ((urlend==-1)? pos : urlend)-rpos-2 );
+ if ( !this.check_url (url) ) {
+ this.printr ( ErrorNumber.INVALID_LINK, curelement.get_filename (), str, strlen, nline, newlinepos, rpos+2, pos-rpos-2 );
return false;
}
- string urldesc = (urlend==-1)? url : str.substring(urlend+1, pos-urlend-1);
- LinkDocElement linktag = (LinkDocElement)GLib.Object.new (this.modules.linktag);
- linktag.parse (this.settings, this.tree, curelement, url, urldesc);
- content.add (linktag);
+ string urldesc = (urlend==-1)? url : str.substring( urlend+1, pos-urlend-1 );
+ LinkDocElement linktag = (LinkDocElement)GLib.Object.new ( this.modules.linktag );
+ linktag.parse ( this.settings, this.tree, curelement, url, urldesc );
+ content.add ( linktag );
nline = line;
rpos = pos+1;
@@ -606,11 +598,11 @@ public class Valadoc.Parser : Object {
}
break;
case '\n':
- this.printr (ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, nline, newlinepos, rpos, -1);
+ this.printr ( ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, nline, newlinepos, rpos, -1 );
return false;
}
}
- this.printr (ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, nline, newlinepos, rpos, -1);
+ this.printr ( ErrorNumber.OPEN_TAG, curelement.get_filename (), str, strlen, nline, newlinepos, rpos, -1 );
return false;
}
@@ -728,9 +720,6 @@ public class Valadoc.Parser : Object {
else if ( this.parse_url_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos ) ) {
this.prepend_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, subcontent, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
else if ( this.parse_highlighting_pos (curelement, str, strlen, subcontent, ref pos, ref line, ref newlinepos, wikimode) ) {
this.prepend_string_taglet ( str, strlen, subcontent, ref startpos, pos, lpos, buf );
}
@@ -779,7 +768,7 @@ public class Valadoc.Parser : Object {
return true;
}
- private long get_table_cell_attributes_error_len (string str, long strlen, long startpos) {
+ private long get_table_cell_attributes_error_len ( string str, long strlen, long startpos ) {
weak string strstartpos = str.offset(startpos);
weak string? endposstr = strstartpos.chr (-1, '>');
@@ -790,11 +779,11 @@ public class Valadoc.Parser : Object {
long cellend = (cellendstr == null)? long.MAX : strstartpos.pointer_to_offset(cellendstr);
long lineend = (lineendstr == null)? long.MAX : strstartpos.pointer_to_offset(lineendstr);
- return long.min(long.min(long.min(cellend, lineend), endpos), strlen-startpos);
+ return long.min(long.min( long.min( cellend, lineend), endpos), strlen-startpos);
}
private bool parse_table_cell_attributes (Documented curelement, string str, long strlen, ref long npos, long line, long newlinepos, out TextPosition vpos, out TextVerticalPosition hpos, out int hwidth, out int vwidth, out int color) {
- if (str[npos] != '<') {
+ if ( str[npos] != '<' ) {
return false;
}
@@ -805,22 +794,22 @@ public class Valadoc.Parser : Object {
color = -1;
- for (long pos = npos+1; pos < strlen; pos++) {
- switch (str[pos]) {
+ for ( long pos = npos+1; pos < strlen; pos++ ) {
+ switch ( str[pos] ) {
case '-':
- if (!this.extract_decimal (str, strlen, ref pos, out hwidth)) {
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ if ( !this.extract_decimal ( str, strlen, ref pos, out hwidth ) ) {
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
break;
case '|':
- if (!this.extract_decimal (str, strlen, ref pos, out vwidth )) {
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ if ( !this.extract_decimal ( str, strlen, ref pos, out vwidth ) ) {
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
break;
case ')':
- switch (str[pos+1]) {
+ switch ( str[pos+1] ) {
case '(':
vpos = TextPosition.CENTER;
pos++;
@@ -830,13 +819,13 @@ public class Valadoc.Parser : Object {
pos++;
break;
default:
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
break;
case '#':
- if (!this.extract_color(str, strlen, ref pos, out color)) {
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ if ( !this.extract_color(str, strlen, ref pos, out color) ) {
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
break;
@@ -854,16 +843,16 @@ public class Valadoc.Parser : Object {
case ' ':
break;
default:
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
}
- this.printr (ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos));
+ this.printr ( ErrorNumber.TABLE_CELL_ATTRIBUTES, curelement.get_filename (), str, strlen, line, newlinepos, npos, this.get_table_cell_attributes_error_len (str, strlen, npos) );
return false;
}
- private bool parse_table_cell (Documented curelement, string str, long strlen, Gee.ArrayList<TableCellDocElement> cells, ref long pos, ref long line, ref long newlinepos, bool wikimode) {
- if (!str.offset(pos).has_prefix("||")) {
+ private bool parse_table_cell ( Documented curelement, string str, long strlen, Gee.ArrayList<TableCellDocElement> cells, ref long pos, ref long line, ref long newlinepos, bool wikimode ) {
+ if ( !str.offset(pos).has_prefix("||") ) {
return false;
}
@@ -884,42 +873,39 @@ public class Valadoc.Parser : Object {
this.parse_table_cell_attributes (curelement, str, strlen, ref pos, line, newlinepos, out vpos, out hpos, out hwidth, out vwidth, out color);
- for (long startpos = pos; pos < strlen ; pos++) {
+ for ( long startpos = pos; pos < strlen ; pos++ ) {
lpos = pos;
- if (str.offset(pos).has_prefix("||")) {
- this.append_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf);
+ if ( str.offset(pos).has_prefix("||") ) {
+ this.append_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
- TableCellDocElement celltag = (TableCellDocElement)GLib.Object.new (this.modules.celltag);
- celltag.parse ( vpos, hpos, hwidth, vwidth, content);
+ TableCellDocElement celltag = (TableCellDocElement)GLib.Object.new ( this.modules.celltag );
+ celltag.parse ( vpos, hpos, hwidth, vwidth, content );
cells.add ( celltag );
return true;
}
- else if (this.parse_linebreak_pos (str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
+ else if (this.parse_linebreak_pos (str, strlen, ref pos, ref line, ref newlinepos, wikimode) ) {
buf.append_len (str.offset(startpos), lpos-startpos);
startpos=pos+1;
}
- else if (this.parse_inline_taglet_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf);
+ else if (this.parse_inline_taglet_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode )) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
startpos=pos+1;
}
- else if (this.parse_code_constant_pos (str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
- else if (this.parse_url_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_url_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_img_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_img_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_highlighting_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_highlighting_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
else if (this.parse_newline_pos (str, strlen, ref pos, ref line, ref newlinepos, wikimode)) {
- this.printr (ErrorNumber.TABLE_CELL, curelement.get_filename (), str, strlen, cellstartline, cellstartnewlinepos, cellstartpos, -1);
+ this.printr ( ErrorNumber.TABLE_CELL, curelement.get_filename (), str, strlen, cellstartline, cellstartnewlinepos, cellstartpos, -1 );
return false;
}
}
- this.printr (ErrorNumber.TABLE_CELL, curelement.get_filename (), str, strlen, cellstartline, cellstartnewlinepos, cellstartpos, -1);
+ this.printr ( ErrorNumber.TABLE_CELL, curelement.get_filename (), str, strlen, cellstartline, cellstartnewlinepos, cellstartpos, -1 );
return false;
}
@@ -1081,7 +1067,7 @@ public class Valadoc.Parser : Object {
return counter > 0;
}
- private bool parse_headline_pos (string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, ref long space, bool wikimode) {
+ private bool parse_headline_pos ( string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long nnewlinepos, ref long space, bool wikimode ) {
weak string startstr = str.offset(npos);
if ( !startstr.has_prefix("==") ) {
return false;
@@ -1196,9 +1182,6 @@ public class Valadoc.Parser : Object {
if (this.parse_inline_taglet_pos (wikipage, str, strlen, content, ref pos, ref line, ref newlinepos, true)) {
this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
else if ( this.parse_url_pos (wikipage, str, strlen, content, ref pos, ref line, ref newlinepos) ) {
this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
@@ -1216,21 +1199,21 @@ public class Valadoc.Parser : Object {
return wikipage;
}
- public DocumentationTree? parse (DocumentedElement self) {
+ public DocumentationTree? parse ( DocumentedElement self ) {
if (self.vcomment == null) {
return null;
}
weak string str = self.vcomment.content;
- if (str == null) {
+ if ( str == null ) {
return null;
}
- if (str[0]!='*') {
+ if ( str[0]!='*' ) {
return null;
}
- if (self.documentation != null) {
+ if ( self.documentation != null ) {
return self.documentation;
}
@@ -1243,15 +1226,15 @@ public class Valadoc.Parser : Object {
long line = 0;
long pos = 0;
- if (!this.skip_header_pos ( str, strlen, ref pos, ref line, ref newlinepos, false)) {
+ if (!this.skip_header_pos ( str, strlen, ref pos, ref line, ref newlinepos, false )) {
return null;
}
- if(!this.parse_short_desc_pos(self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false)) {
+ if(!this.parse_short_desc_pos(self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false )) {
return null;
}
- doctree.add_brief (content);
+ doctree.add_brief ( content );
StringBuilder buf = new StringBuilder ();
long startpos = pos; //+1
@@ -1261,9 +1244,9 @@ public class Valadoc.Parser : Object {
content = new Gee.ArrayList<DocElement> ();
- for (; pos<strlen ; pos++) {
+ for ( ; pos<strlen ; pos++ ) {
lpos = pos;
- if (this.parse_linebreak_pos (str, strlen, ref pos, ref line, ref newlinepos, false)) {
+ if ( this.parse_linebreak_pos (str, strlen, ref pos, ref line, ref newlinepos, false) ) {
buf.append_len (str.offset(startpos), lpos-startpos);
startpos = pos+1;
continue;
@@ -1278,57 +1261,54 @@ public class Valadoc.Parser : Object {
continue;
}
- if (linestart == pos) {
- if (this.parse_source_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ if ( linestart == pos ) {
+ if ( this.parse_source_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
linestart = startpos = pos+1;
continue ;
}
- else if (this.parse_notification_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_notification_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
linestart = startpos = pos+1;
continue ;
}
- else if ( this.parse_align_pos(self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_align_pos( self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
linestart = startpos = pos+1;
continue ;
}
- else if (this.parse_list_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, ref linestart, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_list_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, ref linestart, false) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
linestart = startpos = pos+1;
continue ;
}
- else if (str[pos] == '@' && !str[pos].isspace()) {
+ else if ( str[pos] == '@' && !str[pos].isspace() ) {
Gee.ArrayList<MainTaglet> taglets = new Gee.ArrayList<MainTaglet>();
- this.parse_taglet (self, str, strlen, taglets, ref pos, ref line, ref newlinepos, ref space, ref depth, false);
- this.append_string_taglet (str, strlen, content, ref startpos, strlen-1, lpos, buf);
- doctree.add_description (content);
+ this.parse_taglet ( self, str, strlen, taglets, ref pos, ref line, ref newlinepos, ref space, ref depth, false );
+ this.append_string_taglet ( str, strlen, content, ref startpos, strlen-1, lpos, buf );
+ doctree.add_description ( content );
doctree.add_taglets (taglets);
return doctree;
}
- else if (this.parse_table ( self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_table ( self, str, strlen, content, ref pos, ref line, ref newlinepos, ref space, false ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
linestart = startpos = pos+1;
- continue;
+ continue ;
}
}
- if (this.parse_inline_taglet_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
- else if (this.parse_url_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ if (this.parse_inline_taglet_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos, false )) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_code_constant_pos (str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_url_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_img_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_img_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
- else if (this.parse_highlighting_pos (self, str, strlen, content, ref pos, ref line, ref newlinepos, false)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
+ else if ( this.parse_highlighting_pos ( self, str, strlen, content, ref pos, ref line, ref newlinepos, false ) ) {
+ this.prepend_string_taglet ( str, strlen, content, ref startpos, pos, lpos, buf );
}
}
@@ -1446,9 +1426,6 @@ public class Valadoc.Parser : Object {
else if (this.parse_inline_taglet_pos ( curelement, str, strlen, content, ref pos, ref line, ref newlinepos, wikimode)) {
this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
}
- else if ( this.parse_code_constant_pos (str, strlen, content, ref pos, ref line, ref newlinepos)) {
- this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
- }
else if ( this.parse_url_pos (curelement, str, strlen, content, ref pos, ref line, ref newlinepos)) {
this.prepend_string_taglet (str, strlen, content, ref startpos, pos, lpos, buf);
}
@@ -1471,34 +1448,6 @@ public class Valadoc.Parser : Object {
npos = pos;
return true;
}
-
- private bool parse_code_constant_pos (string str, long strlen, Gee.ArrayList<DocElement> content, ref long npos, ref long nline, ref long newlinepos) {
- weak string startstr = str.offset(npos);
- CodeConstantDocElement? tag = null;
-
- if (startstr.has_prefix("{{{null}}}") ) {
- tag = (CodeConstantDocElement)GLib.Object.new (this.modules.codeconstanttag);
- tag.parse ("null");
- content.add (tag);
- npos += 9;
- return true;
- }
- else if (startstr.has_prefix("{{{true}}}") ) {
- tag = (CodeConstantDocElement)GLib.Object.new (this.modules.codeconstanttag);
- tag.parse ("true");
- content.add (tag);
- npos += 9;
- return true;
- }
- else if (startstr.has_prefix("{{{false}}}") ) {
- tag = (CodeConstantDocElement)GLib.Object.new (this.modules.codeconstanttag);
- tag.parse ("false");
- content.add (tag);
- npos += 10;
- return true;
- }
- return false;
- }
}
diff --git a/src/libvaladoc/wiki.vala b/src/libvaladoc/documentation/wiki.vala
index 30c66d087..30c66d087 100755
--- a/src/libvaladoc/wiki.vala
+++ b/src/libvaladoc/documentation/wiki.vala
diff --git a/src/libvaladoc/langlet.vala b/src/libvaladoc/langlet.vala
index 8ecba46a2..3f68d6ccc 100755
--- a/src/libvaladoc/langlet.vala
+++ b/src/libvaladoc/langlet.vala
@@ -20,31 +20,32 @@
using GLib;
+// deprecated
public abstract class Valadoc.Langlet : Object {
- public abstract void write_pointer ( Pointer param, void* ptr, DocumentedElement pos );
- public abstract void write_array ( Array param, void* ptr, DocumentedElement pos );
- public abstract void write_type_parameter ( TypeParameter param, void* ptr );
- public abstract void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr );
- public abstract void write_inheritance_list ( Inheritable dtype, void* ptr );
- public abstract void write_parameter_list ( ParameterListHandler thandler, void* ptr );
- public abstract void write_field ( Valadoc.Field field, Valadoc.FieldHandler pos, void* ptr );
- public abstract void write_constant ( Valadoc.Constant constant, Valadoc.ConstantHandler parent, void* ptr );
- public abstract void write_type_reference ( Valadoc.TypeReference tref, void* ptr );
- public abstract void write_formal_parameter ( Valadoc.FormalParameter param, void* ptr );
- public abstract void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr );
- public abstract void write_property ( Valadoc.Property prop, void* ptr );
- public abstract void write_signal ( Valadoc.Signal sig, void* ptr );
- public abstract void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler pos );
- public abstract void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr );
- public abstract void write_error_code ( Valadoc.ErrorCode errcode, void* ptr );
- public abstract void write_enum_value ( Valadoc.EnumValue enval, void* ptr );
- public abstract void write_delegate ( Valadoc.Delegate del, void* ptr );
- public abstract void write_class ( Valadoc.Class cl, void* ptr );
- public abstract void write_enum ( Valadoc.Enum en, void* ptr );
- public abstract void write_struct ( Valadoc.Struct stru, void* ptr );
- public abstract void write_interface ( Valadoc.Interface iface, void* ptr );
- public abstract void write_namespace ( Valadoc.Namespace ns, void* ptr );
- public abstract void write_file ( Valadoc.Package file, void* ptr );
+ public abstract void write_pointer (Pointer param, void* ptr, DocumentedElement pos);
+ public abstract void write_array (Array param, void* ptr, DocumentedElement pos);
+ public abstract void write_type_parameter (TypeParameter param, void* ptr);
+ public abstract void write_template_parameters (TemplateParameterListHandler thandler, void* ptr);
+ public abstract void write_inheritance_list (DocumentedElement dtype, void* ptr);
+ public abstract void write_parameter_list (ParameterListHandler thandler, void* ptr);
+ public abstract void write_field (Valadoc.Field field, Valadoc.FieldHandler pos, void* ptr);
+ public abstract void write_constant (Valadoc.Constant constant, Valadoc.ConstantHandler parent, void* ptr);
+ public abstract void write_type_reference (Valadoc.TypeReference tref, void* ptr);
+ public abstract void write_formal_parameter (Valadoc.FormalParameter param, void* ptr);
+ public abstract void write_property_accessor (Valadoc.PropertyAccessor propac, void* ptr);
+ public abstract void write_property (Valadoc.Property prop, void* ptr);
+ public abstract void write_signal (Valadoc.Signal sig, void* ptr);
+ public abstract void write_method (void* ptr, Valadoc.Method m, Valadoc.MethodHandler pos);
+ public abstract void write_error_domain (Valadoc.ErrorDomain errdom, void* ptr);
+ public abstract void write_error_code (Valadoc.ErrorCode errcode, void* ptr);
+ public abstract void write_enum_value (Valadoc.EnumValue enval, void* ptr);
+ public abstract void write_delegate (Valadoc.Delegate del, void* ptr);
+ public abstract void write_class (Valadoc.Class cl, void* ptr);
+ public abstract void write_enum (Valadoc.Enum en, void* ptr);
+ public abstract void write_struct (Valadoc.Struct stru, void* ptr);
+ public abstract void write_interface (Valadoc.Interface iface, void* ptr);
+ public abstract void write_namespace (Valadoc.Namespace ns, void* ptr);
+ public abstract void write_file (Valadoc.Package file, void* ptr);
}