1 <?xml version="1.0" encoding="utf-8"?>
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12 <xsl:strip-space elements="requires effects postconditions returns throws
13 complexity notes rationale purpose"/>
15 <!-- When true, the stylesheet will emit compact definitions of
16 functions when the function does not have any detailed
18 <xsl:param name="boost.compact.function">1</xsl:param>
20 <!-- The longest type length that is considered "short" for the
21 layout of function return types. When the length of the result type
22 and any storage specifiers is greater than this length, they will be
23 placed on a separate line from the function name and parameters
24 unless everything fits on a single line. -->
25 <xsl:param name="boost.short.result.type">12</xsl:param>
27 <!-- Display a function declaration -->
28 <xsl:template name="function">
29 <xsl:param name="indentation"/>
30 <xsl:param name="is-reference"/>
32 <!-- Whether or not we should include parameter names in the output -->
33 <xsl:param name="include-names" select="$is-reference"/>
35 <!-- What type of link the function name should have. This shall
36 be one of 'anchor' (the function output will be the target of
37 links), 'link' (the function output will link to a definition), or
38 'none' (the function output will not be either a link or a link
40 <xsl:param name="link-type">
42 <xsl:when test="$is-reference">
43 <xsl:text>anchor</xsl:text>
46 <xsl:text>link</xsl:text>
51 <!-- The id we should link to or anchor as -->
52 <xsl:param name="link-to">
53 <xsl:call-template name="generate.id"/>
56 <!-- If we are printing a constructor -->
57 <xsl:param name="constructor-for"/>
59 <!-- If we are printing a destructor -->
60 <xsl:param name="destructor-for"/>
62 <!-- If we are printing a copy assignment operator -->
63 <xsl:param name="copy-assign-for"/>
65 <!-- The name of this function -->
66 <xsl:param name="name" select="@name"/>
68 <!-- True if this is the function's separate documentation -->
69 <xsl:param name="standalone" select="false()"/>
71 <!-- True if we should suppress the template header -->
72 <xsl:param name="suppress-template" select="false()"/>
74 <!-- Calculate the specifiers -->
75 <xsl:variable name="specifiers">
76 <xsl:if test="@specifiers">
77 <xsl:value-of select="concat(@specifiers, ' ')"/>
81 <!-- Calculate the type -->
82 <xsl:variable name="type">
83 <xsl:value-of select="$specifiers"/>
86 <!-- Conversion operators have an empty type, because the return
87 type is part of the name -->
88 <xsl:when test="$name='conversion-operator'"/>
90 <!-- Constructors and destructors have no return type -->
91 <xsl:when test="$constructor-for or $destructor-for"/>
93 <!-- Copy assignment operators return a reference to the class
94 they are in, unless another type has been explicitly
95 provided in the element. -->
96 <xsl:when test="$copy-assign-for and not(type)">
97 <xsl:value-of select="concat($copy-assign-for, '& ')"/>
101 <xsl:apply-templates select="type" mode="annotation"/>
102 <xsl:text> </xsl:text>
107 <!-- Build the function name with return type -->
108 <xsl:variable name="function-name">
110 <xsl:when test="$constructor-for">
111 <xsl:value-of select="$constructor-for"/>
113 <xsl:when test="$destructor-for">
114 <xsl:value-of select="concat('~',$destructor-for)"/>
116 <xsl:when test="$copy-assign-for">
117 <xsl:value-of select="'operator='"/>
119 <xsl:when test="$name='conversion-operator'">
120 <xsl:text>operator </xsl:text>
121 <xsl:apply-templates select="type" mode="annotation"/>
124 <xsl:value-of select="$name"/>
129 <xsl:if test="not ($standalone) or
130 (local-name(.)='signature' and (position() > 1))
131 or $suppress-template">
132 <xsl:text> </xsl:text>
135 <!-- Indent this declaration -->
136 <xsl:call-template name="indent">
137 <xsl:with-param name="indentation" select="$indentation"/>
140 <!-- Build the template header -->
141 <xsl:variable name="template-length">
143 <xsl:when test="$suppress-template">
147 <xsl:call-template name="template.synopsis.length"/>
152 <!-- Build a full parameter string (without line breaks) -->
153 <xsl:variable name="param-string">
154 <xsl:text>(</xsl:text>
155 <xsl:call-template name="function-parameters">
156 <xsl:with-param name="include-names" select="$include-names"/>
157 <xsl:with-param name="wrap" select="false()"/>
159 <xsl:text>)</xsl:text>
162 <!-- Build the text that follows the declarator-->
163 <xsl:variable name="postdeclarator">
164 <xsl:if test="@cv and @cv != ''">
165 <xsl:text> </xsl:text>
166 <xsl:value-of select="@cv"/>
170 <!-- Build the full declaration text -->
171 <xsl:variable name="decl-string"
172 select="concat($type, $function-name, $param-string, $postdeclarator)"/>
173 <xsl:variable name="end-column"
174 select="$template-length + string-length($decl-string) + $indentation"/>
177 <!-- Check if we should put the template header on its own line to
178 save horizontal space. -->
179 <xsl:when test="($template-length > 0) and
180 ($end-column > $max-columns)">
181 <!-- Emit template header on its own line -->
182 <xsl:apply-templates select="template" mode="synopsis">
183 <xsl:with-param name="indentation" select="$indentation"/>
184 </xsl:apply-templates>
186 <!-- Emit the rest of the function declaration (without the
187 template header) indented two extra spaces. -->
188 <xsl:call-template name="function">
189 <xsl:with-param name="indentation" select="$indentation + 2"/>
190 <xsl:with-param name="is-reference" select="$is-reference"/>
191 <xsl:with-param name="include-names" select="$include-names"/>
192 <xsl:with-param name="link-type" select="$link-type"/>
193 <xsl:with-param name="link-to" select="$link-to"/>
194 <xsl:with-param name="constructor-for" select="$constructor-for"/>
195 <xsl:with-param name="destructor-for" select="$destructor-for"/>
196 <xsl:with-param name="copy-assign-for" select="$copy-assign-for"/>
197 <xsl:with-param name="name" select="$name"/>
198 <xsl:with-param name="standalone" select="$standalone"/>
199 <xsl:with-param name="suppress-template" select="true()"/>
203 <!-- Check if we can put the entire declaration on a single
205 <xsl:when test="not($end-column > $max-columns)">
206 <!-- Emit template header, if not suppressed -->
207 <xsl:if test="not($suppress-template)">
208 <xsl:apply-templates select="template" mode="synopsis">
209 <xsl:with-param name="indentation" select="$indentation"/>
210 <xsl:with-param name="wrap" select="false()"/>
211 <xsl:with-param name="highlight" select="true()"/>
212 </xsl:apply-templates>
215 <!-- Emit specifiers -->
216 <xsl:call-template name="source-highlight">
217 <xsl:with-param name="text" select="$specifiers"/>
220 <!-- Emit type, if any -->
222 <!-- Conversion operators have an empty type, because the return
223 type is part of the name -->
224 <xsl:when test="$name='conversion-operator'"/>
226 <!-- Constructors and destructors have no return type -->
227 <xsl:when test="$constructor-for or $destructor-for"/>
229 <!-- Copy assignment operators return a reference to the class
230 they are in, unless another type has been explicitly
231 provided in the element. -->
232 <xsl:when test="$copy-assign-for and not(type)">
233 <xsl:value-of select="concat($copy-assign-for, '& ')"/>
237 <xsl:apply-templates select="type" mode="highlight"/>
238 <xsl:text> </xsl:text>
242 <xsl:call-template name="link-or-anchor">
243 <xsl:with-param name="to" select="$link-to"/>
244 <xsl:with-param name="text" select="$function-name"/>
245 <xsl:with-param name="link-type" select="$link-type"/>
246 <xsl:with-param name="highlight" select="true()"/>
249 <xsl:call-template name="highlight-text">
250 <xsl:with-param name="text" select="'('"/>
252 <xsl:call-template name="function-parameters">
253 <xsl:with-param name="include-names" select="$include-names"/>
254 <xsl:with-param name="indentation"
255 select="$indentation + $template-length + string-length($type)
256 + string-length($function-name) + 1"/>
257 <xsl:with-param name="final" select="true()"/>
259 <xsl:call-template name="highlight-text">
260 <xsl:with-param name="text" select="')'"/>
263 <xsl:call-template name="source-highlight">
264 <xsl:with-param name="text" select="$postdeclarator"/>
266 <xsl:call-template name="highlight-text">
267 <xsl:with-param name="text" select="';'"/>
271 <!-- This declaration will take multiple lines -->
273 <!-- Emit specifiers -->
274 <xsl:call-template name="source-highlight">
275 <xsl:with-param name="text" select="$specifiers"/>
278 <!-- Emit type, if any -->
280 <!-- Conversion operators have an empty type, because the return
281 type is part of the name -->
282 <xsl:when test="$name='conversion-operator'"/>
284 <!-- Constructors and destructors have no return type -->
285 <xsl:when test="$constructor-for or $destructor-for"/>
287 <!-- Copy assignment operators return a reference to the class
288 they are in, unless another type has been explicitly
289 provided in the element. -->
290 <xsl:when test="$copy-assign-for and not(type)">
291 <xsl:value-of select="concat($copy-assign-for, '& ')"/>
295 <xsl:apply-templates select="type" mode="highlight"/>
296 <xsl:text> </xsl:text>
300 <xsl:if test="string-length($type) > $boost.short.result.type">
301 <xsl:text> </xsl:text>
302 <xsl:call-template name="indent">
303 <xsl:with-param name="indentation" select="$indentation"/>
307 <!-- Determine how many columns the type and storage
308 specifiers take on the same line as the function name. -->
309 <xsl:variable name="type-length">
311 <xsl:when test="string-length($type) > $boost.short.result.type">
315 <xsl:value-of select="string-length($type)"/>
320 <xsl:call-template name="link-or-anchor">
321 <xsl:with-param name="to" select="$link-to"/>
322 <xsl:with-param name="text" select="$function-name"/>
323 <xsl:with-param name="link-type" select="$link-type"/>
324 <xsl:with-param name="highlight" select="true()"/>
326 <xsl:call-template name="highlight-text">
327 <xsl:with-param name="text" select="'('"/>
329 <xsl:call-template name="function-parameters">
330 <xsl:with-param name="include-names" select="$include-names"/>
331 <xsl:with-param name="indentation"
332 select="$indentation + $type-length
333 + string-length($function-name) + 1"/>
334 <xsl:with-param name="final" select="true()"/>
336 <xsl:call-template name="highlight-text">
337 <xsl:with-param name="text" select="')'"/>
339 <xsl:call-template name="source-highlight">
340 <xsl:with-param name="text" select="$postdeclarator"/>
342 <xsl:call-template name="highlight-text">
343 <xsl:with-param name="text" select="';'"/>
349 <!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
350 <xsl:template name="function-parameters">
351 <!-- Indentation level of this parameter list -->
352 <xsl:param name="indentation"/>
354 <!-- True if we should include parameter names -->
355 <xsl:param name="include-names" select="true()"/>
357 <!-- True if we should wrap function parameters to the next line -->
358 <xsl:param name="wrap" select="true()"/>
360 <!-- True if we are printing the final output -->
361 <xsl:param name="final" select="false()"/>
363 <!-- Internal: The prefix to emit before a parameter -->
364 <xsl:param name="prefix" select="''"/>
366 <!-- Internal: The list of parameters -->
367 <xsl:param name="parameters" select="parameter"/>
369 <!-- Internal: The column we are on -->
370 <xsl:param name="column" select="$indentation"/>
372 <!-- Internal: Whether this is the first parameter on this line or not -->
373 <xsl:param name="first-on-line" select="true()"/>
375 <xsl:if test="$parameters">
376 <!-- Information for this parameter -->
377 <xsl:variable name="parameter" select="$parameters[position()=1]"/>
378 <xsl:variable name="pack">
379 <xsl:if test="$parameter/@pack=1">
381 <xsl:when test="$final">
382 <xsl:call-template name="highlight-text">
383 <xsl:with-param name="text" select="'...'"/>
387 <xsl:text>...</xsl:text>
392 <xsl:variable name="name">
393 <xsl:if test="$include-names and $parameter/@name != ''">
394 <xsl:text> </xsl:text><xsl:value-of select="$parameter/@name"/>
398 <xsl:variable name="type" select="string($parameter/paramtype)"/>
400 <xsl:variable name="default">
402 <xsl:when test="$parameter/@default">
404 <xsl:when test="$final">
405 <xsl:call-template name="highlight-text">
406 <xsl:with-param name="text" select="concat(' = ', $parameter/@default)"/>
410 <xsl:text> = </xsl:text>
411 <xsl:value-of select="$parameter/@default"/>
415 <xsl:when test="$parameter/default">
417 <xsl:when test="$final">
418 <xsl:call-template name="highlight-text">
419 <xsl:with-param name="text" select="' = '"/>
422 select="$parameter/default/*|$parameter/default/text()"
424 <xsl:with-param name="highlight" select="true()"/>
425 </xsl:apply-templates>
428 <xsl:text> = </xsl:text>
429 <xsl:value-of select="string($parameter/default)"/>
436 <xsl:variable name="text" select="concat($type, $pack, $name, $default)"/>
438 <xsl:variable name="end-column"
439 select="$column + string-length($prefix) + string-length($text)"/>
442 <!-- Parameter goes on this line -->
443 <xsl:when test="$first-on-line or ($end-column < $max-columns)
446 <xsl:when test="$final">
447 <xsl:call-template name="highlight-text">
448 <xsl:with-param name="text" select="$prefix"/>
451 select="$parameter/paramtype/*|$parameter/paramtype/text()"
453 <xsl:with-param name="highlight" select="true()"/>
454 </xsl:apply-templates>
455 <xsl:copy-of select="$pack"/>
456 <xsl:value-of select="$name"/>
457 <xsl:copy-of select="$default"/>
460 <xsl:value-of select="concat($prefix, $text)"/>
464 <xsl:call-template name="function-parameters">
465 <xsl:with-param name="indentation" select="$indentation"/>
466 <xsl:with-param name="include-names" select="$include-names"/>
467 <xsl:with-param name="wrap" select="$wrap"/>
468 <xsl:with-param name="final" select="$final"/>
469 <xsl:with-param name="parameters"
470 select="$parameters[position()!=1]"/>
471 <xsl:with-param name="prefix" select="', '"/>
472 <xsl:with-param name="column" select="$end-column"/>
473 <xsl:with-param name="first-on-line" select="false()"/>
476 <!-- Parameter goes on next line -->
478 <!-- The comma goes on this line -->
480 <xsl:when test="$final">
481 <xsl:call-template name="highlight-text">
482 <xsl:with-param name="text" select="$prefix"/>
486 <xsl:value-of select="$prefix"/>
489 <xsl:text> </xsl:text>
491 <!-- Indent and print the parameter -->
492 <xsl:call-template name="indent">
493 <xsl:with-param name="indentation" select="$indentation"/>
496 <xsl:when test="$final">
498 select="$parameter/paramtype/*|$parameter/paramtype/text()"
500 <xsl:with-param name="highlight" select="true()"/>
501 </xsl:apply-templates>
502 <xsl:copy-of select="$pack"/>
503 <xsl:value-of select="$name"/>
504 <xsl:copy-of select="$default"/>
507 <xsl:value-of select="concat($prefix, $text)"/>
511 <!-- Emit next parameter -->
512 <xsl:call-template name="function-parameters">
513 <xsl:with-param name="indentation" select="$indentation"/>
514 <xsl:with-param name="include-names" select="$include-names"/>
515 <xsl:with-param name="wrap" select="$wrap"/>
516 <xsl:with-param name="final" select="$final"/>
517 <xsl:with-param name="parameters"
518 select="$parameters[position()!=1]"/>
519 <xsl:with-param name="prefix" select="', '"/>
520 <xsl:with-param name="column"
521 select="1 + string-length($text) + $indentation"/>
522 <xsl:with-param name="first-on-line" select="false()"/>
529 <!-- Function synopsis -->
530 <xsl:template match="function|method" mode="synopsis">
531 <xsl:param name="indentation"/>
533 <!-- True if we should compact this function -->
534 <xsl:variable name="compact"
535 select="not (para|description|requires|effects|postconditions|returns|
536 throws|complexity|notes|rationale) and
537 ($boost.compact.function='1') and
538 not (local-name(.)='method')"/>
541 <xsl:when test="$compact">
542 <xsl:if test="purpose">
543 <!-- Compact display outputs the purpose as a comment (if
544 there is one) and the entire function declaration. -->
545 <xsl:text> </xsl:text>
546 <xsl:call-template name="indent">
547 <xsl:with-param name="indentation" select="$indentation"/>
550 <xsl:call-template name="highlight-comment">
551 <xsl:with-param name="text">
552 <xsl:text>// </xsl:text>
553 <xsl:apply-templates select="purpose/*|purpose/text()"
559 <xsl:call-template name="function">
560 <xsl:with-param name="indentation" select="$indentation"/>
561 <xsl:with-param name="is-reference" select="true()"/>
565 <xsl:call-template name="function">
566 <xsl:with-param name="indentation" select="$indentation"/>
567 <xsl:with-param name="is-reference" select="false()"/>
573 <xsl:template match="overloaded-function|overloaded-method" mode="synopsis">
574 <xsl:param name="indentation"/>
576 <xsl:variable name="name" select="@name"/>
578 <!-- True if we should compact this function -->
579 <xsl:variable name="compact"
580 select="not (para|description|requires|effects|postconditions|returns|
581 throws|complexity|notes|rationale) and
582 ($boost.compact.function='1') and
583 not (local-name(.)='overloaded-method')"/>
586 <xsl:when test="$compact">
587 <xsl:if test="purpose">
588 <!-- Compact display outputs the purpose as a comment (if
589 there is one) and the entire function declaration. -->
590 <xsl:text> </xsl:text>
591 <xsl:call-template name="indent">
592 <xsl:with-param name="indentation" select="$indentation"/>
595 <xsl:call-template name="highlight-comment">
596 <xsl:with-param name="text">
597 <xsl:text>// </xsl:text>
598 <xsl:apply-templates select="purpose" mode="annotation"/>
603 <xsl:for-each select="signature">
604 <xsl:call-template name="function">
605 <xsl:with-param name="indentation" select="$indentation"/>
606 <xsl:with-param name="is-reference" select="true()"/>
607 <xsl:with-param name="name" select="$name"/>
611 <xsl:when test="local-name(..)='namespace'">
612 <xsl:variable name="link-to">
613 <xsl:call-template name="generate.id"/>
616 <xsl:for-each select="signature">
617 <xsl:call-template name="function">
618 <xsl:with-param name="indentation" select="$indentation"/>
619 <xsl:with-param name="is-reference" select="false()"/>
620 <xsl:with-param name="name" select="$name"/>
621 <xsl:with-param name="link-to" select="$link-to"/>
626 <xsl:for-each select="signature">
627 <xsl:call-template name="function">
628 <xsl:with-param name="indentation" select="$indentation"/>
629 <xsl:with-param name="is-reference" select="false()"/>
630 <xsl:with-param name="name" select="$name"/>
637 <!-- Group free functions together under a category name (header synopsis)-->
638 <xsl:template match="free-function-group" mode="header-synopsis">
639 <xsl:param name="class"/>
640 <xsl:param name="indentation"/>
641 <xsl:apply-templates select="function|overloaded-function" mode="synopsis">
642 <xsl:with-param name="indentation" select="$indentation"/>
643 </xsl:apply-templates>
646 <!-- Constructors, destructor, and assignment operators -->
647 <xsl:template name="construct-copy-destruct-synopsis">
648 <xsl:param name="indentation"/>
649 <xsl:if test="constructor|copy-assignment|destructor">
650 <xsl:if test="typedef|static-constant">
651 <xsl:text> </xsl:text>
653 <xsl:text> </xsl:text>
654 <xsl:call-template name="indent">
655 <xsl:with-param name="indentation" select="$indentation"/>
657 <xsl:call-template name="highlight-comment">
658 <xsl:with-param name="text">
659 <xsl:text>// </xsl:text>
660 <xsl:call-template name="internal-link">
661 <xsl:with-param name="to">
662 <xsl:call-template name="generate.id"/>
663 <xsl:text>construct-copy-destruct</xsl:text>
665 <xsl:with-param name="text" select="'construct/copy/destruct'"/>
669 <xsl:apply-templates select="constructor" mode="synopsis">
670 <xsl:with-param name="indentation" select="$indentation"/>
671 </xsl:apply-templates>
672 <xsl:apply-templates select="copy-assignment" mode="synopsis">
673 <xsl:with-param name="indentation" select="$indentation"/>
674 </xsl:apply-templates>
675 <xsl:apply-templates select="destructor" mode="synopsis">
676 <xsl:with-param name="indentation" select="$indentation"/>
677 </xsl:apply-templates>
681 <xsl:template name="construct-copy-destruct-reference">
682 <xsl:if test="constructor|copy-assignment|destructor">
683 <xsl:call-template name="member-documentation">
684 <xsl:with-param name="name">
685 <xsl:call-template name="anchor">
686 <xsl:with-param name="to">
687 <xsl:call-template name="generate.id"/>
688 <xsl:text>construct-copy-destruct</xsl:text>
690 <xsl:with-param name="text" select="''"/>
692 <xsl:call-template name="monospaced">
693 <xsl:with-param name="text">
694 <xsl:call-template name="object-name"/>
697 <xsl:text> </xsl:text>
698 <xsl:call-template name="access-name"/>
699 <xsl:text> construct/copy/destruct</xsl:text>
701 <xsl:with-param name="text">
703 <xsl:apply-templates select="constructor" mode="reference"/>
704 <xsl:apply-templates select="copy-assignment" mode="reference"/>
705 <xsl:apply-templates select="destructor" mode="reference"/>
712 <xsl:template match="constructor" mode="reference">
713 <xsl:call-template name="function.documentation">
714 <xsl:with-param name="text">
716 <xsl:call-template name="preformatted">
717 <xsl:with-param name="text">
718 <xsl:call-template name="function">
719 <xsl:with-param name="indentation" select="0"/>
720 <xsl:with-param name="is-reference" select="true()"/>
721 <xsl:with-param name="constructor-for">
722 <xsl:call-template name="object-name"/>
724 <xsl:with-param name="standalone" select="true()"/>
729 <xsl:call-template name="function-requirements"/>
734 <xsl:template match="copy-assignment" mode="reference">
735 <xsl:call-template name="function.documentation">
736 <xsl:with-param name="text">
738 <xsl:call-template name="preformatted">
739 <xsl:with-param name="text">
740 <xsl:call-template name="function">
741 <xsl:with-param name="indentation" select="0"/>
742 <xsl:with-param name="is-reference" select="true()"/>
743 <xsl:with-param name="copy-assign-for">
744 <xsl:call-template name="object-name"/>
746 <xsl:with-param name="standalone" select="true()"/>
751 <xsl:call-template name="function-requirements"/>
756 <xsl:template match="destructor" mode="reference">
757 <xsl:call-template name="function.documentation">
758 <xsl:with-param name="text">
760 <xsl:call-template name="preformatted">
761 <xsl:with-param name="text">
762 <xsl:call-template name="function">
763 <xsl:with-param name="indentation" select="0"/>
764 <xsl:with-param name="is-reference" select="true()"/>
765 <xsl:with-param name="destructor-for">
766 <xsl:call-template name="object-name"/>
768 <xsl:with-param name="standalone" select="true()"/>
773 <xsl:call-template name="function-requirements"/>
778 <!-- Templates for functions -->
779 <xsl:template name="function.documentation">
780 <xsl:param name="text"/>
782 <xsl:when test="count(ancestor::free-function-group) > 0
783 or count(ancestor::method-group) > 0
784 or local-name(.)='constructor'
785 or local-name(.)='copy-assignment'
786 or local-name(.)='destructor'">
787 <listitem><xsl:copy-of select="$text"/></listitem>
790 <xsl:copy-of select="$text"/>
795 <!-- Semantic descriptions of functions -->
796 <xsl:template name="function-requirements">
797 <xsl:param name="namespace-reference" select="false()"/>
799 <xsl:if test="$namespace-reference=false()">
800 <xsl:apply-templates select="purpose/*|purpose/text()"/>
803 <xsl:apply-templates select="description/*"/>
805 <xsl:if test="parameter/description|signature/parameter/description|
806 template/template-type-parameter/purpose|
807 template/template-nontype-parameter/purpose|
808 requires|effects|postconditions|returns|throws|complexity|
810 <variablelist spacing="compact">
811 <xsl:processing-instruction name="dbhtml">
812 list-presentation="table"
813 </xsl:processing-instruction>
815 <!-- Document parameters -->
816 <xsl:if test="parameter/description|signature/parameter/description">
818 <term>Parameters:</term>
820 <variablelist spacing="compact">
821 <xsl:processing-instruction name="dbhtml">
822 list-presentation="table"
823 </xsl:processing-instruction>
824 <xsl:for-each select="parameter|signature/parameter">
825 <xsl:sort select="attribute::name"/>
826 <xsl:if test="description">
829 <xsl:call-template name="monospaced">
830 <xsl:with-param name="text" select="@name"/>
834 <xsl:apply-templates select="description/*"/>
844 <!-- Document template parameters -->
845 <xsl:if test="template/template-type-parameter/purpose|
846 template/template-nontype-parameter/purpose">
848 <term>Template Parameters:</term>
850 <variablelist spacing="compact">
851 <xsl:processing-instruction name="dbhtml">
852 list-presentation="table"
853 </xsl:processing-instruction>
854 <xsl:for-each select="template/template-type-parameter|
855 template/template-nontype-parameter">
856 <xsl:sort select="attribute::name"/>
857 <xsl:if test="purpose">
860 <xsl:call-template name="monospaced">
861 <xsl:with-param name="text" select="@name"/>
865 <xsl:apply-templates select="purpose/*"/>
875 <!-- Document rest of function's contract -->
876 <xsl:for-each select="requires|effects|postconditions|returns|throws|complexity|
879 <term><xsl:call-template name="function.requirement.name"/>:</term>
881 <xsl:apply-templates select="./*|./text()" mode="annotation"/>
891 <xsl:text>Warning: Use of 'para' elements in a function is deprecated. </xsl:text>
892 <xsl:text> Wrap them in a 'description' element.</xsl:text>
894 <xsl:call-template name="print.warning.context"/>
895 <xsl:apply-templates select="para"/>
900 <xsl:template name="function.requirement.name">
901 <xsl:param name="node" select="."/>
903 <xsl:when test="local-name($node)='requires'">Requires</xsl:when>
904 <xsl:when test="local-name($node)='effects'">Effects</xsl:when>
905 <xsl:when test="local-name($node)='postconditions'">
906 <xsl:text>Postconditions</xsl:text>
908 <xsl:when test="local-name($node)='returns'">Returns</xsl:when>
909 <xsl:when test="local-name($node)='throws'">Throws</xsl:when>
910 <xsl:when test="local-name($node)='complexity'">Complexity</xsl:when>
911 <xsl:when test="local-name($node)='notes'">Notes</xsl:when>
912 <xsl:when test="local-name($node)='rationale'">Rationale</xsl:when>
915 <xsl:text>Error: unhandled node type `</xsl:text>
916 <xsl:value-of select="local-name($node)"/>
917 <xsl:text>' in template function.requirement.name.</xsl:text>
923 <!-- Function reference -->
924 <xsl:template match="function|method" mode="reference">
925 <!-- True if we should compact this function -->
926 <xsl:variable name="compact"
927 select="not (para|description|requires|effects|postconditions|returns|
928 throws|complexity|notes|rationale) and
929 ($boost.compact.function='1') and
930 not (local-name(.)='method')"/>
932 <xsl:if test="not ($compact)">
933 <xsl:call-template name="function.documentation">
934 <xsl:with-param name="text">
936 <xsl:call-template name="preformatted">
937 <xsl:with-param name="text">
938 <xsl:call-template name="function">
939 <xsl:with-param name="indentation" select="0"/>
940 <xsl:with-param name="is-reference" select="true()"/>
941 <xsl:with-param name="link-type" select="'anchor'"/>
942 <xsl:with-param name="standalone" select="true()"/>
947 <xsl:call-template name="function-requirements"/>
953 <!-- Reference for functions at namespace level -->
954 <xsl:template match="function" mode="namespace-reference">
955 <!-- True if we should compact this function -->
956 <xsl:variable name="compact"
957 select="not (para|description|requires|effects|postconditions|returns|
958 throws|complexity|notes|rationale) and
959 ($boost.compact.function='1')"/>
961 <xsl:if test="not ($compact)">
962 <xsl:call-template name="reference-documentation">
963 <xsl:with-param name="name">
964 <xsl:text>Function </xsl:text>
965 <xsl:if test="template">
966 <xsl:text>template </xsl:text>
968 <xsl:call-template name="monospaced">
969 <xsl:with-param name="text" select="@name"/>
972 <xsl:with-param name="refname">
973 <xsl:call-template name="fully-qualified-name">
974 <xsl:with-param name="node" select="."/>
977 <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
978 <xsl:with-param name="anchor">
979 <xsl:call-template name="generate.id"/>
981 <xsl:with-param name="synopsis">
982 <xsl:call-template name="header-link"/>
983 <xsl:call-template name="function">
984 <xsl:with-param name="indentation" select="0"/>
985 <xsl:with-param name="is-reference" select="true()"/>
986 <xsl:with-param name="link-type" select="'none'"/>
989 <xsl:with-param name="text">
990 <xsl:call-template name="function-requirements">
991 <xsl:with-param name="namespace-reference" select="true()"/>
998 <xsl:template match="overloaded-function" mode="reference">
999 <xsl:variable name="name" select="@name"/>
1001 <!-- True if we should compact this function -->
1002 <xsl:variable name="compact"
1003 select="not (para|description|requires|effects|postconditions|returns|
1004 throws|complexity|notes|rationale) and
1005 ($boost.compact.function='1')"/>
1007 <xsl:if test="not ($compact)">
1008 <xsl:call-template name="function.documentation">
1009 <xsl:with-param name="text">
1011 <xsl:attribute name="id">
1012 <xsl:call-template name="generate.id"/>
1015 <xsl:call-template name="preformatted">
1016 <xsl:with-param name="text">
1017 <xsl:for-each select="signature">
1018 <xsl:call-template name="function">
1019 <xsl:with-param name="indentation" select="0"/>
1020 <xsl:with-param name="is-reference" select="true()"/>
1021 <xsl:with-param name="name" select="$name"/>
1022 <xsl:with-param name="standalone" select="true()"/>
1023 </xsl:call-template>
1026 </xsl:call-template>
1028 <xsl:call-template name="function-requirements"/>
1030 </xsl:call-template>
1034 <xsl:template match="overloaded-function" mode="namespace-reference">
1035 <!-- True if we should compact this function -->
1036 <xsl:variable name="compact"
1037 select="not (para|description|requires|effects|postconditions|returns|
1038 throws|complexity|notes|rationale) and
1039 ($boost.compact.function='1')"/>
1041 <xsl:variable name="name" select="@name"/>
1043 <xsl:if test="not ($compact)">
1044 <xsl:call-template name="reference-documentation">
1045 <xsl:with-param name="name">
1046 <xsl:text>Function </xsl:text>
1047 <xsl:if test="template">
1048 <xsl:text>template </xsl:text>
1050 <xsl:call-template name="monospaced">
1051 <xsl:with-param name="text" select="@name"/>
1052 </xsl:call-template>
1054 <xsl:with-param name="refname">
1055 <xsl:call-template name="fully-qualified-name">
1056 <xsl:with-param name="node" select="."/>
1057 </xsl:call-template>
1059 <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
1060 <xsl:with-param name="anchor">
1061 <xsl:call-template name="generate.id"/>
1063 <xsl:with-param name="synopsis">
1064 <xsl:call-template name="header-link"/>
1065 <xsl:for-each select="signature">
1066 <xsl:call-template name="function">
1067 <xsl:with-param name="indentation" select="0"/>
1068 <xsl:with-param name="is-reference" select="true()"/>
1069 <xsl:with-param name="link-type" select="'none'"/>
1070 <xsl:with-param name="name" select="$name"/>
1071 </xsl:call-template>
1074 <xsl:with-param name="text">
1075 <xsl:call-template name="function-requirements">
1076 <xsl:with-param name="namespace-reference" select="true()"/>
1077 </xsl:call-template>
1079 </xsl:call-template>
1083 <xsl:template match="overloaded-method" mode="reference">
1084 <xsl:variable name="name" select="@name"/>
1086 <xsl:call-template name="function.documentation">
1087 <xsl:with-param name="text">
1089 <xsl:call-template name="preformatted">
1090 <xsl:with-param name="text">
1091 <xsl:call-template name="anchor">
1092 <xsl:with-param name="to">
1093 <xsl:call-template name="generate.id"/>
1095 </xsl:call-template>
1096 <xsl:for-each select="signature">
1097 <xsl:call-template name="function">
1098 <xsl:with-param name="indentation" select="0"/>
1099 <xsl:with-param name="is-reference" select="true()"/>
1100 <xsl:with-param name="name" select="$name"/>
1101 <xsl:with-param name="standalone" select="true()"/>
1102 </xsl:call-template>
1105 </xsl:call-template>
1107 <xsl:call-template name="function-requirements"/>
1109 </xsl:call-template>
1112 <!-- Group member functions together under a category name (synopsis)-->
1113 <xsl:template match="method-group" mode="synopsis">
1114 <xsl:param name="indentation"/>
1115 <xsl:if test="count(child::*) > 0">
1116 <xsl:text> </xsl:text>
1117 <xsl:text> </xsl:text>
1118 <xsl:call-template name="indent">
1119 <xsl:with-param name="indentation" select="$indentation"/>
1120 </xsl:call-template>
1121 <xsl:call-template name="highlight-comment">
1122 <xsl:with-param name="text">
1123 <xsl:text>// </xsl:text>
1124 <xsl:call-template name="internal-link">
1125 <xsl:with-param name="to">
1126 <xsl:call-template name="generate.id"/>
1128 <xsl:with-param name="text" select="string(@name)"/>
1129 </xsl:call-template>
1131 </xsl:call-template>
1132 <xsl:apply-templates select="method|overloaded-method"
1134 <xsl:with-param name="indentation" select="$indentation"/>
1135 </xsl:apply-templates>
1139 <!-- Group member functions together under a category name (reference)-->
1140 <xsl:template match="method-group" mode="reference">
1141 <xsl:if test="count(child::*) > 0">
1142 <xsl:call-template name="member-documentation">
1143 <xsl:with-param name="name">
1144 <xsl:call-template name="anchor">
1145 <xsl:with-param name="to">
1146 <xsl:call-template name="generate.id"/>
1148 <xsl:with-param name="text" select="''"/>
1149 </xsl:call-template>
1150 <xsl:call-template name="monospaced">
1151 <xsl:with-param name="text">
1152 <xsl:call-template name="object-name"/>
1154 </xsl:call-template>
1155 <xsl:text> </xsl:text>
1156 <xsl:value-of select="@name"/>
1158 <xsl:with-param name="text">
1160 <xsl:apply-templates select="method|overloaded-method"
1164 </xsl:call-template>
1168 <!-- Group free functions together under a category name (synopsis)-->
1169 <xsl:template match="free-function-group" mode="synopsis">
1170 <xsl:param name="class"/>
1171 <xsl:param name="indentation"/>
1172 <xsl:text> </xsl:text>
1173 <xsl:text> </xsl:text>
1174 <xsl:call-template name="indent">
1175 <xsl:with-param name="indentation" select="$indentation"/>
1176 </xsl:call-template>
1177 <xsl:call-template name="highlight-comment">
1178 <xsl:with-param name="text">
1179 <xsl:text>// </xsl:text>
1180 <xsl:call-template name="internal-link">
1181 <xsl:with-param name="to">
1182 <xsl:call-template name="generate.id"/>
1184 <xsl:with-param name="text" select="string(@name)"/>
1185 </xsl:call-template>
1187 </xsl:call-template>
1188 <xsl:apply-templates select="function|overloaded-function" mode="synopsis">
1189 <xsl:with-param name="indentation" select="$indentation"/>
1190 </xsl:apply-templates>
1193 <!-- Group free functions together under a category name (reference)-->
1194 <xsl:template match="free-function-group" mode="reference">
1195 <xsl:param name="class"/>
1196 <xsl:call-template name="member-documentation">
1197 <xsl:with-param name="name">
1198 <xsl:call-template name="anchor">
1199 <xsl:with-param name="to">
1200 <xsl:call-template name="generate.id"/>
1202 <xsl:with-param name="text" select="''"/>
1203 </xsl:call-template>
1204 <xsl:call-template name="monospaced">
1205 <xsl:with-param name="text" select="$class"/>
1206 </xsl:call-template>
1207 <xsl:value-of select="concat(' ',@name)"/>
1209 <xsl:with-param name="text">
1211 <xsl:apply-templates select="function|overloaded-function"
1215 </xsl:call-template>