|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86285 - in trunk/tools/boostbook: test/doxygen test/doxygen/boost xsl/doxygen
From: dnljms_at_[hidden]
Date: 2013-10-13 07:10:39
Author: danieljames
Date: 2013-10-13 07:10:38 EDT (Sun, 13 Oct 2013)
New Revision: 86285
URL: http://svn.boost.org/trac/boost/changeset/86285
Log:
Support noexcept with a conditional.
Turns out Doxygen doesn't like BOOST_NOEXCEPT_IF. Text parsing in XSL is an
almighty pain, it might be better to just combine whatever follows the
arguments in argsstring with the values from the attributes.
Text files modified:
trunk/tools/boostbook/test/doxygen/autodoc.gold | 2 +
trunk/tools/boostbook/test/doxygen/boost/example.hpp | 2 +
trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl | 56 +++++++++++++++++++++++++++++++++++++--
3 files changed, 56 insertions(+), 4 deletions(-)
Modified: trunk/tools/boostbook/test/doxygen/autodoc.gold
==============================================================================
--- trunk/tools/boostbook/test/doxygen/autodoc.gold Sun Oct 13 07:10:01 2013 (r86284)
+++ trunk/tools/boostbook/test/doxygen/autodoc.gold 2013-10-13 07:10:38 EDT (Sun, 13 Oct 2013) (r86285)
@@ -31,7 +31,9 @@
<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>
+<method name="trad_noexcept_if" cv="noexcept(a==b &&(c||d)))"><type>void</type></method>
<method name="boost_noexcept" cv="noexcept"><type>void</type></method>
+<method name="boost_noexcept_if" cv="noexcept(condition)"><type>void</type></method>
<method name="trad_constexpr" cv="constexpr"><type>void</type></method>
<method name="boost_constexpr" cv="constexpr"><type>void</type></method>
<method name="boost_constexpr_or_const" cv="constexpr"><type>void</type></method>
Modified: trunk/tools/boostbook/test/doxygen/boost/example.hpp
==============================================================================
--- trunk/tools/boostbook/test/doxygen/boost/example.hpp Sun Oct 13 07:10:01 2013 (r86284)
+++ trunk/tools/boostbook/test/doxygen/boost/example.hpp 2013-10-13 07:10:38 EDT (Sun, 13 Oct 2013) (r86285)
@@ -55,7 +55,9 @@
void volatile_method() volatile;
void trad_noexcept() noexcept;
+ void trad_noexcept_if() noexcept(a == b && (c || d));
void boost_noexcept() BOOST_NOEXCEPT;
+ void boost_noexcept_if() BOOST_NOEXCEPT_IF(a == b && (c || d));
void trad_constexpr() constexpr;
void boost_constexpr() BOOST_CONSTEXPR;
Modified: trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl Sun Oct 13 07:10:01 2013 (r86284)
+++ trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl 2013-10-13 07:10:38 EDT (Sun, 13 Oct 2013) (r86285)
@@ -1078,19 +1078,43 @@
<!-- CV Qualifiers -->
<!-- Plus deleted and defaulted function markers as they're not properly
supported in boostbook -->
- <!-- The 'substring' trick includes the string if the condition is true -->
+
+ <!-- noexcept is complicated because is can have parameters.
+ TODO: should really remove the noexcept parameters before doing
+ anything else. -->
+ <xsl:variable name="noexcept">
+ <xsl:choose>
+ <xsl:when test="contains($extra-qualifiers, ' noexcept(')">
+ <xsl:call-template name="noexcept-if">
+ <xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' noexcept(')" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="contains($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')">
+ <xsl:call-template name="noexcept-if">
+ <xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')" />
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="contains($extra-qualifiers, ' noexcept ') or contains($extra-qualifiers, ' BOOST_NOEXCEPT ')">
+ <xsl:value-of select="'noexcept '" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- Calculate constexpr now, so that we can avoid it getting confused
+ with const -->
<xsl:variable name="constexpr" select="
contains($extra-qualifiers, ' const expr ') or
contains($extra-qualifiers, ' BOOST_CONSTEXPR ') or
contains($extra-qualifiers, ' BOOST_CONSTEXPR_OR_CONST ')" />
+ <!-- The 'substring' trick includes the string if the condition is true -->
<xsl:variable name="cv-qualifiers" select="normalize-space(concat(
substring('constexpr ', 1, 999 * $constexpr),
substring('const ', 1, 999 * (not($constexpr) and @const='yes')),
substring('volatile ', 1, 999 * (@volatile='yes' or contains($extra-qualifiers, ' volatile '))),
- substring('noexcept ', 1, 999 * (
- contains($extra-qualifiers, ' noexcept ') or
- contains($extra-qualifiers, ' BOOST_NOEXCEPT '))),
+ $noexcept,
substring('= delete ', 1, 999 * contains($extra-qualifiers, ' =delete ')),
substring('= default ', 1, 999 * contains($extra-qualifiers, ' =default ')),
substring('= 0 ', 1, 999 * (@virt = 'pure-virtual')),
@@ -1118,6 +1142,30 @@
</xsl:template>
+ <!-- $condition = string after the opening bracket of the condition -->
+ <xsl:template name="noexcept-if">
+ <xsl:param name="condition"/>
+
+ <xsl:variable name="trailing">
+ <xsl:call-template name="strip-brackets">
+ <xsl:with-param name="text" select="$condition" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string-length($trailing)">
+ <xsl:value-of select="concat(
+ 'noexcept(',
+ substring($condition, 1, string-length($condition) - string-length($trailing)),
+ ') ')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Something has gone wrong so: -->
+ <xsl:value-of select="'noexcept(condition) '" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<!-- $text = substring after the opening bracket -->
<xsl:template name="strip-brackets">
<xsl:param name="text"/>
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