Papierkorb / bindgen

Binding and wrapper generator for C/C++ libraries
GNU General Public License v3.0
179 stars 18 forks source link

Host anonymous enumerators inside wrapped classes as constants #97

Closed HertzDevil closed 4 years ago

HertzDevil commented 4 years ago

This PR adds support for nested constants defined in the form of anonymous enums:

struct A {
  enum { X, Y, Z };
};
class A
  X = 0u32
  Y = 1u32
  Z = 2u32
end

Such constructs are sometimes seen in C++ code to define compile-time constants, instead of static const. Qt uses it for QGraphicsItem::type().

This PR does not address the use of anonymous enumerators in instance variables.

Papierkorb commented 4 years ago

Good stuff as always :+1: Could you change the specs commit to be something more descriptive? Then it's ready to be ~merged~ rebased.

HertzDevil commented 4 years ago

Done.

Papierkorb commented 4 years ago

Thanks!