Skip to content

Commit

Permalink
Generated code improvements
Browse files Browse the repository at this point in the history
    * ridlbe/c++11/templates/cli/hdr/bitset.erb:
    * ridlbe/c++11/templates/cli/inl/bitset_inl.erb:
  • Loading branch information
jwillemsen committed Nov 22, 2024
1 parent 0ca98e5 commit 3ab46c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
13 changes: 2 additions & 11 deletions ridlbe/c++11/templates/cli/hdr/bitset.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,8 @@ public:
% end
%end

%# Add base class support
bool operator== (const <%= cxxname %> &rhs) const { return
%_ms = bitfields.dup.find_all {|bitf| !bitf.cxxname.empty? }
%unless _ms.empty?
% while !_ms.empty?
% _m = _ms.shift
(this->_taox11_<%= cxxname.downcase %>.<%= _m.cxxname %> == rhs._taox11_<%= cxxname.downcase %>.<%= _m.cxxname %>)<%= _ms.empty? ? ';' : '&&' %>
% end
%end
};
bool operator!= (const <%= cxxname %> &rhs) const { return !this->operator== (rhs);};
bool operator== (const <%= cxxname %> &rhs) const;
bool operator!= (const <%= cxxname %> &rhs) const;

%bitfields.find_all {|bitf| !bitf.cxxname.empty? }.each do |_m|
inline void <%= _m.cxxname %> (<%= _m.cxx_in_type %> _x11_<%= _m.cxxname %>) { this->_taox11_<%= cxxname.downcase %>.<%= _m.cxxname %> = _x11_<%= _m.cxxname %>; }
Expand Down
19 changes: 19 additions & 0 deletions ridlbe/c++11/templates/cli/inl/bitset_inl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,22 @@ inline void <%= scoped_cxxtype %>::swap (<%= scoped_cxx_out_type %> s)
std::swap (this->_taox11_<%= cxxname.downcase %>, s._taox11_<%= cxxname.downcase %>);
%# end
}

inline bool <%= scoped_cxxtype %>::operator== (const <%= cxxname %> &rhs) const {
return
%unless base.nil?
<%= base.cxxname %>::operator==(rhs) &&
%end
%_ms = bitfields.dup.find_all {|bitf| !bitf.cxxname.empty? }
%unless _ms.empty?
% while !_ms.empty?
% _m = _ms.shift
(this->_taox11_<%= cxxname.downcase %>.<%= _m.cxxname %> == rhs._taox11_<%= cxxname.downcase %>.<%= _m.cxxname %>)<%= _ms.empty? ? ';' : ' &&' %>
% end
%end
}

inline bool <%= scoped_cxxtype %>::operator!= (const <%= cxxname %> &rhs) const
{
return !this->operator== (rhs);
}

0 comments on commit 3ab46c7

Please sign in to comment.