diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-03-09 11:44:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 11:44:57 -0800 |
commit | fdea868dbfdee4b0e04852ce59065c8b2ff71662 (patch) | |
tree | 7d142cc58af557088719c4cac67b0e03ef74498d /bindgen-integration/cpp/Test.cc | |
parent | 2afecece53a82fdf18e53a98d1b8ed0077500995 (diff) | |
parent | 50ee7372b4bb67097cc40fc9578b880efebb2680 (diff) |
Auto merge of #567 - fitzgen:bitfield-accessors, r=emilio
Reintroduce bitfield accessors
This commit reintroduces accessor methods for bitfields in the generated
bindings.
Fixes #519
r? @emilio
Diffstat (limited to 'bindgen-integration/cpp/Test.cc')
-rw-r--r-- | bindgen-integration/cpp/Test.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bindgen-integration/cpp/Test.cc b/bindgen-integration/cpp/Test.cc index fa0ff827..1d962406 100644 --- a/bindgen-integration/cpp/Test.cc +++ b/bindgen-integration/cpp/Test.cc @@ -20,3 +20,31 @@ Test::Test(double foo) : m_int(0) , m_double(foo) {} + +namespace bitfields { + +bool +First::assert(unsigned char first, + unsigned char second, + unsigned char third) +{ + return three_bits_byte_one == first && + six_bits_byte_two == second && + two_bits_byte_two == third; +} + +bool +Second::assert(int first, bool second) +{ + return thirty_one_bits == first && one_bit == second; +} + +bool +Third::assert(int first, bool second, ItemKind third) +{ + return flags == first && + is_whatever == second && + kind == third; +} + +} |