diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-10 01:02:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-10 01:02:50 +0000 |
commit | c66249b79aa9bfa0924494adcd5345b5b1244b0c (patch) | |
tree | 19a77c57cc41d8b522554fbde0c36d6f20d7dc7b /src/HACKING | |
download | gwenview-c66249b79aa9bfa0924494adcd5345b5b1244b0c.tar.gz gwenview-c66249b79aa9bfa0924494adcd5345b5b1244b0c.zip |
Added old abandoned KDE3 version of gwenview
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1088034 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/HACKING')
-rw-r--r-- | src/HACKING | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/HACKING b/src/HACKING new file mode 100644 index 0000000..599dd3b --- /dev/null +++ b/src/HACKING @@ -0,0 +1,95 @@ +This file describes the coding conventions used in Gwenview. + + +Naming +------ + +Classes should be named like this: MyClass. The class MyClass should be defined +in the myclass.h file and implemented in myclass.cpp. + +Variables and functions should be named like this: myVariable. Static and +member variables are identified by a prefix (s or m), without underscore. + +int sStaticVariable. + +class MyClass { + int mMemberVariable; + + void doSomething() { + int localVariable; + } +}; + + +Enum items and consts are spelled like this: + +const int MY_CONST_VALUE=120; +enum AnEnum { ITEM1, ITEM2, ITEM3 }; + + +Namespace +--------- + +All code should be enclosed in the "Gwenview" namespace. Make sure the closing +curly bracket of the namespace looks like this : + +} // namespace + +This avoids wondering why the curly bracket is here. + + +Code layout +----------- + +Use tabs, not spaces. + +The opening brace follows the function/class/for/while. Insert a space after +commas and after for/while keywords. + +void myFunction() { + int v1; + int v2=12; + for (v1=0; v1<10; ++v1) { + doSomething(v1, v2); + } +} + +class MyClass { +}; + + +If the if content is only one line long, you can place it on the same line and +omit the curly braces, but DO NOT omit them if you place the content after the +if. + +// Ok +if (!data) { + return; +} + +// Ok too +if (!data) return; + +// Bad +if (!data) + return; + + +Include files +------------- + +Group include files in the Qt, KDE or local groups and sort them +alphabetically. When writing the implementation file of a class which is a +Q_OBJECT, make sure you include the .moc file, not the .h. + +// Qt +#include <qobject.h> +#include <qwidget.h> + +// KDE +#include <kiconview.h> +#include <klistview.h> + +// Local +#include "aclass.h" +#include "myclass.moc" |