From a3a0766d4bd317d33423b6cbb50215f0fdb6041e Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 14 Aug 2023 09:44:28 +0200 Subject: [PATCH] Add support for bitset inheritance * tests/idl4/illegal_idl/bitset_inherit_struct.idl: Added. * ridlbe/c++11/templates/cli/hdr/bitset.erb: * ridlbe/c++11/visitors/bitset.rb: --- ridlbe/c++11/templates/cli/hdr/bitset.erb | 2 +- ridlbe/c++11/visitors/bitset.rb | 5 +++++ tests/idl4/illegal_idl/bitset_inherit_struct.idl | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/idl4/illegal_idl/bitset_inherit_struct.idl diff --git a/ridlbe/c++11/templates/cli/hdr/bitset.erb b/ridlbe/c++11/templates/cli/hdr/bitset.erb index ebdbb81f..8123b1f4 100644 --- a/ridlbe/c++11/templates/cli/hdr/bitset.erb +++ b/ridlbe/c++11/templates/cli/hdr/bitset.erb @@ -2,7 +2,7 @@ // generated from <%= ridl_template_path %> /// @copydoc <%= doc_scoped_name %> /// @todo THIS MAPPING IS NOT COMPLETE -class <%= cxxname %> +class <%= cxxname %><% unless base.nil? %> : public <%= base.cxxname %><% end %> { public: <%= cxxname %> () = default; diff --git a/ridlbe/c++11/visitors/bitset.rb b/ridlbe/c++11/visitors/bitset.rb index c982e7ac..82376f26 100644 --- a/ridlbe/c++11/visitors/bitset.rb +++ b/ridlbe/c++11/visitors/bitset.rb @@ -17,6 +17,11 @@ def bitfields } end + # Return the base of this bitset, nil in case of no base bitset + def base + node.base + end + # template mapping map_template :bitset, :bitset diff --git a/tests/idl4/illegal_idl/bitset_inherit_struct.idl b/tests/idl4/illegal_idl/bitset_inherit_struct.idl new file mode 100644 index 00000000..5edc7f92 --- /dev/null +++ b/tests/idl4/illegal_idl/bitset_inherit_struct.idl @@ -0,0 +1,16 @@ +/** + * @file bitfield_65.idl + * @author Johnny Willemsen + * + * ridlc shall reject use of a bitset which inherits from a struct + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +struct Base { + short Foo; +}; + +bitset MyBitset : Base { + bitfield<6> x; +};