-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
80 lines (78 loc) · 2.72 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
RequiresClausePosition: OwnLine
AllowShortLoopsOnASingleLine: 'true'
AlwaysBreakTemplateDeclarations: 'true'
BreakBeforeBraces: Linux
# ColumnLimit: '160'
ColumnLimit: '80'
Cpp11BracedListStyle: 'true'
IndentWidth: '4'
KeepEmptyLinesAtTheStartOfBlocks: 'true'
Language: Cpp
NamespaceIndentation: None
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Never
# 指针的*的挨着哪边
PointerAlignment: Right
# 连续的空行保留几行
MaxEmptyLinesToKeep: 2
# 是否允许短方法单行
AllowShortFunctionsOnASingleLine: true
# 是否允许短if单行 If true, if (a) return; 可以放到同一行
#注释对齐
AlignTrailingComments: false
AllowShortIfStatementsOnASingleLine: true
AccessModifierOffset: -4
# 连续赋值时,对齐所有等号
AlignConsecutiveAssignments: false
# 连续声明时,对齐所有声明的变量名
AlignConsecutiveDeclarations: false
# ConstructorInitializerAllOnOneLineOrOnePerLine: true
# AllowAllConstructorInitializersOnNextLine: true
AlignAfterOpenBracket: Align
#等号两边的空格
SpaceBeforeAssignmentOperators: true
# If ``true``, spaces will be inserted after '<' and before '>' in template argument lists
SortIncludes: true
# false表示所有形参要么都在同一行,要么都各自一行
BinPackParameters: true
# BinPackArguments: false
# BinPackParameters: false
# ExperimentalAutoDetectBinPacking: false
# AllowAllParametersOfDeclarationOnNextLine: false
# 大括号换行,只有当BreakBeforeBraces设置为Custom时才有效
BraceWrapping:
# class定义后面
AfterClass: true
# 控制语句后面
AfterControlStatement: false
# enum定义后面
AfterEnum: true
# 函数定义后面
AfterFunction: true
# 命名空间定义后面
AfterNamespace: true
# ObjC定义后面
AfterObjCDeclaration: true
# struct定义后面
AfterStruct: true
# union定义后面
AfterUnion: true
# catch之前
BeforeCatch: true
# else之前
BeforeElse: true
# 缩进大括号
IndentBraces: false
# 在二元运算符前换行: None(在操作符后换行), NonAssignment(在非赋值的操作符前换行), All(在操作符前换行)
BreakBeforeBinaryOperators: NonAssignment
# 在大括号前换行: Attach(始终将大括号附加到周围的上下文), Linux(除函数、命名空间和类定义,与Attach类似),
# Mozilla(除枚举、函数、记录定义,与Attach类似), Stroustrup(除函数定义、catch、else,与Attach类似),
# Allman(总是在大括号前换行), GNU(总是在大括号前换行,并对于控制语句的大括号增加额外的缩进), WebKit(在函数前换行), Custom
# 注:这里认为语句块也属于函数
...