1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 xmlns:exsl="http://exslt.org/common" 4 extension-element-prefixes="exsl" 5 version="1.0"> 6 7 <xsl:template name="header"> 8<exsl:document href="g{/format/@format}.h" method="text"> 9// 10// g<xsl:value-of select="/format/@format"/>.h 11// 12// This file is generated by codegen/header.xsl 13// DO NOT MODIFY 14// 15 16 17#ifndef <xsl:value-of select="/format/@format"/>_H 18#define <xsl:value-of select="/format/@format"/>_H 19 20#include <cinttypes> 21#include <cstdint> 22#include <<xsl:value-of select="/format/@format"/>Reader.h> 23#include <<xsl:value-of select="/format/@format"/>Tag.h> 24#include <<xsl:value-of select="/format/@format"/>Action.h> 25#include <<xsl:value-of select="/format/@format"/>Filter.h> 26#include <<xsl:value-of select="/format/@format"/>Trait.h> 27#include <<xsl:value-of select="/format/@format"/>List.h> 28#include <<xsl:value-of select="/format/@format"/>ShapeItem.h> 29#include <<xsl:value-of select="/format/@format"/>GlyphList.h> 30#include <<xsl:value-of select="/format/@format"/>IdItems.h> 31#include <<xsl:value-of select="/format/@format"/>OpCode.h> 32 33namespace <xsl:value-of select="/format/@format"/> { 34 35struct Context { 36 public: 37 Context(); 38 39 int swfVersion; 40 bool transientPropsToXML; 41 bool debugTrace; 42 bool exportAssets; 43 bool quiet; 44 45 bool isLast; 46 char tagVersion; 47 bool alpha; 48 bool many_shapes; 49 50 bool convertEncoding; 51 const char *swf_encoding; 52 53 <xsl:for-each select="contextvariable"> 54 <xsl:variable name="tmp"> 55 <xsl:element name="{@type}"/> 56 </xsl:variable> 57 <xsl:apply-templates select="exsl:node-set($tmp)" mode="ctype"/> 58 <xsl:text> </xsl:text> 59 <xsl:value-of select="@name"/>; 60 </xsl:for-each> 61}; 62 63<xsl:for-each select="type|tag|action|filter|style|stackitem|namespaceconstant|multinameconstant|trait|opcode"> 64class <xsl:value-of select="@name"/> : public <xsl:apply-templates select="." mode="baseclass"/> { 65 public: 66 <xsl:value-of select="@name"/>(); 67 virtual ~<xsl:value-of select="@name"/>(); 68 69 virtual bool parse( Reader *r, int end, Context *ctx ); 70 virtual void dump( int indent, Context *ctx ); 71 virtual size_t calcSize( Context *ctx, int start_at ); 72 virtual void write( Writer *w, Context *ctx ); 73 virtual void writeXML( xmlNodePtr xml, Context *ctx ); 74 virtual void parseXML( xmlNodePtr xml, Context *ctx ); 75 76 static <xsl:value-of select="@name"/>* get( Reader *r, int end, Context *ctx ); 77 static <xsl:value-of select="@name"/>* getByName( const char *name ); 78 79 <xsl:apply-templates mode="declareAccessors"/> 80 81 protected: 82 <xsl:apply-templates mode="declare"/> 83 84 <xsl:if test="@id"> 85 static int id; 86 </xsl:if> 87}; 88</xsl:for-each> 89 90} 91#endif 92</exsl:document> 93 </xsl:template> 94 95<!-- definitions --> 96 <xsl:template match="flagged|if" mode="declare"> 97 <xsl:apply-templates mode="declare"/> 98 </xsl:template> 99 <xsl:template match="fill-byte|context" mode="declare"/> 100 101 <xsl:template match="*" mode="declare" priority="-1"> 102 <xsl:apply-templates mode="ctype" select="."/><xsl:text> </xsl:text><xsl:value-of select="@name"/>; // <xsl:value-of select="name()"/><xsl:text> 103</xsl:text> 104 </xsl:template> 105 106<!-- accessor definitions --> 107 <xsl:template match="flagged|if" mode="declareAccessors"> 108 <xsl:apply-templates mode="declareAccessors"/> 109 </xsl:template> 110 <xsl:template match="fill-byte|context" mode="declareAccessors"/> 111 <xsl:template match="byte|word|byteOrWord|string|fixedpoint|fixedpoint2|bit|integer|uint32|float|double|half|u30|s24|encodedu32" mode="declareAccessors" priority="-1"> 112 <xsl:apply-templates mode="ctype" select="."/><xsl:text> </xsl:text>get<xsl:value-of select="@name"/>(); 113 void set<xsl:value-of select="@name"/>( <xsl:apply-templates mode="ctype" select="."/> ); 114 </xsl:template> 115 <xsl:template match="xml" mode="declareAccessors" priority="-1"> 116 <xsl:apply-templates mode="ctype" select="."/><xsl:text> </xsl:text>get<xsl:value-of select="@name"/>(); 117 void set<xsl:value-of select="@name"/>( <xsl:apply-templates mode="ctype" select="."/> ); 118 </xsl:template> 119 <xsl:template match="data" mode="declareAccessors" priority="-1"> 120 void get<xsl:value-of select="@name"/>( unsigned char **dst, int *size ); 121 void set<xsl:value-of select="@name"/>( const unsigned char *src, int size ); 122 </xsl:template> 123 <xsl:template match="object" mode="declareAccessors" priority="-1"> 124 <xsl:apply-templates mode="ctype" select="."/> *get<xsl:value-of select="@name"/>(); 125 </xsl:template> 126 <xsl:template match="list" mode="declareAccessors" priority="-1"> 127 <xsl:apply-templates mode="ctype" select="."/> *get<xsl:value-of select="@name"/>(); 128 </xsl:template> 129 130<!-- base classes --> 131 <xsl:template match="type" mode="baseclass"> 132 <xsl:choose> 133 <xsl:when test="@parent"> 134 <xsl:value-of select="@parent"/> 135 </xsl:when> 136 <xsl:otherwise>Item</xsl:otherwise> 137 </xsl:choose> 138 </xsl:template> 139 <xsl:template match="tag" mode="baseclass">Tag</xsl:template> 140 <xsl:template match="action" mode="baseclass">Action</xsl:template> 141 <xsl:template match="filter" mode="baseclass">Filter</xsl:template> 142 <xsl:template match="style" mode="baseclass">Style</xsl:template> 143 <xsl:template match="stackitem" mode="baseclass">StackItem</xsl:template> 144 <xsl:template match="namespaceconstant" mode="baseclass">NamespaceConstant</xsl:template> 145 <xsl:template match="multinameconstant" mode="baseclass">MultinameConstant</xsl:template> 146 <xsl:template match="trait" mode="baseclass">Trait</xsl:template> 147 <xsl:template match="opcode" mode="baseclass">OpCode</xsl:template> 148 149</xsl:stylesheet> 150