File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ Language : Cpp
3
+ BasedOnStyle : Google
4
+
5
+ AccessModifierOffset : -2
6
+ AlignAfterOpenBracket : Align
7
+ AlignOperands : true
8
+ AllowAllParametersOfDeclarationOnNextLine : true
9
+ BreakConstructorInitializersBeforeComma : true
10
+ BinPackArguments : true
11
+ BinPackParameters : false
12
+ BraceWrapping :
13
+ AfterClass : false
14
+ AfterFunction : false
15
+ AfterNamespace : false
16
+ AfterStruct : false
17
+ BreakBeforeBraces : Custom
18
+ ColumnLimit : 100
19
+ ConstructorInitializerIndentWidth : 0
20
+ ContinuationIndentWidth : 2
21
+ DerivePointerAlignment : false
22
+ PointerAlignment : Right
23
+ ReflowComments : false
Original file line number Diff line number Diff line change @@ -349,6 +349,40 @@ double bs_coeff; // 弹速系数
349
349
*/
350
350
```
351
351
352
+ ## 代码风格规范(基于 Google 风格)
353
+
354
+ 参加CODE_STADARD中` .clang-format `
355
+
356
+ - ** 语言** :C++
357
+ - ** 基础风格** :Google
358
+
359
+ #### 格式规范
360
+
361
+ - ** 访问修饰符缩进** (` AccessModifierOffset ` ):设置为 ` -2 ` ,即访问修饰符(如 ` public ` 、` protected ` 、` private ` )向左缩进 2 个空格。
362
+ - ** 括号对齐** (` AlignAfterOpenBracket ` ):将括号内的内容对齐。
363
+ - ** 操作符对齐** (` AlignOperands ` ):开启,将行内的操作符对齐。
364
+ - ** 允许所有参数声明在下一行** (` AllowAllParametersOfDeclarationOnNextLine ` ):设置为 ` true ` ,允许函数声明的参数可以放置在下一行。
365
+ - ** 在构造函数初始化器前换行** (` BreakConstructorInitializersBeforeComma ` ):设置为 ` true ` ,在构造函数的初始化列表中,每个成员初始化器的逗号前换行。
366
+ - ** 函数参数的多行换行** (` BinPackArguments ` ):设置为 ` true ` ,允许函数调用的参数放在同一行,减少换行。
367
+ - ** 函数声明参数的多行换行** (` BinPackParameters ` ):设置为 ` false ` ,函数声明中的参数不允许挤在同一行,鼓励换行对齐。
368
+
369
+ #### 括号换行规则(` BraceWrapping ` )
370
+
371
+ - ** 类定义后** (` AfterClass ` ):设置为 ` false ` ,类定义不另起一行 ` { ` 。
372
+ - ** 函数定义后** (` AfterFunction ` ):设置为 ` false ` ,函数定义不另起一行 ` { ` 。
373
+ - ** 命名空间后** (` AfterNamespace ` ):设置为 ` false ` ,命名空间定义不另起一行 ` { ` 。
374
+ - ** 结构体定义后** (` AfterStruct ` ):设置为 ` false ` ,结构体定义不另起一行 ` { ` 。
375
+
376
+ #### 其他格式设置
377
+
378
+ - ** 大括号换行方式** (` BreakBeforeBraces ` ):设置为 ` Custom ` ,使用自定义的换行规则。
379
+ - ** 列宽限制** (` ColumnLimit ` ):设置为 ` 100 ` ,限制代码每行最长 100 个字符。
380
+ - ** 构造函数初始化器的缩进宽度** (` ConstructorInitializerIndentWidth ` ):设置为 ` 0 ` ,构造函数初始化器无额外缩进。
381
+ - ** 续行缩进宽度** (` ContinuationIndentWidth ` ):设置为 ` 2 ` ,行持续缩进(如换行后的缩进)为 2 个空格。
382
+ - ** 指针对齐方式** (` PointerAlignment ` ):设置为 ` Right ` ,指针符号 ` * ` 右对齐到变量名。
383
+ - ** 派生指针对齐** (` DerivePointerAlignment ` ):设置为 ` false ` ,不自动推导指针对齐方式。
384
+ - ** 注释换行** (` ReflowComments ` ):设置为 ` false ` ,不自动对注释进行换行处理。
385
+
352
386
## Acknowledgements
353
387
354
388
我们参考了[ 阮一峰的网络日志] ( https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html ) 中关于git commit message的部分以及2023年IRobot视觉组代码规范部分。
You can’t perform that action at this time.
0 commit comments