Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86284 - in trunk/tools/boostbook: test/doxygen test/doxygen/boost xsl/doxygen
From: dnljms_at_[hidden]
Date: 2013-10-13 07:10:01


Author: danieljames
Date: 2013-10-13 07:10:01 EDT (Sun, 13 Oct 2013)
New Revision: 86284
URL: http://svn.boost.org/trac/boost/changeset/86284

Log:
Parse brackets in argsstring.

This may seem like overkill, but it's going to be needed for handling
parameters to noexcept. Doesn't handle escapes because that my sanity is
already stretched far enough.

Text files modified:
   trunk/tools/boostbook/test/doxygen/autodoc.gold | 10 ++++++
   trunk/tools/boostbook/test/doxygen/boost/example.hpp | 12 +++++++
   trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl | 64 ++++++++++++++++++++++++++++++++++++++-
   3 files changed, 83 insertions(+), 3 deletions(-)

Modified: trunk/tools/boostbook/test/doxygen/autodoc.gold
==============================================================================
--- trunk/tools/boostbook/test/doxygen/autodoc.gold Sun Oct 13 06:13:10 2013 (r86283)
+++ trunk/tools/boostbook/test/doxygen/autodoc.gold 2013-10-13 07:10:01 EDT (Sun, 13 Oct 2013) (r86284)
@@ -18,6 +18,16 @@
 <method name="virtual_abstract_method" cv="= 0" specifiers="virtual"><type>int</type></method>
 <method name="virtual_const_method" cv="const" specifiers="virtual"><type>int</type></method>
 <method name="method_with_default_value"><type>int</type><parameter name=""><paramtype>int</paramtype><default>default_value</default></parameter></method>
+<method name="method_with_fp"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="method_with_string_default1"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="method_with_string_default2"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="method_with_char_default1"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="method_with_char_default2"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="volatile_method_with_fp" cv="volatile"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="volatile_method_with_string_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="volatile_method_with_string_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="volatile_method_with_char_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
+<method name="volatile_method_with_char_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
 <method name="const_method" cv="const"><type>void</type></method>
 <method name="volatile_method" cv="volatile"><type>void</type></method>
 <method name="trad_noexcept" cv="noexcept"><type>void</type></method>

Modified: trunk/tools/boostbook/test/doxygen/boost/example.hpp
==============================================================================
--- trunk/tools/boostbook/test/doxygen/boost/example.hpp Sun Oct 13 06:13:10 2013 (r86283)
+++ trunk/tools/boostbook/test/doxygen/boost/example.hpp 2013-10-13 07:10:01 EDT (Sun, 13 Oct 2013) (r86284)
@@ -39,6 +39,18 @@
         virtual int virtual_const_method() const;
         int method_with_default_value(int = default_value);
 
+ int method_with_fp(int (*fp)(), volatile char);
+ int method_with_string_default1(char* = ")", volatile char);
+ int method_with_string_default2(char* = "(", volatile char);
+ int method_with_char_default1(char = '(', volatile char);
+ int method_with_char_default2(char = ')', volatile char);
+
+ int volatile_method_with_fp(int (*fp)(), volatile char) volatile;
+ int volatile_method_with_string_default1(char* = ")", volatile char) volatile;
+ int volatile_method_with_string_default2(char* = "(", volatile char) volatile;
+ int volatile_method_with_char_default1(char = '(', volatile char) volatile;
+ int volatile_method_with_char_default2(char = ')', volatile char) volatile;
+
         void const_method() const;
         void volatile_method() volatile;
 

Modified: trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl Sun Oct 13 06:13:10 2013 (r86283)
+++ trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl 2013-10-13 07:10:01 EDT (Sun, 13 Oct 2013) (r86284)
@@ -1062,9 +1062,18 @@
   <xsl:template name="function.attributes">
 
     <!-- argsstring = '(arguments) [= delete] [= default] [constexpt]' -->
- <xsl:variable name="extra-qualifiers" select="concat(' ',
- normalize-space(substring-after(argsstring/text(), ')')),
- ' ')" />
+ <xsl:variable name="extra-qualifiers-a">
+ <xsl:if test="contains(argsstring/text(), '(')">
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="substring-after(argsstring/text(), '(')" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="extra-qualifiers">
+ <xsl:if test="$extra-qualifiers-a">
+ <xsl:value-of select="concat(' ', normalize-space($extra-qualifiers-a), ' ')" />
+ </xsl:if>
+ </xsl:variable>
 
     <!-- CV Qualifiers -->
     <!-- Plus deleted and defaulted function markers as they're not properly
@@ -1109,6 +1118,55 @@
 
   </xsl:template>
 
+ <!-- $text = substring after the opening bracket -->
+ <xsl:template name="strip-brackets">
+ <xsl:param name="text"/>
+
+ <xsl:if test="contains($text, ')')">
+ <xsl:variable name="prefix1" select="substring-before($text, ')')" />
+ <xsl:variable name="prefix2" select="substring($prefix1, 1,
+ string-length(substring-before($prefix1, '(')) +
+ 999 * not(contains($prefix1, '(')))" />
+ <xsl:variable name="prefix3" select="substring($prefix2, 1,
+ string-length(substring-before($prefix2, '&quot;')) +
+ 999 * not(contains($prefix2, '&quot;')))" />
+ <xsl:variable name="prefix" select="substring($prefix3, 1,
+ string-length(substring-before($prefix3, &quot;'&quot;)) +
+ 999 * not(contains($prefix3, &quot;'&quot;)))" />
+
+ <xsl:variable name="prefix-length" select="string-length($prefix)" />
+ <xsl:variable name="char" select="substring($text, $prefix-length + 1, 1)" />
+
+ <xsl:choose>
+ <xsl:when test="$char=')'">
+ <xsl:value-of select="substring($text, $prefix-length + 2)" />
+ </xsl:when>
+ <xsl:when test="$char='('">
+ <xsl:variable name="text2">
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="substring($text, $prefix-length + 2)" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="$text2" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$char=&quot;'&quot;">
+ <!-- Not bothering with escapes, because this is crazy enough as it is -->
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), &quot;'&quot;)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$char='&quot;'">
+ <!-- Not bothering with escapes, because this is crazy enough as it is -->
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), '&quot;')" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
   <!-- Handle function children -->
   <xsl:template name="function.children">
     <xsl:param name="is-overloaded" select="false()"/>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk