<
xsl:
template name="emitCOMInterfaces">
<
xsl:
param name="iface"/>
<
xsl:
value-
of select="concat(' COM_INTERFACE_ENTRY(', $iface/@name, ') ')"/>
<!-- now recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="$iface/@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
<
xsl:
call-
template name="emitCOMInterfaces">
<
xsl:
with-
param name="iface" select="//interface[@name=$extends]"/>
<
xsl:
template match="interface" mode="classheader">
<
xsl:
value-
of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_ ')"/>
<
xsl:
value-
of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
<
xsl:
value-
of select="concat('class ATL_NO_VTABLE ', substring(@name, 2), 'Wrap:')"/>
<
xsl:
value-
of select="concat(' VBOX_SCRIPTABLE_IMPL(', @name, ') ')"/>
<
xsl:
value-
of select="concat(' VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ') ')"/>
<
xsl:
value-
of select="concat(' DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap) ')"/>
<
xsl:
text> DECLARE_PROTECT_FINAL_CONSTRUCT()
<
xsl:
value-
of select="concat(' BEGIN_COM_MAP(', substring(@name, 2), 'Wrap) ')"/>
<
xsl:
text> COM_INTERFACE_ENTRY(ISupportErrorInfo)
<
xsl:
call-
template name="emitCOMInterfaces">
<
xsl:
with-
param name="iface" select="."/>
<
xsl:
value-
of select="concat(' COM_INTERFACE_ENTRY2(IDispatch, ', @name, ') ')"/>
<
xsl:
value-
of select="concat(' DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap) ')"/>
<
xsl:
template match="interface" mode="classfooter">
<
xsl:
value-
of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_ ')"/>
<
xsl:
template match="interface" mode="codeheader">
<
xsl:
value-
of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), ' ')"/>
<
xsl:
value-
of select="concat('#include "', substring(@name, 2), 'Wrap.h" ')"/>
<
xsl:
template name="emitISupports">
<
xsl:
param name="classname"/>
<
xsl:
param name="extends"/>
<
xsl:
param name="depth"/>
<
xsl:
param name="interfacelist"/>
<
xsl:
when test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
<
xsl:
variable name="newextends" select="//interface[@name=$extends]/@extends"/>
<
xsl:
variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="$classname"/>
<
xsl:
with-
param name="extends" select="$newextends"/>
<
xsl:
with-
param name="depth" select="$depth + 1"/>
<
xsl:
with-
param name="interfacelist" select="$newiflist"/>
<
xsl:
value-
of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ') ')"/>
<
xsl:
template match="interface" mode="codefooter">
<
xsl:
text>#ifdef VBOX_WITH_XPCOM
<
xsl:
value-
of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap) ')"/>
<
xsl:
call-
template name="emitISupports">
<
xsl:
with-
param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
<
xsl:
with-
param name="extends" select="@extends"/>
<
xsl:
with-
param name="depth" select="1"/>
<
xsl:
with-
param name="interfacelist" select="@name"/>
<
xsl:
text>#endif // VBOX_WITH_XPCOM
<!-- - - - - - - - - - - - - - - - - - - - - - - templates for dealing with names and parameters - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="tospace">
<
xsl:
value-
of select="translate($str, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_', ' ')"/>
<
xsl:
template name="checkoption">
<
xsl:
param name="optionlist"/>
<
xsl:
param name="option"/>
<
xsl:
value-
of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
<
xsl:
template name="translatepublictype">
<
xsl:
variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
<
xsl:
when test="$type='wstring' or $type='uuid'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>IN_BSTR</
xsl:
text>
<
xsl:
text>BSTR</
xsl:
text>
<
xsl:
when test="string-length($gluetypefield)">
<
xsl:
value-
of select="$gluetypefield"/>
<
xsl:
when test="//enum[@name=$type]">
<
xsl:
value-
of select="concat($type, '_T')"/>
<
xsl:
when test="$type='$unknown'">
<
xsl:
text>IUnknown *</
xsl:
text>
<
xsl:
when test="//interface[@name=$type]">
<
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
value-
of select="concat($thatifname, ' *')"/>
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatepublictype: Type "', $type, '" is not supported.')"/>
<
xsl:
template name="translatewrappedtype">
<
xsl:
param name="safearray"/>
<
xsl:
variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
<
xsl:
when test="$type='wstring'">
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>com::Utf8Str &</
xsl:
text>
<
xsl:
when test="$type='uuid'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>com::Guid &</
xsl:
text>
<
xsl:
when test="string-length($wraptypefield)">
<
xsl:
value-
of select="$wraptypefield"/>
<
xsl:
when test="//enum[@name=$type]">
<
xsl:
value-
of select="concat($type, '_T')"/>
<
xsl:
when test="$type='$unknown'">
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>ComPtr<IUnknown> &</
xsl:
text>
<
xsl:
when test="//interface[@name=$type]">
<
xsl:
variable name="thatif" select="//interface[@name=$type]"/>
<
xsl:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
if test="$dir='in' and not($safearray='yes')">
<
xsl:
text>const </
xsl:
text>
<
xsl:
value-
of select="concat('ComPtr<', $thatifname, '> &')"/>
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatewrappedtype: Type "', $type, '" is not supported.')"/>
<
xsl:
template name="translatefmtspectype">
<
xsl:
param name="safearray"/>
<
xsl:
variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
<
xsl:
when test="$mod='ref' and $dir!='in'">
<
xsl:
when test="$safearray='yes'">
<
xsl:
when test="string-length($wrapfmt)">
<
xsl:
value-
of select="$wrapfmt"/>
<
xsl:
when test="//enum[@name=$type]">
<
xsl:
text>%RU32</
xsl:
text>
<
xsl:
when test="$type='$unknown'">
<
xsl:
when test="//interface[@name=$type]">
<
xsl:
call-
template name="fatalError">
<
xsl:
with-
param name="msg" select="concat('translatefmtcpectype: Type "', $type, '" is not supported.')"/>
<
xsl:
template match="attribute/@type | param/@type" mode="public">
<
xsl:
variable name="gluetype">
<
xsl:
call-
template name="translatepublictype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayIn(</
xsl:
text>
<
xsl:
text>ComSafeArrayOut(</
xsl:
text>
<
xsl:
value-
of select="$gluetype"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
if test="substring($gluetype,string-length($gluetype))!='*'">
<
xsl:
when test="$dir='in'">
<
xsl:
value-
of select="'*'"/>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
value-
of select="')'"/>
<
xsl:
template match="attribute/@type | param/@type" mode="wrapped">
<
xsl:
variable name="wraptype">
<
xsl:
call-
template name="translatewrappedtype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="safearray" select="../@safearray"/>
<
xsl:
when test="../@safearray='yes'">
<
xsl:
if test="$dir='in'">
<
xsl:
text>const </
xsl:
text>
<
xsl:
text>std::vector<</
xsl:
text>
<
xsl:
when test="substring($wraptype,string-length($wraptype))='&'">
<
xsl:
variable name="wraptype2">
<
xsl:
value-
of select="substring($wraptype,1,string-length($wraptype)-2)"/>
<
xsl:
when test="substring($wraptype2,string-length($wraptype2))='>'">
<
xsl:
value-
of select="concat($wraptype2, ' ')"/>
<
xsl:
value-
of select="$wraptype2"/>
<
xsl:
when test="substring($wraptype,string-length($wraptype))='>'">
<
xsl:
value-
of select="concat($wraptype, ' ')"/>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
text>> &</
xsl:
text>
<
xsl:
value-
of select="$wraptype"/>
<
xsl:
if test="substring($wraptype,string-length($wraptype))!='&'">
<
xsl:
if test="substring($wraptype,string-length($wraptype))!='*'">
<
xsl:
when test="$dir='in'">
<
xsl:
value-
of select="'*'"/>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
template match="attribute/@type | param/@type" mode="logparamtext">
<
xsl:
if test="$mod!='ref' and ($dir='out' or $dir='ret')">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
call-
template name="translatefmtspectype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
with-
param name="safearray" select="../@safearray"/>
<
xsl:
with-
param name="mod" select="$mod"/>
<
xsl:
template match="attribute/@type | param/@type" mode="logparamval">
<
xsl:
when test="../@safearray='yes' and $mod!='ref'">
<
xsl:
text>ComSafeArraySize(</
xsl:
text>
<
xsl:
if test="$mod!='ref' and $dir!='in'">
<
xsl:
when test="$mod!='ref' and $dir!='in'">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
when test="../@safearray='yes' and $mod!='ref'">
<
xsl:
template match="attribute/@type | param/@type" mode="paramvalconversion">
<
xsl:
variable name="gluetype">
<
xsl:
call-
template name="translatepublictype">
<
xsl:
with-
param name="type" select="."/>
<
xsl:
with-
param name="dir" select="$dir"/>
<
xsl:
variable name="type" select="."/>
<
xsl:
variable name="thatif" select="../../../..//interface[@name=$type]"/>
<
xsl:
when test="$type='$unknown'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComTypeInConverter<IUnknown>(</
xsl:
text>
<
xsl:
text>ComTypeOutConverter<IUnknown>(</
xsl:
text>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
when test="$thatif">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
variable name="thatifname" select="$thatif/@name"/>
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComTypeInConverter</
xsl:
text>
<
xsl:
text>ComTypeOutConverter</
xsl:
text>
<
xsl:
value-
of select="concat('<', $thatifname, '>(')"/>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
when test="$type='wstring'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>BSTRInConverter(</
xsl:
text>
<
xsl:
text>BSTROutConverter(</
xsl:
text>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
when test="$type='uuid'">
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>UuidInConverter(</
xsl:
text>
<
xsl:
text>UuidOutConverter(</
xsl:
text>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>Array</
xsl:
text>
<
xsl:
when test="$dir='in'">
<
xsl:
text>InConverter</
xsl:
text>
<
xsl:
text>OutConverter</
xsl:
text>
<
xsl:
value-
of select="concat('<', $gluetype, '>(')"/>
<
xsl:
when test="$dir='in'">
<
xsl:
text>ComSafeArrayInArg(</
xsl:
text>
<
xsl:
text>ComSafeArrayOutArg(</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="../@name"/>
<
xsl:
when test="$type='$unknown' or $thatif">
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text>)).array()</
xsl:
text>
<
xsl:
text>).ptr()</
xsl:
text>
<
xsl:
when test="$type='wstring'">
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text>)).array()</
xsl:
text>
<
xsl:
text>).str()</
xsl:
text>
<
xsl:
when test="$type='uuid'">
<
xsl:
when test="../@safearray='yes'">
<
xsl:
text>)).array()</
xsl:
text>
<
xsl:
text>).uuid()</
xsl:
text>
<
xsl:
if test="../@safearray='yes'">
<
xsl:
text>)).array()</
xsl:
text>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="attribute" mode="public">
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat(' STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat(' STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
template match="attribute" mode="wrapped">
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat(' virtual HRESULT get', $attrbasename, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat(' virtual HRESULT set', $attrbasename, '(')"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
template match="attribute" mode="code">
<
xsl:
param name="topclass"/>
<
xsl:
variable name="attrbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'out'"/>
LogRelFlow(("{%p} %s: enter </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="mod" select="'ref'"/>
<
xsl:
text>\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
with-
param name="mod" select="'ref'"/>
VirtualBoxBase::clearError();
CheckComArgOutPointerValidThrow(a</
xsl:
text>
<
xsl:
value-
of select="$attrbasename"/>
AutoCaller autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = get', $attrbasename, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="paramvalconversion">
<
xsl:
with-
param name="dir" select="'out'"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
LogRelFlow(("{%p} %s: leave </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
text> hrc=%Rhrc\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'out'"/>
<
xsl:
if test="not(@readonly) or @readonly!='yes'">
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="'in'"/>
<!-- @todo check in parameters if possible --> LogRelFlow(("{%p} %s: enter </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="'in'"/>
<
xsl:
text>\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="'in'"/>
VirtualBoxBase::clearError();
AutoCaller autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = set', $attrbasename, '(')"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller, </
xsl:
text>
<
xsl:
apply-
templates select="@type" mode="paramvalconversion">
<
xsl:
with-
param name="dir" select="'in'"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </
xsl:
text>
<
xsl:
value-
of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAttributes">
<
xsl:
param name="iface"/>
<
xsl:
param name="topclass"/>
<
xsl:
param name="pmode"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="$iface/@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="//interface[@name=$extends]"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
value-
of select="concat('// ', $iface/@name, ' properties')"/>
<
xsl:
value-
of select="concat(' // ', $pmode, ' ', $iface/@name, ' properties ')"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
when test="$pmode='code'">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="method" mode="public">
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
text> STDMETHOD(</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
template match="method" mode="wrapped">
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
text> virtual HRESULT </
xsl:
text>
<
xsl:
call-
template name="uncapitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>AutoCaller &aAutoCaller</
xsl:
text>
<
xsl:
if test="count(param) > 0">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="wrapped">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
template match="method" mode="code">
<
xsl:
param name="topclass"/>
<
xsl:
variable name="methodindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
variable name="methodclassindent">
<
xsl:
call-
template name="tospace">
<
xsl:
with-
param name="str" select="concat($topclass, @name)"/>
<
xsl:
variable name="methodbasename">
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
<
xsl:
value-
of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="public">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodclassindent"/>
LogRelFlow(("{%p} %s:enter</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="mod" select="'ref'"/>
<
xsl:
text>\n", this</
xsl:
text>
<
xsl:
value-
of select="concat(', "', $topclass, '::', @name, '"')"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
with-
param name="mod" select="'ref'"/>
VirtualBoxBase::clearError();
<!-- @todo check in parameters if possible --> <
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
text> CheckComArgOutPointerValidThrow(a</
xsl:
text>
<
xsl:
call-
template name="capitalize">
<
xsl:
with-
param name="str" select="@name"/>
AutoCaller autoCaller(this);
<
xsl:
value-
of select="concat(' hrc = ', @name, '(')"/>
<
xsl:
variable name="passAutoCaller">
<
xsl:
call-
template name="checkoption">
<
xsl:
with-
param name="optionlist" select="@wrap-hint-server"/>
<
xsl:
with-
param name="option" select="'passcaller'"/>
<
xsl:
if test="$passAutoCaller = 'true'">
<
xsl:
text>autoCaller</
xsl:
text>
<
xsl:
if test="count(param) > 0">
<
xsl:
value-
of select="$methodindent"/>
<
xsl:
for-
each select="param">
<
xsl:
apply-
templates select="@type" mode="paramvalconversion">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
if test="not(position()=last())">
<
xsl:
value-
of select="$methodindent"/>
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
LogRelFlow(("{%p} %s: leave</
xsl:
text>
<
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
apply-
templates select="@type" mode="logparamtext">
<
xsl:
with-
param name="dir" select="@dir"/>
<
xsl:
text> hrc=%Rhrc\n", this</
xsl:
text>
<
xsl:
value-
of select="concat(', "', $topclass, '::', @name, '"')"/>
<
xsl:
for-
each select="param">
<
xsl:
if test="@dir!='in'">
<
xsl:
apply-
templates select="@type" mode="logparamval">
<
xsl:
with-
param name="dir" select="@dir"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all methods of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitMethods">
<
xsl:
param name="iface"/>
<
xsl:
param name="topclass"/>
<
xsl:
param name="pmode"/>
<!-- first recurse to emit all base interfaces --> <
xsl:
variable name="extends" select="$iface/@extends"/>
<
xsl:
if test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="//interface[@name=$extends]"/>
<
xsl:
with-
param name="topclass" select="$topclass"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
value-
of select="concat('// ', $iface/@name, ' methods')"/>
<
xsl:
value-
of select="concat(' // ', $pmode, ' ', $iface/@name, ' methods ')"/>
<
xsl:
when test="$pmode='public'">
<
xsl:
apply-
templates select="$iface/method" mode="public"/>
<
xsl:
when test="$pmode='wrapped'">
<
xsl:
apply-
templates select="$iface/method" mode="wrapped"/>
<
xsl:
when test="$pmode='code'">
<
xsl:
apply-
templates select="$iface/method" mode="code">
<
xsl:
with-
param name="topclass" select="$topclass"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes and methods declarations of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDecls">
<
xsl:
param name="iface"/>
<
xsl:
param name="pmode"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="$pmode"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDecls">
<
xsl:
param name="iface"/>
<!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the header file of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitHeader">
<
xsl:
param name="iface"/>
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
<
xsl:
when test="$filelistonly=''">
<
xsl:
apply-
templates select="$iface" mode="startfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
call-
template name="fileheader">
<
xsl:
with-
param name="name" select="$filename"/>
<
xsl:
with-
param name="class" select="substring(@name, 2)"/>
<
xsl:
with-
param name="type" select="'header'"/>
<
xsl:
apply-
templates select="." mode="classheader"/>
<
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="'public'"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<!-- switch to private --> <
xsl:
call-
template name="emitInterfaceDecls">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="pmode" select="'wrapped'"/>
<
xsl:
apply-
templates select="." mode="classfooter"/>
<
xsl:
apply-
templates select="$iface" mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
apply-
templates select="$iface" mode="listfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit all attributes and methods definitions of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitInterfaceDefs">
<
xsl:
param name="iface"/>
<
xsl:
value-
of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap) ')"/>
<
xsl:
call-
template name="emitAttributes">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
xsl:
with-
param name="pmode" select="'code'"/>
<
xsl:
call-
template name="emitMethods">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
with-
param name="topclass" select="substring($iface/@name, 2)"/>
<
xsl:
with-
param name="pmode" select="'code'"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - emit auxiliary method declarations of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitAuxMethodDefs">
<
xsl:
param name="iface"/>
<!-- currently nothing, maybe later some generic FinalConstruct/... implementation --> <!-- - - - - - - - - - - - - - - - - - - - - - - emit the code file of an interface - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template name="emitCode">
<
xsl:
param name="iface"/>
<
xsl:
variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
<
xsl:
when test="$filelistonly=''">
<
xsl:
apply-
templates select="$iface" mode="startfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
call-
template name="fileheader">
<
xsl:
with-
param name="name" select="$filename"/>
<
xsl:
with-
param name="class" select="substring(@name, 2)"/>
<
xsl:
with-
param name="type" select="'code'"/>
<
xsl:
apply-
templates select="." mode="codeheader"/>
<!-- @todo special thread logging for API methods returning IProgress??? would be very usefulcurrently nothing, maybe later some generic FinalConstruct/... implementation --> <
xsl:
call-
template name="emitInterfaceDefs">
<
xsl:
with-
param name="iface" select="$iface"/>
<!-- auxiliary methods (public) --> <
xsl:
call-
template name="emitAuxMethodDefs">
<
xsl:
with-
param name="iface" select="$iface"/>
<
xsl:
apply-
templates select="." mode="codefooter"/>
<
xsl:
apply-
templates select="$iface" mode="endfile">
<
xsl:
with-
param name="file" select="$filename"/>
<
xsl:
apply-
templates select="$iface" mode="listfile">
<
xsl:
with-
param name="file" select="$filename"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - wildcard match, ignore everything which has no explicit match - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="*"/>
<!-- - - - - - - - - - - - - - - - - - - - - - - ignore all if tags except those for XPIDL or MIDL target - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="if">
<
xsl:
if test="(@target = 'xpidl') or (@target = 'midl')">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="interface">
<
xsl:
if test="not(@supportsErrorInfo='no')">
<
xsl:
call-
template name="emitHeader">
<
xsl:
with-
param name="iface" select="."/>
<
xsl:
call-
template name="emitCode">
<
xsl:
with-
param name="iface" select="."/>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="library">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <
xsl:
template match="/idl">
<
xsl:
when test="$filelistonly=''">
<
xsl:
value-
of select="concat($filelistonly, ' := \ ')"/>
<
xsl:
when test="$filelistonly=''">
<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->