VirtualBox

Changeset 72974 in vbox for trunk/src/VBox/Main/idl


Ignore:
Timestamp:
Jul 8, 2018 1:35:21 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123526
Message:

Main: Some early sketches on how to get proper C++ enums with xpidl.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/xpidl.xsl

    r72973 r72974  
    3636     portability concerns.
    3737 -->
    38 <xsl:param name="g_fHackEnumsOntoCppEnums" select="'no'"/>
     38<xsl:param name="g_fHackEnumsOntoCppEnums" select="'yes'"/>
    3939
    4040
     
    717717  <xsl:text>};&#x0A;&#x0A;</xsl:text>
    718718  <xsl:choose>
     719
    719720    <xsl:when test="$g_fHackEnumsOntoCppEnums = 'yes'">
    720721      <xsl:text>
    721 /* IDL typedef for enum ', @name, ' */
    722 typedef PRUint32 </xsl:text><xsl:value-of select="concat(@name, '_EnumT')" /><xsl:text>;
    723 
    724 /* C++ enum type name for ', @name, ' */
     722/* IDL typedef for enum </xsl:text><xsl:value-of select="@name" /><xsl:text> and C++ mappings. */
    725723%{C++
     724#ifndef VBOX_WITH_XPCOM_CPP_ENUM_HACK
     725%}
     726typedef PRUint32 </xsl:text><xsl:value-of select="concat(@name, '_T')" /><xsl:text>;
     727%{C++
     728</xsl:text>
     729      <xsl:for-each select="const">
     730        <xsl:value-of select="concat('# define ', ../@name, '_', @name, ' ', ../@name, '::', @name, '&#x0A;')"/>
     731      </xsl:for-each>
     732      <xsl:text>#else /* VBOX_WITH_XPCOM_CPP_ENUM_HACK */
    726733typedef enum </xsl:text>
    727734      <xsl:value-of select="concat(@name, '_T')" />
     
    733740      <xsl:value-of select="concat('    ', @name, '_32BitHack = 0x7fffffff', '&#x0A;')"/>
    734741      <xsl:text>} </xsl:text><xsl:value-of select="concat(@name, '_T')"/><xsl:text>;
    735 #ifdef AssertCompileSize
     742# ifdef AssertCompileSize
    736743AssertCompileSize(</xsl:text><xsl:value-of select="concat(@name, '_T')"/><xsl:text>, sizeof(PRUint32));
    737 #endif
    738 /* Use the preprocessor to replace the IDL enum typedef with our C++ enum so it will
    739    behave just like we had real enum support in xpidl or if were using msidl. */
    740 #define </xsl:text><xsl:value-of select="concat(@name, '_EnumT ', @name, '_T')" /><xsl:text>
    741 #ifndef VBOX_WITH_XPCOM_CPP_ENUM_HACK
    742 # define VBOX_WITH_XPCOM_CPP_ENUM_HACK 1
    743 #endif
     744# endif
     745#endif /* VBOX_WITH_XPCOM_CPP_ENUM_HACK */
    744746%}
    745747
     
    953955              <xsl:choose>
    954956                <xsl:when test="$g_fHackEnumsOntoCppEnums = 'yes'">
    955                   <xsl:value-of select="concat(., '_EnumT')" />
     957                  <xsl:value-of select="concat(., '_T')" />
    956958                </xsl:when>
    957959                <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette