summaryrefslogtreecommitdiff
path: root/bindgen-integration/cpp/Test.h
blob: c060984da6cb78b3b405c168b9dbbf1cd4f4bbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once

class Test {
  int m_int;
  double m_double;
public:
  static const char* name();
  Test(int foo);
  Test(double foo);

  static const int COUNTDOWN[];
  static const int* COUNTDOWN_PTR;
  static const int* countdown();
};

namespace testing {

typedef Test TypeAlias;

} // namespace testing

typedef testing::TypeAlias TypeAlias;

namespace bitfields {

struct First {
    unsigned char three_bits_byte_one : 3;
    // This starts a new byte, leaving 5 bits unused.
    unsigned char :0;

    unsigned char six_bits_byte_two : 6;
    unsigned char two_bits_byte_two : 2;

    /// Returns true if the bitfields match the arguments, false otherwise.
    bool assert(unsigned char first,
                unsigned char second,
                unsigned char third);
};

struct Second {
    int thirty_one_bits : 31;
    bool one_bit : 1;

    /// Returns true if the bitfields match the arguments, false otherwise.
    bool assert(int first,
                bool second);
};

enum ItemKind {
    ITEM_KIND_UNO,
    ITEM_KIND_DOS,
    ITEM_KIND_TRES,
};

struct Third {
    int flags : 28;
    bool is_whatever : 1;
    ItemKind kind : 3;

    /// Returns true if the bitfields match the arguments, false otherwise.
    bool assert(int first, bool second, ItemKind third);
};

} // namespace bitfields