Don't share mailto
[kdepim.git] / kontact / HACKING
blobd15c7b4dad2443a7e66e88bd54a1011ce6d1a478
1 Coding Style
2 ============
4 See http://korganizer.kde.org/develop/hacking.html for an HTML version.
6 Formatting
7 ----------
9 - No Tabs.
10 - Indent with 2 spaces.
11 - A line must not have more than 100 chars.
12 - Put Spaces between brackets and arguments of functions.
13 - For if, else, while and similar statements put the brackets on the same line
14   as the statement.
15 - Function and class definitions have their brackets on separate lines.
17 Example:
19 void MyClass::myFunction()
21   if ( blah == fasel ) {
22     blubbVariable = arglValue;
23   } else {
24     blubbVariable = oerxValue;
25   }
29 Header Formatting
30 -----------------
32 - General formatting rules apply.
33 - Access modifiers are indented.
34 - Put curly brackets of class definition on its own line.
35 - Double inclusion protection defines are all upper case letters and are
36   composed of the namespace (if available), the classname and a H suffix
37   separated by underscores.
38 - Inside a namespace there is no indentation.
40 Example:
42 #ifndef XKJ_MYCLASS_H
43 #define XKJ_MYCLASS_H
45 namespace XKJ {
47 class MyClass
49   public:
50     MyClass();
52   private:
53     int mMyInt;
58 #endif
61 API docs
62 --------
64 - Each public function must have a Doxygen compatible comment in the header
65 - Use C-style comments without additional asterisks
66 - Indent correctly.
67 - Comments should be grammatically correct, e.g. sentences start with uppercase
68   letters and end with a full stop.
69 - Be concise.
71 Example:
73   /**
74     This function makes tea.
76     @param cups number of cups.
77     @result tea
78   */
79   Tea makeTea( int cups );
82 Class and File Names
83 --------------------
85 - Put classes in files, which have the same name as the class, but only
86   lower-case letters.
87 - Designer-generated files should have a name classname_base.ui and should
88   contain a class called ClassnameBase.
89 - Classes inheriting from designer-generated classes have the same name as the
90   generated class, but without the Base suffix.
92 Class and Variable Names
93 ------------------------
95 - For class, variable, function names seperate multiple words by upper-casing
96   the words precedeed by other words.
97 - Class names start with an upper-case letter.
98 - Function names start with a lower-case letter.
99 - Variable names start with a lower-case letter.
100 - Member variables of a class start with "m" followed by an upper-case letter.