2019-04-20 20:24:14 +00:00
|
|
|
|
---
|
2019-04-23 11:53:16 +00:00
|
|
|
|
title: "Проверка именования в clang-tidy"
|
2019-04-20 20:24:14 +00:00
|
|
|
|
category: Программирование
|
2019-04-22 05:13:35 +00:00
|
|
|
|
tags: C++, программирование, clang, clang-tidy, форматирование,
|
2019-04-20 20:24:14 +00:00
|
|
|
|
summary:
|
2019-04-23 11:53:16 +00:00
|
|
|
|
CSS: table-100.css, clang-table.css
|
2019-04-20 20:24:14 +00:00
|
|
|
|
toc: yes
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
[TOC]
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Программа [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) может
|
|
|
|
|
проверить стилистику регистра идентификаторов, а также их префиксы и суффиксы.
|
|
|
|
|
Возможные варианты стилей:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
|
|
|
|
lower_case
|
|
|
|
|
UPPER_CASE
|
|
|
|
|
camelBack
|
|
|
|
|
CamelCase
|
|
|
|
|
camel_Snake_Back
|
|
|
|
|
Camel_Snake_Case
|
|
|
|
|
aNy_CasE
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Перечень вариантов идентификаторов приведён
|
|
|
|
|
[здесь](https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html).
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Для включения проверки именования идентификаторов нужно в находящемся
|
|
|
|
|
в корне проекта файле `.clang-tidy` включить данный тип диагностики (опция
|
2019-04-20 20:24:14 +00:00
|
|
|
|
`clang-diagnostic-*,readability-identifier-naming`), а затем указать
|
|
|
|
|
список выполняемых проверок и их параметры в формате YAML, например:
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
---
|
|
|
|
|
Checks: 'clang-diagnostic-*,readability-identifier-naming'
|
|
|
|
|
CheckOptions:
|
|
|
|
|
- key: readability-identifier-naming.VariableCase
|
|
|
|
|
value: lower_case
|
|
|
|
|
- key: readability-identifier-naming.VariablePrefix
|
|
|
|
|
value: ''
|
|
|
|
|
- key: readability-identifier-naming.VariableSuffix
|
|
|
|
|
value: ''
|
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-24 13:57:04 +00:00
|
|
|
|
[Проект](https://git.246060.ru/f1x1t/clang-tidy-readability-identifier-naming)
|
|
|
|
|
с файлом `.clang-tidy`, в соответствии с которым проводятся проверки именования
|
|
|
|
|
идентификаторов.
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
Перечень возможных параметров конфигурационного файла, их типовые значения
|
|
|
|
|
и примеры соответствующего кода приведены ниже.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Синтаксис
|
|
|
|
|
|
|
|
|
|
### AbstractClass (Абстрактный класс)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
AbstractClassCase | `CamelCase`
|
|
|
|
|
AbstractClassPrefix | `''`
|
|
|
|
|
AbstractClassSuffix | `''`
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ABSTRACT_CLASS {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
ABSTRACT_CLASS();
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class AbstractClass {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
AbstractClass();
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Class (Класс)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ClassCase | `CamelCase`
|
|
|
|
|
ClassPrefix | `''`
|
|
|
|
|
ClassSuffix | `''`
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class TEST_CLASS {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
TEST_CLASS();
|
|
|
|
|
~TEST_CLASS();
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class TestClass {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
TestClass();
|
|
|
|
|
~TestClass();
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Struct (Структура)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
StructCase | `CamelCase`
|
|
|
|
|
StructPrefix | `''`
|
|
|
|
|
StructSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
struct TEST_struct {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int a;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
struct TestStruct {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int a;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Union (Объединение)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
UnionCase | `CamelCase`
|
|
|
|
|
UnionPrefix | `''`
|
|
|
|
|
UnionSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
union TEST_union {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int a;
|
|
|
|
|
char b;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
union TestUnion {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int a;
|
|
|
|
|
char b;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Enum (Перечисление)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
EnumCase | `CamelCase`
|
|
|
|
|
EnumPrefix | `''`
|
|
|
|
|
EnumSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
enum TEST_enum { ONE, TWO };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
enum TestEnum { ONE, TWO };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### EnumConstant (Значение в перечислении)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
EnumConstantCase | `UPPER_CASE`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
EnumConstantPrefix | `''`
|
|
|
|
|
EnumConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
enum TestEnum { one, TWO };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
enum TestEnum { ONE, TWO };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Namespace (Пространство имён)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
NamespaceCase | `lower_case`
|
|
|
|
|
NamespacePrefix | `''`
|
|
|
|
|
NamespaceSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
namespace TEST_ns {
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
namespace test_ns {
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### InlineNamespace (Вложенное пространство имён)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
InlineNamespaceCase | `lower_case`
|
|
|
|
|
InlineNamespacePrefix | `''`
|
|
|
|
|
InlineNamespaceSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
namespace test_ns {
|
|
|
|
|
inline namespace InlineNamespace {
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
}
|
|
|
|
|
} // namespace test_ns
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
namespace test_ns {
|
|
|
|
|
inline namespace inline_namespace {
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
}
|
|
|
|
|
} // namespace test_ns
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### TypeAlias (Псевдоним типа)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
TypeAliasCase | `lower_case`
|
|
|
|
|
TypeAliasPrefix | `''`
|
|
|
|
|
TypeAliasSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
struct MyStructure {
|
|
|
|
|
int a;
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
using MY_STRUCT_TYPE = MyStructure;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
struct MyStructure {
|
|
|
|
|
int a;
|
|
|
|
|
};
|
|
|
|
|
using MyStructType = MyStructure;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Typedef (Объявление типа)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
TypedefCase | `lower_case`
|
|
|
|
|
TypedefPrefix | `''`
|
|
|
|
|
TypedefSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
typedef int MY_INT;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
typedef int my_int;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Переменные
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### Variable (Переменная) ???
|
|
|
|
|
|
|
|
|
|
### GlobalVariable (Глобальная переменная)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 05:13:35 +00:00
|
|
|
|
GlobalVariableCase | `lower_case`
|
|
|
|
|
GlobalVariablePrefix | `''`
|
|
|
|
|
GlobalVariableSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
unsigned GlobalVariable;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
unsigned global_variable;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### LocalVariable (Локальная переменная)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
LocalVariableCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
LocalVariablePrefix | `''`
|
|
|
|
|
LocalVariableSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
int function() {
|
|
|
|
|
int LocalVariable = 0;
|
|
|
|
|
return LocalVariable;
|
|
|
|
|
}
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
int function() {
|
2019-04-22 08:59:44 +00:00
|
|
|
|
int localVariable = 0;
|
|
|
|
|
return localVariable;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
}
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### StaticVariable (Статическая переменная)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
StaticVariableCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
StaticVariablePrefix | `''`
|
|
|
|
|
StatucVariableSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int functionWithStaticVariable() {
|
|
|
|
|
static int StaticVariable = 0;
|
|
|
|
|
return StaticVariable;
|
|
|
|
|
}
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
int functionWithStaticVariable() {
|
|
|
|
|
static int staticVariable = 0;
|
|
|
|
|
return staticVariable;
|
|
|
|
|
}
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ConstexptVariable (Переменная constexpr)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 05:13:35 +00:00
|
|
|
|
ConstexprVariableCase | `lower_case`
|
|
|
|
|
ConstexprVariablePrefix | `''`
|
|
|
|
|
ConstexprVariableSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
constexpr int CONST_FIVE = 5;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
constexpr int const_five = 5;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
|
|
|
|
### GlobalPointer (Глобальный указатель)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 05:13:35 +00:00
|
|
|
|
GlobalPointerCase | `lower_case`
|
|
|
|
|
GlobalPointerPrefix | `''`
|
|
|
|
|
GlobalPointerSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
void* globalPointer;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 05:13:35 +00:00
|
|
|
|
void* global_pointer;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### LocalPointer (Локальный указатель)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
LocalPointerCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
LocalPointerPrefix | `''`
|
|
|
|
|
LocalPointerSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
void* function() {
|
|
|
|
|
void* LocalPointer = nullptr;
|
|
|
|
|
return LocalPointer;
|
|
|
|
|
}
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
void* function() {
|
|
|
|
|
void* localPointer = nullptr;
|
|
|
|
|
return localPointer;
|
|
|
|
|
}
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Member (Член) ???
|
|
|
|
|
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
### ClassMember (Член класса)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ClassMemberCase | `camelBack`
|
|
|
|
|
ClassMemberPrefix | `''`
|
|
|
|
|
ClassMemberSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithClassMember {
|
|
|
|
|
public:
|
|
|
|
|
static int CLASS_MEMBER;
|
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithClassMember {
|
|
|
|
|
public:
|
|
|
|
|
static int classMember;
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ConstantMember (Константный член)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ConstantMemberCase | `lower_case`
|
|
|
|
|
ConstantMemberPrefix | `''`
|
|
|
|
|
ConstantMemberSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithConstantMember {
|
|
|
|
|
char const ConstMember[4] = "123";
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithConstantMember {
|
|
|
|
|
char const const_member[4] = "123";
|
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
|
|
|
|
### PrivateMember (Приватный член)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
PrivateMemberCase | `camelBack`
|
|
|
|
|
PrivateMemberPrefix | `'m_'`
|
|
|
|
|
PrivateMemberSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithPrivateMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
private:
|
|
|
|
|
int PrivateMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithPrivateMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
private:
|
|
|
|
|
int m_privateMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### ProtectedMember (Защищённый член)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ProtectedMemberCase | `camelBack`
|
|
|
|
|
ProtectedMemberPrefix | `''`
|
|
|
|
|
ProtectedMemberSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithProtectedMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
protected:
|
|
|
|
|
int ProtectedMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithProtectedMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
protected:
|
|
|
|
|
int protectedMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
### PublicMember (Публичный член)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
PublicMemberCase | `camelBack`
|
|
|
|
|
PublicMemberPrefix | `''`
|
|
|
|
|
PublicMemberSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithPublicMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
int PublicMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
|
|
|
|
class ClassWithPublicMember {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
int publicMember;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Константы
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
|
|
|
|
|
### Constant (Константа) ???
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ConstantCase | `UPPER_CASE`
|
|
|
|
|
ConstantPrefix | `''`
|
|
|
|
|
ConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
const int theOne = 1;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
const int THE_ONE = 1;
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### GlobalConstant (Глобальная константа)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
GlobalConstantCase | `UPPER_CASE`
|
|
|
|
|
GlobalConstantPrefix | `''`
|
|
|
|
|
GlobalConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
const int theOne = 1;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
const int THE_ONE = 1;
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
### LocalConstant (Локальная константа)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
LocalConstantCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
LocalConstantPrefix | `''`
|
|
|
|
|
LocalConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int functionWithLocalConstant() {
|
|
|
|
|
const int LocalConstant = 0;
|
|
|
|
|
return LocalConstant;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int functionWithLocalConstant() {
|
2019-04-22 08:59:44 +00:00
|
|
|
|
const int localConstant = 0;
|
|
|
|
|
return localConstant;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
### StaticConstant (Статическая контстанта)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
StaticConstantCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
StaticConstantPrefix | `''`
|
|
|
|
|
StaticConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int functionWithStaticConstant() {
|
|
|
|
|
const int StaticConstant = 0;
|
|
|
|
|
return StaticConstant;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int functionWithStaticConstant() {
|
2019-04-22 08:59:44 +00:00
|
|
|
|
const int staticConstant = 0;
|
|
|
|
|
return staticConstant;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
### ClassConstant (Константа класса)
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ClassConstantCase | `UPPER_CASE`
|
|
|
|
|
ClassConstantPrefix | `''`
|
|
|
|
|
ClassConstantSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
class ClassWithClassConstant {
|
|
|
|
|
public:
|
|
|
|
|
static int const Class_Constant = 0;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
class ClassWithClassConstant {
|
|
|
|
|
public:
|
|
|
|
|
static int const CLASS_CONSTANT = 0;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
### GlobalConstantPointer (Глобальный константный указатель)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-23 11:53:16 +00:00
|
|
|
|
GlobalConstantPointerCase | `lower_case`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
GlobalConstantPointerPrefix | `''`
|
|
|
|
|
GlobalConstantPointerSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
void* global_pointer;
|
|
|
|
|
void* const GlobalConstPointer = global_pointer;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
void* global_pointer;
|
2019-04-23 11:53:16 +00:00
|
|
|
|
void* const global_const_pointer = global_pointer;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
### LocalConstantPointer (Локальный константный указатель)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-23 11:53:16 +00:00
|
|
|
|
LocalConstantPointerCase | `camelBack`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
LocalConstantPointerPrefix | `''`
|
|
|
|
|
LocalConstantPointerSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
void* functionWithLocalConstPointer() {
|
|
|
|
|
void* pointer = nullptr;
|
|
|
|
|
void* const LocalConstPointer = pointer;
|
|
|
|
|
return LocalConstPointer;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
void* functionWithLocalConstPointer() {
|
|
|
|
|
void* pointer = nullptr;
|
2019-04-23 11:53:16 +00:00
|
|
|
|
void* const localConstPointer = pointer;
|
|
|
|
|
return localConstPointer;
|
2019-04-22 05:13:35 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
## Функции
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### Function (Функция)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
FunctionCase | `camelBack`
|
|
|
|
|
FunctionPrefix | `''`
|
|
|
|
|
FunctionSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
static int static_function() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
static int staticFunction() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### GlobalFunction (Глобальная функция)
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
GlobalFunctionCase | `camelBack`
|
|
|
|
|
GlobalFunctionPrefix | `''`
|
|
|
|
|
GlobalFunctionSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int global_function() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
int globalFunction() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
### ConstexprFunction (Функция constexpr)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-22 05:13:35 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-23 11:53:16 +00:00
|
|
|
|
ConstexprFunctionCase | `camelBack`
|
|
|
|
|
ConstexprFunctionPrefix | `''`
|
|
|
|
|
ConstexprFunctionSuffix | `''`
|
2019-04-22 05:13:35 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
constexpr int get_five() {
|
|
|
|
|
return ( 5 );
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
constexpr int getFive() {
|
|
|
|
|
return ( 5 );
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### Method (Метод) ???
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
### ClassMethod (Метод класса)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ClassMethodCase | `camelBack`
|
|
|
|
|
ClassMethodPrefix | `''`
|
|
|
|
|
ClassMethodSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithMethod {
|
|
|
|
|
public:
|
|
|
|
|
static int get_int() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithMethod {
|
|
|
|
|
public:
|
|
|
|
|
static int getInt() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### ConstexprMethod (Метод constexpr)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ConstexprMethodCase | `camelBack`
|
|
|
|
|
ConstexprMethodPrefix | `''`
|
|
|
|
|
ConstexprMethodSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithConstexprMethod {
|
|
|
|
|
private:
|
|
|
|
|
constexpr int get_int() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithConstexprMethod {
|
|
|
|
|
private:
|
|
|
|
|
constexpr int getInt() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### VirtualMethod (Виртуальный метод)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
VirtualMethodCase | `camelBack`
|
|
|
|
|
VirtualMethodPrefix | `''`
|
|
|
|
|
VirtualMethodSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithVirtualMethod {
|
|
|
|
|
private:
|
|
|
|
|
virtual int get_int() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithVirtualMethod {
|
|
|
|
|
private:
|
|
|
|
|
virtual int getInt() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### PrivateMethod (Приватный метод)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
PrivateMethodCase | `camelBack`
|
|
|
|
|
PrivateMethodPrefix | `''`
|
|
|
|
|
PrivateMethodSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithPrivateMethod {
|
|
|
|
|
private:
|
|
|
|
|
int get_int() { return 0; };
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithPrivateMethod {
|
|
|
|
|
private:
|
|
|
|
|
int getInt() { return 0; };
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### ProtectedMethod (Защищённый метод)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ProtectedMethodCase | `camelBack`
|
|
|
|
|
ProtectedMethodPrefix | `''`
|
|
|
|
|
ProtectedMethodSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithProtectedMethod {
|
|
|
|
|
protected:
|
|
|
|
|
int get_int() { return 0; };
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithProtectedMethod {
|
|
|
|
|
protected:
|
|
|
|
|
int getInt() { return 0; };
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### PublicMethod (Публичный метод)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
----------------------------|----------------
|
|
|
|
|
PublicMethodCase | `camelBack`
|
|
|
|
|
PublicMethodPrefix | `''`
|
|
|
|
|
PublicMethodSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithPublicMethod {
|
|
|
|
|
public:
|
|
|
|
|
int get_int() { return 0; };
|
2019-04-23 11:53:16 +00:00
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
class ClassWithPublicMethod {
|
|
|
|
|
public:
|
|
|
|
|
int getInt() { return 0; };
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
## Параметры
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### Parameter (Параметр)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ParameterCase | `camelBack`
|
|
|
|
|
ParameterPrefix | `''`
|
|
|
|
|
ParameterSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
int returnInt(int return_Value) {
|
|
|
|
|
return return_Value;
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
int returnInt(int returnValue) {
|
|
|
|
|
return returnValue;
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### ConstantParameter (Константный параметр)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ConstantParameterCase | `camelBack`
|
|
|
|
|
ConstantParameterPrefix | `''`
|
|
|
|
|
ConstantParameterSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
char returnChar(const char return_Value) {
|
|
|
|
|
return return_Value;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
char returnChar(const char returnValue) {
|
2019-04-23 11:53:16 +00:00
|
|
|
|
return returnValue;
|
2019-04-22 08:59:44 +00:00
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### ConstantPointerParameter (Константный указатель на параметр)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ConstantPointerParameterCase | `camelBack`
|
|
|
|
|
ConstantPointerParameterPrefix | `''`
|
|
|
|
|
ConstantPointerParameterSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
void* returnVoid(void* const return_Value) {
|
|
|
|
|
return return_Value;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
void* returnVoid(void* const returnValue) {
|
|
|
|
|
return returnValue;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### PointerParameter (Параметр типа указатель)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
PointerParameterCase | `camelBack`
|
|
|
|
|
PointerParameterPrefix | `''`
|
|
|
|
|
PointerParameterSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
void* returnPtr(void* return_Value) {
|
|
|
|
|
return return_Value;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
void* returnPtr(void* returnValue) {
|
|
|
|
|
return returnValue;
|
2019-04-20 20:24:14 +00:00
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
|
|
|
|
|
## Шаблоны
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### TemplateParameter (Параметр шаблона)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
TemplateParameterCase | `camelBack`
|
|
|
|
|
TemplateParameterPrefix | `''`
|
|
|
|
|
TemplateParameterSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода до форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
template<typename TType> int tFunction(TType t_value) {
|
2019-04-22 08:59:44 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
Пример кода после форматирования:
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-23 11:53:16 +00:00
|
|
|
|
template<typename TType> int tFunction(TType tValue) {
|
2019-04-22 08:59:44 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
### ParameterPack (Список параметров шаблона)
|
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ParameterPackCase | `camelBack`
|
|
|
|
|
ParameterPackPrefix | `''`
|
|
|
|
|
ParameterPackSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<class ... Types> void f(Types ... Parameters_Pack);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<class ... Types> void f(Types ... parametersPack);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### TemplateTemplateParameter (Параметр шаблона шаблона)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
TemplateTemplateParameterCase | `camelBack`
|
|
|
|
|
TemplateTemplateParameterPrefix| `''`
|
|
|
|
|
TemplateTemplateParameterSuffix| `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<template<class T> class TPL_TPL_Parameter>
|
|
|
|
|
class AllmightyClass { };
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<template<class T> class tplTplParameter>
|
|
|
|
|
class AllmightyClass { };
|
|
|
|
|
```
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-04-22 08:59:44 +00:00
|
|
|
|
### TypeTemplateParameter (Типа параметра шаблона)
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
2019-04-22 08:59:44 +00:00
|
|
|
|
TypeTemplateParameterCase | `CamelCase`
|
|
|
|
|
TypeTemplateParameterPrefix | `''`
|
|
|
|
|
TypeTemplateParameterSuffix | `''`
|
2019-04-20 20:24:14 +00:00
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
template<typename t_type>int tFunction(t_type value) {
|
|
|
|
|
return 0;
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
2019-04-22 08:59:44 +00:00
|
|
|
|
template<typename TType>int tFunction(TType value) {
|
|
|
|
|
return 0;
|
|
|
|
|
};
|
2019-04-20 20:24:14 +00:00
|
|
|
|
```
|
2019-04-22 08:59:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ValueTemplateParameter (Значение параметра шаблона)
|
|
|
|
|
|
2019-04-23 11:53:16 +00:00
|
|
|
|
Параметр | Значение
|
|
|
|
|
-------------------------------|----------------
|
|
|
|
|
ValueTemplateParameterCase | `camelBack`
|
|
|
|
|
ValueTemplateParameterPrefix | `''`
|
|
|
|
|
ValueTemplateParameterSuffix | `''`
|
|
|
|
|
|
|
|
|
|
Пример кода до форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<typename TType, int arg_count> int tFunction(TType tValue) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Пример кода после форматирования:
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<typename TType, int argCount> int tFunction(TType tValue) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
2019-04-22 08:59:44 +00:00
|
|
|
|
|