Skip to content

Commit

Permalink
Add support for bitset inheritance
Browse files Browse the repository at this point in the history
    * tests/idl4/illegal_idl/bitset_inherit_struct.idl:
      Added.

    * ridlbe/c++11/templates/cli/hdr/bitset.erb:
    * ridlbe/c++11/visitors/bitset.rb:
  • Loading branch information
jwillemsen committed Aug 14, 2023
1 parent 976b0d5 commit a3a0766
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/bitset.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions ridlbe/c++11/visitors/bitset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tests/idl4/illegal_idl/bitset_inherit_struct.idl
Original file line number Diff line number Diff line change
@@ -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;
};

0 comments on commit a3a0766

Please sign in to comment.