summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/cli/input/class_enum_struct_union.cpp
blob: 9041745d0835909231a9d547919d7156cf4305fa (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
   /**
    * the enum (and variable declarations thereof) could be of
    * the following forms:
    *
    * "enum type [: integral_type] { ... } [x, ...]"
    * "enum type [: integral_type]"
    * "enum class type [: integral_type] { ... } [x, ...]"
    * "enum class type [: integral_type]"
    * "enum [: integral_type] { ... } x, ..."
    */

   /**
    * the class/struct (and variable declarations thereof) could be of
    * the following forms:
    *
    * template<...> class/struct[<...>] [macros/attributes ...] type [: bases ...] { }
    * template<...> class/struct[<...>] [macros/attributes ...] type
    * class/struct[ [macros/attributes ...] type [: bases ...] { } [x, ...]
    * class/struct [macros/attributes ...] type [x, ...]
    * class/struct [macros/attributes ...] [: bases] { } x, ...
    */

#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))

#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#define API_EXPORT __attribute__ ((visibility("default")))
#elif defined _WIN32
#define API_EXPORT __declspec(dllexport)
#else
#define API_EXPORT
#endif

namespace outer_namespace
{

namespace inner_namespace
{

class Base1 { };

template<typename> class Base2 { };

}

}

// template<...> class/struct[<...>] [macros/attributes ...] type : bases ... { }
template<typename, typename ...>
class API_EXPORT __attribute__((__deprecated__)) ALIGNAS(4) c1
: public outer_namespace::inner_namespace::Base1,
  public outer_namespace::inner_namespace::Base2<outer_namespace::inner_namespace::Base1>
{

};

// template<...> class/struct[<...>] [macros/attributes ...] type { }
template<typename, typename ...>
class API_EXPORT c2
{
public:

   template<typename T>
   struct inner_class
   {
      static inner_class<T> *m_inner_class;
   };
};

template<> template<> struct API_EXPORT c2<int>::inner_class<int> *c2<int>::inner_class<int>::m_inner_class = nullptr;

// template<...> class/struct[<...>] [macros/attributes ...] type
template<typename, typename ...>
class API_EXPORT c2;

// class/struct [macros/attributes ...] type : bases ... { } x, ...
class API_EXPORT __attribute__((__deprecated__)) ALIGNAS(4) c3
: public outer_namespace::inner_namespace::Base2<int>,
  public c2<int>::inner_class<int>
{
public:
   c3(int x = 0, int y = 0, int z = 0) : m_x(x), m_y(y), m_z(z) { }

   int m_x;
   int m_y;
   int m_z;
} c31, *c32 = nullptr, *c33[] = { nullptr, nullptr }, c34{ 0, 1, 2}, * const c35(nullptr), c16(0, 1, 2);

// class/struct [macros/attributes ...] type x, ...
class __attribute__((__deprecated__)) API_EXPORT ALIGNAS(4) c3 c41, *c42 = nullptr, *c43[] = { nullptr, nullptr }, c44{ 0, 1, 2}, * const c45(nullptr), c46(0, 1, 2);

// class/struct [macros/attributes ...] type : bases ... { } x, ...
class ALIGNAS(4) API_EXPORT __attribute__((__deprecated__))
: public outer_namespace::inner_namespace::Base1
{
public:
   int m_x;
   int m_y;
   int m_z;
} c51, *c52 = nullptr, *c53[] = { nullptr, nullptr };


// enum type : integral_type { ... } x, ...
enum e1 : long long { a1, b1, d1 } e11, e12, e13;

// enum type : integral_type { ... }
enum e2 : unsigned int { a2, b2, d2 };

// enum type : integral_type
enum e3 : short;

// enum type x, ...
enum e3 e31, e32;

// enum class type : integral_type { ... } x, ...
enum class e4 : long long { a4, b4, d4 } e41, e42, e43, e44;

// enum class type : integral_type { ... }
enum class e5 : unsigned int { a5, b5, d5 };

// enum class type : integral_type
enum class e6 : short;

// enum class type
enum class e7;

// enum : integral_type { ... } x, ...
enum : long long { a8, b8, c8 } e81, e82;

// enum { ... } x, ...
enum { a9, b9, c9 } e91, e92;

union API_EXPORT u1 { int x; long y; } u11, *u12 = nullptr, *u13{0};

union API_EXPORT u1 u21;