summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/align_func_params.cpp
blob: a90155fd87a8e5862583238aac52aa34c1b7e716 (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
class SomeClass
{
    public:
        // Short parameters
        TYPE_EXPORT method1(int     a,
                                     float      b);

        TYPE_EXPORT method2(int&     d,
                                     float      e);

        TYPE_EXPORT method3(int*     f,
                   float      g);

        // Parameters with '&' and '*'
        TYPE_EXPORT method4(int     a);
        TYPE_EXPORT method5(int         & a);
        TYPE_EXPORT method6(int    *     a);

        TYPE_EXPORT method7(float     a);
        TYPE_EXPORT method8(float         & a);
        TYPE_EXPORT method9(float    * a);

        // Single short and long parameters
        void method10(int     a);
        void method11(float         & a);
        void method12(SomeLongNamespace::SomeLongType       long_parameter_name);
        void method13(double    * a);
        void method14(SomeLongType       long_parameter_name);

        // Long parameters
        void method20(int           * int_param,
                             SomeLongNamespace::SomeLongType       long_parameter_name,
                             float  & float_param);

        // Possible bug: different aligning in method21 and method22
        // align_func_params_span = 1, align_func_params_thresh = 8
        void method21(SomeLoooooooooooooongType long_param_1,
            const string& string_param_1,
                    const TimePoint& time_param,
            double  double_param_1,
                    double    double_param_2,
                const string& string_param_2,
                  SomeLoooooooooooooongType    long_param_2 );
        void method22(SomeLoooooooooooooongType long_param_1,
            const string& string_param_1,
            double  double_param_1,
                    double    double_param_2,
                              const TimePoint& time_param,
                const string& string_param_2,
                  SomeLoooooooooooooongType    long_param_2 );

        void method23(int int_param,
        int * int_ptr_param,
        float float_param,
        float & float_ref_param,
                             SomeLongNamespace::SomeLongType       long_parameter_name,
           int   * other_int_param,
                       SomeLooooongType       long_parameter_name,
                 SomeLoooooooooongType looong_parameter_name,
                      SomeLongNamespace::OtherLongNamespace::SomeLongType very_long_parameter_name,
        int   * int_ptr_param,
        float float_param,
        float & float_ref_param,
        double    & double_param,
                             SomeLongNamespace::SomeLongType       long_parameter_name,
                             int * other_int_param);

        // Don't align several parameters in one line
        void method30(int*     f, char foo,
                   float      g);

        // Short parameters in method definition
        void method40(int     a,
                                     float      b)
                                     {
                                        int c;

                                        if ( true ) callProc;
                                        // do stuff.
                                    }

        // Long parameters in method definition
        void method50(int         int_param,
                             SomeLongNamespace::OtherLongNamespace::SomeLongType       long_parameter_name,
                             float         float_param,
                             double double_param,
                             const string & string_param)
                             {
                             doSomething();
                             }

        void method51(
        int         int_param,
                             SomeLongNamespace::OtherLongNamespace::SomeLongType       long_parameter_name,
                             float         float_param,
                             double double_param,
                             const string & string_param)
                             {
                             doSomething();
                             }
        void increasing_length(
        int         int_param,
                             float         float_param,
                             double double_param,
                             ah_long_t & string_param,
                             very_long_type t_param,
                             even_longer_type l_param)
                             {
                             doSomething();
                             }
};