write_wiki_pages ( tree, css_path_wiki, Path.build_filename(this.settings.path, this.settings.pkg_name, "content") );
- Gee.Collection<Package> packages = tree.get_package_list ();
- foreach ( Package pkg in packages ) {
- pkg.accept (this);
- }
+ tree.accept (this);
+ }
+
+ public override void visit_tree (Api.Tree tree) {
+ tree.accept_children (this);
}
public override void visit_package (Package package) {
write_file_footer ();
file = null;
- package.visit_namespaces ( this );
+ package.accept_all_children (this);
this.devhelp.save_file ( devpath );
}
- public override void visit_namespace ( Namespace ns ) {
- if ( ns.name != null ) {
- string rpath = this.get_real_path ( ns );
- string path = this.get_path ( ns );
+ private void process_compound_node (Api.Node node, KeywordType type) {
+ string rpath = this.get_real_path (node);
+ string path = this.get_path (node);
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
+ if (node.name != null) {
+ this.devhelp.add_chapter_start (node.name, path);
+
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, ns.full_name());
- write_namespace_content (ns, ns);
+ write_file_header (css_path, node.full_name());
+ write_symbol_content (node);
write_file_footer ();
file = null;
-
- this.devhelp.add_keyword ( KeywordType.NAMESPACE, ns.name, path );
- this.devhelp.add_chapter_start ( ns.name, path );
}
- ns.visit_namespaces ( this );
- ns.visit_classes ( this );
- ns.visit_interfaces ( this );
- ns.visit_structs ( this );
- ns.visit_enums ( this );
- ns.visit_error_domains ( this );
- ns.visit_delegates ( this );
- ns.visit_methods ( this );
- ns.visit_fields ( this );
- ns.visit_constants ( this );
-
- if ( ns.name != null ) {
- this.devhelp.add_chapter_end ( );
+ node.accept_all_children (this);
+
+ if (node.name != null) {
+ this.devhelp.add_chapter_end ();
+ this.devhelp.add_keyword (type, node.name, path);
}
}
- public override void visit_interface ( Interface iface ) {
- string rpath = this.get_real_path ( iface );
- string path = this.get_path ( iface );
-
+ private void process_node (Api.Node node, KeywordType type) {
+ string rpath = this.get_real_path (node);
+ string path = this.get_path (node);
- this.devhelp.add_chapter_start ( iface.name, path );
-
- iface.visit_classes ( this );
- iface.visit_structs ( this );
- iface.visit_enums ( this );
- iface.visit_delegates ( this );
- iface.visit_methods ( this );
- iface.visit_signals ( this );
- iface.visit_properties ( this );
- iface.visit_fields ( this );
- iface.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
- this.devhelp.add_keyword ( KeywordType.INTERFACE, iface.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, iface.full_name());
- write_symbol_content (iface);
+ write_file_header (css_path, node.full_name());
+ write_symbol_content (node);
write_file_footer ();
file = null;
- }
- public override void visit_class ( Class cl ) {
- string rpath = this.get_real_path ( cl );
- string path = this.get_path ( cl );
+ node.accept_all_children (this);
-
- this.devhelp.add_keyword ( KeywordType.CLASS, cl.name, path );
- this.devhelp.add_chapter_start ( cl.name, path );
-
- cl.visit_construction_methods ( this );
- cl.visit_classes ( this );
- cl.visit_structs ( this );
- cl.visit_enums ( this );
- cl.visit_delegates ( this );
- cl.visit_methods ( this );
- cl.visit_signals ( this );
- cl.visit_properties ( this );
- cl.visit_fields ( this );
- cl.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, cl.full_name());
- write_symbol_content (cl);
- write_file_footer ();
- file = null;
+ this.devhelp.add_keyword (type, node.name, path);
+ this.devhelp.add_chapter (node.name, path);
}
- public override void visit_struct ( Struct stru ) {
- string rpath = this.get_real_path ( stru );
- string path = this.get_path ( stru );
-
-
- this.devhelp.add_keyword ( KeywordType.STRUCT, stru.name, path );
- this.devhelp.add_chapter_start ( stru.name, path );
-
- stru.visit_construction_methods ( this );
- stru.visit_methods ( this );
- stru.visit_fields ( this );
- stru.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, stru.full_name());
- write_symbol_content (stru);
- write_file_footer ();
- file = null;
+ public override void visit_namespace (Namespace item) {
+ process_compound_node (item, KeywordType.NAMESPACE);
}
- public override void visit_error_domain ( ErrorDomain errdom ) {
- string rpath = this.get_real_path ( errdom );
- string path = this.get_path ( errdom );
-
- errdom.visit_methods ( this );
-
- this.devhelp.add_keyword ( KeywordType.ERRORDOMAIN, errdom.name, path );
- this.devhelp.add_chapter ( errdom.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, errdom.full_name());
- write_symbol_content (errdom);
- write_file_footer ();
- file = null;
+ public override void visit_interface (Interface item) {
+ process_compound_node (item, KeywordType.INTERFACE);
}
- public override void visit_enum ( Enum en ) {
- string rpath = this.get_real_path ( en );
- string path = this.get_path ( en );
-
- en.visit_enum_values ( this );
- en.visit_methods ( this );
-
- this.devhelp.add_keyword ( KeywordType.ENUM, en.name, path );
- this.devhelp.add_chapter ( en.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, en.full_name());
- write_symbol_content (en);
- write_file_footer ();
- file = null;
+ public override void visit_class (Class item) {
+ process_compound_node (item, KeywordType.CLASS);
}
- public override void visit_property ( Property prop ) {
- string rpath = this.get_real_path ( prop );
- string path = this.get_path ( prop );
-
- this.devhelp.add_keyword ( KeywordType.PROPERTY, prop.name, path );
- this.devhelp.add_chapter ( prop.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, prop.full_name());
- write_symbol_content (prop);
- write_file_footer ();
- file = null;
+ public override void visit_struct (Struct item) {
+ process_compound_node (item, KeywordType.STRUCT);
}
- public override void visit_constant (Constant constant) {
- string rpath = this.get_real_path ( constant );
- string path = this.get_path ( constant );
-
- this.devhelp.add_keyword ( KeywordType.VARIABLE, constant.name, path );
- this.devhelp.add_chapter ( constant.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, constant.full_name());
- write_symbol_content (constant);
- write_file_footer ();
- file = null;
+ public override void visit_error_domain (ErrorDomain item) {
+ process_node (item, KeywordType.ERRORDOMAIN);
}
- public override void visit_field (Field field) {
- string rpath = this.get_real_path ( field );
- string path = this.get_path ( field );
-
- this.devhelp.add_keyword ( KeywordType.VARIABLE, field.name, path );
- this.devhelp.add_chapter ( field.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, field.full_name());
- write_symbol_content (field);
- write_file_footer ();
- file = null;
+ public override void visit_enum ( Enum item) {
+ process_node (item, KeywordType.ENUM);
}
- public override void visit_error_code ( ErrorCode errcode ) {
+ public override void visit_property (Property item) {
+ process_node (item, KeywordType.PROPERTY);
}
- public override void visit_enum_value ( Api.EnumValue enval ) {
+ public override void visit_constant (Constant item) {
+ process_node (item, KeywordType.VARIABLE);
}
- public override void visit_delegate ( Delegate del ) {
- string rpath = this.get_real_path ( del );
- string path = this.get_path ( del );
-
- this.devhelp.add_keyword ( KeywordType.DELEGATE, del.name, path );
- this.devhelp.add_chapter ( del.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, del.full_name());
- write_symbol_content (del);
- write_file_footer ();
- file = null;
+ public override void visit_field (Field item) {
+ process_node (item, KeywordType.VARIABLE);
}
- public override void visit_signal ( Api.Signal sig ) {
- string rpath = this.get_real_path ( sig );
- string path = this.get_path ( sig );
-
- this.devhelp.add_keyword ( KeywordType.SIGNAL, sig.name, path );
- this.devhelp.add_chapter ( sig.name, path );
+ public override void visit_error_code (ErrorCode item) {
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, sig.full_name());
- write_symbol_content (sig);
- write_file_footer ();
- file = null;
+ public override void visit_enum_value (Api.EnumValue item) {
}
- public override void visit_method (Method m) {
- string rpath = this.get_real_path ( m );
- string path = this.get_path ( m );
+ public override void visit_delegate (Delegate item) {
+ process_node (item, KeywordType.DELEGATE);
+ }
- this.devhelp.add_keyword ( KeywordType.FUNCTION, m.name, path );
- this.devhelp.add_chapter ( m.name, path );
+ public override void visit_signal (Api.Signal item) {
+ process_node (item, KeywordType.SIGNAL);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, m.full_name());
- write_symbol_content (m);
- write_file_footer ();
- file = null;
+ public override void visit_method (Method item) {
+ process_node (item, KeywordType.FUNCTION);
}
}
-
-
-
-
[ModuleInit]
public Type register_plugin ( ) {
Valadoc.Html.get_html_link_imp = Valadoc.Devhelp.get_html_link;
return typeof ( Valadoc.Devhelp.Doclet );
}
-
write_file_footer ();
file = null;
- Gee.Collection<Package> packages = tree.get_package_list ();
- foreach ( Package pkg in packages ) {
- pkg.accept (this);
- }
+ tree.accept (this);
+ }
+
+ public override void visit_tree (Api.Tree tree) {
+ tree.accept_children (this);
}
public override void visit_package (Package package) {
write_file_footer ();
file = null;
- package.visit_namespaces ( this );
+ package.accept_all_children (this);
}
public override void visit_namespace ( Namespace ns ) {
file = null;
}
- // file:
- ns.visit_namespaces ( this );
- ns.visit_classes ( this );
- ns.visit_interfaces ( this );
- ns.visit_structs ( this );
- ns.visit_enums ( this );
- ns.visit_error_domains ( this );
- ns.visit_delegates ( this );
- ns.visit_methods ( this );
- ns.visit_fields ( this );
- ns.visit_constants ( this );
+ ns.accept_all_children (this);
}
- public override void visit_interface ( Interface iface ) {
- string rpath = this.get_real_path ( iface );
-
- iface.visit_classes ( this );
- iface.visit_structs ( this );
- iface.visit_enums ( this );
- iface.visit_delegates ( this );
- iface.visit_methods ( this );
- iface.visit_signals ( this );
- iface.visit_properties ( this );
- iface.visit_fields ( this );
- iface.visit_constants ( this );
+ private void process_node (Api.Node node) {
+ string rpath = this.get_real_path (node);
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, iface.full_name());
- write_navi_symbol (iface);
- write_symbol_content (iface);
+ write_file_header (css_path, node.full_name());
+ if (is_internal_node (node)) {
+ write_navi_symbol (node);
+ } else {
+ write_navi_leaf_symbol (node);
+ }
+ write_symbol_content (node);
write_file_footer ();
file = null;
- }
- public override void visit_class ( Class cl ) {
- string rpath = this.get_real_path ( cl );
-
- cl.visit_construction_methods ( this );
- cl.visit_classes ( this );
- cl.visit_structs ( this );
- cl.visit_enums ( this );
- cl.visit_delegates ( this );
- cl.visit_methods ( this );
- cl.visit_signals ( this );
- cl.visit_properties ( this );
- cl.visit_fields ( this );
- cl.visit_constants ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, cl.full_name());
- write_navi_symbol (cl);
- write_symbol_content (cl);
- write_file_footer ();
- file = null;
+ node.accept_all_children (this);
}
- public override void visit_struct ( Struct stru ) {
- string rpath = this.get_real_path ( stru );
-
- stru.visit_construction_methods ( this );
- stru.visit_methods ( this );
- stru.visit_fields ( this );
- stru.visit_constants ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, stru.full_name());
- write_navi_symbol (stru);
- write_symbol_content (stru);
- write_file_footer ();
- file = null;
+ private bool is_internal_node (Api.Node node) {
+ return node is Package
+ || node is Namespace
+ || node is Interface
+ || node is Class
+ || node is Struct;
}
- public override void visit_error_domain ( ErrorDomain errdom ) {
- string rpath = this.get_real_path ( errdom );
-
- errdom.visit_methods ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, errdom.full_name());
- write_navi_symbol (errdom);
- write_symbol_content (errdom);
- write_file_footer ();
- file = null;
+ public override void visit_interface (Interface item) {
+ process_node (item);
}
- public override void visit_enum ( Enum en ) {
- string rpath = this.get_real_path ( en );
-
- en.visit_enum_values ( this );
- en.visit_methods ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, en.full_name());
- write_navi_symbol (en);
- write_symbol_content (en);
- write_file_footer ();
- file = null;
+ public override void visit_class (Class item) {
+ process_node (item);
}
- public override void visit_property ( Property prop ) {
- string rpath = this.get_real_path ( prop );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, prop.full_name());
- write_navi_leaf_symbol (prop);
- write_symbol_content (prop);
- write_file_footer ();
- file = null;
+ public override void visit_struct (Struct item) {
+ process_node (item);
}
- public override void visit_constant (Constant constant) {
- string rpath = this.get_real_path ( constant );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, constant.full_name());
- write_navi_leaf_symbol (constant);
- write_symbol_content (constant);
- write_file_footer ();
- file = null;
+ public override void visit_error_domain (ErrorDomain item) {
+ process_node (item);
}
- public override void visit_field (Field field) {
- string rpath = this.get_real_path ( field );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, field.full_name());
- write_navi_leaf_symbol (field);
- write_symbol_content (field);
- write_file_footer ();
- file = null;
+ public override void visit_enum (Enum item) {
+ process_node (item);
}
- public override void visit_error_code ( ErrorCode errcode ) {
+ public override void visit_property (Property item) {
+ process_node (item);
}
- public override void visit_enum_value ( Api.EnumValue enval ) {
+ public override void visit_constant (Constant item) {
+ process_node (item);
}
- public override void visit_delegate ( Delegate del ) {
- string rpath = this.get_real_path ( del );
+ public override void visit_field (Field item) {
+ process_node (item);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, del.full_name());
- write_navi_leaf_symbol (del);
- write_symbol_content (del);
- write_file_footer ();
- file = null;
+ public override void visit_error_code (ErrorCode item) {
}
- public override void visit_signal ( Api.Signal sig ) {
- string rpath = this.get_real_path ( sig );
+ public override void visit_enum_value (Api.EnumValue item) {
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, sig.full_name());
- write_navi_leaf_symbol (sig);
- write_symbol_content (sig);
- write_file_footer ();
- file = null;
+ public override void visit_delegate (Delegate item) {
+ process_node (item);
}
- public override void visit_method (Method m) {
- string rpath = this.get_real_path ( m );
+ public override void visit_signal (Api.Signal item) {
+ process_node (item);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, m.full_name());
- write_navi_leaf_symbol (m);
- write_symbol_content (m);
- write_file_footer ();
- file = null;
+ public override void visit_method (Method item) {
+ process_node (item);
}
}
-
-
-
-
[ModuleInit]
public Type register_plugin ( ) {
Valadoc.Html.get_html_link_imp = Valadoc.get_html_link;
return typeof ( Valadoc.HtmlDoclet );
}
-
}
}
- protected void fetch_subnamespace_names (NamespaceHandler pos, Gee.ArrayList<Namespace> lst) {
- Gee.Collection<Namespace> nspaces = pos.get_namespace_list ();
-
- foreach (Namespace ns in nspaces) {
- lst.add (ns);
- this.fetch_subnamespace_names (ns, lst);
+ protected void fetch_subnamespace_names (Api.Node node, Gee.ArrayList<Namespace> namespaces) {
+ foreach (Api.Node child in node.get_children_by_type (Api.NodeType.NAMESPACE)) {
+ namespaces.add ((Namespace) child);
+ this.fetch_subnamespace_names (child, namespaces);
}
}
writer.end_tag ("div");
}
- protected void write_child_namespaces (NamespaceHandler nh, Api.Node? parent) {
- Gee.ArrayList<Namespace> nsl = new Gee.ArrayList<Namespace> ();
- this.fetch_subnamespace_names (nh, nsl);
+ protected void write_child_namespaces (Api.Node node, Api.Node? parent) {
+ Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
+ this.fetch_subnamespace_names (node, namespaces);
- if (nsl.size == 0)
+ if (namespaces.size == 0)
return ;
- if (nsl.size == 1) {
- if (nsl.get(0).name == null)
+ if (namespaces.size == 1) {
+ if (namespaces.get(0).name == null)
return ;
}
- bool with_childs = (parent == null)? false : parent is Package;
+ bool with_childs = parent != null && parent is Package;
writer.start_tag ("h3", css_title).text ("Namespaces:").end_tag ("h3");
writer.start_tag ("ul", css_inline_navigation);
- foreach (Namespace child in nsl) {
+ foreach (Namespace child in namespaces) {
if (child.name != null) {
writer.start_tag ("li", css_namespace);
writer.link (get_link (child, parent), child.name);
documentation/wikiscanner.vala \
api/array.vala \
api/class.vala \
- api/classhandler.vala \
api/constant.vala \
- api/constanthandler.vala \
- api/constructionmethodhandler.vala \
api/delegate.vala \
- api/delegatehandler.vala \
api/enum.vala \
- api/enumhandler.vala \
api/enumvalue.vala \
api/errorcode.vala \
api/errordomain.vala \
- api/errordomainhandler.vala \
- api/exceptionlisthandler.vala \
api/field.vala \
- api/fieldhandler.vala \
api/formalparameter.vala \
api/interface.vala \
- api/interfacehandler.vala \
api/item.vala \
api/member.vala \
api/method.vala \
- api/methodhandler.vala \
api/namespace.vala \
- api/namespacehandler.vala \
api/node.vala \
api/nodebuilder.vala \
api/package.vala \
- api/parameterlisthandler.vala \
api/pointer.vala \
api/property.vala \
api/propertyaccessor.vala \
- api/propertyhandler.vala \
- api/returntypehandler.vala \
api/signal.vala \
- api/signalhandler.vala \
api/signaturebuilder.vala \
api/struct.vala \
- api/structhandler.vala \
api/symbol.vala \
api/symbolaccessibility.vala \
- api/templateparameterlisthandler.vala \
api/tree.vala \
api/typeparameter.vala \
api/typereference.vala \
valadoc-1.0.deps \
$(NULL)
+
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Class : TypeSymbol, ClassHandler, StructHandler, SignalHandler, MethodHandler, EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler, DelegateHandler, ConstantHandler, TemplateParameterListHandler {
+public class Valadoc.Api.Class : TypeSymbol {
private ArrayList<TypeReference> interfaces;
private Vala.Class vclass;
return this.interfaces;
}
- internal bool is_vclass (Vala.Class vcl) {
- return this.vclass == vcl;
- }
-
public bool is_abstract {
get {
return this.vclass.is_abstract;
return signature.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.ClassHandler : Node {
- protected Class? find_vclass (Vala.Class vcl) {
- foreach (Class cl in get_class_list ()) {
- if (cl.is_vclass (vcl)) {
- return cl;
- }
-
- var tmp = cl.find_vclass (vcl);
- if (tmp != null) {
- return tmp;
- }
- }
- return null;
- }
-
- public Gee.Collection<Class> get_class_list () {
- return get_children_by_type (NodeType.CLASS);
- }
-
- public void visit_classes (Visitor visitor) {
- accept_children_by_type (NodeType.CLASS, visitor);
- }
-}
-
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Constant : Member, ReturnTypeHandler {
+public class Valadoc.Api.Constant : Member {
private Vala.Constant vconst;
public TypeReference? type_reference {
base (symbol, parent);
this.vconst = symbol;
- var vret = this.vconst.type_reference;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.type_reference, this);
}
public string get_cname () {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
}
protected override Inline build_signature () {
visitor.visit_constant (this);
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.ConstantHandler : Node {
- public Collection<Constant> get_constant_list () {
- return get_children_by_type (NodeType.CONSTANT);
- }
-
- public void visit_constants (Visitor visitor) {
- accept_children_by_type (NodeType.CONSTANT, visitor);
- }
-}
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.ConstructionMethodHandler : Node {
- public Collection<Method> get_construction_method_list () {
- return get_children_by_type (NodeType.CREATION_METHOD);
- }
-
- public void visit_construction_methods (Visitor visitor) {
- accept_children_by_type (NodeType.CREATION_METHOD, visitor);
- }
-}
-
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Delegate : TypeSymbol, ParameterListHandler, ReturnTypeHandler, TemplateParameterListHandler, ExceptionHandler {
+public class Valadoc.Api.Delegate : TypeSymbol {
private Vala.Delegate vdelegate;
public Delegate (Vala.Delegate symbol, Node parent) {
this.vdelegate = symbol;
- var ret = this.vdelegate.return_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
-
- var vexceptionlst = this.vdelegate.get_error_types ();
- this.add_exception_list (root, vexceptionlst);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
return signature.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.DelegateHandler : Node {
- public Gee.Collection<Delegate> get_delegate_list () {
- return get_children_by_type (NodeType.DELEGATE);
- }
-
- public void visit_delegates (Visitor visitor) {
- accept_children_by_type (NodeType.DELEGATE, visitor);
- }
-}
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Enum : TypeSymbol, MethodHandler {
+public class Valadoc.Api.Enum : TypeSymbol {
public Enum (Vala.Enum symbol, Node parent) {
base (symbol, parent);
this.venum = symbol;
return this.venum.get_cname();
}
- // rename: get_enum_value_list
- public Collection<EnumValue> get_enum_values () {
- return get_children_by_type (NodeType.ENUM_VALUE);
- }
-
- public void visit_enum_values (Visitor visitor) {
- accept_children_by_type (NodeType.ENUM_VALUE, visitor);
- }
-
public override NodeType node_type { get { return NodeType.ENUM; } }
public override void accept (Visitor visitor) {
.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.EnumHandler : Node {
- public Collection<Enum> get_enum_list () {
- return get_children_by_type (NodeType.ENUM);
- }
-
- public void visit_enums (Visitor visitor) {
- accept_children_by_type (NodeType.ENUM, visitor);
- }
-}
-
using Valadoc.Content;
-public class Valadoc.Api.ErrorDomain : TypeSymbol, MethodHandler {
+public class Valadoc.Api.ErrorDomain : TypeSymbol {
private Vala.ErrorDomain verrdom;
public ErrorDomain (Vala.ErrorDomain symbol, Node parent) {
return this.verrdom.get_cname();
}
- public void visit_error_codes (Visitor visitor) {
- accept_children_by_type (NodeType.ERROR_CODE, visitor);
- }
-
- public Collection<ErrorCode> get_error_code_list () {
- return get_children_by_type (NodeType.ERROR_CODE);
- }
-
public override NodeType node_type { get { return NodeType.ERROR_DOMAIN; } }
public override void accept (Visitor visitor) {
.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.ErrorDomainHandler : Node {
- public Collection<ErrorDomain> get_error_domain_list () {
- return get_children_by_type (NodeType.ERROR_DOMAIN);
- }
-
- public void visit_error_domains (Visitor visitor) {
- accept_children_by_type (NodeType.ERROR_DOMAIN, visitor);
- }
-}
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-// rename to ExceptionListHandler
-public interface Valadoc.Api.ExceptionHandler : Node {
-
- public Collection<Api.Node> get_error_domains () {
- return get_children_by_type (NodeType.ERROR_DOMAIN);
- }
-
- public void add_exception_list (Tree root, Vala.Collection<Vala.DataType> vexceptions) {
- foreach (Vala.DataType vtype in vexceptions) {
- if (((Vala.ErrorType) vtype).error_domain == null) {
- add_child (glib_error);
- } else {
- ErrorDomain type = (ErrorDomain) root.search_vala_symbol (((Vala.ErrorType) vtype).error_domain);
- add_child (type);
- }
- }
- }
-}
-
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Field : Member, ReturnTypeHandler {
+public class Valadoc.Api.Field : Member {
private Vala.Field vfield;
public Field (Vala.Field symbol, Node parent) {
base (symbol, parent);
this.vfield = symbol;
- var vret = this.vfield.field_type;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.field_type, this);
}
public string? get_cname () {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
visitor.visit_field (this);
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.FieldHandler : Node {
- public Collection<Field> get_field_list () {
- return get_children_by_type (NodeType.FIELD);
- }
-
- public void visit_fields (Visitor visitor) {
- accept_children_by_type (NodeType.FIELD, visitor);
- }
-}
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.FormalParameter : Symbol, ReturnTypeHandler {
+public class Valadoc.Api.FormalParameter : Symbol {
private Vala.FormalParameter vformalparam;
public FormalParameter (Vala.FormalParameter symbol, Node parent) {
base (symbol, parent);
this.vformalparam = symbol;
- var vformparam = this.vformalparam.parameter_type;
- this.set_ret_type (vformparam);
+ type_reference = new TypeReference (symbol.parameter_type, this);
}
public bool is_out {
return;
}
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
return signature.get ();
}
}
+
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Interface : TypeSymbol, SignalHandler, PropertyHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler, MethodHandler, DelegateHandler, EnumHandler, StructHandler, ClassHandler {
+public class Valadoc.Api.Interface : TypeSymbol {
public Interface (Vala.Interface symbol, Node parent) {
base (symbol, parent);
this.vinterface = symbol;
return signature.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.InterfaceHandler : Node {
- public Collection<Interface> get_interface_list () {
- return get_children_by_type (NodeType.INTERFACE);
- }
-
- public void visit_interfaces (Visitor visitor) {
- accept_children_by_type (NodeType.INTERFACE, visitor);
- }
-}
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Method : Member, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler, ReturnTypeHandler {
+public class Valadoc.Api.Method : Member {
private Vala.Method vmethod;
public Method (Vala.Method symbol, Node parent) {
base (symbol, parent);
this.vmethod = symbol;
- var vret = this.vmethod.return_type;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
this.base_method = (Method?) root.search_vala_symbol (vm);
}
- var vexceptionlst = this.vmethod.get_error_types ();
- this.add_exception_list (root, vexceptionlst);
-
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.MethodHandler : Node {
- public void visit_methods (Visitor visitor) {
- accept_children_by_type (NodeType.METHOD, visitor);
- }
-
- public Collection<Method> get_method_list () {
- return get_children_by_type (NodeType.METHOD);
- }
-}
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Namespace : Symbol, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomainHandler,
- EnumHandler, ClassHandler, StructHandler, InterfaceHandler,
- DelegateHandler, ConstantHandler
-{
+public class Valadoc.Api.Namespace : Symbol {
private Vala.Comment source_comment;
- public Namespace (Vala.Namespace symbol, NamespaceHandler parent) {
+ public Namespace (Vala.Namespace symbol, Api.Node parent) {
base (symbol, parent);
this.vnspace = symbol;
private get;
set;
}
-
- internal bool is_vnspace (Vala.Namespace vns) {
- return this.vnspace == vns;
- }
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.NamespaceHandler : Node {
- public Collection<Namespace> get_namespace_list (bool filtered = true) {
- return get_children_by_type (NodeType.NAMESPACE, filtered);
- }
-
- public void visit_namespaces (Visitor visitor) {
- accept_children_by_type (NodeType.NAMESPACE, visitor);
- }
-
- private ArrayList<Vala.Namespace> create_parent_vnamespace_list (Vala.Symbol vsymbol) {
- var lst = new 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 (vns, this);
- add_child (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 (vnspace, this);
- add_child (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 get_namespace_list (false)) {
- 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 get_namespace_list (false)) {
- 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));
- }
-}
}
}
+ public void accept_all_children (Visitor visitor) {
+ foreach (Gee.List<Node> children in per_type_children.values) {
+ foreach (Node node in children) {
+ if (node.do_document) {
+ node.accept (visitor);
+ }
+ }
+ }
+ }
+
public Node? find_by_name (string name) {
return per_name_children.get (name);
}
Vala.SourceFile source_file = element.source_reference.file;
Package package = find_package_for (source_file);
- Namespace ns = package.get_namespace (element);
- return ns;
+ return package.get_namespace (root, element);
}
private Package? find_package_for (Vala.SourceFile source_file) {
}
}
+
using Gee;
using Valadoc.Content;
-
-
-public class Valadoc.Api.Package : Node, NamespaceHandler {
+public class Valadoc.Api.Package : Node {
private ArrayList<Vala.SourceFile> vfiles = new ArrayList<Vala.SourceFile> ();
internal void add_file (Vala.SourceFile vfile) {
}
}
- // TODO Remove
internal bool is_vpackage (Vala.SourceFile vfile) {
return this.vfiles.contains (vfile);
}
.append (name)
.get ();
}
+
+ protected Namespace get_namespace (Tree root, Vala.Symbol symbol) {
+ Vala.Symbol namespace_symbol = symbol;
+ while (!(namespace_symbol is Vala.Namespace)) {
+ namespace_symbol = namespace_symbol.parent_symbol;
+ }
+
+ // Try to find it first
+ var ns = (Namespace) root.search_vala_symbol_in (namespace_symbol, this);
+ if (ns != null) {
+ return ns;
+ }
+
+ // Find parent namespace and use it as parent if existing
+ var parent_namespace_symbol = namespace_symbol.parent_symbol;
+
+ if (parent_namespace_symbol != null) {
+ ns = (Namespace) get_namespace (root, parent_namespace_symbol);
+ if (ns != null) {
+ var new_namespace = new Namespace ((Vala.Namespace) namespace_symbol, ns);
+ add_child (new_namespace);
+ return new_namespace;
+ }
+ }
+
+ // Else take this package as parent
+ var new_namespace = new Namespace ((Vala.Namespace) namespace_symbol, this);
+ add_child (new_namespace);
+ return new_namespace;
+ }
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-// TODO Rename FormalParameters
-public interface Valadoc.Api.ParameterListHandler : Node {
- public Gee.List<FormalParameter> param_list {
- owned get { return get_parameter_list (); }
- }
-
- public Gee.List<FormalParameter> get_parameter_list () {
- return (Gee.List<FormalParameter>) get_children_by_type (NodeType.FORMAL_PARAMETER);
- }
-}
-
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Property : Member, ReturnTypeHandler {
+public class Valadoc.Api.Property : Member {
private Vala.Property vproperty;
public Property (Vala.Property symbol, Node parent) {
this.vproperty = symbol;
- var ret = this.vproperty.property_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.property_type, this);
if (this.vproperty.get_accessor != null) {
this.getter = new PropertyAccessor (this.vproperty.get_accessor, this);
if (vp != null) {
this.base_property = (Property?) root.search_vala_symbol (vp);
}
- this.set_return_type_references (root);
+
+ type_reference.resolve_type_references (root);
}
protected override Inline build_signature () {
visitor.visit_property (this);
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.PropertyHandler : Node {
- protected bool is_overwritten_property (Property prop) {
- foreach (Property p in get_property_list ()) {
- if (p.parent != this) {
- continue ;
- }
- if (!p.is_override) {
- continue ;
- }
- if (p.equals (prop)) {
- return true;
- }
- }
- return false;
- }
-
- public Collection<Property> get_property_list () {
- return get_children_by_type (NodeType.PROPERTY);
- }
-
- public void visit_properties (Visitor visitor) {
- accept_children_by_type (NodeType.PROPERTY, visitor);
- }
-}
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.ReturnTypeHandler : Item {
- public abstract TypeReference? type_reference {
- protected set;
- get;
- }
-
- internal void set_return_type_references (Tree root) {
- if ( this.type_reference == null )
- return ;
-
- this.type_reference.resolve_type_references (root);
- }
-
- // rename
- internal void set_ret_type ( Vala.DataType? vtref ) {
- var tmp = new TypeReference (vtref, this);
- this.type_reference = tmp;
- }
-}
-
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Signal : Member, ParameterListHandler, ReturnTypeHandler {
+public class Valadoc.Api.Signal : Member {
private Vala.Signal vsignal;
public Signal (Vala.Signal symbol, Node parent) {
this.vsignal = symbol;
- var ret = this.vsignal.return_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
visitor.visit_signal (this);
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.SignalHandler : Node {
- public void visit_signals (Visitor visitor) {
- accept_children_by_type (NodeType.SIGNAL, visitor);
- }
-
- public Collection<Signal> get_signal_list () {
- return get_children_by_type (NodeType.SIGNAL);
- }
-}
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Struct : TypeSymbol, MethodHandler, ConstructionMethodHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler {
+public class Valadoc.Api.Struct : TypeSymbol {
private Vala.Struct vstruct;
public Struct (Vala.Struct symbol, Node parent) {
return signature.get ();
}
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-public interface Valadoc.Api.StructHandler : Node {
- public Collection<Struct> get_struct_list () {
- return get_children_by_type (NodeType.STRUCT);
- }
-
- public void visit_structs (Visitor visitor) {
- accept_children_by_type (NodeType.STRUCT, visitor);
- }
-}
return "private";
}
}
+
+ protected override void resolve_type_references (Tree root) {
+ base.resolve_type_references (root);
+
+ foreach (Vala.DataType type in symbol.get_error_types ()) {
+ var error_type = type as Vala.ErrorType;
+ if (error_type.error_domain == null) {
+ add_child (glib_error);
+ } else {
+ add_child (root.search_vala_symbol (error_type.error_domain));
+ }
+ }
+ }
}
+
+++ /dev/null
-/*
- * Valadoc.Api.- 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 Gee;
-
-
-public interface Valadoc.Api.TemplateParameterListHandler : Node {
- public Collection<TypeParameter> get_template_param_list () {
- return get_children_by_type (NodeType.TYPE_PARAMETER, false);
- }
-}
-
visitor.visit_tree (this);
}
+ public void accept_children (Visitor visitor) {
+ foreach (Node node in packages) {
+ node.accept (visitor);
+ }
+ }
+
private Node? search_relative_to (Node element, string[] path) {
Api.Node? node = element;
foreach (string name in path) {
}
/* default packages */
- if (!this.add_package ("glib-2.0")) { //
+ if (!this.add_package ("glib-2.0")) {
Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
}
- if (!this.add_package ("gobject-2.0")) { //
+ if (!this.add_package ("gobject-2.0")) {
Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
}
}
}
}
- internal Node? search_vala_symbol (Vala.Symbol? vnode) {
- if (vnode == null) {
- return null;
- }
+ internal Symbol? search_vala_symbol (Vala.Symbol symbol) {
+ Vala.SourceFile source_file = symbol.source_reference.file;
+ Package package = this.find_file (source_file);
+ return search_vala_symbol_in (symbol, package);
+ }
+ internal Symbol? search_vala_symbol_in (Vala.Symbol symbol, Package package) {
ArrayList<Vala.Symbol> params = new ArrayList<Vala.Symbol> ();
- for (Vala.Symbol iter = vnode; iter != null; iter = iter.parent_symbol) {
+ for (Vala.Symbol iter = symbol; iter != null; iter = iter.parent_symbol) {
if (iter is Vala.DataType) {
params.insert (0, ((Vala.DataType)iter).data_type);
} else {
}
}
- Vala.SourceFile vfile = vnode.source_reference.file;
- Package file = this.find_file(vfile);
-
- Api.Node? node = file;
- foreach (Vala.Symbol symbol in params) {
- node = node.find_by_symbol (symbol);
+ Api.Node? node = package;
+ foreach (Vala.Symbol a_symbol in params) {
+ node = node.find_by_symbol (a_symbol);
if (node == null) {
return null;
}
}
- return node;
+ return (Symbol) node;
}
private Package? get_external_package_by_name (string name) {
return null;
}
}
+
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.TypeParameter : Symbol, ReturnTypeHandler {
+public class Valadoc.Api.TypeParameter : Symbol {
public TypeParameter (Vala.TypeParameter symbol, Node parent) {
base (symbol, parent);
}
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
protected override Inline build_signature () {
return new SignatureBuilder ()
.append (name)
visitor.visit_type_parameter (this);
}
}
+
}
} else if (vtyperef is Vala.DelegateType) {
this.data_type = root.search_vala_symbol (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else {
+ } else if (vtyperef.data_type != null) {
this.data_type = root.search_vala_symbol (vtyperef.data_type);
}
return signature.get ();
}
}
+