[Telepathy-commits] [telepathy-spec/master] Add check for array-name being present if an array of a complex type is used

Olli Salli olli.salli at collabora.co.uk
Tue Sep 9 08:53:22 PDT 2008


---
 tools/doc-generator.xsl |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl
index 8f1f772..7761453 100644
--- a/tools/doc-generator.xsl
+++ b/tools/doc-generator.xsl
@@ -855,10 +855,49 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       </xsl:message>
     </xsl:if>
 
+    <xsl:if test="contains($tp-type, '[]')">
+      <xsl:call-template name="tp-type-array-usage-check">
+        <xsl:with-param name="single-type" select="$single-type"/>
+        <xsl:with-param name="type-of-tp-type" select="$type-of-tp-type"/>
+      </xsl:call-template>
+    </xsl:if>
+
     <a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a>
 
   </xsl:template>
 
+  <xsl:template name="tp-type-array-usage-check">
+    <xsl:param name="single-type"/>
+    <xsl:param name="type-of-tp-type"/>
+
+    <xsl:variable name="array-name">
+      <xsl:choose>
+        <xsl:when test="//tp:struct[@name=$single-type]">
+          <xsl:value-of select="//tp:struct[@name=$single-type]/@array-name"/>
+        </xsl:when>
+        <xsl:when test="//tp:mapping[@name=$single-type]">
+          <xsl:value-of select="//tp:mapping[@name=$single-type]/@array-name"/>
+        </xsl:when>
+        <xsl:when test="//tp:external-type[@name=$single-type]">
+          <xsl:value-of select="//tp:external-type[@name=$single-type]/@array-name"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="''"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:if test="not(contains('ybnqiuxtdsvog', $type-of-tp-type))">
+      <xsl:if test="not($array-name) or $array-name=''">
+        <xsl:message terminate="yes">
+          <xsl:text>No array-name specified for complex type </xsl:text>
+          <xsl:value-of select="$single-type"/>
+          <xsl:text>, but array used&#10;</xsl:text>
+        </xsl:message>
+      </xsl:if>
+    </xsl:if>
+  </xsl:template>
+
   <xsl:template name="parenthesized-tp-type">
     <xsl:if test="@tp:type">
       <xsl:text> (</xsl:text>
-- 
1.5.6.3




More information about the Telepathy-commits mailing list