use constant identifiers for sprm ids
This commit is contained in:
parent
7ebc0db32c
commit
eedf2058e9
2 changed files with 91 additions and 61 deletions
|
@ -5,9 +5,9 @@
|
|||
*
|
||||
* $RCSfile: resourcesimpl.xsl,v $
|
||||
*
|
||||
* $Revision: 1.9 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-04-24 12:44:42 $
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-06-04 08:41:22 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -49,9 +49,9 @@
|
|||
*
|
||||
* $RCSfile: resourcesimpl.xsl,v $
|
||||
*
|
||||
* $Revision: 1.9 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-04-24 12:44:42 $
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-06-04 08:41:22 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -88,6 +88,10 @@
|
|||
#include <WW8OutputWithDepth.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_SPRMIDS_HXX
|
||||
#include <resourcemodel/sprmids.hxx>
|
||||
#endif
|
||||
|
||||
namespace doctok {
|
||||
|
||||
extern WW8OutputWithDepth output;
|
||||
|
@ -178,10 +182,10 @@ using namespace ::std;
|
|||
</xsl:text>
|
||||
<xsl:if test="$needsinit='true'">
|
||||
<xsl:text>
|
||||
void </xsl:text>
|
||||
void </xsl:text>
|
||||
<xsl:value-of select="$classname"/>
|
||||
<xsl:text>::init()
|
||||
{
|
||||
{
|
||||
</xsl:text>
|
||||
<xsl:if test='.//UML:Stereotype[@xmi.idref ="withmembers"]'>
|
||||
<xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
|
||||
|
@ -192,7 +196,7 @@ using namespace ::std;
|
|||
<xsl:text> initImpl();
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
|
||||
}
</xsl:text>
|
||||
}
</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:choose>
|
||||
|
@ -225,27 +229,30 @@ using namespace ::std;
|
|||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:text>void </xsl:text>
|
||||
<xsl:text>
|
||||
void </xsl:text>
|
||||
<xsl:value-of select="$classname"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test=".//UML:Stereotype[@xmi.idref='ww8resource']">
|
||||
<xsl:text>::resolve(Properties & </xsl:text>
|
||||
<xsl:value-of select="$rHandler"/>
|
||||
<xsl:text>)
</xsl:text>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test=".//UML:Stereotype[@xmi.idref='dffrecord']">
|
||||
<xsl:text>::resolveLocal(Properties & </xsl:text>
|
||||
<xsl:value-of select="$rHandler"/>
|
||||
<xsl:text>)
</xsl:text>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:text>
|
||||
{
|
||||
</xsl:text>
|
||||
{</xsl:text>
|
||||
<xsl:if test='.//UML:Stereotype[@xmi.idref="debug"]'>
|
||||
dump(output);
|
||||
<xsl:text>
|
||||
dump(output);</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>try {
</xsl:text>
|
||||
<xsl:text>
|
||||
try
|
||||
{</xsl:text>
|
||||
<xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
|
||||
<xsl:choose>
|
||||
<xsl:when test='.//UML:Stereotype[@xmi.idref="noresolve"]'>
|
||||
|
@ -283,7 +290,7 @@ using namespace ::std;
|
|||
<xsl:value-of select='@name'/>
|
||||
<xsl:text>'>");
|
||||
|
||||
WW8StructBase::dump(o);
</xsl:text>
|
||||
WW8StructBase::dump(o);</xsl:text>
|
||||
<xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
|
||||
<xsl:apply-templates select='.' mode='dumpAttribute'/>
|
||||
</xsl:for-each>
|
||||
|
@ -298,17 +305,16 @@ using namespace ::std;
|
|||
<xsl:choose>
|
||||
<xsl:when test='.//UML:Stereotype/@xmi.idref = "attribute"'>
|
||||
<xsl:text>
|
||||
{
|
||||
WW8Value::Pointer_t pVal = createValue(get_</xsl:text>
|
||||
{
|
||||
WW8Value::Pointer_t pVal = createValue(get_</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>());
|
||||
rHandler.attribute(</xsl:text>
|
||||
rHandler.attribute(</xsl:text>
|
||||
<xsl:call-template name='idtoqname'>
|
||||
<xsl:with-param name='id'><xsl:value-of select='$attrid'/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>, *pVal);
|
||||
}
|
||||
</xsl:text>
|
||||
}</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test='.//UML:Stereotype/@xmi.idref = "array"'>
|
||||
<xsl:variable name="elementtype">
|
||||
|
@ -322,37 +328,36 @@ using namespace ::std;
|
|||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:text>
|
||||
{
|
||||
sal_uInt32 nCount = get_</xsl:text>
|
||||
{
|
||||
sal_uInt32 nCount = get_</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>_count();
|
||||
|
||||
for (sal_uInt32 n = 0; n < nCount; ++n)
|
||||
{
|
||||
WW8Value::Pointer_t pVal = createValue(get_</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>(n));
|
||||
rHandler.attribute(</xsl:text>
|
||||
<xsl:call-template name='idtoqname'>
|
||||
<xsl:with-param name='id'><xsl:value-of select='$attrid'/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>, *pVal);
|
||||
}
|
||||
}
</xsl:text>
|
||||
<xsl:text>_count();
|
||||
for (sal_uInt32 n = 0; n < nCount; ++n)
|
||||
{
|
||||
WW8Value::Pointer_t pVal = createValue(get_</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>(n));
|
||||
rHandler.attribute(</xsl:text>
|
||||
<xsl:call-template name='idtoqname'>
|
||||
<xsl:with-param name='id'><xsl:value-of select='$attrid'/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>, *pVal);
|
||||
}
|
||||
}</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test='.//UML:Stereotype/@xmi.idref = "string"'>
|
||||
<xsl:text>
|
||||
{
|
||||
WW8StringValue aVal(get_</xsl:text>
|
||||
<xsl:value-of select='@name'/>
|
||||
<xsl:text>());
|
||||
rHandler.attribute(</xsl:text>
|
||||
<xsl:call-template name='idtoqname'>
|
||||
<xsl:with-param name='id'><xsl:value-of select='$attrid'/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>, aVal);
|
||||
}

|
||||
</xsl:text>
|
||||
{
|
||||
WW8StringValue aVal(get_</xsl:text>
|
||||
<xsl:value-of select='@name'/>
|
||||
<xsl:text>());
|
||||
rHandler.attribute(</xsl:text>
|
||||
<xsl:call-template name='idtoqname'>
|
||||
<xsl:with-param name='id'>
|
||||
<xsl:value-of select='$attrid'/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:text>, aVal);
|
||||
}</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
@ -385,7 +390,7 @@ using namespace ::std;
|
|||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>(n));
|
||||
}
|
||||
}
</xsl:text>
|
||||
}</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test='.//UML:Stereotype/@xmi.idref = "string"'>
|
||||
<xsl:text>
|
||||
|
@ -397,10 +402,15 @@ using namespace ::std;
|
|||
o.addItem("</xsl:text>
|
||||
<xsl:value-of select='@name'/>
|
||||
<xsl:text>" << "=\"" + aVal.toString() + "\"");
|
||||
}
</xsl:text>
|
||||
}</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
doctok::dump(o, "<xsl:value-of select='@name'/>", get_<xsl:value-of select="@name"/>());
|
||||
<xsl:text>
|
||||
doctok::dump(o, "</xsl:text>
|
||||
<xsl:value-of select='@name'/>
|
||||
<xsl:text>", get_</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>());</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
*
|
||||
* $RCSfile: resourcetools.xsl,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-05-29 15:33:16 $
|
||||
* last change: $Author: hbrinkm $ $Date: 2007-06-04 08:41:22 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -150,19 +150,37 @@
|
|||
</xsl:template>
|
||||
|
||||
<xsl:template match='UML:Model' mode='sprmcodetostr'>
|
||||
<xsl:text>
|
||||
SprmIdToString::SprmIdToString()
|
||||
{
|
||||
{</xsl:text>
|
||||
<xsl:variable name='tmp'>map < sal_uInt32, string > </xsl:variable>
|
||||
<xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.idref="ww8sprm"]'>
|
||||
mMap[<xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="sprmcode"]//UML:TaggedValue.dataValue'/>] = "<xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="sprmid"]//UML:TaggedValue.dataValue'/>";</xsl:for-each>
|
||||
<xsl:variable name="sprmconst">
|
||||
<xsl:call-template name="sprmCodeOfClass"/>
|
||||
</xsl:variable>
|
||||
<xsl:text>
|
||||
mMap[</xsl:text>
|
||||
<xsl:value-of select="$sprmconst"/>
|
||||
<xsl:text>] = "</xsl:text>
|
||||
<xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="sprmid"]//UML:TaggedValue.dataValue'/>
|
||||
<xsl:text>";</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>
|
||||
}
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:key name="classes-with-kind" match="UML:TagDefinition[@xmi.idref='kind']"
|
||||
use="ancestor::UML:TaggedValue/UML:TaggedValue.dataValue"/>
|
||||
|
||||
<xsl:template name="sprmCodeOfClass">
|
||||
<xsl:value-of select=".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref='sprmcode']/UML:TaggedValue.dataValue"/>
|
||||
<xsl:variable name="tmp">
|
||||
<xsl:text>sprm:</xsl:text>
|
||||
<xsl:value-of select="substring-after(@name, 'sprm')"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="idtoqname">
|
||||
<xsl:with-param name="id" select="$tmp"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="sprmkindcase">
|
||||
|
@ -171,8 +189,7 @@ SprmIdToString::SprmIdToString()
|
|||
<xsl:text>
|
||||
case </xsl:text>
|
||||
<xsl:call-template name="sprmCodeOfClass"/>
|
||||
<xsl:text>: //</xsl:text>
|
||||
<xsl:value-of select="@xmi.id"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
@ -249,10 +266,15 @@ namespace NS_sprm { </xsl:text>
|
|||
<xsl:variable name="upperpattern">
|
||||
<xsl:value-of select="translate($pattern, 'abcdef', 'ABCDEF')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="constname">
|
||||
<xsl:variable name="tmp">
|
||||
<xsl:text>sprm:</xsl:text>
|
||||
<xsl:value-of select="substring-after(@name, 'sprm')"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="constname">
|
||||
<xsl:call-template name="idtoqname">
|
||||
<xsl:with-param name="id" select="$tmp"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:text>
|
||||
sed "s/</xsl:text>
|
||||
<xsl:value-of select="$lowerpattern"/>
|
||||
|
@ -266,9 +288,7 @@ sed "s/</xsl:text>
|
|||
<xsl:value-of select="$constname"/>
|
||||
<xsl:text>/g" < $1 > $1.out && mv $1.out $1 </xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>
|
||||
}
|
||||
</xsl:text>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
Loading…
Reference in a new issue