update SEP definition

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-16 09:10:57 +00:00
parent de1e4e61d5
commit 07eb383363
3 changed files with 491 additions and 207 deletions

View File

@ -18,7 +18,6 @@
package org.apache.poi.hwpf.model.types;
import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.DateAndTime;
@ -29,12 +28,33 @@ import org.apache.poi.hwpf.usermodel.DateAndTime;
*
* @author S. Ryan Ackley
*/
public abstract class SEPAbstractType implements HDFType {
public abstract class SEPAbstractType
{
protected byte field_1_bkc;
/** No break */
/**/public final static byte BKC_NO_BREAK = 0;
/** New column */
/**/public final static byte BKC_NEW_COLUMN = 1;
/** New page */
/**/public final static byte BKC_NEW_PAGE = 2;
/** Even page */
/**/public final static byte BKC_EVEN_PAGE = 3;
/** Odd page */
/**/public final static byte BKC_ODD_PAGE = 4;
protected boolean field_2_fTitlePage;
protected boolean field_3_fAutoPgn;
protected byte field_4_nfcPgn;
/** Arabic */
/**/public final static byte NFCPGN_ARABIC = 0;
/** Roman (upper case) */
/**/public final static byte NFCPGN_ROMAN_UPPER_CASE = 1;
/** Roman (lower case) */
/**/public final static byte NFCPGN_ROMAN_LOWER_CASE = 2;
/** Letter (upper case) */
/**/public final static byte NFCPGN_LETTER_UPPER_CASE = 3;
/** Letter (lower case) */
/**/public final static byte NFCPGN_LETTER_LOWER_CASE = 4;
protected boolean field_5_fUnlocked;
protected byte field_6_cnsPgn;
protected boolean field_7_fPgnRestart;
@ -61,7 +81,9 @@ public abstract class SEPAbstractType implements HDFType {
protected int field_28_dyaLinePitch;
protected int field_29_clm;
protected int field_30_unused2;
protected byte field_31_dmOrientPage;
protected boolean field_31_dmOrientPage;
/**/public final static boolean DMORIENTPAGE_LANDSCAPE = false;
/**/public final static boolean DMORIENTPAGE_PORTRAIT = true;
protected byte field_32_iHeadingPgn;
protected int field_33_pgnStart;
protected int field_34_lnnMin;
@ -91,24 +113,165 @@ public abstract class SEPAbstractType implements HDFType {
protected short field_58_unused6;
protected byte[] field_59_olstAnm;
public SEPAbstractType()
protected SEPAbstractType()
{
}
/**
* Size of record (exluding 4 byte header)
*/
public int getSize()
{
return 4 + + 1 + 0 + 0 + 1 + 0 + 1 + 0 + 0 + 1 + 1 + 2 + 4 + 2 + 2 + 0 + 1 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 0 + 2 + 4 + 4 + 4 + 2 + 2 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 2 + 0 + 1 + 4 + 356 + 4 + 1 + 1 + 2 + 212;
this.field_1_bkc = 2;
this.field_8_fEndNote = true;
this.field_13_dxaPgn = 720;
this.field_14_dyaPgn = 720;
this.field_31_dmOrientPage = true;
this.field_33_pgnStart = 1;
this.field_39_xaPage = 12240;
this.field_40_yaPage = 15840;
this.field_41_xaPageNUp = 12240;
this.field_42_yaPageNUp = 15840;
this.field_43_dxaLeft = 1800;
this.field_44_dxaRight = 1800;
this.field_45_dyaTop = 1440;
this.field_46_dyaBottom = 1440;
this.field_48_dyaHdrTop = 720;
this.field_49_dyaHdrBottom = 720;
this.field_51_fEvenlySpaced = true;
this.field_53_dxaColumns = 720;
}
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("[SEP]\n");
builder.append(" .bkc = ");
builder.append(" (").append(getBkc()).append(" )\n");
builder.append(" .fTitlePage = ");
builder.append(" (").append(getFTitlePage()).append(" )\n");
builder.append(" .fAutoPgn = ");
builder.append(" (").append(getFAutoPgn()).append(" )\n");
builder.append(" .nfcPgn = ");
builder.append(" (").append(getNfcPgn()).append(" )\n");
builder.append(" .fUnlocked = ");
builder.append(" (").append(getFUnlocked()).append(" )\n");
builder.append(" .cnsPgn = ");
builder.append(" (").append(getCnsPgn()).append(" )\n");
builder.append(" .fPgnRestart = ");
builder.append(" (").append(getFPgnRestart()).append(" )\n");
builder.append(" .fEndNote = ");
builder.append(" (").append(getFEndNote()).append(" )\n");
builder.append(" .lnc = ");
builder.append(" (").append(getLnc()).append(" )\n");
builder.append(" .grpfIhdt = ");
builder.append(" (").append(getGrpfIhdt()).append(" )\n");
builder.append(" .nLnnMod = ");
builder.append(" (").append(getNLnnMod()).append(" )\n");
builder.append(" .dxaLnn = ");
builder.append(" (").append(getDxaLnn()).append(" )\n");
builder.append(" .dxaPgn = ");
builder.append(" (").append(getDxaPgn()).append(" )\n");
builder.append(" .dyaPgn = ");
builder.append(" (").append(getDyaPgn()).append(" )\n");
builder.append(" .fLBetween = ");
builder.append(" (").append(getFLBetween()).append(" )\n");
builder.append(" .vjc = ");
builder.append(" (").append(getVjc()).append(" )\n");
builder.append(" .dmBinFirst = ");
builder.append(" (").append(getDmBinFirst()).append(" )\n");
builder.append(" .dmBinOther = ");
builder.append(" (").append(getDmBinOther()).append(" )\n");
builder.append(" .dmPaperReq = ");
builder.append(" (").append(getDmPaperReq()).append(" )\n");
builder.append(" .brcTop = ");
builder.append(" (").append(getBrcTop()).append(" )\n");
builder.append(" .brcLeft = ");
builder.append(" (").append(getBrcLeft()).append(" )\n");
builder.append(" .brcBottom = ");
builder.append(" (").append(getBrcBottom()).append(" )\n");
builder.append(" .brcRight = ");
builder.append(" (").append(getBrcRight()).append(" )\n");
builder.append(" .fPropMark = ");
builder.append(" (").append(getFPropMark()).append(" )\n");
builder.append(" .ibstPropRMark = ");
builder.append(" (").append(getIbstPropRMark()).append(" )\n");
builder.append(" .dttmPropRMark = ");
builder.append(" (").append(getDttmPropRMark()).append(" )\n");
builder.append(" .dxtCharSpace = ");
builder.append(" (").append(getDxtCharSpace()).append(" )\n");
builder.append(" .dyaLinePitch = ");
builder.append(" (").append(getDyaLinePitch()).append(" )\n");
builder.append(" .clm = ");
builder.append(" (").append(getClm()).append(" )\n");
builder.append(" .unused2 = ");
builder.append(" (").append(getUnused2()).append(" )\n");
builder.append(" .dmOrientPage = ");
builder.append(" (").append(getDmOrientPage()).append(" )\n");
builder.append(" .iHeadingPgn = ");
builder.append(" (").append(getIHeadingPgn()).append(" )\n");
builder.append(" .pgnStart = ");
builder.append(" (").append(getPgnStart()).append(" )\n");
builder.append(" .lnnMin = ");
builder.append(" (").append(getLnnMin()).append(" )\n");
builder.append(" .wTextFlow = ");
builder.append(" (").append(getWTextFlow()).append(" )\n");
builder.append(" .unused3 = ");
builder.append(" (").append(getUnused3()).append(" )\n");
builder.append(" .pgbProp = ");
builder.append(" (").append(getPgbProp()).append(" )\n");
builder.append(" .unused4 = ");
builder.append(" (").append(getUnused4()).append(" )\n");
builder.append(" .xaPage = ");
builder.append(" (").append(getXaPage()).append(" )\n");
builder.append(" .yaPage = ");
builder.append(" (").append(getYaPage()).append(" )\n");
builder.append(" .xaPageNUp = ");
builder.append(" (").append(getXaPageNUp()).append(" )\n");
builder.append(" .yaPageNUp = ");
builder.append(" (").append(getYaPageNUp()).append(" )\n");
builder.append(" .dxaLeft = ");
builder.append(" (").append(getDxaLeft()).append(" )\n");
builder.append(" .dxaRight = ");
builder.append(" (").append(getDxaRight()).append(" )\n");
builder.append(" .dyaTop = ");
builder.append(" (").append(getDyaTop()).append(" )\n");
builder.append(" .dyaBottom = ");
builder.append(" (").append(getDyaBottom()).append(" )\n");
builder.append(" .dzaGutter = ");
builder.append(" (").append(getDzaGutter()).append(" )\n");
builder.append(" .dyaHdrTop = ");
builder.append(" (").append(getDyaHdrTop()).append(" )\n");
builder.append(" .dyaHdrBottom = ");
builder.append(" (").append(getDyaHdrBottom()).append(" )\n");
builder.append(" .ccolM1 = ");
builder.append(" (").append(getCcolM1()).append(" )\n");
builder.append(" .fEvenlySpaced = ");
builder.append(" (").append(getFEvenlySpaced()).append(" )\n");
builder.append(" .unused5 = ");
builder.append(" (").append(getUnused5()).append(" )\n");
builder.append(" .dxaColumns = ");
builder.append(" (").append(getDxaColumns()).append(" )\n");
builder.append(" .rgdxaColumn = ");
builder.append(" (").append(getRgdxaColumn()).append(" )\n");
builder.append(" .dxaColumnWidth = ");
builder.append(" (").append(getDxaColumnWidth()).append(" )\n");
builder.append(" .dmOrientFirst = ");
builder.append(" (").append(getDmOrientFirst()).append(" )\n");
builder.append(" .fLayout = ");
builder.append(" (").append(getFLayout()).append(" )\n");
builder.append(" .unused6 = ");
builder.append(" (").append(getUnused6()).append(" )\n");
builder.append(" .olstAnm = ");
builder.append(" (").append(getOlstAnm()).append(" )\n");
builder.append("[/SEP]\n");
return builder.toString();
}
/**
* Get the bkc field for the SEP record.
* Break code.
*
* @return One of
* <li>{@link #BKC_NO_BREAK}
* <li>{@link #BKC_NEW_COLUMN}
* <li>{@link #BKC_NEW_PAGE}
* <li>{@link #BKC_EVEN_PAGE}
* <li>{@link #BKC_ODD_PAGE}
*/
public byte getBkc()
{
@ -116,7 +279,15 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Set the bkc field for the SEP record.
* Break code.
*
* @param field_1_bkc
* One of
* <li>{@link #BKC_NO_BREAK}
* <li>{@link #BKC_NEW_COLUMN}
* <li>{@link #BKC_NEW_PAGE}
* <li>{@link #BKC_EVEN_PAGE}
* <li>{@link #BKC_ODD_PAGE}
*/
public void setBkc(byte field_1_bkc)
{
@ -124,7 +295,7 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Get the fTitlePage field for the SEP record.
* Set to 1 when a title page is to be displayed.
*/
public boolean getFTitlePage()
{
@ -132,7 +303,7 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Set the fTitlePage field for the SEP record.
* Set to 1 when a title page is to be displayed.
*/
public void setFTitlePage(boolean field_2_fTitlePage)
{
@ -140,7 +311,7 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Get the fAutoPgn field for the SEP record.
* Only for Macintosh compatibility, used only during open, when 1, sep.dxaPgn and sep.dyaPgn are valid page number locations.
*/
public boolean getFAutoPgn()
{
@ -148,7 +319,7 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Set the fAutoPgn field for the SEP record.
* Only for Macintosh compatibility, used only during open, when 1, sep.dxaPgn and sep.dyaPgn are valid page number locations.
*/
public void setFAutoPgn(boolean field_3_fAutoPgn)
{
@ -156,7 +327,14 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Get the nfcPgn field for the SEP record.
* Page number format code.
*
* @return One of
* <li>{@link #NFCPGN_ARABIC}
* <li>{@link #NFCPGN_ROMAN_UPPER_CASE}
* <li>{@link #NFCPGN_ROMAN_LOWER_CASE}
* <li>{@link #NFCPGN_LETTER_UPPER_CASE}
* <li>{@link #NFCPGN_LETTER_LOWER_CASE}
*/
public byte getNfcPgn()
{
@ -164,7 +342,15 @@ public abstract class SEPAbstractType implements HDFType {
}
/**
* Set the nfcPgn field for the SEP record.
* Page number format code.
*
* @param field_4_nfcPgn
* One of
* <li>{@link #NFCPGN_ARABIC}
* <li>{@link #NFCPGN_ROMAN_UPPER_CASE}
* <li>{@link #NFCPGN_ROMAN_LOWER_CASE}
* <li>{@link #NFCPGN_LETTER_UPPER_CASE}
* <li>{@link #NFCPGN_LETTER_LOWER_CASE}
*/
public void setNfcPgn(byte field_4_nfcPgn)
{
@ -589,16 +775,25 @@ public abstract class SEPAbstractType implements HDFType {
/**
* Get the dmOrientPage field for the SEP record.
*
* @return One of
* <li>{@link #DMORIENTPAGE_LANDSCAPE}
* <li>{@link #DMORIENTPAGE_PORTRAIT}
*/
public byte getDmOrientPage()
public boolean getDmOrientPage()
{
return field_31_dmOrientPage;
}
/**
* Set the dmOrientPage field for the SEP record.
*
* @param field_31_dmOrientPage
* One of
* <li>{@link #DMORIENTPAGE_LANDSCAPE}
* <li>{@link #DMORIENTPAGE_PORTRAIT}
*/
public void setDmOrientPage(byte field_31_dmOrientPage)
public void setDmOrientPage(boolean field_31_dmOrientPage)
{
this.field_31_dmOrientPage = field_31_dmOrientPage;
}
@ -1051,9 +1246,4 @@ public abstract class SEPAbstractType implements HDFType {
this.field_59_olstAnm = field_59_olstAnm;
}
} // END OF CLASS

View File

@ -17,26 +17,39 @@
limitations under the License.
====================================================================
-->
<record id="0x101B" name="SEP" package="org.apache.poi.hwpf.model.types">
<record id="0x101B" name="SEP" fromfile="false" package="org.apache.poi.hwpf.model.types">
<suffix>AbstractType</suffix>
<extends>HDFType</extends>
<description>Section Properties.</description>
<author>S. Ryan Ackley</author>
<fields>
<field type="byte" size="1" name="bkc"/>
<field type="boolean" size="0" name="fTitlePage"/>
<field type="boolean" size="0" name="fAutoPgn"/>
<field type="byte" size="1" name="nfcPgn"/>
<field type="boolean" size="0" name="fUnlocked"/>
<field type="byte" size="1" name="bkc" default="2" description="Break code">
<const type="byte" value="0" name="NO_BREAK" description="No break"/>
<const type="byte" value="1" name="NEW_COLUMN" description="New column"/>
<const type="byte" value="2" name="NEW_PAGE" description="New page"/>
<const type="byte" value="3" name="EVEN_PAGE" description="Even page"/>
<const type="byte" value="4" name="ODD_PAGE" description="Odd page"/>
</field>
<field type="boolean" size="1" name="fTitlePage" description="Set to 1 when a title page is to be displayed"/>
<field type="boolean" size="1" name="fAutoPgn"
description="Only for Macintosh compatibility, used only during open, when 1, sep.dxaPgn and sep.dyaPgn are valid page number locations"/>
<field type="byte" size="1" name="nfcPgn" description="Page number format code">
<const type="byte" name="ARABIC" value="0" description="Arabic"/>
<const type="byte" name="ROMAN_UPPER_CASE" value="1" description="Roman (upper case)"/>
<const type="byte" name="ROMAN_LOWER_CASE" value="2" description="Roman (lower case)"/>
<const type="byte" name="LETTER_UPPER_CASE" value="3" description="Letter (upper case)"/>
<const type="byte" name="LETTER_LOWER_CASE" value="4" description="Letter (lower case)"/>
</field>
<field type="boolean" size="1" name="fUnlocked"/>
<field type="byte" size="1" name="cnsPgn"/>
<field type="boolean" size="0" name="fPgnRestart"/>
<field type="boolean" size="0" name="fEndNote"/>
<field type="boolean" size="1" name="fPgnRestart"/>
<field type="boolean" size="1" default="true" name="fEndNote"/>
<field type="byte" size="1" name="lnc"/>
<field type="byte" size="1" name="grpfIhdt"/>
<field type="int" size="2" name="nLnnMod"/>
<field type="int" size="4" name="dxaLnn"/>
<field type="int" size="2" name="dxaPgn"/>
<field type="int" size="2" name="dyaPgn"/>
<field type="int" size="2" default="720" name="dxaPgn"/>
<field type="int" size="2" default="720" name="dyaPgn"/>
<field type="boolean" size="0" name="fLBetween"/>
<field type="byte" size="1" name="vjc"/>
<field type="int" size="2" name="dmBinFirst"/>
@ -46,36 +59,39 @@
<field type="BorderCode" size="4" name="brcLeft"/>
<field type="BorderCode" size="4" name="brcBottom"/>
<field type="BorderCode" size="4" name="brcRight"/>
<field type="boolean" size="0" name="fPropMark"/>
<field type="boolean" size="1" name="fPropMark"/>
<field type="int" size="2" name="ibstPropRMark"/>
<field type="DateAndTime" size="4" name="dttmPropRMark"/>
<field type="int" size="4" name="dxtCharSpace"/>
<field type="int" size="4" name="dyaLinePitch"/>
<field type="int" size="2" name="clm"/>
<field type="int" size="2" name="unused2"/>
<field type="byte" size="1" name="dmOrientPage"/>
<field type="boolean" size="1" default="true" name="dmOrientPage">
<const type="boolean" name="LANDSCAPE" value="false"/>
<const type="boolean" name="PORTRAIT" value="true"/>
</field>
<field type="byte" size="1" name="iHeadingPgn"/>
<field type="int" size="2" name="pgnStart"/>
<field type="int" size="2" default="1" name="pgnStart"/>
<field type="int" size="2" name="lnnMin"/>
<field type="int" size="2" name="wTextFlow"/>
<field type="short" size="2" name="unused3"/>
<field type="int" size="2" name="pgbProp"/>
<field type="short" size="2" name="unused4"/>
<field type="int" size="4" name="xaPage"/>
<field type="int" size="4" name="yaPage"/>
<field type="int" size="4" name="xaPageNUp"/>
<field type="int" size="4" name="yaPageNUp"/>
<field type="int" size="4" name="dxaLeft"/>
<field type="int" size="4" name="dxaRight"/>
<field type="int" size="4" name="dyaTop"/>
<field type="int" size="4" name="dyaBottom"/>
<field type="int" size="4" default="12240" name="xaPage"/>
<field type="int" size="4" default="15840" name="yaPage"/>
<field type="int" size="4" default="12240" name="xaPageNUp"/>
<field type="int" size="4" default="15840" name="yaPageNUp"/>
<field type="int" size="4" default="1800" name="dxaLeft"/>
<field type="int" size="4" default="1800" name="dxaRight"/>
<field type="int" size="4" default="1440" name="dyaTop"/>
<field type="int" size="4" default="1440" name="dyaBottom"/>
<field type="int" size="4" name="dzaGutter"/>
<field type="int" size="4" name="dyaHdrTop"/>
<field type="int" size="4" name="dyaHdrBottom"/>
<field type="int" size="4" default="720" name="dyaHdrTop"/>
<field type="int" size="4" default="720" name="dyaHdrBottom"/>
<field type="int" size="2" name="ccolM1"/>
<field type="boolean" size="0" name="fEvenlySpaced"/>
<field type="boolean" size="0" default="true" name="fEvenlySpaced"/>
<field type="byte" size="1" name="unused5"/>
<field type="int" size="4" name="dxaColumns"/>
<field type="int" size="4" default="720" name="dxaColumns"/>
<field type="int[]" size="356" name="rgdxaColumn"/>
<field type="int" size="4" name="dxaColumnWidth"/>
<field type="byte" size="1" name="dmOrientFirst"/>

View File

@ -31,37 +31,65 @@
package <xsl:value-of select="@package"/>;
</xsl:if>
import org.apache.poi.util.BitField;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;
import org.apache.poi.util.HexDump;
import org.apache.poi.hdf.model.hdftypes.HDFType;
import org.apache.poi.hwpf.usermodel.*;
/**
* <xsl:value-of select="/record/description"/>
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/records/definitions.
<xsl:apply-templates select="author"/>
* remove the record in src/types/definitions.
<xsl:apply-templates select="author"/><xsl:text>
*/
public abstract class <xsl:value-of select="@name"/>AbstractType
implements HDFType
public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>AbstractType
{
<xsl:for-each select="//fields/field"> protected <xsl:value-of select="@type"/><xsl:text> field_</xsl:text><xsl:value-of select="position()"/>_<xsl:value-of select="@name"/>;
<xsl:apply-templates select="./bit|./const"/>
</xsl:for-each>
</xsl:text>
<xsl:for-each select="//fields/field">
<xsl:call-template name="indent"/>
<xsl:text>protected </xsl:text>
<xsl:value-of select="@type"/>
<xsl:text> field_</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>;</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:apply-templates select="./bit|./const"/>
</xsl:for-each>
public <xsl:value-of select="@name"/>AbstractType()
{
<xsl:for-each select="//fields/field"><xsl:if test="@default">
<xsl:text> </xsl:text>
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/> = <xsl:value-of select="@default"/>;
</xsl:if></xsl:for-each>
}
<xsl:if test='//@fromfile="true"'>
protected void fillFields(byte [] data, int offset)
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:text>protected </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>AbstractType()</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:text>{</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:for-each select="//fields/field">
<!-- we don't include @default condition in for-each to preserve position() -->
<xsl:if test="@default">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>this.</xsl:text>
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="@default"/>
<xsl:text>;</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:if>
</xsl:for-each>
<xsl:call-template name="indent"/>
<xsl:text>}</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="linebreak"/>
<xsl:if test='/@fromfile="true"'>
protected void fillFields(byte[] data, int offset)
{
<xsl:variable name="fieldIterator" select="field:new()"/>
<xsl:for-each select="//fields/field">
@ -76,17 +104,6 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
<xsl:text> </xsl:text><xsl:value-of select="field:serialiseEncoder($fieldIterator,position(),@name,@size,@type)"/>;
</xsl:for-each>
}
</xsl:if>
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("[<xsl:value-of select="@name"/>]\n");
<xsl:apply-templates select="//field" mode="tostring"/>
buffer.append("[/<xsl:value-of select="@name"/>]\n");
return buffer.toString();
}
/**
* Size of record (exluding 4 byte header)
@ -99,16 +116,36 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
<xsl:value-of select="field:calcSize($fieldIterator,position(),@name,@size,@type)"/>
</xsl:for-each>;
}
</xsl:if>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:text>public String toString()
{
StringBuilder builder = new StringBuilder();
</xsl:text>
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>builder.append("[</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>]\n");</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:apply-templates select="//field" mode="tostring"/>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>builder.append("[/</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>]\n");
return builder.toString();
}
</xsl:text>
<xsl:apply-templates select="//field" mode="getset"/>
<xsl:apply-templates select="//field" mode="bits"/>
<xsl:text>
} // END OF CLASS
</xsl:text>
</xsl:template>
<xsl:template match = "field" mode="bits">
@ -139,13 +176,44 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
<xsl:template match = "bit" > private static BitField <xsl:value-of select="@name"/> = new BitField(<xsl:value-of select="@mask"/>);
</xsl:template>
<xsl:template match = "const"> public final static <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>;
</xsl:template>
<xsl:template match = "const" mode="listconsts">
<xsl:text>
* </xsl:text>
<xsl:value-of select="recutil:getConstName(../@name,@name,0)"/></xsl:template>
<xsl:template match="const">
<xsl:if test="@description">
<xsl:call-template name="indent"/>
<xsl:text>/** </xsl:text>
<xsl:value-of select="@description"/>
<xsl:text> */</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:if>
<xsl:call-template name="indent"/>
<xsl:text>/**/</xsl:text>
<xsl:text>public final static </xsl:text>
<xsl:value-of select="@type"/>
<xsl:text> </xsl:text>
<xsl:value-of select="recutil:getConstName(../@name,@name,0)"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>;</xsl:text>
<xsl:call-template name="linebreak"/>
</xsl:template>
<xsl:template match="const" mode="listconsts">
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:text> * &lt;li&gt;{@link #</xsl:text>
<xsl:value-of select="recutil:getConstName(../@name,@name,0)"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template name="linebreak">
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="indent">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="field" mode="getset">
/**
* <xsl:choose>
@ -195,11 +263,21 @@ public abstract class <xsl:value-of select="@name"/>AbstractType
}
</xsl:template>
<xsl:template match="field" mode="tostring">
buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ");
buffer.append(" (").append(get<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>()).append(" )\n");
<xsl:apply-templates select="bit" mode="bittostring"/>
</xsl:template>
<xsl:template match="field" mode="tostring">
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>builder.append(" .</xsl:text>
<xsl:value-of select="recutil:getFieldName(@name,20)"/>
<xsl:text> = ");</xsl:text>
<xsl:call-template name="linebreak"/>
<xsl:call-template name="indent"/>
<xsl:call-template name="indent"/>
<xsl:text>builder.append(" (").append(get</xsl:text>
<xsl:value-of select="recutil:getFieldName1stCap(@name,0)"/>
<xsl:text>()).append(" )\n");</xsl:text>
<xsl:apply-templates select="bit" mode="bittostring"/>
<xsl:call-template name="linebreak"/>
</xsl:template>
<xsl:template match="bit" mode="bittostring"> buffer.append(" .<xsl:value-of select="recutil:getFieldName(@name,20)"/> = ").append(<xsl:value-of select="recutil:getBitFieldFunction(@name, @mask, ../@type, 'false')"/>()).append('\n');
</xsl:template>