Skip to content

Commit

Permalink
[21380] Support setting value to an enumeration literal using annotat…
Browse files Browse the repository at this point in the history
…ion @value (#379)

* Refs #21379. Support setting values

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #21379. Add test

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #21379. Fix error

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #21379. Fix error on tests

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #21379. Update submodule

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

---------

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware authored Sep 26, 2024
1 parent f61a07e commit f24cb50
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ enum_type(ctx, parent, enum) ::= <<
*/
enum class $enum.name$ : int32_t
{
$enum.members:{ member | $member.name$}; separator=",\n"$
$enum.members:{ member | $member.name$$if(member.annotationValue)$ = $member.annotationValueValue$$endif$}; separator=",\n"$
};
>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ TEST(TypeObjectTests, TestEnumTypeObject_$enum.name$)
TypeIdentifierPair type_ids;

// Register specific enum TypeObject
$if(enum.scope)$::$endif$$enum.scope$::register_$enum.name$_type_identifier(type_ids);
$if(!enum.scope.empty)$::$endif$$enum.scope$::register_$enum.name$_type_identifier(type_ids);

$check_type_identifier_consistency(result="type_ids")$
$check_direct_hash_type_identifier(typeid="type_ids")$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ $endif$
enum_literal(literal, parent, name) ::= <<
{
EnumeratedLiteralFlag flags_$literal.name$ = TypeObjectUtils::build_enumerated_literal_flag($literal.annotationDefaultLiteral$);
CommonEnumeratedLiteral common_$literal.name$ = TypeObjectUtils::build_common_enumerated_literal($literal.index$, flags_$literal.name$);
CommonEnumeratedLiteral common_$literal.name$ = TypeObjectUtils::build_common_enumerated_literal($if(literal.annotationValue)$$literal.annotationValueValue$$else$$literal.index$$endif$, flags_$literal.name$);
$empty_ann_builtin_complete_member_detail(member=literal, parent=parent, message=[parent.scopedname, " Enumerated ", literal.name, " literal: only @default_literal and @value builtin annotations apply to literals"], name=name)$
CompleteEnumeratedLiteral literal_$literal.name$ = TypeObjectUtils::build_complete_enumerated_literal(common_$literal.name$, detail_$literal.name$);
TypeObjectUtils::add_complete_enumerated_literal(literal_seq_$parent.name$, literal_$literal.name$);
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/dds-types-test

0 comments on commit f24cb50

Please sign in to comment.