summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Brosch <flobrosch@src.gnome.org>2008-10-28 01:22:12 +0000
committerFlorian Brosch <flobrosch@src.gnome.org>2008-10-28 01:22:12 +0000
commit28c004fb4c10e8816630d2f334611b7d59220bfb (patch)
tree1a575d01546cfe3d7c8f7f5653b6c38c5bdc43aa
parent916f132257417d57e5516c0b053404c07a483e84 (diff)
downloadvala-28c004fb4c10e8816630d2f334611b7d59220bfb.tar.gz
--
-- svn path=/trunk/; revision=5
-rw-r--r--AUTHORS1
-rw-r--r--COPYING340
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am2
-rw-r--r--NEWS0
-rw-r--r--README0
-rwxr-xr-xautogen.sh12
-rw-r--r--config.h.in55
-rw-r--r--configure.in83
-rw-r--r--src/Makefile.am12
-rw-r--r--src/doclets/Makefile.am11
-rw-r--r--src/doclets/html/Makefile.am17
-rw-r--r--src/doclets/html/deps/Makefile.am31
-rw-r--r--src/doclets/html/deps/class.pngbin0 -> 624 bytes
-rw-r--r--src/doclets/html/deps/constant.pngbin0 -> 560 bytes
-rw-r--r--src/doclets/html/deps/delegate.pngbin0 -> 688 bytes
-rw-r--r--src/doclets/html/deps/enum.pngbin0 -> 634 bytes
-rw-r--r--src/doclets/html/deps/enumvalue.pngbin0 -> 215 bytes
-rw-r--r--src/doclets/html/deps/errorcode.pngbin0 -> 215 bytes
-rw-r--r--src/doclets/html/deps/errordomain.pngbin0 -> 618 bytes
-rw-r--r--src/doclets/html/deps/field.pngbin0 -> 560 bytes
-rw-r--r--src/doclets/html/deps/interface.pngbin0 -> 544 bytes
-rw-r--r--src/doclets/html/deps/main.css265
-rw-r--r--src/doclets/html/deps/method.pngbin0 -> 559 bytes
-rw-r--r--src/doclets/html/deps/namespace.pngbin0 -> 390 bytes
-rw-r--r--src/doclets/html/deps/package.pngbin0 -> 633 bytes
-rw-r--r--src/doclets/html/deps/packages.pngbin0 -> 618 bytes
-rw-r--r--src/doclets/html/deps/property.pngbin0 -> 884 bytes
-rw-r--r--src/doclets/html/deps/signal.pngbin0 -> 536 bytes
-rw-r--r--src/doclets/html/deps/struct.pngbin0 -> 329 bytes
-rw-r--r--src/doclets/html/doclet/Makefile.am56
-rw-r--r--src/doclets/html/doclet/docletconfig.vapi7
-rw-r--r--src/doclets/html/doclet/template.vala2148
-rw-r--r--src/doclets/html/linkhelper/Makefile.am44
-rwxr-xr-xsrc/doclets/html/linkhelper/helper.vala194
-rw-r--r--src/doclets/html/taglets/Makefile.am26
-rw-r--r--src/doclets/html/taglets/author/Makefile.am55
-rw-r--r--src/doclets/html/taglets/author/taglet.vala84
-rw-r--r--src/doclets/html/taglets/link/Makefile.am55
-rw-r--r--src/doclets/html/taglets/link/taglet.vala72
-rw-r--r--src/doclets/html/taglets/parameter/Makefile.am55
-rw-r--r--src/doclets/html/taglets/parameter/taglet.vala138
-rw-r--r--src/doclets/html/taglets/return/Makefile.am55
-rw-r--r--src/doclets/html/taglets/return/taglet.vala71
-rw-r--r--src/doclets/html/taglets/see/Makefile.am55
-rw-r--r--src/doclets/html/taglets/see/taglet.vala104
-rw-r--r--src/doclets/html/taglets/string/Makefile.am55
-rw-r--r--src/doclets/html/taglets/string/taglet.vala54
-rw-r--r--src/doclets/html/taglets/throws/Makefile.am55
-rw-r--r--src/doclets/html/taglets/throws/taglet.vala130
-rw-r--r--src/doclets/html/taglets/version/Makefile.am55
-rw-r--r--src/doclets/html/taglets/version/taglet.vala82
-rw-r--r--src/doclets/valadoc.org/Makefile.am16
-rw-r--r--src/doclets/valadoc.org/doclet/Makefile.am56
-rw-r--r--src/doclets/valadoc.org/doclet/template.vala1954
-rw-r--r--src/doclets/valadoc.org/linkhelper/Makefile.am44
-rwxr-xr-xsrc/doclets/valadoc.org/linkhelper/helper.vala169
-rw-r--r--src/doclets/valadoc.org/taglets/Makefile.am16
-rw-r--r--src/doclets/valadoc.org/taglets/author/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/author/taglet.vala83
-rw-r--r--src/doclets/valadoc.org/taglets/link/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/link/taglet.vala72
-rw-r--r--src/doclets/valadoc.org/taglets/parameter/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/parameter/taglet.vala126
-rw-r--r--src/doclets/valadoc.org/taglets/return/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/return/taglet.vala71
-rw-r--r--src/doclets/valadoc.org/taglets/see/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/see/taglet.vala100
-rw-r--r--src/doclets/valadoc.org/taglets/string/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/string/taglet.vala54
-rw-r--r--src/doclets/valadoc.org/taglets/throws/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/throws/taglet.vala130
-rw-r--r--src/doclets/valadoc.org/taglets/version/Makefile.am55
-rw-r--r--src/doclets/valadoc.org/taglets/version/taglet.vala82
-rw-r--r--src/libvaladoc/Makefile.am70
-rwxr-xr-xsrc/libvaladoc/doclet.vala62
-rwxr-xr-xsrc/libvaladoc/doctree.vala4465
-rwxr-xr-xsrc/libvaladoc/drawer.vala171
-rwxr-xr-xsrc/libvaladoc/errorreporter.vala151
-rwxr-xr-xsrc/libvaladoc/langlet.vala94
-rwxr-xr-xsrc/libvaladoc/old_doctree.vala4708
-rw-r--r--src/libvaladoc/parser.vala868
-rwxr-xr-xsrc/libvaladoc/settings.vala58
-rw-r--r--src/libvaladoc/valadoc-1.0.pc.in14
-rw-r--r--src/libvaladoc/xmlimporter.vala187
-rw-r--r--src/libvaladoc/xmlparser.vala718
-rw-r--r--src/valadoc/Makefile.am48
-rwxr-xr-xsrc/valadoc/valadoc.vala674
-rw-r--r--src/vapi/Makefile.am16
-rw-r--r--src/vapi/config.vapi15
-rwxr-xr-xsrc/vapi/libgvc.vapi394
-rw-r--r--src/vapi/valadoc-1.0.deps2
92 files changed, 20607 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 000000000..00dc670ea
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Florian Brosch <flo.brosch@gmail.com>
diff --git a/COPYING b/COPYING
new file mode 100644
index 000000000..08ddefd04
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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, or
+ (at your option) any later version.
+
+ 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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 000000000..2a455c383
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2 @@
+# Makefile.am
+SUBDIRS = src
diff --git a/NEWS b/NEWS
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/README
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 000000000..9c728c50a
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 000000000..5a1898acf
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,55 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff --git a/configure.in b/configure.in
new file mode 100644
index 000000000..b42c588fb
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,83 @@
+dnl configure.in
+AC_PREREQ(2.59)
+AC_INIT(Valadoc, 0.2, flo.brosch@gmail.com)
+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)
+
+# Checks for libraries.
+LIBVALA_REQUIRED=0.3.4
+LIBGVC_REQUIRED=2.16
+GLIB_REQUIRED=2.12.0
+GTK_REQUIRED=2.10.0
+LIBXML2_REQUIRED=2.0
+
+PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED )
+AC_SUBST(LIBXML2_CFLAGS)
+AC_SUBST(LIBXML2_LIBS)
+
+PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED )
+AC_SUBST(LIBGVC_CFLAGS)
+AC_SUBST(LIBGVC_LIBS)
+
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
+PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED)
+AC_SUBST(GMODULE_CFLAGS)
+AC_SUBST(GMODULE_LIBS)
+
+PKG_CHECK_MODULES(LIBVALA, vala-1.0 >= $LIBVALA_REQUIRED)
+AC_SUBST(LIBVALA_CFLAGS)
+AC_SUBST(LIBVALA_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
+ src/libvaladoc/Makefile
+ src/vapi/Makefile
+ src/doclets/Makefile
+ src/doclets/html/Makefile
+ src/doclets/html/linkhelper/Makefile
+ src/doclets/html/doclet/Makefile
+ src/doclets/html/deps/Makefile
+ src/doclets/html/taglets/Makefile
+ src/doclets/html/taglets/parameter/Makefile
+ src/doclets/html/taglets/version/Makefile
+ src/doclets/html/taglets/throws/Makefile
+ src/doclets/html/taglets/return/Makefile
+ src/doclets/html/taglets/string/Makefile
+ src/doclets/html/taglets/link/Makefile
+ src/doclets/html/taglets/see/Makefile
+ src/doclets/valadoc.org/Makefile
+ src/doclets/valadoc.org/linkhelper/Makefile
+ src/doclets/valadoc.org/doclet/Makefile
+ src/doclets/valadoc.org/taglets/Makefile
+ src/doclets/valadoc.org/taglets/parameter/Makefile
+ src/doclets/valadoc.org/taglets/version/Makefile
+ src/doclets/valadoc.org/taglets/throws/Makefile
+ src/doclets/valadoc.org/taglets/return/Makefile
+ src/doclets/valadoc.org/taglets/string/Makefile
+ src/doclets/valadoc.org/taglets/link/Makefile
+ src/doclets/valadoc.org/taglets/see/Makefile
+ src/valadoc/Makefile])
+
+
+AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 000000000..a16f827dd
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,12 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = libvaladoc \
+ vapi \
+ doclets \
+ valadoc \
+ $(NULL)
+
+
diff --git a/src/doclets/Makefile.am b/src/doclets/Makefile.am
new file mode 100644
index 000000000..a61eb1e9e
--- /dev/null
+++ b/src/doclets/Makefile.am
@@ -0,0 +1,11 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = \
+ html \
+ valadoc.org \
+ $(NULL)
+
+
diff --git a/src/doclets/html/Makefile.am b/src/doclets/html/Makefile.am
new file mode 100644
index 000000000..1f041948a
--- /dev/null
+++ b/src/doclets/html/Makefile.am
@@ -0,0 +1,17 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = \
+ linkhelper \
+ doclet \
+ taglets \
+ deps \
+ $(NULL)
+
+# langlet \
+# doclet \
+# $(NULL)
+
+
diff --git a/src/doclets/html/deps/Makefile.am b/src/doclets/html/deps/Makefile.am
new file mode 100644
index 000000000..1dfdb5d6f
--- /dev/null
+++ b/src/doclets/html/deps/Makefile.am
@@ -0,0 +1,31 @@
+NULL =
+
+
+vapidir = $(libdir)/valadoc/plugins/template/deps/
+
+
+dist_vapi_DATA = \
+ main.css \
+ class.png \
+ enumvalue.png \
+ interface.png \
+ packages.png \
+ constant.png \
+ errorcode.png \
+ method.png \
+ property.png \
+ delegate.png \
+ errordomain.png \
+ namespace.png \
+ signal.png \
+ enum.png \
+ field.png \
+ package.png \
+ struct.png \
+ $(NULL)
+
+dist_noinst_DATA = \
+ $(NULL)
+
+
+
diff --git a/src/doclets/html/deps/class.png b/src/doclets/html/deps/class.png
new file mode 100644
index 000000000..f8e82b556
--- /dev/null
+++ b/src/doclets/html/deps/class.png
Binary files differ
diff --git a/src/doclets/html/deps/constant.png b/src/doclets/html/deps/constant.png
new file mode 100644
index 000000000..5515f7e66
--- /dev/null
+++ b/src/doclets/html/deps/constant.png
Binary files differ
diff --git a/src/doclets/html/deps/delegate.png b/src/doclets/html/deps/delegate.png
new file mode 100644
index 000000000..3ad818b4d
--- /dev/null
+++ b/src/doclets/html/deps/delegate.png
Binary files differ
diff --git a/src/doclets/html/deps/enum.png b/src/doclets/html/deps/enum.png
new file mode 100644
index 000000000..9d534b5fe
--- /dev/null
+++ b/src/doclets/html/deps/enum.png
Binary files differ
diff --git a/src/doclets/html/deps/enumvalue.png b/src/doclets/html/deps/enumvalue.png
new file mode 100644
index 000000000..08dcb8a00
--- /dev/null
+++ b/src/doclets/html/deps/enumvalue.png
Binary files differ
diff --git a/src/doclets/html/deps/errorcode.png b/src/doclets/html/deps/errorcode.png
new file mode 100644
index 000000000..08dcb8a00
--- /dev/null
+++ b/src/doclets/html/deps/errorcode.png
Binary files differ
diff --git a/src/doclets/html/deps/errordomain.png b/src/doclets/html/deps/errordomain.png
new file mode 100644
index 000000000..cbe3fe038
--- /dev/null
+++ b/src/doclets/html/deps/errordomain.png
Binary files differ
diff --git a/src/doclets/html/deps/field.png b/src/doclets/html/deps/field.png
new file mode 100644
index 000000000..5515f7e66
--- /dev/null
+++ b/src/doclets/html/deps/field.png
Binary files differ
diff --git a/src/doclets/html/deps/interface.png b/src/doclets/html/deps/interface.png
new file mode 100644
index 000000000..83a958809
--- /dev/null
+++ b/src/doclets/html/deps/interface.png
Binary files differ
diff --git a/src/doclets/html/deps/main.css b/src/doclets/html/deps/main.css
new file mode 100644
index 000000000..be46c21c1
--- /dev/null
+++ b/src/doclets/html/deps/main.css
@@ -0,0 +1,265 @@
+ul.external_link {
+}
+
+
+.main_optional_parameter {
+ font-style: italic;
+}
+
+
+
+.main_diagram {
+ display: block;
+ margin: 0px auto;
+ width: 100px;
+}
+
+.site_navi {
+ text-align: right;;
+}
+
+
+div.cms_message {
+}
+
+
+input {
+ border-color: #aaaaff;
+ border-style: solid;
+ border-width: 1px;
+}
+
+
+
+
+.site_header {
+ font-size: 25px;
+ padding-bottom: 10px;
+ padding-top: 10px;
+ background-color: #aaaaff;
+ width: 100%;
+}
+
+
+div {
+ font-family:'Verdana';
+ font-size: 12;
+}
+
+
+.site_title {
+ text-align: left;
+ font-size: 40;
+}
+
+div.site_foother {
+ text-align: center;
+ background-color: #aaaaff;
+ padding-bottom: 5px;
+ padding-top: 5px;
+ width: 100%;
+ clear: left;
+}
+
+
+div.site_body {
+ font-size: 10;
+}
+
+
+div.site_navigation {
+ float: left;
+
+ width: 240px;
+ border-color: #aaaaff;
+ border-style: solid;
+ border-width: 1px;
+ background-color: #eeeeff;
+}
+
+
+.site_content {
+ font-size: 10px;
+ margin-left: 255px;
+ margin-right: 5px;
+ text-align: left;
+}
+
+
+.main_other_type {
+ text-decoration: none;
+ font-style: italic;
+ color: #000000;
+}
+
+.main_basic_type {
+ text-decoration: none;
+ font-weight: bold;
+ color: #2e8b57;
+}
+
+.main_keyword {
+ text-decoration: none;
+ font-weight: bold;
+ color: #a52a2a;
+}
+
+
+div.main_code_definition {
+ padding-right: 10px;
+ padding-left: 10px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+
+ font: monospace;
+ font-size: 10;
+ border-color: #aaaaff;
+ background-color: #eeeeff;
+ border-style: solid;
+ border-width: 1px;
+ margin: 10px;
+}
+
+
+
+
+
+h1.main_title {
+ font-size: 20px;
+ margin-bottom: 0px;
+}
+
+h2.main_title {
+ margin-bottom: 0px;
+}
+
+h3.main_title {
+ margin-bottom: 0px;
+}
+
+.main_hr {
+ border: 0;
+ color: #aaaaff;
+ background-color: #aaaaff;
+ height: 1px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+
+
+
+.main_parameter_table_text, .main_errordomain_table_text, .main_enum_table_text {
+}
+
+.main_parameter_table_name, .main_errordomain_table_name, .main_enum_table_name {
+ vertical-align: top;
+ text-align: right;
+ font-weight: bold;
+ width: 120px;
+ padding-right: 10px;
+}
+
+.main_parameter_table, .main_errordomain_table, .main_enum_table {
+ margin-weight: 20px;
+ margin-left: 20px;
+}
+
+
+
+
+
+
+
+.navi_package_index, .main_inline_navigation_package {
+ list-style-image: url(packages.png)
+}
+.main_navi_enval {
+ list-style-image: url(enumvalue.png)
+}
+.main_navi_errdomcode {
+ list-style-image: url(errorcode.png)
+}
+.navi_construction_method, .main_list_m {
+ list-style-image: url(method.png)
+}
+.navi_error_domain, .main_list_errdom {
+ list-style-image: url(errordomain.png)
+}
+.navi_namespace, .main_list_ns, .main_inline_navigation_namespace {
+ list-style-image: url(namespace.png)
+}
+.navi_method, .main_inline_navigation_method {
+ list-style-image: url(method.png)
+}
+.navi_struct, .main_list_stru {
+ list-style-image: url(struct.png)
+}
+.navi_iface, .main_list_iface {
+ list-style-image: url(interface.png)
+}
+.navi_field, .main_inline_navigation_fields, .main_list_field {
+ list-style-image: url(field.png)
+}
+.navi_class, .main_inline_navigation_class, .main_list_cl {
+ list-style-image: url(class.png)
+}
+.navi_enum, .main_list_en {
+ list-style-image: url(enum.png)
+}
+.navi_prop, .main_inline_navigation_property, .main_list_prop {
+ list-style-image: url(property.png)
+}
+.navi_del, .main_list_del, .main_inline_navigation_delegate {
+ list-style-image: url(delegate.png)
+}
+.navi_sig, .main_inline_navigation_signal, .main_list_sig {
+ list-style-image: url(signal.png)
+}
+.navi_package, .main_inline_navigation_package {
+ list-style-image: url(package.png)
+}
+
+.main_inline_navigation_constant, .navi_constant {
+ list-style-image: url(constant.png)
+}
+
+
+.navi_main {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding-left: 30px;
+}
+
+.navi_hr {
+ border: 0;
+ color: #aaaaff;
+ background-color: #aaaaff;
+ height: 1px;
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+
+
+
+
+a.navi_link, a.external_link {
+ text-decoration: none;
+ color: #214b87;
+}
+
+a.navi_link:hover, a.external_link:hover {
+ text-decoration: underline;
+# color: #ff0000;
+}
+
+
+
+
+.main_see_list {
+}
+
+.main_inline_navigation {
+}
+
diff --git a/src/doclets/html/deps/method.png b/src/doclets/html/deps/method.png
new file mode 100644
index 000000000..516c2ff2c
--- /dev/null
+++ b/src/doclets/html/deps/method.png
Binary files differ
diff --git a/src/doclets/html/deps/namespace.png b/src/doclets/html/deps/namespace.png
new file mode 100644
index 000000000..759846f72
--- /dev/null
+++ b/src/doclets/html/deps/namespace.png
Binary files differ
diff --git a/src/doclets/html/deps/package.png b/src/doclets/html/deps/package.png
new file mode 100644
index 000000000..cc6718776
--- /dev/null
+++ b/src/doclets/html/deps/package.png
Binary files differ
diff --git a/src/doclets/html/deps/packages.png b/src/doclets/html/deps/packages.png
new file mode 100644
index 000000000..d99004a28
--- /dev/null
+++ b/src/doclets/html/deps/packages.png
Binary files differ
diff --git a/src/doclets/html/deps/property.png b/src/doclets/html/deps/property.png
new file mode 100644
index 000000000..3b9641387
--- /dev/null
+++ b/src/doclets/html/deps/property.png
Binary files differ
diff --git a/src/doclets/html/deps/signal.png b/src/doclets/html/deps/signal.png
new file mode 100644
index 000000000..55f19662c
--- /dev/null
+++ b/src/doclets/html/deps/signal.png
Binary files differ
diff --git a/src/doclets/html/deps/struct.png b/src/doclets/html/deps/struct.png
new file mode 100644
index 000000000..2acb79ab4
--- /dev/null
+++ b/src/doclets/html/deps/struct.png
Binary files differ
diff --git a/src/doclets/html/doclet/Makefile.am b/src/doclets/html/doclet/Makefile.am
new file mode 100644
index 000000000..606935d05
--- /dev/null
+++ b/src/doclets/html/doclet/Makefile.am
@@ -0,0 +1,56 @@
+# src/Makefile.am
+
+
+
+libdoclet_VALASOURCES = \
+ template.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libdoclet.vala.stamp
+
+
+libdoclet.vala.stamp: $(libdoclet_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --vapidir . --pkg docletconfig --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+docletdir = $(libdir)/valadoc/plugins/template/
+
+doclet_LTLIBRARIES = libdoclet.la
+
+
+libdoclet_la_SOURCES = \
+ libdoclet.vala.stamp \
+ $(libdoclet_VALASOURCES:.vala=.c) \
+ $(libdoclet_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -DPACKAGE_PLUGINDIR=\"$(libdir)/valadoc/plugins/template/\" \
+ -I ../../../libvaladoc/ \
+ -I ../linkhelper/ \
+ -I ../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libdoclet_la_LDFLAGS = -module -avoid-version
+
+
+libdoclet_la_LIBADD = \
+ ../../../libvaladoc/libvaladoc.la \
+ ../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libdoclet_VALASOURCES) libdoclet.vala.stamp
diff --git a/src/doclets/html/doclet/docletconfig.vapi b/src/doclets/html/doclet/docletconfig.vapi
new file mode 100644
index 000000000..c791c1f04
--- /dev/null
+++ b/src/doclets/html/doclet/docletconfig.vapi
@@ -0,0 +1,7 @@
+
+
+[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "")]
+namespace Config {
+ [CCode (cname = "PACKAGE_PLUGINDIR")]
+ public const string doclet_path;
+}
diff --git a/src/doclets/html/doclet/template.vala b/src/doclets/html/doclet/template.vala
new file mode 100644
index 000000000..129587bad
--- /dev/null
+++ b/src/doclets/html/doclet/template.vala
@@ -0,0 +1,2148 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Gee;
+
+
+
+
+
+public enum WriterState {
+ KEY,
+ STANDARD,
+ NULL
+}
+
+
+
+
+
+
+
+
+public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public LangletIndex ( Settings settings ) {
+ this.settings = settings;
+ }
+
+ private Basic position = null;
+
+ private inline bool is_basic_type ( string name ) {
+ string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort",
+ "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32",
+ "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string"
+ };
+
+ foreach ( string str in basic_types ) {
+ if ( str == name )
+ return true;
+ }
+
+ return false;
+ }
+
+ private void write_type_name ( DataType? datatype, GLib.FileStream file ) {
+ if ( datatype == null ) {
+ file.printf ( "<font class=\"%s\">void</font>", css_keyword );
+ return ;
+ }
+
+ string typename = datatype.full_name ();
+ if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) {
+ if ( this.is_basic_type ( typename ) ) {
+ string link = this.get_link(datatype, this.position );
+ if ( link == null )
+ file.printf ( "<span class=\"%s\">%s</span>", css_basic_type, typename );
+ else
+ file.printf ( "<a class=\"%s\" href=\"%s\">%s</a>", css_basic_type, link, typename );
+ return ;
+ }
+ }
+
+ string link = this.get_link(datatype, this.position);
+ if ( link == null )
+ file.printf ( "<span class=\"%s\">%s</span>", css_other_type, typename );
+ else
+ file.printf ( "<a class=\"%s\" href=\"%s\">%s</a>", css_other_type, link, typename );
+ }
+
+ private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) {
+ if ( type_reference.type_name == "void" ) {
+ file.printf ( "<font class=\"%s\">void</font>", css_keyword );
+ }
+ else {
+ if ( type_reference.data_type == null ) {
+ file.printf ( "<font class=\"%s\">%s</font>", css_other_type, type_reference.type_name );
+ }
+ else {
+ this.write_type_name ( type_reference.data_type, file );
+ }
+ }
+ }
+
+ private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) {
+ Gee.Collection<TypeReference> arglst = type_reference.get_type_arguments ( );
+ int size = arglst.size;
+ if ( size == 0 )
+ return ;
+
+ file.puts ( "<" );
+ int i = 0;
+
+ foreach ( TypeReference arg in arglst ) {
+ i++;
+
+ this.write_nested_type_referene ( arg, file );
+ if ( i != size )
+ file.puts ( ", " );
+ }
+
+ file.puts ( ">" );
+ }
+
+ private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) {
+ if ( type_reference.type_name == null )
+ return ;
+
+ if ( type_reference.is_weak )
+ file.printf ( "<font class=\"%s\">weak</font> ", css_keyword );
+
+ this.write_type_reference_name ( type_reference, file );
+ this.write_type_reference_template_arguments ( type_reference, file );
+
+ if ( type_reference.is_array ) {
+ string str = string.nfill ( type_reference.array_rank-1, ',');
+ file.printf ( "[%s]", str );
+ }
+
+ if ( type_reference.pass_ownership ) {
+ file.putc ( '#' );
+ }
+
+ if ( type_reference.is_nullable ) {
+ file.putc ( '?' );
+ }
+
+ string str = string.nfill ( type_reference.pointer_rank, '*' );
+ file.puts ( str );
+
+ }
+
+ public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ if ( type_reference == null )
+ return ;
+
+ this.write_nested_type_referene ( type_reference, file );
+ file.putc ( ' ' );
+
+ /*
+ if ( type_reference.is_weak ) {
+ file.printf ( "<font class=\"%s\">weak</font> ", css_keyword );
+ }
+
+ this.write_type_name ( type_reference.data_type, file );
+
+ if ( type_reference.is_array ) {
+ string str = string.nfill ( type_reference.array_rank-1, ',');
+ file.printf ( "[%s]", str );
+ }
+
+ if ( type_reference.pass_ownership ) {
+ file.putc ( '#' );
+ }
+
+ if ( type_reference.is_nullable ) {
+ file.putc ( '?' );
+ }
+
+ string str = string.nfill ( type_reference.pointer_rank, '*' );
+ file.puts ( str );
+ */
+ }
+
+ private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) {
+ if ( param.ellipsis ) {
+ file.puts ( " ..." );
+ }
+ else {
+ if ( param.is_out )
+ file.printf ( "<span class=\"%s\">out</span> ", css_keyword );
+ else if ( param.is_ref )
+ file.printf ( "<span class=\"%s\">ref</span> ", css_keyword );
+
+ this.write_type_reference ( param.type_reference, file );
+ file.printf ( " %s", param.name );
+ }
+ }
+
+ public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ bool open_bracket = false;
+
+ Gee.ArrayList<FormalParameter> params = thandler.param_list;
+ int size = params.size;
+ int i = 0;
+
+ file.putc ( '(' );
+
+ foreach ( FormalParameter param in params ) {
+ i++;
+
+ if ( param.default_value != null && open_bracket == false ) {
+ file.printf ( "<span class=\"%s\">[", css_optional_parameter );
+ open_bracket = true;
+ }
+
+ this.write_formal_parameter ( param, file );
+ if ( i != size ) {
+ file.puts ( ", " );
+ }
+ else if ( open_bracket == true ) {
+ file.puts ( "]</span>" );
+ }
+ }
+
+ file.putc ( ')' );
+ }
+
+ private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) {
+ Gee.ReadOnlyCollection<TypeReference> error_domains = exception_handler.get_error_domains ();
+ int size = error_domains.size;
+ int i = 1;
+
+ if ( size == 0 )
+ return ;
+
+ file.printf ( " <span class=\"%s\">throws</span> ", css_keyword );
+
+ foreach ( TypeReference type_reference in error_domains ) {
+ if ( type_reference == null ) {
+ file.printf ( "<span class=\"%s\">GLib.Error</span>", css_other_type );
+ }
+ else {
+ this.write_type_reference ( type_reference, file );
+ }
+
+ if ( error_domains.size > i ) {
+ file.puts ( ", " );
+ }
+ i++;
+ }
+ }
+
+ public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) {
+ this.position = m;
+
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( m, file );
+
+ if ( m.is_abstract )
+ modifiers.append ( " abstract" );
+ if ( m.is_virtual )
+ modifiers.append ( " virtual" );
+ if ( m.is_override )
+ modifiers.append ( " override" );
+ if ( m.is_static )
+ modifiers.append ( " static" );
+ if ( m.is_inline )
+ modifiers.append ( " inline" );
+
+ file.printf ( " <span class=\"%s\">%s</span> ", css_keyword, modifiers.str );
+ this.write_type_reference ( m.return_type, file );
+ file.puts ( m.name );
+ file.puts ( " " );
+ this.write_parameter_list ( m, file );
+ this.write_exception_list ( m, file );
+ }
+
+ public override void write_type_parameter ( TypeParameter param, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.puts ( param.datatype_name );
+ }
+
+ public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ int i = 1;
+
+ var lst = thandler.get_template_param_list( );
+ if ( lst.size == 0 )
+ return ;
+
+ file.puts ( "&lt;" ); // <
+
+
+ foreach ( TypeParameter param in lst ) {
+ param.write ( this, file );
+ if ( lst.size > i )
+ file.puts ( ", " );
+
+ i++;
+ }
+ file.puts ( "&gt;" ); // >
+ }
+
+ public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) {
+ this.position = field;
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( field, file );
+
+ if ( field.is_volatile )
+ file.printf ( " <span class=\"%s\">volatile</span>", css_keyword );
+
+ this.write_type_reference ( field.type_reference, file );
+
+ file.printf ( " %s", field.name );
+ }
+
+ public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) {
+ this.position = constant;
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( constant, file );
+ file.printf ( " <span class=\"%s\"> const </span>", css_keyword );
+ this.write_type_reference ( constant.type_reference, file );
+ file.printf ( " %s", constant.name );
+ }
+
+ public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ Property prop = (Property)propac.parent;
+
+ if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) {
+ // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.)
+ if ( propac.is_public )
+ file.printf ( "<span class=\"%s\">public</span> ", css_keyword );
+ else if ( propac.is_protected )
+ file.printf ( "<span class=\"%s\">protected</span> ", css_keyword );
+ else if ( propac.is_private )
+ file.printf ( "<span class=\"%s\">private</span> ", css_keyword );
+ }
+
+
+ if ( propac.is_get ) {
+ file.printf ( "<span class=\"%s\"> get</span>;", css_keyword );
+ }
+ else if ( propac.is_set ) {
+ if ( propac.is_construct ) {
+ file.printf ( "<span class=\"%s\"> construct</span> ", css_keyword );
+ }
+
+ file.printf ( "<span class=\"%s\"> set</span>;", css_keyword );
+ }
+ }
+
+ public override void write_property ( Valadoc.Property prop, void* ptr ) {
+ this.position = prop;
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( prop, file );
+
+ if ( prop.is_virtual )
+ modifiers.append ( " virtual " );
+ if ( prop.is_abstract )
+ modifiers.append ( " abstract " );
+ if ( prop.is_override )
+ modifiers.append ( " override " );
+
+
+ this.write_type_reference ( prop.return_type, file );
+ file.printf ( " <span class=\"%s\">%s</span>%s { ", css_keyword, modifiers.str, prop.name );
+
+ if ( prop.setter != null )
+ this.write_property_accessor ( prop.setter, file );
+
+
+ file.printf ( " " );
+
+ if ( prop.getter != null )
+ this.write_property_accessor ( prop.getter, file );
+
+ file.printf ( " }" );
+ }
+
+ public override void write_signal ( Valadoc.Signal sig, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = sig;
+
+ this.write_accessor ( sig, file );
+
+ file.printf ( " <span class=\"%s\">signal</span> ", css_keyword );
+ this.write_type_reference ( sig.return_type, file );
+ file.printf ( " %s ", sig.name );
+ this.write_parameter_list ( sig, file );
+ }
+
+ public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) {
+ }
+
+ public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) {
+ }
+
+ public override void write_delegate ( Valadoc.Delegate del, void* ptr ) {
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = del;
+
+ this.write_accessor ( del, file );
+
+ file.printf ( " <span class=\"%s\">delegate</span> ", css_keyword );
+ this.write_type_reference ( del.return_type, file );
+ file.printf ( " %s ", del.name );
+ this.write_parameter_list ( del, file );
+ this.write_exception_list ( del, file );
+ }
+
+ public override void write_enum ( Valadoc.Enum en, void* ptr ) {
+ }
+
+ public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) {
+ }
+
+ private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) {
+ if ( element.is_public )
+ file.printf ( "<span class=\"%s\">public</span> ", css_keyword );
+ else if ( element.is_protected )
+ file.printf ( "<span class=\"%s\">protected</span> ", css_keyword );
+ else if ( element.is_private )
+ file.printf ( "<span class=\"%s\">private</span> ", css_keyword );
+ }
+
+
+ public override void write_struct ( Valadoc.Struct stru, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = stru;
+
+ this.write_accessor ( stru, file );
+ file.printf ( "<span class=\"%s\">struct</span> %s", css_keyword, stru.name );
+ this.write_template_parameters ( stru, ptr );
+ this.write_inheritance_list ( stru, file );
+ }
+
+ private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) {
+ Gee.Collection<DataType> lst = dtype.get_parent_types ( );
+ int size = lst.size;
+ int i = 1;
+
+ if ( size == 0 )
+ return ;
+
+ file.puts ( " : " );
+
+ foreach ( DataType cntype in lst ) {
+ this.write_type_name ( cntype, file );
+ if ( size > i )
+ file.puts ( ", " );
+
+ i++;
+ }
+
+ file.putc ( ' ' );
+ }
+
+ public override void write_class ( Valadoc.Class cl, void* ptr ) {
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = cl;
+
+ this.write_accessor ( cl, file );
+
+ if ( cl.is_abstract )
+ modifiers.append ( "abstract " );
+ else if ( cl.is_static )
+ modifiers.append ( "static " );
+
+ file.printf ( "<span class=\"%s\">%s class</span> %s", css_keyword, modifiers.str, cl.name );
+
+ this.write_template_parameters ( cl, file );
+ this.write_inheritance_list ( cl, file );
+ }
+
+ public override void write_interface ( Valadoc.Interface iface, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = iface;
+
+ this.write_accessor ( iface, file );
+
+ if ( iface.is_static )
+ file.printf ( "<span class=\"%s\">static interface</span> %s", css_keyword, iface.name );
+ else
+ file.printf ( "<span class=\"%s\">interface</span> %s", css_keyword, iface.name );
+
+ this.write_template_parameters ( iface, ptr );
+ this.write_inheritance_list ( iface, file );
+ }
+
+ public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
+ }
+
+ public override void write_file ( Valadoc.File file, void* ptr ) {
+ }
+}
+
+
+
+
+private class NamespaceBundle : Object {
+ public Namespace creation_namespace { construct set; get; }
+ public NamespaceBundle? parent { construct set; get; }
+ public string? name { construct set; get; }
+ public string path { construct set; get; }
+
+ public Gee.ArrayList<NamespaceBundle> subnamespaces = new Gee.ArrayList<NamespaceBundle> ();
+
+ public string full_name () {
+ return this.creation_namespace.full_name ();
+ }
+
+ public NamespaceBundle ( string path, string? name, Namespace creation_namespace, NamespaceBundle? parent = null ) {
+ this.creation_namespace = creation_namespace;
+ this.parent = parent;
+ this.name = name;
+ this.path = path;
+ }
+
+ private NamespaceBundle get_namespace_bundle ( Namespace ns ) {
+ foreach ( NamespaceBundle bundle in this.subnamespaces ) {
+ if ( this.name == ns.name ) {
+ return bundle;
+ }
+ }
+
+ NamespaceBundle nsbundle = new NamespaceBundle ( this.path + ns.name + "/", ns.name, ns, this );
+ this.subnamespaces.add ( nsbundle );
+ return nsbundle;
+ }
+
+ public Gee.ArrayList<ErrorDomain> errordomains = new Gee.ArrayList<ErrorDomain> ();
+ public Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface> ();
+ public Gee.ArrayList<Struct> structs = new Gee.ArrayList<Struct> ();
+ public Gee.ArrayList<Class> classes = new Gee.ArrayList<Class> ();
+ public Gee.ArrayList<Enum> enums = new Gee.ArrayList<Enum> ();
+
+ public Gee.ArrayList<Constant> constants = new Gee.ArrayList<Constant> ();
+ public Gee.ArrayList<Delegate> delegates = new Gee.ArrayList<Delegate> ();
+ public Gee.ArrayList<Method> methods = new Gee.ArrayList<Method> ();
+ public Gee.ArrayList<Field> fields = new Gee.ArrayList<Field> ();
+
+ public void merge_namespace ( Namespace ns ) {
+ Gee.Collection<Namespace> subnamespaces = ns.get_namespace_list ();
+ foreach ( Namespace subns in subnamespaces ) {
+ NamespaceBundle nsbundle = this.get_namespace_bundle ( subns );
+ nsbundle.merge_namespace ( subns );
+ }
+
+ Gee.Collection<ErrorDomain> errordomains = ns.get_error_domain_list ();
+ foreach ( ErrorDomain errdom in errordomains ) {
+ this.errordomains.add ( errdom );
+ }
+
+ Gee.Collection<Interface> interfaces = ns.get_interface_list ();
+ foreach ( Interface iface in interfaces ) {
+ this.interfaces.add ( iface );
+ }
+
+ Gee.Collection<Struct> structs = ns.get_struct_list ();
+ foreach ( Struct stru in structs ) {
+ this.structs.add ( stru );
+ }
+
+ Gee.Collection<Class> classes = ns.get_class_list ();
+ foreach ( Class cl in classes ) {
+ this.classes.add ( cl );
+ }
+
+ Gee.Collection<Enum> enums = ns.get_enum_list ();
+ foreach ( Enum en in enums ) {
+ this.enums.add ( en );
+ }
+
+ Gee.Collection<Constant> constants = ns.get_constant_list ();
+ foreach ( Constant c in constants ) {
+ this.constants.add ( c );
+ }
+
+ Gee.Collection<Delegate> delegates = ns.get_delegate_list ();
+ foreach ( Delegate d in delegates ) {
+ this.delegates.add ( d );
+ }
+
+ Gee.Collection<Method> methods = ns.get_method_list ();
+ foreach ( Method m in methods ) {
+ this.methods.add ( m );
+ }
+
+ Gee.Collection<Field> fields = ns.get_field_list ();
+ foreach ( Field f in fields ) {
+ this.fields.add ( f );
+ }
+ }
+}
+
+
+
+
+
+
+public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
+ private Valadoc.LangletIndex langlet;
+
+ private string current_path = null;
+ private string package_name = null;
+ private bool is_vapi = false;
+
+ private int directory_level = 1;
+
+ private void write_navi_entry_html_template ( GLib.FileStream file, string style, string content ) {
+ file.printf ( "\t<li class=\"%s\">%s</li>\n", style, content );
+ }
+
+ private void write_navi_entry_html_template_with_link ( GLib.FileStream file, string style, string link, string content ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", style, css_navi_link, link, content );
+ }
+
+ private void write_navi_entry ( GLib.FileStream file, Basic element, Basic pos, string style, bool link, bool full_name = false ) {
+ string name;
+
+ if ( element is File ) {
+ string path = this.get_file_name ( element );
+ name = this.get_package_name ( path );
+ }
+ else if ( full_name == true && element is Namespace ) {
+ string tmp = ((Namespace)element).full_name ();
+ name = (element.name == null)? "Global Namespace" : tmp;
+ }
+ else {
+ string tmp = element.name;
+ name = (tmp == null)? "Global Namespace" : tmp;
+ }
+
+ if ( link == true )
+ this.write_navi_entry_html_template_with_link ( file, style, this.get_link (element, pos), name );
+ else
+ this.write_navi_entry_html_template ( file, style, name );
+ }
+
+ private void write_navi_top_entry ( GLib.FileStream file, Basic element, Basic mself ) {
+ string name = (element.name == null)? "Global Namespace" : element.name;
+ string style = null;
+
+ if ( element is Namespace )
+ style = css_navi_namespace;
+ else if ( element is Enum )
+ style = css_navi_enum;
+ else if ( element is ErrorDomain )
+ style = css_navi_error_domain;
+ else if ( element is Struct )
+ style = css_navi_struct;
+ else if ( element is Class )
+ style = css_navi_class;
+ else if ( element is Interface )
+ style = css_navi_iface;
+ else if ( element is File ) {
+ name = this.get_package_name ( element.name );
+ style = css_navi_package;
+ }
+
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ if ( element == mself )
+ this.write_navi_entry ( file, element, mself, style, false );
+ else
+ this.write_navi_entry ( file, element, mself, style, true );
+
+ file.puts ( "</ul>\n" );
+ file.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+ }
+
+
+ private void write_top_element_template ( GLib.FileStream file, string link ) {
+ file.printf ( "<ul class=\"%s\">\n\t\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">Packages</a></li>\n</ul>\n<hr class=\"%s\">\n", css_navi, css_navi_package_index, css_navi_link, link, css_navi_hr );
+ }
+
+ private void write_top_element ( GLib.FileStream file, Basic pos ) {
+ string top = this.get_top_link ( pos );
+ this.write_top_element_template ( file, top+"index.html" );
+ }
+
+ private void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself ) {
+ Gee.ArrayList<Basic> lst = new Gee.ArrayList<Basic> ();
+ Basic pos = element;
+
+ if ( mself == null )
+ mself = element;
+
+ string file_name = this.get_file_name ( element );
+ string package_name = this.get_package_name ( file_name );
+
+ this.write_top_element ( file, mself );
+
+ while ( pos != null ) {
+ lst.add ( pos );
+ pos = pos.parent;
+ }
+
+ for ( int i = lst.size-1; i >= 0 ; i-- ) {
+ Basic el = lst.get ( i );
+ this.write_navi_top_entry ( file, el, mself );
+ }
+ }
+
+
+ private void fetch_subnamespace_names ( NamespaceHandler pos, Gee.ArrayList<Namespace> lst ) {
+ Gee.ReadOnlyCollection<Namespace> nspaces = pos.get_namespace_list ();
+
+ foreach ( Namespace ns in nspaces ) {
+ lst.add ( ns );
+ this.fetch_subnamespace_names ( ns, lst );
+ }
+ }
+
+ private void write_navi_file ( GLib.FileStream file, File efile ) {
+ Gee.ArrayList<Namespace> ns_list = new Gee.ArrayList<Namespace> ();
+ this.fetch_subnamespace_names (efile, ns_list );
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_element_template ( file, "../index.html" );
+ file.printf ( "\t\t\t\t<ul class=\"%s\">\n", css_navi );
+
+ foreach ( Namespace ns in ns_list ) {
+ this.write_navi_entry ( file, ns, efile, css_navi_namespace, true, true );
+ }
+
+ file.puts ( "\t\t\t\t</ul>\n" );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_namespace ( GLib.FileStream file, Namespace ns ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, ns, ns );
+ this.write_navi_child_namespaces_inline ( file, ns, ns );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_namespaces_without_childs ( file, ns, mself );
+ this.write_navi_child_error_domains_without_childs ( file, ns, mself );
+ this.write_navi_child_enums_without_childs ( file, ns, mself );
+ this.write_navi_child_classes_without_childs ( file, ns, mself );
+ this.write_navi_child_interfaces_without_childs ( file, ns, mself );
+ this.write_navi_child_structs_without_childs ( file, ns, mself );
+ this.write_navi_child_delegates ( file, ns, mself );
+ this.write_navi_child_constants ( file, ns, mself );
+ this.write_navi_child_fields ( file, ns, mself );
+ this.write_navi_child_methods ( file, ns, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_child_namespaces ( GLib.FileStream file, Namespace ns, Basic mself ) {
+ this.write_top_elements ( file, ns, mself );
+ this.write_navi_child_namespaces_inline ( file, ns, mself );
+ }
+
+ private void write_navi_struct_inline ( GLib.FileStream file, Struct stru, Basic mself ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_constants ( file, stru, mself );
+ this.write_navi_child_construction_methods ( file, stru, mself );
+ this.write_navi_child_fields ( file, stru, mself );
+ this.write_navi_child_methods ( file, stru, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_struct ( GLib.FileStream file, Struct stru, Basic mself ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, stru, mself );
+ this.write_navi_struct_inline ( file, stru, mself );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_interface_inline ( GLib.FileStream file, Interface iface, Basic mself ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_delegates ( file, iface, mself );
+ this.write_navi_child_fields ( file, iface, mself );
+ this.write_navi_child_properties ( file, iface, mself );
+ this.write_navi_child_methods ( file, iface, mself );
+ this.write_navi_child_signals ( file, iface, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_interface ( GLib.FileStream file, Interface iface, Basic mself ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, iface, mself );
+ this.write_navi_interface_inline ( file, iface, mself );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_enum_inline ( GLib.FileStream file, Enum en, Basic mself ) {
+ Gee.ReadOnlyCollection<EnumValue> enum_values = en.get_enum_values ( );
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ foreach ( EnumValue env in enum_values ) {
+ this.write_navi_entry ( file, env, mself, css_navi_enval, true );
+ }
+
+ this.write_navi_child_methods ( file, en, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_enum ( GLib.FileStream file, Enum en, Basic mself ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, en, mself );
+ this.write_navi_enum_inline ( file, en, mself );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_error_domain_inline ( GLib.FileStream file, ErrorDomain errdom, Basic mself ) {
+ Gee.ReadOnlyCollection<ErrorCode> error_codes = errdom.get_error_code_list ( );
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ foreach ( ErrorCode ec in error_codes ) {
+ this.write_navi_entry ( file, ec, mself, css_navi_errdomcode, true );
+ }
+
+ this.write_navi_child_methods ( file, errdom, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_error_domain ( GLib.FileStream file, ErrorDomain errdom, Basic mself ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, errdom, mself );
+ this.write_navi_error_domain_inline ( file, errdom, mself );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_class_inline ( GLib.FileStream file, Class cl, Basic mself ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_enums_without_childs ( file, cl, mself );
+ this.write_navi_child_classes_without_childs ( file, cl, mself );
+ this.write_navi_child_structs_without_childs ( file, cl, mself );
+ this.write_navi_child_delegates ( file, cl, mself );
+ this.write_navi_child_constants ( file, cl, mself );
+ this.write_navi_child_construction_methods ( file, cl, mself );
+ this.write_navi_child_fields ( file, cl, mself );
+ this.write_navi_child_properties ( file, cl, mself );
+ this.write_navi_child_methods ( file, cl, mself );
+ this.write_navi_child_signals ( file, cl, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_class ( GLib.FileStream file, Class cl, Basic mself ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, cl, mself );
+ this.write_navi_class_inline ( file, cl, mself );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_method ( GLib.FileStream file, Method m ) {
+ Basic parent = m.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+
+ this.write_top_elements ( file, parent, m );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, m );
+ else if ( m.parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, m );
+ else if ( m.parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, m );
+ else if ( m.parent is Enum )
+ this.write_navi_enum_inline ( file, (Enum)parent, m );
+ else if ( m.parent is ErrorDomain )
+ this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m );
+ else if ( m.parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_property ( GLib.FileStream file, Property prop ) {
+ Basic parent = prop.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, prop.parent, prop );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, prop );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, prop );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_signal ( GLib.FileStream file, Signal sig ) {
+ Basic parent = sig.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+
+ this.write_top_elements ( file, sig.parent, sig );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, sig );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, sig );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_constant ( GLib.FileStream file, Constant c ) {
+ Basic parent = c.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, parent, c );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, c );
+ else if ( parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, c );
+ else if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c );
+ //else if ( parent is Interface )
+ // this.write_navi_interface_inline ( file, (Interface)parent, c );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_field ( GLib.FileStream file, Field f ) {
+ Basic parent = f.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, parent, f );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, f );
+ else if ( parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, f );
+ else if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, f );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_navi_delegate ( GLib.FileStream file, Delegate del ) {
+ Basic parent = del.parent;
+
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_elements ( file, parent, del );
+
+ if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del );
+ else if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, del );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, del );
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+
+ private void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection<Method> methods, Basic mself ) {
+ foreach ( Method m in methods ) {
+ if ( m == mself )
+ this.write_navi_entry ( file, m, mself, css_navi_construction_method, false );
+ else
+ this.write_navi_entry ( file, m, mself, css_navi_construction_method, true );
+ }
+ }
+
+ private void write_navi_child_methods ( GLib.FileStream file, MethodHandler mh, Basic mself ) {
+ Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ( );
+ this.write_navi_child_methods_collection ( file, methods, mself );
+ }
+
+ private void write_navi_child_classes_without_childs_collection ( GLib.FileStream file, Gee.Collection<Class> classes, Basic mself ) {
+ foreach ( Class cl in classes ) {
+ if ( cl == mself )
+ this.write_navi_entry ( file, cl, mself, css_navi_class, false );
+ else
+ this.write_navi_entry ( file, cl, mself, css_navi_class, true );
+ }
+ }
+
+ private void write_navi_child_classes_without_childs ( GLib.FileStream file, ClassHandler clh, Basic mself ) {
+ Gee.ReadOnlyCollection<Class> classes = clh.get_class_list ( );
+ this.write_navi_child_classes_without_childs_collection ( file, classes, mself );
+ }
+
+ private void write_navi_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic mself ) {
+ Gee.ReadOnlyCollection<Method> methods = cmh.get_construction_method_list ( );
+ this.write_navi_child_methods_collection ( file, methods, mself );
+ }
+
+ private void write_navi_child_signals ( GLib.FileStream file, SignalHandler sh, Basic mself ) {
+ Gee.ReadOnlyCollection<Signal> signals = sh.get_signal_list ( );
+
+ foreach ( Signal sig in signals ) {
+ if ( sig == mself )
+ this.write_navi_entry ( file, sig, mself, css_navi_sig, false );
+ else
+ this.write_navi_entry ( file, sig, mself, css_navi_sig, true );
+ }
+ }
+
+ private void write_navi_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic mself ) {
+ Gee.ReadOnlyCollection<Property> properties = ph.get_property_list ( );
+
+ foreach ( Property p in properties ) {
+ if ( p == mself )
+ this.write_navi_entry ( file, p, mself, css_navi_prop, false );
+ else
+ this.write_navi_entry ( file, p, mself, css_navi_prop, true );
+ }
+ }
+
+ private void write_navi_child_fields_collection ( GLib.FileStream file, Gee.Collection<Field> fields, Basic mself ) {
+ foreach ( Field f in fields ) {
+ if ( f == mself )
+ this.write_navi_entry ( file, f, mself, css_navi_field, false );
+ else
+ this.write_navi_entry ( file, f, mself, css_navi_field, true );
+ }
+ }
+
+ private void write_navi_child_fields ( GLib.FileStream file, FieldHandler fh, Basic mself ) {
+ Gee.ReadOnlyCollection<Field> fields = fh.get_field_list ( );
+ this.write_navi_child_fields_collection ( file, fields, mself );
+ }
+
+ private void write_navi_child_constants_collection ( GLib.FileStream file, Gee.Collection<Constant> constants, Basic mself ) {
+ foreach ( Constant c in constants ) {
+ if ( c == mself )
+ this.write_navi_entry ( file, c, mself, css_navi_constant, false );
+ else
+ this.write_navi_entry ( file, c, mself, css_navi_constant, true );
+ }
+ }
+
+ private void write_navi_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic mself ) {
+ Gee.ReadOnlyCollection<Constant> constants = ch.get_constant_list ( );
+ this.write_navi_child_constants_collection ( file, constants, mself );
+ }
+
+ private void write_navi_child_structs_without_childs_collection ( GLib.FileStream file, Gee.Collection<Struct> structs, Basic mself ) {
+ foreach ( Struct stru in structs ) {
+ if ( stru == mself )
+ this.write_navi_entry ( file, stru, mself, css_navi_struct, false );
+ else
+ this.write_navi_entry ( file, stru, mself, css_navi_struct, true );
+ }
+ }
+
+ private void write_navi_child_structs_without_childs ( GLib.FileStream file, StructHandler strh, Basic mself ) {
+ Gee.Collection<Struct> structs = strh.get_struct_list ( );
+ this.write_navi_child_structs_without_childs_collection ( file, structs, mself );
+ }
+
+ private void write_navi_child_delegates_collection ( GLib.FileStream file, Gee.Collection<Delegate> delegates, Basic mself ) {
+ foreach ( Delegate del in delegates ) {
+ if ( del == mself )
+ this.write_navi_entry ( file, del, mself, css_navi_del, false );
+ else
+ this.write_navi_entry ( file, del, mself, css_navi_del, true );
+ }
+ }
+
+ private void write_navi_child_delegates ( GLib.FileStream file, DelegateHandler delh, Basic mself ) {
+ Gee.Collection<Delegate> delegates = delh.get_delegate_list ( );
+ this.write_navi_child_delegates_collection ( file, delegates, mself );
+ }
+
+ private void write_navi_child_interfaces_without_childs_collection ( GLib.FileStream file, Gee.Collection<Interface> interfaces, Basic mself ) {
+ foreach ( Interface iface in interfaces ) {
+ if ( iface == mself )
+ this.write_navi_entry ( file, iface, mself, css_navi_iface, false );
+ else
+ this.write_navi_entry ( file, iface, mself, css_navi_iface, true );
+ }
+ }
+
+ private void write_navi_child_interfaces_without_childs ( GLib.FileStream file, Namespace ifh, Basic mself ) {
+ Gee.Collection<Interface> interfaces = ifh.get_interface_list ( );
+ this.write_navi_child_interfaces_without_childs_collection ( file, interfaces, mself );
+ }
+
+ private void write_navi_child_enums_without_childs_collection ( GLib.FileStream file, Gee.Collection<Enum> enums, Basic mself ) {
+ foreach ( Enum en in enums ) {
+ if ( en == mself )
+ this.write_navi_entry ( file, en, mself, css_navi_enum, false );
+ else
+ this.write_navi_entry ( file, en, mself, css_navi_enum, true );
+ }
+ }
+
+ private void write_navi_child_enums_without_childs ( GLib.FileStream file, EnumHandler eh, Basic mself ) {
+ Gee.Collection<Enum> enums = eh.get_enum_list ( );
+ this.write_navi_child_enums_without_childs_collection ( file, enums, mself );
+ }
+
+ private void write_navi_child_error_domains_without_childs_collection ( GLib.FileStream file, Gee.Collection<ErrorDomain> errordomains, Basic mself ) {
+ foreach ( ErrorDomain errdom in errordomains ) {
+ if ( errdom == mself )
+ this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, false );
+ else
+ this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, true );
+ }
+ }
+
+ private void write_navi_child_error_domains_without_childs ( GLib.FileStream file, Namespace errdomh, Basic mself ) {
+ Gee.Collection<ErrorDomain> errordomains = errdomh.get_error_domain_list ( );
+ this.write_navi_child_error_domains_without_childs_collection ( file, errordomains, mself );
+ }
+
+ private void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself ) {
+ Gee.ReadOnlyCollection<Namespace> namespaces = nsh.get_namespace_list ( );
+ foreach ( Namespace ns in namespaces ) {
+ if ( ns == mself )
+ this.write_navi_entry ( file, ns, mself, css_navi_namespace, false );
+ else
+ this.write_navi_entry ( file, ns, mself, css_navi_namespace, true );
+ }
+ }
+
+ private string get_full_path ( Basic element ) {
+ if ( element.name == null )
+ return "";
+
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+
+ for ( var pos = element; pos != null ; pos = pos.parent ) {
+ if ( pos is File )
+ break;
+
+ str.prepend_unichar ( '/' );
+
+ if ( pos.name == null )
+ str.prepend ( "0" );
+ else
+ str.prepend ( pos.name );
+ }
+
+ string file_path = get_file_name ( element );
+ string package_name = get_package_name ( file_path ) + "/";
+
+ str.prepend ( package_name );
+ str.append_unichar ( '/' );
+ return str.str;
+ }
+
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public override void initialisation ( Settings settings ) {
+ this.settings = settings;
+
+ var rt = DirUtils.create ( this.settings.path, 0777 );
+ this.langlet = new Valadoc.LangletIndex ( settings );
+ }
+
+ private void write_image_block ( GLib.FileStream file, DataType element ) {
+ string realimgpath = this.current_path + "tree.png";
+ string imgpath = "tree.png";
+
+ if ( element is Class ) {
+ Diagrams.write_class_diagram ( (Class)element, realimgpath );
+ }
+ else if ( element is Interface ) {
+ Diagrams.write_interface_diagram ( (Interface)element, realimgpath );
+ }
+ else if ( element is Struct ) {
+ Diagrams.write_struct_diagram ( (Struct)element, realimgpath );
+ }
+
+ file.printf ( "<h2 cass=\"%s\">Object Hierarchy:</h2>\n", css_title );
+ file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
+ }
+
+ private void write_file_content ( GLib.FileStream file, File f ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, this.package_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private Gee.ArrayList<File> files = new Gee.ArrayList<File> ();
+
+ public override void visit_file ( File file ) {
+ this.package_name = this.get_package_name ( file.name );
+ this.is_vapi = file.name.has_suffix (".vapi");
+ this.files.add ( file );
+
+ string new_path = this.settings.path + this.package_name + "/";
+ bool dir_exists = FileUtils.test ( new_path, FileTest.EXISTS);
+
+ if ( !dir_exists ) {
+ var rt = DirUtils.create ( new_path, 0777 );
+
+ GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" );
+ this.write_file_header ( sfile );
+ this.write_navi_file ( sfile, file );
+ this.write_file_content ( sfile, file );
+ this.write_file_footer ( sfile );
+ sfile = null;
+ }
+
+ this.current_path = new_path;
+ file.visit_namespaces ( this );
+ this.current_path = null;
+ }
+
+
+// private Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
+// globale Funktionen
+// globale Konstante
+// globale Delegates
+// globale Felder
+
+ private Gee.ArrayList<NamespaceBundle> namespaces = new Gee.ArrayList<NamespaceBundle> ();
+
+ private void add_namespace_bundle ( Namespace ns ) {
+ if ( ns.parent is Namespace )
+ return ;
+
+ foreach ( NamespaceBundle bundle in this.namespaces ) {
+ if ( bundle.name == ns.name ) {
+ bundle.merge_namespace ( ns );
+ return ;
+ }
+ }
+
+ NamespaceBundle bundle = new NamespaceBundle ( this.current_path, ns.name, ns );
+ this.namespaces.add ( bundle );
+ bundle.merge_namespace ( ns );
+ }
+
+ private void write_navi_namespace_bundle_path_navigation ( NamespaceBundle nsbundle, GLib.FileStream navi, Basic mself ) {
+ this.directory_level++;
+
+ string top_link = this.get_top_link ( (mself == null)? nsbundle.creation_namespace : mself );
+
+ Gee.ArrayList<NamespaceBundle> parents = new Gee.ArrayList<NamespaceBundle> ();
+ for ( NamespaceBundle nsb = nsbundle.parent; nsb != null ; nsb = nsb.parent ) {
+ parents.insert ( 0, nsb );
+ }
+
+ navi.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
+ this.write_top_element ( navi, mself );
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_package, top_link + this.package_name + "/index.html", this.package_name );
+ navi.puts ( "</ul>\n" );
+ navi.printf ( "<hr class=\"%s\">\n", css_navi_hr );
+
+ int indent = parents.size;
+
+ foreach ( NamespaceBundle nsb in parents ) {
+ string ns_link = "";
+
+ for ( int i = 0; indent > i ; i++ )
+ ns_link += "../";
+
+ ns_link += "index.html";
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, ns_link, (nsb.name == null)? "Global Namespace" : nsb.name );
+ navi.puts ( "</ul>\n" );
+ navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+ }
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ if ( mself.name == nsbundle.name ) {
+ this.write_navi_entry_html_template ( navi, css_navi_namespace, (nsbundle.name == null)? "Global Namespace" : nsbundle.name );
+ }
+ else {
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, "../index.html", (nsbundle.name == null)? "Global Namespace" : nsbundle.name );
+ }
+ navi.puts ( "</ul>\n" );
+ navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ foreach ( NamespaceBundle nsb in nsbundle.subnamespaces ) {
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.name + "/index.html", (nsb.name == null)? "Global Namespace" : nsb.name );
+ }
+ this.write_navi_child_classes_without_childs_collection ( navi, nsbundle.classes, mself );
+ this.write_navi_child_methods_collection ( navi, nsbundle.methods, mself );
+ this.write_navi_child_fields_collection ( navi, nsbundle.fields, mself );
+ this.write_navi_child_constants_collection ( navi, nsbundle.constants, mself );
+ this.write_navi_child_structs_without_childs_collection ( navi, nsbundle.structs, mself );
+ this.write_navi_child_delegates_collection ( navi, nsbundle.delegates, mself );
+ this.write_navi_child_interfaces_without_childs_collection ( navi, nsbundle.interfaces, mself );
+ this.write_navi_child_enums_without_childs_collection ( navi, nsbundle.enums, mself );
+ this.write_navi_child_error_domains_without_childs_collection ( navi, nsbundle.errordomains, mself );
+ navi.puts ( "</ul>\n" );
+ navi.puts ( "\t\t\t</div>\n" );
+
+ this.directory_level--;
+ }
+
+ private void write_navi_namespace_bundle ( NamespaceBundle nsbundle, Basic mself ) {
+ this.directory_level++;
+
+ foreach ( NamespaceBundle subnsbundle in nsbundle.subnamespaces ) {
+ this.write_navi_namespace_bundle ( subnsbundle, mself );
+ }
+
+
+ this.directory_level++;
+ foreach ( Constant c in nsbundle.constants ) {
+ GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + c.name + "/index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, c );
+ this.write_constant_content ( file, c, (ConstantHandler)c.parent );
+ this.write_file_footer ( file );
+ }
+ foreach ( Delegate del in nsbundle.delegates ) {
+ GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + del.name + "/index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, del );
+ this.write_delegate_content ( file, del );
+ this.write_file_footer ( file );
+ }
+ foreach ( Method m in nsbundle.methods ) {
+ GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + m.name + "/index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, m );
+ this.write_method_content ( file, m, (MethodHandler)m.parent );
+ this.write_file_footer ( file );
+ }
+ foreach ( Field f in nsbundle.fields ) {
+ GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + f.name + "/index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, f );
+ this.write_field_content ( file, f, (FieldHandler)f.parent );
+ this.write_file_footer ( file );
+ }
+ this.directory_level--;
+
+ GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + "index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, (mself == null)? nsbundle.creation_namespace : mself );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, (nsbundle.name == null)? "Global Namespace" : nsbundle.full_name () );
+ file.printf ( "<hr class=\"%s\" />\n", css_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.puts ( "\t\t\t</div>\n" );
+ this.write_file_footer ( file );
+
+ this.directory_level--;
+ }
+
+ private bool copy_file ( string src, string dest ) {
+ GLib.FileStream fsrc = GLib.FileStream.open ( src, "rb" );
+ GLib.FileStream fdest = GLib.FileStream.open ( dest, "wb" );
+ if ( fsrc == null || fdest == null )
+ return false;
+
+ for ( int c = fsrc.getc() ; !fsrc.eof() ; c = fsrc.getc() ) {
+ fdest.putc ( (char)c );
+ }
+
+ return true;
+ }
+
+ private void copy_deps ( ) {
+ string path = Config.doclet_path + "deps/";
+
+ GLib.Dir dir = GLib.Dir.open ( path );
+ for ( weak string name = dir.read_name (); name != null ; name = dir.read_name () ) {
+ this.copy_file ( path+name, this.settings.path+name );
+ }
+ }
+
+ private bool is_depency ( string dep ) {
+ foreach ( string file in this.settings.files ) {
+ if ( dep == file )
+ return false;
+ }
+ return true;
+ }
+
+ ~HtmlDoclet () {
+ this.directory_level = 1;
+ copy_deps ( );
+
+ foreach ( NamespaceBundle nsbundle in this.namespaces ) {
+ this.write_navi_namespace_bundle ( nsbundle, null );
+ }
+
+ GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "index.html", "w" );
+ string title = ( this.settings.package_name == null )? "" : this.settings.package_name;
+ this.write_file_header_template ( sfile, title, 0 );
+
+ sfile.printf ( "<h2 class=\"%s\">Namespaces:</h2>\n", css_title );
+ sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( NamespaceBundle nsb in this.namespaces ) {
+ string dir = (nsb.name == null)? "0" : nsb.name;
+ this.write_navi_entry_html_template_with_link ( sfile, css_inline_navigation_namespace, this.package_name + "/" + dir + "/index.html", (nsb.name == null)? "Global Namespace" : nsb.name );
+ }
+ sfile.puts ( "</ul>\n\n" );
+
+
+ sfile.printf ( "<h2 class=\"%s\">Depencies:</h2>\n", css_title );
+ sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+
+ foreach ( File file in this.files ) {
+ if ( !this.is_depency ( file.name ) )
+ continue;
+
+ if ( this.settings.with_deps )
+ sfile.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s/index.html\">%s</a></li>\n", css_inline_navigation_package, css_navi_link, this.get_package_name(file.name), this.get_package_name(file.name) );
+ else
+ sfile.printf ( "\t<li class=\"%s\">%s</li>\n", css_inline_navigation_package, this.get_package_name(file.name) );
+ }
+
+ sfile.puts ( "</ul>\n" );
+
+ this.write_file_footer ( sfile );
+ sfile = null;
+ }
+
+ public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name () );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ ns.write_comment ( file );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private void write_child_classes ( GLib.FileStream file, ClassHandler clh ) {
+ Gee.ReadOnlyCollection<Class> classes = clh.get_class_list ();
+ if ( classes.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Classes:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Class subcl in classes ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_class, css_navi_link, this.get_link(subcl, clh), subcl.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_enums ( GLib.FileStream file, EnumHandler eh ) {
+ Gee.Collection<Enum> enums = eh.get_enum_list ();
+ if ( enums.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Enums:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Enum en in enums ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_enum, css_navi_link, this.get_link(en, eh), en.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_structs ( GLib.FileStream file, StructHandler struh ) {
+ Gee.Collection<Struct> structs = struh.get_struct_list ();
+ if ( structs.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Structs:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Struct stru in structs ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_struct, css_navi_link, this.get_link(stru, struh), stru.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_methods ( GLib.FileStream file, MethodHandler mh ) {
+ Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ();
+ if ( methods.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Methods:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Method m in methods ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_method, css_navi_link, this.get_link(m, mh), m.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) {
+ Gee.Collection<Delegate> delegates = dh.get_delegate_list ();
+ if ( delegates.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Delegates:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Delegate d in delegates ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_delegate, css_navi_link, this.get_link(d, dh), d.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) {
+ Gee.ReadOnlyCollection<Method> methods = cmh.get_construction_method_list ();
+ if ( methods.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Construction Methods:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Method m in methods ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_method, css_navi_link, this.get_link(m, cmh), m.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_signals ( GLib.FileStream file, SignalHandler sh ) {
+ Gee.ReadOnlyCollection<Signal> signals = sh.get_signal_list ();
+ if ( signals.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Signals:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Signal sig in signals ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_signal, css_navi_link, this.get_link(sig, sh), sig.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) {
+ Gee.ReadOnlyCollection<Property> properties = ph.get_property_list ();
+ if ( properties.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Properties:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Property prop in properties ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_property, css_navi_link, this.get_link(prop, ph), prop.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_fields ( GLib.FileStream file, FieldHandler fh ) {
+ Gee.ReadOnlyCollection<Field> fields = fh.get_field_list ();
+ if ( fields.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Fields:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Field f in fields ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_fields, css_navi_link, this.get_link(f, fh), f.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) {
+ Gee.ReadOnlyCollection<Constant> constants = ch.get_constant_list ();
+ if ( constants.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Constants:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Constant c in constants ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_constant, css_navi_link, this.get_link(c, ch), c.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) {
+ Gee.ReadOnlyCollection<ErrorCode> error_codes = errdom.get_error_code_list ();
+ if ( error_codes.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Error Codes:</h3>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_errordomain_table );
+ foreach ( ErrorCode errcode in error_codes ) {
+ file.puts ( "<tr>\n" );
+ file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_errordomain_table_name, errcode.name, errcode.name );
+ file.printf ( "\t<td class=\"%s\">\n", css_errordomain_table_text );
+
+ errcode.write_comment ( file );
+
+ file.puts ( "\t</td>\n" );
+ file.puts ( "</tr>\n" );
+ }
+ file.puts ( "</table>\n" );
+ }
+ }
+
+ private void write_child_enum_values ( GLib.FileStream file, Enum en ) {
+ Gee.ReadOnlyCollection<EnumValue> enum_values = en.get_enum_values ();
+ if ( enum_values.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Enum Values:</h3>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_enum_table );
+ foreach ( EnumValue enval in enum_values ) {
+ file.puts ( "<tr>\n" );
+ file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_enum_table_name, enval.name, enval.name );
+ file.printf ( "\t<td class=\"%s\">\n", css_enum_table_text );
+
+ enval.write_comment ( file );
+
+ file.puts ( "\t</td>\n" );
+ file.puts ( "</tr>\n" );
+ }
+ file.puts ( "</table>\n" );
+ }
+ }
+
+ public void write_interface_content ( GLib.FileStream file, Interface iface ) {
+ string full_name = iface.full_name ();
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ this.write_image_block ( file, iface );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ iface.write_comment ( file );
+ this.write_namespace_note ( file, iface );
+ this.write_package_note ( file, iface );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_classes ( file, iface );
+ this.write_child_structs ( file, iface );
+ this.write_child_delegates ( file, iface );
+ this.write_child_fields ( file, iface );
+ this.write_child_properties ( file, iface );
+ this.write_child_signals ( file, iface );
+ this.write_child_methods ( file, iface );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_class_content ( GLib.FileStream file, Class cl ) {
+ string full_name = cl.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ this.write_image_block ( file, cl );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_class ( cl, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ cl.write_comment ( file );
+ this.write_namespace_note ( file, cl );
+ this.write_package_note ( file, cl );
+ file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_construction_methods ( file, cl );
+ this.write_child_enums ( file, cl );
+ this.write_child_classes ( file, cl );
+ this.write_child_structs ( file, cl );
+ this.write_child_delegates ( file, cl );
+ this.write_child_constants ( file, cl );
+ this.write_child_fields ( file, cl );
+ this.write_child_properties ( file, cl );
+ this.write_child_signals ( file, cl );
+ this.write_child_methods ( file, cl );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_struct_content ( GLib.FileStream file, Struct stru ) {
+ string full_name = stru.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ this.write_image_block ( file, stru );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ stru.write_comment ( file );
+ this.write_namespace_note ( file, stru );
+ this.write_package_note ( file, stru );
+ file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_struct ( stru, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ this.write_child_construction_methods ( file, stru );
+ this.write_child_constants ( file, stru );
+ this.write_child_fields ( file, stru );
+ this.write_child_methods ( file, stru );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) {
+ string full_name = errdom.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ errdom.write_comment ( file );
+ this.write_namespace_note ( file, errdom );
+ this.write_package_note ( file, errdom );
+ file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_error_values ( file, errdom );
+ this.write_child_methods ( file, errdom );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_enum_content ( GLib.FileStream file, Enum en ) {
+ string full_name = en.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ en.write_comment ( file );
+ this.write_namespace_note ( file, en );
+ this.write_package_note ( file, en );
+ file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_enum_values ( file, en );
+ this.write_child_methods ( file, en );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_property_content ( GLib.FileStream file, Property prop ) {
+ string full_name = prop.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_property ( prop, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ prop.write_comment ( file );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) {
+ string full_name = constant.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_constant ( constant, parent, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ constant.write_comment ( file );
+
+ if ( constant.parent is Namespace ) {
+ this.write_namespace_note ( file, constant );
+ }
+
+ this.write_package_note ( file, constant );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) {
+ string full_name = field.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_field ( field, parent, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ field.write_comment ( file );
+
+ if ( field.parent is Namespace ) {
+ this.write_namespace_note ( file, field );
+ }
+
+ this.write_package_note ( file, field );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_delegate_content ( GLib.FileStream file, Delegate del ) {
+ string full_name = del.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_delegate ( del, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ del.write_comment ( file );
+
+ if ( del.parent is Namespace ) {
+ this.write_namespace_note ( file, del );
+ this.write_package_note ( file, del );
+ }
+
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_signal_content ( GLib.FileStream file, Signal sig ) {
+ string full_name = sig.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_signal ( sig, file );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ sig.write_comment ( file );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) {
+ string full_name = m.full_name ( );
+ file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
+ file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_method ( file, m, parent );
+ file.printf ( "\n\t\t\t\t</div>\n" );
+ m.write_comment ( file );
+
+ if ( m.parent is Namespace ) {
+ this.write_namespace_note ( file, m );
+ }
+
+ this.write_package_note ( file, m );
+ file.puts ( "\t\t\t</div>\n" );
+ }
+
+ private string css_site_header = "site_header";
+
+ private void write_file_header_template ( GLib.FileStream file, string title, int level ) {
+ GLib.StringBuilder css_path = new GLib.StringBuilder ( );
+ for ( int i = 0; level > i; i++ ) {
+ css_path.append ( "../" );
+ }
+
+ css_path.append ( "main.css" );
+
+ file.puts ( "<html>\n" );
+ file.puts ( "\t<head>\n" );
+ file.puts ( "\t\t<title>Vala Binding Reference</title>\n" );
+ file.printf ( "\t\t<link href=\"%s\" rel=\"stylesheet\" type=\"text/css\" />\n", css_path.str );
+ file.puts ( "\t</head>\n" );
+ file.puts ( "\t<body>\n\n" );
+
+ file.printf ( "\t<div class=\"%s\">\n", this.css_site_header );
+ file.printf ( "\t\t%s Reference Manual\n", title );
+ file.puts ( "\t</div>\n\n" );
+
+ file.printf ( "\t\t<div class=\"%s\">\n", this.css_style_body );
+ }
+
+ private void write_package_note ( GLib.FileStream file, Basic element ) {
+ string package = element.package;
+ if ( package == null )
+ return ;
+
+ file.printf ( "\n\n<br />\n<b>Package:</b> %s\n\n", package );
+ }
+
+ private void write_namespace_note ( GLib.FileStream file, Basic element ) {
+ for ( ; element is Namespace == false; element = element.parent )
+ ;
+
+ if ( element.parent == null )
+ return ;
+
+ if ( element.name == null )
+ return ;
+
+ file.printf ( "\n\n<br />\n<b>Namespace:</b> %s\n\n", ((Namespace)element).full_name () );
+ }
+
+ private void write_file_header ( GLib.FileStream file ) {
+ this.write_file_header_template ( file, this.package_name, this.directory_level );
+ }
+
+ private const string css_style_navigation = "site_navigation";
+ private const string css_style_content = "site_content";
+ private const string css_style_body = "site_body";
+
+
+ private void write_file_footer ( GLib.FileStream file ) {
+ file.puts ( "\t</div>\n" );
+
+ file.puts ( "\t<div style= \"clear: left\">\n" );
+ file.puts ( "\t\t<br />\n" );
+ file.puts ( "\t\t<div class=\"site_foother\">\n" );
+ file.puts ( "\t\t\tcreated by <a href=\"http://www.valadoc.org\">valadoc</a>\n" );
+ file.puts ( "\t\t</div>\n" );
+ file.puts ( "\t</div>\n" );
+ file.puts ( "\t</body>\n" );
+ file.puts ( "</html>" );
+ }
+
+ public override void visit_property ( Property prop ) {
+ string path = this.current_path + prop.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+ this.directory_level++;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_property ( file, prop );
+ this.write_property_content ( file, prop );
+ this.write_file_footer ( file );
+
+ this.directory_level--;
+ file = null;
+ }
+
+ public override void visit_constant ( Constant constant, ConstantHandler parent ) {
+ string path = this.current_path + constant.name + "/";
+
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || constant.parent is Namespace == false ) {
+ this.directory_level++;
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_constant ( file, constant );
+ this.write_constant_content ( file, constant, parent );
+ this.write_file_footer ( file );
+ this.directory_level--;
+ file = null;
+ }
+ }
+
+ public override void visit_field ( Field field, FieldHandler parent ) {
+ string path = this.current_path + field.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || field.parent is Namespace == false ) {
+ this.directory_level++;
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_field ( file, field );
+ this.write_field_content ( file, field, parent );
+ this.write_file_footer ( file );
+ this.directory_level--;
+ file = null;
+ }
+ }
+
+ public override void visit_delegate ( Delegate del ) {
+ string path = this.current_path + del.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || del.parent is Namespace == false ) {
+ this.directory_level++;
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_delegate ( file, del );
+ this.write_delegate_content ( file, del );
+ this.write_file_footer ( file );
+ this.directory_level--;
+ file = null;
+ }
+ }
+
+ public override void visit_signal ( Signal sig ) {
+ string path = this.current_path + sig.name + "/";
+ this.directory_level++;
+
+ var rt = DirUtils.create ( path, 0777 );
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_signal ( file, sig );
+ write_signal_content ( file, sig );
+ this.write_file_footer ( file );
+
+ this.directory_level--;
+ file = null;
+ }
+
+ public override void visit_method ( Method m, Valadoc.MethodHandler parent ) {
+ string path = this.current_path + m.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || m.parent is Namespace == false ) {
+ this.directory_level++;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_method ( file, m );
+ this.write_method_content ( file, m, parent );
+ this.write_file_footer ( file );
+
+ this.directory_level--;
+ file = null;
+ }
+ }
+
+ public override void visit_namespace ( Namespace ns ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ if ( ns.name == null ) {
+ string tmp = this.current_path + "0/";
+ this.current_path = tmp;
+ }
+ else {
+ string tmp = this.current_path + ns.name + "/";
+ this.current_path = tmp;
+ }
+
+ if ( !this.is_vapi ) {
+ this.add_namespace_bundle ( ns );
+ }
+
+ bool dir_exists = FileUtils.test ( this.current_path, FileTest.EXISTS);
+ if ( !dir_exists ) {
+ var rt = DirUtils.create ( this.current_path, 0777 );
+ if ( this.is_vapi ) {
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_namespace ( file, ns );
+ this.write_namespace_content ( file, ns );
+ this.write_file_footer ( file );
+ file = null;
+ }
+ }
+
+ // file:
+ ns.visit_namespaces ( this );
+ ns.visit_enums ( this );
+ ns.visit_error_domains ( this );
+ ns.visit_structs ( this );
+ ns.visit_interfaces ( this );
+ ns.visit_classes ( this );
+ ns.visit_delegates ( this );
+ ns.visit_constants ( this );
+ ns.visit_fields ( this );
+ ns.visit_methods ( this );
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_enum ( Enum en ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ this.current_path += en.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ en.visit_enum_values ( this );
+ en.visit_methods ( this );
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_enum ( file, en, en );
+ this.write_enum_content ( file, en );
+ this.write_file_footer ( file );
+ file = null;
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_error_domain ( ErrorDomain errdom ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ this.current_path += errdom.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ errdom.visit_methods ( this );
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_error_domain ( file, errdom, errdom );
+ this.write_error_domain_content ( file, errdom );
+ this.write_file_footer ( file );
+ file = null;
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_struct ( Struct stru ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ this.current_path += stru.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ stru.visit_constants ( this );
+ stru.visit_fields ( this );
+ stru.visit_construction_methods ( this );
+ stru.visit_methods ( this );
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_struct ( file, stru, stru );
+ this.write_struct_content ( file, stru );
+ this.write_file_footer ( file );
+ file = null;
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_class ( Class cl ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ this.current_path += cl.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ cl.visit_enums ( this );
+ cl.visit_classes ( this );
+ cl.visit_structs ( this );
+ cl.visit_delegates ( this );
+ cl.visit_constants ( this );
+ cl.visit_construction_methods ( this );
+ cl.visit_methods ( this );
+ cl.visit_fields ( this );
+ cl.visit_properties ( this );
+ cl.visit_signals ( this );
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_file_header ( file );
+ this.write_navi_class ( file, cl, cl );
+ this.write_class_content ( file, cl );
+ this.write_file_footer ( file );
+ file = null;
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_interface ( Interface iface ) {
+ string old_path = this.current_path;
+ this.directory_level++;
+
+ this.current_path += iface.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ iface.visit_properties ( this );
+ iface.visit_delegates ( this );
+ iface.visit_signals ( this );
+ iface.visit_methods ( this );
+ iface.visit_structs ( this );
+ iface.visit_fields ( this );
+ iface.visit_structs ( this );
+ iface.visit_classes ( this );
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
+ this.write_file_header ( file );
+ this.write_navi_interface ( file, iface, iface );
+ this.write_interface_content ( file, iface );
+ this.write_file_footer ( file );
+ file = null;
+
+ this.current_path = old_path;
+ this.directory_level--;
+ }
+
+ public override void visit_error_code ( ErrorCode errcode ) {
+ }
+
+ public override void visit_enum_value ( EnumValue enval ) {
+ }
+}
+
+
+
+
+
+[ModuleInit]
+public Type register_plugin ( ) {
+ return typeof ( Valadoc.HtmlDoclet );
+}
+
diff --git a/src/doclets/html/linkhelper/Makefile.am b/src/doclets/html/linkhelper/Makefile.am
new file mode 100644
index 000000000..aca36ba5f
--- /dev/null
+++ b/src/doclets/html/linkhelper/Makefile.am
@@ -0,0 +1,44 @@
+# src/Makefile.am
+
+
+
+libhtmlhelper_VALASOURCES = \
+ helper.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libhtmlhelper.vala.stamp
+
+
+libhtmlhelper.vala.stamp: $(libhtmlhelper_VALASOURCES)
+ $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^
+ touch $@
+
+
+
+htmlhelperdir = $(libdir)/valadoc/plugins/template/
+htmlhelper_LTLIBRARIES = libhtmlhelper.la
+
+
+libhtmlhelper_la_SOURCES = \
+ libhtmlhelper.vala.stamp \
+ $(libhtmlhelper_VALASOURCES:.vala=.c) \
+ $(libhtmlhelper_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+AM_CFLAGS = \
+ -I ../../../libvaladoc/ \
+ $(LIBVALA_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(NULL)
+
+
+libhtmlhelper_la_LIBADD = \
+ ../../../libvaladoc/libvaladoc.la \
+ $(LIBVALA_LIBS) \
+ $(GLIB_LIBS) \
+ $(NULL)
+
+
+EXTRA_DIST = $(libhtmlhelper_VALASOURCES) libhtmlhelper.vala.stamp
diff --git a/src/doclets/html/linkhelper/helper.vala b/src/doclets/html/linkhelper/helper.vala
new file mode 100755
index 000000000..e68308209
--- /dev/null
+++ b/src/doclets/html/linkhelper/helper.vala
@@ -0,0 +1,194 @@
+/*
+ * 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 GLib;
+
+
+
+/* css-class-names: */
+public const string css_inline_navigation = "main_inline_navigation";
+public const string css_inline_navigation_namespace = "main_inline_navigation_namespace";
+public const string css_inline_navigation_property = "main_inline_navigation_property";
+public const string css_inline_navigation_method = "main_inline_navigation_method";
+public const string css_inline_navigation_signal = "main_inline_navigation_signal";
+public const string css_inline_navigation_fields = "main_inline_navigation_fields";
+public const string css_inline_navigation_class = "main_inline_navigation_class";
+public const string css_inline_navigation_enum = "main_inline_navigation_enum";
+public const string css_inline_navigation_struct = "main_inline_navigation_struct";
+public const string css_inline_navigation_delegate = "main_inline_navigation_delegate";
+public const string css_inline_navigation_constant = "main_inline_navigation_constant";
+public const string css_inline_navigation_package = "main_inline_navigation_package";
+
+public const string css_navi_package_index = "navi_package_index";
+public const string css_navi_package = "navi_package";
+public const string css_navi_construction_method = "navi_construction_method";
+public const string css_navi_error_domain = "navi_error_domain";
+public const string css_navi_namespace = "navi_namespace";
+public const string css_navi_method = "navi_method";
+public const string css_navi_struct = "navi_struct";
+public const string css_navi_iface = "navi_iface";
+public const string css_navi_field = "navi_field";
+public const string css_navi_class = "navi_class";
+public const string css_navi_enum = "navi_enum";
+public const string css_navi_link = "navi_link";
+public const string css_navi_constant = "navi_constant";
+public const string css_navi_prop = "navi_prop";
+public const string css_navi_del = "navi_del";
+public const string css_navi_sig = "navi_sig";
+public const string css_navi = "navi_main";
+public const string css_navi_enval = "main_navi_enval";
+public const string css_navi_errdomcode = "main_navi_errdomcode";
+public const string css_navi_hr = "navi_hr";
+
+public const string css_errordomain_table_name = "main_errordomain_table_name";
+public const string css_errordomain_table_text = "main_errordomain_table_text";
+public const string css_errordomain_table = "main_errordomain_table";
+
+
+public const string css_enum_table_name = "main_enum_table_name";
+public const string css_enum_table_text = "main_enum_table_text";
+public const string css_enum_table = "main_enum_table";
+
+public const string css_diagram = "main_diagram";
+public const string css_see_list = "main_see_list";
+public const string css_exception_table = "main_parameter_table";
+public const string css_parameter_table_text = "main_parameter_table_text";
+public const string css_parameter_table_name = "main_parameter_table_name";
+public const string css_parameter_table = "main_parameter_table";
+public const string css_title = "main_title";
+public const string css_other_type = "main_other_type";
+public const string css_basic_type = "main_basic_type";
+public const string css_keyword = "main_keyword";
+public const string css_optional_parameter = "main_optional_parameter";
+public const string css_code_definition = "main_code_definition";
+public const string css_headline_hr = "main_hr";
+public const string css_hr = "main_hr";
+public const string css_list_errdom = "main_list_errdom";
+public const string css_list_en = "main_list_en";
+public const string css_list_ns = "main_list_ns";
+public const string css_list_cl = "main_list_cl";
+public const string css_list_iface = "main_list_iface";
+public const string css_list_stru = "main_list_stru";
+public const string css_list_field = "main_list_field";
+public const string css_list_prop = "main_list_prop";
+public const string css_list_del = "main_list_del";
+public const string css_list_sig = "main_list_sig";
+public const string css_list_m = "main_list_m";
+
+
+
+public interface Valadoc.LinkHelper : Object {
+ private static string package_name = null;
+
+ public abstract Settings settings {
+ construct set;
+ get;
+ }
+
+ private string get_dirname ( string file_name ) {
+ if ( file_name[file_name.len()-1] == '/' )
+ return GLib.Path.get_dirname ( file_name );
+ else
+ return GLib.Path.get_basename ( file_name );
+ }
+
+ protected string get_package_name ( string file_path ) {
+ if ( file_path.has_suffix (".vapi") ) {
+ string file_name = GLib.Path.get_basename (file_path);
+ return file_name.ndup ( file_name.size() - ".vapi".size() );
+ }
+
+ if ( this.package_name == null ) {
+ this.package_name = this.settings.package_name;
+ }
+
+ if ( this.package_name == null ) {
+ string file_name = this.get_dirname( settings.path );
+ this.package_name = file_name; //file_name.ndup ( file_name.size() - ".vala".size() );
+ }
+
+ return this.package_name;
+ }
+
+ public string get_file_name ( Valadoc.Basic tag ) {
+ Valadoc.Basic pos = tag;
+
+ while ( pos != null ) {
+ if ( pos is Valadoc.File )
+ return pos.name;
+
+ pos = pos.parent;
+ }
+ return null;
+ }
+
+ protected string get_top_link ( Valadoc.Basic postag ) {
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+ Valadoc.Basic pos = postag;
+
+ while ( pos != null ) {
+ str.append ( "../" );
+ pos = pos.parent;
+ }
+ return str.str;
+ }
+
+ protected string? get_link ( Valadoc.Basic tag, Valadoc.Basic postag ) {
+ if ( !this.settings.to_doc( tag.file_name ) )
+ return null;
+
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+ Valadoc.Basic pos = tag;
+
+ string? link_id = null;
+
+ if ( tag is Valadoc.File == false ) {
+ if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) {
+ link_id = "#"+tag.name;
+ pos = pos.parent;
+ }
+
+ while ( pos != null ) {
+ if ( pos.name == null )
+ str.prepend ( "0" );
+ else
+ str.prepend ( pos.name );
+
+ str.prepend ( "/" );
+
+ if ( pos.parent is Valadoc.File )
+ break;
+
+ pos = pos.parent;
+ }
+ }
+ string filename = this.get_file_name ( tag );
+ string package_name = this.get_package_name ( filename );
+ str.prepend ( package_name );
+ str.prepend ( this.get_top_link ( postag ) );
+ str.append ( "/index.html" );
+
+ if ( link_id != null )
+ str.append ( link_id );
+
+ return str.str;
+ }
+}
+
+
diff --git a/src/doclets/html/taglets/Makefile.am b/src/doclets/html/taglets/Makefile.am
new file mode 100644
index 000000000..f83b62394
--- /dev/null
+++ b/src/doclets/html/taglets/Makefile.am
@@ -0,0 +1,26 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = \
+ see \
+ link \
+ return \
+ string \
+ throws \
+ version \
+ parameter \
+ $(NULL)
+
+
+
+# -see
+# -{link}
+# -version
+# -throws
+# -return
+# -param
+
+#@author name
+#@deprecated description
diff --git a/src/doclets/html/taglets/author/Makefile.am b/src/doclets/html/taglets/author/Makefile.am
new file mode 100644
index 000000000..f26055f6c
--- /dev/null
+++ b/src/doclets/html/taglets/author/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletversion_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletversion.vala.stamp
+
+
+libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletversiondir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletversion_LTLIBRARIES = libtagletversion.la
+
+
+libtagletversion_la_SOURCES = \
+ libtagletversion.vala.stamp \
+ $(libtagletversion_VALASOURCES:.vala=.c) \
+ $(libtagletversion_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletversion_la_LDFLAGS = -module -avoid-version
+
+
+libtagletversion_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletversion_VALASOURCES) libtagletversion.vala.stamp
diff --git a/src/doclets/html/taglets/author/taglet.vala b/src/doclets/html/taglets/author/taglet.vala
new file mode 100644
index 000000000..1124462ec
--- /dev/null
+++ b/src/doclets/html/taglets/author/taglet.vala
@@ -0,0 +1,84 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+public class AuthorHtmlTaglet : MainTaglet {
+ private string? email;
+ private string name;
+
+ public override int order {
+ get { return 400; }
+ }
+
+ public override bool write_block_start ( void* res ) {
+ ((GLib.FileStream)res).puts ( "\t\t<table width=\"100%\" align=\"center\">\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t<tr>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td colspan=\"2\"><h5>Version:</h5></td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t</tr>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t<tr>" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td width=\"5\">&nbsp;</td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td>\n" );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ ((GLib.FileStream)res).puts ( "</td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t</tr>" );
+ ((GLib.FileStream)res).puts ( "\t\t</table>\n" );
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size != 1 ) {
+ return false;
+ }
+
+ Taglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ str = str.strip ( );
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ ((GLib.FileStream)res).printf ( "%s", this.version );
+ if ( max != index+1 )
+ ((GLib.FileStream)res).puts ( ", " );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( AuthorHtmlTaglet );
+ taglets.set ( "author", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/link/Makefile.am b/src/doclets/html/taglets/link/Makefile.am
new file mode 100644
index 000000000..1ff506414
--- /dev/null
+++ b/src/doclets/html/taglets/link/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletlink_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletlink.vala.stamp
+
+
+libtagletlink.vala.stamp: $(libtagletlink_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletlinkdir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletlink_LTLIBRARIES = libtagletlink.la
+
+
+libtagletlink_la_SOURCES = \
+ libtagletlink.vala.stamp \
+ $(libtagletlink_VALASOURCES:.vala=.c) \
+ $(libtagletlink_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletlink_la_LDFLAGS = -module -avoid-version
+
+
+libtagletlink_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletlink_VALASOURCES) libtagletlink.vala.stamp
diff --git a/src/doclets/html/taglets/link/taglet.vala b/src/doclets/html/taglets/link/taglet.vala
new file mode 100644
index 000000000..e47f2694f
--- /dev/null
+++ b/src/doclets/html/taglets/link/taglet.vala
@@ -0,0 +1,72 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class LinkHtmlTaglet : InlineTaglet, LinkHelper {
+ private string content;
+ private string path;
+
+ public Settings settings {
+ construct set;
+ get;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, string content ) {
+ string[] arr = content.split ( "\n" );
+ string str = string.joinv ("", arr ).strip();
+
+ Valadoc.Basic? element = tree.search_symbol_str ( me, str );
+ if ( element == null ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+5, "Linked Type is not available.\n", error_start );
+ return false;
+ }
+
+ this.settings = settings;
+ this.path = this.get_link ( element, me );
+ this.content = str;
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ if ( this.path == null )
+ ((GLib.FileStream)res).printf ( "<i>%s</i>", this.content );
+ else
+ ((GLib.FileStream)res).printf ( "<a href=\"%s\">%s</a>", this.path, this.content );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( LinkHtmlTaglet );
+ taglets.set ( "link", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/parameter/Makefile.am b/src/doclets/html/taglets/parameter/Makefile.am
new file mode 100644
index 000000000..751e3bd7b
--- /dev/null
+++ b/src/doclets/html/taglets/parameter/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletparameter_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletparameter.vala.stamp
+
+
+libtagletparameter.vala.stamp: $(libtagletparameter_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletparameterdir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletparameter_LTLIBRARIES = libtagletparameter.la
+
+
+libtagletparameter_la_SOURCES = \
+ libtagletparameter.vala.stamp \
+ $(libtagletparameter_VALASOURCES:.vala=.c) \
+ $(libtagletparameter_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletparameter_la_LDFLAGS = -module -avoid-version
+
+
+libtagletparameter_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletparameter_VALASOURCES) libtagletparameter.vala.stamp
diff --git a/src/doclets/html/taglets/parameter/taglet.vala b/src/doclets/html/taglets/parameter/taglet.vala
new file mode 100644
index 000000000..97ba213a3
--- /dev/null
+++ b/src/doclets/html/taglets/parameter/taglet.vala
@@ -0,0 +1,138 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ParameterHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
+ private string paramname = "";
+
+ public override int order {
+ get { return 100; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_parameter_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+ protected void get_first_word_start_pos ( string str, ref int line, ref int pos ) {
+ for ( int i = 0; str[i] != '\0'; i++ ) {
+ if ( str[i].isspace() == false )
+ return ;
+
+ pos++;
+
+ if ( str[i] == '\n' ) {
+ pos = 0;
+ line++;
+ }
+ }
+ }
+
+ private bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
+ foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
+ if ( param.name == name )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+
+ string strpos = ((StringTaglet)tag).content;
+ string paramname;
+
+ strpos = this.get_next_word ( strpos, out paramname );
+ ((StringTaglet)tag).content = strpos;
+ this.paramname = paramname;
+
+ if ( this.paramname == "" ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+ if ( !check_parameter_name ( ((Valadoc.ParameterListHandler)me), this.paramname ) ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
+ return false;
+ }
+
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+}
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ParameterHtmlTaglet );
+ taglets.set ( "param", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/return/Makefile.am b/src/doclets/html/taglets/return/Makefile.am
new file mode 100644
index 000000000..b71782b30
--- /dev/null
+++ b/src/doclets/html/taglets/return/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletXXXX_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletXXXX.vala.stamp
+
+
+libtagletXXXX.vala.stamp: $(libtagletXXXX_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletXXXXdir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletXXXX_LTLIBRARIES = libtagletXXXX.la
+
+
+libtagletXXXX_la_SOURCES = \
+ libtagletXXXX.vala.stamp \
+ $(libtagletXXXX_VALASOURCES:.vala=.c) \
+ $(libtagletXXXX_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletXXXX_la_LDFLAGS = -module -avoid-version
+
+
+libtagletXXXX_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletXXXX_VALASOURCES) libtagletXXXX.vala.stamp
diff --git a/src/doclets/html/taglets/return/taglet.vala b/src/doclets/html/taglets/return/taglet.vala
new file mode 100644
index 000000000..f1e40da1f
--- /dev/null
+++ b/src/doclets/html/taglets/return/taglet.vala
@@ -0,0 +1,71 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ReturnHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
+
+ public override int order {
+ get { return 300; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ReturnHtmlTaglet );
+ taglets.set ( "return", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/see/Makefile.am b/src/doclets/html/taglets/see/Makefile.am
new file mode 100644
index 000000000..ea3990c03
--- /dev/null
+++ b/src/doclets/html/taglets/see/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletsee_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletsee.vala.stamp
+
+
+libtagletsee.vala.stamp: $(libtagletsee_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletseedir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletsee_LTLIBRARIES = libtagletsee.la
+
+
+libtagletsee_la_SOURCES = \
+ libtagletsee.vala.stamp \
+ $(libtagletsee_VALASOURCES:.vala=.c) \
+ $(libtagletsee_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletsee_la_LDFLAGS = -module -avoid-version
+
+
+libtagletsee_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletsee_VALASOURCES) libtagletsee.vala.stamp
diff --git a/src/doclets/html/taglets/see/taglet.vala b/src/doclets/html/taglets/see/taglet.vala
new file mode 100644
index 000000000..dc6f1e92f
--- /dev/null
+++ b/src/doclets/html/taglets/see/taglet.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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+public class SeeHtmlTaglet : MainTaglet, LinkHelper {
+ private string name;
+ private string path;
+
+ public override int order {
+ get { return 500; }
+ }
+
+ public Settings settings {
+ construct set;
+ get;
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
+ file.printf ( "<ul class=\"%s\">", css_see_list );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.puts ( "</ul>" );
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
+ return false;
+ }
+
+ string[] arr = ((StringTaglet)tag).content.split ( "\n" );
+ string str = string.joinv ("", arr ).strip();
+
+ Valadoc.Basic? element = tree.search_symbol_str ( me, str );
+ if ( element == null ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Linked type is not available.\n", error_start );
+ return false;
+ }
+
+ this.settings = settings;
+ this.path = this.get_link ( element, me );
+ this.name = str;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ if ( this.path == null )
+ file.printf ( "\t<li class=\"%s\"><i>%s</i></li>\n", css_see_list, this.name );
+ else
+ file.printf ( "\t<li class=\"%s\"><a href=\"%s\">%s</a></li>\n", css_see_list, this.path, this.name );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( SeeHtmlTaglet );
+ taglets.set ( "see", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/string/Makefile.am b/src/doclets/html/taglets/string/Makefile.am
new file mode 100644
index 000000000..7c2bb5ad9
--- /dev/null
+++ b/src/doclets/html/taglets/string/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletstring_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletstring.vala.stamp
+
+
+libtagletstring.vala.stamp: $(libtagletstring_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletstringdir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletstring_LTLIBRARIES = libtagletstring.la
+
+
+libtagletstring_la_SOURCES = \
+ libtagletstring.vala.stamp \
+ $(libtagletstring_VALASOURCES:.vala=.c) \
+ $(libtagletstring_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletstring_la_LDFLAGS = -module -avoid-version
+
+
+libtagletstring_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletstring_VALASOURCES) libtagletstring.vala.stamp
diff --git a/src/doclets/html/taglets/string/taglet.vala b/src/doclets/html/taglets/string/taglet.vala
new file mode 100644
index 000000000..a958874d1
--- /dev/null
+++ b/src/doclets/html/taglets/string/taglet.vala
@@ -0,0 +1,54 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class StringHtmlTaglet : StringTaglet {
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content ) {
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* res, int max , int index ) {
+ try {
+ string str = new Regex ( Regex.escape_string ("\n")).replace_literal ( this.content, -1, 0, "\n<br>" );
+ ((GLib.FileStream)res).puts ( str );
+ }
+ catch ( RegexError err ) {
+ return false;
+ }
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( StringHtmlTaglet );
+ taglets.set ( "", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/throws/Makefile.am b/src/doclets/html/taglets/throws/Makefile.am
new file mode 100644
index 000000000..e37d2983c
--- /dev/null
+++ b/src/doclets/html/taglets/throws/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libexceptionparameter_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libexceptionparameter.vala.stamp
+
+
+libexceptionparameter.vala.stamp: $(libexceptionparameter_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+exceptionparameterdir = $(libdir)/valadoc/plugins/template/taglets/
+
+exceptionparameter_LTLIBRARIES = libexceptionparameter.la
+
+
+libexceptionparameter_la_SOURCES = \
+ libexceptionparameter.vala.stamp \
+ $(libexceptionparameter_VALASOURCES:.vala=.c) \
+ $(libexceptionparameter_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libexceptionparameter_la_LDFLAGS = -module -avoid-version
+
+
+libexceptionparameter_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libexceptionparameter_VALASOURCES) libexceptionparameter.vala.stamp
diff --git a/src/doclets/html/taglets/throws/taglet.vala b/src/doclets/html/taglets/throws/taglet.vala
new file mode 100644
index 000000000..ba9bf2423
--- /dev/null
+++ b/src/doclets/html/taglets/throws/taglet.vala
@@ -0,0 +1,130 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ExceptionHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
+ private string paramname = "";
+
+ public override int order {
+ get { return 200; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_exception_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+ private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
+ if ( paramname[0] == '.' )
+ return false;
+
+ foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
+ if ( param.type_name.has_suffix ( paramname ) )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ string strpos = ((StringTaglet)tag).content;
+ string paramname;
+
+ strpos = this.get_next_word ( strpos, out paramname );
+ ((StringTaglet)tag).content = strpos;
+ this.paramname = paramname;
+
+ if ( this.paramname == "" ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ if ( !check_exception_parameter_name ( ((Valadoc.ExceptionHandler)me), this.paramname ) ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
+ return false;
+ }
+
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ExceptionHtmlTaglet );
+ taglets.set ( "throws", type );
+ return type;
+}
+
diff --git a/src/doclets/html/taglets/version/Makefile.am b/src/doclets/html/taglets/version/Makefile.am
new file mode 100644
index 000000000..f26055f6c
--- /dev/null
+++ b/src/doclets/html/taglets/version/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletversion_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletversion.vala.stamp
+
+
+libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletversiondir = $(libdir)/valadoc/plugins/template/taglets/
+
+tagletversion_LTLIBRARIES = libtagletversion.la
+
+
+libtagletversion_la_SOURCES = \
+ libtagletversion.vala.stamp \
+ $(libtagletversion_VALASOURCES:.vala=.c) \
+ $(libtagletversion_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletversion_la_LDFLAGS = -module -avoid-version
+
+
+libtagletversion_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletversion_VALASOURCES) libtagletversion.vala.stamp
diff --git a/src/doclets/html/taglets/version/taglet.vala b/src/doclets/html/taglets/version/taglet.vala
new file mode 100644
index 000000000..02ca5e6e6
--- /dev/null
+++ b/src/doclets/html/taglets/version/taglet.vala
@@ -0,0 +1,82 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class VersionHtmlTaglet : MainTaglet {
+ private string version;
+
+ public override int order {
+ get { return 400; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Version:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size != 1 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ this.version = str.strip ( );
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ ((GLib.FileStream)res).printf ( "%s", this.version );
+ if ( max != index+1 )
+ ((GLib.FileStream)res).puts ( ", " );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( VersionHtmlTaglet );
+ taglets.set ( "version", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/Makefile.am b/src/doclets/valadoc.org/Makefile.am
new file mode 100644
index 000000000..4239419aa
--- /dev/null
+++ b/src/doclets/valadoc.org/Makefile.am
@@ -0,0 +1,16 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = \
+ linkhelper \
+ doclet \
+ taglets \
+ $(NULL)
+
+# langlet \
+# doclet \
+# $(NULL)
+
+
diff --git a/src/doclets/valadoc.org/doclet/Makefile.am b/src/doclets/valadoc.org/doclet/Makefile.am
new file mode 100644
index 000000000..a46cbc9e0
--- /dev/null
+++ b/src/doclets/valadoc.org/doclet/Makefile.am
@@ -0,0 +1,56 @@
+# src/Makefile.am
+
+
+
+
+libdoclet_VALASOURCES = \
+ template.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libdoclet.vala.stamp
+
+
+libdoclet.vala.stamp: $(libdoclet_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+docletdir = $(libdir)/valadoc/plugins/valadoc.org/
+
+doclet_LTLIBRARIES = libdoclet.la
+
+
+libdoclet_la_SOURCES = \
+ libdoclet.vala.stamp \
+ $(libdoclet_VALASOURCES:.vala=.c) \
+ $(libdoclet_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../libvaladoc/ \
+ -I ../linkhelper/ \
+ -I ../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libdoclet_la_LDFLAGS = -module -avoid-version
+
+
+libdoclet_la_LIBADD = \
+ ../../../libvaladoc/libvaladoc.la \
+ ../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libdoclet_VALASOURCES) libdoclet.vala.stamp
diff --git a/src/doclets/valadoc.org/doclet/template.vala b/src/doclets/valadoc.org/doclet/template.vala
new file mode 100644
index 000000000..7a1d43079
--- /dev/null
+++ b/src/doclets/valadoc.org/doclet/template.vala
@@ -0,0 +1,1954 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Gee;
+
+
+public enum WriterState {
+ KEY,
+ STANDARD,
+ NULL
+}
+
+
+
+
+private string get_full_name ( Basic element ) {
+ if ( element.name == null )
+ return "";
+
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+
+ for ( var pos = element; pos != null ; pos = pos.parent ) {
+ str.prepend ( pos.name );
+ if ( pos.parent is File || pos.parent.name == null )
+ return str.str;
+ else
+ str.prepend_unichar ( '.' );
+ }
+ return str.str;
+}
+
+
+
+
+public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public LangletIndex ( Settings settings ) {
+ this.settings = settings;
+ }
+
+ private Basic position = null;
+
+ private inline bool is_basic_type ( string name ) {
+ string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort",
+ "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32",
+ "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string"
+ };
+
+ foreach ( string str in basic_types ) {
+ if ( str == name )
+ return true;
+ }
+
+ return false;
+ }
+
+ private void write_type_name ( DataType? datatype, GLib.FileStream file ) {
+ if ( datatype == null ) {
+ file.printf ( "<font class=\"%s\">void</font>", css_keyword );
+ return ;
+ }
+
+ string typename = get_full_name ( datatype );
+ if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) {
+ if ( this.is_basic_type ( typename ) ) {
+ string link = this.get_link( datatype );
+ if ( link == null )
+ file.printf ( "<span class=\"%s\">%s</span>", css_basic_type, typename );
+ else
+ file.printf ( "<a class=\"%s\" href=\"%s\">%s</a>", css_basic_type, link, typename );
+ return ;
+ }
+ }
+
+ string link = this.get_link( datatype );
+ if ( link == null )
+ file.printf ( "<span class=\"%s\">%s</span>", css_other_type, typename );
+ else
+ file.printf ( "<a class=\"%s\" href=\"%s\">%s</a>", css_other_type, link, typename );
+ }
+
+ private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) {
+ if ( type_reference.type_name == "void" ) {
+ file.printf ( "<font class=\"%s\">void</font>", css_keyword );
+ }
+ else {
+ if ( type_reference.data_type == null ) {
+ file.printf ( "<font class=\"%s\">%s</font>", css_other_type, type_reference.type_name );
+ }
+ else {
+ this.write_type_name ( type_reference.data_type, file );
+ }
+ }
+ }
+
+ private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) {
+ Gee.Collection<TypeReference> arglst = type_reference.get_type_arguments ( );
+ int size = arglst.size;
+ if ( size == 0 )
+ return ;
+
+ file.puts ( "<" );
+ int i = 0;
+
+ foreach ( TypeReference arg in arglst ) {
+ i++;
+
+ this.write_nested_type_referene ( arg, file );
+ if ( i != size )
+ file.puts ( ", " );
+ }
+
+ file.puts ( ">" );
+ }
+
+ private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) {
+ if ( type_reference.type_name == null )
+ return ;
+
+ if ( type_reference.is_weak )
+ file.printf ( "<font class=\"%s\">weak</font> ", css_keyword );
+
+ this.write_type_reference_name ( type_reference, file );
+ this.write_type_reference_template_arguments ( type_reference, file );
+
+ if ( type_reference.is_array ) {
+ string str = string.nfill ( type_reference.array_rank-1, ',');
+ file.printf ( "[%s]", str );
+ }
+
+ if ( type_reference.pass_ownership ) {
+ file.putc ( '#' );
+ }
+
+ if ( type_reference.is_nullable ) {
+ file.putc ( '?' );
+ }
+
+ string str = string.nfill ( type_reference.pointer_rank, '*' );
+ file.puts ( str );
+
+ }
+
+ public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ if ( type_reference == null )
+ return ;
+
+ this.write_nested_type_referene ( type_reference, file );
+ file.putc ( ' ' );
+
+ /*
+ if ( type_reference.is_weak ) {
+ file.printf ( "<font class=\"%s\">weak</font> ", css_keyword );
+ }
+
+ this.write_type_name ( type_reference.data_type, file );
+
+ if ( type_reference.is_array ) {
+ string str = string.nfill ( type_reference.array_rank-1, ',');
+ file.printf ( "[%s]", str );
+ }
+
+ if ( type_reference.pass_ownership ) {
+ file.putc ( '#' );
+ }
+
+ if ( type_reference.is_nullable ) {
+ file.putc ( '?' );
+ }
+
+ string str = string.nfill ( type_reference.pointer_rank, '*' );
+ file.puts ( str );
+ */
+ }
+
+ private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) {
+ if ( param.ellipsis ) {
+ file.puts ( " ..." );
+ }
+ else {
+ if ( param.is_out )
+ file.printf ( "<span class=\"%s\">out</span> ", css_keyword );
+ else if ( param.is_ref )
+ file.printf ( "<span class=\"%s\">ref</span> ", css_keyword );
+
+ this.write_type_reference ( param.type_reference, file );
+ file.printf ( " %s", param.name );
+ }
+ }
+
+ public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ bool open_bracket = false;
+
+ Gee.ArrayList<FormalParameter> params = thandler.param_list;
+ int size = params.size;
+ int i = 0;
+
+ file.putc ( '(' );
+
+ foreach ( FormalParameter param in params ) {
+ i++;
+
+ if ( param.default_value != null && open_bracket == false ) {
+ file.printf ( "<span class=\"%s\">[", css_optional_parameter );
+ open_bracket = true;
+ }
+
+ this.write_formal_parameter ( param, file );
+ if ( i != size ) {
+ file.puts ( ", " );
+ }
+ else if ( open_bracket == true ) {
+ file.puts ( "]</span>" );
+ }
+ }
+
+ file.putc ( ')' );
+ }
+
+ private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) {
+ Gee.ReadOnlyCollection<TypeReference> error_domains = exception_handler.get_error_domains ();
+ int size = error_domains.size;
+ int i = 1;
+
+ if ( size == 0 )
+ return ;
+
+ file.printf ( " <span class=\"%s\">throws</span> ", css_keyword );
+
+ foreach ( TypeReference type_reference in error_domains ) {
+ this.write_type_reference ( type_reference, file );
+ if ( error_domains.size > i ) {
+ file.puts ( ", " );
+ }
+ i++;
+ }
+ }
+
+ public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) {
+ this.position = m;
+
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( m, file );
+
+ if ( m.is_abstract )
+ modifiers.append ( " abstract" );
+ if ( m.is_virtual )
+ modifiers.append ( " virtual" );
+ if ( m.is_override )
+ modifiers.append ( " override" );
+ if ( m.is_static )
+ modifiers.append ( " static" );
+ if ( m.is_inline )
+ modifiers.append ( " inline" );
+
+ file.printf ( " <span class=\"%s\">%s</span> ", css_keyword, modifiers.str );
+ this.write_type_reference ( m.return_type, file );
+ file.puts ( m.name );
+ this.write_parameter_list ( m, file );
+ this.write_exception_list ( m, file );
+ }
+
+ public override void write_type_parameter ( TypeParameter param, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.puts ( param.datatype_name );
+ }
+
+ public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ int i = 1;
+
+ var lst = thandler.get_template_param_list( );
+ if ( lst.size == 0 )
+ return ;
+
+ file.puts ( "&lt;" ); // <
+
+
+ foreach ( TypeParameter param in lst ) {
+ param.write ( this, file );
+ if ( lst.size > i )
+ file.puts ( ", " );
+
+ i++;
+ }
+ file.puts ( "&gt;" ); // >
+ }
+
+ public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) {
+ this.position = field;
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( field, file );
+
+ if ( field.is_volatile )
+ file.printf ( " <span class=\"%s\">volatile</span>", css_keyword );
+
+ this.write_type_reference ( field.type_reference, file );
+
+ file.printf ( " %s", field.name );
+ }
+
+ public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) {
+ this.position = constant;
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( constant, file );
+ file.printf ( " <span class=\"%s\"> const </span>", css_keyword );
+ this.write_type_reference ( constant.type_reference, file );
+ file.printf ( " %s", constant.name );
+ }
+
+ public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ Property prop = (Property)propac.parent;
+
+ if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) {
+ // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.)
+ if ( propac.is_public )
+ file.printf ( "<span class=\"%s\">public</span> ", css_keyword );
+ else if ( propac.is_protected )
+ file.printf ( "<span class=\"%s\">protected</span> ", css_keyword );
+ else if ( propac.is_private )
+ file.printf ( "<span class=\"%s\">private</span> ", css_keyword );
+ }
+
+
+ if ( propac.is_get ) {
+ file.printf ( "<span class=\"%s\"> get</span>;", css_keyword );
+ }
+ else if ( propac.is_set ) {
+ if ( propac.is_construct ) {
+ file.printf ( "<span class=\"%s\"> construct</span> ", css_keyword );
+ }
+
+ file.printf ( "<span class=\"%s\"> set</span>;", css_keyword );
+ }
+ }
+
+ public override void write_property ( Valadoc.Property prop, void* ptr ) {
+ this.position = prop;
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ this.write_accessor ( prop, file );
+
+ if ( prop.is_virtual )
+ modifiers.append ( " virtual " );
+ if ( prop.is_abstract )
+ modifiers.append ( " abstract " );
+ if ( prop.is_override )
+ modifiers.append ( " override " );
+
+
+ this.write_type_reference ( prop.return_type, file );
+ file.printf ( " <span class=\"%s\">%s</span>%s { ", css_keyword, modifiers.str, prop.name );
+
+ if ( prop.setter != null )
+ this.write_property_accessor ( prop.setter, file );
+
+
+ file.printf ( " " );
+
+ if ( prop.getter != null )
+ this.write_property_accessor ( prop.getter, file );
+
+ file.printf ( " }" );
+ }
+
+ public override void write_signal ( Valadoc.Signal sig, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = sig;
+
+ this.write_accessor ( sig, file );
+
+ file.printf ( " <span class=\"%s\">signal</span> ", css_keyword );
+ this.write_type_reference ( sig.return_type, file );
+ file.printf ( " %s ", sig.name );
+ this.write_parameter_list ( sig, file );
+ }
+
+ public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) {
+ }
+
+ public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) {
+ }
+
+ public override void write_delegate ( Valadoc.Delegate del, void* ptr ) {
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = del;
+
+ this.write_accessor ( del, file );
+
+ file.printf ( " <span class=\"%s\">delegate</span> ", css_keyword );
+ this.write_type_reference ( del.return_type, file );
+ file.printf ( " %s ", del.name );
+ this.write_parameter_list ( del, file );
+ this.write_exception_list ( del, file );
+ }
+
+ public override void write_enum ( Valadoc.Enum en, void* ptr ) {
+ }
+
+ public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) {
+ }
+
+ private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) {
+ if ( element.is_public )
+ file.printf ( "<span class=\"%s\">public</span> ", css_keyword );
+ else if ( element.is_protected )
+ file.printf ( "<span class=\"%s\">protected</span> ", css_keyword );
+ else if ( element.is_private )
+ file.printf ( "<span class=\"%s\">private</span> ", css_keyword );
+ }
+
+
+ public override void write_struct ( Valadoc.Struct stru, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = stru;
+
+ this.write_accessor ( stru, file );
+ file.printf ( "<span class=\"%s\">struct</span> %s", css_keyword, stru.name );
+ this.write_template_parameters ( stru, ptr );
+ this.write_inheritance_list ( stru, file );
+ }
+
+ private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) {
+ Gee.Collection<DataType> lst = dtype.get_parent_types ( );
+ int size = lst.size;
+ int i = 1;
+
+ if ( size == 0 )
+ return ;
+
+ file.puts ( " : " );
+
+ foreach ( DataType cntype in lst ) {
+ this.write_type_name ( cntype, file );
+ if ( size > i )
+ file.puts ( ", " );
+
+ i++;
+ }
+
+ file.putc ( ' ' );
+ }
+
+ public override void write_class ( Valadoc.Class cl, void* ptr ) {
+ GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" );
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = cl;
+
+ this.write_accessor ( cl, file );
+
+ if ( cl.is_abstract )
+ modifiers.append ( "abstract " );
+ else if ( cl.is_static )
+ modifiers.append ( "static " );
+
+ file.printf ( "<span class=\"%s\">%s class</span> %s", css_keyword, modifiers.str, cl.name );
+
+ this.write_template_parameters ( cl, file );
+ this.write_inheritance_list ( cl, file );
+ }
+
+ public override void write_interface ( Valadoc.Interface iface, void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ this.position = iface;
+
+ this.write_accessor ( iface, file );
+
+ if ( iface.is_static )
+ file.printf ( "<span class=\"%s\">static interface</span> %s", css_keyword, iface.name );
+ else
+ file.printf ( "<span class=\"%s\">interface</span> %s", css_keyword, iface.name );
+
+ this.write_template_parameters ( iface, ptr );
+ this.write_inheritance_list ( iface, file );
+ }
+
+ public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
+ }
+
+ public override void write_file ( Valadoc.File file, void* ptr ) {
+ }
+}
+
+
+
+
+
+
+
+private class NamespaceBundle : Object {
+ public NamespaceBundle? parent { construct set; get; }
+ public string? name { construct set; get; }
+ public string path { construct set; get; }
+ public string link { construct set; get; }
+
+ public Gee.ArrayList<NamespaceBundle> subnamespaces = new Gee.ArrayList<NamespaceBundle> ();
+
+ public NamespaceBundle ( string path, string link, string? name, NamespaceBundle? parent = null ) {
+ this.parent = parent;
+ this.name = name;
+ this.path = path;
+ this.link = link;
+ }
+
+ private NamespaceBundle get_namespace_bundle ( Namespace ns ) {
+ foreach ( NamespaceBundle bundle in this.subnamespaces ) {
+ if ( this.name == ns.name ) {
+ return bundle;
+ }
+ }
+
+ NamespaceBundle nsbundle = new NamespaceBundle ( this.path + ns.name + "/", this.link+"::"+ns.name, ns.name, this );
+ this.subnamespaces.add ( nsbundle );
+ return nsbundle;
+ }
+
+ public Gee.ArrayList<ErrorDomain> errordomains = new Gee.ArrayList<ErrorDomain> ();
+ public Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface> ();
+ public Gee.ArrayList<Struct> structs = new Gee.ArrayList<Struct> ();
+ public Gee.ArrayList<Class> classes = new Gee.ArrayList<Class> ();
+ public Gee.ArrayList<Enum> enums = new Gee.ArrayList<Enum> ();
+
+ public Gee.ArrayList<Constant> constants = new Gee.ArrayList<Constant> ();
+ public Gee.ArrayList<Delegate> delegates = new Gee.ArrayList<Delegate> ();
+ public Gee.ArrayList<Method> methods = new Gee.ArrayList<Method> ();
+ public Gee.ArrayList<Field> fields = new Gee.ArrayList<Field> ();
+
+ public void merge_namespace ( Namespace ns ) {
+ Gee.Collection<Namespace> subnamespaces = ns.get_namespace_list ();
+ foreach ( Namespace subns in subnamespaces ) {
+ NamespaceBundle nsbundle = this.get_namespace_bundle ( subns );
+ nsbundle.merge_namespace ( subns );
+ }
+
+ Gee.Collection<ErrorDomain> errordomains = ns.get_error_domain_list ();
+ foreach ( ErrorDomain errdom in errordomains ) {
+ this.errordomains.add ( errdom );
+ }
+
+ Gee.Collection<Interface> interfaces = ns.get_interface_list ();
+ foreach ( Interface iface in interfaces ) {
+ this.interfaces.add ( iface );
+ }
+
+ Gee.Collection<Struct> structs = ns.get_struct_list ();
+ foreach ( Struct stru in structs ) {
+ this.structs.add ( stru );
+ }
+
+ Gee.Collection<Class> classes = ns.get_class_list ();
+ foreach ( Class cl in classes ) {
+ this.classes.add ( cl );
+ }
+
+ Gee.Collection<Enum> enums = ns.get_enum_list ();
+ foreach ( Enum en in enums ) {
+ this.enums.add ( en );
+ }
+
+ Gee.Collection<Constant> constants = ns.get_constant_list ();
+ foreach ( Constant c in constants ) {
+ this.constants.add ( c );
+ }
+
+ Gee.Collection<Delegate> delegates = ns.get_delegate_list ();
+ foreach ( Delegate d in delegates ) {
+ this.delegates.add ( d );
+ }
+
+ Gee.Collection<Method> methods = ns.get_method_list ();
+ foreach ( Method m in methods ) {
+ this.methods.add ( m );
+ }
+
+ Gee.Collection<Field> fields = ns.get_field_list ();
+ foreach ( Field f in fields ) {
+ this.fields.add ( f );
+ }
+ }
+}
+
+
+
+
+
+
+public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
+ private Valadoc.LangletIndex langlet;
+
+ private string current_path = null;
+ private bool is_vapi = false;
+
+
+ private void write_navi_entry_html_template ( GLib.FileStream file, string style, string content ) {
+ file.printf ( "\t<li class=\"%s\">%s</li>\n", style, content );
+ }
+
+ private void write_navi_entry_html_template_with_link ( GLib.FileStream file, string style, string link, string content ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", style, css_navi_link, link, content );
+ }
+
+ private void write_navi_entry ( GLib.FileStream file, Basic element, string style, bool link, bool full_name = false ) {
+ string name;
+
+ if ( element is File ) {
+ string path = this.get_file_name ( element );
+ name = this.get_package_name ( path );
+ }
+ else if ( full_name == true && element is Namespace ) {
+ string tmp = element.full_name();
+ name = (tmp == null)? "Global Namespace" : tmp;
+ }
+ else {
+ string tmp = element.name;
+ name = (tmp == null)? "Global Namespace" : tmp;
+ }
+
+ if ( link == true )
+ this.write_navi_entry_html_template_with_link ( file, style, this.get_link (element), name );
+ else
+ this.write_navi_entry_html_template ( file, style, name );
+ }
+
+ private void write_navi_top_entry ( GLib.FileStream file, Basic element, Basic mself ) {
+ string name = (element.name == null)? "Global Namespace" : element.name;
+ string style = null;
+
+ if ( element is Namespace )
+ style = css_navi_namespace;
+ else if ( element is Enum )
+ style = css_navi_enum;
+ else if ( element is ErrorDomain )
+ style = css_navi_error_domain;
+ else if ( element is Struct )
+ style = css_navi_struct;
+ else if ( element is Class )
+ style = css_navi_class;
+ else if ( element is Interface )
+ style = css_navi_iface;
+ else if ( element is File ) {
+ name = this.get_package_name ( element.name );
+ style = css_navi_package;
+ }
+
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ if ( element == mself )
+ this.write_navi_entry ( file, element, style, false );
+ else
+ this.write_navi_entry ( file, element, style, true );
+
+ file.puts ( "</ul>\n" );
+ file.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+ }
+
+ private void write_top_element ( GLib.FileStream file ) {
+ file.printf ( "<ul class=\"%s\">\n\t\t<li class=\"%s\"><a class=\"%s\" href=\"?\">Packages</a></li>\n</ul>\n<hr class=\"%s\">\n", css_navi, css_navi_package_index, css_navi_link, css_navi_hr );
+ }
+
+ private void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself = null ) {
+ Gee.ArrayList<Basic> lst = new Gee.ArrayList<Basic> ();
+ Basic pos = element;
+
+ if ( mself == null )
+ mself = element;
+
+ string file_name = this.get_file_name ( element );
+ string package_name = this.get_package_name ( file_name );
+
+ this.write_top_element ( file );
+
+ while ( pos != null ) {
+ lst.add ( pos );
+ pos = pos.parent;
+ }
+
+ for ( int i = lst.size-1; i >= 0 ; i-- ) {
+ Basic el = lst.get ( i );
+ this.write_navi_top_entry ( file, el, mself );
+ }
+ }
+
+
+ private void fetch_subnamespace_names ( NamespaceHandler pos, Gee.ArrayList<Namespace> lst ) {
+ Gee.ReadOnlyCollection<Namespace> nspaces = pos.get_namespace_list ();
+
+ foreach ( Namespace ns in nspaces ) {
+ lst.add ( ns );
+ this.fetch_subnamespace_names ( ns, lst );
+ }
+ }
+
+ private void write_navi_file ( GLib.FileStream file, File efile ) {
+ Gee.ArrayList<Namespace> ns_list = new Gee.ArrayList<Namespace> ();
+ this.fetch_subnamespace_names (efile, ns_list );
+
+ this.write_top_elements ( file, efile );
+
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ foreach ( Namespace ns in ns_list ) {
+ this.write_navi_entry ( file, ns, css_navi_namespace, true, true );
+ }
+
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself = null ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_namespaces_without_childs ( file, ns, mself );
+ this.write_navi_child_error_domains_without_childs ( file, ns, mself );
+ this.write_navi_child_enums_without_childs ( file, ns, mself );
+ this.write_navi_child_classes_without_childs ( file, ns, mself );
+ this.write_navi_child_interfaces_without_childs ( file, ns, mself );
+ this.write_navi_child_structs_without_childs ( file, ns, mself );
+ this.write_navi_child_delegates ( file, ns, mself );
+ this.write_navi_child_constants ( file, ns, mself );
+ this.write_navi_child_fields ( file, ns, mself );
+ this.write_navi_child_methods ( file, ns, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_child_namespaces ( GLib.FileStream file, Namespace ns, Basic mself = null ) {
+ this.write_top_elements ( file, ns );
+ this.write_navi_child_namespaces_inline ( file, ns, mself );
+ }
+
+ private void write_navi_struct_inline ( GLib.FileStream file, Struct stru, Basic mself = null ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_constants ( file, stru, mself );
+ this.write_navi_child_construction_methods ( file, stru, mself );
+ this.write_navi_child_fields ( file, stru, mself );
+ this.write_navi_child_methods ( file, stru, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_struct ( GLib.FileStream file, Struct stru, Basic mself = null ) {
+ this.write_top_elements ( file, stru );
+ this.write_navi_struct_inline ( file, stru, mself );
+ }
+
+ private void write_navi_interface_inline ( GLib.FileStream file, Interface iface, Basic mself = null ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_delegates ( file, iface, mself );
+ this.write_navi_child_fields ( file, iface, mself );
+ this.write_navi_child_properties ( file, iface, mself );
+ this.write_navi_child_methods ( file, iface, mself );
+ this.write_navi_child_signals ( file, iface, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_interface ( GLib.FileStream file, Interface iface, Basic mself = null ) {
+ this.write_top_elements ( file, iface );
+ this.write_navi_interface_inline ( file, iface, mself );
+ }
+
+ private void write_navi_enum_inline ( GLib.FileStream file, Enum en, Basic mself = null ) {
+ Gee.ReadOnlyCollection<EnumValue> enum_values = en.get_enum_values ( );
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ foreach ( EnumValue env in enum_values ) {
+ this.write_navi_entry ( file, env, css_navi_enval, true );
+ }
+
+ this.write_navi_child_methods ( file, en, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_enum ( GLib.FileStream file, Enum en, Basic mself = null ) {
+ this.write_top_elements ( file, en );
+ this.write_navi_enum_inline ( file, en, mself );
+ }
+
+ private void write_navi_error_domain_inline ( GLib.FileStream file, ErrorDomain errdom, Basic mself = null ) {
+ Gee.ReadOnlyCollection<ErrorCode> error_codes = errdom.get_error_code_list ( );
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+ foreach ( ErrorCode ec in error_codes ) {
+ this.write_navi_entry ( file, ec, css_navi_errdomcode, true );
+ }
+
+ this.write_navi_child_methods ( file, errdom, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_error_domain ( GLib.FileStream file, ErrorDomain errdom, Basic mself = null ) {
+ this.write_top_elements ( file, errdom );
+ this.write_navi_error_domain_inline ( file, errdom, mself );
+ }
+
+ private void write_navi_class_inline ( GLib.FileStream file, Class cl, Basic mself = null ) {
+ file.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_child_enums_without_childs ( file, cl, mself );
+ this.write_navi_child_classes_without_childs ( file, cl, mself );
+ this.write_navi_child_structs_without_childs ( file, cl, mself );
+ this.write_navi_child_delegates ( file, cl, mself );
+ this.write_navi_child_constants ( file, cl, mself );
+ this.write_navi_child_construction_methods ( file, cl, mself );
+ this.write_navi_child_fields ( file, cl, mself );
+ this.write_navi_child_properties ( file, cl, mself );
+ this.write_navi_child_methods ( file, cl, mself );
+ this.write_navi_child_signals ( file, cl, mself );
+ file.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_class ( GLib.FileStream file, Class cl, Basic mself = null ) {
+ this.write_top_elements ( file, cl );
+ this.write_navi_class_inline ( file, cl, mself );
+ }
+
+ private void write_navi_method ( GLib.FileStream file, Method m ) {
+ Basic parent = m.parent;
+
+ this.write_top_elements ( file, parent, m );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, m );
+ else if ( m.parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, m );
+ else if ( m.parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, m );
+ else if ( m.parent is Enum )
+ this.write_navi_enum_inline ( file, (Enum)parent, m );
+ else if ( m.parent is ErrorDomain )
+ this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m );
+ else if ( m.parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m );
+ }
+
+ private void write_navi_property ( GLib.FileStream file, Property prop ) {
+ Basic parent = prop.parent;
+
+ this.write_top_elements ( file, prop.parent, prop );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, prop );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, prop );
+ }
+
+ private void write_navi_signal ( GLib.FileStream file, Signal sig ) {
+ Basic parent = sig.parent;
+
+ this.write_top_elements ( file, sig.parent, sig );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, sig );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, sig );
+ }
+
+ private void write_navi_constant ( GLib.FileStream file, Constant c ) {
+ Basic parent = c.parent;
+
+ this.write_top_elements ( file, parent, c );
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, c );
+ else if ( parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, c );
+ else if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c );
+ //else if ( parent is Interface )
+ // this.write_navi_interface_inline ( file, (Interface)parent, c );
+ }
+
+ private void write_navi_field ( GLib.FileStream file, Field f ) {
+ Basic parent = f.parent;
+
+ this.write_top_elements ( file, parent, f );
+
+ if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, f );
+ else if ( parent is Struct )
+ this.write_navi_struct_inline ( file, (Struct)parent, f );
+ else if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, f );
+ }
+
+ private void write_navi_delegate ( GLib.FileStream file, Delegate del ) {
+ Basic parent = del.parent;
+
+ this.write_top_elements ( file, parent, del );
+
+ if ( parent is Namespace )
+ this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del );
+ else if ( parent is Class )
+ this.write_navi_class_inline ( file, (Class)parent, del );
+ else if ( parent is Interface )
+ this.write_navi_interface_inline ( file, (Interface)parent, del );
+ }
+
+
+ private void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection<Method> methods, Basic mself = null ) {
+ foreach ( Method m in methods ) {
+ if ( m == mself )
+ this.write_navi_entry ( file, m, css_navi_construction_method, false );
+ else
+ this.write_navi_entry ( file, m, css_navi_construction_method, true );
+ }
+ }
+
+ private void write_navi_child_methods ( GLib.FileStream file, MethodHandler mh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ( );
+ this.write_navi_child_methods_collection ( file, methods, mself );
+ }
+
+ private void write_navi_child_classes_without_childs_collection ( GLib.FileStream file, Gee.Collection<Class> classes, Basic mself = null ) {
+ foreach ( Class cl in classes ) {
+ if ( cl == mself )
+ this.write_navi_entry ( file, cl, css_navi_class, false );
+ else
+ this.write_navi_entry ( file, cl, css_navi_class, true );
+ }
+ }
+
+ private void write_navi_child_classes_without_childs ( GLib.FileStream file, ClassHandler clh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Class> classes = clh.get_class_list ( );
+ this.write_navi_child_classes_without_childs_collection ( file, classes, mself );
+ }
+
+ private void write_navi_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Method> methods = cmh.get_construction_method_list ( );
+ this.write_navi_child_methods_collection ( file, methods, mself );
+ }
+
+ private void write_navi_child_signals ( GLib.FileStream file, SignalHandler sh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Signal> signals = sh.get_signal_list ( );
+
+ foreach ( Signal sig in signals ) {
+ if ( sig == mself )
+ this.write_navi_entry ( file, sig, css_navi_sig, false );
+ else
+ this.write_navi_entry ( file, sig, css_navi_sig, true );
+ }
+ }
+
+ private void write_navi_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Property> properties = ph.get_property_list ( );
+
+ foreach ( Property p in properties ) {
+ if ( p == mself )
+ this.write_navi_entry ( file, p, css_navi_prop, false );
+ else
+ this.write_navi_entry ( file, p, css_navi_prop, true );
+ }
+ }
+
+ private void write_navi_child_fields_collection ( GLib.FileStream file, Gee.Collection<Field> fields, Basic mself = null ) {
+ foreach ( Field f in fields ) {
+ if ( f == mself )
+ this.write_navi_entry ( file, f, css_navi_field, false );
+ else
+ this.write_navi_entry ( file, f, css_navi_field, true );
+ }
+ }
+
+ private void write_navi_child_fields ( GLib.FileStream file, FieldHandler fh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Field> fields = fh.get_field_list ( );
+ this.write_navi_child_fields_collection ( file, fields, mself );
+ }
+
+ private void write_navi_child_constants_collection ( GLib.FileStream file, Gee.Collection<Constant> constants, Basic mself = null ) {
+ foreach ( Constant c in constants ) {
+ if ( c == mself )
+ this.write_navi_entry ( file, c, css_navi_constant, false );
+ else
+ this.write_navi_entry ( file, c, css_navi_constant, true );
+ }
+ }
+
+ private void write_navi_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Constant> constants = ch.get_constant_list ( );
+ this.write_navi_child_constants_collection ( file, constants, mself );
+ }
+
+ private void write_navi_child_structs_without_childs_collection ( GLib.FileStream file, Gee.Collection<Struct> structs, Basic mself = null ) {
+ foreach ( Struct stru in structs ) {
+ if ( stru == mself )
+ this.write_navi_entry ( file, stru, css_navi_struct, false );
+ else
+ this.write_navi_entry ( file, stru, css_navi_struct, true );
+ }
+ }
+
+ private void write_navi_child_structs_without_childs ( GLib.FileStream file, StructHandler strh, Basic mself = null ) {
+ Gee.Collection<Struct> structs = strh.get_struct_list ( );
+ this.write_navi_child_structs_without_childs_collection ( file, structs, mself );
+ }
+
+ private void write_navi_child_delegates_collection ( GLib.FileStream file, Gee.Collection<Delegate> delegates, Basic mself = null ) {
+ foreach ( Delegate del in delegates ) {
+ if ( del == mself )
+ this.write_navi_entry ( file, del, css_navi_del, false );
+ else
+ this.write_navi_entry ( file, del, css_navi_del, true );
+ }
+ }
+
+ private void write_navi_child_delegates ( GLib.FileStream file, DelegateHandler delh, Basic mself = null ) {
+ Gee.Collection<Delegate> delegates = delh.get_delegate_list ( );
+ this.write_navi_child_delegates_collection ( file, delegates, mself );
+ }
+
+ private void write_navi_child_interfaces_without_childs_collection ( GLib.FileStream file, Gee.Collection<Interface> interfaces, Basic mself = null ) {
+ foreach ( Interface iface in interfaces ) {
+ if ( iface == mself )
+ this.write_navi_entry ( file, iface, css_navi_iface, false );
+ else
+ this.write_navi_entry ( file, iface, css_navi_iface, true );
+ }
+ }
+
+ private void write_navi_child_interfaces_without_childs ( GLib.FileStream file, Namespace ifh, Basic mself = null ) {
+ Gee.Collection<Interface> interfaces = ifh.get_interface_list ( );
+ this.write_navi_child_interfaces_without_childs_collection ( file, interfaces, mself );
+ }
+
+ private void write_navi_child_enums_without_childs_collection ( GLib.FileStream file, Gee.Collection<Enum> enums, Basic mself = null ) {
+ foreach ( Enum en in enums ) {
+ if ( en == mself )
+ this.write_navi_entry ( file, en, css_navi_enum, false );
+ else
+ this.write_navi_entry ( file, en, css_navi_enum, true );
+ }
+ }
+
+ private void write_navi_child_enums_without_childs ( GLib.FileStream file, EnumHandler eh, Basic mself = null ) {
+ Gee.Collection<Enum> enums = eh.get_enum_list ( );
+ this.write_navi_child_enums_without_childs_collection ( file, enums, mself );
+ }
+
+ private void write_navi_child_error_domains_without_childs_collection ( GLib.FileStream file, Gee.Collection<ErrorDomain> errordomains, Basic mself = null ) {
+ foreach ( ErrorDomain errdom in errordomains ) {
+ if ( errdom == mself )
+ this.write_navi_entry ( file, errdom, css_navi_error_domain, false );
+ else
+ this.write_navi_entry ( file, errdom, css_navi_error_domain, true );
+ }
+ }
+
+ private void write_navi_child_error_domains_without_childs ( GLib.FileStream file, Namespace errdomh, Basic mself = null ) {
+ Gee.Collection<ErrorDomain> errordomains = errdomh.get_error_domain_list ( );
+ this.write_navi_child_error_domains_without_childs_collection ( file, errordomains, mself );
+ }
+
+ private void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself = null ) {
+ Gee.ReadOnlyCollection<Namespace> namespaces = nsh.get_namespace_list ( );
+ foreach ( Namespace ns in namespaces ) {
+ if ( ns == mself )
+ this.write_navi_entry ( file, ns, css_navi_namespace, false );
+ else
+ this.write_navi_entry ( file, ns, css_navi_namespace, true );
+ }
+ }
+
+ private string get_full_path ( Basic element ) {
+ if ( element.name == null )
+ return "";
+
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+
+ for ( var pos = element; pos != null ; pos = pos.parent ) {
+ if ( pos is File )
+ break;
+
+ str.prepend_unichar ( '/' );
+
+ if ( pos.name == null )
+ str.prepend ( "0" );
+ else
+ str.prepend ( pos.name );
+ }
+
+ string file_path = get_file_name ( element );
+ string package_name = get_package_name ( file_path ) + "/";
+
+ str.prepend ( package_name );
+ str.append_unichar ( '/' );
+ return str.str;
+ }
+
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public override void initialisation ( Settings settings ) {
+ this.settings = settings;
+
+ var rt = DirUtils.create ( this.settings.path, 0777 );
+ this.langlet = new Valadoc.LangletIndex ( settings );
+ }
+
+ private void write_image_block ( GLib.FileStream file, DataType element ) {
+ string realimgpath = this.current_path + "tree.png";
+ string imgpath = "docs/" + get_full_path ( element ) + "tree.png";
+
+ if ( element is Class ) {
+ Diagrams.write_class_diagram ( (Class)element, realimgpath );
+ }
+ else if ( element is Interface ) {
+ Diagrams.write_interface_diagram ( (Interface)element, realimgpath );
+ }
+ else if ( element is Struct ) {
+ Diagrams.write_struct_diagram ( (Struct)element, realimgpath );
+ }
+
+ file.printf ( "<h2 cass=\"%s\">Object Hierarchy:</h2>\n", css_title );
+ file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
+ }
+
+ public override void visit_file ( File file ) {
+ string package_name = this.get_package_name ( file.name );
+ this.is_vapi = file.name.has_suffix (".vapi");
+
+ stdout.printf ( "File:%s - %s\n", file.name, (this.is_vapi)?"true":"false" );
+
+ string new_path = this.settings.path + package_name + "/";
+ bool dir_exists = FileUtils.test ( new_path, FileTest.EXISTS);
+
+ if ( !dir_exists ) {
+ var rt = DirUtils.create ( new_path, 0777 );
+
+ GLib.FileStream nav = GLib.FileStream.open ( new_path + "navi.html", "w" );
+ this.write_navi_file ( nav, file );
+ }
+
+
+ this.current_path = new_path;
+ file.visit_namespaces ( this );
+ this.current_path = null;
+ }
+
+
+// private Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
+// globale Funktionen
+// globale Konstante
+// globale Delegates
+// globale Felder
+
+ private Gee.ArrayList<NamespaceBundle> namespaces = new Gee.ArrayList<NamespaceBundle> ();
+
+ private void add_namespace_bundle ( Namespace ns ) {
+ if ( ns.parent is Namespace )
+ return ;
+
+ foreach ( NamespaceBundle bundle in this.namespaces ) {
+ if ( bundle.name == ns.name ) {
+ bundle.merge_namespace ( ns );
+ return ;
+ }
+ }
+
+ NamespaceBundle bundle = new NamespaceBundle ( this.current_path, this.get_link(ns), ns.name );
+ this.namespaces.add ( bundle );
+ bundle.merge_namespace ( ns );
+ }
+
+ private void write_navi_namespace_bundle_path_navigation ( NamespaceBundle nsbundle, GLib.FileStream navi, Basic mself = null ) {
+ Gee.ArrayList<NamespaceBundle> parents = new Gee.ArrayList<NamespaceBundle> ();
+ for ( NamespaceBundle nsb = nsbundle.parent; nsb != null ; nsb = nsb.parent ) {
+ parents.insert ( 0, nsb );
+ }
+
+ this.write_top_element ( navi );
+
+ foreach ( NamespaceBundle nsb in parents ) {
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.path + "navi.html", nsb.name );
+ navi.puts ( "</ul>\n" );
+ navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+ }
+
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ if ( mself == null ) {
+ this.write_navi_entry_html_template ( navi, css_navi_namespace, nsbundle.name );
+ }
+ else {
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsbundle.path + "navi.html", nsbundle.name );
+ }
+ navi.puts ( "</ul>\n" );
+ navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
+
+ navi.printf ( "<ul class=\"%s\">\n", css_navi );
+ foreach ( NamespaceBundle nsb in nsbundle.subnamespaces ) {
+ this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.link, (nsb.name == null)? "Global Namespace" : nsb.name );
+ }
+ this.write_navi_child_classes_without_childs_collection ( navi, nsbundle.classes, mself );
+ this.write_navi_child_methods_collection ( navi, nsbundle.methods, mself );
+ this.write_navi_child_fields_collection ( navi, nsbundle.fields, mself );
+ this.write_navi_child_constants_collection ( navi, nsbundle.constants, mself );
+ this.write_navi_child_structs_without_childs_collection ( navi, nsbundle.structs, mself );
+ this.write_navi_child_delegates_collection ( navi, nsbundle.delegates, mself );
+ this.write_navi_child_interfaces_without_childs_collection ( navi, nsbundle.interfaces, mself );
+ this.write_navi_child_enums_without_childs_collection ( navi, nsbundle.enums, mself );
+ this.write_navi_child_error_domains_without_childs_collection ( navi, nsbundle.errordomains, mself );
+ navi.puts ( "</ul>\n" );
+ }
+
+ private void write_navi_namespace_bundle ( NamespaceBundle nsbundle, Basic mself = null ) {
+ foreach ( NamespaceBundle subnsbundle in nsbundle.subnamespaces ) {
+ this.write_navi_namespace_bundle ( subnsbundle );
+ }
+
+ foreach ( Constant c in nsbundle.constants ) {
+ GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + c.name + "/navi.html", "w" );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, c );
+ }
+ foreach ( Delegate del in nsbundle.delegates ) {
+ GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + del.name + "/navi.html", "w" );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, del );
+ }
+ foreach ( Method m in nsbundle.methods ) {
+ GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + m.name + "/navi.html", "w" );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, m );
+ }
+ foreach ( Field f in nsbundle.fields ) {
+ GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + f.name + "/navi.html", "w" );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, f );
+ }
+
+ GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + "navi.html", "w" );
+ this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, mself );
+ }
+
+ ~HtmlDoclet () {
+ foreach ( NamespaceBundle nsbundle in this.namespaces ) {
+ this.write_navi_namespace_bundle ( nsbundle );
+ }
+ }
+
+ public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name() );
+ file.printf ( "<hr class=\"%s\" />\n", css_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ ns.write_comment ( file );
+ }
+
+ public override void visit_namespace ( Namespace ns ) {
+ string old_path = this.current_path;
+
+ if ( ns.name == null ) {
+ string tmp = this.current_path + "0/";
+ this.current_path = tmp;
+ }
+ else {
+ string tmp = this.current_path + ns.name + "/";
+ this.current_path = tmp;
+ }
+
+ if ( !this.is_vapi ) {
+ this.add_namespace_bundle ( ns );
+ }
+
+ bool dir_exists = FileUtils.test ( this.current_path, FileTest.EXISTS);
+ if ( !dir_exists ) {
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ if ( this.is_vapi ) {
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_child_namespaces ( navi, ns );
+ navi = null;
+ }
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
+ this.write_namespace_content ( file, ns );
+ file = null;
+ }
+
+
+ // file:
+ ns.visit_namespaces ( this );
+ ns.visit_enums ( this );
+ ns.visit_error_domains ( this );
+ ns.visit_structs ( this );
+ ns.visit_interfaces ( this );
+ ns.visit_classes ( this );
+ ns.visit_delegates ( this );
+ ns.visit_constants ( this );
+ ns.visit_fields ( this );
+ ns.visit_methods ( this );
+
+ this.current_path = old_path;
+ }
+
+ private void write_child_classes ( GLib.FileStream file, ClassHandler clh ) {
+ Gee.ReadOnlyCollection<Class> classes = clh.get_class_list ();
+ if ( classes.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Classes:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Class subcl in classes ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_class, css_navi_link, this.get_link(subcl), subcl.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_enums ( GLib.FileStream file, EnumHandler eh ) {
+ Gee.Collection<Enum> enums = eh.get_enum_list ();
+ if ( enums.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Enums:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Enum en in enums ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_enum, css_navi_link, this.get_link(en), en.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_structs ( GLib.FileStream file, StructHandler struh ) {
+ Gee.Collection<Struct> structs = struh.get_struct_list ();
+ if ( structs.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Structs:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Struct stru in structs ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_struct, css_navi_link, this.get_link(stru), stru.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_methods ( GLib.FileStream file, MethodHandler mh ) {
+ Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ();
+ if ( methods.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Methods:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Method m in methods ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) {
+ Gee.Collection<Delegate> delegates = dh.get_delegate_list ();
+ if ( delegates.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Delegates:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Delegate d in delegates ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_delegate, css_navi_link, this.get_link(d), d.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) {
+ Gee.ReadOnlyCollection<Method> methods = cmh.get_construction_method_list ();
+ if ( methods.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Construction Methods:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Method m in methods ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_signals ( GLib.FileStream file, SignalHandler sh ) {
+ Gee.ReadOnlyCollection<Signal> signals = sh.get_signal_list ();
+ if ( signals.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Signals:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Signal sig in signals ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_signal, css_navi_link, this.get_link(sig), sig.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) {
+ Gee.ReadOnlyCollection<Property> properties = ph.get_property_list ();
+ if ( properties.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Properties:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Property prop in properties ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_property, css_navi_link, this.get_link(prop), prop.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_fields ( GLib.FileStream file, FieldHandler fh ) {
+ Gee.ReadOnlyCollection<Field> fields = fh.get_field_list ();
+ if ( fields.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Fields:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Field f in fields ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_fields, css_navi_link, this.get_link(f), f.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) {
+ Gee.ReadOnlyCollection<Constant> constants = ch.get_constant_list ();
+ if ( constants.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Constants:</h3>\n", css_title );
+ file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+ foreach ( Constant c in constants ) {
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_constant, css_navi_link, this.get_link(c), c.name );
+ }
+ file.puts ( "</ul>\n" );
+ }
+ }
+
+ private void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) {
+ Gee.ReadOnlyCollection<ErrorCode> error_codes = errdom.get_error_code_list ();
+ if ( error_codes.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Error Codes:</h3>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_errordomain_table );
+ foreach ( ErrorCode errcode in error_codes ) {
+ file.puts ( "<tr>\n" );
+ file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_errordomain_table_name, errcode.name, errcode.name );
+ file.printf ( "\t<td class=\"%s\">\n", css_errordomain_table_text );
+
+ errcode.write_comment ( file );
+
+ file.puts ( "\t</td>\n" );
+ file.puts ( "</tr>\n" );
+ }
+ file.puts ( "</table>\n" );
+ }
+ }
+
+ private void write_child_enum_values ( GLib.FileStream file, Enum en ) {
+ Gee.ReadOnlyCollection<EnumValue> enum_values = en.get_enum_values ();
+ if ( enum_values.size > 0 ) {
+ file.printf ( "<h3 class=\"%s\">Enum Values:</h3>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_enum_table );
+ foreach ( EnumValue enval in enum_values ) {
+ file.puts ( "<tr>\n" );
+ file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_enum_table_name, enval.name, enval.name );
+ file.printf ( "\t<td class=\"%s\">\n", css_enum_table_text );
+
+ enval.write_comment ( file );
+
+ file.puts ( "\t</td>\n" );
+ file.puts ( "</tr>\n" );
+ }
+ file.puts ( "</table>\n" );
+ }
+ }
+
+ public void write_interface_content ( GLib.FileStream file, Interface iface ) {
+ string full_name = get_full_name ( iface );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+
+ this.write_image_block ( file, iface );
+
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ iface.write_comment ( file );
+ this.write_namespace_note ( file, iface );
+ this.write_package_note ( file, iface );
+ file.printf ( "\n<h2 class=\"%s\">Content:</h2>\n", css_title );
+
+ this.write_child_classes ( file, iface );
+ this.write_child_structs ( file, iface );
+ this.write_child_delegates ( file, iface );
+ this.write_child_fields ( file, iface );
+ this.write_child_properties ( file, iface );
+ this.write_child_signals ( file, iface );
+ this.write_child_methods ( file, iface );
+ }
+
+ public override void visit_interface ( Interface iface ) {
+ string old_path = this.current_path;
+ this.current_path += iface.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ iface.visit_properties ( this );
+ iface.visit_delegates ( this );
+ iface.visit_signals ( this );
+ iface.visit_methods ( this );
+ iface.visit_structs ( this );
+ iface.visit_fields ( this );
+ iface.visit_structs ( this );
+ iface.visit_classes ( this );
+
+ GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
+ cname.puts ( iface.get_cname() );
+ cname = null;
+
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_interface ( navi, iface );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_interface_content ( file, iface );
+ file = null;
+
+ this.current_path = old_path;
+ }
+
+ public void write_class_content ( GLib.FileStream file, Class cl ) {
+ string full_name = get_full_name ( cl );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+
+ this.write_image_block ( file, cl );
+
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_class ( cl, file );
+ file.printf ( "\n</div>\n" );
+ cl.write_comment ( file );
+ this.write_namespace_note ( file, cl );
+ this.write_package_note ( file, cl );
+ file.printf ( "\n<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_construction_methods ( file, cl );
+ this.write_child_enums ( file, cl );
+ this.write_child_classes ( file, cl );
+ this.write_child_structs ( file, cl );
+ this.write_child_delegates ( file, cl );
+ this.write_child_constants ( file, cl );
+ this.write_child_fields ( file, cl );
+ this.write_child_properties ( file, cl );
+ this.write_child_signals ( file, cl );
+ this.write_child_methods ( file, cl );
+ }
+
+ public override void visit_class ( Class cl ) {
+ string old_path = this.current_path;
+ this.current_path += cl.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ cl.visit_enums ( this );
+ cl.visit_classes ( this );
+ cl.visit_structs ( this );
+ cl.visit_delegates ( this );
+ cl.visit_constants ( this );
+ cl.visit_construction_methods ( this );
+ cl.visit_methods ( this );
+ cl.visit_fields ( this );
+ cl.visit_properties ( this );
+ cl.visit_signals ( this );
+
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_class ( navi, cl );
+ navi = null;
+
+ GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
+ cname.puts ( cl.get_cname() );
+ cname = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_class_content ( file, cl );
+ file = null;
+
+ this.current_path = old_path;
+ }
+
+ public void write_struct_content ( GLib.FileStream file, Struct stru ) {
+ string full_name = get_full_name ( stru );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+
+ this.write_image_block ( file, stru );
+
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ stru.write_comment ( file );
+ this.write_namespace_note ( file, stru );
+ this.write_package_note ( file, stru );
+ file.printf ( "\n<h2 class=\"%s\">Content:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_struct ( stru, file );
+ file.printf ( "\n</div>\n" );
+
+ this.write_child_construction_methods ( file, stru );
+ this.write_child_constants ( file, stru );
+ this.write_child_fields ( file, stru );
+ this.write_child_methods ( file, stru );
+ }
+
+ public override void visit_struct ( Struct stru ) {
+ string old_path = this.current_path;
+ this.current_path += stru.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ stru.visit_constants ( this );
+ stru.visit_fields ( this );
+ stru.visit_construction_methods ( this );
+ stru.visit_methods ( this );
+
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_struct ( navi, stru );
+ navi = null;
+
+ GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
+ cname.puts ( stru.get_cname() );
+ cname = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_struct_content ( file, stru );
+ file = null;
+
+ this.current_path = old_path;
+ }
+
+ public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) {
+ string full_name = get_full_name ( errdom );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ errdom.write_comment ( file );
+ this.write_namespace_note ( file, errdom );
+ this.write_package_note ( file, errdom );
+ file.printf ( "\n<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_error_values ( file, errdom );
+ this.write_child_methods ( file, errdom );
+ }
+
+ public override void visit_error_domain ( ErrorDomain errdom ) {
+ string old_path = this.current_path;
+ this.current_path += errdom.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ errdom.visit_methods ( this );
+
+ GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
+ cname.puts ( errdom.get_cname() );
+ cname = null;
+
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_error_domain ( navi, errdom );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_error_domain_content ( file, errdom );
+ file = null;
+
+ this.current_path = old_path;
+ }
+
+ public void write_enum_content ( GLib.FileStream file, Enum en ) {
+ string full_name = get_full_name ( en );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ en.write_comment ( file );
+ this.write_namespace_note ( file, en );
+ this.write_package_note ( file, en );
+ file.printf ( "\n<h2 class=\"%s\">Content:</h2>\n", css_title );
+ this.write_child_enum_values ( file, en );
+ this.write_child_methods ( file, en );
+ }
+
+ public override void visit_enum ( Enum en ) {
+ string old_path = this.current_path;
+ this.current_path += en.name + "/";
+ var rt = DirUtils.create ( this.current_path, 0777 );
+
+ en.visit_enum_values ( this );
+ en.visit_methods ( this );
+
+ GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" );
+ cname.puts ( en.get_cname() );
+ cname = null;
+
+ GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+ this.write_navi_enum ( navi, en );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w");
+ this.write_enum_content ( file, en );
+ file = null;
+
+ this.current_path = old_path;
+ }
+
+ public void write_property_content ( GLib.FileStream file, Property prop ) {
+ string full_name = get_full_name ( prop );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_property ( prop, file );
+ file.printf ( "\n</div>\n" );
+ prop.write_comment ( file );
+ }
+
+ private void write_package_note ( GLib.FileStream file, Basic element ) {
+ string package = element.package;
+ if ( package == null )
+ return ;
+
+ file.printf ( "\n\n<br />\n<b>Package:</b> %s\n\n", package );
+ }
+
+ private void write_namespace_note ( GLib.FileStream file, Basic element ) {
+ for ( ; element is Namespace == false; element = element.parent )
+ ;
+
+ if ( element.parent == null )
+ return ;
+
+ if ( element.name == null )
+ return ;
+
+ file.printf ( "\n\n<br />\n<b>Namespace:</b> %s\n\n", element.full_name() );
+ }
+
+ public override void visit_property ( Property prop ) {
+ string path = this.current_path + prop.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+ if ( prop.parent is Class ) {
+ cname.printf ( "%s:%s", ((Class)prop.parent).get_cname(), prop.get_cname() );
+ }
+ else {
+ cname.printf ( "%s:%s", ((Interface)prop.parent).get_cname(), prop.get_cname() );
+ }
+ cname = null;
+
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_property ( navi, prop );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_property_content ( file, prop );
+ file = null;
+ }
+
+ public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) {
+ string full_name = get_full_name ( constant );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_constant ( constant, parent, file );
+ file.printf ( "\n</div>\n" );
+ constant.write_comment ( file );
+ if ( constant.parent is Namespace ) {
+ this.write_namespace_note ( file, constant );
+ this.write_package_note ( file, constant );
+ }
+ }
+
+ public override void visit_constant ( Constant constant, ConstantHandler parent ) {
+ string path = this.current_path + constant.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || constant.parent is Namespace == false ) {
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_constant ( navi, constant );
+ navi = null;
+ }
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_constant_content ( file, constant, parent );
+ file = null;
+ }
+
+ public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) {
+ string full_name = get_full_name ( field );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_field ( field, parent, file );
+ file.printf ( "\n</div>\n" );
+ field.write_comment ( file );
+ if ( field.parent is Namespace ) {
+ this.write_namespace_note ( file, field );
+ this.write_package_note ( file, field );
+ }
+ }
+
+ public override void visit_field ( Field field, FieldHandler parent ) {
+ string path = this.current_path + field.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+ if ( field.parent is Class ) {
+ cname.puts( ((Class)field.parent).get_cname() );
+ }
+ else if ( field.parent is Struct ) {
+ cname.puts( ((Struct)field.parent).get_cname() );
+ }
+ else if ( field.parent is Interface ) {
+ cname.puts( ((Interface)field.parent).get_cname() );
+ }
+ else if ( field.parent is Namespace ) {
+ cname.puts( field.get_cname() );
+ }
+ cname = null;
+
+ if ( this.is_vapi || field.parent is Namespace == false ) {
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_field ( navi, field );
+ navi = null;
+ }
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_field_content ( file, field, parent );
+ file = null;
+ }
+
+ public override void visit_error_code ( ErrorCode errcode ) {
+ }
+
+ public override void visit_enum_value ( EnumValue enval ) {
+ }
+
+ public void write_delegate_content ( GLib.FileStream file, Delegate del ) {
+ string full_name = get_full_name ( del );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_delegate ( del, file );
+ file.printf ( "\n</div>\n" );
+ del.write_comment ( file );
+ if ( del.parent is Namespace ) {
+ this.write_namespace_note ( file, del );
+ this.write_package_note ( file, del );
+ }
+ }
+
+ public override void visit_delegate ( Delegate del ) {
+ string path = this.current_path + del.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || del.parent is Namespace == false ) {
+ GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+ cname.puts ( del.get_cname() );
+ cname = null;
+ }
+
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_delegate ( navi, del );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_delegate_content ( file, del );
+ file = null;
+ }
+
+ public void write_signal_content ( GLib.FileStream file, Signal sig ) {
+ string full_name = get_full_name ( sig );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_signal ( sig, file );
+ file.printf ( "\n</div>\n" );
+ sig.write_comment ( file );
+ }
+
+ public override void visit_signal ( Signal sig ) {
+ string path = this.current_path + sig.name + "/";
+ var rt = DirUtils.create ( path, 0777 );
+
+ GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+ if ( sig.parent is Class ) {
+ cname.printf ( "%s::%s", ((Class)sig.parent).get_cname(), sig.get_cname() );
+ }
+ else {
+ cname.printf ( "%s::%s", ((Interface)sig.parent).get_cname(), sig.get_cname() );
+ }
+ cname = null;
+
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_signal ( navi, sig );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ write_signal_content ( file, sig );
+ file = null;
+ }
+
+ public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) {
+ string full_name = get_full_name ( m );
+ file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
+ file.printf ( "<hr class=\"%s\" />\n", css_headline_hr );
+ file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
+ file.printf ( "<div class=\"%s\">\n\t", css_code_definition );
+ this.langlet.write_method ( file, m, parent );
+ file.printf ( "\n</div>\n" );
+ m.write_comment ( file );
+ if ( m.parent is Namespace ) {
+ this.write_namespace_note ( file, m );
+ this.write_package_note ( file, m );
+ }
+ }
+
+ public override void visit_method ( Method m, Valadoc.MethodHandler parent ) {
+ string path = this.current_path + m.name + "/";
+ string full_name = get_full_name ( m );
+ var rt = DirUtils.create ( path, 0777 );
+
+ if ( this.is_vapi || m.parent is Namespace == false ) {
+ GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+ cname.puts ( m.get_cname () );
+ cname = null;
+ }
+
+ GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+ this.write_navi_method ( navi, m );
+ navi = null;
+
+ GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+ this.write_method_content ( file, m, parent );
+ file = null;
+ }
+}
+
+
+
+
+
+[ModuleInit]
+public Type register_plugin ( ) {
+ return typeof ( Valadoc.HtmlDoclet );
+}
+
diff --git a/src/doclets/valadoc.org/linkhelper/Makefile.am b/src/doclets/valadoc.org/linkhelper/Makefile.am
new file mode 100644
index 000000000..519ec1be8
--- /dev/null
+++ b/src/doclets/valadoc.org/linkhelper/Makefile.am
@@ -0,0 +1,44 @@
+# src/Makefile.am
+
+
+
+libhtmlhelper_VALASOURCES = \
+ helper.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libhtmlhelper.vala.stamp
+
+
+libhtmlhelper.vala.stamp: $(libhtmlhelper_VALASOURCES)
+ $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^
+ touch $@
+
+
+
+htmlhelperdir = $(libdir)/valadoc/plugins/valadoc.org/
+htmlhelper_LTLIBRARIES = libhtmlhelper.la
+
+
+libhtmlhelper_la_SOURCES = \
+ libhtmlhelper.vala.stamp \
+ $(libhtmlhelper_VALASOURCES:.vala=.c) \
+ $(libhtmlhelper_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+AM_CFLAGS = \
+ -I ../../../libvaladoc/ \
+ $(LIBVALA_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(NULL)
+
+
+libhtmlhelper_la_LIBADD = \
+ ../../../libvaladoc/libvaladoc.la \
+ $(LIBVALA_LIBS) \
+ $(GLIB_LIBS) \
+ $(NULL)
+
+
+EXTRA_DIST = $(libhtmlhelper_VALASOURCES) libhtmlhelper.vala.stamp
diff --git a/src/doclets/valadoc.org/linkhelper/helper.vala b/src/doclets/valadoc.org/linkhelper/helper.vala
new file mode 100755
index 000000000..23b049c59
--- /dev/null
+++ b/src/doclets/valadoc.org/linkhelper/helper.vala
@@ -0,0 +1,169 @@
+/*
+ * 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 GLib;
+
+
+
+/* css-class-names: */
+public const string css_inline_navigation = "main_inline_navigation";
+public const string css_inline_navigation_property = "main_inline_navigation_property";
+public const string css_inline_navigation_method = "main_inline_navigation_method";
+public const string css_inline_navigation_signal = "main_inline_navigation_signal";
+public const string css_inline_navigation_fields = "main_inline_navigation_fields";
+public const string css_inline_navigation_class = "main_inline_navigation_class";
+public const string css_inline_navigation_enum = "main_inline_navigation_enum";
+public const string css_inline_navigation_struct = "main_inline_navigation_struct";
+public const string css_inline_navigation_delegate = "main_inline_navigation_delegate";
+public const string css_inline_navigation_constant = "main_inline_navigation_constant";
+
+public const string css_navi_package_index = "navi_package_index";
+public const string css_navi_package = "navi_package";
+public const string css_navi_construction_method = "navi_construction_method";
+public const string css_navi_error_domain = "navi_error_domain";
+public const string css_navi_namespace = "navi_namespace";
+public const string css_navi_method = "navi_method";
+public const string css_navi_struct = "navi_struct";
+public const string css_navi_iface = "navi_iface";
+public const string css_navi_field = "navi_field";
+public const string css_navi_class = "navi_class";
+public const string css_navi_enum = "navi_enum";
+public const string css_navi_link = "navi_link";
+public const string css_navi_constant = "navi_constant";
+public const string css_navi_prop = "navi_prop";
+public const string css_navi_del = "navi_del";
+public const string css_navi_sig = "navi_sig";
+public const string css_navi = "navi_main";
+public const string css_navi_enval = "main_navi_enval";
+public const string css_navi_errdomcode = "main_navi_errdomcode";
+public const string css_navi_hr = "navi_hr";
+
+public const string css_errordomain_table_name = "main_errordomain_table_name";
+public const string css_errordomain_table_text = "main_errordomain_table_text";
+public const string css_errordomain_table = "main_errordomain_table";
+
+
+public const string css_enum_table_name = "main_enum_table_name";
+public const string css_enum_table_text = "main_enum_table_text";
+public const string css_enum_table = "main_enum_table";
+
+public const string css_diagram = "main_diagram";
+public const string css_see_list = "main_see_list";
+public const string css_exception_table = "main_parameter_table";
+public const string css_parameter_table_text = "main_parameter_table_text";
+public const string css_parameter_table_name = "main_parameter_table_name";
+public const string css_parameter_table = "main_parameter_table";
+public const string css_title = "main_title";
+public const string css_other_type = "main_other_type";
+public const string css_basic_type = "main_basic_type";
+public const string css_keyword = "main_keyword";
+public const string css_optional_parameter = "main_optional_parameter";
+public const string css_code_definition = "main_code_definition";
+public const string css_headline_hr = "main_hr";
+public const string css_hr = "main_hr";
+public const string css_list_errdom = "main_list_errdom";
+public const string css_list_en = "main_list_en";
+public const string css_list_ns = "main_list_ns";
+public const string css_list_cl = "main_list_cl";
+public const string css_list_iface = "main_list_iface";
+public const string css_list_stru = "main_list_stru";
+public const string css_list_field = "main_list_field";
+public const string css_list_prop = "main_list_prop";
+public const string css_list_del = "main_list_del";
+public const string css_list_sig = "main_list_sig";
+public const string css_list_m = "main_list_m";
+
+public interface Valadoc.LinkHelper : Object {
+ private static string package_name = null;
+
+ public abstract Settings settings {
+ construct set;
+ get;
+ }
+
+ private string get_dirname ( string file_name ) {
+ if ( file_name[file_name.len()-1] == '/' )
+ return GLib.Path.get_dirname ( file_name );
+ else
+ return GLib.Path.get_basename ( file_name );
+ }
+
+ protected string get_package_name ( string file_path ) {
+ if ( file_path.has_suffix (".vapi") ) {
+ string file_name = GLib.Path.get_basename (file_path);
+ return file_name.ndup ( file_name.size() - ".vapi".size() );
+ }
+
+ if ( this.package_name == null ) {
+ string file_name = this.get_dirname( settings.path );
+ this.package_name = file_name; //file_name.ndup ( file_name.size() - ".vala".size() );
+ }
+
+ return this.package_name;
+ }
+
+ public string get_file_name ( Valadoc.Basic tag ) {
+ Valadoc.Basic pos = tag;
+
+ while ( pos != null ) {
+ if ( pos is Valadoc.File )
+ return pos.name;
+
+ pos = pos.parent;
+ }
+ return null;
+ }
+
+ protected string? get_link ( Valadoc.Basic tag ) {
+// if ( !this.settings.to_doc( tag.file_name ) )
+// return null;
+
+ GLib.StringBuilder str = new GLib.StringBuilder ( "" );
+ Valadoc.Basic pos = tag;
+
+ if ( tag is Valadoc.File == false ) {
+ if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) {
+ str.append_unichar ( '#' );
+ str.append ( tag.name );
+ pos = pos.parent;
+ }
+
+ while ( pos != null ) {
+ if ( pos.name == null )
+ str.prepend ( "0" );
+ else
+ str.prepend ( pos.name );
+
+ str.prepend ( "::" );
+
+ if ( pos.parent is Valadoc.File )
+ break;
+
+ pos = pos.parent;
+ }
+ }
+ string filename = this.get_file_name ( tag );
+ string package_name = this.get_package_name ( filename );
+ str.prepend ( package_name );
+ str.prepend ( "?path=" );
+ return str.str;
+ }
+}
+
+
diff --git a/src/doclets/valadoc.org/taglets/Makefile.am b/src/doclets/valadoc.org/taglets/Makefile.am
new file mode 100644
index 000000000..adb9f7d12
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/Makefile.am
@@ -0,0 +1,16 @@
+# src/Makefile.am
+
+NULL =
+
+
+SUBDIRS = \
+ see \
+ link \
+ return \
+ string \
+ throws \
+ version \
+ parameter \
+ $(NULL)
+
+
diff --git a/src/doclets/valadoc.org/taglets/author/Makefile.am b/src/doclets/valadoc.org/taglets/author/Makefile.am
new file mode 100644
index 000000000..a16a4a707
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/author/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletversion_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletversion.vala.stamp
+
+
+libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletversiondir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletversion_LTLIBRARIES = libtagletversion.la
+
+
+libtagletversion_la_SOURCES = \
+ libtagletversion.vala.stamp \
+ $(libtagletversion_VALASOURCES:.vala=.c) \
+ $(libtagletversion_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletversion_la_LDFLAGS = -module -avoid-version
+
+
+libtagletversion_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletversion_VALASOURCES) libtagletversion.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/author/taglet.vala b/src/doclets/valadoc.org/taglets/author/taglet.vala
new file mode 100644
index 000000000..0e55bbe41
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/author/taglet.vala
@@ -0,0 +1,83 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+public class AuthorHtmlTaglet : MainTaglet {
+ private string? email;
+ private string name;
+
+ public override int order {
+ get { return 400; }
+ }
+
+ public override bool write_block_start ( void* res ) {
+ ((GLib.FileStream)res).puts ( "\t\t<table width=\"100%\" align=\"center\">\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t<tr>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td colspan=\"2\"><h5>Version:</h5></td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t</tr>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t<tr>" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td width=\"5\">&nbsp;</td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t\t<td>\n" );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ ((GLib.FileStream)res).puts ( "</td>\n" );
+ ((GLib.FileStream)res).puts ( "\t\t\t</tr>" );
+ ((GLib.FileStream)res).puts ( "\t\t</table>\n" );
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Basic me, Gee.ArrayList<InlineTaglet> content ) {
+ if ( content.size != 1 )
+ return false;
+
+ InlineTaglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ str = str.strip ( );
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ ((GLib.FileStream)res).printf ( "%s", this.version );
+ if ( max != index+1 )
+ ((GLib.FileStream)res).puts ( ", " );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( AuthorHtmlTaglet );
+ taglets.set ( "author", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/link/Makefile.am b/src/doclets/valadoc.org/taglets/link/Makefile.am
new file mode 100644
index 000000000..7d105468b
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/link/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletlink_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletlink.vala.stamp
+
+
+libtagletlink.vala.stamp: $(libtagletlink_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletlinkdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletlink_LTLIBRARIES = libtagletlink.la
+
+
+libtagletlink_la_SOURCES = \
+ libtagletlink.vala.stamp \
+ $(libtagletlink_VALASOURCES:.vala=.c) \
+ $(libtagletlink_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletlink_la_LDFLAGS = -module -avoid-version
+
+
+libtagletlink_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletlink_VALASOURCES) libtagletlink.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/link/taglet.vala b/src/doclets/valadoc.org/taglets/link/taglet.vala
new file mode 100644
index 000000000..cf8e06c89
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/link/taglet.vala
@@ -0,0 +1,72 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+public class LinkHtmlTaglet : InlineTaglet, LinkHelper {
+ private string content;
+ private string path;
+
+ public Settings settings {
+ construct set;
+ get;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, string content ) {
+ string[] arr = content.split ( "\n" );
+ string str = string.joinv ("", arr ).strip();
+
+ Valadoc.Basic? element = tree.search_symbol_str ( me, str );
+ if ( element == null ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+5, "Linked Type is not available.\n", error_start );
+ return false;
+ }
+
+ this.settings = settings;
+ this.path = this.get_link ( element );
+ this.content = str;
+ return true;
+ }
+
+
+ public override bool write ( void* res, int max, int index ) {
+ if ( this.path == null )
+ ((GLib.FileStream)res).printf ( "<i>%s</i>", this.content );
+ else
+ ((GLib.FileStream)res).printf ( "<a href=\"%s\">%s</a>", this.path, this.content );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( LinkHtmlTaglet );
+ taglets.set ( "link", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/parameter/Makefile.am b/src/doclets/valadoc.org/taglets/parameter/Makefile.am
new file mode 100644
index 000000000..3211b3b83
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/parameter/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletparameter_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletparameter.vala.stamp
+
+
+libtagletparameter.vala.stamp: $(libtagletparameter_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletparameterdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletparameter_LTLIBRARIES = libtagletparameter.la
+
+
+libtagletparameter_la_SOURCES = \
+ libtagletparameter.vala.stamp \
+ $(libtagletparameter_VALASOURCES:.vala=.c) \
+ $(libtagletparameter_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletparameter_la_LDFLAGS = -module -avoid-version
+
+
+libtagletparameter_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletparameter_VALASOURCES) libtagletparameter.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/parameter/taglet.vala b/src/doclets/valadoc.org/taglets/parameter/taglet.vala
new file mode 100644
index 000000000..f49063ac3
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/parameter/taglet.vala
@@ -0,0 +1,126 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ParameterHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
+ private string paramname = "";
+
+ public override int order {
+ get { return 100; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_parameter_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+ private bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
+ foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
+ if ( param.name == name )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+
+ string strpos = ((StringTaglet)tag).content;
+ string paramname;
+
+ strpos = this.get_next_word ( strpos, out paramname );
+ ((StringTaglet)tag).content = strpos;
+ this.paramname = paramname;
+
+ if ( this.paramname == "" ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
+ return false;
+ }
+
+ if ( !check_parameter_name ( ((Valadoc.ParameterListHandler)me), this.paramname ) ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
+ return false;
+ }
+
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+}
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ParameterHtmlTaglet );
+ taglets.set ( "param", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/return/Makefile.am b/src/doclets/valadoc.org/taglets/return/Makefile.am
new file mode 100644
index 000000000..fb7ecc9f1
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/return/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletXXXX_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletXXXX.vala.stamp
+
+
+libtagletXXXX.vala.stamp: $(libtagletXXXX_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletXXXXdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletXXXX_LTLIBRARIES = libtagletXXXX.la
+
+
+libtagletXXXX_la_SOURCES = \
+ libtagletXXXX.vala.stamp \
+ $(libtagletXXXX_VALASOURCES:.vala=.c) \
+ $(libtagletXXXX_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletXXXX_la_LDFLAGS = -module -avoid-version
+
+
+libtagletXXXX_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletXXXX_VALASOURCES) libtagletXXXX.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/return/taglet.vala b/src/doclets/valadoc.org/taglets/return/taglet.vala
new file mode 100644
index 000000000..2292f61dc
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/return/taglet.vala
@@ -0,0 +1,71 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ReturnHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
+
+ public override int order {
+ get { return 300; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ReturnHtmlTaglet );
+ taglets.set ( "return", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/see/Makefile.am b/src/doclets/valadoc.org/taglets/see/Makefile.am
new file mode 100644
index 000000000..60d5b9093
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/see/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletsee_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletsee.vala.stamp
+
+
+libtagletsee.vala.stamp: $(libtagletsee_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletseedir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletsee_LTLIBRARIES = libtagletsee.la
+
+
+libtagletsee_la_SOURCES = \
+ libtagletsee.vala.stamp \
+ $(libtagletsee_VALASOURCES:.vala=.c) \
+ $(libtagletsee_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletsee_la_LDFLAGS = -module -avoid-version
+
+
+libtagletsee_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletsee_VALASOURCES) libtagletsee.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/see/taglet.vala b/src/doclets/valadoc.org/taglets/see/taglet.vala
new file mode 100644
index 000000000..17fe5b0ef
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/see/taglet.vala
@@ -0,0 +1,100 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+public class SeeHtmlTaglet : MainTaglet, LinkHelper {
+ private string name;
+ private string path;
+
+ public override int order {
+ get { return 500; }
+ }
+
+ public Settings settings {
+ construct set;
+ get;
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
+ file.printf ( "<ul class=\"%s\">", css_see_list );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.puts ( "</ul>" );
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
+ return false;
+ }
+
+ string[] arr = ((StringTaglet)tag).content.split ( "\n" );
+ string str = string.joinv ("", arr ).strip();
+
+ Valadoc.Basic? element = tree.search_symbol_str ( me, str );
+ if ( element == null ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+4, "Linked type is not available.\n", error_start );
+ return false;
+ }
+
+ this.settings = settings;
+ this.path = this.get_link ( element );
+ this.name = str;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<li class=\"%s\"><a href=\"%s\">%s</a></li>\n", css_see_list, this.path, this.name );
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( SeeHtmlTaglet );
+ taglets.set ( "see", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/string/Makefile.am b/src/doclets/valadoc.org/taglets/string/Makefile.am
new file mode 100644
index 000000000..44676c49f
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/string/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletstring_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletstring.vala.stamp
+
+
+libtagletstring.vala.stamp: $(libtagletstring_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletstringdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletstring_LTLIBRARIES = libtagletstring.la
+
+
+libtagletstring_la_SOURCES = \
+ libtagletstring.vala.stamp \
+ $(libtagletstring_VALASOURCES:.vala=.c) \
+ $(libtagletstring_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletstring_la_LDFLAGS = -module -avoid-version
+
+
+libtagletstring_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletstring_VALASOURCES) libtagletstring.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/string/taglet.vala b/src/doclets/valadoc.org/taglets/string/taglet.vala
new file mode 100644
index 000000000..a958874d1
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/string/taglet.vala
@@ -0,0 +1,54 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class StringHtmlTaglet : StringTaglet {
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content ) {
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* res, int max , int index ) {
+ try {
+ string str = new Regex ( Regex.escape_string ("\n")).replace_literal ( this.content, -1, 0, "\n<br>" );
+ ((GLib.FileStream)res).puts ( str );
+ }
+ catch ( RegexError err ) {
+ return false;
+ }
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( StringHtmlTaglet );
+ taglets.set ( "", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/throws/Makefile.am b/src/doclets/valadoc.org/taglets/throws/Makefile.am
new file mode 100644
index 000000000..2ec375a83
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/throws/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libexceptionparameter_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libexceptionparameter.vala.stamp
+
+
+libexceptionparameter.vala.stamp: $(libexceptionparameter_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+exceptionparameterdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+exceptionparameter_LTLIBRARIES = libexceptionparameter.la
+
+
+libexceptionparameter_la_SOURCES = \
+ libexceptionparameter.vala.stamp \
+ $(libexceptionparameter_VALASOURCES:.vala=.c) \
+ $(libexceptionparameter_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libexceptionparameter_la_LDFLAGS = -module -avoid-version
+
+
+libexceptionparameter_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libexceptionparameter_VALASOURCES) libexceptionparameter.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/throws/taglet.vala b/src/doclets/valadoc.org/taglets/throws/taglet.vala
new file mode 100644
index 000000000..537ed5714
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/throws/taglet.vala
@@ -0,0 +1,130 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class ExceptionHtmlTaglet : MainTaglet {
+ private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
+ private string paramname = "";
+
+ public override int order {
+ get { return 200; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_exception_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+ private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
+ if ( paramname[0] == '.' )
+ return false;
+
+ foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
+ if ( param.type_name.has_suffix ( paramname ) )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size == 0 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ string strpos = ((StringTaglet)tag).content;
+ string paramname;
+
+ strpos = this.get_next_word ( strpos, out paramname );
+ ((StringTaglet)tag).content = strpos;
+ this.paramname = paramname;
+
+ if ( this.paramname == "" ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
+ return false;
+ }
+
+ if ( !check_exception_parameter_name ( ((Valadoc.ExceptionHandler)me), this.paramname ) ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
+ return false;
+ }
+
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( Taglet tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( ExceptionHtmlTaglet );
+ taglets.set ( "throws", type );
+ return type;
+}
+
diff --git a/src/doclets/valadoc.org/taglets/version/Makefile.am b/src/doclets/valadoc.org/taglets/version/Makefile.am
new file mode 100644
index 000000000..a16a4a707
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/version/Makefile.am
@@ -0,0 +1,55 @@
+# src/Makefile.am
+
+
+
+libtagletversion_VALASOURCES = \
+ taglet.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libtagletversion.vala.stamp
+
+
+libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES)
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ touch $@
+
+
+
+
+tagletversiondir = $(libdir)/valadoc/plugins/valadoc.org/taglets/
+
+tagletversion_LTLIBRARIES = libtagletversion.la
+
+
+libtagletversion_la_SOURCES = \
+ libtagletversion.vala.stamp \
+ $(libtagletversion_VALASOURCES:.vala=.c) \
+ $(libtagletversion_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = -g \
+ -I ../../../../libvaladoc/ \
+ -I ../../linkhelper/ \
+ -I ../../ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(NULL)
+
+
+libtagletversion_la_LDFLAGS = -module -avoid-version
+
+
+libtagletversion_la_LIBADD = \
+ ../../../../libvaladoc/libvaladoc.la \
+ ../../linkhelper/libhtmlhelper.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(NULL)
+
+
+
+
+EXTRA_DIST = $(libtagletversion_VALASOURCES) libtagletversion.vala.stamp
diff --git a/src/doclets/valadoc.org/taglets/version/taglet.vala b/src/doclets/valadoc.org/taglets/version/taglet.vala
new file mode 100644
index 000000000..02ca5e6e6
--- /dev/null
+++ b/src/doclets/valadoc.org/taglets/version/taglet.vala
@@ -0,0 +1,82 @@
+/*
+ * 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 Valadoc;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+public class VersionHtmlTaglet : MainTaglet {
+ private string version;
+
+ public override int order {
+ get { return 400; }
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "<h2 class=\"%s\">Version:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+
+ public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
+ if ( content.size != 1 ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
+ return false;
+ }
+
+ Taglet tag = content.get ( 0 );
+ if ( tag is StringTaglet == false ) {
+ string error_start = this.extract_lines ( line_start, 0, 0 );
+ reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ this.version = str.strip ( );
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ ((GLib.FileStream)res).printf ( "%s", this.version );
+ if ( max != index+1 )
+ ((GLib.FileStream)res).puts ( ", " );
+
+ return true;
+ }
+}
+
+
+
+[ModuleInit]
+public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
+ GLib.Type type = typeof ( VersionHtmlTaglet );
+ taglets.set ( "version", type );
+ return type;
+}
+
diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am
new file mode 100644
index 000000000..b3e1f4241
--- /dev/null
+++ b/src/libvaladoc/Makefile.am
@@ -0,0 +1,70 @@
+# src/Makefile.am
+
+
+
+libvaladoc_VALASOURCES = \
+ drawer.vala \
+ settings.vala \
+ doclet.vala \
+ errorreporter.vala \
+ parser.vala \
+ doctree.vala \
+ langlet.vala \
+ xmlparser.vala \
+ xmlimporter.vala \
+ $(NULL)
+
+
+BUILT_SOURCES = libvaladoc.vala.stamp
+
+
+libvaladoc.vala.stamp: $(libvaladoc_VALASOURCES)
+ $(VALAC) -C --pkg vala-1.0 --pkg gmodule-2.0 --vapidir ../vapi --pkg libxml-2.0 --pkg libgvc --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --disable-non-null --save-temps $^
+ touch $@
+
+
+vapis:
+
+valadocdir = $(libdir)/valadoc/
+valadoc_LTLIBRARIES = libvaladoc.la
+
+
+libvaladoc_la_SOURCES = \
+ libvaladoc.vala.stamp \
+ $(libvaladoc_VALASOURCES:.vala=.c) \
+ $(libvaladoc_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+ccodeincludedir = $(includedir)/valadoc-1.0
+
+ccodeinclude_HEADERS = \
+ $(libvaladoc_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+
+AM_CFLAGS = \
+ $(LIBXML2_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ $(LIBGVC_CFLAGS) \
+ $(NULL)
+
+
+libvaladoc_la_LIBADD = \
+ $(LIBXML2_LIBS) \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(GMODULE_LIBS) \
+ $(LIBGVC_LIBS) \
+ $(NULL)
+
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = valadoc-1.0.pc
+
+
+
+EXTRA_DIST = $(libvaladoc_VALASOURCES) libvaladoc.vala.stamp
diff --git a/src/libvaladoc/doclet.vala b/src/libvaladoc/doclet.vala
new file mode 100755
index 000000000..824b05fa9
--- /dev/null
+++ b/src/libvaladoc/doclet.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 Valadoc;
+using GLib;
+
+
+public static delegate Type Valadoc.DocletRegisterFunction ( );
+
+
+
+
+public abstract class Valadoc.Doclet : GLib.Object {
+ public abstract void initialisation ( Settings settings );
+
+ public abstract void visit_file ( File file );
+
+ public abstract void visit_namespace ( Namespace ns );
+
+ public abstract void visit_interface ( Interface iface );
+
+ public abstract void visit_class ( Class cl );
+
+ public abstract void visit_struct ( Struct stru );
+
+ public abstract void visit_error_domain ( ErrorDomain errdom );
+
+ public abstract void visit_enum ( Enum en );
+
+ public abstract void visit_property ( Property prop );
+
+ public abstract void visit_field ( Field field, FieldHandler parent );
+
+ public abstract void visit_constant ( Constant constant, ConstantHandler parent );
+
+ public abstract void visit_error_code ( ErrorCode errcode );
+
+ public abstract void visit_enum_value ( EnumValue enval );
+
+ public abstract void visit_delegate ( Delegate del );
+
+ public abstract void visit_signal ( Signal sig );
+
+ public abstract void visit_method ( Method m, Valadoc.MethodHandler parent );
+}
+
diff --git a/src/libvaladoc/doctree.vala b/src/libvaladoc/doctree.vala
new file mode 100755
index 000000000..64e4fba26
--- /dev/null
+++ b/src/libvaladoc/doctree.vala
@@ -0,0 +1,4465 @@
+/*
+ * 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 enum CommentContext {
+ ERRORDOMAIN,
+ ENUMVALUE,
+ ERRORCODE,
+ INTERFACE,
+ DELEGATE,
+ CONSTANT,
+ PROPERTY,
+ SIGNAL,
+ STRUCT,
+ CLASS,
+ FIELD,
+ ENUM
+}
+
+
+
+public class Valadoc.Basic : Object {
+ private string _full_name = null;
+
+ public string? full_name () {
+ if ( this.name == null )
+ return null;
+
+ if ( this._full_name == null ) {
+ this._full_name = this.name;
+ Basic pos = this.parent;
+
+ while ( pos is File == false ) {
+ if ( pos.name != null )
+ this._full_name = pos.name + "." + this._full_name;
+
+ pos = pos.parent;
+ }
+ }
+ return this._full_name;
+ }
+
+ public string?# package {
+ 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;
+ if ( path.has_suffix (".vapi") ) {
+ string file_name = GLib.Path.get_basename ( path );
+ return file_name.ndup ( file_name.size() - ".vapi".size() );
+ }
+
+ return this.settings.package_name;
+ }
+ }
+
+ protected string? comment_string {
+ get {
+ SourceReference sref = this.vsymbol.source_reference;
+ if ( sref == null )
+ return null;
+
+ return sref.comment;
+ }
+ set {
+ SourceReference sref = this.vsymbol.source_reference;
+ if ( sref == null )
+ return ;
+
+ sref.comment = value;
+ }
+ }
+
+ //- Nur dort hin packen, wo es gebraucht wird.
+ public DocumentationTree? documentation {
+ protected set;
+ get;
+ }
+
+ // internal
+ public virtual weak Basic? search_element ( string[] params, int pos ) {
+ return null;
+ }
+
+ // internal
+ public virtual weak Basic? search_element_vala ( Gee.ArrayList<Vala.Symbol> list, int pos ) {
+ return null;
+ }
+
+ //Vala.Symbol symbol, Gee.HashMap<string, Valadoc.TagletCreator> taglets, CommentContext context
+ protected void parse_comment_helper ( Valadoc.Parser docparser, CommentContext context ) {
+ if ( this.documentation != null )
+ return ;
+
+ string? docu = this.comment_string;
+ if ( docu == null )
+ return ;
+
+ bool tmp = Parser.is_documentation ( docu );
+ if ( tmp == false )
+ return ;
+
+
+ this.documentation = docparser.parse ( this.head, this, docu );
+ }
+
+ public int line {
+ get {
+ Vala.SourceReference vsref = this.vsymbol.source_reference;
+ if ( vsref == null )
+ return 0;
+
+ return vsref.first_line;
+ }
+ }
+
+ // Herausnehmen, dort übergeben wo es sein muss.
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public DataType? parent_data_type {
+ get {
+ if ( this.parent is DataType )
+ return (DataType)this.parent;
+
+ return null;
+ }
+ }
+
+ public string? file_name {
+ get {
+ Basic element = this;
+ while ( element != null ) {
+ if ( element is File )
+ return element.name;
+
+ element = element.parent;
+ }
+ return null;
+ }
+ }
+
+ // construct set -> creation method
+ public File? file {
+ get {
+ Valadoc.Basic ast = this;
+ while ( ast is Valadoc.File == false ) {
+ ast = ast.parent;
+ if ( ast == null )
+ return null;
+ }
+ return (Valadoc.File)ast;
+ }
+ }
+
+ // construct set -> creation method
+ public Namespace? nspace {
+ get {
+ Valadoc.Basic ast = this;
+ while ( ast is Valadoc.Namespace == false ) {
+ ast = ast.parent;
+ if ( ast == null )
+ return null;
+ }
+ return (Valadoc.Namespace)ast;
+ }
+ }
+
+ public Basic parent {
+ construct set;
+ get;
+ }
+
+ protected Vala.Symbol vsymbol {
+ // internal
+ protected get;
+ set;
+ }
+
+ public Tree head {
+ construct set;
+ protected get;
+ }
+
+ public virtual string?# name {
+ get {
+ return null;
+ }
+ }
+
+
+ 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_private {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return ( access == Vala.SymbolAccessibility.PRIVATE );
+ }
+ }
+
+
+ // Move to Valadoc.SymbolAccessibility
+ protected Basic? find_member_lst ( Gee.Collection<Basic> lst, string name ) {
+ foreach ( Basic element in lst ) {
+ if ( element.name == name )
+ return element;
+ }
+ return null;
+ }
+}
+
+public interface Valadoc.EnumHandler : Basic {
+ protected abstract Gee.ArrayList<Enum> enums {
+ private set;
+ get;
+ }
+
+ protected void set_enum_type_references ( ) {
+ foreach ( Enum en in this.enums ) {
+ en.set_type_references ( );
+ }
+ }
+
+ protected weak Basic? search_enum_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Enum en in this.enums ) {
+ Basic element = en.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected weak Basic? search_enum ( string[] params, int pos ) {
+ foreach ( Enum en in this.enums ) {
+ Basic 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 );
+ tmp.initialisation ( );
+ 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 {
+ private set;
+ get;
+ }
+
+ protected weak Basic? 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 weak Basic? 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 );
+ tmp.initialisation ( );
+ }
+
+ 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 {
+ private set;
+ get;
+ }
+
+ protected weak Basic? search_interface_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Interface iface in this.interfaces ) {
+ Basic? element = iface.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected weak Basic? search_interface ( string[] params, int pos ) {
+ foreach ( Interface iface in this.interfaces ) {
+ Basic 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 );
+ tmp.initialisation ( );
+ }
+
+ 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.ErrorDomoainHandler : Basic {
+ protected abstract Gee.ArrayList<ErrorDomain> errdoms {
+ private set;
+ get;
+ }
+
+ protected weak Basic? search_error_domain_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ Basic? element = errdom.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected weak Basic? search_error_domain ( string[] params, int pos ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ Basic? 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 );
+ tmp.initialisation ( );
+ 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 );
+ }
+ }
+}
+
+public interface Valadoc.Writeable : Basic {
+ public abstract DocumentationTree? documentation {
+ protected set;
+ get;
+ }
+
+ // rename to write_documentation
+ public bool write_comment ( void* ptr ) {
+ if ( this.documentation == null )
+ return false;
+
+ this.documentation.write ( ptr );
+ return true;
+ }
+}
+
+public interface Valadoc.NamespaceHandler : Basic {
+ public abstract Gee.ArrayList<Namespace> namespaces {
+ private 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 );
+ ns.initialisation( );
+ }
+
+ if ( vnspaces.size == pos+1 ) {
+ return ns;
+ }
+
+ return ns.get_namespace_helper ( node, vnspaces, pos+1 );
+ }
+
+ // TODO: Rename vars
+ 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 );
+ ns.initialisation( );
+ 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 weak Basic? search_class_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Class cl in this.classes ) {
+ Basic element = cl.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ protected weak Basic? search_class ( string[] params, int pos ) {
+ foreach ( Class cl in this.classes ) {
+ Basic 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, remove
+ public void append_class ( Valadoc.Class cl ) {
+ this.classes.add( cl );
+ }
+
+ // internal
+ public void add_class ( Vala.Class vcl ) {
+ Class cl = new Class ( this.settings, vcl, this, this.head );
+ this.classes.add ( cl );
+ cl.initialisation( );
+ }
+
+ 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 : ContainerDataType {
+ protected abstract Gee.ArrayList<Property> properties {
+ get;
+ set;
+ }
+
+ protected weak Basic? 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 weak Basic? 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 );
+ tmp.initialisation ( );
+ this.properties.add ( tmp );
+ }
+ }
+}
+
+
+public interface Valadoc.ConstructionMethodHandler : DataType, MethodHandler {
+ protected abstract Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected weak Basic? 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 weak Basic? 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_methods_and_construction_methods ( Gee.Collection<Vala.Method> vmethods ) {
+ foreach ( Vala.Method vm in vmethods ) {
+ var tmp = new Method ( this.settings, vm, this, this.head );
+ tmp.initialisation ( );
+ if ( tmp.is_constructor )
+ this.construction_methods.add ( tmp );
+ else
+ this.methods.add ( tmp );
+ }
+ }
+}
+
+public interface Valadoc.SignalHandler : ContainerDataType {
+ protected abstract Gee.ArrayList<Signal> signals {
+ get;
+ set;
+ }
+
+ protected weak Basic? 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 weak Basic? 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 );
+ tmp.initialisation ();
+ 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 weak Basic? search_struct_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Struct stru in this.structs ) {
+ Basic element = stru.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+
+ protected weak Basic? search_struct ( string[] params, int pos ) {
+ foreach ( Struct stru in this.structs ) {
+ Basic 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 );
+ }
+
+ // internal, remove
+ public void append_struct ( Valadoc.Struct stru ) {
+ this.structs.add( stru );
+ }
+
+ public void add_struct ( Vala.Struct vstru ) {
+ Struct stru = new Struct ( this.settings, vstru, this, this.head );
+ this.structs.add( stru );
+ stru.initialisation( );
+ }
+
+ 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._protected && this.is_protected )
+ return false;
+
+ if ( this.parent != element && !this.settings.add_inherited )
+ return false;
+
+ return true;
+ }
+
+ protected bool is_visitor_accessible ( ) {
+ if ( !this.settings._private && this.is_private )
+ return false;
+
+ if ( !this.settings._protected && this.is_protected )
+ return false;
+
+ return true;
+ }
+}
+
+
+public interface Valadoc.SymbolAccessibility {
+ public abstract bool is_public {
+ get;
+ }
+
+ public abstract bool is_protected {
+ get;
+ }
+
+ public abstract bool is_private {
+ get;
+ }
+}
+
+
+
+public interface Valadoc.ReturnTypeHandler : Basic {
+ public abstract TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void set_return_type_references ( ) {
+ if ( this.return_type == null )
+ return ;
+
+ this.return_type.set_type_references ( );
+ }
+
+ // internal, rename
+ protected void set_ret_type ( Vala.DataType vtref ) {
+ var tmp = new TypeReference ( this.settings, vtref, this, this.head );
+ this.return_type = tmp;
+ }
+}
+
+
+// ????
+public interface Valadoc.TypeHandler : Basic {
+ public abstract TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public void set_type_references ( ) {
+ if ( this.type_reference == null )
+ return ;
+
+ this.type_reference.set_type_references ( );
+ }
+
+ // ???, 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 weak Basic? 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 weak Basic? 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<Type>( 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 );
+ tmp.initialisation ( );
+ }
+
+ // 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 weak Basic? 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 weak Basic? 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<Type>( 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 ) {
+ var tmp = new Field ( this.settings, vf, this, this.head );
+ this.fields.add ( tmp );
+ tmp.initialisation ( );
+ }
+
+ // 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 );
+ }
+ }
+}
+
+public interface Valadoc.ExceptionHandler : Basic {
+ protected abstract Gee.ArrayList<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<TypeReference> get_error_domains ( ) {
+ return new Gee.ReadOnlyCollection<TypeReference> ( this.err_domains );
+ }
+
+ // internal
+ public void add_error_domains ( Gee.Collection<Vala.DataType> vexceptions ) {
+ foreach ( Vala.DataType vtref in vexceptions ) {
+ var tmp = new TypeReference ( this.settings, vtref, (Valadoc.Basic)this, this.head );
+ this.err_domains.add ( tmp );
+ }
+ }
+
+ // internal
+ public void set_exception_type_references ( ) {
+ foreach ( TypeReference tref in this.err_domains ) {
+ tref.set_type_references ( );
+ }
+ }
+}
+
+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 );
+ tmp.initialisation ( );
+ 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 {
+ protected set;
+ get;
+ }
+
+ protected weak Basic? 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 weak Basic? 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 );
+ tmp.initialisation ( );
+ 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 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 );
+ tmp.initialisation ( );
+ 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 : Basic, SymbolAccessibility, TypeHandler, Visitable, Writeable {
+ public TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public Vala.Constant vconst {
+ construct set;
+ private get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vconst.name;
+ }
+ }
+
+ public bool is_vconstant ( Vala.Constant vconst ) {
+ return ( this.vconst == vconst );
+ }
+
+ public void initialisation ( ) {
+ this.vsymbol = this.vconst;
+
+ var vret = this.vconst.type_reference;
+ this.set_ret_type ( vret );
+ }
+
+ public Constant ( Valadoc.Settings settings, Vala.Constant vconst, ConstantHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vconst = vconst;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.CONSTANT );
+ }
+
+ 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 : Basic, SymbolAccessibility, TypeHandler, Visitable, Writeable {
+ public Field ( Valadoc.Settings settings, Vala.Field vfield, FieldHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vfield = vfield;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ 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 override string?# name {
+ get {
+ return this.vfield.name;
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vfield;
+
+ var vret = this.vfield.field_type;
+ this.set_ret_type ( vret );
+ }
+
+ public Vala.Field vfield {
+ construct set;
+ private get;
+ }
+
+ public bool is_volatile {
+ get {
+ return this.vfield.is_volatile;
+ }
+ }
+
+ // remove
+ public bool is_global {
+ get {
+ return ( this.parent is Valadoc.Namespace );
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.FIELD );
+ }
+
+ 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 {
+ public TypeReference ( Valadoc.Settings settings, Vala.DataType vtyperef, Basic parent, Tree head ) {
+ this.settings = settings;
+ this.vtyperef = vtyperef;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ protected Gee.ArrayList<TypeReference> type_arguments = new Gee.ArrayList<TypeReference> ();
+
+ 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 DataType data_type {
+ private set;
+ get;
+ }
+
+ public Vala.DataType vtyperef {
+ construct set;
+ private 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;
+ }
+ }
+
+ // from vala/valainterfacewriter.vala
+ private bool is_weak_helper (Vala.DataType type) {
+ if (type.value_owned) {
+ return false;
+ } else if (type is VoidType || type is PointerType) {
+ return false;
+ } else if (type is ValueType) {
+ if (type.nullable) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public bool is_weak {
+ get {
+ Vala.CodeNode? node = this.vtyperef.parent_node;
+ if ( node == null )
+ return false;
+
+ if ( node is Vala.FormalParameter ) {
+ var direction = ((Vala.FormalParameter)node).direction;
+
+ if ( direction == Vala.ParameterDirection.OUT || direction == Vala.ParameterDirection.IN )
+ return false;
+
+ return !this.vtyperef.value_owned;
+ }
+
+ return is_weak_helper( this.vtyperef );
+ }
+ }
+
+ public bool is_nullable {
+ get {
+ return this.vtyperef.nullable && this.vtyperef is Vala.PointerType == false;
+ }
+ }
+
+ public bool is_pointer {
+ get {
+ return this.vtyperef is Vala.PointerType;
+ }
+ }
+
+ public uint pointer_rank {
+ get {
+ if ( !this.is_pointer )
+ return 0;
+
+ Vala.DataType vdtype = this.vtyperef;
+ for ( int i = 0 ;; i++ ) {
+ if ( vdtype is Vala.PointerType == false )
+ return i;
+
+ vdtype = ((Vala.PointerType)vdtype).base_type;
+ }
+ return 0;
+ }
+ }
+
+ public bool is_array {
+ get {
+ return this.vtyperef.is_array();
+ }
+ }
+
+ public uint array_rank {
+ get {
+ if ( !this.is_array )
+ return 0;
+
+ return ((Vala.ArrayType)vtyperef).rank;
+ }
+ }
+
+ 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 {
+ get {
+ return this.extract_type_name ( this.vtyperef );
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ Vala.DataType vtype = this.vtyperef;
+ while ( vtype is Vala.PointerType || vtype is Vala.ArrayType ) {
+ for ( ; vtype is Vala.PointerType ; vtype = ((Vala.PointerType)vtype).base_type );
+ for ( ; vtype is Vala.ArrayType ; vtype = ((Vala.ArrayType)vtype).element_type );
+ }
+
+ 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;
+ }
+ 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 );
+ }
+ }
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_type_reference ( this, ptr );
+ }
+}
+
+
+
+// TODO: Remove unused stuff
+// You just need it for the name in a template-parameter-list.
+// remove TypeHandler-interface
+public class Valadoc.TypeParameter : Basic, TypeHandler {
+ public TypeParameter ( Valadoc.Settings settings, Vala.TypeParameter vtypeparam, Basic parent, Tree head ) {
+ this.vtypeparam = 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 Vala.TypeParameter vtypeparam {
+ construct set;
+ protected get;
+ }
+
+ public string# datatype_name {
+ get {
+ return this.vtypeparam.name;
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ }
+
+ // internal
+ public void set_type_reference ( ) {
+ }
+}
+
+
+public class Valadoc.FormalParameter : Basic, TypeHandler {
+ public FormalParameter ( Valadoc.Settings settings, Vala.FormalParameter vformalparam, Basic parent, Tree head ) {
+ this.settings = settings;
+ this.vformalparam = vformalparam;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_out {
+ get {
+ return this.vformalparam.direction == ParameterDirection.OUT;
+ }
+ }
+
+ public bool is_ref {
+ get {
+ return this.vformalparam.direction == ParameterDirection.REF;
+ }
+ }
+
+ public string? default_value {
+ private set;
+ public get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vformalparam;
+
+ var vformparam = this.vformalparam.parameter_type;
+ this.set_ret_type ( vformparam );
+
+ var def = this.vformalparam.default_expression;
+ if ( def != null ) {
+ if ( def is Vala.StringLiteral )
+ this.default_value = def.to_string;
+ else if ( def is Vala.CharacterLiteral )
+ this.default_value = def.to_string;
+ else if ( def is Vala.RealLiteral )
+ this.default_value = def.to_string;
+ else if ( def is BooleanLiteral )
+ this.default_value = def.to_string;
+ else if ( def is IntegerLiteral )
+ this.default_value = def.to_string;
+ else if ( def is NullLiteral )
+ this.default_value = "null";
+ else
+ this.default_value = def.to_string;
+ }
+ }
+
+ public TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public bool ellipsis {
+ get {
+ return this.vformalparam.ellipsis;
+ }
+ }
+
+ public bool is_construct {
+ get {
+ return this.vformalparam.construct_parameter;
+ }
+ }
+
+ public override string?# name {
+ get {
+ return ( this.vformalparam.name == null )? "" : this.vformalparam.name;
+ }
+ }
+
+ public Vala.FormalParameter vformalparam {
+ construct set;
+ protected get;
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ if ( this.vformalparam.ellipsis )
+ return ;
+
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_formal_parameter ( this, ptr );
+ }
+}
+
+public class Valadoc.PropertyAccessor : Object /*, FIXME: Valac-Bug! Can't override properties of SymbolAccessibility */ {
+ 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 void construction ( ) {
+ }
+
+ public Tree head {
+ construct;
+ get;
+ }
+
+ public Vala.PropertyAccessor vpropacc {
+ construct;
+ private get;
+ }
+
+ public Settings settings {
+ construct;
+ get;
+ }
+
+ public Property parent {
+ private set;
+ get;
+ }
+
+ public Tree tree {
+ construct;
+ 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_set {
+ get {
+ return this.vpropacc.writable;
+ }
+ }
+
+ public bool is_get {
+ get {
+ return this.vpropacc.readable;
+ }
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_property_accessor ( this, ptr );
+ }
+}
+
+public class Valadoc.Property : Basic, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
+ public Property ( Valadoc.Settings settings, Vala.Property vproperty, ContainerDataType parent, Tree head ) {
+ this.settings = settings;
+ this.vproperty = vproperty;
+ this.parent = parent;
+ this.head = 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 return_type {
+ 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;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = 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 Vala.Property vproperty {
+ construct set;
+ protected get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vproperty.name;
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ this.set_return_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.PROPERTY );
+ }
+
+ 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 : Basic, ParameterListHandler, SymbolAccessibility,
+ ReturnTypeHandler, Visitable, Writeable
+{
+ public Signal ( Valadoc.Settings settings, Vala.Signal vsignal, ContainerDataType parent, Tree head ) {
+ this.settings = settings;
+ this.vsignal = vsignal;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_vsignal ( Vala.Signal vsig ) {
+ return ( this.vsignal == vsig );
+ }
+
+ construct {
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+ }
+
+ public string? get_cname () {
+ return this.vsignal.get_cname();
+ }
+
+ public TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = vsignal;
+
+ var vparamlst = this.vsignal.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+
+ var ret = this.vsignal.return_type;
+ this.set_ret_type ( ret );
+ }
+
+ protected Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ public Vala.Signal vsignal {
+ construct set;
+ private 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, CommentContext.SIGNAL );
+ }
+
+ public override string?# name {
+ get {
+ return this.vsignal.name;
+ }
+ }
+
+ 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 : Basic, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler,
+ SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable
+{
+ public Method ( Valadoc.Settings settings, Vala.Method vmethod, MethodHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vmethod = vmethod;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_vmethod ( Vala.Method vm ) {
+ return ( this.vmethod == vm );
+ }
+
+ public string? get_cname () {
+ return this.vmethod.get_cname();
+ }
+
+ construct {
+ this.err_domains = new Gee.ArrayList<TypeReference>();
+ this.param_list = new Gee.ArrayList<FormalParameter>();
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ }
+
+ public Method base_method {
+ get;
+ set;
+ }
+
+ public TypeReference return_type {
+ 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<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vmethod.source_reference.comment;
+ }
+ }
+
+ // 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.comment_string == null )
+ return ;
+
+ bool tmp = Parser.is_documentation ( this.comment_string );
+ if ( tmp == false )
+ return ;
+
+ if ( this.is_override && Parser.is_inherit_doc ( this.comment_string ) ) {
+ this.base_method.parse_comment ( docparser );
+ this.documentation = this.base_method.documentation;
+ return ;
+ }
+
+ // wrong context!
+ this.parse_comment_helper ( docparser, CommentContext.CLASS );
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = vmethod;
+
+ var vret = this.vmethod.return_type;
+ this.set_ret_type ( vret );
+
+ var vparamlst = this.vmethod.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+
+ var vexceptionlst = this.vmethod.get_error_types ();
+ this.add_error_domains ( vexceptionlst );
+ }
+
+ public Vala.Method vmethod {
+ construct set;
+ private get;
+ }
+
+ 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 string# parent_name {
+ get {
+ return this.parent.name;
+ }
+ }
+
+ public bool is_global {
+ get {
+ return ( this.parent is Namespace );
+ }
+ }
+
+ 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 {
+ get {
+ if ( this.is_constructor ) {
+ if ( this.vmethod.name == "new" )
+ return this.parent_name;
+ else
+ return this.parent_name + "." + this.vmethod.name;
+ }
+ else {
+ return this.vmethod.name;
+ }
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ this.set_return_type_references ( );
+
+ this.set_exception_type_references ( );
+ this.set_parameter_list_type_references ( );
+ }
+
+ 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: Basic, Writeable {
+ public EnumValue ( Valadoc.Settings settings, Vala.EnumValue venval, Enum parent, Tree head ) {
+ this.settings = settings;
+ this.venval = venval;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_venumvalue ( Vala.EnumValue venval ) {
+ return ( this.venval == venval );
+ }
+
+ public void initialisation ( ) {
+ this.vsymbol = venval;
+ }
+
+ public override string?# name {
+ get {
+ return this.venval.name;
+ }
+ }
+
+ public Vala.EnumValue venval {
+ construct set;
+ protected get;
+ }
+
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.ENUMVALUE );
+ }
+
+ 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 : Basic, Writeable {
+ public ErrorCode ( Valadoc.Settings settings, Vala.ErrorCode verrcode, ErrorDomain parent, Tree head ) {
+ this.settings = settings;
+ this.verrcode = verrcode;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_verrorcode ( Vala.ErrorCode verrcode ) {
+ return ( this.verrcode == verrcode );
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = verrcode;
+ }
+
+ public override string?# name {
+ get {
+ return this.verrcode.name;
+ }
+ }
+
+ public Vala.ErrorCode verrcode {
+ construct set;
+ protected get;
+ }
+
+ 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, CommentContext.ENUMVALUE );
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_error_code ( this );
+ }
+}
+
+public abstract class Valadoc.DataType: Basic, SymbolAccessibility, Visitable, Writeable {
+ public override string?# name {
+ get {
+ return this.vsymbol.name;
+ }
+ }
+
+ // internal
+ public virtual void set_type_references ( ) {
+ }
+
+ public virtual void visit ( Doclet doclet ) {
+ }
+
+ public virtual void write ( Langlet langlet, void* ptr ) {
+ }
+}
+
+
+
+public class Valadoc.Delegate : DataType, ParameterListHandler, SymbolAccessibility, Writeable,
+ ReturnTypeHandler, TemplateParameterListHandler,
+ ExceptionHandler {
+ public Delegate ( Valadoc.Settings settings, Vala.Delegate vdelegate, DelegateHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vdelegate = vdelegate;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.vdelegate.get_cname();
+ }
+
+ public TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ public override 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<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vdelegate;
+
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+
+ var vparamlst = this.vdelegate.get_parameters ();
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+ this.add_parameter_list ( vparamlst );
+
+ var vexceptionlst = this.vdelegate.get_error_types ();
+ this.err_domains = new Gee.ArrayList<TypeReference>();
+ this.add_error_domains ( vexceptionlst );
+
+ var ret = this.vdelegate.return_type;
+ this.set_ret_type ( ret );
+ }
+
+ public Vala.Delegate vdelegate {
+ construct set;
+ private get;
+ }
+
+ public bool is_static {
+ get {
+ return this.vdelegate.has_target;
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_template_parameter_list_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, CommentContext.DELEGATE );
+ }
+
+ // internal
+ public bool is_vdelegate ( Vala.Delegate vdel ) {
+ return ( this.vdelegate == vdel );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_delegate ( this, ptr );
+ }
+}
+
+public abstract class Valadoc.ContainerDataType : DataType, MethodHandler, Visitable,
+ TemplateParameterListHandler
+{
+ protected Gee.ArrayList<DataType> parent_types = new Gee.ArrayList<DataType>();
+
+ construct {
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.methods = new Gee.ArrayList<Method> ();
+ }
+
+ protected Class? parent_class {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ public string?# comment_str {
+ get {
+ return null;
+ }
+ }
+
+ protected Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ // rename to get_parent_type_list
+ public Gee.Collection<DataType> get_parent_types ( ) {
+ return this.parent_types;
+ }
+
+ public bool derived_from_interface ( Interface iface ) {
+ foreach ( DataType dtype in this.parent_types ) {
+ if ( dtype == iface )
+ return true;
+ }
+ return false;
+ }
+
+ // rename, remove virtual
+ public virtual void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_method_comments ( docparser );
+ }
+
+ protected void set_parent_references ( Gee.Collection<Vala.DataType> lst ) {
+ if ( ((Gee.Collection)this.parent_types).size != 0 )
+ return ;
+
+ foreach ( Vala.DataType vtyperef in lst ) {
+ DataType? element = (DataType?)this.head.search_vala_symbol ( vtyperef.data_type );
+ this.parent_types.add ( element );
+ if ( element is Class ) {
+ this.parent_class = (Class)element;
+ }
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_template_parameter_list_references ( );
+ this.set_method_type_references ( );
+ base.set_type_references ( );
+ }
+}
+
+public class Valadoc.Class : ContainerDataType, Visitable, ClassHandler, StructHandler, SignalHandler,
+ EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler,
+ DelegateHandler, ConstantHandler {
+ public Class ( Valadoc.Settings settings, Vala.Class vclass, ClassHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vclass = vclass;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ private bool inherited = false;
+
+ 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();
+ }
+
+ // internal
+ public override weak Basic? 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];
+
+ if ( velement is Vala.Field ) {
+ var element = this.search_field_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ var element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Delegate ) {
+ var element = this.search_delegate_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.CreationMethod ) {
+ var element = this.search_construction_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Signal ) {
+ var element = this.search_signal_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Property ) {
+ var element = this.search_property_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Struct ) {
+ var element = this.search_struct_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Class ) {
+ var element = this.search_class_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Enum ) {
+ var element = this.search_enum_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Constant ) {
+ var element = this.search_constant_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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 void initialisation ( ) {
+ this.vsymbol = this.vclass;
+
+ 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 );
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vclass.source_reference.comment;
+ }
+ }
+
+ public Vala.Class vclass {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_vclass ( Vala.Class vcl ) {
+ return this.vclass == vcl;
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_class ( this, ptr );
+ }
+
+ public bool is_abstract {
+ get {
+ return this.vclass.is_abstract;
+ }
+ }
+
+ // remove
+ public bool is_static {
+ get {
+ return this.vclass.is_static;
+ }
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_class ( this );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.CLASS );
+
+ this.parse_construction_method_comments ( docparser );
+ this.parse_delegate_comments ( docparser );
+ this.parse_constant_comments ( docparser );
+ this.parse_property_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 );
+ base.parse_comments ( docparser );
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ base.set_type_references ( );
+
+ var lst = this.vclass.get_base_types ();
+ this.set_parent_references ( lst );
+
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_delegate_type_references ( );
+ this.set_property_type_reference ( );
+ 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 ;
+
+ if ( m.is_virtual || m.is_override || m.is_abstract ) {
+ Method m2 = get_new_method ( m );
+ if ( m2 != null )
+ m2.base_method = m;
+ continue ;
+ }
+
+ this.methods.add ( m );
+ }
+ }
+
+ // rename - base_method?
+ private Method? get_new_method ( Method overwritten_method ) {
+ foreach ( Method m in this.methods ) {
+ if ( !m.is_override )
+ continue ;
+
+ if ( m.name == overwritten_method.name )
+ return m;
+ }
+ return null;
+ }
+
+ 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;
+ foreach ( DataType dtype in this.parent_types ) {
+ if ( dtype is Class )
+ this.inheritance_class ( (Class)dtype );
+ else if ( dtype is Interface )
+ this.inheritance_interface ( (Interface)dtype );
+ }
+
+ foreach ( Class cl in this.classes ) {
+ cl.inheritance( );
+ }
+ }
+}
+
+
+
+public class Valadoc.ErrorDomain : DataType, MethodHandler, Visitable {
+ public ErrorDomain ( Valadoc.Settings settings, Vala.ErrorDomain verrdom, ErrorDomoainHandler parent, Tree head ) {
+ this.settings = settings;
+ this.verrdom = verrdom;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.verrdom.get_cname();
+ }
+
+ private Gee.ArrayList<ErrorCode> errcodes = new Gee.ArrayList<ErrorCode> ();
+
+ protected Vala.ErrorDomain verrdom {
+ private get;
+ set;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ // internal
+ public bool is_verrordomain ( Vala.ErrorDomain ver ) {
+ return ( this.verrdom == ver );
+ }
+
+ private weak Basic? 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 weak Basic? 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 weak Basic? 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];
+
+ if ( velement is Vala.ErrorCode ) {
+ var element = this.search_error_code_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ var element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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, CommentContext.ERRORDOMAIN );
+ 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 override 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 );
+ tmp.initialisation ( );
+ this.errcodes.add ( tmp );
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_method_type_references ( );
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.verrdom;
+
+ 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 class Valadoc.Enum : DataType, MethodHandler, Visitable {
+ public Enum ( Valadoc.Settings settings, Vala.Enum venum, EnumHandler parent, Tree head ) {
+ this.settings = settings;
+ this.venum = venum;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.venum.get_cname();
+ }
+
+ private weak Basic? 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 weak Basic? 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 weak Basic? 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];
+
+ if ( velement is Vala.EnumValue ) {
+ var element = this.search_enum_value_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ var element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ var 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 override void set_type_references ( ) {
+ this.set_method_type_references ( );
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<EnumValue> en_values {
+ get;
+ set;
+ }
+
+ public Gee.ReadOnlyCollection<EnumValue> get_enum_values () {
+ return new Gee.ReadOnlyCollection<EnumValue>( this.en_values );
+ }
+
+ // internal
+ public void parse_comments ( Valadoc.Parser docparser ) {
+ // CommentContext.ENUM
+ this.parse_comment_helper ( docparser, CommentContext.ENUM );
+
+ 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 );
+ tmp.initialisation ( );
+ this.en_values.add ( tmp );
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.venum;
+
+ 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 void visit_enum_values ( Doclet doclet ) {
+ foreach ( EnumValue enval in this.en_values )
+ enval.visit ( doclet );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_enum ( this );
+ }
+
+ public Vala.Enum venum {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_venum ( Vala.Enum ven ) {
+ return ( this.venum == ven );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_enum ( this, ptr );
+ }
+}
+
+
+
+public class Valadoc.Struct : ContainerDataType, Visitable, ConstructionMethodHandler, FieldHandler, ConstantHandler {
+ public Struct ( Valadoc.Settings settings, Vala.Struct vstruct, StructHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vstruct = vstruct;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.vstruct.get_cname();
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Constant> constants {
+ set;
+ get;
+ }
+
+ public override weak Basic? 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];
+
+ if ( velement is Vala.Field ) {
+ var element = this.search_field_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.CreationMethod ) {
+ var element = this.search_construction_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ var element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Constant ) {
+ var element = this.search_constant_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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
+ public void initialisation ( ) {
+ this.vsymbol = this.vstruct;
+
+ 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 );
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vstruct.source_reference.comment;
+ }
+ }
+
+ public Vala.Struct vstruct {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_vstruct ( Vala.Struct vstru ) {
+ return ( this.vstruct == vstru );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_struct ( this );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_struct ( this, ptr );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+ this.parse_construction_method_comments ( docparser );
+ this.parse_constant_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ base.parse_comments ( docparser );
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_field_type_references ( );
+ base.set_type_references ( );
+
+ var lst = this.vstruct.get_base_types ();
+ this.set_parent_references ( lst );
+ }
+}
+
+public class Valadoc.Interface : ContainerDataType, Visitable, SignalHandler, PropertyHandler, FieldHandler,
+ DelegateHandler, EnumHandler, StructHandler, ClassHandler {
+ public Interface ( Valadoc.Settings settings, Vala.Interface vinterface, InterfaceHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vinterface = vinterface;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.vinterface.get_cname();
+ }
+
+ 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;
+ }
+
+ public Vala.Interface vinterface {
+ construct set;
+ protected get;
+ }
+
+ public override weak Basic? 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];
+
+ if ( velement is Vala.Field ) {
+ var element = this.search_field_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ var element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Signal ) {
+ var element = this.search_signal_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Property ) {
+ var element = this.search_property_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Delegate ) {
+ var element = this.search_delegate_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Struct ) {
+ var element = this.search_struct_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Enum ) {
+ var element = this.search_enum_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Class ) {
+ var element = this.search_class_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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 void initialisation ( ) {
+ this.vsymbol = this.vinterface;
+
+ 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 );
+ }
+
+ public bool is_static {
+ get {
+ return this.vinterface.is_static;
+ }
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vinterface.source_reference.comment;
+ }
+ }
+
+ // internal
+ public bool is_vinterface ( Vala.Interface viface ) {
+ return ( this.vinterface == viface );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_interface ( this );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_interface ( this, ptr );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.INTERFACE );
+ this.parse_delegate_comments ( docparser );
+ this.parse_property_comments ( docparser );
+ this.parse_signal_comments ( docparser );
+ this.parse_struct_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ this.parse_class_comments ( docparser );
+ this.parse_enum_comments ( docparser );
+ base.parse_comments ( docparser );
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ base.set_type_references ( );
+
+ this.set_delegate_type_references ();
+ this.set_property_type_reference ();
+ this.set_signal_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_parent_references ( lst );
+ }
+}
+
+public class Valadoc.Namespace : Basic, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomoainHandler,
+ 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 void initialisation( ) {
+ 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> ();
+ }
+
+ 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 weak Basic? search_namespace ( string[] params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ //interface
+ private weak Basic? search_namespace_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element_vala ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ public override weak Basic? 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];
+
+ if ( velement is Vala.Namespace ) {
+ Basic element = this.search_namespace_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Class ) {
+ Basic element = this.search_class_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Interface ) {
+ Basic element = this.search_interface_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Struct ) {
+ Basic element = this.search_struct_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Enum ) {
+ Basic element = this.search_enum_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.ErrorDomain ) {
+ Basic element = this.search_error_domain_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Method ) {
+ Basic element = this.search_method_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Field ) {
+ Basic element = this.search_field_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.DelegateType || velement is Vala.Delegate ) {
+ Basic element = this.search_delegate_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ else if ( velement is Vala.Constant ) {
+ Basic element = this.search_constant_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ Basic 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.vnspace = vnspace;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_namespace ( this );
+ }
+
+ public Vala.Namespace vnspace {
+ construct set;
+ private get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vnspace.name;
+ }
+ }
+
+ // interface
+ 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 ( );
+ }
+
+ // 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_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.File : Basic, NamespaceHandler {
+ public Gee.ArrayList<Namespace> namespaces {
+ default = new Gee.ArrayList<Namespace>();
+ private set;
+ private get;
+ }
+
+ public File ( Valadoc.Settings settings, Vala.SourceFile vfile, Tree head ) {
+ this.settings = settings;
+ this.vfile = vfile;
+ this.head = head;
+ }
+
+ public override string?# name {
+ get {
+ return this.vfile.filename;
+ }
+ }
+
+ public Vala.SourceFile vfile {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public override weak Basic? search_element ( string[] params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override weak Basic? search_element_vala ( Gee.ArrayList<Vala.Symbol> params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element_vala ( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public bool is_file ( Vala.SourceFile vfile ) {
+ return ( vfile == this.vfile );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !settings.to_doc ( this.name ) )
+ return ;
+
+ doclet.visit_file ( 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<File> files = new Gee.ArrayList<File>();
+
+ public Valadoc.Settings settings {
+ construct set;
+ private get;
+ }
+
+ public Tree (Valadoc.Settings settings, Vala.CodeContext context ) {
+ this.settings = settings;
+ this.context = context;
+ }
+
+ public CodeContext context {
+ construct set;
+ private get;
+ }
+
+ public void visit ( Doclet doclet ) {
+ foreach ( File file in this.files ) {
+ file.visit ( doclet );
+ }
+ }
+
+ private weak Basic? search_symbol_in_namespace ( Basic element, string[] params ) {
+ return this.search_symbol_in_symbol ( element.nspace, params );
+ }
+
+ private weak Basic? search_symbol_in_type ( Basic element, string[] params, int params_offset = 0 ) {
+ if ( !( element.parent is ContainerDataType || 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 ( element.parent, nparams, 0 );
+ }
+
+ return this.search_symbol_in_symbol ( element.parent, params, 0 );
+ }
+
+ private weak Basic? search_symbol_in_symbol ( Basic 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 weak Basic? search_symbol_in_global_namespaces ( Basic? 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 ( File f in this.files ) {
+ Basic element = f.search_element ( global_params, 0 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ private weak Basic? search_symbol_in_namespaces ( Basic element, string[] params ) {
+ foreach ( File f in this.files ) {
+ Basic element = f.search_element ( params, 0 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ private weak Basic? search_element ( Basic? 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;
+
+ if ( element != null ) {
+ var tmp = this.search_symbol_in_namespaces ( element, params );
+ if ( tmp != null )
+ return tmp;
+ }
+ return null;
+ }
+
+ public weak Basic? search_symbol_str ( Valadoc.Basic? 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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_file ( vfile );
+ Namespace ns = file.get_namespace ( verrdom );
+ ns.add_error_domain ( verrdom );
+ }
+
+ public void create_tree ( ) {
+ this.context.accept( this );
+ this.set_type_references ( );
+ this.inheritance ( ); // remove
+ }
+
+ // internal
+ public File? find_file ( Vala.SourceFile vfile ) {
+ foreach ( File f in this.files ) {
+ if ( f.is_file( vfile ) )
+ return f;
+ }
+ return null;
+ }
+
+ private void set_type_references ( ) {
+ foreach ( File f in this.files ) {
+ f.set_type_references( );
+ }
+ }
+
+ private void inheritance ( ) {
+ foreach ( File f in this.files ) {
+ f.inheritance( );
+ }
+ }
+
+ public void parse_comments ( Valadoc.Parser docparser ) {
+ foreach ( File f in this.files ) {
+ f.parse_comments( docparser );
+ }
+ }
+
+ // internal
+ public weak Basic? 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[1] is Vala.Namespace ) {
+ params.remove_at ( 0 );
+ }
+ }
+
+ Vala.SourceFile vfile = vnode.source_reference.file;
+ File file = this.get_file ( vfile );
+
+ return file.search_element_vala ( params, 0 );
+ }
+
+ // internal
+ public File get_file ( Vala.SourceFile vfile ) {
+ File file = this.find_file( vfile );
+ if ( file != null )
+ return file;
+
+ var tmp = new File ( this.settings,vfile, this );
+ this.files.add ( tmp );
+ return tmp;
+ }
+}
+
diff --git a/src/libvaladoc/drawer.vala b/src/libvaladoc/drawer.vala
new file mode 100755
index 000000000..f8bc1dd59
--- /dev/null
+++ b/src/libvaladoc/drawer.vala
@@ -0,0 +1,171 @@
+
+
+using Graphviz;
+using GLib;
+using Gee;
+
+
+
+namespace Valadoc.Diagrams {
+ private static inline string get_diagram_node_name ( DataType type ) {
+ string name = "";
+ if ( type.nspace.full_name() != null ) {
+ name = type.nspace.full_name() + ".";
+ }
+ return name + type.name;
+ }
+
+ public static void write_struct_diagram ( Struct stru, string path ) {
+ string[] params2 = new string[5];
+ params2[0] = "";
+ params2[1] = "-T";
+ params2[2] = "png";
+ params2[3] = "-o";
+ params2[4] = path;
+
+ Graphviz.Context cntxt = Context.context( );
+ cntxt.parse_args ( params2 );
+
+ Graphviz.Graph g = Graph.open ( "g", GraphType.AGDIGRAPH );
+ g.set_safe ( "rank", "", "" );
+
+ weak Graphviz.Node me = draw_struct ( g, stru, null );
+ draw_struct_parents ( stru, g, me );
+
+ cntxt.layout_jobs ( g );
+ cntxt.render_jobs ( g );
+ cntxt.free_layout ( g );
+ }
+
+ private static void draw_struct_parents ( Struct stru, Graphviz.Graph g, Graphviz.Node me ) {
+ Gee.Collection<DataType> parentlst = stru.get_parent_types ( );
+
+ foreach ( DataType type in parentlst ) {
+ weak Graphviz.Node stru = draw_struct ( g, (Struct)type, me );
+ draw_struct_parents ( (Struct)type, g, stru );
+ }
+ }
+
+ public static void write_interface_diagram ( Interface iface, string path ) {
+ string[] params2 = new string[5];
+ params2[0] = "";
+ params2[1] = "-T";
+ params2[2] = "png";
+ params2[3] = "-o";
+ params2[4] = path;
+
+ Graphviz.Context cntxt = Context.context( );
+ cntxt.parse_args ( params2 );
+
+ Graphviz.Graph g = Graph.open ( "g", GraphType.AGDIGRAPH );
+ g.set_safe ( "rank", "", "" );
+
+ weak Graphviz.Node me = draw_interface ( g, iface, null );
+ draw_interface_parents ( iface, g, me );
+
+ cntxt.layout_jobs ( g );
+ cntxt.render_jobs ( g );
+ cntxt.free_layout ( g );
+ }
+
+ private static void draw_interface_parents ( Interface iface, Graphviz.Graph g, Graphviz.Node me ) {
+ Gee.Collection<DataType> parentlst = iface.get_parent_types ( );
+
+ foreach ( DataType type in parentlst ) {
+ if ( type is Interface ) {
+ draw_interface ( g, (Interface)type, me );
+ }
+ else {
+ weak Graphviz.Node cl = draw_class ( g, (Class)type, me );
+ draw_class_parents ( (Class)type, g, cl );
+ }
+ }
+ }
+
+ public static void write_class_diagram ( Class cl, string path ) {
+ string[] params2 = new string[5];
+ params2[0] = "";
+ params2[1] = "-T";
+ params2[2] = "png";
+ params2[3] = "-o";
+ params2[4] = path;
+
+ Graphviz.Context cntxt = Context.context( );
+ cntxt.parse_args ( params2 );
+
+ Graphviz.Graph g = Graph.open ( "g", GraphType.AGDIGRAPH );
+ g.set_safe ( "rank", "", "" );
+
+ weak Graphviz.Node me = draw_class ( g, cl, null );
+ draw_class_parents ( cl, g, me );
+
+ cntxt.layout_jobs ( g );
+ cntxt.render_jobs ( g );
+ cntxt.free_layout ( g );
+ }
+
+ private static weak Graphviz.Node draw_struct ( Graph g, Struct stru, Graphviz.Node? parent ) {
+ string name = get_diagram_node_name ( stru );
+ weak Graphviz.Node? node = g.find_node ( name );
+ if ( node == null ) {
+ node = g.node ( name );
+ node.set_safe ( "shape", "box", "" );
+ }
+
+ if ( parent != null ) {
+ weak Edge edge = g.edge ( node, parent );
+ edge.set_safe ( "dir", "back", "" );
+ }
+
+ return node;
+ }
+
+ private static weak Graphviz.Node draw_interface ( Graph g, Interface iface, Graphviz.Node? parent ) {
+ string name = get_diagram_node_name ( iface );
+ weak Graphviz.Node? node = g.find_node ( name );
+ if ( node == null ) {
+ node = g.node ( name );
+ node.set_safe ( "shape", "box", "" );
+ }
+
+ if ( parent != null ) {
+ weak Edge edge = g.edge ( node, parent );
+ edge.set_safe ( "dir", "back", "" );
+ }
+
+ return node;
+ }
+
+ private static weak Graphviz.Node draw_class ( Graph g, Class cl, Graphviz.Node? parent ) {
+ string name = get_diagram_node_name ( cl );
+ weak Graphviz.Node? node = g.find_node ( name );
+ if ( node == null ) {
+ node = g.node ( name );
+ node.set_safe ( "shape", "box", "" );
+ node.set_safe ( "style", "bold", "" );
+ }
+
+ if ( parent != null ) {
+ weak Edge edge = g.edge ( node, parent );
+ edge.set_safe ( "dir", "back", "" );
+ }
+
+ return node;
+ }
+
+ private static void draw_class_parents ( Class cl, Graphviz.Graph g, Graphviz.Node me ) {
+ Gee.Collection<DataType> parents = cl.get_parent_types ( );
+
+ foreach ( DataType type in parents ) {
+ if ( type is Interface ) {
+ draw_interface ( g, (Valadoc.Interface)type, me );
+ }
+ else if ( type is Class ) {
+ weak Graphviz.Node node = draw_class ( g, (Valadoc.Class)type, me );
+ draw_class_parents ( ((Class)type), g, node );
+ }
+ }
+ }
+}
+
+
diff --git a/src/libvaladoc/errorreporter.vala b/src/libvaladoc/errorreporter.vala
new file mode 100755
index 000000000..00c02d39d
--- /dev/null
+++ b/src/libvaladoc/errorreporter.vala
@@ -0,0 +1,151 @@
+/*
+ * 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 GLib;
+using Vala;
+using Gee;
+
+
+[ErrorDomain]
+public enum CommentParserError {
+ UNKNOWN_SYMBOL,
+ SUBPARSER,
+ BRACKET_ERROR,
+ UNKNOWN_OPTION,
+ NO_COMMENT_STRING,
+ NESTED_BRACKETS,
+ SYNTAX_ERROR,
+ CONTEXT_ERROR
+}
+
+
+public class Valadoc.Error : Object {
+ public string cmnd {
+ construct set;
+ get;
+ }
+
+ public bool is_warning {
+ construct set;
+ get;
+ }
+
+ public Basic element {
+ construct set;
+ get;
+ }
+
+ public string description {
+ construct set;
+ get;
+ }
+
+
+ public CommentParserError err {
+ construct set;
+ get;
+ }
+
+ public Error ( Basic element,
+ bool is_warning,
+ string cmnd,
+ CommentParserError err ) {
+ this.element = element;
+ this.is_warning = is_warning;
+ this.cmnd = cmnd;
+ this.err = err;
+ }
+
+ public Error.Message ( Basic element,
+ bool is_warning,
+ string cmnd,
+ string description ) {
+ this.element = element;
+ this.is_warning = is_warning;
+ this.cmnd = cmnd;
+ this.description = description;
+ }
+
+ public void print ( ) {
+ string file = this.element.file.name;
+ string type = ( this.is_warning )? "warning" : "error";
+ string element = this.element.name;
+
+ string desc = null;
+ if ( this.description == null ) {
+ switch ( this.err ) {
+ case CommentParserError.UNKNOWN_SYMBOL:
+ desc = "unnown symbol"; break;
+ case CommentParserError.SUBPARSER:
+ desc = "subparser"; break;
+ case CommentParserError.UNKNOWN_OPTION:
+ desc = "unnown option \"" + this.cmnd + "\"" ; break;
+ case CommentParserError.NO_COMMENT_STRING:
+ desc = "no comment string"; break;
+ case CommentParserError.NESTED_BRACKETS:
+ desc = "nested brackets"; break;
+ case CommentParserError.SYNTAX_ERROR:
+ desc = "syntax error"; break;
+ case CommentParserError.CONTEXT_ERROR:
+ desc = "context error"; break;
+ case CommentParserError.BRACKET_ERROR:
+ desc = "open brackets"; break;
+ default: desc = "unknown error"; break;
+ }
+ }
+ else {
+ desc = this.description;
+ }
+///home/mog/Desktop/vendy/vendy/Vendy.Magtek.vala, read: error: linked type is not available.
+
+ if ( this.element.line == 0 )
+ stdout.printf ( "%s: %s: in %s: %s\n", file, type, element, desc );
+ else
+ stdout.printf ( "%s:%d: %s: in %s: %s\n", file, this.element.line, type, element, desc );
+ }
+}
+
+public class Valadoc.ErrorReporter : Object {
+ Gee.ArrayList<Error> lst = new Gee.ArrayList<Error> ();
+
+ public int numbers {
+ get {
+ return ((Gee.Collection)this.lst).size;
+ }
+ }
+
+ public void print_errors ( ) {
+ foreach ( Error err in this.lst ) {
+ err.print();
+ }
+ }
+
+ public void add_with_message ( Basic element, bool is_warning, string? cmnd, string desc ) {
+ var tmp = new Error.Message ( element, is_warning, cmnd, desc );
+ this.lst.add ( tmp );
+ }
+
+ public void add ( Basic element, bool is_warning, string? cmnd, CommentParserError err ) {
+ var tmp = new Error ( element, is_warning, cmnd,CommentParserError.UNKNOWN_OPTION );
+ this.lst.add ( tmp );
+ }
+}
+
+
+
diff --git a/src/libvaladoc/langlet.vala b/src/libvaladoc/langlet.vala
new file mode 100755
index 000000000..dacbfa9db
--- /dev/null
+++ b/src/libvaladoc/langlet.vala
@@ -0,0 +1,94 @@
+/*
+ * 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 GLib;
+
+
+public class Valadoc.Langlet : Object {
+ public signal void puts_keyword ( void* ptr, string str );
+ public signal void puts ( void* ptr, string str );
+
+ public virtual void write_type_parameter ( TypeParameter param, void* ptr ) {
+ }
+
+ public virtual void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) {
+ }
+
+ public void write_parent_type_list ( Valadoc.ContainerDataType dtype, void* ptr ) {
+ }
+
+ public virtual void write_parameter_list ( ParameterListHandler thandler, void* ptr ) {
+ }
+
+ public virtual void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) {
+ }
+
+ public virtual void write_constant ( Valadoc.Constant constant, Valadoc.ConstantHandler parent, void* ptr ) {
+ }
+
+ public virtual void write_type_reference ( Valadoc.TypeReference tref, void* ptr ) {
+ }
+
+ public virtual void write_formal_parameter ( Valadoc.FormalParameter param, void* ptr ) {
+ }
+
+ public virtual void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) {
+ }
+
+ public virtual void write_property ( Valadoc.Property prop, void* ptr ) {
+ }
+
+ public virtual void write_signal ( Valadoc.Signal sig, void* ptr ) {
+ }
+
+ public virtual void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) {
+ }
+
+ public virtual void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) {
+ }
+
+ public virtual void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) {
+ }
+
+ public virtual void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) {
+ }
+
+ public virtual void write_delegate ( Valadoc.Delegate del, void* ptr ) {
+ }
+
+ public virtual void write_class ( Valadoc.Class cl, void* ptr ) {
+ }
+
+ public virtual void write_enum ( Valadoc.Enum en, void* ptr ) {
+ }
+
+ public virtual void write_struct ( Valadoc.Struct stru, void* ptr ) {
+ }
+
+ public virtual void write_interface ( Valadoc.Interface iface, void* ptr ) {
+ }
+
+ public virtual void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
+ }
+
+ public virtual void write_file ( Valadoc.File file, void* ptr ) {
+ }
+}
+
+
diff --git a/src/libvaladoc/old_doctree.vala b/src/libvaladoc/old_doctree.vala
new file mode 100755
index 000000000..5b6a803ce
--- /dev/null
+++ b/src/libvaladoc/old_doctree.vala
@@ -0,0 +1,4708 @@
+/*
+ * 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;
+
+
+/*
+TODO:
+ - clean up the api
+ -- rename stuff
+ -- mark unused stuff
+
+ -- remove the overritten methods from the vala-visitor
+*/
+
+
+// private
+public Valadoc.Class glib_error = null;
+
+
+// remove
+public enum ExpressionType {
+ NOT_SET,
+ STRING,
+ CHAR,
+ REAL,
+ BOOL,
+ INT,
+ NULL
+}
+
+
+
+public enum CommentContext {
+ ERRORDOMAIN,
+ ENUMVALUE,
+ ERRORCODE,
+ INTERFACE,
+ DELEGATE,
+ CONSTANT,
+ PROPERTY,
+ SIGNAL,
+ STRUCT,
+ CLASS,
+ FIELD,
+ ENUM
+}
+
+
+
+public class Valadoc.Basic : Object {
+ private string _full_name = null;
+
+ public string? full_name {
+ get {
+ if ( this.name == null )
+ return null;
+
+ if ( this._full_name == null ) {
+ this._full_name = this.name;
+ Basic pos = this.parent;
+
+ while ( pos is File == false ) {
+ this._full_name = pos.name + "." + this._full_name;
+ pos = pos.parent;
+ }
+ }
+
+ return this._full_name;
+ }
+ }
+
+ public string?# package {
+ 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;
+ if ( path.has_suffix (".vapi") ) {
+ string file_name = GLib.Path.get_basename ( path );
+ return file_name.ndup ( file_name.size() - ".vapi".size() );
+ }
+
+ return this.settings.package_name;
+ }
+ }
+
+ protected string? comment_string {
+ get {
+ SourceReference sref = this.vsymbol.source_reference;
+ if ( sref == null )
+ return null;
+
+ return sref.comment;
+ }
+ set {
+ SourceReference sref = this.vsymbol.source_reference;
+ if ( sref == null )
+ return ;
+
+ sref.comment = value;
+ }
+ }
+
+ //- Nur dort hin packen, wo es gebraucht wird.
+ public DocumentationTree? documentation {
+ protected set;
+ get;
+ }
+
+ // internal
+ public virtual Basic? search_element ( string[] params, int pos ) {
+ return null;
+ }
+
+
+ // <><><><><><><><><>
+ // <><><><><><><><><>
+ //Vala.Symbol symbol, Gee.HashMap<string, Valadoc.TagletCreator> taglets, CommentContext context
+ protected void parse_comment_helper ( Valadoc.Parser docparser, CommentContext context ) {
+ if ( this.documentation != null )
+ return ;
+
+ string? docu = this.comment_string;
+ if ( docu == null )
+ return ;
+
+ bool tmp = Parser.is_documentation ( docu );
+ if ( tmp == false )
+ return ;
+
+
+ this.documentation = docparser.parse ( this.head, this, docu );
+ }
+
+ public int line {
+ get {
+ Vala.SourceReference vsref = this.vsymbol.source_reference;
+ if ( vsref == null )
+ return 0;
+
+ return vsref.first_line;
+ }
+ }
+
+ // Herausnehmen, dort übergeben wo es sein muss.
+ public Valadoc.Settings settings {
+ construct set;
+ protected get;
+ }
+
+ public DataType? parent_data_type {
+ get {
+ if ( this.parent is DataType )
+ return (DataType)this.parent;
+
+ return null;
+ }
+ }
+
+ public string? file_name {
+ get {
+ Basic element = this;
+ while ( element != null ) {
+ if ( element is File )
+ return element.name;
+
+ element = element.parent;
+ }
+ return null;
+ }
+ }
+
+ // construct set -> creation method
+ public File? file {
+ get {
+ Valadoc.Basic ast = this;
+ while ( ast is Valadoc.File == false ) {
+ ast = ast.parent;
+ if ( ast == null )
+ return null;
+ }
+ return (Valadoc.File)ast;
+ }
+ }
+
+ // construct set -> creation method
+ public Namespace? nspace {
+ get {
+ Valadoc.Basic ast = this;
+ while ( ast is Valadoc.Namespace == false ) {
+ ast = ast.parent;
+ if ( ast == null )
+ return null;
+ }
+ return (Valadoc.Namespace)ast;
+ }
+ }
+
+ public Basic parent {
+ construct set;
+ get;
+ }
+
+ protected Vala.Symbol vsymbol {
+ // internal
+ protected get;
+ set;
+ }
+
+ public Tree head {
+ construct set;
+ protected get;
+ }
+
+ public virtual string?# name {
+ get {
+ return null;
+ }
+ }
+
+
+ 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_private {
+ get {
+ Vala.SymbolAccessibility access = vsymbol.access;
+ return ( access == Vala.SymbolAccessibility.PRIVATE );
+ }
+ }
+
+
+ // Move to Valadoc.SymbolAccessibility
+ protected Basic? find_member_lst ( Gee.Collection<Basic> lst, string name ) {
+ foreach ( Basic element in lst ) {
+ if ( element.name == name )
+ return element;
+ }
+ return null;
+ }
+}
+
+
+public interface Valadoc.EnumHandler : Basic {
+ protected abstract Gee.ArrayList<Enum> enums {
+ private set;
+ get;
+ }
+
+ protected void set_enum_type_references ( ) {
+ foreach ( Enum en in this.enums ) {
+ en.set_type_references ( );
+ }
+ }
+
+ protected inline Basic? search_enum ( string[] params, int pos ) {
+ foreach ( Enum en in this.enums ) {
+ Basic 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 );
+ }
+
+ // internal
+ public Enum? find_enum ( Vala.Enum venum ) {
+ foreach ( Enum en in this.enums ) {
+ if ( en.is_venum( venum ) )
+ return en;
+ }
+
+ return null;
+ }
+
+ 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 );
+ tmp.initialisation ( );
+ 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 {
+ private set;
+ get;
+ }
+
+ protected inline Basic? 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 );
+ }
+
+ // internal
+ public Delegate? find_delegate ( Vala.Delegate vdel ) {
+ foreach ( Delegate del in this.delegates ) {
+ if ( del.is_vdelegate( vdel ) )
+ return del;
+ }
+
+ return null;
+ }
+
+ 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, 0 );
+ this.delegates.add ( tmp );
+ tmp.initialisation ( );
+ }
+
+ 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 {
+ private set;
+ get;
+ }
+
+ protected inline Basic? search_interface ( string[] params, int pos ) {
+ foreach ( Interface iface in this.interfaces ) {
+ Basic 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 );
+ }
+
+ // internal
+ public Interface? find_interface ( Vala.Interface viface ) {
+ foreach ( Interface iface in this.interfaces ) {
+ if ( iface.is_vinterface( viface ) )
+ return iface;
+ }
+
+ return null;
+ }
+
+ 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 );
+ }
+ }
+
+ // inline
+ public void add_interface ( Vala.Interface viface ) {
+ var tmp = new Interface ( this.settings, viface, this, this.head );
+ this.interfaces.add ( tmp );
+ tmp.initialisation ( );
+ }
+
+ 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.ErrorDomoainHandler : Basic {
+ protected abstract Gee.ArrayList<ErrorDomain> errdoms {
+ private set;
+ get;
+ }
+
+ protected inline Basic? search_error_domain ( string[] params, int pos ) {
+ foreach ( ErrorDomain errdom in this.errdoms ) {
+ Basic 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 );
+ tmp.initialisation ( );
+ 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 );
+ }
+ }
+}
+
+
+
+
+public interface Valadoc.Writeable : Basic {
+ public abstract DocumentationTree? documentation {
+ protected set;
+ get;
+ }
+
+ // rename to write_documentation
+ public bool write_comment ( void* ptr ) {
+ if ( this.documentation == null )
+ return false;
+
+ this.documentation.write ( ptr );
+ return true;
+ }
+}
+
+
+
+public interface Valadoc.NamespaceHandler : Basic {
+ public abstract Gee.ArrayList<Namespace> namespaces {
+ private 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> ();
+ if ( vsymbol.name == null ) {
+ lst.add ( (Vala.Namespace)vsymbol );
+ return lst;
+ }
+
+
+ while ( vsymbol.name != null ) {
+ if ( vsymbol is Vala.Namespace ) {
+ lst.insert ( 0, (Vala.Namespace)vsymbol );
+ }
+ vsymbol = vsymbol.parent_symbol;
+ }
+ return lst;
+ }
+
+ // rename
+ // internal
+ public void add__namespace ( Namespace ns ) {
+ this.namespaces.add ( ns );
+ }
+
+ // 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 );
+ ns.initialisation( );
+ }
+
+ if ( pos == 0 ) {
+ return ns;
+ }
+
+ return ns.get_namespace_helper ( node, vnspaces, pos+1 );
+ }
+
+ // TODO: Rename vars
+ 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 );
+ ns.initialisation( );
+ 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.name != vns.name ) {
+ continue ;
+ }
+
+ if ( pos == 0 ) {
+ 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 );
+ int i = 0;
+
+ foreach ( Vala.Namespace n_s in vnspaces ) {
+ i++;
+ }
+
+ return this.find_vnamespace_helper ( vnspaces, vnspaces.size-1 );
+ }
+
+ // 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 {
+ // remove
+ protected abstract Gee.ArrayList<Class> classes {
+ set;
+ get;
+ }
+
+ public abstract uint bracket_level {
+ construct set;
+ protected get;
+ }
+
+ protected inline Basic? search_class ( string[] params, int pos ) {
+ foreach ( Class cl in this.classes ) {
+ Basic 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, remove
+ public void append_class ( Valadoc.Class cl ) {
+ this.classes.add( cl );
+ }
+
+ // internal
+ public void add_class ( Vala.Class vcl ) {
+ Class cl = new Class ( this.settings, vcl, this, this.head, 0 );
+ this.classes.add ( cl );
+ cl.initialisation( );
+ }
+
+ 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 : ContainerDataType {
+ protected abstract Gee.ArrayList<Property> properties {
+ get;
+ set;
+ }
+
+ protected inline Basic? 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.bracket_level + 1 );
+ tmp.initialisation ( );
+ this.properties.add ( tmp );
+ }
+ }
+}
+
+
+public interface Valadoc.ConstructionMethodHandler : DataType, MethodHandler {
+ protected abstract Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected inline Basic? 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_methods_and_construction_methods ( Gee.Collection<Vala.Method> vmethods ) {
+ foreach ( Vala.Method vm in vmethods ) {
+ var tmp = new Method ( this.settings, vm, this, this.head, this.bracket_level + 1 );
+ tmp.initialisation ( );
+ if ( tmp.is_constructor )
+ this.construction_methods.add ( tmp );
+ else
+ this.methods.add ( tmp );
+ }
+ }
+}
+
+
+
+public interface Valadoc.SignalHandler : ContainerDataType {
+ protected abstract Gee.ArrayList<Signal> signals {
+ get;
+ set;
+ }
+
+ protected inline Basic? 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.bracket_level + 1 );
+ tmp.initialisation ();
+ 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;
+ }
+
+ public abstract uint bracket_level {
+ construct set;
+ protected get;
+ }
+
+ protected inline Basic? search_struct ( string[] params, int pos ) {
+ foreach ( Struct stru in this.structs ) {
+ Basic 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 );
+ }
+
+ // internal, remove
+ public void append_struct ( Valadoc.Struct stru ) {
+ this.structs.add( stru );
+ }
+
+ public void add_struct ( Vala.Struct vstru ) {
+ Struct stru = new Struct ( this.settings, vstru, this, this.head, 0 );
+ this.structs.add( stru );
+ stru.initialisation( );
+ }
+
+ 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._protected && this.is_protected )
+ return false;
+
+ if ( this.parent != element && !this.settings.add_inherited )
+ return false;
+
+ return true;
+ }
+
+ protected bool is_visitor_accessible ( ) {
+ if ( !this.settings._private && this.is_private )
+ return false;
+
+ if ( !this.settings._protected && this.is_protected )
+ return false;
+
+ return true;
+ }
+}
+
+
+public interface Valadoc.SymbolAccessibility {
+ public abstract bool is_public {
+ get;
+ }
+
+ public abstract bool is_protected {
+ get;
+ }
+
+ public abstract bool is_private {
+ get;
+ }
+}
+
+
+
+public interface Valadoc.ReturnTypeHandler : Basic {
+ public abstract TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void set_return_type_references ( ) {
+ if ( this.return_type == null )
+ return ;
+
+ this.return_type.set_type_references ( );
+ }
+
+ // internal
+ protected void set_ret_type ( Vala.DataType vtref ) {
+ var tmp = new TypeReference.return_type ( this.settings, vtref, this, this.head );
+ this.return_type = tmp;
+ }
+}
+
+
+// ????
+public interface Valadoc.TypeHandler : Basic {
+ public abstract TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public void set_type_references ( ) {
+ if ( this.type_reference == null )
+ return ;
+
+ this.type_reference.set_type_references ( );
+ }
+
+ // ???
+ 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;
+ }
+
+ // internal
+ protected inline Basic? 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<Type>( 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 );
+ tmp.initialisation ( );
+ }
+
+ // 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;
+ }
+
+ public abstract uint bracket_level {
+ construct set;
+ get;
+ }
+
+ // internal
+ protected inline Basic? 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<Type>( 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 ) {
+ var tmp = new Field ( this.settings, vf, this, this.head, 0 /* this.bracket_level + 1 */ );
+ this.fields.add ( tmp );
+ tmp.initialisation ( );
+ }
+
+ // 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 );
+ }
+ }
+}
+
+
+
+public interface Valadoc.ExceptionHandler : Basic {
+ protected abstract Gee.ArrayList<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ public Gee.ReadOnlyCollection<TypeReference> get_error_domains ( ) {
+ return new Gee.ReadOnlyCollection<FormalParameter> ( this.err_domains );
+ }
+
+ // internal
+ public void add_error_domains ( Gee.Collection<Vala.DataType> vexceptions ) {
+ foreach ( Vala.DataType vtref in vexceptions ) {
+ var tmp = new TypeReference ( this.settings, vtref, (Valadoc.Basic)this, this.head );
+ this.err_domains.add ( tmp );
+ }
+ }
+
+ // internal
+ public void set_exception_type_references ( ) {
+ foreach ( TypeReference tref in this.err_domains ) {
+ tref.set_type_references ( );
+ }
+ }
+}
+
+
+
+public interface Valadoc.ParameterListHandler : Basic {
+ protected abstract Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ public abstract uint bracket_level {
+ construct 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 );
+ tmp.initialisation ( );
+ 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 {
+ protected set;
+ get;
+ }
+
+ public abstract uint bracket_level {
+ construct set;
+ get;
+ }
+
+ // internal
+ protected inline Basic? 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, 0 );
+ tmp.initialisation ( );
+ 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 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 );
+ tmp.initialisation ( );
+ 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 : Basic, SymbolAccessibility, TypeHandler, Visitable, Writeable {
+ public TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public Vala.Constant vconst {
+ construct set;
+ private get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vconst.name;
+ }
+ }
+
+ public void initialisation ( ) {
+ this.vsymbol = this.vconst;
+
+ var vret = this.vconst.type_reference;
+ this.set_ret_type ( vret );
+ }
+
+ public Constant ( Valadoc.Settings settings, Vala.Constant vconst, ConstantHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vconst = vconst;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.CONSTANT );
+ }
+
+ 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 : Basic, SymbolAccessibility, TypeHandler, Visitable, Writeable {
+ public Field ( Valadoc.Settings settings, Vala.Field vfield, FieldHandler parent, Tree head, uint bracket_level ) {
+ this.bracket_level = bracket_level;
+ this.settings = settings;
+ this.vfield = vfield;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.vfield.get_cname();
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vfield.name;
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vfield;
+
+ var vret = this.vfield.field_type;
+ this.set_ret_type ( vret );
+ }
+
+ public Vala.Field vfield {
+ construct set;
+ private get;
+ }
+
+ public bool is_volatile {
+ get {
+ return this.vfield.is_volatile;
+ }
+ }
+
+ // remove
+ public bool is_global {
+ get {
+ return ( this.parent is Valadoc.Namespace );
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.FIELD );
+ }
+
+ 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 {
+ public TypeReference ( Valadoc.Settings settings, Vala.DataType vtyperef, Basic parent, Tree head ) {
+ this.is_return_type = false;
+ this.settings = settings;
+ this.vtyperef = vtyperef;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ // remove
+ public TypeReference.return_type ( Valadoc.Settings settings, Vala.DataType vtyperef, Basic parent, Tree head ) {
+ this.is_return_type = true;
+ this.settings = settings;
+ this.vtyperef = vtyperef;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ // remove
+ public bool is_return_type {
+ construct set;
+ protected get;
+ }
+
+ protected Gee.ArrayList<TypeReference> type_arguments = new Gee.ArrayList<TypeReference> ();
+
+ 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 DataType data_type {
+ private set;
+ get;
+ }
+
+ public Vala.DataType vtyperef {
+ construct set;
+ private 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;
+ }
+ }
+
+ // from vala/valainterfacewriter.vala
+ private bool is_weak_helper (Vala.DataType type) {
+ if (type.value_owned) {
+ return false;
+ } else if (type is VoidType || type is PointerType) {
+ return false;
+ } else if (type is ValueType) {
+ if (type.nullable) {
+ // nullable structs are heap allocated
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public bool is_weak {
+ get {
+ Vala.CodeNode? node = this.vtyperef.parent_node;
+ if ( node == null )
+ return false;
+
+ if ( node is Vala.FormalParameter ) {
+ if ( ((Vala.FormalParameter)node).direction == Vala.ParameterDirection.IN)
+ return false;
+
+ if ( ((Vala.FormalParameter)node).direction == Vala.ParameterDirection.OUT)
+ return false;
+
+ return !this.vtyperef.value_owned;
+ }
+
+ return is_weak_helper( this.vtyperef );
+ }
+ }
+
+ public bool is_nullable {
+ get {
+ return this.vtyperef.nullable && this.vtyperef is Vala.PointerType == false;
+ }
+ }
+
+ public bool is_pointer {
+ get {
+ return this.vtyperef is Vala.PointerType;
+ }
+ }
+
+ public uint pointer_rank {
+ get {
+ if ( !this.is_pointer )
+ return 0;
+
+ Vala.DataType vdtype = this.vtyperef;
+ for ( int i = 0 ;; i++ ) {
+ if ( vdtype is Vala.PointerType == false )
+ return i;
+
+ vdtype = ((Vala.PointerType)vdtype).base_type;
+ }
+ return 0;
+ }
+ }
+
+ public bool is_array {
+ get {
+ return this.vtyperef.is_array();
+ }
+ }
+
+ public uint array_rank {
+ get {
+ if ( !this.is_array )
+ return 0;
+
+ return ((Vala.ArrayType)vtyperef).rank;
+ }
+ }
+
+ public string?# type_nspace_name {
+ get {
+
+ if ( this.data_type == null )
+ return null;
+
+ if ( this.data_type.nspace == null )
+ return null;
+
+ return this.data_type.nspace.name;
+ }
+ }
+
+
+ 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 );
+ }
+ /*
+ else if ( vdtype is FieldPrototype ) {
+ // Vala.Field field_symbol
+ }
+ InvalidType // nix
+ // ReferenceType
+ TypeParameterType
+ UnresolvedType //Vala.UnresolvedSymbol unresolved_symbol
+ ValueType // Vala.TypeSymbol type_symbol
+ */
+ return vtyperef.to_string();
+ }
+
+ // remove
+ public string# type_name {
+ get {
+ return this.extract_type_name ( this.vtyperef );
+ /*
+ Vala.TypeSymbol? vdtype = null;
+ if ( this.vtyperef is Vala.VoidType ) {
+ return "void";
+ }
+ else if ( this.vtyperef is Vala.PointerType ) {
+ vdtype = ((Vala.PointerType)this.vtyperef).base_type.data_type;
+ }
+ else if ( this.vtyperef is Vala.DelegateType ) {
+ return ((Vala.DelegateType)this.vtyperef).delegate_symbol.name;
+ }
+ else if ( this.vtyperef is Vala.MethodType ) {
+ return ((Vala.MethodType)this.vtyperef).method_symbol.name;
+ }
+ else if ( this.vtyperef is Vala.SignalType ) {
+ return ((Vala.SignalType)this.vtyperef).signal_symbol.name;
+ }
+ else if ( this.vtyperef is Vala.ArrayType ) {
+ vdtype = ((Vala.ArrayType)this.vtyperef).element_type.data_type;
+ }
+
+ if ( vdtype == null )
+ vdtype = this.vtyperef.data_type;
+
+ if ( vdtype == null ) {
+ return this.vtyperef.to_string();
+ }
+ return vdtype.name;
+ */
+ }
+ }
+
+ private DataType? _get_data_type ( Vala.TypeSymbol vdtype, File file, Namespace ns ) {
+ if ( vdtype is Vala.Enum ) {
+ return ns.find_enum ( (Vala.Enum)vdtype );
+ }
+ else if ( vdtype is ErrorDomain ) {
+ return ns.find_errordomain ( (Vala.ErrorDomain)vdtype );
+ }
+ else if ( vdtype is Vala.Delegate ) {
+ return ns.find_delegate ( (Vala.Delegate)vdtype );
+ }
+ else if ( vdtype is Vala.ArrayType ) {
+ var vtsym = ((Vala.ArrayType)vdtype).data_type;
+ return this._get_data_type ( vtsym, file, ns );
+ }
+ else if ( vdtype is Vala.Class ) {
+ return ns.find_class ( (Vala.Class)vdtype );
+ }
+ else if ( vdtype is Vala.Struct ) {
+ return ns.find_struct ( (Vala.Struct)vdtype );
+ }
+ else if ( vdtype is Vala.Interface ) {
+ return ns.find_interface ( (Vala.Interface)vdtype );
+ }
+ else if ( vdtype is Vala.PointerIndirection ) {
+ Vala.TypeSymbol vtsym = ((Vala.PointerType)vdtype).data_type;
+ return this._get_data_type ( vtsym, file, ns );
+ }
+ return null;
+ }
+
+ private File? get_file ( Vala.CodeNode vdtype ) {
+ if ( vdtype == null )
+ return null;
+
+ if ( vdtype.source_reference == null )
+ return null;
+
+
+ Vala.SourceReference sref = vdtype.source_reference;
+ if ( sref is SourceReference == false )
+ return null;
+
+ Vala.SourceFile vfile = sref.file;
+ if ( vfile == null )
+ return null;
+
+ File file = this.head.find_file ( vfile );
+ return file;
+ }
+
+ private Namespace get_nspace ( File file, Vala.Symbol vns ) {
+ while ( vns is Vala.Namespace == false ) {
+ vns = vns.parent_symbol;
+ }
+
+ Namespace ns = file.find_namespace ( (Vala.Namespace)vns );
+ return ns;
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ //stdout.printf ( "> %s\n", this.vtyperef.to_string() );
+ this.data_type = this.get_type_references ( this.vtyperef );
+ }
+
+ public DataType? get_type_references ( Vala.DataType vtyperef ) {
+ if ( vtyperef is Vala.ErrorType ) {
+ Vala.ErrorDomain verrdom = ((Vala.ErrorType)vtyperef).error_domain;
+ if ( verrdom != null ) {
+ File file = this.get_file ( verrdom );
+ if ( file == null ) {
+ return glib_error;
+ }
+
+ Namespace ns = this.get_nspace ( file, verrdom );
+ Valadoc.ErrorDomain errdom = ns.find_errordomain ( (Vala.ErrorDomain)verrdom );
+ return errdom;
+ }
+ }
+
+ if ( vtyperef is Vala.ClassType ) {
+ Vala.Class vcl = ((Vala.ClassType)vtyperef).class_symbol;
+ File file = this.get_file ( vcl );
+ if ( file == null )
+ return null; // err
+
+ Namespace ns = this.get_nspace ( file, vcl );
+ Valadoc.Class cl = ns.find_class ( (Vala.Class)vcl );
+ return cl;
+ }
+
+ if ( vtyperef is Vala.InterfaceType ) {
+ Vala.Interface vif = ((Vala.InterfaceType)vtyperef).interface_symbol;
+ File file = this.get_file ( vif );
+ if ( file == null )
+ return null; // err
+
+ Namespace ns = this.get_nspace ( file, vif );
+ Valadoc.Interface iface = ns.find_interface ( (Vala.Interface)vif );
+ return iface;
+ }
+
+ if ( vtyperef is Vala.DelegateType ) {
+ Vala.Delegate vdel = ((Vala.DelegateType)vtyperef).delegate_symbol;
+ File file = this.get_file ( vdel );
+ if ( file == null )
+ return null; // err
+
+ Namespace ns = this.get_nspace ( file, vdel );
+ Valadoc.Delegate del = ns.find_delegate ( (Vala.Delegate)vdel );
+ return del;
+ }
+
+ if ( vtyperef is Vala.PointerType ) {
+ Vala.DataType vptr = ((Vala.PointerType)vtyperef).base_type;
+ if ( vptr == null )
+ return null;
+ return this.get_type_references ( vptr );
+ }
+
+ if ( vtyperef is Vala.ArrayType ) {
+ Vala.DataType vptr = ((Vala.ArrayType)vtyperef).element_type;
+ if ( vptr == null )
+ return null;
+
+ return this.get_type_references ( vptr );
+ }
+ /*
+ if ( vtyperef is Vala.ValueType ) {
+ // Integer, StructType, Enum
+ } */
+
+ Vala.TypeSymbol vdtype = vtyperef.data_type;
+ if ( vdtype == null ) {
+ return null;
+ }
+
+ var varguments = vtyperef.get_type_arguments ();
+ this.set_template_argument_list ( varguments );
+
+ File file = this.get_file ( vdtype );
+ if ( file == null )
+ return null; // err
+
+ Namespace ns = this.get_nspace ( file, vdtype );
+ return this._get_data_type ( vdtype, file, ns );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_type_reference ( this, ptr );
+ }
+}
+
+
+
+// TODO: Remove unused stuff
+// You just need it for the name in a template-parameter-list.
+// remove TypeHandler-interface
+public class Valadoc.TypeParameter : Basic, TypeHandler {
+ public TypeParameter ( Valadoc.Settings settings,
+ Vala.TypeParameter vtypeparam,
+ Basic parent,
+ Tree head ) {
+ this.vtypeparam = 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 Vala.TypeParameter vtypeparam {
+ construct set;
+ protected get;
+ }
+
+ public string# datatype_name {
+ get {
+ return this.vtypeparam.name;
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ }
+
+ // internal
+ public void set_type_reference ( ) {
+ }
+}
+
+
+public class Valadoc.FormalParameter : Basic, TypeHandler {
+ public FormalParameter ( Valadoc.Settings settings, Vala.FormalParameter vformalparam, Basic parent, Tree head ) {
+ this.settings = settings;
+ this.vformalparam = vformalparam;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public bool is_out {
+ get {
+ return this.vformalparam.direction == ParameterDirection.OUT;
+ }
+ }
+
+ public bool is_ref {
+ get {
+ return this.vformalparam.direction == ParameterDirection.REF;
+ }
+ }
+
+ public ExpressionType default_vaule_type {
+ default = ExpressionType.NOT_SET;
+ private set;
+ get;
+ }
+
+ public string? default_value {
+ private set;
+ public get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vformalparam;
+
+ var vformparam = this.vformalparam.parameter_type;
+ this.set_ret_type ( vformparam );
+
+ var def = this.vformalparam.default_expression;
+ if ( def != null ) {
+ {
+ if ( def is Vala.StringLiteral ) {
+ this.default_value = def.to_string;
+ this.default_vaule_type = ExpressionType.STRING;
+ }
+ else if ( def is Vala.CharacterLiteral ) {
+ this.default_value = def.to_string;
+ this.default_vaule_type = ExpressionType.CHAR;
+ }
+ else if ( def is Vala.RealLiteral ) {
+ this.default_vaule_type = ExpressionType.REAL;
+ this.default_value = def.to_string;
+ }
+ else if ( def is BooleanLiteral ) {
+ this.default_value = def.to_string;
+ this.default_vaule_type = ExpressionType.BOOL;
+ }
+ else if ( def is IntegerLiteral ) {
+ this.default_value = def.to_string;
+ this.default_vaule_type = ExpressionType.INT;
+ }
+ else if ( def is NullLiteral ) {
+ this.default_vaule_type = ExpressionType.NULL;
+ this.default_value = "null";
+ }
+ else {
+ this.default_value = def.to_string;
+ }
+ }
+ }
+ }
+
+ public TypeReference type_reference {
+ protected set;
+ get;
+ }
+
+ public bool ellipsis {
+ get {
+ return this.vformalparam.ellipsis;
+ }
+ }
+
+ public bool is_construct {
+ get {
+ return this.vformalparam.construct_parameter;
+ }
+ }
+
+ public override string?# name {
+ get {
+ return ( this.vformalparam.name == null )
+ ? "" : this.vformalparam.name;
+ }
+ }
+
+ public Vala.FormalParameter vformalparam {
+ construct set;
+ protected get;
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ if ( this.vformalparam.ellipsis )
+ return ;
+
+ ((TypeHandler)this).set_type_references ( );
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_formal_parameter ( this, ptr );
+ }
+}
+
+
+
+public class Valadoc.PropertyAccessor : Object /*, FIXME: Valac-Bug! Can't override properties of SymbolAccessibility */ {
+ 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 void construction ( ) {
+ }
+
+ public Tree head {
+ construct;
+ get;
+ }
+
+ public Vala.PropertyAccessor vpropacc {
+ construct;
+ private get;
+ }
+
+ public Settings settings {
+ construct;
+ get;
+ }
+
+ public Property parent {
+ private set;
+ get;
+ }
+
+ public Tree tree {
+ construct;
+ 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_set {
+ get {
+ return this.vpropacc.writable;
+ }
+ }
+
+ public bool is_get {
+ get {
+ return this.vpropacc.readable;
+ }
+ }
+
+ public void write ( Langlet langlet, void* ptr ) {
+ langlet.write_property_accessor ( this, ptr );
+ }
+}
+
+
+
+public class Valadoc.Property : Basic, SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable {
+ public Property ( Valadoc.Settings settings,
+ Vala.Property vproperty,
+ ContainerDataType parent,
+ Tree head,
+ uint bracket_level ) {
+ this.settings = settings;
+ this.vproperty = vproperty;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ public string? get_cname () {
+ return this.vproperty.nick;
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public bool equals ( Property p ) {
+ return this.vproperty.equals ( p.vproperty );
+ }
+
+ public TypeReference return_type {
+ 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;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = 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 Vala.Property vproperty {
+ construct set;
+ protected get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vproperty.name;
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ this.set_return_type_references ( );
+ }
+
+ // internal
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.PROPERTY );
+ }
+
+ 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 : Basic, ParameterListHandler, SymbolAccessibility,
+ ReturnTypeHandler, Visitable, Writeable
+{
+ public Signal ( Valadoc.Settings settings,
+ Vala.Signal vsignal,
+ ContainerDataType parent,
+ Tree head,
+ uint bracket_level ) {
+ this.settings = settings;
+ this.vsignal = vsignal;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ construct {
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+ }
+
+ public string? get_cname () {
+ return this.vsignal.get_cname();
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = vsignal;
+
+ var vparamlst = this.vsignal.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+
+ var ret = this.vsignal.return_type;
+ this.set_ret_type ( ret );
+ }
+
+ protected Gee.ArrayList<FormalParameter> param_list {
+ protected set;
+ get;
+ }
+
+ public Vala.Signal vsignal {
+ construct set;
+ private 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, CommentContext.SIGNAL );
+ }
+
+ public override string?# name {
+ get {
+ return this.vsignal.name;
+ }
+ }
+
+ 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 : Basic, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler,
+ SymbolAccessibility, ReturnTypeHandler, Visitable, Writeable
+{
+ public Method ( Valadoc.Settings settings,
+ Vala.Method vmethod,
+ MethodHandler parent,
+ Tree head,
+ uint bracket_level ) {
+ this.settings = settings;
+ this.vmethod = vmethod;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ public string? get_cname () {
+ return this.vmethod.get_cname();
+ }
+
+ construct {
+ this.err_domains = new Gee.ArrayList<TypeReference>();
+ this.param_list = new Gee.ArrayList<FormalParameter>();
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ }
+
+ public Method base_method {
+ get;
+ set;
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public TypeReference return_type {
+ 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<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vmethod.source_reference.comment;
+ }
+ }
+
+ // 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.comment_string == null )
+ return ;
+
+ bool tmp = Parser.is_documentation ( this.comment_string );
+ if ( tmp == false )
+ return ;
+
+ if ( this.is_override && Parser.is_inherit_doc ( this.comment_string ) ) {
+ this.base_method.parse_comment ( docparser );
+ this.documentation = this.base_method.documentation;
+ return ;
+ }
+
+ // wrong context!
+ this.parse_comment_helper ( docparser, CommentContext.CLASS );
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = vmethod;
+
+ var vret = this.vmethod.return_type;
+ this.set_ret_type ( vret );
+
+ var vparamlst = this.vmethod.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+
+ var vexceptionlst = this.vmethod.get_error_types ();
+ this.add_error_domains ( vexceptionlst );
+ }
+
+ public Vala.Method vmethod {
+ construct set;
+ private get;
+ }
+
+ 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 string# parent_name {
+ get {
+ return this.parent.name;
+ }
+ }
+
+ public bool is_global {
+ get {
+ return ( this.parent is Namespace );
+ }
+ }
+
+ 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 {
+ get {
+ if ( this.is_constructor )
+ return this.parent_name + this.vmethod.name.offset( ".new".len() );
+ else
+ return this.vmethod.name;
+ }
+ }
+
+ // internal
+ public void set_type_references ( ) {
+ this.set_return_type_references ( );
+
+ this.set_exception_type_references ( );
+ this.set_parameter_list_type_references ( );
+ }
+
+ 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: Basic, Writeable {
+ public EnumValue ( Valadoc.Settings settings,
+ Vala.EnumValue venval,
+ Enum parent,
+ Tree head ) {
+ this.settings = settings;
+ this.venval = venval;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public void initialisation ( ) {
+ this.bracket_level = 1;
+ this.vsymbol = venval;
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public override string?# name {
+ get {
+ return this.venval.name;
+ }
+ }
+
+ public Vala.EnumValue venval {
+ construct set;
+ protected get;
+ }
+
+ public void parse_comment ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.ENUMVALUE );
+ }
+
+ 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 : Basic, Writeable {
+ public ErrorCode ( Valadoc.Settings settings,
+ Vala.ErrorCode verrcode,
+ ErrorDomain parent,
+ Tree head ) {
+ this.settings = settings;
+ this.verrcode = verrcode;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.bracket_level = 1;
+ this.vsymbol = verrcode;
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ public override string?# name {
+ get {
+ return this.verrcode.name;
+ }
+ }
+
+ public Vala.ErrorCode verrcode {
+ construct set;
+ protected get;
+ }
+
+ 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, CommentContext.ENUMVALUE );
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_error_code ( this );
+ }
+}
+
+
+
+public abstract class Valadoc.DataType: Basic, SymbolAccessibility, Visitable, Writeable {
+ public override string?# name {
+ get {
+ return this.vsymbol.name;
+ }
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ // internal
+ public virtual void set_type_references ( ) {
+ }
+
+ public virtual void visit ( Doclet doclet ) {
+ }
+
+ public virtual void write ( Langlet langlet, void* ptr ) {
+ }
+}
+
+
+
+public class Valadoc.Delegate : DataType, ParameterListHandler, SymbolAccessibility, Writeable,
+ ReturnTypeHandler, TemplateParameterListHandler,
+ ExceptionHandler {
+ public Delegate ( Valadoc.Settings settings,
+ Vala.Delegate vdelegate,
+ DelegateHandler parent,
+ Tree head,
+ uint bracket_level ) {
+ this.settings = settings;
+ this.vdelegate = vdelegate;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ public string? get_cname () {
+ return this.vdelegate.get_cname();
+ }
+
+ construct {
+ this.err_domains = new Gee.ArrayList<TypeReference>();
+ this.param_list = new Gee.ArrayList<FormalParameter> ();
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ }
+
+ public TypeReference return_type {
+ protected set;
+ get;
+ }
+
+ public override 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<TypeReference> err_domains {
+ protected set;
+ get;
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.vdelegate;
+
+ var vparamlst = this.vdelegate.get_parameters ();
+ this.add_parameter_list ( vparamlst );
+
+ var vexceptionlst = this.vdelegate.get_error_types ();
+ this.add_error_domains ( vexceptionlst );
+
+ var ret = this.vdelegate.return_type;
+ this.set_ret_type ( ret );
+ }
+
+ public Vala.Delegate vdelegate {
+ construct set;
+ private get;
+ }
+
+ public bool is_static {
+ get {
+ return this.vdelegate.has_target;
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_template_parameter_list_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, CommentContext.DELEGATE );
+ }
+
+ // internal
+ public bool is_vdelegate ( Vala.Delegate vdel ) {
+ return ( this.vdelegate == vdel );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_delegate ( this, ptr );
+ }
+}
+
+
+
+public abstract class Valadoc.ContainerDataType : DataType, MethodHandler, Visitable,
+ TemplateParameterListHandler
+{
+ protected Gee.ArrayList<DataType> parent_types = new Gee.ArrayList<DataType>();
+
+ construct {
+ this.template_param_lst = new Gee.ArrayList<TypeParameter> ();
+ this.methods = new Gee.ArrayList<Method> ();
+ }
+
+ protected Class? parent_class {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ public string?# comment_str {
+ get {
+ return null;
+ }
+ }
+
+ protected Gee.ArrayList<TypeParameter> template_param_lst {
+ set;
+ get;
+ }
+
+ // rename to get_parent_type_list
+ public Gee.Collection<DataType> get_parent_types ( ) {
+ return this.parent_types;
+ }
+
+ public bool derived_from_interface ( Interface iface ) {
+ foreach ( DataType dtype in this.parent_types ) {
+ if ( dtype == iface )
+ return true;
+ }
+ return false;
+ }
+
+ // internal <>!<>!<>!<>!<>
+ // remove virtual
+ public virtual void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_method_comments ( docparser );
+ }
+
+ protected void set_parent_references ( Gee.Collection<Vala.DataType> lst ) {
+ if ( ((Gee.Collection)this.parent_types).size != 0 )
+ return ;
+
+ foreach ( Vala.DataType vtyperef in lst ) {
+ var vtype = vtyperef.data_type;
+ if ( vtype == null )
+ return ;
+
+ Vala.SourceFile vfile = vtype.source_reference.file;
+ File file = this.head.find_file ( vfile );
+
+ Vala.Symbol vns = vtype;
+ while ( vns is Vala.Namespace == false ) {
+ vns = vns.parent_symbol;
+ }
+
+
+ Namespace ns = file.find_namespace ( (Vala.Namespace)vns );
+ if ( vtype is Vala.Class ) {
+ var tmp = ns.find_vclass ( (Vala.Class)vtype );
+ this.parent_types.add ( tmp );
+ this.parent_class = tmp;
+ }
+ else if ( vtype is Vala.Interface ) {
+ var tmp = ns.find_interface ( (Vala.Interface)vtype );
+ this.parent_types.add ( tmp );
+ }
+ else if ( vtype is Vala.Struct ) {
+ var tmp = ns.find_struct ( (Vala.Struct)vtype );
+ this.parent_types.add ( tmp );
+ }
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_template_parameter_list_references ( );
+ this.set_method_type_references ( );
+ base.set_type_references ( );
+ }
+
+ public bool is_double_method ( Method met ) {
+ foreach ( Method m2 in this.methods ) {
+ if ( met == m2 )
+ continue;
+
+ if ( met.name == m2.name )
+ return true;
+ }
+ return false;
+ }
+}
+
+
+
+public class Valadoc.Class : ContainerDataType, Visitable, ClassHandler, StructHandler, SignalHandler,
+ EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler,
+ DelegateHandler, ConstantHandler {
+ public Class ( Valadoc.Settings settings, Vala.Class vclass, ClassHandler parent, Tree head, uint bracket_level = 0 ) {
+ this.settings = settings;
+ this.vclass = vclass;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ private bool inherited = false;
+
+ 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();
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ var fooo = string.joinv (".", params);
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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 void initialisation ( ) {
+ this.vsymbol = this.vclass;
+
+ 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 ();
+ enums = new Gee.ArrayList<Enum> ();
+ this.add_enums ( venums );
+
+ Gee.Collection<Vala.Delegate> vdelegates = this.vclass.get_delegates ();
+ 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 );
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vclass.source_reference.comment;
+ }
+ }
+
+ public Vala.Class vclass {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_vclass ( Vala.Class vcl ) {
+ return this.vclass == vcl;
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_class ( this, ptr );
+ }
+
+ public bool is_abstract {
+ get {
+ return this.vclass.is_abstract;
+ }
+ }
+
+ // remove
+ public bool is_static {
+ get {
+ return this.vclass.is_static;
+ }
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_class ( this );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.CLASS );
+
+ this.parse_construction_method_comments ( docparser );
+ this.parse_delegate_comments ( docparser );
+ this.parse_constant_comments ( docparser );
+ this.parse_property_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 );
+ base.parse_comments ( docparser );
+ }
+
+ // remove ?
+ protected bool is_double_field ( Field f ) {
+ foreach ( Field f2 in this.fields ) {
+ if ( f == f2 )
+ continue ;
+
+ if ( f.name == f2.name )
+ return true;
+ }
+ return false;
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ base.set_type_references ( );
+
+ var lst = this.vclass.get_base_types ();
+ this.set_parent_references ( lst );
+
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_delegate_type_references ( );
+ this.set_property_type_reference ( );
+ 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 ( );
+
+ if ( dtype.name == "Object" )
+ return ;
+
+ 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 ;
+
+ if ( m.is_virtual || m.is_override || m.is_abstract ) {
+ Method m2 = get_new_method ( m );
+ if ( m2 != null )
+ m2.base_method = m;
+ continue ;
+ }
+
+ this.methods.add ( m );
+ }
+ }
+
+ private Method? get_new_method ( Method overwritten_method ) {
+ foreach ( Method m in this.methods ) {
+ if ( !m.is_override )
+ continue ;
+
+ if ( m.name == overwritten_method.name )
+ return m;
+ }
+ return null;
+ }
+
+ private void inheritance_interface ( Interface dtype ) {
+ /*if ( dtype.derived_from_interface ( dtype ) )
+ return ; */
+
+ 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;
+ foreach ( DataType dtype in this.parent_types ) {
+ if ( dtype is Class )
+ this.inheritance_class ( (Class)dtype );
+ else if ( dtype is Interface )
+ this.inheritance_interface ( (Interface)dtype );
+ }
+
+ foreach ( Class cl in this.classes ) {
+ cl.inheritance( );
+ }
+ }
+}
+
+
+
+public class Valadoc.ErrorDomain : DataType, MethodHandler, Visitable {
+ public ErrorDomain ( Valadoc.Settings settings,
+ Vala.ErrorDomain verrdom,
+ ErrorDomoainHandler parent,
+ Tree head ) {
+ this.settings = settings;
+ this.verrdom = verrdom;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.verrdom.get_cname();
+ }
+
+ private Gee.ArrayList<ErrorCode> errcodes = new Gee.ArrayList<ErrorCode> ();
+
+ protected Vala.ErrorDomain verrdom {
+ private get;
+ set;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ // internal
+ public bool is_verrordomain ( Vala.ErrorDomain ver ) {
+ return ( this.verrdom == ver );
+ }
+
+ //inline
+ private inline Basic? 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;
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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 ) {
+ // CommentContext.ENUM
+ this.parse_comment_helper ( docparser, CommentContext.ERRORDOMAIN );
+ 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 override 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 );
+ tmp.initialisation ( );
+ this.errcodes.add ( tmp );
+ }
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_method_type_references ( );
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.verrdom;
+
+ 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 class Valadoc.Enum : DataType, MethodHandler, Visitable {
+ public Enum ( Valadoc.Settings settings,
+ Vala.Enum venum,
+ EnumHandler parent,
+ Tree head ) {
+ this.settings = settings;
+ this.venum = venum;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.venum.get_cname();
+ }
+
+ private inline Basic? 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
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ var 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 override void set_type_references ( ) {
+ this.set_method_type_references ( );
+ }
+
+ construct {
+ this.en_values = new Gee.ArrayList<EnumValue> ();
+ this.methods = new Gee.ArrayList<Method> ();
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ protected set;
+ get;
+ }
+
+ protected Gee.ArrayList<EnumValue> en_values {
+ get;
+ set;
+ }
+
+ public Gee.ReadOnlyCollection<EnumValue> get_enum_values () {
+ return new Gee.ReadOnlyCollection<EnumValue>( this.en_values );
+ }
+
+ // internal
+ public void parse_comments ( Valadoc.Parser docparser ) {
+ // CommentContext.ENUM
+ this.parse_comment_helper ( docparser, CommentContext.ENUM );
+
+ 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 );
+ tmp.initialisation ( );
+ this.en_values.add ( tmp );
+ }
+ }
+
+ // internal
+ public void initialisation ( ) {
+ this.vsymbol = this.venum;
+
+ Gee.Collection<Vala.Method> vmethods = this.venum.get_methods ();
+ this.add_methods ( vmethods );
+
+ Gee.Collection<Vala.EnumValue> venvals = this.venum.get_values ();
+ this.add_enum_values ( venvals );
+ }
+
+ public void visit_enum_values ( Doclet doclet ) {
+ foreach ( EnumValue enval in this.en_values )
+ enval.visit ( doclet );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_enum ( this );
+ }
+
+ public Vala.Enum venum {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_venum ( Vala.Enum ven ) {
+ return ( this.venum == ven );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_enum ( this, ptr );
+ }
+}
+
+
+
+public class Valadoc.Struct : ContainerDataType, Visitable, ConstructionMethodHandler, FieldHandler, ConstantHandler {
+ public Struct ( Valadoc.Settings settings, Vala.Struct vstruct, StructHandler parent, Tree head, uint bracket_level ) {
+ this.settings = settings;
+ this.vstruct = vstruct;
+ this.parent = parent;
+ this.head = head;
+ this.bracket_level = bracket_level;
+ }
+
+ public string? get_cname () {
+ return this.vstruct.get_cname();
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> construction_methods {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Constant> constants {
+ set;
+ get;
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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
+ public void initialisation ( ) {
+ this.vsymbol = this.vstruct;
+
+ 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 );
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vstruct.source_reference.comment;
+ }
+ }
+
+ public Vala.Struct vstruct {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public bool is_vstruct ( Vala.Struct vstru ) {
+ return ( this.vstruct == vstru );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_struct ( this );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_struct ( this, ptr );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+ this.parse_construction_method_comments ( docparser );
+ this.parse_constant_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ base.parse_comments ( docparser );
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ this.set_construction_method_references ( );
+ this.set_constant_type_references ( );
+ this.set_field_type_references ( );
+ base.set_type_references ( );
+
+ var lst = this.vstruct.get_base_types ();
+ this.set_parent_references ( lst );
+ }
+}
+
+
+
+public class Valadoc.Interface : ContainerDataType, Visitable, SignalHandler, PropertyHandler, FieldHandler,
+ DelegateHandler, EnumHandler, StructHandler, ClassHandler {
+ public Interface ( Valadoc.Settings settings, Vala.Interface vinterface, InterfaceHandler parent, Tree head ) {
+ this.settings = settings;
+ this.vinterface = vinterface;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public string? get_cname () {
+ return this.vinterface.get_cname();
+ }
+
+ 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;
+ }
+
+ public Vala.Interface vinterface {
+ construct set;
+ protected get;
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( !(this.name == params[pos] || params[0] == "this") )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+ var 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 void initialisation ( ) {
+ this.vsymbol = this.vinterface;
+
+ 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 );
+ }
+
+ public bool is_static {
+ get {
+ return this.vinterface.is_static;
+ }
+ }
+
+ public string?# comment_str {
+ get {
+ return this.vinterface.source_reference.comment;
+ }
+ }
+
+ // internal
+ public bool is_vinterface ( Vala.Interface viface ) {
+ return ( this.vinterface == viface );
+ }
+
+ public override void visit ( Doclet doclet ) {
+ if ( !this.is_visitor_accessible ( ) )
+ return ;
+
+ doclet.visit_interface ( this );
+ }
+
+ public override void write ( Langlet langlet, void* ptr ) {
+ langlet.write_interface ( this, ptr );
+ }
+
+ // internal
+ public override void parse_comments ( Valadoc.Parser docparser ) {
+ this.parse_comment_helper ( docparser, CommentContext.INTERFACE );
+ this.parse_delegate_comments ( docparser );
+ this.parse_property_comments ( docparser );
+ this.parse_signal_comments ( docparser );
+ this.parse_struct_comments ( docparser );
+ this.parse_field_comments ( docparser );
+ this.parse_class_comments ( docparser );
+ this.parse_enum_comments ( docparser );
+ base.parse_comments ( docparser );
+ }
+
+ // internal
+ public override void set_type_references ( ) {
+ base.set_type_references ( );
+
+ this.set_delegate_type_references ();
+ this.set_property_type_reference ();
+ this.set_signal_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_parent_references ( lst );
+ }
+}
+
+
+
+
+public class Valadoc.Namespace : Basic, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomoainHandler,
+ 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 void initialisation( ) {
+ this.namespaces = new Gee.ArrayList<Namespace> ();
+ this.structs = new Gee.ArrayList<Struct>();
+ this.classes = new Gee.ArrayList<Class>();
+ this.bracket_level = 0;
+
+ 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> ();
+
+ /*
+ Gee.Collection<Vala.Delegate> vdelegates = this.vnspace.get_delegates ();
+ this.delegates = new Gee.ArrayList<Delegate>();
+ this.add_delegates ( vdelegates );
+
+ Gee.Collection<Vala.ErrorDomain> verrdoms = this.vnspace.get_error_types ();
+ this.errdoms = new Gee.ArrayList<ErrorDomain>();
+ this.add_error_domains ( verrdoms );
+
+ Gee.Collection<Vala.Enum> venums = this.vnspace.get_enums ();
+ this.enums = new Gee.ArrayList<Enum>();
+ this.add_enums ( venums );
+
+ Gee.Collection<Vala.Field> vfields = this.vnspace.get_fields ();
+ this.fields = new Gee.ArrayList<Field> ();
+ this.add_fields ( vfields );
+
+ Gee.Collection<Vala.Method> vmethods = this.vnspace.get_methods ();
+ this.methods = new Gee.ArrayList<Method> ();
+ this.add_methods ( vmethods );
+
+ Gee.Collection<Vala.Interface> vifaces = this.vnspace.get_interfaces ();
+ this.interfaces = new Gee.ArrayList<Interface>();
+ this.add_interfaces ( vifaces );
+ */
+ }
+
+ public Gee.ArrayList<Namespace> namespaces {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Class> classes {
+ private set;
+ get;
+ }
+
+ protected Gee.ArrayList<Struct> structs {
+ private set;
+ get;
+ }
+
+ private inline Basic? search_namespace ( string[] params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element ( params, pos+1 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ if ( this.name != params[pos] )
+ return null;
+
+ if ( params[pos+1] == null )
+ return this;
+
+
+ Basic 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;
+ }
+
+ public uint bracket_level {
+ construct set;
+ get;
+ }
+
+ protected Gee.ArrayList<Field> fields {
+ set;
+ get;
+ }
+
+ protected Gee.ArrayList<Method> methods {
+ set;
+ get;
+ }
+
+ // internal, remove
+ public Struct? find_struct ( Vala.Struct vstruct ) {
+ foreach ( Struct stru in this.structs ) {
+ if ( stru.is_vstruct( vstruct ) )
+ return stru;
+ }
+
+ return null;
+ }
+
+ // internal, remove
+ public Class? find_class ( Vala.Class vclass ) {
+ foreach ( Class cl in this.classes ) {
+ if ( cl.is_vclass( vclass ) )
+ return cl;
+ }
+
+ return null;
+ }
+
+ public Namespace ( Valadoc.Settings settings,
+ Vala.Namespace vnspace,
+ NamespaceHandler parent,
+ Tree head ) {
+ this.settings = settings;
+ this.vnspace = vnspace;
+ this.parent = parent;
+ this.head = head;
+ }
+
+ public void visit ( Doclet doclet ) {
+ doclet.visit_namespace ( this );
+ }
+
+ public Vala.Namespace vnspace {
+ construct set;
+ private get;
+ }
+
+ public override string?# name {
+ get {
+ return this.vnspace.name;
+ }
+ }
+
+ /*/ internal
+ public void append_interface ( Vala.Interface viface ) {
+ var tmp = new Interface ( this.settings, viface, this, this.head );
+ tmp.initialisation ( );
+ this.interfaces.add ( tmp );
+ } */
+
+ /*/ internal
+ private Valadoc.Class create_subclasses ( Vala.Class vcl, Basic parent,
+ Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Class> > sub_classes,
+ Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Struct> > sub_structs,
+ uint rank )
+ {
+ var cl = new Class ( this.settings, vcl, (ClassHandler)parent, this.head, rank++ );
+ cl.initialisation( );
+
+ foreach ( Vala.Struct vsubstruct in sub_structs.get( vcl ) ) {
+ var substru = new Struct ( this.settings, vsubstruct, cl, this.head, rank );
+ substru.initialisation( );
+ cl.append_struct ( substru );
+ }
+
+ foreach ( Vala.Class vsubcl in sub_classes.get ( vcl ) ) {
+ var subcl = this.create_subclasses ( vsubcl, cl,sub_classes, sub_structs, rank );
+ cl.append_class ( subcl );
+ }
+ return cl;
+ }
+*/
+/*
+ // internal
+ public void append_global_class ( Vala.Class vclass,
+ Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Class> > vsubclasses,
+ Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Class> > vsubstructs )
+ {
+ var tmp = this.create_subclasses ( vclass, this, vsubclasses, vsubstructs, 0 );
+ this.append_class ( tmp );
+ }
+
+ // internal
+ public void append_global_struct ( Vala.Struct vstruct ) {
+ var tmp = new Struct ( this.settings, vstruct, this, this.head, 0 );
+ tmp.initialisation ( );
+ this.append_struct ( tmp );
+ }
+*/
+ /*/ internal
+ public void append_enum ( Vala.Enum venum ) {
+ var tmp = new Enum ( this.settings, venum, this, this.head );
+ tmp.initialisation ( );
+ this.enums.add( tmp );
+ }*/
+
+ /*/ internal
+ public void append_error_domain ( Vala.ErrorDomain verrdom ) {
+ var tmp = new ErrorDomain ( this.settings, verrdom, this, this.head );
+ tmp.initialisation ( );
+ this.errdoms.add ( tmp );
+ } */
+
+ /*/ internal
+ public void append_global_method ( Vala.Method vm ) {
+ var tmp = new Method ( this.settings, vm, this, this.head, 0 );
+ tmp.initialisation ( );
+ this.methods.add ( tmp );
+ }*/
+
+ /*/ internal
+ public void append_global_field ( Vala.Field vf ) {
+ var tmp = new Field ( this.settings, vf, this, this.head, 0 );
+ tmp.initialisation ( );
+ this.fields.add( tmp );
+ }
+*/
+ /*/ internal
+ public void append_delegate ( Vala.Delegate vdel ) {
+ var tmp = new Delegate ( this.settings, vdel, this, this.head, 0 );
+ tmp.initialisation ( );
+ this.delegates.add ( tmp );
+ } */
+
+ // interface
+ 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 ( );
+ }
+
+ // 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_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 );
+ }
+}
+
+
+// rename to package
+public class Valadoc.File : Basic, NamespaceHandler {
+ public Gee.ArrayList<Namespace> namespaces {
+ default = new Gee.ArrayList<Namespace>();
+ private set;
+ private get;
+ }
+
+ public File ( Valadoc.Settings settings, Vala.SourceFile vfile, Tree head ) {
+ this.settings = settings;
+ this.vfile = vfile;
+ this.head = head;
+ }
+
+ public override string?# name {
+ get {
+ return this.vfile.filename;
+ }
+ }
+
+ public Vala.SourceFile vfile {
+ construct set;
+ private get;
+ }
+
+ // internal
+ public override Basic? search_element ( string[] params, int pos ) {
+ foreach ( Namespace ns in this.namespaces ) {
+ Basic element = ns.search_element( params, pos );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ // internal
+ public bool is_file ( Vala.SourceFile vfile ) {
+ return ( vfile == this.vfile );
+ }
+
+ public void visit ( Doclet doclet ) {
+ if ( !settings.to_doc ( this.name ) )
+ return ;
+
+ doclet.visit_file ( this );
+ }
+
+ /*/ internal
+ public void append_interface ( Vala.Interface viface ) {
+ var ns = this.get_namespace ( viface );
+ ns.append_interface ( viface );
+ }
+ */
+/*
+ // internal
+ public void append_class ( Vala.Class vclass,
+ Gee.HashMap< Gee.Collection<Vala.Class> > vsubclasses,
+ Gee.HashMap< Gee.Collection<Vala.Struct> > vsubstructs ) {
+ var ns = this.get_namespace ( vclass );
+ ns.append_global_class ( vclass, vsubclasses, vsubstructs );
+ }
+
+ // internal
+ public void append_struct ( Vala.Struct vstruct ) {
+ var ns = this.get_namespace ( vstruct );
+ ns.append_global_struct ( vstruct );
+ }
+
+ // internal
+ public void append_enum ( Vala.Enum venum ) {
+ var ns = this.get_namespace ( venum );
+ ns.append_enum ( venum );
+ }*/
+
+ /*/ internal
+ public void append_error_domain ( Vala.ErrorDomain verrdom ) {
+ var ns = this.get_namespace ( verrdom );
+ ns.append_error_domain ( verrdom );
+ } */
+
+ /*/ internal
+ public void append_global_method ( Vala.Method vm ){
+ var ns = this.get_namespace ( vm );
+ ns.append_global_method ( vm );
+ } */
+
+
+ /*/ internal
+ public void append_global_field ( Vala.Field vf ) {
+ var ns = this.get_namespace ( vf );
+ ns.append_global_field( vf );
+ }*/
+
+ /* internal
+ public void append_delegate ( Vala.Delegate vdel ) {
+ var ns = this.get_namespace ( vdel );
+ ns.append_delegate ( vdel );
+ } */
+
+ // 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<File> files = new Gee.ArrayList<File>();
+
+ // remove
+ private uint level = 0;
+
+ // remove
+ private Vala.TypeSymbol current_type = null;
+
+ // remove
+ private Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Class> > sub_classes
+ = new Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Class> > ();
+
+ // remove
+ private Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Struct> > sub_structs
+ = new Gee.HashMap<Vala.Class, Gee.ArrayList<Vala.Struct> > ();
+
+
+ public Valadoc.Settings settings {
+ construct set;
+ private get;
+ }
+
+ public Tree (Valadoc.Settings settings, Vala.CodeContext context ) {
+ this.settings = settings;
+ this.context = context;
+ }
+
+ public CodeContext context {
+ construct set;
+ private get;
+ }
+
+ public void visit ( Doclet doclet ) {
+ foreach ( File file in this.files ) {
+ file.visit ( doclet );
+ }
+ }
+
+ private Basic? search_symbol_in_namespace ( Basic element, string[] params ) {
+ return this.search_symbol_in_symbol ( element.nspace, params );
+ }
+
+ private Basic? search_symbol_in_type ( Basic element, string[] params, int params_offset = 0 ) {
+ if ( !( element.parent is ContainerDataType || 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 ( element.parent, nparams, 0 );
+ }
+
+ return this.search_symbol_in_symbol ( element.parent, params, 0 );
+ }
+
+ private Basic? search_symbol_in_symbol ( Basic 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 Basic? search_symbol_in_global_namespaces ( Basic? 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 ( File f in this.files ) {
+ Basic element = f.search_element ( global_params, 0 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ private Basic? search_symbol_in_namespaces ( Basic element, string[] params ) {
+ foreach ( File f in this.files ) {
+ Basic element = f.search_element ( params, 0 );
+ if ( element != null )
+ return element;
+ }
+ return null;
+ }
+
+ private Basic? search_element ( Basic? 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;
+
+ if ( element != null ) {
+ var tmp = this.search_symbol_in_namespaces ( element, params );
+ if ( tmp != null )
+ return tmp;
+ }
+ return null;
+ }
+
+ public Basic? search_symbol_str ( Valadoc.Basic? 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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_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;
+ File file = this.get_file ( vfile );
+ Namespace ns = file.get_namespace ( verrdom );
+ ns.add_error_domain ( verrdom );
+ }
+
+/*
+ public override void visit_field ( Vala.Field vf ) {
+ if ( this.level > 0 )
+ return ;
+
+ Vala.SourceReference vsrcref = vf.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+
+ File file = get_file ( vsrc );
+ file.append_global_field ( vf );
+ }
+
+ public override void visit_method ( Vala.Method vm ) {
+ if ( this.level > 0 )
+ return ;
+
+ Vala.SourceReference vsrcref = vm.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+
+ File file = get_file ( vsrc );
+ file.append_global_method ( vm );
+ }
+*
+ public override void visit_struct ( Vala.Struct vstruct ) {
+ this.level++;
+
+ if ( this.level == 1 ) {
+ Vala.SourceReference vsrcref = vstruct.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+
+ File file = get_file ( vsrc );
+ file.append_struct ( vstruct );
+ }
+ else {
+ // is it really a class in our case?
+ Gee.ArrayList<Vala.Struct> vstrulist = this.sub_structs.get ( (Vala.Class)this.current_type );
+ vstrulist.add ( vstruct );
+ }
+
+ this.level--;
+ }
+
+ public override void visit_class ( Vala.Class vcl ) {
+ Vala.TypeSymbol parent_type = this.current_type;
+ this.current_type = vcl;
+ this.level++;
+
+ var vcllist = new Gee.ArrayList<Vala.Class> ();
+ this.sub_classes.set ( vcl, vcllist );
+
+ var vstrulist = new Gee.ArrayList<Vala.Struct> ();
+ this.sub_structs.set ( vcl, vstrulist );
+
+ vcl.accept_children ( this );
+
+ if ( this.level == 1 ) {
+ Vala.SourceReference vsrcref = vcl.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+
+ File file = get_file ( vsrc );
+ file.append_class ( vcl, this.sub_classes, this.sub_structs );
+ this.sub_classes.clear ();
+ this.sub_structs.clear ();
+ }
+ else {
+ // Really a class?
+ Gee.ArrayList<Vala.Class> vcllist = this.sub_classes.get ( (Vala.Class)parent_type );
+ vcllist.add ( vcl );
+ }
+
+ this.current_type = parent_type;
+ this.level--;
+ }
+*/
+/*
+ public override void visit_delegate ( Vala.Delegate vdel ) {
+ Vala.SourceReference vsrcref = vdel.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+
+ File file = get_file ( vsrc );
+ file.append_delegate ( vdel );
+ }
+
+ public override void visit_error_domain ( Vala.ErrorDomain verrdom ) {
+ Vala.SourceReference vsrcref = verrdom.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+ File file = get_file ( vsrc );
+
+ file.append_error_domain ( verrdom );
+ }
+
+ public override void visit_enum ( Vala.Enum ven ) {
+ Vala.SourceReference vsrcref = ven.source_reference;
+ Vala.SourceFile vsrc = vsrcref.file;
+ File file = get_file ( vsrc );
+
+ file.append_enum ( ven );
+ }
+*/
+
+ public void create_tree ( ) {
+ this.context.accept( this );
+ this.set_type_references ( );
+ this.inheritance ( ); // remove
+ }
+
+ // internal
+ public File? find_file ( Vala.SourceFile vfile ) {
+ foreach ( File f in this.files ) {
+ if ( f.is_file( vfile ) )
+ return f;
+ }
+ return null;
+ }
+
+ private void set_type_references ( ) {
+ foreach ( File f in this.files ) {
+ f.set_type_references( );
+ }
+ }
+
+ private void inheritance ( ) {
+ foreach ( File f in this.files ) {
+ f.inheritance( );
+ }
+ }
+
+ public void parse_comments ( Valadoc.Parser docparser ) {
+ foreach ( File f in this.files ) {
+ f.parse_comments( docparser );
+ }
+ }
+
+ // internal
+ public File get_file ( Vala.SourceFile vfile ) {
+ File file = this.find_file( vfile );
+ if ( file != null )
+ return file;
+
+ var tmp = new File ( this.settings,vfile, this );
+ this.files.add ( tmp );
+ return tmp;
+ }
+}
+
+
diff --git a/src/libvaladoc/parser.vala b/src/libvaladoc/parser.vala
new file mode 100644
index 000000000..2fb154170
--- /dev/null
+++ b/src/libvaladoc/parser.vala
@@ -0,0 +1,868 @@
+/*
+ * 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 GLib;
+using Gee;
+
+
+namespace Valadoc {
+
+
+public static delegate GLib.Type TagletRegisterFunction ( Gee.HashMap<string, Type> taglets );
+
+public abstract class Taglet : Object {
+ public abstract bool write ( void* res, int max, int index );
+
+ // => Regexp
+ protected weak string get_next_word ( string str, out string param ) {
+ GLib.StringBuilder buf = new GLib.StringBuilder ();
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ if ( !chr.isspace() )
+ break;
+ }
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ if ( chr.isspace() )
+ break;
+
+ buf.append_unichar ( chr );
+ }
+
+ param = buf.str.strip();
+ return str;
+ }
+
+ // remove
+ protected static string strip_string ( string str, out int start_line, out int start_pos, out int end_line, out int end_pos ) {
+ int lpos = (int)str.length - 1;
+ int pos = 0;
+
+ while ( str[pos] != '\0' && str[pos].isspace () ) {
+ if ( str[pos] == '\n' ) {
+ start_line = start_line+2;
+ start_pos = 0;
+ }
+ else {
+ start_pos++;
+ }
+ pos++;
+ }
+
+ while ( lpos >= 0 && str[lpos].isspace () ) {
+ if ( str[lpos] == '\n' ) {
+ end_line = end_line+2;
+ }
+ lpos--;
+ }
+
+ while ( lpos != 0 && str[lpos] == '\n' ) {
+ end_pos++;
+ lpos--;
+ }
+
+ string striped = str.offset(pos).ndup ( lpos-pos+1 );
+ end_line += start_line;
+
+ for ( int i = 0; striped[i] != '\0'; i++ ) {
+ if ( striped[i] == '\n' ) {
+ end_line = end_line+2;
+ }
+ }
+
+ if ( end_line == 0 ) {
+ end_pos = lpos;
+ }
+
+ return striped;
+ }
+
+ protected static string? extract_lines ( string content, int line1, int line2 ) {
+ if ( line1 > line2 )
+ return null;
+
+ string[] lines = content.split ( "\n" );
+ int lines_len = 0; for ( ; lines[lines_len] != null; lines_len++ );
+
+
+ if ( lines_len <= line2 )
+ return null;
+
+ GLib.StringBuilder str = new GLib.StringBuilder ();
+
+ while ( line1 < line2+1 ) {
+ str.append ( lines[line1] );
+ line1++;
+
+ if ( line1 < line2+1 )
+ str.append_unichar ( '\n' );
+ }
+ return str.str;
+ }
+
+ // remove
+ public void init ( ) {
+ }
+}
+
+public abstract class MainTaglet : Taglet {
+ public virtual int order {
+ get { return 0; }
+ }
+
+ public virtual bool compare_function ( MainTaglet x ) {
+ return false;
+ }
+
+ public abstract bool write_block_start ( void* res );
+ public abstract bool write_block_end ( void* res );
+ public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string linestart, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content );
+}
+
+public abstract class InlineTaglet : Taglet {
+ public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string linestart, int line, int pos, Valadoc.Basic me, string content );
+}
+
+public abstract class StringTaglet : Taglet {
+ public string content {
+ protected set;
+ get;
+ }
+
+ public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content );
+
+ // remove
+ public string extract_first_word ( ) { return ""; }
+
+ // remove
+ // add counter-stuff!
+ public string extract_first_word2 ( out int word_line, out int word_pos, ref int line, ref int pos ) {
+ GLib.StringBuilder buf = new GLib.StringBuilder ( "" );
+ string str = this.content;
+
+ if ( str == null ) {
+ return ""; // FIXME: str should never be null
+ }
+
+ for ( unichar chr = str.get_char(); chr != '\0'; str = str.next_char(), chr = str.get_char() ) {
+ if ( !chr.isspace() )
+ break;
+
+ pos++;
+
+ if ( chr == '\n' ) {
+ line = line+2;
+ pos = 0;
+ }
+ }
+
+ word_line = line;
+ word_pos = pos;
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ if ( chr.isspace() )
+ break;
+
+ pos++;
+
+ buf.append_unichar ( chr );
+ }
+
+ this.content = str;
+ return buf.str;
+ }
+}
+
+
+
+
+
+
+private enum ReporterMessageType {
+ WARNING,
+ ERROR
+}
+
+
+public class Reporter : Object {
+ private int __warnings;
+ private int __errors;
+
+ public int warnings {
+ get {
+ return this.__warnings;
+ }
+ }
+
+ public int errors {
+ get {
+ return this.__errors;
+ }
+ }
+
+ private bool new_message ( ReporterMessageType type, int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
+ string filename = "filename.vala";
+ string typestr = (type == ReporterMessageType.WARNING)?"warning":"error";
+
+ stdout.printf ( "%s:%d.%d-%d.%d: %s: %s", filename, startline, startchr, endline, endchr, typestr, errtxt );
+
+
+ string[] linev = lines.split ( "\n" );
+ if ( linev == null ) {
+ linev = new string[2];
+ linev[0] = lines;
+ linev[1] = null;
+ }
+
+ for ( int i = 0; linev[i] != null ; i++ ) {
+ int rl = i + startline;
+ stdout.printf ( "\t %s\n", linev[i] );
+
+ if ( rl == startline ) {
+ int len = (int)linev[i].len ( );
+ int ulen;
+
+
+ if ( startline == endline )
+ ulen = ( endchr == startchr )? 1 : endchr - startchr;
+ else
+ ulen = len - startchr;
+
+ string ustr = string.nfill ( ulen, '^' );
+ string sstr = string.nfill ( startchr, ' ' );
+ stdout.printf ( "\t%s%s\n", sstr, ustr );
+ }
+/* else if ( rl == endline ) {
+ string ustr = string.nfill ( endchr, '^' );
+ stdout.printf ( "\t%s\n", ustr );
+ }
+ else {
+ long len = linev[i].len ( );
+ string ustr = string.nfill ( len, '^' );
+ stdout.printf ( "\t%s\n", ustr );
+ }
+*/
+ }
+ return true;
+ }
+
+ public bool add_warning (int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
+ this.__warnings++;
+
+ return this.new_message ( ReporterMessageType.WARNING, startline, startchr, endline,
+ endchr, errtxt, lines );
+ }
+
+ public bool add_error (int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
+ this.__errors++;
+
+ return this.new_message ( ReporterMessageType.ERROR, startline, startchr, endline,
+ endchr, errtxt, lines );
+ }
+}
+
+
+
+public class DocumentationTree : Object {
+ private Gee.ArrayList<InlineTaglet> description = new Gee.ArrayList<InlineTaglet> ();
+ private Gee.HashMap<string, Gee.ArrayList<MainTaglet> > taglets
+ = new Gee.HashMap<string, Gee.ArrayList<MainTaglet> > ( GLib.str_hash, GLib.str_equal );
+
+ public bool add_taglet ( string tag, MainTaglet taglet ) {
+ if ( this.taglets.contains ( tag ) ) {
+ Gee.ArrayList<MainTaglet> lst = this.taglets.get ( tag );
+ lst.add ( taglet );
+ return true;
+ }
+ else{
+ Gee.ArrayList<MainTaglet> nlst = new Gee.ArrayList<MainTaglet> ();
+ nlst.add ( taglet );
+ this.taglets.set ( tag, nlst );
+ return true;
+ }
+ }
+
+ public bool add_description ( Gee.ArrayList<Taglet> content ) {
+ this.description = content;
+ return true;
+ }
+
+ private static Gee.ArrayList< Gee.ArrayList<MainTaglet> > sort_tag_collection ( Gee.Collection< Gee.ArrayList<MainTaglet> > lst ) {
+ Gee.ArrayList< Gee.ArrayList<MainTaglet> > slst
+ = new Gee.ArrayList< Gee.ArrayList<MainTaglet> > ();
+
+ foreach ( Gee.ArrayList<MainTaglet> entry in lst ) {
+ slst.add ( entry );
+ }
+
+ //<bublesort>
+ int count = slst.size;
+ if ( count <= 0 )
+ return slst;
+
+ for ( int i = 0; i < count; i++ ) {
+ for ( int j = count-1; j>i; j-- ) {
+ if ( slst.get(j).get(0).order < slst.get(j-1).get(0).order ) {
+ Gee.ArrayList<MainTaglet> tmp1 = slst.get(j-1);
+ Gee.ArrayList<MainTaglet> tmp2 = slst.get(j);
+
+ slst.remove_at ( j );
+ slst.insert (j, tmp1 );
+ slst.remove_at ( j-1 );
+ slst.insert (j-1, tmp2 );
+ }
+ }
+ }
+ //</bublesort>
+ return slst;
+ }
+
+ public bool write ( void* res ) {
+ bool tmp;
+
+ int max = this.description.size;
+ int i;
+
+ foreach ( InlineTaglet tag in this.description ) {
+ tmp = tag.write ( res, max, i );
+ if ( tmp == false )
+ return false;
+
+ i++;
+ }
+
+ Gee.Collection< Gee.ArrayList<MainTaglet> > lst = this.taglets.get_values ( );
+ Gee.ArrayList< Gee.ArrayList<MainTaglet> > alst = sort_tag_collection ( lst );
+
+ foreach ( Gee.ArrayList<MainTaglet> tags in alst ) {
+ MainTaglet ftag = tags.get ( 0 );
+ int max = tags.size;
+ int i = 0;
+
+ tmp = ftag.write_block_start ( res );
+ if ( tmp == false )
+ return false;
+
+ foreach ( MainTaglet tag in tags ) {
+ tmp = tag.write ( res, max, i );
+ if ( tmp == false )
+ return false;
+
+ i++;
+ }
+
+ tmp = ftag.write_block_end ( res );
+ if ( tmp == false )
+ return false;
+ }
+
+ return true;
+ }
+}
+
+
+
+public class Parser : Object {
+ private Gee.HashMap< string, GLib.Type > taglets;
+ private GLib.Type stringtag;
+ private Reporter reporter;
+ private Settings settings;
+
+ public void init ( Settings settings, Reporter reporter, GLib.Type strtag, Gee.HashMap< string, GLib.Type > taglets ) {
+ this.reporter = reporter;
+ this.stringtag = strtag;
+ this.settings = settings;
+ this.taglets = taglets;
+ }
+
+ private static inline string extract_line ( string str ) {
+ str = str.next_char();
+ weak string? pos = str.chr ( -1, '\n' );
+ if ( pos == null )
+ return str;
+
+ string line = str.ndup ( (char*)pos - (char*)str );
+ return line;
+ }
+
+ private inline bool skip_documentation_header ( ref string str, ref int linenr, ref int pos ) {
+ string linestart = str;
+
+ int borderpos = pos;
+
+ if ( str[0] != '*' ) {
+ string line = Parser.extract_line ( str );
+ this.reporter.add_error ( linenr, 0, linenr, (int)line.len(), "Comment is not a documentation string.\n", string.nfill(borderpos, ' ')+"/*"+line );
+ return false;
+ }
+
+ str = str.next_char();
+ pos++;
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ if ( chr == '\n' ) {
+ linenr++;
+ pos = 0;
+ return true;
+ }
+
+ pos++;
+
+ if ( !chr.isspace() ) {
+ string line = Parser.extract_line ( linestart );
+ this.reporter.add_error ( linenr, 0, linenr, (int)line.len() + 3, "Comment is not a documentation string.\n", string.nfill(borderpos, ' ')+"/*"+line );
+ return false;
+ }
+ }
+ string line = Parser.extract_line ( linestart );
+ this.reporter.add_error ( linenr, 0, linenr, (int)line.len() + 3, "Incomplete Documentation header\n", string.nfill(borderpos, ' ')+"/*"+line );
+ return false;
+ }
+
+ // rm linenr
+ private bool skip_deadh_zone ( ref string str, ref unichar chr, int linenr, ref int pos ) {
+ string linestart = str;
+
+ str = str.next_char();
+ pos = 0;
+
+ for ( chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ pos++;
+
+ if ( chr == '*' )
+ return true;
+
+ if ( !chr.isspace() ) {
+ int endpos = 0;
+
+ string line = Parser.extract_line ( linestart );
+ weak string? endposstr = str.chr( line.len(), '*' );
+ if ( endposstr != null ) {
+ endpos = (int)(linestart.len() - endposstr.len());
+ }
+
+ this.reporter.add_error ( linenr, pos, linenr, endpos, "Invalid documentation body.\n", line );
+ return false;
+ }
+ }
+ // end of comment
+ return true;
+ }
+
+ private inline void set_prev_chr ( out unichar prev, out unichar prevprev, unichar push ) {
+ prevprev = prev;
+ prev = push;
+ }
+
+ private string? parse_taglet_name ( ref string str, out unichar prevchr, out unichar prevprevchr, ref string linestart, ref int linenr, ref int pos ) {
+ GLib.StringBuilder buf = new GLib.StringBuilder ();
+
+ str = str.next_char();
+ int startpos = pos;
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ this.set_prev_chr ( out prevchr, out prevprevchr, chr );
+
+ pos++;
+
+ if ( chr == '\n' ) {
+ linestart = str;
+ linenr++;
+ pos = 0;
+
+ this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
+ this.set_prev_chr ( out prevchr, out prevprevchr, 'p' );
+ return buf.str;
+ }
+
+ if ( chr.isspace() ) {
+ return buf.str;
+ }
+
+ if ( !((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z')) ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "invalide taglet name.\n";
+ int endpos = pos;
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ if ( chr.isspace() )
+ break;
+
+ endpos ++;
+ }
+
+ this.reporter.add_error (linenr, startpos, linenr, endpos, reportmsg, line );
+ return null;
+ }
+ buf.append_unichar ( chr );
+ }
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Incomplete Taglet.\n";
+ this.reporter.add_error (linenr, startpos, linenr, (int)line.len(), reportmsg, line );
+ return null;
+ }
+
+ public StringTaglet create_string_tag ( Valadoc.Tree tree, Valadoc.Basic me, string start_line, int linenr, int pos, string str ) {
+ StringTaglet strt = (StringTaglet)GLib.Object.new ( this.stringtag );
+ strt.init ( );
+
+// strt.parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content );
+ strt.parse ( this.settings, tree, str );
+ return strt;
+ }
+
+
+ public bool append_new_tag ( Valadoc.Tree mtree, Valadoc.Basic me, DocumentationTree tree, string? name, Gee.ArrayList<Taglet> content, string linestart, int linenr, int pos ) {
+ if ( name == null ) {
+ tree.add_description ( content );
+ return true;
+ }
+
+ if ( !this.taglets.contains( name ) ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Taglet '%s' is not registered.\n".printf( name );
+ this.reporter.add_error (linenr, pos, linenr, pos+(int)name.len()+1, reportmsg, line );
+ return false;
+ }
+
+ GLib.Type type = this.taglets.get ( name );
+ Taglet taglet = (Taglet)GLib.Object.new ( type );
+ if ( taglet is MainTaglet == false ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "'%s' is an inline taglet.\n".printf( name );
+ this.reporter.add_error (linenr, pos, linenr, pos+(int)name.len()+1, reportmsg, line );
+ return false;
+ }
+
+ taglet.init ();
+ ((MainTaglet)taglet).parse ( this.settings, mtree, this.reporter, linestart.offset(1), linenr, pos, me, content );
+ tree.add_taglet ( name, (MainTaglet)taglet );
+ return true;
+ }
+
+ // add a line counter!!
+ private inline void skip_spaces ( ref string str, ref int pos ) {
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ pos++;
+ if ( !chr.isspace() )
+ return ;
+ }
+ }
+
+
+ // add line counting
+ private InlineTaglet? parse_bracket ( Valadoc.Tree tree, Valadoc.Basic me, ref string str, ref string linestart, ref int linestartnr, ref int linenr, ref int pos ) {
+ int startpos = pos;
+
+ str = str.next_char();
+ pos++;
+
+ string? currtagname = "";
+ unichar prevprevchr = '\0';
+ unichar prevchr = '\0';
+
+ GLib.StringBuilder buf = new GLib.StringBuilder ();
+ this.skip_spaces ( ref str, ref pos );
+
+ int taglinenr = linenr;
+ int tagpos = pos-1;
+
+ if ( str[0] != '@' ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Bracket is not allowed in this context.\n";
+ this.reporter.add_error ( linenr, startpos, linenr, startpos, reportmsg, line );
+ return null;
+ }
+
+ string? tagname = this.parse_taglet_name ( ref str, out prevchr, out prevprevchr, ref linestart, ref linenr, ref pos );
+ if ( tagname == null )
+ return null;
+
+ if ( !this.taglets.contains( tagname ) ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Taglet '%s' is not registered.\n".printf( tagname );
+ this.reporter.add_error (linenr, startpos+1, linenr, startpos+(int)tagname.len()+2, reportmsg, line );
+ return null;
+ }
+
+ GLib.Type tagtype = this.taglets.get ( tagname );
+ GLib.Object tag = GLib.Object.new (tagtype );
+ if ( tag is InlineTaglet == false ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "'%s' is not an inline taglet.\n".printf( tagname );
+ this.reporter.add_error (linenr, tagpos, linenr, tagpos+(int)tagname.len()+1, reportmsg, line );
+ return null;
+ }
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ pos++;
+
+ bool tmp = this.escaped_characters ( ref str, linestart, linenr, ref chr, ref prevchr, ref prevprevchr, ref pos );
+ if ( tmp == true ) {
+ buf.append_unichar ( chr );
+ continue ;
+ }
+
+ tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
+ if ( tmp == true )
+ continue ;
+
+
+ if ( chr == '}' ) {
+ if ( prevchr.isspace() )
+ buf.erase ( buf.len-1, -1);
+
+ InlineTaglet rtag = ((InlineTaglet)tag);
+ rtag.init ( );
+ //rtag.parse ( this.settings, tree, this.reporter, linestart.offset(1), linenr, pos, me, buf.str );
+ rtag.parse ( this.settings, tree, this.reporter, linestart.offset(1), taglinenr, tagpos, me, buf.str );
+ return rtag;
+ }
+
+ if ( chr == '@' || chr == '{' ) {
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Error: Character is not allowed in this context.\n";
+ this.reporter.add_error (linenr, pos-1, linenr, pos-1, reportmsg, line );
+ return null;
+ }
+
+
+ buf.append_unichar ( chr );
+ this.set_prev_chr ( out prevchr, out prevprevchr, chr );
+ }
+
+ string line = this.extract_line ( linestart );
+ string reportmsg = "Warning: Bracket is not closed.\n";
+ this.reporter.add_error (linenr, startpos, linenr, (int)linestart.len(), reportmsg, line );
+ return null;
+ }
+
+ private inline bool skip_double_spaces ( ref string str, GLib.StringBuilder buf,unichar chr, ref unichar prevchr, ref unichar prevprevchr ) {
+ if ( chr.isspace() ) {
+ buf.append_unichar ( ' ' );
+
+ if ( prevchr.isspace() )
+ return true;
+
+ string tmpstr = str.next_char();
+ unichar nextchr = tmpstr.get_char();
+
+ if ( nextchr.isspace() )
+ return true;
+
+ this.set_prev_chr ( out prevchr, out prevprevchr, ' ' );
+ return true;
+ }
+ return false;
+ }
+
+ private inline bool escaped_characters ( ref string str, string linestart, int linenr, ref unichar curchr, ref unichar prevchr, ref unichar prevprevchr, ref int pos ) {
+ if ( curchr == '\\' ) {
+ str = str.next_char();
+ curchr = str.get_char();
+
+ prevprevchr = prevchr;
+ prevchr = '\\';
+
+ if (!( curchr == '@' || curchr == '{' || curchr == '}' || curchr == '\\' )) {
+ GLib.StringBuilder unichrstr = new GLib.StringBuilder ( "" );
+ unichrstr.append_unichar( curchr );
+
+ string line = this.extract_line ( linestart );
+ string reportmsg = "'\\%s' is not a valid character.\n".printf ( unichrstr.str );
+ this.reporter.add_error (linenr, pos, linenr, pos+2, reportmsg, line );
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public DocumentationTree? parse ( Valadoc.Tree tree, Valadoc.Basic me, string str2 ) {
+ string str = str2;
+
+ GLib.StringBuilder buf = new GLib.StringBuilder ();
+ DocumentationTree doctree = new DocumentationTree ();
+
+ int linenr = 0;
+ int pos = 0;
+
+
+ bool tmp = this.skip_documentation_header ( ref str, ref linenr, ref pos );
+ if ( tmp == false )
+ return null;
+
+
+ Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
+ string? currtagname = null;
+ string currtagline = str;
+ int currtagstartpos = 0;
+ int currtagstartlinenr = 0;
+
+
+ unichar prevprevchr = '\0';
+ unichar prevchr = '\0';
+
+ // weak
+ string? linestart = str;
+ int linestartnr = 0;
+
+ for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
+ pos++;
+
+ bool tmp = this.escaped_characters ( ref str, linestart, linenr, ref chr, ref prevchr, ref prevprevchr, ref pos );
+ if ( tmp == true ) {
+ buf.append_unichar ( chr );
+ continue ;
+ }
+
+ if ( chr == '\n' ) {
+ linestartnr = linenr;
+ linestart = str;
+ linenr++;
+ pos = 0;
+
+ this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
+ if ( chr == '\0' )
+ break;
+
+ if ( prevchr == '\n' ) {
+ buf.append_unichar ( '\n' );
+ }
+
+ this.set_prev_chr ( out prevchr, out prevprevchr, '\n' );
+ continue ;
+ }
+/*
+ if ( prevchr == '\n' && prevprevchr == '\n' ) {
+ buf.append_unichar ( '\n' );
+ }
+*/
+ tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
+ if ( tmp == true )
+ continue ;
+
+
+ if ( chr == '{' ) {
+ // <
+ if ( buf.len > 0 ) {
+ StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
+ content.add ( strtag );
+ prevchr = '}';
+ buf.erase ( 0, -1 );
+ }
+ // >
+
+ InlineTaglet itag = this.parse_bracket ( tree, me, ref str, ref linestart, ref linestartnr, ref linenr, ref pos );
+ if ( itag == null ) {
+ return null;
+ }
+ content.add ( itag );
+ continue ;
+ }
+ else if ( chr == '}' ) {
+ string line = this.extract_line ( linestart );
+ this.reporter.add_error (linenr, pos, linenr, pos, "syntax error.\n", line );
+ return null;
+ }
+ else if ( chr == '@' && prevchr.isspace() ) {
+ // <
+ if ( buf.len > 0 ) {
+ StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
+ content.add ( strtag );
+ buf.erase ( 0, -1 );
+ }
+ this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
+ // >
+ content = new Gee.ArrayList<InlineTaglet> ();
+
+ currtagstartlinenr = linenr;
+ currtagstartpos = pos;
+ currtagline = linestart;
+
+ currtagname = this.parse_taglet_name ( ref str, out prevchr, out prevprevchr, ref linestart, ref linenr, ref pos );
+ continue ;
+ }
+
+ buf.append_unichar ( chr );
+ this.set_prev_chr ( out prevchr, out prevprevchr, chr );
+ }
+
+ if ( buf.len > 0 ) {
+ StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
+ content.add ( strtag );
+ }
+
+ this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
+ tmp = this.check_foother ( ref linestart, linenr );
+ if ( tmp == false )
+ return null;
+
+ return doctree;
+ }
+
+ private inline bool check_foother ( ref string lastline, int linenr ) {
+ for ( unichar chr = lastline.get_char(); chr != '\0' ;
+ lastline = lastline.next_char(), chr = lastline.get_char() )
+ {
+ if ( chr.isspace() )
+ continue ;
+
+ string line = this.extract_line ( lastline );
+ string reportmsg = "syntax error - invalid body.\n";
+ this.reporter.add_error (linenr, 0, linenr, (int)line.len()+1, reportmsg, line+"*/" );
+ return false;
+ }
+ return true;
+ }
+
+ protected static bool is_documentation ( string cmnt ) {
+ if ( cmnt[0] != '*' )
+ return false;
+
+ for ( int i = 1; !(cmnt[i] == '\n' || cmnt[i] == '\0') ; i++ ) {
+ if ( cmnt[i].isspace() )
+ continue;
+
+ return false;
+ }
+
+ return true;
+ }
+
+ protected static bool is_inherit_doc ( string? cmnt ) {
+ if ( cmnt == null )
+ return false;
+
+ try {
+ var regexp = new Regex ( "^[\\s\\*\n]*{[\\s\n]*@inheritDoc[\\s\n]*}[\\s\n\\*]*$" );
+ return regexp.match ( cmnt );
+ }
+ catch ( RegexError err ) {
+ return false;
+ }
+ }
+}
+
+
+
+}
diff --git a/src/libvaladoc/settings.vala b/src/libvaladoc/settings.vala
new file mode 100755
index 000000000..dfdfe64a9
--- /dev/null
+++ b/src/libvaladoc/settings.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 GLib;
+
+
+public class Valadoc.Settings : Object {
+ public Gee.ArrayList<string> files;
+ public string path = "documentation/";
+ public string package_name = null;
+ public bool _private = false;
+ public bool _protected = false;
+ public bool with_deps = false;
+ public bool add_inherited = false;
+
+ public bool application {
+ get {
+ foreach ( string path in this.files ) {
+ if ( path.has_prefix ( ".vapi" ) )
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public bool to_doc ( string name ) {
+ if ( with_deps == true )
+ return true;
+
+ // FIXME: Compare with full path
+ string nstr = Path.get_basename ( name ) ;
+
+ foreach ( string str in this.files ) {
+ if ( Path.get_basename ( str ) == nstr )
+ return true;
+ }
+ return false;
+ }
+}
+
+
+
diff --git a/src/libvaladoc/valadoc-1.0.pc.in b/src/libvaladoc/valadoc-1.0.pc.in
new file mode 100644
index 000000000..9a5af5682
--- /dev/null
+++ b/src/libvaladoc/valadoc-1.0.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@/valadoc/
+includedir=@includedir@
+datarootdir=@datarootdir@
+datadir=@datadir@
+vapidir=@datadir@/vala/vapi
+
+Name: Valadoc
+Description: The Vala documentation compiler library
+Version: @VERSION@
+Requires: vala-1.0 libgvc
+Libs: -L${libdir} -lvaladoc
+Cflags: -I${includedir}/valadoc-1.0
diff --git a/src/libvaladoc/xmlimporter.vala b/src/libvaladoc/xmlimporter.vala
new file mode 100644
index 000000000..3cb05a799
--- /dev/null
+++ b/src/libvaladoc/xmlimporter.vala
@@ -0,0 +1,187 @@
+
+
+using GLib;
+using Xml;
+
+
+public class Valadoc.MergeExternalDocumentation : ExternalDocumentation {
+ private GLib.Queue<string> stack = new GLib.Queue<string> ();
+
+ public Valadoc.Tree tree {
+ construct set;
+ private get;
+ }
+
+ public MergeExternalDocumentation ( Valadoc.Tree tree ) {
+ this.tree = tree;
+ }
+
+ private string? type_path () {
+ GLib.StringBuilder str = new GLib.StringBuilder ();
+
+ for ( weak GLib.List<string> pos = this.stack.head; pos != null ; pos = pos.next ) {
+ str.prepend ( pos.data );
+ if ( pos.next != null )
+ str.prepend_unichar ( '.' );
+ }
+ return str.str;
+ }
+
+
+ public override bool visit_enumvalue_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_enumvalue_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+
+ public override bool visit_errorcode_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_errorcode_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_field_start ( string name ) {
+ this.stack.push_head ( name );
+
+ Valadoc.Basic? element = this.tree.search_symbol_str ( null, this.type_path() );
+ if ( element == null )
+ return false;
+
+
+ element.comment_string = "*\n * HOHOHOHOHOHOHOHO\n ";
+
+
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_field_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_signal_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_signal_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_method_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_method_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_constant_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_constant_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_property_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_property_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_delegate_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_delegate_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_errordomain_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_errordomain_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_class_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_class_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_struct_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_struct_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_interface_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_interface_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+
+ public override bool visit_namespace_start ( string name ) {
+ if ( name != "" )
+ this.stack.push_head ( name );
+
+ stdout.printf ( "Namespace: %s\n", name );
+ return true;
+ }
+
+ public override bool visit_namespace_end ( string name ) {
+ if ( name != "" )
+ this.stack.pop_head ( );
+
+ return true;
+ }
+
+ public override bool visit_enum_start ( string name ) {
+ this.stack.push_head ( name );
+ return true;
+ }
+
+ public override bool visit_enum_end ( string name ) {
+ this.stack.pop_head ( );
+ return true;
+ }
+}
+
diff --git a/src/libvaladoc/xmlparser.vala b/src/libvaladoc/xmlparser.vala
new file mode 100644
index 000000000..8395ff459
--- /dev/null
+++ b/src/libvaladoc/xmlparser.vala
@@ -0,0 +1,718 @@
+
+
+using GLib;
+using Xml;
+
+
+
+public class Valadoc.ExternalDocumentation : GLib.Object {
+ public virtual bool visit_namespace_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_namespace_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_enum_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_enum_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_enumvalue_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_enumvalue_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_errordomain_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_errordomain_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_errorcode_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_errorcode_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_field_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_field_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_signal_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_signal_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_method_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_method_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_class_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_class_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_constant_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_constant_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_property_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_property_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_delegate_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_delegate_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_struct_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_struct_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_interface_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_interface_end ( string name ) {
+ return true;
+ }
+
+
+
+ // Comments:
+ public virtual bool visit_comment_start () {
+ stdout.printf ( "\n---------------\n" );
+ return true;
+ }
+
+ public virtual bool visit_comment_tag_start ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_comment_tag_end ( string name ) {
+ return true;
+ }
+
+ public virtual bool visit_comment_inline_tag ( string name, string content ) {
+ stdout.printf ( ">{ @%s, %s }", name, content );
+ return true;
+ }
+
+ public virtual bool visit_comment_string ( string str ) {
+ stdout.printf ( "%s", str );
+ return true;
+ }
+
+ public virtual bool visit_comment_end () {
+ stdout.printf ( "\n---------------\n" );
+ return true;
+ }
+
+ private bool parse_description ( Xml.Node* desc ) {
+ bool tmp = this.visit_comment_start ();
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = desc->children; iter != null; iter = iter->next) {
+ if (iter->type == ElementType.ELEMENT_NODE) {
+ if ( iter->name != "inline-taglet" )
+ return false;
+
+ string? tagname = iter->get_prop ( "name" );
+ if ( tagname == null )
+ return false;
+
+ string content = iter->get_content ();
+
+ this.visit_comment_inline_tag ( tagname, content );
+ }
+ else if ( iter->type == ElementType.TEXT_NODE ) {
+ string content = iter->get_content ();
+ tmp = this.visit_comment_string ( content );
+ if ( tmp == false )
+ return false;
+ }
+ }
+
+ return this.visit_comment_end ();
+ }
+
+
+ private bool check_name ( string str ) {
+ return true;
+ }
+
+
+ private bool parse_field ( Xml.Node* field ) {
+ string fname = field->get_prop ( "name" );
+ if ( !this.check_name ( fname ) )
+ return false;
+
+ bool tmp = this.visit_field_start ( fname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = field->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = true;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_field_end ( fname );
+ }
+
+ private bool parse_delegate ( Xml.Node* _delegate ) {
+ string dname = _delegate->get_prop ( "name" );
+ if ( !this.check_name ( dname ) )
+ return false;
+
+ bool tmp = this.visit_delegate_start ( dname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = _delegate->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_delegate_end ( dname );
+ }
+
+ private bool parse_constant ( Xml.Node* constant ) {
+ string cname = constant->get_prop ( "name" );
+ if ( !this.check_name ( cname ) )
+ return false;
+
+ bool tmp = this.visit_constant_start ( cname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = constant->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_constant_end ( cname );
+ }
+
+ private bool parse_method ( Xml.Node* method ) {
+ string mname = method->get_prop ( "name" );
+ if ( !this.check_name ( mname ) )
+ return false;
+
+ bool tmp = this.visit_method_start ( mname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = method->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_method_end ( mname );
+ }
+
+ private bool parse_property ( Xml.Node* property ) {
+ string pname = property->get_prop ( "name" );
+ if ( !this.check_name ( pname ) )
+ return false;
+
+ bool tmp = this.visit_property_start ( pname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = property->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_property_end ( pname );
+ }
+
+ private bool parse_signal ( Xml.Node* _signal ) {
+ string sname = _signal->get_prop ( "name" );
+ if ( !this.check_name ( sname ) )
+ return false;
+
+ bool tmp = this.visit_signal_start ( sname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = _signal->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_signal_end ( sname );
+ }
+
+ private bool parse_errorcode ( Xml.Node* errorcode ) {
+ string ename = errorcode->get_prop ( "name" );
+ if ( !this.check_name ( ename ) )
+ return false;
+
+ bool tmp = this.visit_errorcode_start ( ename );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = errorcode->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_errorcode_end ( ename );
+ }
+
+ private bool parse_enumvalue ( Xml.Node* enumvalue ) {
+ string ename = enumvalue->get_prop ( "name" );
+ if ( !this.check_name ( ename ) )
+ return false;
+
+ for (Xml.Node* iter = enumvalue->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ bool tmp = this.visit_enumvalue_start ( ename );
+ if ( tmp == false )
+ return false;
+
+
+ return this.visit_enumvalue_end ( ename );
+ }
+
+ private bool parse_class ( Xml.Node* _class ) {
+ string cname = _class->get_prop ( "name" );
+ if ( !this.check_name ( cname ) )
+ return false;
+
+ bool tmp = this.visit_class_start ( cname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = _class->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "class":
+ tmp = this.parse_class ( iter );
+ break;
+ case "struct":
+ tmp = this.parse_struct ( iter );
+ break;
+ case "constant":
+ tmp = this.parse_constant ( iter );
+ break;
+ case "field":
+ tmp = this.parse_field ( iter );
+ break;
+ case "enum":
+ tmp = this.parse_enum ( iter );
+ break;
+ case "delegate":
+ tmp = this.parse_delegate ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "signal":
+ tmp = this.parse_signal ( iter );
+ break;
+ case "property":
+ tmp = this.parse_property ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_class_end ( cname );
+ }
+
+ private bool parse_struct ( Xml.Node* _struct ) {
+ string sname = _struct->get_prop ( "name" );
+ if ( !this.check_name ( sname ) )
+ return false;
+
+ bool tmp = this.visit_struct_start ( sname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = _struct->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ bool tmp = false;
+
+ switch ( iter->name ) {
+ case "constant":
+ tmp = this.parse_constant ( iter );
+ break;
+ case "field":
+ tmp = this.parse_field ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_struct_end ( sname );
+ }
+
+ private bool parse_interface ( Xml.Node* _interface ) {
+ string iname = _interface->get_prop ( "name" );
+ if ( !this.check_name ( iname ) )
+ return false;
+
+ bool tmp = this.visit_interface_start ( iname );
+ if ( tmp == false )
+ return false;
+
+
+ for (Xml.Node* iter = _interface->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ tmp = false;
+
+ switch ( iter->name ) {
+ case "class":
+ tmp = this.parse_class ( iter );
+ break;
+ case "struct":
+ tmp = this.parse_struct ( iter );
+ break;
+ case "field":
+ tmp = this.parse_field ( iter );
+ break;
+ case "enum":
+ tmp = this.parse_enum ( iter );
+ break;
+ case "delegate":
+ tmp = this.parse_delegate ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "signal":
+ tmp = this.parse_signal ( iter );
+ break;
+ case "property":
+ tmp = this.parse_property ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_interface_end ( iname );
+ }
+
+ private bool parse_enum ( Xml.Node* _enum ) {
+ string ename = _enum->get_prop ( "name" );
+ if ( !this.check_name ( ename ) )
+ return false;
+
+ bool tmp = this.visit_enum_start ( ename );
+ if ( tmp == false )
+ return false;
+
+
+ for (Xml.Node* iter = _enum->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ tmp = false;
+
+ switch ( iter->name ) {
+ case "enumvalue":
+ tmp = this.parse_enumvalue ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_enum_end ( ename );
+ }
+
+ private bool parse_errordomain ( Xml.Node* _errordomain ) {
+ string ename = _errordomain->get_prop ( "name" );
+ if ( !this.check_name ( ename ) )
+ return false;
+
+ bool tmp = this.visit_errordomain_start ( ename );
+ if ( tmp == false )
+ return false;
+
+
+ for (Xml.Node* iter = _errordomain->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ tmp = false;
+
+ switch ( iter->name ) {
+ case "errorcode":
+ tmp = this.parse_errorcode ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_errordomain_end ( ename );
+ }
+
+ private bool parse_namespace ( Xml.Node* ns ) {
+ string nsname = ns->get_prop ( "name" );
+ if ( nsname == null ) {
+ stdout.printf ( "Namespace-name is not set.\n" );
+ return false;
+ }
+
+ bool tmp = this.visit_namespace_start ( nsname );
+ if ( tmp == false )
+ return false;
+
+ for (Xml.Node* iter = ns->children; iter != null; iter = iter->next) {
+ if (iter->type != ElementType.ELEMENT_NODE)
+ continue;
+
+ tmp = false;
+
+ switch ( iter->name ) {
+ case "namespace":
+ tmp = this.parse_namespace ( iter );
+ break;
+ case "delegate":
+ tmp = this.parse_delegate ( iter );
+ break;
+ case "field":
+ tmp = this.parse_field ( iter );
+ break;
+ case "constant":
+ tmp = this.parse_constant ( iter );
+ break;
+ case "method":
+ tmp = this.parse_method ( iter );
+ break;
+ case "class":
+ tmp = this.parse_class ( iter );
+ break;
+ case "struct":
+ tmp = this.parse_struct ( iter );
+ break;
+ case "interface":
+ tmp = this.parse_interface ( iter );
+ break;
+ case "enum":
+ tmp = this.parse_enum ( iter );
+ break;
+ case "errordomain":
+ tmp = this.parse_errordomain ( iter );
+ break;
+ case "description":
+ tmp = this.parse_description ( iter );
+ break;
+ }
+
+ if ( tmp == false )
+ return false;
+ }
+
+ return this.visit_namespace_end ( nsname );
+ }
+
+ public bool parse ( string path ) {
+ Xml.Doc* xml_doc = Xml.Parser.parse_file ( path );
+ if ( xml_doc == null ) {
+ stderr.printf ( "Can't open file.\n" );
+ delete xml_doc;
+ return false;
+ }
+
+ Xml.Node* root_node = xml_doc->get_root_element ();
+ if ( root_node == null ) {
+ stderr.printf ( "Missing root-element.\n" );
+ delete xml_doc;
+ return false;
+ }
+
+ if ( root_node->name != "namespace" ) {
+ stderr.printf ( "Wrong root-element.\n" );
+ delete xml_doc;
+ return false;
+ }
+
+ bool tmp = this.parse_namespace ( root_node );
+ if ( tmp == false ) {
+ stdout.printf ( "Error.\n" );
+ }
+
+ delete xml_doc;
+ return true;
+ }
+}
+
+
diff --git a/src/valadoc/Makefile.am b/src/valadoc/Makefile.am
new file mode 100644
index 000000000..b04feb249
--- /dev/null
+++ b/src/valadoc/Makefile.am
@@ -0,0 +1,48 @@
+# src/Makefile.am
+
+NULL =
+
+
+AM_CFLAGS = \
+ -DPACKAGE_DATADIR=\"$(libdir)/valadoc/plugins/\" \
+ -DPACKAGE_VERSION=\"$(VERSION)\" \
+ -I ../libvaladoc/ \
+ $(GLIB_CFLAGS) \
+ $(LIBVALA_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ $(LIBGVC_CFLAGS) \
+ $(NULL)
+
+
+
+
+bin_PROGRAMS = valadoc
+
+BUILT_SOURCES = valadoc.vala.stamp
+
+valadoc_VALASOURCES = \
+ valadoc.vala \
+ $(NULL)
+
+
+valadoc_SOURCES = \
+ $(valadoc_VALASOURCES:.vala=.c) \
+ $(valadoc_VALASOURCES:.vala=.h) \
+ $(NULL)
+
+
+valadoc_LDADD = \
+ ../libvaladoc/libvaladoc.la \
+ $(GLIB_LIBS) \
+ $(LIBVALA_LIBS) \
+ $(GMODULE_LIBS) \
+ $(LIBGVC_LIBS) \
+ $(NULL)
+
+
+valadoc.vala.stamp: $(libvaladoc_VALASOURCES)
+ $(VALAC) -C --pkg gmodule-2.0 --pkg config --vapidir ../vapi --pkg valadoc-1.0 --basedir $(top_srcdir)/src/valadoc/ valadoc.vala --disable-non-null --save-temps $^
+ touch $@
+
+EXTRA_DIST = $(valadoc_VALASOURCES) valadoc.vala.stamp
+
diff --git a/src/valadoc/valadoc.vala b/src/valadoc/valadoc.vala
new file mode 100755
index 000000000..dd50e1368
--- /dev/null
+++ b/src/valadoc/valadoc.vala
@@ -0,0 +1,674 @@
+/*
+ * 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 Valadoc;
+using Config;
+using GLib;
+using Vala;
+using Gee;
+
+
+
+
+
+public class ValaDoc : Object {
+ private static string basedir;
+ private static string directory;
+ private static string xmlsource;
+ private static string package_name;
+
+ private static bool add_documentation = false;
+ private static bool add_inherited = false;
+ private static bool _protected = false;
+ private static bool with_deps = false;
+ private static bool _private = false;
+ private static bool version;
+
+ private static string pluginpath;
+
+ private static bool non_null_experimental = false;
+ private static bool disable_non_null = false;
+ private static bool disable_checking;
+
+ [NoArrayLength ()]
+ private static string[] vapi_directories;
+ [NoArrayLength ()]
+ private static weak string[] tsources;
+ [NoArrayLength ()]
+ private static string library;
+ [NoArrayLength ()]
+ private static weak string[] tpackages;
+
+
+ private Module docletmodule;
+ private Type doclettype;
+
+
+ private Gee.ArrayList<string> packages = new Gee.ArrayList<string>();
+ private Gee.ArrayList<string> sources = new Gee.ArrayList<string>();
+
+
+ private const GLib.OptionEntry[] options = {
+ { "vapidir", 0, 0, OptionArg.FILENAME_ARRAY, out vapi_directories,
+ "Look for package bindings in DIRECTORY", "DIRECTORY..." },
+ { "pkg", 0, 0, OptionArg.STRING_ARRAY, out tpackages, "Include binding for PACKAGE", "PACKAGE..." },
+ //{ "library", 0, 0, OptionArg.STRING, out library, "Library name", "NAME" },
+ //{ "basedir", 'b', 0, OptionArg.FILENAME, out basedir, "Base source directory", "DIRECTORY" },
+ { "directory", 'o', 0, OptionArg.FILENAME, out directory, "Output directory", "DIRECTORY" },
+ { "package-name", 0, 0, OptionArg.FILENAME, out package_name, "Package name", "DIRECTORY" },
+ { "protected", 0, 0, OptionArg.NONE, ref _protected, "Adds protected elements to documentation", null },
+ { "private", 0, 0, OptionArg.NONE, ref _private, "Adds private elements to documentation", null },
+ { "inherit", 0, 0, OptionArg.NONE, ref add_inherited, "Adds inherited elements to a class", null },
+// { "extend", 0, 0, OptionArg.NONE, ref add_documentation, "Adds documentation to a given directory", null },
+ { "deps", 0, 0, OptionArg.NONE, ref with_deps, "Adds packages to the documentation", null },
+ { "disable-non-null", 0, 0, OptionArg.NONE, ref disable_non_null, "Disable non-null types", null },
+ { "enable-non-null-experimental", 0, 0, OptionArg.NONE, ref non_null_experimental,
+ "Enable experimentalenhancements for non-null types", null },
+ { "", 0, 0, OptionArg.FILENAME_ARRAY, out tsources, null, "FILE..." },
+ { "doclet", 0, 0, OptionArg.FILENAME, ref pluginpath, "plugin", "DIRECTORY" },
+ { "xml", 0, 0, OptionArg.FILENAME, ref xmlsource, "xml", "DIRECTORY" },
+ { null }
+ };
+
+ private int quit () {
+ if (Report.get_errors () == 0) {
+ stdout.printf ("Succeeded - %d warning(s)\n", Report.get_warnings ());
+ return 0;
+ }
+ else {
+ stdout.printf ("Failed: %d error(s), %d warning(s)\n", Report.get_errors (), Report.get_warnings ());
+ return 1;
+ }
+ }
+
+ private bool add_package (CodeContext context, string pkg) {
+ if (context.has_package (pkg)) {
+ // ignore multiple occurences of the same package
+ return true;
+ }
+
+ var package_path = context.get_package_path (pkg, vapi_directories);
+
+ if (package_path == null) {
+ return false;
+ }
+
+ context.add_package (pkg);
+
+ context.add_source_file (new SourceFile (context, package_path, true));
+
+ 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")) {
+ if (dep != "") {
+ if (!add_package (context, 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;
+ }
+
+/*
+ private string? get_package_path (string pkg) {
+ if (FileUtils.test ( pkg, FileTest.EXISTS))
+ return pkg;
+
+ string basename = "%s.vapi".printf (pkg);
+
+ if ( this.vapi_directories != null ) {
+ foreach (string vapidir in this.vapi_directories ) {
+ var filename = Path.build_filename (vapidir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+ }
+
+ string filename = Path.build_filename ("/usr/local/share/vala/vapi", basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+
+ filename = Path.build_filename ("/usr/share/vala/vapi", basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ return null;
+ }
+*/
+ private void add_files ( Vala.CodeContext context ) {
+ foreach ( string source in this.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, false);
+ source_file.add_using_directive (new UsingDirective (new UnresolvedSymbol (null, "GLib", null)));
+ context.add_source_file ( source_file );
+ }
+ else if (source.has_suffix (".vapi")) {
+ context.add_source_file (new SourceFile (context, rpath, true));
+ }
+ else if (source.has_suffix (".c")) {
+ context.add_c_source_file (rpath);
+ }
+ else {
+ Report.error (null, "%s is not a supported source file type.".printf (source));
+ }
+ }
+ else {
+ Report.error (null, "%s not found".printf (source));
+ }
+ }
+ }
+
+
+ //ported from glibc
+ private static string realpath (string name) {
+ string rpath;
+
+ if (name.get_char () != '/') {
+ // relative path
+ rpath = Environment.get_current_dir ();
+ }
+ else {
+ rpath = "/";
+ }
+
+ weak string start;
+ weak string end;
+
+ for (start = end = name; start.get_char () != 0; start = end) {
+ // skip sequence of multiple path-separators
+ while (start.get_char () == '/') {
+ start = start.next_char ();
+ }
+
+ // find end of path component
+ long len = 0;
+ for (end = start; end.get_char () != 0 && end.get_char () != '/'; end = end.next_char ()) {
+ len++;
+ }
+
+ if (len == 0) {
+ break;
+ }
+ else if (len == 1 && start.get_char () == '.') {
+ // do nothing
+ }
+ else if (len == 2 && start.has_prefix ("..")) {
+ // back up to previous component, ignore if at root already
+ if (rpath.len () > 1) {
+ do {
+ rpath = rpath.substring (0, rpath.len () - 1);
+ }
+ while (!rpath.has_suffix ("/"));
+ }
+ }
+ else {
+ if (!rpath.has_suffix ("/")) {
+ rpath += "/";
+ }
+
+ rpath += start.substring (0, len);
+ }
+ }
+
+ if (rpath.len () > 1 && rpath.has_suffix ("/")) {
+ rpath = rpath.substring (0, rpath.len () - 1);
+ }
+
+ return rpath;
+ }
+
+
+ private Gee.ArrayList<string> sort_sources ( ) {
+ var to_doc = new Gee.ArrayList<string>();
+
+ if ( tsources != null ) {
+ foreach ( string str in this.tsources ) {
+ string rpath = this.realpath ( str );
+ if ( str.has_suffix ( ".vala" ) )
+ this.sources.add ( str );
+ else
+ this.packages.add ( str );
+
+ to_doc.add ( rpath );
+ }
+ }
+
+ if ( tpackages != null ) {
+ foreach ( string str in this.tpackages ) {
+ this.packages.add ( str );
+ }
+ }
+
+ this.tpackages = null;
+ this.tsources = null;
+ return to_doc;
+ }
+
+
+/*
+ private static Gee.HashMap<string, Valadoc.TagletCreator> get_taglets ( ) {
+ Gee.HashMap<string, Valadoc.TagletCreator> taglets
+ = new Gee.HashMap<string, Valadoc.TagletCreator>(GLib.str_hash, GLib.str_equal);
+ /*+
+ void* function;
+ Module module;
+ GLib.Dir dir;
+
+ string docletpath = realpath ( "plugins/html/taglets" );
+
+
+ try {
+ dir = GLib.Dir.open ( docletpath ); // throws FileError;
+ }
+ finally {
+ stdout.printf ( "Can't load plugin.\n" );
+ }
+
+ for ( weak string entry = dir.read_name(); entry != null ; entry = dir.read_name() ) {
+ if ( !( entry.has_suffix(".so") || entry.has_suffix(".dll") ) )
+ continue ;
+
+ string tagletpath = docletpath + "/" + entry;
+
+ module = Module.open ( tagletpath, ModuleFlags.BIND_LAZY);
+ if (module == null) {
+ stdout.printf ( "Can't load plugin.\n" );
+ return taglets;
+ }
+
+ module.symbol( "register_plugin", out function );
+ Valadoc.TagletRegisterFunction tagletregisterfkt = (Valadoc.TagletRegisterFunction) function;
+
+
+ //Valadoc.TagletCreator creator;
+ //string name;
+
+ //Type type = tagletregisterfkt ( out name, out creator );
+
+
+ Type type = tagletregisterfkt ( taglets );
+ }
+
+ +/
+
+ /+
+ entries.set ( "", (Valadoc.TagletCreator)Valadoc.GlobalTaglet.create );
+ entries.set ( "see", (Valadoc.TagletCreator)Valadoc.SeeTaglet.create );
+ entries.set ( "link", (Valadoc.TagletCreator)Valadoc.LinkTaglet.create );
+ entries.set ( "param", (Valadoc.TagletCreator)Valadoc.ParameterTaglet.create );
+ entries.set ( "return", (Valadoc.TagletCreator)Valadoc.ReturnTaglet.create );
+ entries.set ( "throws", (Valadoc.TagletCreator)Valadoc.ExceptionTaglet.create );
+ +/
+ return taglets;
+ }
+*/
+ private inline bool check_doclet_structure ( string realpath ) {
+ bool tmp = FileUtils.test ( realpath, FileTest.IS_DIR );
+ if ( tmp == false ) {
+ stdout.printf ( "realpath %s is not a directory.\n", realpath );
+ return false;
+ }
+
+ tmp = FileUtils.test ( realpath + "/libdoclet.so", FileTest.IS_EXECUTABLE );
+ if ( tmp == false ) {
+ stdout.printf ( "%s is not executable.\n", realpath + "libdoclet.so" );
+ return false;
+ }
+
+
+ tmp = FileUtils.test ( realpath + "/taglets/", FileTest.IS_DIR );
+ if ( tmp == false ) {
+ stdout.printf ( "Error: %s is not a directory.\n", realpath + "/taglets/" );
+ return false;
+ }
+
+ return true;
+ }
+
+ private Gee.HashMap<string, Type>? load_taglets ( out Type strtag ) {
+ void* function;
+ GLib.Dir dir;
+
+ string fulldirpath = (pluginpath == null)? Config.plugin_dir : pluginpath;
+ string pluginpath = fulldirpath + "taglets/";
+
+ Gee.ArrayList<Module*> modules = new Gee.ArrayList<weak Module*> ( );
+ Gee.HashMap<string, Type> taglets =
+ new Gee.HashMap<string, Type> ( GLib.str_hash, GLib.str_equal );
+
+ try {
+ dir = GLib.Dir.open ( pluginpath );
+ }
+ catch ( FileError err ) {
+ stdout.printf ( "Can't load plugin. %s\n", pluginpath );
+ return null;
+ }
+
+ for ( weak string entry = dir.read_name(); entry != null ; entry = dir.read_name() ) {
+ if ( !( entry.has_suffix(".so") || entry.has_suffix(".dll") ) )
+ continue ;
+
+ string tagletpath = pluginpath + "/" + entry;
+
+ Module* module = Module.open ( tagletpath, ModuleFlags.BIND_LAZY);
+ if (module == null) {
+ stdout.printf ( "Can't load plugin.\n" );
+ return taglets;
+ }
+
+ module->symbol( "register_plugin", out function );
+ Valadoc.TagletRegisterFunction tagletregisterfkt = (Valadoc.TagletRegisterFunction) function;
+
+ string? name;
+
+ GLib.Type type = tagletregisterfkt ( taglets );
+
+ if ( entry == "libtagletstring.so" || entry == "libtagletstring.dll" )
+ strtag = type;
+ //else
+ // taglets.set ( name, type );
+
+ modules.add ( module );
+ }
+
+ return taglets;
+ }
+
+ private Doclet? load_doclet ( ) {
+ void* function;
+
+/*
+ string ppath = (pluginpath == null)? Config.plugin_dir : pluginpath;
+ string pluginpath = realpath ( ppath ) + "/template";
+
+ string pluginpath;
+ string ppath;
+*/
+
+
+ docletmodule = Module.open ( pluginpath + "/libdoclet.so", ModuleFlags.BIND_LAZY);
+ if (docletmodule == null) {
+ stdout.printf ( "Can't load doclet %s.\n", pluginpath + "/libdoclet.so" );
+ return null;
+ }
+
+ docletmodule.symbol( "register_plugin", out function );
+ if ( function == null ) {
+ stdout.printf ( "Can't register the doclet.\n" );
+ return null;
+ }
+
+ Valadoc.DocletRegisterFunction doclet_register_function = (Valadoc.DocletRegisterFunction) function;
+ doclettype = doclet_register_function ( );
+ return (Doclet)GLib.Object.new (doclettype);
+ }
+
+ private bool check_package_name () {
+ if ( package_name == null )
+ return true;
+
+ if ( package_name == "glib-2.0" )
+ return false;
+
+ foreach (string package in this.packages ) {
+ if ( package_name == package )
+ return false;
+ }
+ return true;
+ }
+
+ private int run ( ) {
+ var settings = new Valadoc.Settings ( );
+ settings.package_name = this.package_name;
+ settings.add_inherited = this.add_inherited;
+ settings.files = this.sort_sources ( );
+ settings._protected = this._protected;
+ settings.with_deps = this.with_deps;
+ settings._private = this._private;
+ settings.path = this.directory;
+
+
+ var context = new Vala.CodeContext();
+ context.library = this.library;
+ context.memory_management = false;
+ context.assert = false;
+ context.checking = false;
+ context.ccode_only = false;
+ context.compile_only = false;
+ context.output = null;
+
+ context.checking = !disable_checking;
+ context.non_null = !disable_non_null || non_null_experimental;
+ context.non_null_experimental = non_null_experimental;
+
+
+ if ( this.basedir != null ) {
+ context.basedir = realpath ( this.basedir );
+ }
+
+ if ( this.directory != null ) {
+ context.directory = realpath ( this.directory );
+ }
+ else {
+ context.directory = context.basedir;
+ }
+
+ context.optlevel = 0;
+ context.debug = false;
+ context.thread = false;
+ context.save_temps = false;
+
+ if ( !check_package_name () ) {
+ Report.error (null, "Invalid package name." );
+ }
+
+ if (!add_package (context, "glib-2.0")) {
+ Report.error (null, "glib-2.0 not found in specified Vala API directories");
+ }
+
+ if ( this.packages != null ) {
+ foreach (string package in this.packages ) {
+ if (!add_package (context, package)) {
+ Report.error (null, "%s not found in specified Vala API directories".printf (package));
+ }
+ }
+ this.packages = null;
+ }
+
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+
+
+ if ( this.sources != null ) {
+ this.add_files( context );
+ this.sources = null;
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+ }
+
+ var parser = new Vala.Parser ();
+ parser.parse ( context );
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+
+ var attributeprocessor = new AttributeProcessor ();
+ attributeprocessor.process( context );
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+
+ var resolver = new SymbolResolver ();
+ resolver.resolve( context );
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+
+ var analyzer = new SemanticAnalyzer ( );
+ analyzer.analyze( context );
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+
+ if (context.non_null_experimental) {
+ var null_checker = new NullChecker ();
+ null_checker.check (context);
+
+ if (Report.get_errors () > 0) {
+ return quit ();
+ }
+ }
+
+
+ // add some random checks here
+ // Gee.HashMap<string, Valadoc.TagletCreator> taglets = this.get_taglets ( );
+
+ //Gee.HashMap<string, Valadoc.TagletCreator> taglets
+ // = new Gee.HashMap<string, Valadoc.TagletCreator>(GLib.str_hash, GLib.str_equal);
+
+
+ ////////////////// parse + errorreporter >>>>>>>>>>>>>>>>>
+
+
+ Reporter reporter = new Reporter();
+ GLib.Type strtag;
+
+ bool tmp = check_doclet_structure ( pluginpath );
+ if ( tmp == false ) {
+ stdout.printf ( "Not a doclet %s.\n", pluginpath );
+ return 1;
+ }
+
+ Gee.HashMap<string, Type> taglets = load_taglets ( out strtag );
+ if ( taglets == null )
+ return 1;
+
+ Valadoc.Doclet doclet = this.load_doclet ( );
+ if ( doclet == null ) {
+ return 1;
+ }
+
+ Valadoc.Parser docparser = new Valadoc.Parser ();
+ docparser.init ( settings, reporter, strtag, taglets );
+
+
+ Valadoc.Tree doctree = new Valadoc.Tree ( settings, context );
+ doctree.create_tree( );
+ if ( reporter.errors > 0 )
+ return quit ();
+
+ //////////////////////////// XML //////////////////////////
+
+ if ( xmlsource != null ) {
+ var xml = new MergeExternalDocumentation ( doctree );
+ bool tmp = xml.parse ( xmlsource );
+ if ( tmp == false ) {
+ stderr.printf ( "Can't load XML-File.\n" );
+ return 1;
+ }
+ }
+
+ doctree.parse_comments ( docparser );
+ if ( reporter.errors > 0 )
+ return 1;
+
+ ///////////////////////////////////////////////////////////
+
+
+ doclet.initialisation ( settings );
+
+
+
+ doctree.visit ( doclet );
+ doclet = null;
+ doctree = null;
+ return quit ();
+ }
+
+ static int main ( string[] args ) {
+ try {
+ var opt_context = new OptionContext ("- Vala Documentation Tool");
+ opt_context.set_help_enabled (true);
+ opt_context.add_main_entries (options, null);
+ opt_context.parse ( ref args);
+ }
+ catch (OptionError e) {
+ stdout.printf ("%s\n", e.message);
+ stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
+ return 1;
+ }
+
+ if ( version ) {
+ stdout.printf ("Valadoc %s\n", "0.1" );
+ return 0;
+ }
+
+ if ( tsources == null ) {
+ stderr.printf ("No source file specified.\n");
+ return -1;
+ }
+
+ if ( directory == null ) {
+ stderr.printf ("No output directory specified.\n");
+ return -1;
+ }
+
+ if ( directory[ directory.len() - 1 ] != '/' ) {
+ directory += "/";
+ }
+
+ if ( !add_documentation ) {
+ if ( FileUtils.test ( directory, FileTest.EXISTS ) ) {
+ stderr.printf ("File already exists.\n");
+ return -1;
+ }
+ }
+
+
+ if ( pluginpath == null ) {
+ pluginpath = Config.plugin_dir + "/template/";
+ }
+ else {
+ if ( !pluginpath.has_suffix ( "/" ) )
+ pluginpath = pluginpath + "/";
+
+ stdout.printf ( ">%s<\n", pluginpath );
+ }
+
+ var valadoc = new ValaDoc( );
+ valadoc.run();
+ return 0;
+ }
+}
+
diff --git a/src/vapi/Makefile.am b/src/vapi/Makefile.am
new file mode 100644
index 000000000..6b9c94117
--- /dev/null
+++ b/src/vapi/Makefile.am
@@ -0,0 +1,16 @@
+NULL =
+
+vapidir = $(datadir)/vala/vapi
+
+valadoc-1.0.vapi: ../libvaladoc/valadoc-1.0.vapi
+ cat ../libvaladoc/valadoc-1.0.vapi > valadoc-1.0.vapi
+
+dist_vapi_DATA = \
+ valadoc-1.0.vapi \
+ valadoc-1.0.deps \
+ $(NULL)
+
+dist_noinst_DATA = \
+ $(NULL)
+
+
diff --git a/src/vapi/config.vapi b/src/vapi/config.vapi
new file mode 100644
index 000000000..32c2847f7
--- /dev/null
+++ b/src/vapi/config.vapi
@@ -0,0 +1,15 @@
+/* config.vapi
+ *
+ * Author:
+ * Florian Brosch <flo.brosch@gmail.com>
+ */
+
+[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
+namespace Config {
+ [CCode (cname = "PACKAGE_VERSION")]
+ public const string version;
+
+ [CCode (cname = "PACKAGE_DATADIR")]
+ public const string plugin_dir;
+}
+
diff --git a/src/vapi/libgvc.vapi b/src/vapi/libgvc.vapi
new file mode 100755
index 000000000..89f186715
--- /dev/null
+++ b/src/vapi/libgvc.vapi
@@ -0,0 +1,394 @@
+
+
+[CCode (cprefix = "")]
+namespace Graphviz {
+
+
+//check the headerfile, // rename
+[CCode (cprefix = "", cheader_filename="gvc.h")]
+public enum GraphType {
+ AGDIGRAPHSTRICT,
+ AGRAPHSTRICT,
+ AGDIGRAPH,
+ AGRAPH
+}
+
+
+
+[CCode (cname = "aginitlib", cheader_filename="gvc.h")]
+public void init ( size_t graphinfo, size_t nodeinfo, size_t edgeinfo);
+
+
+// rename enum values
+[CCode (cname = "agerrlevel_t", cheader_filename = "gvc.h", cprefix = "")]
+public enum ErrorLevel {
+ AGWARN,
+ AGERR,
+ AGMAX,
+ AGPREV
+}
+
+[CCode(cprefix = "ag")]
+namespace Error {
+ [CCode (cname = "agerrno")]
+ public static ErrorLevel errno;
+
+ [CCode (cname = "agerr")]
+ public static int error( ErrorLevel level, string fmt, ...);
+
+ [CCode (cname = "agerrors")]
+ public static int errors( );
+
+ [CCode (cname = "agseterr")]
+ public static void set_error( ErrorLevel err );
+
+ [CCode (cname = "aglasterr")]
+ public static string? last_error( );
+
+ // rename
+ [CCode (cname = "agerrorf")] // name?
+ public static void errorf( string format, ...);
+
+ // rename
+ [CCode (cname = "agwarningf")]
+ void warningf( string fmt, ...);
+}
+
+
+// -> parser: static class
+// [CCode (cname = "agreadline")]
+// public void read_line(int);
+
+// [CCode (cname = "agsetfile")]
+// public void set_file( string filename );
+
+
+// char *gvUsername(void);
+
+
+
+
+//
+//-> class string: (I think we don't need that for the api.)
+//[CCode (cname = "agstrdup")]
+//extern char *agstrdup(char *);
+//[CCode (cname = "agstrfree")]
+//extern void agstrfree(char *);
+//[CCode (cname = "agcanon")]
+//char * agcanon (char *)
+//[CCode (cname = "agstrcanon")]
+//char *agstrcanon(char *, char *);
+//[CCode (cname = "agcanonical")]
+//char *agcanonical(char *);
+//[CCode (cname = "aghtmlstr")]
+//int aghtmlstr(char *s);
+//[CCode (cname = "agstrdup_html")]
+//char *agstrdup_html(char *s);
+
+
+
+
+
+[Compact]
+[CCode (cname = "rank_t", cheader_filename = "gvc.h", free_function = "", cprefix = "")]
+public class Rank {
+
+}
+
+[Compact]
+[CCode (cname = "Agraph_t", cheader_filename = "gvc.h", free_function = "agclose", cprefix = "")]
+public class Graph {
+ //[CCode (cname = "agmemread")]
+ //public static Graph? mem_read( char[] mem ); // some internal cast-magic caused damage to my brain
+ //public void attach_attrs( );
+
+ [CCode (cname = "agread")]
+ public static Graph read (GLib.FileStream file );
+
+ [CCode (cname = "AG_IS_DIRECTED")]
+ public bool is_directed ( );
+
+ [CCode (cname = "AG_IS_STRICT")]
+ public bool is_strict ( );
+
+ //
+ [CCode (cname = "agraphattr")]
+ public Sym attribute ( string name, string val );
+
+ [CCode (cname = "agfstattr")]
+ public weak Sym first_attribute ( );
+
+ [CCode (cname = "aglstattr")]
+ public weak Sym last_attribute ( );
+
+ [CCode (cname = "agnxtattr")]
+ public weak Sym next_attribute ( Sym sym );
+
+ [CCode (cname = "agprvattr")]
+ public weak Sym previous_attribute ( Sym sym );
+
+ //
+ [CCode (cname = "agget")]
+ public string get( string name );
+
+ //
+ [CCode (cname = "agxget")]
+ public string get_index( int index );
+
+ [CCode (cname = "agset")]
+ public int set(string attr, string val);
+
+ [CCode (cname = "agxset")]
+ public int set_index( int index, char[] buf );
+
+ [CCode (cname = "agindex")]
+ public int index ( string name );
+
+ [CCode (cname = "agsafeset")]
+ public int set_safe( string name, string val, string def );
+
+ [CCode (cname = "agopen")]
+ public static Graph open ( string name, GraphType kind );
+
+ //
+ [CCode (cname = "agsubg")]
+ public weak Graph subgraph( string name );
+
+ [CCode (cname = "agfindsubg")]
+ public weak Graph find_sub_graph ( string name );
+
+ [CCode (cname = "agwrite")]
+ public int write( GLib.FileStream file );
+
+ [CCode (cname = "agprotograph")]
+ public static Graph proto_graph ( );
+
+ [CCode (cname = "agusergraph")]
+ public static Graph user_graph( Node n );
+
+ [CCode (cname = "agnnodes")]
+ public int n_nodes( );
+
+ [CCode (cname = "agnedges")]
+ public int n_edges( );
+
+ [CCode (cname = "aginsert")]
+ public void insert( void* obj );
+
+ [CCode (cname = "agdelete")]
+ public void delete( void* obj );
+
+ [CCode (cname = "agcontains")]
+ public int contains( void* obj );
+
+ // make sure that the returned note is really freed by this class
+ [CCode (cname = "agnode")]
+ public weak Node node ( string str );
+
+ //
+ [CCode (cname = "agnodeattr")]
+ Sym node_attribute ( string name, string val );
+
+ [CCode (cname = "agfindnode")]
+ public weak Node find_node( string name );
+
+ [CCode (cname = "agfstnode")]
+ public weak Node first_node( );
+
+ [CCode (cname = "agnxtnode")]
+ public weak Node next_node( Node n );
+
+ [CCode (cname = "aglstnode")]
+ public weak Node last_node( );
+
+ [CCode (cname = "agprvnode")]
+ public weak Node prev_node( Node n );
+
+ [CCode (cname = "agedge")]
+ public weak Edge edge( Node tail, Node head );
+
+ [CCode (cname = "agedgeattr")]
+ public weak Sym edge_attribute( string name, string val );
+
+ [CCode (cname = "agfindedge")]
+ public weak Edge find_edge( Node tail, Node head );
+
+ [CCode (cname = "agfstedge")]
+ public weak Edge first_edge(Graph g, Node n);
+
+ [CCode (cname = "agnxtedge")]
+ public weak Edge next_edge( Edge e, Node n);
+
+ [CCode (cname = "agfstin")]
+ public weak Edge first_in( Node n );
+
+ [CCode (cname = "agnxtin")]
+ public weak Edge next_in ( Edge e );
+
+ [CCode (cname = "agfstout")]
+ public weak Edge first_out( Node n );
+
+ [CCode (cname = "agnxtout")]
+ public weak Edge next_out( Edge edge );
+
+ //?
+ [CCode (cname = "agraphattr")]
+ public Sym graph_attribute ( string name, string val );
+
+ [CCode (cname = "agfindattr")]
+ public weak Sym find_attribute ( string name );
+
+ [CCode (cname = "agcopyattr")]
+ public int copy_attribute( void* newobj );
+
+ //
+ [CCode (cname = "agprotonode")]
+ public Node proto_node ( );
+
+ //
+ [CCode (cname = "agprotoedge")]
+ public Edge proto_edge ( );
+}
+
+
+
+// Fill in!
+[Compact]
+[CCode (cname = "Agnode_t", cheader_filename = "gvc.h", free_function = "agFREEnode", cprefix = "")]
+public class Node {
+ [CCode (cname = "agsafeset")]
+ public int set_safe( string name, string val, string def );
+
+ [CCode (cname = "agfindattr")]
+ public weak Sym find_attribute ( string name );
+
+ [CCode (cname = "agcopyattr")]
+ public int copy_attribute( void* newobj );
+
+ //
+ [CCode (cname = "agget")]
+ public string get( string name );
+
+ //
+ [CCode (cname = "agxget")]
+ public string get_index( int index );
+
+ //
+ [CCode (cname = "agset")]
+ public int set(string attr, string val);
+
+ [CCode (cname = "agxset")]
+ public int set_index( int index, char[] buf );
+
+ [CCode (cname = "agindex")]
+ public int index ( string name );
+
+ // same as cname="agnode" -> i just tink it is weak
+ [CCode (cname = "agattr")]
+ public weak Sym attribute ( string name, string val );
+
+ [CCode (cname = "agfstattr")]
+ public weak Sym first_attribute ( );
+
+ [CCode (cname = "aglstattr")]
+ public weak Sym last_attribute ( );
+
+ [CCode (cname = "agnxtattr")]
+ public weak Sym next_attribute ( Sym sym );
+
+ [CCode (cname = "agprvattr")]
+ public weak Sym previous_attribute ( Sym sym );
+}
+
+
+
+// FILL IN! - free function?
+[Compact]
+[CCode (cname = "Agedge_t", cheader_filename = "gvc.h", cprefix = "")]
+public class Edge {
+ //
+ [CCode (cname = "agattr")]
+ public weak Sym attribute ( string name, string val );
+
+ [CCode (cname = "agfstattr")]
+ public weak Sym first_attribute ( );
+
+ [CCode (cname = "aglstattr")]
+ public weak Sym last_attribute ( );
+
+ [CCode (cname = "agnxtattr")]
+ public weak Sym next_attribute ( Sym sym );
+
+ [CCode (cname = "agprvattr")]
+ public weak Sym previous_attribute ( Sym sym );
+
+ [CCode (cname = "agsafeset")]
+ public int set_safe( string name, string val, string def );
+
+ [CCode (cname = "agfindattr")]
+ public weak Sym find_attribute ( string name );
+
+ //
+ [CCode (cname = "agcopyattr")]
+ public int copy_attribute( void* newobj );
+
+ //
+ [CCode (cname = "agget")]
+ public string get( string name );
+
+ //
+ [CCode (cname = "agxget")]
+ public string get_index( int index );
+
+ [CCode (cname = "agset")]
+ public int set(string attr, string val);
+
+ [CCode (cname = "agxset")]
+ public int set_index( int index, char[] buf );
+
+ [CCode (cname = "agindex")]
+ public int index ( string name );
+}
+
+
+
+// free function?
+[Compact]
+[CCode (cname = "Agsym_t", cheader_filename = "gvc.h", cprefix = "")]
+public class Sym {
+}
+
+
+[Compact]
+[CCode (cname = "GVC_t", cheader_filename = "gvc.h", free_function = "gvFreeContext", cprefix = "")]
+public class Context {
+ //??
+ //GVC_t *gvNEWcontext(char **info, char *user);
+ [CCode (cname = "gvParseArgs")]
+ public int parse_args ( [CCode (array_length_pos = 0.9)] string[] argv );
+
+ [CCode (cname = "gvContext")]
+ public static Context context ( );
+
+ [CCode (cname = "gvLayout")]
+ public int layout ( Graph g, string engine );
+
+ [CCode (cname = "gvLayoutJobs")]
+ public int layout_jobs ( Graph g );
+
+ [CCode (cname = "gvRender")]
+ public int render( Graph g, string format, GLib.FileStream file );
+
+ [CCode (cname = "gvRenderFilename")]
+ public int render_filename ( Graph g, string format, string filename);
+
+ [CCode (cname = "gvRenderJobs")]
+ public int render_jobs ( Graph g );
+
+ [CCode (cname = "gvFreeLayout")]
+ public int free_layout ( Graph g );
+}
+
+
+}
+
diff --git a/src/vapi/valadoc-1.0.deps b/src/vapi/valadoc-1.0.deps
new file mode 100644
index 000000000..58713595c
--- /dev/null
+++ b/src/vapi/valadoc-1.0.deps
@@ -0,0 +1,2 @@
+vala-1.0
+libgvc