websrv-cpp.xsl revision fd168522254205059178a7e247606c9159ed2ae3
af062818b47340eef15700d2f0211576ba3506eevboxsync<?xml version="1.0"?>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync websrv-cpp.xsl:
af062818b47340eef15700d2f0211576ba3506eevboxsync XSLT stylesheet that generates methodmaps.cpp from
af062818b47340eef15700d2f0211576ba3506eevboxsync VirtualBox.xidl. This generated C++ code contains
af062818b47340eef15700d2f0211576ba3506eevboxsync all the service implementations that one would
af062818b47340eef15700d2f0211576ba3506eevboxsync normally have to implement manually to create a
af062818b47340eef15700d2f0211576ba3506eevboxsync web service; our generated code automatically maps
af062818b47340eef15700d2f0211576ba3506eevboxsync all SOAP calls into COM/XPCOM method calls.
af062818b47340eef15700d2f0211576ba3506eevboxsync See webservice/Makefile.kmk for an overview of all the things
af062818b47340eef15700d2f0211576ba3506eevboxsync generated for the webservice.
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync Copyright (C) 2006-2010 Oracle Corporation
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync General Public License (GPL) as published by the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync Foundation, in version 2 as it comes in the "COPYING" file of the
af062818b47340eef15700d2f0211576ba3506eevboxsync VirtualBox OSE distribution. VirtualBox OSE is distributed in the
af062818b47340eef15700d2f0211576ba3506eevboxsync hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync-->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:stylesheet
af062818b47340eef15700d2f0211576ba3506eevboxsync version="1.0"
af062818b47340eef15700d2f0211576ba3506eevboxsync xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
af062818b47340eef15700d2f0211576ba3506eevboxsync xmlns:xsd="http://www.w3.org/2001/XMLSchema"
af062818b47340eef15700d2f0211576ba3506eevboxsync xmlns:exsl="http://exslt.org/common"
af062818b47340eef15700d2f0211576ba3506eevboxsync extension-element-prefixes="exsl">
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:output method="text"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:strip-space elements="*"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync global XSLT variables
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:variable name="G_xsltFilename" select="'websrv-cpp.xsl'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:include href="websrv-shared.inc.xsl" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
af062818b47340eef15700d2f0211576ba3506eevboxsync quick lookup -->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:variable name="G_setSuppressedInterfaces"
af062818b47340eef15700d2f0211576ba3506eevboxsync select="//interface[@wsmap='suppress']" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync root match
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="/idl">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text><![CDATA[
af062818b47340eef15700d2f0211576ba3506eevboxsync/* DO NOT EDIT! This is a generated file.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
af062818b47340eef15700d2f0211576ba3506eevboxsync * Generator: src/VBox/Main/webservice/websrv-cpp.xsl
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// shared webservice header
af062818b47340eef15700d2f0211576ba3506eevboxsync#include "vboxweb.h"
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// vbox headers
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/com/com.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/com/array.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/com/ErrorInfo.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/com/errorprint.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/com/EventQueue.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/VRDPAuth.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/version.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/assert.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/initterm.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/stream.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/string.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// gSOAP headers (must come after vbox includes because it checks for conflicting defs)
af062818b47340eef15700d2f0211576ba3506eevboxsync#include "soapH.h"
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// standard headers
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <map>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <sstream>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// shared strings for debug output
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszCallingComMethod = " calling COM method %s\n";
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszDoneCallingComMethod = " done calling COM method\n";
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszConvertComOutputBack = " convert COM output \"%s\" back to caller format\n";
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszDoneConvertingComOutputBack = " done converting COM output \"%s\" back to caller format\n";
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszEntering = "-- entering %s\n";
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszLeaving = "-- leaving %s, rc: 0x%lX (%d)\n";
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync// generated string constants for all interface names
af062818b47340eef15700d2f0211576ba3506eevboxsyncconst char *g_pcszIUnknown = "IUnknown";
af062818b47340eef15700d2f0211576ba3506eevboxsync]]></xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="//interface">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="ifname" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('const char *g_pcsz', $ifname, ' = &quot;', $ifname, '&quot;;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:apply-templates />
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync if
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync * ignore all |if|s except those for WSDL target
af062818b47340eef15700d2f0211576ba3506eevboxsync-->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="if">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:if test="@target='wsdl'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:apply-templates/>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:if>
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync cpp
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="cpp">
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- ignore this -->
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync library
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="library">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync/****************************************************************************
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * types: enum converter helper functions
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync ****************************************************************************/
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <!--
af062818b47340eef15700d2f0211576ba3506eevboxsync enum converter functions at top of file
af062818b47340eef15700d2f0211576ba3506eevboxsync -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="//enum">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="enumname" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- generate enum converter for COM-to-SOAP -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('vbox__', $enumname, ' ', $G_funcPrefixOutputEnumConverter, $enumname, '(', $enumname, '_T e)')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>{</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' vbox__', $enumname, ' v;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> switch(e)</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> {</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="const[not(@wsmap='suppress')]">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="enumconst" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' case ', $enumname, '_', $enumconst, ':')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' v = vbox__', $enumname, '__')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- escape all "_" in $enumconst -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="escapeUnderscores">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="string" select="$enumconst" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="';'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>break;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- Add a default case so gcc gives us a rest, esp. on darwin. -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>default:</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> AssertMsgFailed(("e=%d\n", (int)e));</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' v = (vbox__', $enumname, ')0x7fffdead;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>break; </xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> }</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> return v;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>}</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- generate enum converter for SOAP-to-COM -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat($enumname, '_T ', $G_funcPrefixInputEnumConverter, $enumname, '(vbox__', $enumname, ' v)')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>{</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' ', $enumname, '_T e;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> switch(v)</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> {</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="const[not(@wsmap='suppress')]">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="enumconst" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' case vbox__', $enumname, '__')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- escape all "_" in $enumconst -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="escapeUnderscores">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="string" select="$enumconst" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="':'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' e = ', $enumname, '_', $enumconst, ';')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>break;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- Insert a default case so gcc gives us a rest, esp. on darwin. -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>default:</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> AssertMsgFailed(("v=%d\n", (int)v));</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' e = (', $enumname, '_T)0x7fffbeef;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewlineIndent8" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>break; </xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> }</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> return e;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>}</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync/****************************************************************************
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * types: struct converter helper functions
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync ****************************************************************************/
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="//interface[@wsmap='struct']">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="structname" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('// ', $structname, ' converter: called from method mappers to convert data from')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('// COM interface ', $structname, ', which has wsmap=&quot;struct&quot;, to SOAP structures')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('vbox__', $structname, '* ', $G_funcPrefixOutputEnumConverter, $structname, '(')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="' struct soap *soap,'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="' const WSDLT_ID &amp;idThis,'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="' HRESULT &amp;rc,'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' ComPtr&lt;', $structname, '&gt; &amp;in)')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>{</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' vbox__', $structname, ' *resp = NULL;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitPrologue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' resp = soap_new_vbox__', $structname, '(soap, -1);')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:for-each select="//interface[@name=$structname]/attribute">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' // -- ', $structname, '.', @name)" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- recurse! -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitGetAttributeComCall">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="ifname" select="$structname" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="object" select="'in'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="attrname" select="@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="attrtype" select="@type" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="callerprefix" select="concat('out', '.')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitEpilogue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:for-each>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:apply-templates />
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync class
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="module/class">
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- TODO swallow for now -->
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync enum
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="enum">
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync const
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="const">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:apply-templates />
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync-->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync desc
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="desc">
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- TODO swallow for now -->
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- - - - - - - - - - - - - - - - - - - - - - -
af062818b47340eef15700d2f0211576ba3506eevboxsync note
af062818b47340eef15700d2f0211576ba3506eevboxsync - - - - - - - - - - - - - - - - - - - - - - -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template match="note">
af062818b47340eef15700d2f0211576ba3506eevboxsync<!-- TODO -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:apply-templates />
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync emitBeginOfFunctionHeader:
af062818b47340eef15700d2f0211576ba3506eevboxsync-->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template name="emitBeginOfFunctionHeader">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="ifname" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="method" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('int __vbox__', $ifname, '_USCORE', $method, '(')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> struct soap *soap</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync emitCppTypeForIDLType:
af062818b47340eef15700d2f0211576ba3506eevboxsync emits the C++ type that corresponds to the given WSDL type in $type.
af062818b47340eef15700d2f0211576ba3506eevboxsync -->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template name="emitCppTypeForIDLType">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="method" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="type" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="safearray" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="inptr" /> <!-- whether to add INPTR to BSTR (Dmitry template magic) -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$type='wstring' or $type='uuid'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$safearray='yes'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$inptr='yes'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="'com::SafeArray&lt;IN_BSTR&gt;'" /> <!-- input string arrays must use IN_BSTR (see com/array.h) -->
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="'com::SafeArray&lt;BSTR&gt;'" /> <!-- output string arrays use raw BSTR -->
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="'com::Bstr'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- if above lookup in table succeeded, use that type -->
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="string-length($gluetypefield)">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitTypeOrArray">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="type" select="$gluetypefield"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="safearray" select="$safearray"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="//enum[@name=$type]">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitTypeOrArray">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="type" select="concat($type, '_T ')"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="safearray" select="$safearray"/>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$type='$unknown'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$safearray='yes'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="'com::SafeIfaceArray&lt;IUnknown&gt;'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="'ComPtr&lt;IUnknown&gt;'" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="//interface[@name=$type]">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="thatif" select="//interface[@name=$type]" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="thatifname" select="$thatif/@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="$safearray='yes'">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('com::SafeIfaceArray&lt;', $thatifname, '&gt;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:when test="//collection[@name=$type]">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="thatif" select="//collection[@name=$type]" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:variable name="thatifname" select="$thatif/@name" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat('ComPtr&lt;', $thatifname, '&gt;')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:when>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="fatalError">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:with-param name="msg" select="concat('emitCppTypeForIDLType: Type &quot;', $type, '&quot; in method &quot;', $method, '&quot; is not supported.')" />
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:call-template>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:otherwise>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:choose>
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync emitDocumentStyleArgStructs:
af062818b47340eef15700d2f0211576ba3506eevboxsync with WSDL "document" style only, emits those lengthy structs for
af062818b47340eef15700d2f0211576ba3506eevboxsync the input and output argument in the function header.
af062818b47340eef15700d2f0211576ba3506eevboxsync-->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template name="emitDocumentStyleArgStructs">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="ifname" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="methodname" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="fOutputs" /> <!-- if 1, emit output struct as well -->
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>,</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ' *', $G_requestElementVarName)" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:if test="$fOutputs">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>,</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:value-of select="concat(' _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ' *', $G_responseElementVarName)" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <!-- <xsl:value-of select="concat(' struct ', $ifname, '__', $methodname, 'Response &amp;', $G_result)" /> -->
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:if>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync emitPrologue:
af062818b47340eef15700d2f0211576ba3506eevboxsync emits the closing ")" for the parameter list and the beginning
af062818b47340eef15700d2f0211576ba3506eevboxsync of the function body.
af062818b47340eef15700d2f0211576ba3506eevboxsync -->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template name="emitPrologue">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> WEBDEBUG((g_pcszEntering, __FUNCTION__));
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync do {</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync</xsl:template>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync<!--
af062818b47340eef15700d2f0211576ba3506eevboxsync emitEpilogue
af062818b47340eef15700d2f0211576ba3506eevboxsync -->
af062818b47340eef15700d2f0211576ba3506eevboxsync<xsl:template name="emitEpilogue">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:param name="fSkipHRESULT" />
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> } while (0);</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> WEBDEBUG((g_pcszLeaving, __FUNCTION__, rc, rc));</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:call-template name="emitNewline" />
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:if test="not($fSkipHRESULT)">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync if (FAILED(rc))
af062818b47340eef15700d2f0211576ba3506eevboxsync return SOAP_FAULT;
af062818b47340eef15700d2f0211576ba3506eevboxsync return SOAP_OK;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:if>
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:if test="$fSkipHRESULT">
af062818b47340eef15700d2f0211576ba3506eevboxsync <xsl:text> return resp;</xsl:text>
af062818b47340eef15700d2f0211576ba3506eevboxsync </xsl:if>
<xsl:call-template name="emitNewline" />
<xsl:text>}</xsl:text>
<xsl:call-template name="emitNewline" />
</xsl:template>
<!--
emitObjForMethod:
after the function prologue, emit a "pObj" object that
specifies the object upon which the method should be invoked.
-->
<xsl:template name="emitObjForMethod">
<xsl:param name="ifname" />
<xsl:param name="wsmap" />
<xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
<xsl:choose>
<xsl:when test="$wsmap='global'">
<xsl:choose>
<xsl:when test="$ifname='IVirtualBox'">
<xsl:text> // invoke method on global IVirtualBox instance</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text>ComPtr&lt;IVirtualBox&gt; pObj = G_pVirtualBox;</xsl:text>
<xsl:call-template name="emitNewline" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitObjForMethod: Unknown interface &quot;', $ifname, '&quot; with wsmap=global in XIDL.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="($wsmap='managed')">
<xsl:text> // look up managed object reference for method call&#10;</xsl:text>
<xsl:value-of select="concat(' ComPtr&lt;', $ifname, '&gt; pObj;&#10;')" />
<xsl:value-of select="concat(' if (!', $G_requestElementVarName, ')&#10;')" />
<xsl:text> {&#10;</xsl:text>
<xsl:text> RaiseSoapInvalidObjectFault(soap, "");&#10;</xsl:text>
<xsl:text> break;&#10;</xsl:text>
<xsl:text> }&#10;</xsl:text>
<xsl:value-of select="concat(' const WSDLT_ID &amp;idThis = ', $structprefix, $G_nameObjectRefEncoded, ';&#10;')" />
<xsl:value-of select="' if ((rc = findComPtrFromId(soap, idThis, pObj, false)))&#10;'" />
<xsl:text> break;&#10;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--
emitInputArgConverter:
another type converter (from wsdl type to COM types),
that generates temporary variables on the stack with
the WSDL input parameters converted to the COM types,
so we can then pass them to the actual COM method call.
-->
<xsl:template name="emitInputArgConverter">
<xsl:param name="method" />
<xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" -->
<xsl:param name="name" />
<xsl:param name="type" />
<xsl:param name="safearray" />
<xsl:value-of select="concat(' // convert input arg ', $name)" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:choose>
<xsl:when test="$safearray='yes'">
<xsl:value-of select="concat('size_t c', $name, ' = ', $structprefix, $name, '.size();')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:call-template name="emitCppTypeForIDLType">
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="type" select="$type"/>
<xsl:with-param name="safearray" select="$safearray"/>
<xsl:with-param name="inptr" select="'yes'"/>
</xsl:call-template>
<xsl:value-of select="concat(' comcall_', $name, '(c', $name, ');')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('for (size_t i = 0; i &lt; c', $name, '; ++i)')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'{'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:choose>
<xsl:when test="$type='$unknown'">
<xsl:value-of select="' ComPtr&lt;IUnknown&gt; tmpObject;'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text> break;</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' IUnknown *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
</xsl:when>
<xsl:when test="//interface[@name=$type]">
<xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject;')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text> break;</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' ', $type, ' *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
</xsl:when>
<xsl:when test="$type='wstring'">
<xsl:value-of select="concat(' com::Bstr tmpObject(', $structprefix, $name, '[i].c_str());')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="' BSTR tmpObjectB;'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="' tmpObject.detachTo(&amp;tmpObjectB);'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' comcall_', $name, '[i] = tmpObjectB;')" />
</xsl:when>
<xsl:when test="$type='long'">
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
</xsl:when>
<xsl:when test="$type='boolean'">
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
</xsl:when>
<xsl:when test="//enum[@name=$type]">
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' comcall_', $name, '[i] = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, '[i]);')" />
</xsl:when>
<xsl:when test="$type='octet'">
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitInputArgConverter Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'}'" />
<xsl:call-template name="emitNewline" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="emitCppTypeForIDLType">
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="type" select="$type"/>
<xsl:with-param name="safearray" select="$safearray"/>
<xsl:with-param name="inptr" select="'yes'"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="$type='wstring' or $type='uuid'">
<xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
</xsl:when>
<xsl:when test="//enum[@name=$type]">
<xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
</xsl:when>
<xsl:when test="$type='$unknown'">
<xsl:value-of select="concat(' comcall_', $name, ';')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text> break</xsl:text>
</xsl:when>
<xsl:when test="(//interface[@name=$type]) or (//collection[@name=$type])">
<!-- the type is one of our own interfaces: then it must have a wsmap attr -->
<xsl:variable name="thatif" select="(//interface[@name=$type]) | (//collection[@name=$type])" />
<xsl:variable name="wsmap" select="$thatif/@wsmap" />
<xsl:variable name="thatifname" select="$thatif/@name" />
<xsl:choose>
<xsl:when test="not($wsmap)">
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; lacks wsmap attribute in XIDL.')" />
</xsl:call-template>
</xsl:when>
<xsl:when test="($wsmap='managed')">
<xsl:value-of select="concat(' comcall_', $name, ';')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text> break</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitInputArgConverter: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; has unsupported wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(' comcall_', $name, ' = ', $structprefix, $name)" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>;
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
emitTypeOrArray
-->
<xsl:template name="emitTypeOrArray">
<xsl:param name="type" />
<xsl:param name="safearray" />
<xsl:choose>
<xsl:when test="$safearray='yes'">
<xsl:value-of select="concat('com::SafeArray&lt;', $type, '&gt;')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$type" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
emitOutputArgBuffer:
another type converter (from wsdl type to COM types)
that generates a buffer variable which receives the
data from 'out' and 'return' parameters of the COM method call.
-->
<xsl:template name="emitOutputArgBuffer">
<xsl:param name="method" />
<xsl:param name="name" />
<xsl:param name="type" />
<xsl:param name="safearray" />
<xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
<xsl:text> // com output arg for </xsl:text><xsl:value-of select="concat($name, ' (safearray: ', $safearray, ')')" /><xsl:text>
</xsl:text>
<xsl:call-template name="emitCppTypeForIDLType">
<xsl:with-param name="method" select="$method" />
<xsl:with-param name="type" select="$type" />
<xsl:with-param name="safearray" select="$safearray" />
</xsl:call-template>
<xsl:value-of select="concat(' comcall_', $varprefix, $name, ';')" />
<xsl:call-template name="emitNewline" />
</xsl:template>
<!--
emitOutParam:
-->
<xsl:template name="emitOutParam">
<xsl:param name="name" />
<xsl:param name="type" />
<xsl:param name="safearray" />
<xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
<xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
<xsl:choose>
<xsl:when test="$safearray='yes'">
<xsl:value-of select="concat('ComSafeArrayAsOutParam(', $varname, ')')" />
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test=" ($type='boolean')
or ($type='short')
or ($type='unsigned short')
or ($type='long')
or ($type='unsigned long')
or ($type='long long')
or ($type='unsigned long long')
or ($type='result')
or (//enum[@name=$type])">
<xsl:text>&amp;</xsl:text><xsl:value-of select="$varname" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$varname" /><xsl:text>.asOutParam()</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
emitComCall:
emits the actual method call with the arguments.
-->
<xsl:template name="emitComCall">
<xsl:param name="object" /> <!-- normally "pObj->" -->
<xsl:param name="methodname" />
<xsl:param name="attrname" /> <!-- with attributes only -->
<xsl:param name="attrtype" /> <!-- with attributes only -->
<xsl:param name="attrsafearray" /> <!-- with attributes only -->
<xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" -->
<xsl:param name="varprefix" /> <!-- only with nested get-attribute calls -->
<xsl:variable name="comMethodName">
<xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template>
</xsl:variable>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, &quot;', $comMethodName, '&quot;));')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('rc = ', $object, '-&gt;', $comMethodName, '(')" />
<xsl:if test="$attrtype">
<xsl:choose>
<xsl:when test="$attrdir='in'">
<xsl:value-of select="concat('comcall_', $varprefix, @name)" />
<xsl:if test="$attrtype='wstring' or $attrtype='uuid'">
<xsl:text>.raw()</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="$attrdir='return'">
<xsl:call-template name="emitOutParam">
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="$attrsafearray" />
<xsl:with-param name="varprefix" select="$varprefix" />
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:for-each select="param">
<xsl:if test="position()=1">
<xsl:call-template name="emitNewline" />
</xsl:if>
<xsl:if test="position() > 1">
<xsl:text>,</xsl:text>
<xsl:call-template name="emitNewline" />
</xsl:if>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="@dir='in'">
<xsl:choose>
<xsl:when test="@safearray='yes'">
<xsl:value-of select="concat('ComSafeArrayAsInParam(comcall_', $varprefix, @name, ')')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('comcall_', $varprefix, @name)" />
<xsl:if test="@type='wstring' or @type='uuid'">
<xsl:text>.raw()</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@dir='out'">
<xsl:call-template name="emitOutParam">
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
<xsl:with-param name="varprefix" select="$varprefix" />
</xsl:call-template>
</xsl:when>
<xsl:when test="@dir='return'">
<xsl:call-template name="emitOutParam">
<xsl:with-param name="name" select="$G_result" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
<xsl:with-param name="varprefix" select="$varprefix" />
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:text>);</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text>if (FAILED(rc))</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text>{</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, rc, ', $object, ');')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text> break;</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text>}</xsl:text>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:text>WEBDEBUG((g_pcszDoneCallingComMethod));</xsl:text>
<xsl:call-template name="emitNewline" />
</xsl:template>
<!--
emitOutputArgBackConverter2: implementation details of emitOutputArgBackConverter.
-->
<xsl:template name="emitOutputArgBackConverter2">
<xsl:param name="name" />
<xsl:param name="varname" />
<xsl:param name="type" />
<xsl:param name="callerprefix" />
<xsl:choose>
<xsl:when test="$type='wstring' or $type='uuid'">
<xsl:value-of select="concat('ConvertComString(', $varname, ')')" />
</xsl:when>
<xsl:when test="$type='boolean'">
<!-- the "!!" avoids a microsoft compiler warning -->
<xsl:value-of select="concat('!!', $varname)" />
</xsl:when>
<xsl:when test=" ($type='octet')
or ($type='short')
or ($type='unsigned short')
or ($type='long')
or ($type='unsigned long')
or ($type='long long')
or ($type='unsigned long long')
or ($type='result')">
<xsl:value-of select="$varname" />
</xsl:when>
<xsl:when test="//enum[@name=$type]">
<xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
</xsl:when>
<xsl:when test="$type='$unknown'">
<xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
</xsl:when>
<xsl:when test="//interface[@name=$type]">
<!-- the type is one of our own interfaces: then it must have a wsmap attr -->
<xsl:variable name="thatif" select="//interface[@name=$type]" />
<xsl:variable name="wsmap" select="$thatif/@wsmap" />
<xsl:variable name="thatifname" select="$thatif/@name" />
<xsl:choose>
<xsl:when test=" ($wsmap='managed') or ($wsmap='global')">
<xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $thatifname, ', ', $varname, ')')" />
</xsl:when>
<xsl:when test="$wsmap='struct'">
<!-- prevent infinite recursion -->
<!-- <xsl:call-template name="fatalError"><xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: attempted infinite recursion for type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method)" /></xsl:call-template> -->
<xsl:if test="not($callerprefix)">
<xsl:value-of select="concat('/* convert COM interface to struct */ ', $G_funcPrefixOutputEnumConverter, $type, '(soap, idThis, rc, ', $varname, ')')" />
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $ifname, '::', $method, '&quot; has invalid wsmap attribute value &quot;', $wsmap, '&quot; in XIDL.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="//collection[@name=$type]">
<!-- the type is a collection of our own types: then build an array from it -->
<xsl:variable name="collectiontype" select="//collection[@name=$type]/@type" />
<xsl:variable name="targetwsmap" select="//interface[@name=$collectiontype]/@wsmap" />
<xsl:value-of select="concat('soap_new_vbox__ArrayOf', $collectiontype, '(soap, -1);')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:variable name="enumerator" select="concat('comcall_', $callerprefix, $name, '_enum')" />
<xsl:value-of select="concat('ComPtr&lt;', $collectiontype, 'Enumerator&gt; ', $enumerator, ';')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('CHECK_ERROR_BREAK( comcall_', $callerprefix, $name, ', Enumerate(', $enumerator, '.asOutParam()) );')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('BOOL comcall_', $callerprefix, $name, '_hasmore = FALSE;')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'do {'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', HasMore(&amp;comcall_', $callerprefix, $name, '_hasmore) );')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' if (!comcall_', $callerprefix, $name, '_hasmore) break;')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' ComPtr&lt;', $collectiontype, '&gt; arrayitem;')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' CHECK_ERROR_BREAK( ', $enumerator, ', GetNext(arrayitem.asOutParam()) );')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' // collection of &quot;', $collectiontype, '&quot;, target interface wsmap: &quot;', $targetwsmap, '&quot;')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' ', $G_responseElementVarName, '-&gt;', $G_result)" />
<xsl:value-of select="'->array.push_back('" />
<xsl:choose>
<xsl:when test="($targetwsmap='managed')">
<xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcsz', $collectiontype, ', arrayitem));')" />
</xsl:when>
<xsl:when test="$targetwsmap='struct'">
<xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $collectiontype, '(soap, idThis, rc, arrayitem));')" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $collectiontype, '&quot; of collection &quot;', $type, '&quot;, used in method &quot;', $method, '&quot;, has unsupported wsmap &quot;', $targetwsmap, '&quot;.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'} while (1)'" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitOutputArgBackConverter2: Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not supported.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
emitOutputArgBackConverter:
another type converter (from COM type back to WSDL)
which converts the output argument from the COM
method call back to the WSDL type passed in by the
caller.
-->
<xsl:template name="emitOutputArgBackConverter">
<xsl:param name="ifname" />
<xsl:param name="method" />
<xsl:param name="name" />
<xsl:param name="type" />
<xsl:param name="safearray" />
<xsl:param name="varprefix" /> <!-- only when called recursively from emitGetAttributeComCall -->
<xsl:param name="callerprefix" /> <!-- only for out params or when called recursively from emitGetAttributeComCall -->
<xsl:variable name="topname" select="$name" />
<xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat('WEBDEBUG((g_pcszConvertComOutputBack, &quot;', $name, '&quot;));')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:variable name="receiverVariable">
<xsl:choose>
<xsl:when test="(not($varprefix))">
<xsl:choose>
<xsl:when test="$callerprefix"> <!-- callerprefix set but varprefix not: then this is an out parameter :-) -->
<xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $name)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($G_responseElementVarName, '-&gt;', $G_result)" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($callerprefix, $G_result, '-&gt;', $name)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$safearray='yes'">
<xsl:value-of select="concat('for (size_t i = 0; i &lt; ', $varname, '.size(); ++i)')" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'{'" />
<xsl:call-template name="emitNewlineIndent8" />
<!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl -->
<xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
<xsl:choose>
<xsl:when test="//interface[@name=$type]">
<xsl:value-of select="concat(' ComPtr&lt;', $type, '&gt; tmpObject(', $varname, '[i]);')" />
</xsl:when>
<xsl:when test="//enum[@name=$type]">
<xsl:value-of select="concat(' ', $type, '_T tmpObject(', $varname, '[i]);')" />
</xsl:when>
<xsl:when test="$type='$unknown'">
<xsl:value-of select="concat(' ComPtr&lt;IUnknown&gt; tmpObject(', $varname, '[i]);')" />
</xsl:when>
<xsl:when test="$type='wstring' or $type='uuid'">
<xsl:value-of select="concat(' com::Bstr tmpObject(', $varname, '[i]);')" />
</xsl:when>
<xsl:when test="$gluetypefield">
<xsl:value-of select="concat(' ', $gluetypefield, ' tmpObject(', $varname, '[i]);')" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fatalError">
<xsl:with-param name="msg" select="concat('emitOutputArgBackConverter (1): Type &quot;', $type, '&quot; in arg &quot;', $name, '&quot; of method &quot;', $method, '&quot; is not yet supported in safearrays.')" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="concat(' ', $receiverVariable, '.push_back(')" />
<xsl:call-template name="emitOutputArgBackConverter2">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="varname" select="'tmpObject'"/>
<xsl:with-param name="type" select="$type"/>
<xsl:with-param name="callerprefix" select="$callerprefix"/>
</xsl:call-template>
<xsl:value-of select="');'" />
<xsl:call-template name="emitNewlineIndent8" />
<xsl:value-of select="'}'" />
<xsl:call-template name="emitNewline" />
</xsl:when>
<xsl:otherwise>
<!-- emit variable name: "resp->retval = " -->
<xsl:value-of select="$receiverVariable" />
<xsl:value-of select="' = '" />
<xsl:call-template name="emitOutputArgBackConverter2">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="varname" select="$varname"/>
<xsl:with-param name="type" select="$type"/>
<xsl:with-param name="callerprefix" select="$callerprefix"/>
</xsl:call-template>
<xsl:value-of select="';'" />
<xsl:call-template name="emitNewline" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat(' WEBDEBUG((g_pcszDoneConvertingComOutputBack, &quot;', $name, '&quot;));')" />
<xsl:call-template name="emitNewline" />
</xsl:template>
<!--
emitGetAttributeComCall
-->
<xsl:template name="emitGetAttributeComCall">
<xsl:param name="ifname" />
<xsl:param name="object" /> <!-- normally "pObj->" -->
<xsl:param name="attrname" />
<xsl:param name="attrtype" />
<xsl:param name="attrsafearray" />
<xsl:param name="varprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
<xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
<xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<xsl:call-template name="emitOutputArgBuffer">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="$attrsafearray" />
<xsl:with-param name="varprefix" select="$varprefix" />
</xsl:call-template>
<xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
<!-- actual COM method call -->
<xsl:call-template name="emitComCall">
<xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" />
<xsl:with-param name="object" select="$object" />
<xsl:with-param name="attrname" select="$attrname" />
<xsl:with-param name="attrtype" select="$attrtype" />
<xsl:with-param name="attrsafearray" select="$attrsafearray" />
<xsl:with-param name="attrdir" select="'return'" />
<xsl:with-param name="varprefix" select="$varprefix" />
</xsl:call-template>
<!-- convert back the output data -->
<xsl:call-template name="emitOutputArgBackConverter">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="method"><xsl:value-of select="$gettername" /></xsl:with-param>
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="$attrsafearray" />
<xsl:with-param name="varprefix" select="$varprefix" />
<xsl:with-param name="callerprefix" select="$callerprefix" />
</xsl:call-template>
</xsl:template>
<!--
emitSetAttributeComCall
-->
<xsl:template name="emitSetAttributeComCall">
<xsl:param name="ifname" />
<xsl:param name="object" /> <!-- normally "pObj->" -->
<xsl:param name="attrname" />
<xsl:param name="attrtype" />
<xsl:param name="attrsafearray" />
<xsl:param name="callerprefix" /> <!-- only when called recursively from emitOutputArgBackConverter-->
<xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable>
<xsl:call-template name="emitInputArgConverter">
<xsl:with-param name="method" select="concat($ifname, '::', $settername)" />
<xsl:with-param name="name" select="$attrname" />
<xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
<xsl:with-param name="type" select="$attrtype" />
<xsl:with-param name="safearray" select="$attrsafearray" />
</xsl:call-template>
<xsl:call-template name="emitComCall">
<xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" />
<xsl:with-param name="object" select="$object" />
<xsl:with-param name="attrname" select="$attrname" />
<xsl:with-param name="attrtype" select="$attrtype" />
<xsl:with-param name="attrsafearray" select="$attrsafearray" />
<xsl:with-param name="attrdir" select="'in'" />
</xsl:call-template>
</xsl:template>
<!--
emitGetAttributeMapper
-->
<xsl:template name="emitGetAttributeMapper">
<xsl:param name="ifname" />
<xsl:param name="wsmap" />
<xsl:param name="attrname" />
<xsl:param name="attrtype" />
<xsl:param name="attrreadonly" />
<xsl:param name="attrsafearray" />
<xsl:variable name="gettername"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<xsl:call-template name="emitBeginOfFunctionHeader">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$gettername" />
</xsl:call-template>
<xsl:call-template name="emitDocumentStyleArgStructs">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="methodname" select="$gettername" />
<xsl:with-param name="fOutputs" select="$attrtype" />
</xsl:call-template>
<xsl:text>)</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:text>{</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:value-of select="' HRESULT rc = S_OK;'" />
<xsl:call-template name="emitNewline" />
<xsl:call-template name="emitPrologue" />
<!-- actual COM method call -->
<!-- <xsl:choose>
array attributes/parameters are not supported yet...
<xsl:when test="@array or @safearray='yes'">
<xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
</xsl:when>
<xsl:otherwise> -->
<xsl:call-template name="emitObjForMethod">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
<xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
</xsl:call-template>
<xsl:call-template name="emitGetAttributeComCall">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="object" select='"pObj"' />
<xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
<xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
<xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param>
</xsl:call-template>
<!-- </xsl:otherwise>
</xsl:choose> -->
<xsl:call-template name="emitEpilogue" />
</xsl:template>
<!--
emitSetAttributeMapper:
-->
<xsl:template name="emitSetAttributeMapper">
<xsl:param name="ifname" select="$ifname" />
<xsl:param name="wsmap" select="$wsmap" />
<xsl:param name="attrname" select="$attrname" />
<xsl:param name="attrtype" select="$attrtype" />
<xsl:param name="attrreadonly" select="$attrreadonly" />
<xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
<xsl:call-template name="emitBeginOfFunctionHeader">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$settername" />
</xsl:call-template>
<xsl:call-template name="emitDocumentStyleArgStructs">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="methodname" select="$settername" />
<xsl:with-param name="fOutputs" select="1" />
</xsl:call-template>
<xsl:text>)</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:text>{</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:value-of select="' HRESULT rc = S_OK;'" />
<xsl:call-template name="emitNewline" />
<xsl:call-template name="emitPrologue" />
<!-- actual COM method call -->
<!-- <xsl:choose>
array attributes/parameters are not supported yet...
<xsl:when test="@array or @safearray='yes'">
<xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING ATTRIBUTE IMPLEMENTATION for &quot;', $attrname, '&quot; because it has array type. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
</xsl:when>
<xsl:otherwise> -->
<xsl:call-template name="emitObjForMethod">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
<xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
</xsl:call-template>
<xsl:call-template name="emitSetAttributeComCall">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="object" select='"pObj"' />
<xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param>
<xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param>
</xsl:call-template>
<!-- </xsl:otherwise>
</xsl:choose> -->
<xsl:call-template name="emitEpilogue" />
</xsl:template>
<!-- - - - - - - - - - - - - - - - - - - - - - -
interface
- - - - - - - - - - - - - - - - - - - - - - -->
<xsl:template match="interface">
<!-- remember the interface name in local variables -->
<xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
<xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
<xsl:variable name="wscpp"><xsl:value-of select="@wscpp" /></xsl:variable>
<!-- we can save ourselves verifying the interface here as it's already
done in the WSDL converter -->
<xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") or ($wscpp="hardcoded") )'>
<xsl:text>
/****************************************************************************
*
* interface </xsl:text>
<xsl:copy-of select="$ifname" />
<xsl:text>
*
****************************************************************************/
</xsl:text>
<!--
here come the attributes
-->
<xsl:for-each select="attribute">
<xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
<xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
<xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
<xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
<xsl:call-template name="emitNewline" />
<!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
<xsl:choose>
<xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
<xsl:value-of select="concat('// Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype)" />
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@readonly='yes'">
<xsl:value-of select="concat('// read-only attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname, ' of type ', $attrtype)" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat(' (safearray: ', $attrsafearray, ')')" />
<!-- emit getter method -->
<xsl:call-template name="emitGetAttributeMapper">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="wsmap" select="$wsmap" />
<xsl:with-param name="attrname" select="$attrname" />
<xsl:with-param name="attrtype" select="$attrtype" />
<xsl:with-param name="attrreadonly" select="$attrreadonly" />
<xsl:with-param name="attrsafearray" select="$attrsafearray" />
</xsl:call-template>
<!-- for read-write attributes, emit setter method -->
<xsl:if test="not(@readonly='yes')">
<xsl:call-template name="emitSetAttributeMapper">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="wsmap" select="$wsmap" />
<xsl:with-param name="attrname" select="$attrname" />
<xsl:with-param name="attrtype" select="$attrtype" />
<xsl:with-param name="attrreadonly" select="$attrreadonly" />
</xsl:call-template>
</xsl:if>
</xsl:otherwise> <!-- not wsmap=suppress -->
</xsl:choose>
</xsl:for-each>
<!--
here come the real methods
-->
<xsl:for-each select="method">
<xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
<!-- method header: return value "int", method name, soap arguments -->
<!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
<xsl:choose>
<xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
or (param[@mod='ptr'])" >
<xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="fHasReturnParms" select="param[@dir='return']" />
<xsl:variable name="fHasOutParms" select="param[@dir='out']" />
<xsl:call-template name="emitNewline" />
<xsl:value-of select="concat('/* method ', $ifname, '::', $methodname, '(')" />
<xsl:for-each select="param">
<xsl:call-template name="emitNewline" />
<xsl:value-of select="concat(' [', @dir, '] ', @type, ' ', @name)" />
<xsl:if test="@safearray='yes'">
<xsl:text>[]</xsl:text>
</xsl:if>
<xsl:if test="not(position()=last())">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:text> */</xsl:text>
<xsl:call-template name="emitBeginOfFunctionHeader">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="method" select="$methodname" />
</xsl:call-template>
<xsl:call-template name="emitDocumentStyleArgStructs">
<xsl:with-param name="ifname" select="$ifname" />
<xsl:with-param name="methodname" select="$methodname" />
<xsl:with-param name="fOutputs" select="1" />
</xsl:call-template>
<xsl:text>)</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:text>{</xsl:text>
<xsl:call-template name="emitNewline" />
<xsl:value-of select="' HRESULT rc = S_OK;'" />
<xsl:call-template name="emitNewline" />
<xsl:call-template name="emitPrologue" />
<xsl:choose>
<xsl:when test="param[@array]">
<xsl:call-template name="warning"><xsl:with-param name="msg" select="concat('emitComCall: SKIPPING METHOD IMPLEMENTATION for &quot;', $methodname, '&quot; because it has arguments with &quot;array&quot; types. THIS SOAP METHOD WILL NOT DO ANYTHING!')" /></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- emit the object upon which to invoke the method -->
<xsl:call-template name="emitObjForMethod">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="wsmap"><xsl:value-of select="$wsmap" /></xsl:with-param>
<xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
</xsl:call-template>
<!-- next, emit storage variables to convert the SOAP/C++ arguments to COM types -->
<xsl:for-each select="param">
<xsl:variable name="dir" select="@dir" />
<xsl:choose>
<xsl:when test="$dir='in'">
<xsl:call-template name="emitInputArgConverter">
<xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
<xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '-&gt;')" />
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$dir='out'">
<xsl:call-template name="emitOutputArgBuffer">
<xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
<xsl:with-param name="name" select="@name" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$dir='return'">
<xsl:call-template name="emitOutputArgBuffer">
<xsl:with-param name="method" select="concat($ifname, '::', $methodname)" />
<xsl:with-param name="name" select="$G_result" />
<xsl:with-param name="type" select="@type" />
<xsl:with-param name="safearray" select="@safearray" />
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- actual COM method call -->
<xsl:call-template name="emitComCall">
<xsl:with-param name="object" select='"pObj"' />
<xsl:with-param name="methodname">
<xsl:call-template name="capitalize">
<xsl:with-param name="str" select="$methodname" />
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<!-- convert back the output data -->
<xsl:for-each select="param">
<xsl:variable name="dir" select="@dir" />
<xsl:if test="$dir='out'">
<xsl:call-template name="emitOutputArgBackConverter">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
<xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
<xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
<xsl:with-param name="callerprefix" select="'outparms.'"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$dir='return'">
<!-- return values _normally_ should convert to the input arg from the function prototype,
except when there are both return and out params; in that case gsoap squeezes them all
into the output args structure and the return thing is called "retval" -->
<xsl:choose>
<xsl:when test="$fHasOutParms">
<xsl:call-template name="emitOutputArgBackConverter">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
<xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
<xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
<xsl:with-param name="callerprefix" select="'outparms.'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="emitOutputArgBackConverter">
<xsl:with-param name="ifname"><xsl:value-of select="$ifname" /></xsl:with-param>
<xsl:with-param name="method" select="$methodname" />
<xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
<xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
<xsl:with-param name="safearray"><xsl:value-of select="@safearray" /></xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="emitEpilogue" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>