Warning, /sdk/cervisia/HACKING is written in an unsupported language. File is not indexed.
0001 Coding Style 0002 ============ 0003 0004 Formatting 0005 ---------- 0006 0007 - No tabs. 0008 - Indent is 4 spaces. 0009 - A line should be 80 chars in length, with a maximum length of 90 chars 0010 - Brackets are always on separate lines. 0011 - Put spaces between brackets of if, while and 0012 similar statements. 0013 - Follow the style of the rest of the file if it is different from these 0014 guidelines 0015 0016 Example: 0017 0018 void MyClass::myFunction(const QString& arg) 0019 { 0020 if ( blah == "halb" ) 0021 { 0022 doSometing(); 0023 } 0024 else 0025 { 0026 varA = varB; 0027 } 0028 } 0029 0030 0031 0032 Header Formatting 0033 ----------------- 0034 0035 - Access modifiers are not indented. 0036 - Double inclusion guard defines are all upper case 0037 letters and are composed of the namespace (if available), 0038 the classname and a H suffix separated by underscores. 0039 - Inside a namespace there is no indentation. 0040 0041 0042 Example: 0043 0044 #ifndef NAMESPACE_MYCLASS_H 0045 #define NAMESPACE_MYCLASS_H 0046 0047 namespace Namespace 0048 { 0049 0050 class MyClass 0051 { 0052 public: 0053 MyClass(); 0054 0055 private: 0056 int m_intVar; 0057 QProcess* m_proc; 0058 }; 0059 0060 } 0061 0062 #endif 0063 0064 0065 0066 Class and File Names 0067 -------------------- 0068 0069 - Use .h and .cpp for the header and source files, respectively 0070 - Do not abbreviate words in filenames 0071 - Use the classname without the namespace as the name of the file 0072 0073 Example: 0074 0075 class FooDialog : public QDialog 0076 { 0077 public: 0078 FooDialog( QWidget* parent ); 0079 }; 0080 0081 has files foodialog.h and foodialog.cpp instead of foodialog.h and foodlg.cpp 0082 0083 0084 Class and Variable Names 0085 ------------------------ 0086 0087 - For class, variable and function names separate multiple 0088 words by uppercasing the words preceded by other words. 0089 - Class names start with an uppercase letter. 0090 - Function names start with a lowercase letter. 0091 - Variable names start with a lowercase letter. 0092 - Member Variables of a class start with a 'm_' prefix 0093 followed by an lowercase letter. 0094 - Use descriptive names where possible. Write "job" instead of "j", for 0095 example. 0096 0097 Member Functions 0098 ---------------- 0099 0100 - Do not write inline accessors. All code should be in the .cpp files 0101