-
Notifications
You must be signed in to change notification settings - Fork 7
/
.clang-format
139 lines (137 loc) · 4.2 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
BasedOnStyle: WebKit
# 访问说明符的偏移(public private)
AccessModifierOffset: -4
# 括号之后,水平对齐参数: Align DontAlign AlwaysBreak。
AlignAfterOpenBracket: Align
#AlignConsecutiveBitFields: false
# 连续的赋值时,对齐所有的等号
AlignConsecutiveAssignments: false
# 连续声明时,对齐所有声明的变量名
AlignConsecutiveDeclarations: false
#AlignConsecutiveMacros: false
AlignEscapedNewlines: DontAlign
# 水平对齐二元和三元表达式的操作数
AlignOperands: true
# 对齐连续的尾随的注释
AlignTrailingComments: false
#AllowAllArgumentsOnNextLine: false
#AllowAllConstructorInitializersOnNextLine: false
# 允许函数声明的所有参数在放在下一行
AllowAllParametersOfDeclarationOnNextLine: false
# 允许短的块放在同一行
AllowShortBlocksOnASingleLine: true
# 允许短的case标签放在同一行
AllowShortCaseLabelsOnASingleLine: false
#AllowShortEnumsOnASingleLine: false
# 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All
AllowShortFunctionsOnASingleLine: InlineOnly
# 是否允许短if单行 If true, if (a) return; 可以放到同一行
AllowShortIfStatementsOnASingleLine: false
#AllowShortLambdasOnASingleLine: Inline
# 允许短的循环保持在同一行
AllowShortLoopsOnASingleLine: false
# 总是在定义返回类型后换行(deprecated)
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
BraceWrapping:
# AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
# BeforeLambdaBody: false
# BeforeWhile: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
#在构造函数初始化时按逗号断行,并以冒号对齐
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
# 每行字符的限制,0表示没有限制
ColumnLimit: 120
# 描述具有特殊意义的注释的正则表达式,它不应该被分割为多行或以其它方式改变
# CommentPragmas: '^ IWYU pragma:'
# 语言: None Cpp Java Objc Protp
CompactNamespaces: false
Cpp11BracedListStyle: true
#DeriveLineEnding: \n
DerivePointerAlignment: false
FixNamespaceComments: true
ForEachMacros: [ "foreach", "Q_FOREACH" ]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"'
Priority: 1
- Regex: '^["<]D'
Priority: 2
- Regex: '^<Q'
Priority: 3
- Regex: '^<'
Priority: 4
- Regex: '\.h>$'
Priority: 5
- Regex: '^"moc_'
Priority: 99
- Regex: '\.moc"'
Priority: 99
# 缩进case 标签
IndentCaseLabels: false
#IndentExternBlock: NoIndent
#IndentCaseBlocks: false
#IndentGotoLabels: false
IndentPPDirectives: None
#缩进宽度
IndentWidth: 4
IndentWrappedFunctionNames: false
#InsertTrailingCommas: None
#在block从空行开始
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
# 连续的空行保留几行
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
#指针的*的挨着哪边
PointerAlignment: Right
# 允许排序#include, 造成编译错误
SortIncludes: false
SortUsingDeclarations: false
#括号后添加空格
SpaceAfterCStyleCast: false
#SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
#等号两边的空格
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
#SpaceBeforeSquareBrackets: false
#SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
#SpacesInConditionalStatement: false
# 容器类的空格 例如 OC的字典
SpacesInContainerLiterals: false
# 小括号两边添加空格
SpacesInParentheses: false
# 中括号两边空格 []
SpacesInSquareBrackets: false
#StatementMacros: ["Q_UNUSED"]
#tab键盘的宽度
TabWidth: 4
UseTab: Never