-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
The eprosima::xtypes::Member has support for id, key and optional annotations, which can be set using the xtypes API.
Currently, it seems the IDL parser do not parse annotations. Is it possible to slightly extend the grammar or the IDL parser implementation, so that the three annotations above are recognized when parsing IDL files?
std::string my_idl = R"~~~(
struct Inner
{
@key uint32 my_uint32;
@optional boolean yes;
};
)~~~";
eprosima::xtypes::idl::Context context = eprosima::xtypes::idl::parse(my_idl);
// Create struct same with xtypes API
eprosima::xtypes::StructType inner2 =
eprosima::xtypes::StructType("Inner")
.add_member(eprosima::xtypes::Member("my_uint32", eprosima::xtypes::primitive_type<uint32_t>()).key())
.add_member(eprosima::xtypes::Member("yes", eprosima::xtypes::primitive_type<bool>()).optional());
auto inner = context.module().structure("Inner");
EXPECT_EQ(inner.member(0).is_key(), inner2.member(0).is_key()); // false, true
EXPECT_EQ(inner.member(1).is_optional(), inner2.member(1).is_optional()); // false, trueMetadata
Metadata
Assignees
Labels
No labels