Previous | Code Standards | Next |
Header files shall end with the extension .h not .hpp.
All header files shall begin with a comment block as generated by KDevelop.
All classes designed for use by the KDE interface should begin with a K with each separate word beginning with an uppercase letter e.g KSomethingDlg.
The header file will include other header files in the following fashion and same order:
//----------------------------------------------------------------------------- // QT Headers #include <qtlabel.h> //----------------------------------------------------------------------------- // KDE Headers #include <kcombobox.h> //----------------------------------------------------------------------------- // Project Headers #include "mymoney/mymoneyfile.h"
Each class should have a kdoc compatable comment header to describe the class and it's function within kmymoney2.
Classes shall begin their declaration as such:
class KSomethingDlg : public KBaseClass {
with an appopriate access declared.
Access modifiers should be left flushed in the class declaration with all attributes and methods indented by one tab. The access methods will be in order starting with private. The access identifier should exist even if no attributes or methods exist. Only one identifier can exist of the same type. An example is below:
class KSomethingDlg : public KBaseClass { private: QString m_szSomeString; void useString(void); private slots: protected: protected slots: public: KSomethingDlg(); public slots: signals: };
All slot methods should begin with slot and signals should start with signal. e.g
signalFoundTransaction(); slotFoundTransaction();
Attribute names should begin with the m_ prefix to indicate that they are member variables. The variable name should begin with a descriptive identifier such as qcomboboxMethod. Explicit hungarian notation is also fine. Examples of valid variable names can be found below:
QComboBox m_qcomboboxMethod; int m_intCounter; int m_nCounter;
Method names should specify a return and argument(s) unless used in a slot or signal where the argument list can be left blank if necessary. The method should start with a lower case letter with each subsequent word having an upper case start letter.
An example of the above specifications for a class can be found here.
Previous | Code Standards | Next |