2016-05-26 23:42:23 +02:00
|
|
|
### Please use the following code style/guidelines
|
|
|
|
|
|
|
|
- use QT wherever it's possible (except there is a good reason)
|
|
|
|
- use unix line endings (not windows)
|
|
|
|
- indent your code with TABs instead of spaces
|
2016-08-15 22:32:01 +02:00
|
|
|
- your files should end with a newline
|
|
|
|
- names are camel case
|
|
|
|
- use utf8 file encoding (ANSI encoding is strictly forbidden!)
|
|
|
|
- use speaking names for variables.
|
|
|
|
- avoid code dups -> if you write similar code blocks more the 2 times -> refactoring!
|
|
|
|
- avoid compiler macros (#ifdef #define ...) where possible
|
|
|
|
- class member variables must prefixed with underscore `int _myMemberVar`
|
2016-05-26 23:42:23 +02:00
|
|
|
- follow this rule for curly brackets
|
2016-08-15 22:32:01 +02:00
|
|
|
|
2016-05-26 23:42:23 +02:00
|
|
|
```
|
|
|
|
bad:
|
|
|
|
if (conditon) {
|
2016-08-15 22:32:01 +02:00
|
|
|
code
|
2016-05-26 23:42:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
good:
|
|
|
|
if (condition)
|
|
|
|
{
|
2016-08-15 22:32:01 +02:00
|
|
|
code
|
|
|
|
}
|
|
|
|
```
|
|
|
|
- initializer list on constructors:
|
|
|
|
|
|
|
|
```
|
|
|
|
bad:
|
|
|
|
MyClass::MyClass()
|
|
|
|
: myVarA(0), myVarB("eee"), myVarC(true)
|
|
|
|
{
|
2016-05-26 23:42:23 +02:00
|
|
|
}
|
|
|
|
|
2016-08-15 22:32:01 +02:00
|
|
|
MyClass::MyClass() : myVarA(0),
|
|
|
|
myVarB("eee"),
|
|
|
|
myVarC(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
good:
|
|
|
|
MyClass::MyClass()
|
2016-08-23 20:07:12 +02:00
|
|
|
: myVarA(0)
|
2016-08-15 22:32:01 +02:00
|
|
|
, myVarB("eee")
|
|
|
|
, myVarC(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
```
|
2016-09-22 09:19:31 +02:00
|
|
|
|
|
|
|
- pointer declaration
|
|
|
|
|
|
|
|
```
|
|
|
|
bad:
|
|
|
|
int *foo;
|
|
|
|
int * fooFoo;
|
|
|
|
|
|
|
|
good:
|
|
|
|
int* foo;
|
|
|
|
```
|
|
|
|
|