File: utility.xsl

package info (click to toggle)
boost1.74 1.74.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 464,084 kB
  • sloc: cpp: 3,338,324; xml: 131,293; python: 33,088; ansic: 14,336; asm: 4,034; sh: 3,351; makefile: 1,193; perl: 1,036; yacc: 478; php: 212; ruby: 102; lisp: 24; sql: 13; csh: 6
file content (52 lines) | stat: -rw-r--r-- 1,852 bytes parent folder | download | duplicates (20)
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
<?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">
  <!-- Indent the current line-->
  <xsl:template name="indent">
    <xsl:param name="indentation"/>
    <xsl:if test="$indentation > 0">
      <xsl:text> </xsl:text>
      <xsl:call-template name="indent">
        <xsl:with-param name="indentation" select="$indentation - 1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <!--   get name of first ancestor-or-self which is a class, struct or union -->
  <xsl:template name="object-name">
    <xsl:variable name="ancestors" select="ancestor-or-self::class |
      ancestor-or-self::class-specialization |
      ancestor-or-self::struct |
      ancestor-or-self::struct-specialization |
      ancestor-or-self::union |
      ancestor-or-self::union-specialization"/>
    <xsl:value-of select="$ancestors[last()]/@name"/>
  </xsl:template>

  <!--   get name of access specification that we are inside -->
  <xsl:template name="access-name">
    <xsl:variable name="ancestors" select="ancestor-or-self::access |
      ancestor-or-self::class |
      ancestor-or-self::class-specialization |
      ancestor-or-self::struct |
      ancestor-or-self::struct-specialization |
      ancestor-or-self::union |
      ancestor-or-self::union-specialization"/>
    <xsl:choose>
      <xsl:when test="name($ancestors[last()])='access'">
        <xsl:value-of select="$ancestors[last()]/@name"/>
      </xsl:when>
      <xsl:otherwise>
        public
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>