|
|
@ -231,8 +231,8 @@ Example: |
|
|
|
|
|
|
|
|
|
|
|
#include <libtorrent/version.hpp> |
|
|
|
#include <libtorrent/version.hpp> |
|
|
|
|
|
|
|
|
|
|
|
#include "base/bittorrent/session.h" |
|
|
|
|
|
|
|
#include "base/bittorrent/infohash.h" |
|
|
|
#include "base/bittorrent/infohash.h" |
|
|
|
|
|
|
|
#include "base/bittorrent/session.h" |
|
|
|
#include "base/utils/fs.h" |
|
|
|
#include "base/utils/fs.h" |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include "base/utils/string.h" |
|
|
|
#include "base/utils/string.h" |
|
|
@ -282,20 +282,32 @@ auto spinBox = static_cast<QSpinBox*>(sender()); |
|
|
|
// we know the variable type based on the right-hand expression |
|
|
|
// we know the variable type based on the right-hand expression |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
* Space around operations eg `a = b + c` or `a=b+c`: |
|
|
|
* Notice the spaces in the following specific situations: |
|
|
|
|
|
|
|
|
|
|
|
Before and after the assignment and other binary (and ternary) operators there should be a space.<br/> |
|
|
|
|
|
|
|
There should not be a space between increment/decrement and its operand.<br/> |
|
|
|
|
|
|
|
Some valid use cases: |
|
|
|
|
|
|
|
```c++ |
|
|
|
```c++ |
|
|
|
|
|
|
|
// Before and after the assignment and other binary (and ternary) operators there should be a space |
|
|
|
|
|
|
|
// There should not be a space between increment/decrement and its operand |
|
|
|
a += 20; |
|
|
|
a += 20; |
|
|
|
a = (b <= MAX_B ? b : MAX_B); |
|
|
|
a = (b <= MAX_B ? b : MAX_B); |
|
|
|
++a; |
|
|
|
++a; |
|
|
|
b--; |
|
|
|
--b; |
|
|
|
|
|
|
|
|
|
|
|
for (int a = 0; a < b; ++b) { |
|
|
|
for (int a = 0; a < b; ++b) { |
|
|
|
// code |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Range-based for loop, spaces before and after the colon |
|
|
|
|
|
|
|
for (auto i : container) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Derived class, spaces before and after the colon |
|
|
|
|
|
|
|
class Derived : public Base |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Prefer pre-increment, pre-decrement operators |
|
|
|
|
|
|
|
```c++ |
|
|
|
|
|
|
|
++i, --j; // Yes |
|
|
|
|
|
|
|
i++, j--; // No |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
* private/public/protected must not be indented |
|
|
|
* private/public/protected must not be indented |
|
|
|