Warning, /pim/kontact/HACKING is written in an unsupported language. File is not indexed.
0001 Coding Style 0002 ============ 0003 0004 We follow the Frameworks Coding Style. 0005 See https://techbase.kde.org/Policies/Frameworks_Coding_Style 0006 0007 Formatting 0008 ---------- 0009 0010 - No Tabs. 0011 - Indent with 2 spaces. 0012 - A line must not have more than 100 chars. 0013 - Put Spaces between brackets and arguments of functions. 0014 - For if, else, while and similar statements put the brackets on the same line 0015 as the statement. 0016 - Function and class definitions have their brackets on separate lines. 0017 0018 Example: 0019 0020 void MyClass::myFunction() 0021 { 0022 if ( blah == fasel ) { 0023 blubbVariable = arglValue; 0024 } else { 0025 blubbVariable = oerxValue; 0026 } 0027 } 0028 0029 0030 Header Formatting 0031 ----------------- 0032 0033 - General formatting rules apply. 0034 - Access modifiers are indented. 0035 - Put curly brackets of class definition on its own line. 0036 - Double inclusion protection defines are all upper case letters and are 0037 composed of the namespace (if available), the classname and a H suffix 0038 separated by underscores. 0039 - Inside a namespace there is no indentation. 0040 0041 Example: 0042 0043 #ifndef XKJ_MYCLASS_H 0044 #define XKJ_MYCLASS_H 0045 0046 namespace XKJ { 0047 0048 class MyClass 0049 { 0050 public: 0051 MyClass(); 0052 0053 private: 0054 int mMyInt; 0055 }; 0056 0057 } 0058 0059 #endif 0060 0061 0062 API docs 0063 -------- 0064 0065 - Each public function must have a Doxygen compatible comment in the header 0066 - Use C-style comments without additional asterisks 0067 - Indent correctly. 0068 - Comments should be grammatically correct, e.g. sentences start with uppercase 0069 letters and end with a full stop. 0070 - Be concise. 0071 0072 Example: 0073 0074 /** 0075 This function makes tea. 0076 0077 @param cups number of cups. 0078 @result tea 0079 */ 0080 Tea makeTea( int cups ); 0081 0082 0083 Class and File Names 0084 -------------------- 0085 0086 - Put classes in files, which have the same name as the class, but only 0087 lower-case letters. 0088 - Designer-generated files should have a name classname_base.ui and should 0089 contain a class called ClassnameBase. 0090 - Classes inheriting from designer-generated classes have the same name as the 0091 generated class, but without the Base suffix. 0092 0093 Class and Variable Names 0094 ------------------------ 0095 0096 - For class, variable, function names separate multiple words by upper-casing 0097 the words precedeed by other words. 0098 - Class names start with an upper-case letter. 0099 - Function names start with a lower-case letter. 0100 - Variable names start with a lower-case letter. 0101 - Member variables of a class start with "m" followed by an upper-case letter.