Deleting the wiki page 'Coding_style' cannot be undone. Continue?
NOTE: This coding style guide is newer than the source code so that you may find some places in the code which violate the coding style!
The coding style is mostly based on PSR-2, as far as it is applicable to C++ code. Read more about PSR-2 here: https://www.php-fig.org/psr/psr-2/
The differences from and the additions to PSR-2 are described in the section "Differences from PSR-2 and additions" in this file.
Here are some details of the coding style:
Four spaces per intendation level, no tabs allowed.
Class names are in UpperCamelCase, methods must be named in lowerCamelCase.
For variables, class attributes and function/method parameters under_score names must be used.
Constants must contain only CAPITAL_LETTERS_AND_UNDERSCORES.
Example:
switch (i) {
case 0: {
do_zero();
break;
}
case 1: {
do_one();
break;
}
default: {
do_nothing();
}
}
Access labels have to be indented by four whitespaces. Two empty lines have to be placed before and after the label and the first method/attribute, except when the label is the first thing in a class/struct declaration. In that case, no newline needs to preceed the label.
Example:
class A
{
public:
/**
* Does this.
*/
void doThis();
/**
* Does something else.
*/
virtual void doSomethingElse();
protected:
/**
* This actor does stuff in doThis and doSomethingElse.
*/
Other actor;
};
Deleting the wiki page 'Coding_style' cannot be undone. Continue?