/usr/share/boostbook/xsl/function.xsl is in libboost1.62-tools-dev 1.62.0+dfsg-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | <?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:strip-space elements="requires effects postconditions returns throws
complexity notes rationale purpose"/>
<!-- When true, the stylesheet will emit compact definitions of
functions when the function does not have any detailed
description. -->
<xsl:param name="boost.compact.function">1</xsl:param>
<!-- The longest type length that is considered "short" for the
layout of function return types. When the length of the result type
and any storage specifiers is greater than this length, they will be
placed on a separate line from the function name and parameters
unless everything fits on a single line. -->
<xsl:param name="boost.short.result.type">12</xsl:param>
<!-- Display a function declaration -->
<xsl:template name="function">
<xsl:param name="indentation"/>
<xsl:param name="is-reference"/>
<!-- Whether or not we should include parameter names in the output -->
<xsl:param name="include-names" select="$is-reference"/>
<!-- What type of link the function name should have. This shall
be one of 'anchor' (the function output will be the target of
links), 'link' (the function output will link to a definition), or
'none' (the function output will not be either a link or a link
target) -->
<xsl:param name="link-type">
<xsl:choose>
<xsl:when test="$is-reference">
<xsl:text>anchor</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>link</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<!-- The id we should link to or anchor as -->
<xsl:param name="link-to">
<xsl:call-template name="generate.id"/>
</xsl:param>
<!-- If we are printing a constructor -->
<xsl:param name="constructor-for"/>
<!-- If we are printing a destructor -->
<xsl:param name="destructor-for"/>
<!-- If we are printing a copy assignment operator -->
<xsl:param name="copy-assign-for"/>
<!-- The name of this function -->
<xsl:param name="name" select="@name"/>
<!-- True if this is the function's separate documentation -->
<xsl:param name="standalone" select="false()"/>
<!-- True if we should suppress the template header -->
<xsl:param name="suppress-template" select="false()"/>
<!-- Calculate the specifiers -->
<xsl:variable name="specifiers">
<xsl:if test="@specifiers">
<xsl:value-of select="concat(@specifiers, ' ')"/>
</xsl:if>
</xsl:variable>
<!-- Calculate the type -->
<xsl:variable name="type">
<xsl:value-of select="$specifiers"/>
<xsl:choose>
<!-- Conversion operators have an empty type, because the return
type is part of the name -->
<xsl:when test="$name='conversion-operator'"/>
<!-- Constructors and destructors have no return type -->
<xsl:when test="$constructor-for or $destructor-for"/>
<!-- Copy assignment operators return a reference to the class
they are in, unless another type has been explicitly
provided in the element. -->
<xsl:when test="$copy-assign-for and not(type)">
<xsl:value-of select="concat($copy-assign-for, '& ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="type" mode="annotation"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Build the function name with return type -->
<xsl:variable name="function-name">
<xsl:choose>
<xsl:when test="$constructor-for">
<xsl:value-of select="$constructor-for"/>
</xsl:when>
<xsl:when test="$destructor-for">
<xsl:value-of select="concat('~',$destructor-for)"/>
</xsl:when>
<xsl:when test="$copy-assign-for">
<xsl:value-of select="'operator='"/>
</xsl:when>
<xsl:when test="$name='conversion-operator'">
<xsl:text>operator </xsl:text>
<xsl:apply-templates select="type" mode="annotation"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="not ($standalone) or
(local-name(.)='signature' and (position() > 1))
or $suppress-template">
<xsl:text> </xsl:text>
</xsl:if>
<!-- Indent this declaration -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<!-- Build the template header -->
<xsl:variable name="template-length">
<xsl:choose>
<xsl:when test="$suppress-template">
0
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="template.synopsis.length"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Build a full parameter string (without line breaks) -->
<xsl:variable name="param-string">
<xsl:text>(</xsl:text>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="wrap" select="false()"/>
</xsl:call-template>
<xsl:text>)</xsl:text>
</xsl:variable>
<!-- Build the text that follows the declarator-->
<xsl:variable name="postdeclarator">
<xsl:if test="@cv and @cv != ''">
<xsl:text> </xsl:text>
<xsl:value-of select="@cv"/>
</xsl:if>
</xsl:variable>
<!-- Build the full declaration text -->
<xsl:variable name="decl-string"
select="concat($type, $function-name, $param-string, $postdeclarator)"/>
<xsl:variable name="end-column"
select="$template-length + string-length($decl-string) + $indentation"/>
<xsl:choose>
<!-- Check if we should put the template header on its own line to
save horizontal space. -->
<xsl:when test="($template-length > 0) and
($end-column > $max-columns)">
<!-- Emit template header on its own line -->
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<!-- Emit the rest of the function declaration (without the
template header) indented two extra spaces. -->
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation + 2"/>
<xsl:with-param name="is-reference" select="$is-reference"/>
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="link-to" select="$link-to"/>
<xsl:with-param name="constructor-for" select="$constructor-for"/>
<xsl:with-param name="destructor-for" select="$destructor-for"/>
<xsl:with-param name="copy-assign-for" select="$copy-assign-for"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="standalone" select="$standalone"/>
<xsl:with-param name="suppress-template" select="true()"/>
</xsl:call-template>
</xsl:when>
<!-- Check if we can put the entire declaration on a single
line. -->
<xsl:when test="not($end-column > $max-columns)">
<!-- Emit template header, if not suppressed -->
<xsl:if test="not($suppress-template)">
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="false()"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</xsl:if>
<!-- Emit specifiers -->
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$specifiers"/>
</xsl:call-template>
<!-- Emit type, if any -->
<xsl:choose>
<!-- Conversion operators have an empty type, because the return
type is part of the name -->
<xsl:when test="$name='conversion-operator'"/>
<!-- Constructors and destructors have no return type -->
<xsl:when test="$constructor-for or $destructor-for"/>
<!-- Copy assignment operators return a reference to the class
they are in, unless another type has been explicitly
provided in the element. -->
<xsl:when test="$copy-assign-for and not(type)">
<xsl:value-of select="concat($copy-assign-for, '& ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="type" mode="highlight"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to" select="$link-to"/>
<xsl:with-param name="text" select="$function-name"/>
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="'('"/>
</xsl:call-template>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="indentation"
select="$indentation + $template-length + string-length($type)
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="')'"/>
</xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="';'"/>
</xsl:call-template>
</xsl:when>
<!-- This declaration will take multiple lines -->
<xsl:otherwise>
<!-- Emit specifiers -->
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$specifiers"/>
</xsl:call-template>
<!-- Emit type, if any -->
<xsl:choose>
<!-- Conversion operators have an empty type, because the return
type is part of the name -->
<xsl:when test="$name='conversion-operator'"/>
<!-- Constructors and destructors have no return type -->
<xsl:when test="$constructor-for or $destructor-for"/>
<!-- Copy assignment operators return a reference to the class
they are in, unless another type has been explicitly
provided in the element. -->
<xsl:when test="$copy-assign-for and not(type)">
<xsl:value-of select="concat($copy-assign-for, '& ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="type" mode="highlight"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length($type) > $boost.short.result.type">
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:if>
<!-- Determine how many columns the type and storage
specifiers take on the same line as the function name. -->
<xsl:variable name="type-length">
<xsl:choose>
<xsl:when test="string-length($type) > $boost.short.result.type">
0
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string-length($type)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to" select="$link-to"/>
<xsl:with-param name="text" select="$function-name"/>
<xsl:with-param name="link-type" select="$link-type"/>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="'('"/>
</xsl:call-template>
<xsl:call-template name="function-parameters">
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="indentation"
select="$indentation + $type-length
+ string-length($function-name) + 1"/>
<xsl:with-param name="final" select="true()"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="')'"/>
</xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$postdeclarator"/>
</xsl:call-template>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="';'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
<xsl:template name="function-parameters">
<!-- Indentation level of this parameter list -->
<xsl:param name="indentation"/>
<!-- True if we should include parameter names -->
<xsl:param name="include-names" select="true()"/>
<!-- True if we should wrap function parameters to the next line -->
<xsl:param name="wrap" select="true()"/>
<!-- True if we are printing the final output -->
<xsl:param name="final" select="false()"/>
<!-- Internal: The prefix to emit before a parameter -->
<xsl:param name="prefix" select="''"/>
<!-- Internal: The list of parameters -->
<xsl:param name="parameters" select="parameter"/>
<!-- Internal: The column we are on -->
<xsl:param name="column" select="$indentation"/>
<!-- Internal: Whether this is the first parameter on this line or not -->
<xsl:param name="first-on-line" select="true()"/>
<xsl:if test="$parameters">
<!-- Information for this parameter -->
<xsl:variable name="parameter" select="$parameters[position()=1]"/>
<xsl:variable name="pack">
<xsl:if test="$parameter/@pack=1">
<xsl:choose>
<xsl:when test="$final">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="'...'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>...</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="$include-names and $parameter/@name != ''">
<xsl:text> </xsl:text><xsl:value-of select="$parameter/@name"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="type" select="string($parameter/paramtype)"/>
<xsl:variable name="default">
<xsl:choose>
<xsl:when test="$parameter/@default">
<xsl:choose>
<xsl:when test="$final">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="concat(' = ', $parameter/@default)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text> = </xsl:text>
<xsl:value-of select="$parameter/@default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$parameter/default">
<xsl:choose>
<xsl:when test="$final">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="' = '"/>
</xsl:call-template>
<xsl:apply-templates
select="$parameter/default/*|$parameter/default/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:text> = </xsl:text>
<xsl:value-of select="string($parameter/default)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="text" select="concat($type, $pack, $name, $default)"/>
<xsl:variable name="end-column"
select="$column + string-length($prefix) + string-length($text)"/>
<xsl:choose>
<!-- Parameter goes on this line -->
<xsl:when test="$first-on-line or ($end-column < $max-columns)
or not($wrap)">
<xsl:choose>
<xsl:when test="$final">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="$prefix"/>
</xsl:call-template>
<xsl:apply-templates
select="$parameter/paramtype/*|$parameter/paramtype/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
<xsl:copy-of select="$pack"/>
<xsl:value-of select="$name"/>
<xsl:copy-of select="$default"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($prefix, $text)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="function-parameters">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="final" select="$final"/>
<xsl:with-param name="parameters"
select="$parameters[position()!=1]"/>
<xsl:with-param name="prefix" select="', '"/>
<xsl:with-param name="column" select="$end-column"/>
<xsl:with-param name="first-on-line" select="false()"/>
</xsl:call-template>
</xsl:when>
<!-- Parameter goes on next line -->
<xsl:otherwise>
<!-- The comma goes on this line -->
<xsl:choose>
<xsl:when test="$final">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="$prefix"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$prefix"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<!-- Indent and print the parameter -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$final">
<xsl:apply-templates
select="$parameter/paramtype/*|$parameter/paramtype/text()"
mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
<xsl:copy-of select="$pack"/>
<xsl:value-of select="$name"/>
<xsl:copy-of select="$default"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($prefix, $text)"/>
</xsl:otherwise>
</xsl:choose>
<!-- Emit next parameter -->
<xsl:call-template name="function-parameters">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="include-names" select="$include-names"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="final" select="$final"/>
<xsl:with-param name="parameters"
select="$parameters[position()!=1]"/>
<xsl:with-param name="prefix" select="', '"/>
<xsl:with-param name="column"
select="1 + string-length($text) + $indentation"/>
<xsl:with-param name="first-on-line" select="false()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Function synopsis -->
<xsl:template match="function|method" mode="synopsis">
<xsl:param name="indentation"/>
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='method')"/>
<xsl:choose>
<xsl:when test="$compact">
<xsl:if test="purpose">
<!-- Compact display outputs the purpose as a comment (if
there is one) and the entire function declaration. -->
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:apply-templates select="purpose/*|purpose/text()"
mode="purpose"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="is-reference" select="true()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="is-reference" select="false()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="overloaded-function|overloaded-method" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:variable name="name" select="@name"/>
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='overloaded-method')"/>
<xsl:choose>
<xsl:when test="$compact">
<xsl:if test="purpose">
<!-- Compact display outputs the purpose as a comment (if
there is one) and the entire function declaration. -->
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:apply-templates select="purpose" mode="annotation"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="local-name(..)='namespace'">
<xsl:variable name="link-to">
<xsl:call-template name="generate.id"/>
</xsl:variable>
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="is-reference" select="false()"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="link-to" select="$link-to"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="is-reference" select="false()"/>
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Group free functions together under a category name (header synopsis)-->
<xsl:template match="free-function-group" mode="header-synopsis">
<xsl:param name="class"/>
<xsl:param name="indentation"/>
<xsl:apply-templates select="function|overloaded-function" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
</xsl:template>
<!-- Constructors, destructor, and assignment operators -->
<xsl:template name="construct-copy-destruct-synopsis">
<xsl:param name="indentation"/>
<xsl:if test="constructor|copy-assignment|destructor">
<xsl:if test="typedef|static-constant">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
<xsl:text>construct-copy-destruct</xsl:text>
</xsl:with-param>
<xsl:with-param name="text" select="'construct/copy/destruct'"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="constructor" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:apply-templates select="copy-assignment" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:apply-templates select="destructor" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template name="construct-copy-destruct-reference">
<xsl:if test="constructor|copy-assignment|destructor">
<xsl:call-template name="member-documentation">
<xsl:with-param name="name">
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
<xsl:text>construct-copy-destruct</xsl:text>
</xsl:with-param>
<xsl:with-param name="text" select="''"/>
</xsl:call-template>
<xsl:call-template name="monospaced">
<xsl:with-param name="text">
<xsl:call-template name="object-name"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="access-name"/>
<xsl:text> construct/copy/destruct</xsl:text>
</xsl:with-param>
<xsl:with-param name="text">
<orderedlist>
<xsl:apply-templates select="constructor" mode="reference"/>
<xsl:apply-templates select="copy-assignment" mode="reference"/>
<xsl:apply-templates select="destructor" mode="reference"/>
</orderedlist>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="constructor" mode="reference">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="constructor-for">
<xsl:call-template name="object-name"/>
</xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="copy-assignment" mode="reference">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="copy-assign-for">
<xsl:call-template name="object-name"/>
</xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="destructor" mode="reference">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="destructor-for">
<xsl:call-template name="object-name"/>
</xsl:with-param>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Templates for functions -->
<xsl:template name="function.documentation">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="count(ancestor::free-function-group) > 0
or count(ancestor::method-group) > 0
or local-name(.)='constructor'
or local-name(.)='copy-assignment'
or local-name(.)='destructor'">
<listitem><xsl:copy-of select="$text"/></listitem>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Semantic descriptions of functions -->
<xsl:template name="function-requirements">
<xsl:param name="namespace-reference" select="false()"/>
<xsl:if test="$namespace-reference=false()">
<xsl:apply-templates select="purpose/*|purpose/text()"/>
</xsl:if>
<xsl:apply-templates select="description/*"/>
<xsl:if test="parameter/description|signature/parameter/description|
template/template-type-parameter/purpose|
template/template-nontype-parameter/purpose|
requires|effects|postconditions|returns|throws|complexity|
notes|rationale">
<variablelist spacing="compact">
<xsl:processing-instruction name="dbhtml">
list-presentation="table"
</xsl:processing-instruction>
<!-- Document parameters -->
<xsl:if test="parameter/description|signature/parameter/description">
<varlistentry>
<term>Parameters:</term>
<listitem>
<variablelist spacing="compact">
<xsl:processing-instruction name="dbhtml">
list-presentation="table"
</xsl:processing-instruction>
<xsl:for-each select="parameter|signature/parameter">
<xsl:sort select="attribute::name"/>
<xsl:if test="description">
<varlistentry>
<term>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</term>
<listitem>
<xsl:apply-templates select="description/*"/>
</listitem>
</varlistentry>
</xsl:if>
</xsl:for-each>
</variablelist>
</listitem>
</varlistentry>
</xsl:if>
<!-- Document template parameters -->
<xsl:if test="template/template-type-parameter/purpose|
template/template-nontype-parameter/purpose">
<varlistentry>
<term>Template Parameters:</term>
<listitem>
<variablelist spacing="compact">
<xsl:processing-instruction name="dbhtml">
list-presentation="table"
</xsl:processing-instruction>
<xsl:for-each select="template/template-type-parameter|
template/template-nontype-parameter">
<xsl:sort select="attribute::name"/>
<xsl:if test="purpose">
<varlistentry>
<term>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</term>
<listitem>
<xsl:apply-templates select="purpose/*"/>
</listitem>
</varlistentry>
</xsl:if>
</xsl:for-each>
</variablelist>
</listitem>
</varlistentry>
</xsl:if>
<!-- Document rest of function's contract -->
<xsl:for-each select="requires|effects|postconditions|returns|throws|complexity|
notes|rationale">
<varlistentry>
<term><xsl:call-template name="function.requirement.name"/>:</term>
<listitem>
<xsl:apply-templates select="./*|./text()" mode="annotation"/>
</listitem>
</varlistentry>
</xsl:for-each>
</variablelist>
</xsl:if>
<xsl:if test="para">
<xsl:message>
<xsl:text>Warning: Use of 'para' elements in a function is deprecated. </xsl:text>
<xsl:text> Wrap them in a 'description' element.</xsl:text>
</xsl:message>
<xsl:call-template name="print.warning.context"/>
<xsl:apply-templates select="para"/>
</xsl:if>
</xsl:template>
<xsl:template name="function.requirement.name">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="local-name($node)='requires'">Requires</xsl:when>
<xsl:when test="local-name($node)='effects'">Effects</xsl:when>
<xsl:when test="local-name($node)='postconditions'">
<xsl:text>Postconditions</xsl:text>
</xsl:when>
<xsl:when test="local-name($node)='returns'">Returns</xsl:when>
<xsl:when test="local-name($node)='throws'">Throws</xsl:when>
<xsl:when test="local-name($node)='complexity'">Complexity</xsl:when>
<xsl:when test="local-name($node)='notes'">Notes</xsl:when>
<xsl:when test="local-name($node)='rationale'">Rationale</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Error: unhandled node type `</xsl:text>
<xsl:value-of select="local-name($node)"/>
<xsl:text>' in template function.requirement.name.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Function reference -->
<xsl:template match="function|method" mode="reference">
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1') and
not (local-name(.)='method')"/>
<xsl:if test="not ($compact)">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="link-type" select="'anchor'"/>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Reference for functions at namespace level -->
<xsl:template match="function" mode="namespace-reference">
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
<xsl:if test="not ($compact)">
<xsl:call-template name="reference-documentation">
<xsl:with-param name="name">
<xsl:text>Function </xsl:text>
<xsl:if test="template">
<xsl:text>template </xsl:text>
</xsl:if>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="refname">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="synopsis">
<xsl:call-template name="header-link"/>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="link-type" select="'none'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:call-template name="function-requirements">
<xsl:with-param name="namespace-reference" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="overloaded-function" mode="reference">
<xsl:variable name="name" select="@name"/>
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
<xsl:if test="not ($compact)">
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:attribute name="id">
<xsl:call-template name="generate.id"/>
</xsl:attribute>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="overloaded-function" mode="namespace-reference">
<!-- True if we should compact this function -->
<xsl:variable name="compact"
select="not (para|description|requires|effects|postconditions|returns|
throws|complexity|notes|rationale) and
($boost.compact.function='1')"/>
<xsl:variable name="name" select="@name"/>
<xsl:if test="not ($compact)">
<xsl:call-template name="reference-documentation">
<xsl:with-param name="name">
<xsl:text>Function </xsl:text>
<xsl:if test="template">
<xsl:text>template </xsl:text>
</xsl:if>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="refname">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="synopsis">
<xsl:call-template name="header-link"/>
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="link-type" select="'none'"/>
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:for-each>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:call-template name="function-requirements">
<xsl:with-param name="namespace-reference" select="true()"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="overloaded-method" mode="reference">
<xsl:variable name="name" select="@name"/>
<xsl:call-template name="function.documentation">
<xsl:with-param name="text">
<para>
<xsl:call-template name="preformatted">
<xsl:with-param name="text">
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
</xsl:call-template>
<xsl:for-each select="signature">
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="is-reference" select="true()"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="standalone" select="true()"/>
</xsl:call-template>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</para>
<xsl:call-template name="function-requirements"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Group member functions together under a category name (synopsis)-->
<xsl:template match="method-group" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:if test="count(child::*) > 0">
<xsl:text> </xsl:text>
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<!-- Group member functions together under a category name (reference)-->
<xsl:template match="method-group" mode="reference">
<xsl:if test="count(child::*) > 0">
<xsl:call-template name="member-documentation">
<xsl:with-param name="name">
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="text" select="''"/>
</xsl:call-template>
<xsl:call-template name="monospaced">
<xsl:with-param name="text">
<xsl:call-template name="object-name"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
</xsl:with-param>
<xsl:with-param name="text">
<orderedlist>
<xsl:apply-templates select="method|overloaded-method"
mode="reference"/>
</orderedlist>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Group free functions together under a category name (synopsis)-->
<xsl:template match="free-function-group" mode="synopsis">
<xsl:param name="class"/>
<xsl:param name="indentation"/>
<xsl:text> </xsl:text>
<xsl:text> </xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="function|overloaded-function" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
</xsl:template>
<!-- Group free functions together under a category name (reference)-->
<xsl:template match="free-function-group" mode="reference">
<xsl:param name="class"/>
<xsl:call-template name="member-documentation">
<xsl:with-param name="name">
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="text" select="''"/>
</xsl:call-template>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="$class"/>
</xsl:call-template>
<xsl:value-of select="concat(' ',@name)"/>
</xsl:with-param>
<xsl:with-param name="text">
<orderedlist>
<xsl:apply-templates select="function|overloaded-function"
mode="reference"/>
</orderedlist>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
|