Skip to content
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
4 changes: 2 additions & 2 deletions StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ sub emit_struct_fields($$;%) {
emit $_ for @ctor_lines;
};
}
} 'ctors';
} 'ctors' unless $flags{-noconstructor};

%info = $flags{-addmethods}->($tag) if $flags{-addmethods};

Expand Down Expand Up @@ -785,7 +785,7 @@ sub emit_struct_fields($$;%) {
($inherits ? "&${inherits}::_identity" : 'NULL'), ', ',
"${ftable}${maybe_index_enum});";
}
} 'fields-' . $fields_group;
} 'fields-' . $fields_group unless $flags{-noidentity};
}

for my $letter ('a' .. 'z') {
Expand Down
25 changes: 18 additions & 7 deletions StructType.pm
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,20 @@ sub render_struct_type {

my $ispec = '';

my $using = '';
my $noidentity = 0;
my $noctor = 0;

if (@codegen_override) {
$using = $codegen_override[0]->getAttribute('using');
$noidentity = $codegen_override[0]->getAttribute('no-identity');
$noctor = $codegen_override[0]->getAttribute('no-constructor');
my $template = $codegen_override[0]->getAttribute('template');
if ($template) {
$using = "$template<$using>";
}
}

for my $extra ($tag->findnodes('extra-include')) {
my $tname = $extra->getAttribute('type-name');
if ($tname) {
Expand Down Expand Up @@ -311,7 +325,7 @@ sub render_struct_type {
};

emit_struct_fields($tag, $typename, -class => $is_class, -inherits => $inherits,
-addmethods => $vmethod_emit);
-addmethods => $vmethod_emit, -noidentity => $noidentity, -noctor => $noctor);

if ($field_backrefs{$typename}) {
for my $backref (@{$field_backrefs{$typename}}) {
Expand All @@ -323,12 +337,9 @@ sub render_struct_type {
} $tag, "$typename$ispec", -export => 1;
};

if (@codegen_override) {
my $using = $codegen_override[0]->getAttribute('using');
if ($using) {
emit "using $typename = $using;";
return;
}
if ($using) {
emit "using $typename = $using;";
return;
}

emit $_ for @struct;
Expand Down
6 changes: 4 additions & 2 deletions data-definition.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="using" use="required">
</xs:attribute>
<xs:attribute name="using" use="optional" type="xs:string"/>
<xs:attribute name="template" use="optional" type="xs:string"/>
<xs:attribute name="no-identity" use="optional" type="xs:boolean" default="false"/>
<xs:attribute name="no-constructor" use="optional" type="xs:boolean" default="false"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Expand Down
Loading