Skip to content

Commit

Permalink
Support stl-array
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed May 19, 2024
1 parent 00d4a81 commit 7529475
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ my %custom_container_handlers = (
header_ref("vector");
return "std::vector<bool>";
},
'stl-array' => sub {
my $item = get_container_item_type($_, -void => 'void*');
my $count = get_container_count($_);
header_ref("array");
return "std::array<$item, $count>";
},
'stl-map' => sub {
# TODO: implement get_container_key_type?
my $key = 'void*';
Expand Down
19 changes: 16 additions & 3 deletions data-definition.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
<xs:element name="stl-vector" type="StlVectorField" />
<xs:element name="stl-bit-vector" type="StlBitVectorField" />
<xs:element name="stl-deque" type="StlDequeField" />
<xs:element name="stl-array" type="StlArrayField" />
<xs:element name="stl-set" type="StlSetField" />
<xs:element name="stl-map" type="StlMapField" />
<xs:element name="stl-unordered-map" type="StlMapField" />
Expand Down Expand Up @@ -329,6 +330,14 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SizedContainerFieldType" mixed="true">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
<xs:attribute name="count" type="xs:positiveInteger">
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="BitContainerFieldType" mixed="true">
<xs:complexContent>
<xs:extension base="SimpleFieldType">
Expand Down Expand Up @@ -388,6 +397,12 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StlArrayField">
<xs:complexContent>
<xs:extension base="SizedContainerFieldType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StlSetField">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
Expand Down Expand Up @@ -458,9 +473,7 @@
</xs:complexType>
<xs:complexType name="StaticArrayField">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
<xs:attribute name="count" type="xs:positiveInteger">
</xs:attribute>
<xs:extension base="SizedContainerFieldType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down
2 changes: 1 addition & 1 deletion lower-1.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Error: field <xsl:value-of select='$enum-key'/> corresponds to an enum value of
</xsl:template>

<!-- Misc containers: meta='container' subtype='$tag' -->
<xsl:template match='stl-vector|stl-deque|stl-set|stl-bit-vector|stl-map|stl-unordered-map|stl-optional|stl-variant|stl-shared-ptr|stl-weak-ptr|stl-function|df-flagarray|df-static-flagarray|df-array|df-linked-list'>
<xsl:template match='stl-vector|stl-deque|stl-set|stl-bit-vector|stl-array|stl-map|stl-unordered-map|stl-optional|stl-variant|stl-shared-ptr|stl-weak-ptr|stl-function|df-flagarray|df-static-flagarray|df-array|df-linked-list'>
<xsl:param name='level' select='-1'/>
<ld:field ld:meta='container'>
<xsl:attribute name='ld:level'><xsl:value-of select='$level'/></xsl:attribute>
Expand Down

0 comments on commit 7529475

Please sign in to comment.