File: align_func_params.cpp

package info (click to toggle)
uncrustify 0.68.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,000 kB
  • sloc: cpp: 56,567; ansic: 19,840; cs: 3,097; python: 2,717; objc: 1,650; java: 510; sh: 390; awk: 150; perl: 63; makefile: 7
file content (101 lines) | stat: -rw-r--r-- 4,140 bytes parent folder | download
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
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();
                             }
};