Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stl-array #757

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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