@ -6,6 +6,31 @@ For programming languages other than C++ (e.g. JavaScript) used in this reposito
@@ -6,6 +6,31 @@ For programming languages other than C++ (e.g. JavaScript) used in this reposito
**Note 2:** You can use the `uncrustify` program/tool to clean up any source file. Use it with the `uncrustify.cfg` configuration file found in the root folder.
**Note 3:** There is also a style for QtCreator but it doesn't cover all cases. In QtCreator `Tools->Options...->C++->Code Style->Import...` and choose the `codingStyleQtCreator.xml` file found in the root folder.
### Table Of Contents
* [1. New lines & curly braces](#1-new-lines--curly-braces)
* [a. Function blocks, class/struct definitions, namespaces](#a-function-blocks-classstruct-definitions-namespaces)
* [b. Other code blocks](#b-other-code-blocks)
* [c. Blocks in switch's case labels](#c-blocks-in-switchs-case-labels)
* [d. If-else statements](#d-if-else-statements)
* [e. Single statement if blocks](#e-single-statement-if-blocks)
* [f. Acceptable conditions to omit braces](#f-acceptable-conditions-to-omit-braces)
UTF-8 and Unix-like line ending (LF). Unless some platform specific files need other encodings/line endings.
### 4. Initialization lists. ###
### 4. Initialization lists ###
Initialization lists should be vertical. This will allow for more easily readable diffs. The initialization colon should be indented and in its own line along with first argument. The rest of the arguments should be indented too and have the comma prepended.
```c++
myClass::myClass(int a, int b, int c, int d)
@ -182,7 +207,7 @@ myClass::myClass(int a, int b, int c, int d)
@@ -182,7 +207,7 @@ myClass::myClass(int a, int b, int c, int d)
}
```
### 5. Enums. ###
### 5. Enums ###
Enums should be vertical. This will allow for more easily readable diffs. The members should be indented.
```c++
enum Days
@ -197,7 +222,7 @@ enum Days
@@ -197,7 +222,7 @@ enum Days
};
```
### 6. Names. ###
### 6. Names ###
All names should be camelCased.
#### a. Type names and namespaces ####
@ -231,7 +256,7 @@ class MyClass
@@ -231,7 +256,7 @@ class MyClass
}
```
### 7. Header inclusion order. ###
### 7. Header inclusion order ###
The headers should be placed in the following group order: