The following rules apply to all source code files.
C++ source files shall end with the extension .cpp not .cc or .cxx
As with header files these should start with a header block similar to the one generated by KDevelop.
Include files shall be included in the same format as for header file e.g
Example 3-7. Including header files in source files
//----------------------------------------------------------------------- // QT Headers #include <qtlabel.h> //----------------------------------------------------------------------- // KDE Headers #include <kcombobox.h> //----------------------------------------------------------------------- // Project Headers #include "mymoney/mymoneyfile.h" #include "ksomethingdlg.h"
Methods should be implemented as such:
with the function body indented by one tab (equals two spaces).
Flow control statements should preferably follow the Kernighan & Ritchie style as such:
Example 3-9. Kernighan & Ritchie flow control style
while (something_is_true) { operate on something; }
although the following Allman style is acceptable:
It is also acceptable for one line body statements to omit the curly braces as such:
Local variables should not be prefixed by the m_ member prefix and should start with a prefix as discussed for the header file. For example:
Each method should have a comment block preceeding it in a suitable format for other developers to see how the method works and what types of return and arguments it expects. It does not have to be kdoc compatable because kdoc only parses the header files. All kdoc comment blocks should be in the header files.