From c66249b79aa9bfa0924494adcd5345b5b1244b0c Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 10 Feb 2010 01:02:50 +0000 Subject: 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 --- src/HACKING | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/HACKING (limited to 'src/HACKING') 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 +#include + +// KDE +#include +#include + +// Local +#include "aclass.h" +#include "myclass.moc" -- cgit v1.2.1