Skip to content

Commit

Permalink
Merge branch 'std-function' into 5010-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ab9rf committed Sep 12, 2023
2 parents 11e6d85 + b7a4f06 commit afa23ff
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
15 changes: 15 additions & 0 deletions StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ my %custom_container_handlers = (
header_ref("map");
return "std::map<$key, $item>";
},
'stl-function' => sub {
my $item = get_container_item_type($_, -void => 'void');
header_ref("functional");
return "std::function<$item() >"; # TODO: get the full prototype
},
'stl-optional' => sub {
my $item = get_container_item_type($_, -void => 'void');
header_ref("optional");
return "std::optional<$item >";
},
'stl-shared-ptr' => sub {
my $item = get_container_item_type($_, -void => 'void');
header_ref("memory");
return "std::shared_ptr<$item >";
},
'df-flagarray' => sub {
my $type = decode_type_name_ref($_, -attr_name => 'index-enum', -force_type => 'enum-type') || 'int';
return "BitArray<$type>";
Expand Down
21 changes: 21 additions & 0 deletions data-definition.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
<xs:element name="stl-mutex" type="OpaqueField" />
<xs:element name="stl-condition-variable" type="OpaqueField" />
<xs:element name="stl-future" type="OpaqueField" />
<xs:element name="stl-optional" type="StlOptionalField" />
<xs:element name="stl-shared-ptr" type="StlSharedPtrField" />
<xs:element name="stl-function" type="StlFunctionField" />
<xs:element name="df-linked-list" type="DfLinkedListField" />
<xs:element name="df-array" type="DfArrayField" />
<xs:element name="df-flagarray" type="DfFlagArrayField" />
Expand Down Expand Up @@ -392,6 +395,24 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StlOptionalField">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StlSharedPtrField">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StlFunctionField">
<xs:complexContent>
<xs:extension base="ContainerFieldType">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="OpaqueField">
<xs:complexContent>
<xs:extension base="SimpleFieldType">
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|df-flagarray|df-static-flagarray|df-array|df-linked-list'>
<xsl:template match='stl-vector|stl-deque|stl-set|stl-bit-vector|stl-map|stl-optional|stl-shared-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 afa23ff

Please sign in to comment.