-
Notifications
You must be signed in to change notification settings - Fork 33
/
doxygen2boostbook.xsl
1846 lines (1640 loc) · 66.3 KB
/
doxygen2boostbook.xsl
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
<?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:import href="../lookup.xsl"/>
<!-- Set this parameter to a space-separated list of headers that
will be included in the output (all others are ignored). If this
parameter is omitted or left as the empty string, all headers will
be output. -->
<xsl:param name="boost.doxygen.headers" select="''"/>
<!-- The common prefix to all headers -->
<xsl:param name="boost.doxygen.header.prefix" select="'boost'"/>
<!-- The text that Doxygen places in overloaded functions. Damn them
for forcing us to compare TEXT just to figure out what's overloaded
and what isn't. -->
<xsl:param name="boost.doxygen.overload">
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
</xsl:param>
<!-- The namespace used to identify code that should not be
processed at all. -->
<xsl:param name="boost.doxygen.detailns">detail</xsl:param>
<!-- The substring used to identify unspecified types that we can't
mask from within Doxygen. This is a hack (big surprise). -->
<xsl:param name="boost.doxygen.detail"><xsl:value-of select="$boost.doxygen.detailns"/>::</xsl:param>
<!-- The title that will be used for the BoostBook library reference emitted.
If left blank, BoostBook will assign a default title. -->
<xsl:param name="boost.doxygen.reftitle" select="''"/>
<!-- The id used for the library-reference. By default, it is the normalized
form of the reftitle. -->
<xsl:param name="boost.doxygen.refid" select="''"/>
<!-- The directory into which png files corresponding to LaTeX formulas will be found. -->
<xsl:param name="boost.doxygen.formuladir" select="'images/'"/>
<xsl:output method="xml" indent="no" standalone="yes"/>
<xsl:key name="compounds-by-kind" match="compounddef" use="@kind"/>
<xsl:key name="compounds-by-id" match="compounddef" use="@id"/>
<xsl:key name="members-by-id" match="memberdef" use="@id" />
<!-- Add trailing slash to formuladir if missing -->
<xsl:variable name="boost.doxygen.formuladir.fixed">
<xsl:choose>
<xsl:when test="substring(boost.doxygen.formuladir, string-length(boost.doxygen.formuladir) - 1) = '/'">
<xsl:value-of select="$boost.doxygen.formuladir" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($boost.doxygen.formuladir, '/')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:strip-space elements="briefdescription detaileddescription inbodydescription"/>
<xsl:template name="kind-error-message">
<xsl:param name="message"/>
<xsl:variable name="location" select=".//location[1]" />
<xsl:variable name="name" select="./name" />
<xsl:message>
<xsl:if test="$location">
<xsl:value-of select="concat($location/@file, ':', $location/@line, ': ')" />
</xsl:if>
<xsl:value-of select="concat($message, ' with kind=', @kind)" />
<xsl:if test="$name">
<xsl:value-of select="concat(' (name=', $name, ') ')" />
</xsl:if>
</xsl:message>
</xsl:template>
<!-- translate-name: given a string, return a string suitable for use as a refid -->
<xsl:template name="translate-name">
<xsl:param name="name"/>
<xsl:value-of select="translate($name,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ ~!%^&*()[].,<>|/ +-=',
'abcdefghijklmnopqrstuvwxyz_____________________')"/>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="doxygen"/>
</xsl:template>
<xsl:template match="doxygen">
<library-reference>
<xsl:if test="string($boost.doxygen.reftitle) != ''">
<!-- when a reference section has a reftitle, also give it a refid. The id
is determined by the boost.doxygen.refid param, which defaults to a
normalized form of the boost.doxygen.reftitle -->
<xsl:attribute name="id">
<xsl:choose>
<xsl:when test="string($boost.doxygen.refid) != ''">
<xsl:value-of select="$boost.doxygen.refid"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="translate-name">
<xsl:with-param name="name" select="$boost.doxygen.reftitle"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<title><xsl:copy-of select="$boost.doxygen.reftitle"/></title>
</xsl:if>
<xsl:apply-templates select="key('compounds-by-kind', 'file')"/>
</library-reference>
</xsl:template>
<xsl:template match="compounddef">
<!-- The set of innernamespace nodes that limits our search -->
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:choose>
<!-- If the string INTERNAL ONLY is in the description, don't
emit this entity. This hack is necessary because Doxygen doesn't
tell us what is \internal and what isn't. -->
<xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="@kind='file'">
<xsl:call-template name="file"/>
</xsl:when>
<xsl:when test="@kind='namespace'">
<xsl:call-template name="namespace">
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='class'">
<xsl:call-template name="class">
<xsl:with-param name="class-key" select="'class'"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='struct'">
<xsl:call-template name="class">
<xsl:with-param name="class-key" select="'struct'"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='union'">
<xsl:call-template name="class">
<xsl:with-param name="class-key" select="'union'"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="kind-error-message">
<xsl:with-param name="message" select="'Cannot handle compounddef'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="namespace">
<!-- The set of innernamespace nodes that limits our search -->
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:variable name="fullname" select="string(compoundname)"/>
<xsl:if test="$with-namespace-refs[string(text())=$fullname]
and not(contains($fullname, $boost.doxygen.detailns))">
<!-- Namespace without the prefix -->
<xsl:variable name="rest">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="compoundname"/>
</xsl:call-template>
</xsl:variable>
<!-- Grab only the namespace name, not any further nested namespaces -->
<xsl:variable name="name">
<xsl:choose>
<xsl:when
test="contains($rest, '::')">
<xsl:value-of select="substring-before($rest, '::')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$rest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<namespace>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</namespace>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
<xsl:template name="class">
<xsl:param name="class-key"/>
<xsl:param name="in-file"/>
<xsl:param name="with-namespace-refs"/>
<xsl:if test="string(location/attribute::file)=$in-file">
<!-- The short name of this class -->
<xsl:variable name="name-with-spec">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="compoundname"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="contains($name-with-spec, '<')">
<xsl:value-of select="substring-before($name-with-spec, '<')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$name-with-spec"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="specialization">
<xsl:if test="contains($name-with-spec, '<')">
<xsl:variable name="spec-with-gt"
select="substring-after($name-with-spec, '<')"/>
<xsl:value-of select="substring($spec-with-gt, 1,
string-length($spec-with-gt)-1)"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="actual-class-key">
<xsl:value-of select="$class-key"/>
<xsl:if test="string-length($specialization) > 0">
<xsl:text>-specialization</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:element name="{$actual-class-key}">
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:apply-templates select="templateparamlist" mode="template"/>
<xsl:if test="string-length($specialization) > 0">
<specialization>
<xsl:call-template name="specialization">
<xsl:with-param name="specialization" select="$specialization"/>
</xsl:call-template>
</specialization>
</xsl:if>
<xsl:apply-templates select="basecompoundref" mode="inherit"/>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template name="enum">
<xsl:param name="in-file"/>
<xsl:if test="string(location/attribute::file)=$in-file">
<xsl:variable name="name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="name"/>
</xsl:call-template>
</xsl:variable>
<enum>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:apply-templates select="enumvalue"/>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</enum>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
<xsl:template match="enumvalue">
<xsl:choose>
<!-- If the string INTERNAL ONLY is in the description, don't
emit this entity. This hack is necessary because Doxygen doesn't
tell us what is \internal and what isn't. -->
<xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/>
<xsl:otherwise>
<enumvalue>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:if test="initializer">
<default>
<xsl:apply-templates select="initializer/*|initializer/text()" mode="passthrough"/>
</default>
</xsl:if>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</enumvalue>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="doxygen.include.header.rec">
<xsl:param name="name"/>
<xsl:param name="header-list" select="$boost.doxygen.headers"/>
<xsl:choose>
<xsl:when test="contains($header-list, ' ')">
<xsl:variable name="header"
select="substring-before($header-list, ' ')"/>
<xsl:variable name="rest" select="substring-after($header-list, ' ')"/>
<xsl:choose>
<xsl:when test="$name=$header">
<xsl:text>yes</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="doxygen.include.header.rec">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="header-list" select="$rest"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$name=$header-list">
<xsl:text>yes</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="doxygen.include.header">
<xsl:param name="name"/>
<xsl:if test="$boost.doxygen.headers=''">
<xsl:text>yes</xsl:text>
</xsl:if>
<xsl:if test="not($boost.doxygen.headers='')">
<xsl:call-template name="doxygen.include.header.rec">
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="file">
<xsl:variable name="include-header">
<xsl:call-template name="doxygen.include.header">
<xsl:with-param name="name" select="string(compoundname)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$include-header='yes'">
<header>
<xsl:attribute name="name">
<xsl:call-template name="shorten.header.name">
<xsl:with-param name="header" select="location/attribute::file"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text> </xsl:text><!-- Newline -->
<xsl:if test="briefdescription/*|detaileddescription/*|inbodydescription/*">
<xsl:apply-templates select="briefdescription/*" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription/*" mode="passthrough"/>
<xsl:apply-templates select="inbdoydescription/*" mode="passthrough"/>
</xsl:if>
<xsl:apply-templates mode="toplevel">
<xsl:with-param name="with-namespace-refs"
select="innernamespace"/>
<xsl:with-param name="in-file" select="location/attribute::file"/>
</xsl:apply-templates>
</header>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
<xsl:template name="shorten.header.name">
<xsl:param name="header"/>
<xsl:variable name="prefix">
<xsl:value-of select="concat($boost.doxygen.header.prefix, '/')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($header, $prefix)">
<xsl:variable name="rest" select="substring-after($header, $prefix)"/>
<xsl:choose>
<xsl:when test="contains($rest, $prefix)">
<xsl:call-template name="shorten.header.name">
<xsl:with-param name="header" select="$rest"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$prefix"/>
<xsl:value-of select="$rest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$header"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="innernamespace">
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:apply-templates select="key('compounds-by-id', @refid)">
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="innernamespace" mode="toplevel">
<!-- The set of innernamespace nodes that limits our search -->
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<!-- The full name of the namespace we are referring to -->
<xsl:variable name="fullname"
select="string(key('compounds-by-id', @refid)/compoundname)"/>
<!-- Only pass on top-level namespaces -->
<xsl:if test="not(contains($fullname, '::'))">
<xsl:apply-templates select="key('compounds-by-id', @refid)">
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="sectiondef" mode="toplevel">
<xsl:param name="in-file" select="''"/>
<xsl:apply-templates mode="toplevel"
select="memberdef[generate-id() =
generate-id(key('members-by-id', @id))]">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="memberdef" mode="toplevel">
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:choose>
<!-- If the string INTERNAL ONLY is in the description, don't
emit this entity. This hack is necessary because Doxygen doesn't
tell us what is \internal and what isn't. -->
<xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="@kind='define'">
<macro>
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<xsl:if test="param">
<xsl:attribute name="kind">
<xsl:value-of select="'functionlike'"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="param">
<xsl:variable name="name" select="defname/text()"/>
<macro-parameter>
<xsl:attribute name="name">
<xsl:value-of select="defname/text()"/>
</xsl:attribute>
<xsl:variable name="params"
select="../detaileddescription/para/parameterlist"/>
<xsl:variable name="description" select="$params/parameteritem/
parameternamelist/parametername[text() = $name]/../../parameterdescription/para"/>
<xsl:if test="$description">
<description>
<xsl:apply-templates select="$description" mode="passthrough"/>
</description>
</xsl:if>
</macro-parameter>
</xsl:for-each>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
</macro>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='function'">
<xsl:call-template name="function">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='typedef'">
<xsl:call-template name="typedef">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='variable'">
<xsl:call-template name="variable" />
</xsl:when>
<xsl:when test="@kind='enum'">
<xsl:call-template name="enum" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="kind-error-message">
<xsl:with-param name="message" select="'Cannot handle toplevel memberdef element'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="innerclass" mode="toplevel">
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:variable name="name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="."/>
</xsl:call-template>
</xsl:variable>
<!-- Only process this if it is indeed global -->
<xsl:if test=".=$name">
<xsl:apply-templates select="key('compounds-by-id', @refid)">
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="innerclass">
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:apply-templates select="key('compounds-by-id', @refid)">
<xsl:with-param name="with-namespace-refs"
select="$with-namespace-refs"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:template>
<!-- Classes -->
<xsl:template match="templateparamlist" mode="template">
<template>
<xsl:apply-templates mode="template"/>
</template>
</xsl:template>
<xsl:template match="param" mode="template">
<xsl:choose>
<xsl:when test="string(type)='class' or string(type)='typename'">
<xsl:variable name="name" select="normalize-space(string(declname))"/>
<template-type-parameter>
<xsl:attribute name="name">
<xsl:value-of select="normalize-space(string(declname))"/>
</xsl:attribute>
<xsl:if test="defval">
<default>
<xsl:apply-templates select="defval/*|defval/text()"
mode="passthrough"/>
</default>
</xsl:if>
<xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem">
<xsl:if test="string(parameternamelist/parametername)=$name">
<purpose>
<xsl:apply-templates select="parameterdescription/para" mode="passthrough"/>
</purpose>
</xsl:if>
</xsl:for-each>
</template-type-parameter>
</xsl:when>
<!-- Doxygen 1.5.8 generates odd xml for template type parameters.
This deals with that -->
<xsl:when test="not(declname) and
(starts-with(string(type), 'class ') or starts-with(string(type), 'typename '))">
<template-type-parameter>
<xsl:variable name="name">
<xsl:value-of select="normalize-space(substring-after(string(type), ' '))"/>
</xsl:variable>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:if test="defval">
<default>
<xsl:apply-templates select="defval/*|defval/text()"
mode="passthrough"/>
</default>
</xsl:if>
<xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem">
<xsl:if test="string(parameternamelist/parametername)=$name">
<purpose>
<xsl:apply-templates select="parameterdescription/para" mode="passthrough"/>
</purpose>
</xsl:if>
</xsl:for-each>
</template-type-parameter>
</xsl:when>
<xsl:otherwise>
<template-nontype-parameter>
<xsl:variable name="name">
<xsl:value-of select="normalize-space(string(declname))"/>
</xsl:variable>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<type>
<xsl:apply-templates select="type"/>
</type>
<xsl:if test="defval">
<default>
<xsl:apply-templates select="defval/*|defval/text()"
mode="passthrough"/>
</default>
</xsl:if>
<xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem">
<xsl:if test="string(parameternamelist/parametername)=$name">
<purpose>
<xsl:apply-templates select="parameterdescription/para" mode="passthrough"/>
</purpose>
</xsl:if>
</xsl:for-each>
</template-nontype-parameter>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="templateparamlist"/>
<!-- "Parse" a specialization from part of a name -->
<xsl:template name="specialization">
<xsl:param name="specialization"/>
<xsl:choose>
<xsl:when test="contains($specialization, ',')">
<template-arg>
<xsl:value-of
select="normalize-space(substring-before($specialization, ','))"/>
</template-arg>
<xsl:call-template name="specialization">
<xsl:with-param name="specialization"
select="substring-after($specialization, ',')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<template-arg>
<xsl:value-of select="normalize-space($specialization)"/>
</template-arg>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Inheritance -->
<xsl:template match="basecompoundref" mode="inherit">
<xsl:choose>
<xsl:when test="contains(string(.), $boost.doxygen.detail)"/>
<xsl:otherwise>
<inherit>
<!-- Access specifier for inheritance -->
<xsl:attribute name="access">
<xsl:value-of select="@prot"/>
</xsl:attribute>
<!-- TBD: virtual vs. non-virtual inheritance -->
<xsl:apply-templates mode="passthrough"/>
</inherit>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="basecompoundref"/>
<!-- Skip over sections: they aren't very useful at all -->
<xsl:template match="sectiondef">
<xsl:param name="in-file" select="''"/>
<xsl:choose>
<xsl:when test="@kind='public-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="public static functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='protected-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="protected static functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='private-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<method-group name="private static functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:when>
<xsl:when test="@kind='public-func'">
<xsl:variable name="members" select="./memberdef"/>
<xsl:variable name="num-internal-only">
<xsl:value-of
select="count($members[contains(detaileddescription/para,
'INTERNAL ONLY')])"/>
</xsl:variable>
<xsl:if test="$num-internal-only < count($members)">
<method-group name="public member functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind='protected-func'">
<method-group name="protected member functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='private-func'">
<xsl:variable name="members" select="./memberdef"/>
<xsl:variable name="num-internal-only">
<xsl:value-of
select="count($members[contains(detaileddescription/para,
'INTERNAL ONLY')])"/>
</xsl:variable>
<xsl:if test="$num-internal-only < count($members)">
<method-group name="private member functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='friend'">
<xsl:if test="./memberdef/detaileddescription/para or ./memberdef/briefdescription/para">
<method-group name="friend functions">
<xsl:text> </xsl:text><!-- Newline -->
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</method-group>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
</xsl:when>
<xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='public-type'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='private-type'">
<!--skip private members-->
</xsl:when>
<xsl:when test="@kind='private-static-attrib' or @kind='private-attrib'">
<!--skip private members-->
</xsl:when>
<xsl:when test="@kind='func'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='typedef'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='var'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='enum'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind='user-defined'">
<xsl:apply-templates>
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="@kind=''">
<xsl:apply-templates select="memberdef[generate-id() =
generate-id(key('members-by-id', @id))]">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="kind-error-message">
<xsl:with-param name="message" select="'Cannot handle sectiondef'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Handle member definitions -->
<xsl:template match="memberdef">
<!-- True when we're inside a section -->
<xsl:param name="in-section" select="false()"/>
<xsl:param name="in-file" select="''"/>
<xsl:choose>
<!-- If the string INTERNAL ONLY is in the description, don't
emit this entity. This hack is necessary because Doxygen doesn't
tell us what is \internal and what isn't. -->
<xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/>
<xsl:when test="@kind='typedef'">
<xsl:call-template name="typedef">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='function'">
<xsl:choose>
<xsl:when test="ancestor::compounddef/attribute::kind='namespace'">
<xsl:call-template name="function">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- We are in a class -->
<!-- The name of the class we are in -->
<xsl:variable name="in-class-full">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name"
select="string(ancestor::compounddef/compoundname/text())"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name ="in-class">
<xsl:choose>
<xsl:when test="contains($in-class-full, '<')">
<xsl:value-of select="substring-before($in-class-full, '<')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$in-class-full"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="string(name/text())=$in-class">
<xsl:if test="not ($in-section)">
<xsl:call-template name="constructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())=concat('~',$in-class)">
<xsl:if test="not ($in-section)">
<xsl:call-template name="destructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())='operator='">
<xsl:if test="not ($in-section)">
<xsl:call-template name="copy-assignment"/>
</xsl:if>
</xsl:when>
<xsl:when test="normalize-space(string(type))=''
and contains(name/text(), 'operator ')">
<xsl:if test="$in-section">
<xsl:call-template name="conversion-operator"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$in-section">
<xsl:call-template name="method"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@kind='friend'">
<xsl:if test="./detaileddescription/para or ./briefdescription/para">
<xsl:call-template name="method"/>
</xsl:if>
</xsl:when>
<xsl:when test="@kind='enum'">
<xsl:call-template name="enum">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="@kind='variable'">
<xsl:call-template name="variable">
<xsl:with-param name="in-file" select="$in-file"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="kind-error-message">
<xsl:with-param name="message" select="'Cannot handle memberdef element'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Display typedefs -->
<xsl:template name="typedef">
<xsl:param name="in-file" select="''"/>
<xsl:if test="string(location/attribute::file)=$in-file">
<!-- TBD: Handle public/protected/private -->
<typedef>
<!-- Name of the type -->
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
<xsl:apply-templates select="inbodydescription" mode="passthrough"/>
<type><xsl:apply-templates select="type"/></type>
</typedef>
<xsl:text> </xsl:text><!-- Newline -->
</xsl:if>
</xsl:template>
<!-- Handle function parameters -->
<xsl:template match="param" mode="function">
<parameter>
<!-- Parameter name -->
<xsl:attribute name="name">
<xsl:value-of select="normalize-space(declname/text())"/>