esdl2cpp_srvcpp.xslt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ##############################################################################
  4. # HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. ##############################################################################
  18. -->
  19. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  20. <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
  21. <xsl:template match="esxdl">
  22. <xsl:variable name="servicename"><xsl:value-of select="EsdlService/@name"/></xsl:variable>
  23. <xsl:text>#include "</xsl:text><xsl:value-of select="$servicename"/>Service.hpp"
  24. #include "jliball.hpp"
  25. #include "jlog.hpp"
  26. #include "jptree.hpp"
  27. <xsl:apply-templates select="EsdlService"/>
  28. <xsl:text>extern "C" </xsl:text><xsl:value-of select="$servicename"/>ServiceBase* create<xsl:value-of select="$servicename"/>ServiceObj()
  29. {
  30. return new <xsl:value-of select="$servicename"/>Service();
  31. }<xsl:text>
  32. </xsl:text>
  33. </xsl:template>
  34. <xsl:template match="EsdlService">
  35. <xsl:variable name="servicename" select="@name"/>
  36. <xsl:for-each select="EsdlMethod">
  37. <xsl:value-of select="@response_type"/>* <xsl:value-of select="$servicename"/>Service::<xsl:value-of select="@name"/>(EsdlContext* context, <xsl:value-of select="@request_type"/>* request)
  38. {
  39. Owned&lt;<xsl:value-of select="@response_type"/>&gt; resp = new <xsl:value-of select="@response_type"/>();
  40. //Fill in logic
  41. return resp.getClear();
  42. }<xsl:text>
  43. </xsl:text>
  44. </xsl:for-each>
  45. </xsl:template>
  46. </xsl:stylesheet>