* major layout fixes (size, stacked widget, ...)
[kdenetwork.git] / kget / HACKING
blob33153f44073562c3f652812ad66249cdc3d84aeb
1 This file has been copied from the kicker HACKING file from Aaron Seigo.
3 While you may notice that there are many discrepencies between
4 the code and this document, all new development should
5 follow the coding style as described below amd one day the codebase will 
6 actually be consistent!
8 Naming Conventions
9 ------------------
10 Class names start with a capital letter, member variables begin with m_.
11 Methods and functions start with a lower case letter.
14 Indenting
15 ---------
16 Tabstop is 4 spaces. No tabs, only spaces.
18 Try to keep lines under 80 characters in width. When wrapping a single
19 logical line of code across multiple lines, new lines should be indented
20 at least once and should preferably line up with parentheses, if any, on
21 the line above. e.g.:
23     someMethod(parameterOne, parameterTwo,
24                parameterThree, parameterFour);
26 If a boolean expression is spread out over several lines, the boolean
27 operator is always the last item on the line, e.g.:
29     if ((condition1 || condition2) &&
30         condition3 &&
31         (condition4 || condition5))
32     {
34 Switch statements should have the case line indented and the case block
35 itsel further indented, e.g.:
37     switch (condition)
38     {
39         case 1:
40             ...
41             break;
42         case 2:
43             ...
44             break;
45         default:
46             ...;
47     }
49 Spaces
50 ------
51 A single space should appear between keywords and parentheses, eg:
53     if (
54     while (
55     for (
57 No spaces appear between function/method names and parentheses:
59     function(
60     someObject->method(
62 No spaces appear between opening closing parens and the arguments:
64     for (int i = 0; i < count; ++i)
66 Spaces appear between operators, e.g.:
68     int i = i + 3;
69     someObject.setValue(someObject.currentValue() + 1)
72 Braces
73 ------
74 Braces always appear on a line by themself, indented to align with the
75 above keyword:
77     if (foo)
78     {
79         ...
80     }
81     else
82     {
83         ...
84     }
86 Unless it uglifies the code, use braces even for one-liner conditionals:
88     if (foo)
89     {
90         return 1;
91     }
93 Always use braces if the conditional expression wraps across multiple
94 physical lines.
96 Braces around case blocks in switch statements are optional.
99 Constructors
100 ------------
101 Constructors are written as:
103     MyClass::MyClass(...)
104         : SuperClass(...),
105           m_member1(...),
106           m_member2(...),
107           ...
108     {
111 Class Definitions
112 -----------------
113 Class definitions will follow the following order:
115     class <name> : <scope> <superclass>
116     {
117         public:
118             <ctors>
119             <dtors>
120             <operators>
121             <other methods>
123             <members>
125         public slots:
126             <methods>
128         signals:
129             <methods>
131         protected:
132             <ctors>
133             <dtors>
134             <operators>
136             <members>
138         protected slots:
139             <methods>
141         private:
142             <ctors>
143             <dtors>
144             <operators>
146             <members>
148         private slots:
149             <methods>
150     };