Changeset 53942 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 23, 2015 2:35:01 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97820
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
r53460 r53942 23 23 <xsl:strip-space elements="*"/> 24 24 25 26 <!-- 27 * Capitalizes the first letter: 28 --> 29 <xsl:template name="capitalize"> 30 <xsl:param name="str" select="."/> 31 <xsl:value-of select=" 32 concat( 33 translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 34 substring($str,2) 35 ) 36 "/> 37 </xsl:template> 38 39 <!-- 40 * Uncapitalizes the first letter only if the second one is not capital 41 * otherwise leaves the string unchanged: 42 --> 43 <xsl:template name="uncapitalize"> 44 <xsl:param name="str" select="."/> 45 <xsl:choose> 46 <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))"> 47 <xsl:value-of select=" 48 concat( 49 translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 50 substring($str,2) 51 ) 52 "/> 53 </xsl:when> 54 <xsl:otherwise> 55 <xsl:value-of select="string($str)"/> 56 </xsl:otherwise> 57 </xsl:choose> 58 </xsl:template> 59 60 61 <!-- 62 * Translates the string to uppercase: 63 --> 64 <xsl:template name="uppercase"> 65 <xsl:param name="str" select="."/> 66 <xsl:value-of select=" 67 translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 68 "/> 69 </xsl:template> 25 <xsl:include href="../../../../Main/idl/typemap-shared.inc.xsl" /> 26 27 28 <!-- 29 * Keys for more efficiently looking up of types. 30 --> 31 <xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/> 32 <xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/> 70 33 71 34 … … 83 46 <xsl:template name="endFile"> 84 47 <xsl:param name="file" /> 85 <xsl:value-of select="concat(' // ##### ENDFILE "', $file, '" ')" /> 48 <xsl:call-template name="xsltprocNewlineOutputHack"/> 49 <xsl:value-of select="concat('// ##### ENDFILE "', $file, '" ')" /> 86 50 </xsl:template> 87 51 … … 682 646 <xsl:text>// </xsl:text> 683 647 <xsl:value-of select="@name"/> 684 <xsl:text> wrapper

</xsl:text> 648 <xsl:text> wrapper
</xsl:text> 649 <xsl:call-template name="xsltprocNewlineOutputHack"/> 685 650 686 651 <xsl:if test="name()='interface'"> … … 1268 1233 <xsl:template name="tryComposeFetchErrorInfo"> 1269 1234 <xsl:param name="mode" select="''"/> 1235 1270 1236 <xsl:variable name="ifaceSupportsErrorInfo" select=" 1271 1237 ancestor-or-self::interface[1]/@supportsErrorInfo 1272 1238 "/> 1273 1239 <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/> 1240 1274 1241 <xsl:choose> 1275 1242 <xsl:when test="$ifaceSupportsErrorInfo"> … … 1291 1258 <xsl:param name="supports" select="''"/> 1292 1259 <xsl:param name="mode" select="''"/> 1260 1293 1261 <xsl:choose> 1294 1262 <xsl:when test="$mode='getBaseClassName'"> … … 1312 1280 1313 1281 <xsl:template name="composeMethodCallParam"> 1314 1315 1282 <xsl:param name="isIn" select="@dir='in'"/> 1316 1283 <xsl:param name="isOut" select="@dir='out' or @dir='return'"/> 1317 1318 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>1319 1284 1320 1285 <xsl:choose> … … 1354 1319 </xsl:when> 1355 1320 <!-- enum types --> 1356 <xsl:when test=" 1357 (ancestor::library/enum[@name=current()/@type]) or 1358 (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type]) 1359 "> 1321 <xsl:when test="count(key('G_keyEnumsByName', current()/@type)) > 0"> 1360 1322 <xsl:choose> 1361 1323 <xsl:when test="$isIn"> … … 1381 1343 </xsl:when> 1382 1344 <!-- interface types --> 1383 <xsl:when test=" 1384 @type='$unknown' or 1385 ((ancestor::library/interface[@name=current()/@type]) or 1386 (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type]) 1387 ) 1388 "> 1345 <xsl:when test="@type='$unknown' or (count(key('G_keyInterfacesByName', current()/@type)) > 0)"> 1389 1346 <xsl:choose> 1390 1347 <xsl:when test="$isIn"> … … 1433 1390 --> 1434 1391 <xsl:template match="attribute/@type | param/@type"> 1435 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>1436 1437 1392 <xsl:choose> 1438 1393 <!-- modifiers --> … … 1523 1478 <!-- system interface types --> 1524 1479 <xsl:when test=".='$unknown'">CUnknown</xsl:when> 1480 <!-- enum types --> 1481 <xsl:when test="count(key('G_keyEnumsByName', current())) > 0"> 1482 <xsl:value-of select="concat('K',string(.))"/> 1483 </xsl:when> 1484 <!-- custom interface types --> 1485 <xsl:when test="count(key('G_keyInterfacesByName', current())) > 0"> 1486 <xsl:value-of select="concat('C',substring(.,2))"/> 1487 </xsl:when> 1488 <!-- other types --> 1525 1489 <xsl:otherwise> 1526 <xsl:choose> 1527 <!-- enum types --> 1528 <xsl:when test=" 1529 (ancestor::library/enum[@name=current()]) or 1530 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 1531 "> 1532 <xsl:value-of select="concat('K',string(.))"/> 1533 </xsl:when> 1534 <!-- custom interface types --> 1535 <xsl:when test=" 1536 ((ancestor::library/interface[@name=current()]) or 1537 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1538 ) 1539 "> 1540 <xsl:value-of select="concat('C',substring(.,2))"/> 1541 </xsl:when> 1542 <!-- other types --> 1543 <xsl:otherwise> 1544 <xsl:message terminate="yes"> 1545 <xsl:text>Unknown parameter type: </xsl:text> 1546 <xsl:value-of select="."/> 1547 </xsl:message> 1548 </xsl:otherwise> 1549 </xsl:choose> 1490 <xsl:message terminate="yes"><xsl:text>Unknown parameter type: </xsl:text><xsl:value-of select="."/></xsl:message> 1550 1491 </xsl:otherwise> 1551 1492 </xsl:choose> … … 1564 1505 --> 1565 1506 <xsl:template match="attribute/@type | param/@type" mode="initializer"> 1566 1567 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>1568 1569 1507 <xsl:choose> 1570 1508 <!-- safearrays don't need initializers --> … … 1638 1576 <xsl:when test=".='string'"> = NULL</xsl:when> 1639 1577 <xsl:when test=".='wchar'"> = 0</xsl:when> 1640 <xsl:otherwise> 1641 <xsl:choose> 1642 <!-- enum types initialized with 0 --> 1643 <xsl:when test=" 1644 (ancestor::library/enum[@name=current()]) or 1645 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 1646 "> 1647 <xsl:value-of select="concat(' = (K',string(.),') 0')"/> 1648 </xsl:when> 1649 </xsl:choose> 1650 </xsl:otherwise> 1578 <!-- enum types initialized with 0 --> 1579 <xsl:when test="count(key('G_keyEnumsByName', current())) > 0"> 1580 <xsl:value-of select="concat(' = (K',string(.),') 0')"/> 1581 </xsl:when> 1651 1582 </xsl:choose> 1652 1583 </xsl:otherwise> … … 1659 1590 --> 1660 1591 <xsl:template match="attribute/@type | param/@type" mode="param"> 1661 1662 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>1663 1664 1592 <xsl:choose> 1665 1593 <!-- class types --> 1666 1594 <xsl:when test=" 1667 .='string' or 1668 .='wstring' or 1669 ../@safearray='yes' or 1670 ((ancestor::library/enum[@name=current()]) or 1671 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 1672 ) or 1673 .='$unknown' or 1674 ((ancestor::library/interface[@name=current()]) or 1675 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1676 ) 1595 . = 'string' 1596 or . = 'wstring' 1597 or . = '$unknown' 1598 or ../@safearray = 'yes' 1599 or (count(key('G_keyEnumsByName', current())) > 0) 1600 or (count(key('G_keyInterfacesByName', current())) > 0) 1677 1601 "> 1678 1602 <xsl:choose> … … 1727 1651 --> 1728 1652 <xsl:template match="attribute/@type | param/@type" mode="com"> 1729 1730 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>1731 1732 1653 <xsl:choose> 1733 1654 <!-- modifiers --> … … 1803 1724 <!-- system interface types --> 1804 1725 <xsl:when test=".='$unknown'">IUnknown *</xsl:when> 1726 <!-- enum types --> 1727 <xsl:when test="count(key('G_keyEnumsByName', current())) > 0"> 1728 <xsl:value-of select="."/> 1729 </xsl:when> 1730 <!-- custom interface types --> 1731 <xsl:when test="count(key('G_keyInterfacesByName', current())) > 0"> 1732 <xsl:value-of select="."/><xsl:text> *</xsl:text> 1733 </xsl:when> 1734 <!-- other types --> 1805 1735 <xsl:otherwise> 1806 <xsl:choose> 1807 <!-- enum types --> 1808 <xsl:when test=" 1809 (ancestor::library/enum[@name=current()]) or 1810 (ancestor::library/if[@target=$self_target]/enum[@name=current()]) 1811 "> 1812 <xsl:value-of select="."/> 1813 </xsl:when> 1814 <!-- custom interface types --> 1815 <xsl:when test=" 1816 ((ancestor::library/interface[@name=current()]) or 1817 (ancestor::library/if[@target=$self_target]/interface[@name=current()]) 1818 ) 1819 "> 1820 <xsl:value-of select="."/><xsl:text> *</xsl:text> 1821 </xsl:when> 1822 <!-- other types --> 1823 <xsl:otherwise> 1824 <xsl:message terminate="yes"> 1825 <xsl:text>Unknown parameter type: </xsl:text> 1826 <xsl:value-of select="."/> 1827 </xsl:message> 1828 </xsl:otherwise> 1829 </xsl:choose> 1736 <xsl:message terminate="yes"> 1737 <xsl:text>Unknown parameter type: </xsl:text> 1738 <xsl:value-of select="."/> 1739 </xsl:message> 1830 1740 </xsl:otherwise> 1831 1741 </xsl:choose> … … 1847 1757 --> 1848 1758 <xsl:template name="hooks"> 1849 1850 1759 <xsl:param name="when" select="''"/> 1851 1760 <xsl:param name="isSetter" select="''"/> 1852 1761 1853 <xsl:variable name="self_target" select="current()/ancestor::if/@target"/> 1854 1855 <xsl:variable name="is_iface" select="( 1856 ((ancestor::library/interface[@name=current()/@type]) or 1857 (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type]) 1858 ) 1859 )"/> 1860 1861 <xsl:variable name="is_enum" select="( 1862 (ancestor::library/enum[@name=current()/@type]) or 1863 (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type]) 1864 )"/> 1865 1762 <xsl:variable name="is_iface" select="count(key('G_keyInterfacesByName', current()/@type)) > 0"/> 1866 1763 <xsl:variable name="is_out" select="( 1867 1764 (name()='attribute' and not($isSetter)) or … … 1871 1768 <xsl:choose> 1872 1769 <xsl:when test="$when='pre-call'"> 1770 <xsl:variable name="is_enum" select="count(key('G_keyEnumsByName', current()/@type)) > 0"/> 1873 1771 <xsl:choose> 1874 1772 <xsl:when test="@safearray='yes'">
Note:
See TracChangeset
for help on using the changeset viewer.