Language: Cpp
# BasedOnStyle: Google
# 访问说明符(public、private等)的偏移(缩进或者对齐)
AccessModifierOffset: -4
# 开括号(括号、开尖括号、开方括号)后的对齐: Align, DontAlign, AlwaysBreak(总是在开括号后换
AlignAfterOpenBracket: Align
# 连续赋值时,对齐所有等号
AlignConsecutiveAssignments: true
# 连续声明对齐
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
#int aaa = bbbbbbbbbbbbbbb +
# ccccccccccccccc;
AlignOperands: true
# 对齐尾部注释
AlignTrailingComments: true
# 允许声明的参数在下一行上
AllowAllParametersOfDeclarationOnNextLine: true
# 允许短语法块在单行上
AllowShortBlocksOnASingleLine: false
#
AllowShortCaseLabelsOnASingleLine: false
# 允许短函数在单行上 None,InlineOnly,Empty,Inline,ALL
AllowShortFunctionsOnASingleLine: Inline
# 允许 if 块在单行上
AllowShortIfStatementsOnASingleLine: false
# 允许合并短循环到单行上
AllowShortLoopsOnASingleLine: false
#A lwaysBreakAfterDefinitionReturnType 函数定义返回类型换行风格该选项已经弃用
AlwaysBreakAfterDefinitionReturnType: None
# 函数声明的返回类型换行风格
AlwaysBreakAfterReturnType: None
# 多行字符串断行
AlwaysBreakBeforeMultilineStrings: true
# 模板声明断行
AlwaysBreakTemplateDeclarations: true
#如果为false,函数调用变量要么都在同一行上,要么每个变量都独自在一行。
#如果true,则会把变量合理打包放在一行上,显得更紧凑。
BinPackArguments: true
#如果false,函数声明的参数或者函数定义的参数要么在同一行上,要么每个变量都独自在一行。
#如果true,则会把变量合理打包放在一行上,显得更紧凑
BinPackParameters: true
# {}风格
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
# 二元操作符断行
BreakBeforeBinaryOperators: None
# 大括号断行风格
BreakBeforeBraces: Attach
# 元操作符断行规则
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
#列数显示
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
# 构造初始化断行风格 选项已弃用
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# 构造初始化缩进宽度
ConstructorInitializerIndentWidth: 4
# 延续下一行的缩进宽度,只原来一行放不下时,换行后,新行缩进的字符数。
ContinuationIndentWidth: 4
#括号列表中没有空格。
#在结束大括号前不能换行。
#用连续缩进,而不是用块缩进。
Cpp11BracedListStyle: true
# 提取指针对齐
DerivePointerAlignment: true
# 禁用格式化
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
# case 缩进宽度
IndentCaseLabels: true
# 缩进宽度
IndentWidth: 4
# 函数名缩进
IndentWrappedFunctionNames: false
# 在语法块开始留空行
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
# 最大空行数
MaxEmptyLinesToKeep: 1
# namespace 缩进
NamespaceIndentation: None
# ObjC块缩进
ObjCBlockIndentWidth: 2
# 属性修饰符空格
ObjCSpaceAfterProperty: false
# 协议列表前空白
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
# int *p
PointerAlignment: Right
# 重排版注释
ReflowComments: true
# include 排序
SortIncludes: Never
# (int) i; i之前的空格
SpaceAfterCStyleCast: false
# 赋值操作符空格
SpaceBeforeAssignmentOperators: true
# 圆括号空格
SpaceBeforeParens: ControlStatements
# 圆括号之间的空格
SpaceInEmptyParentheses: false
# 尾部注释之前的空格
SpacesBeforeTrailingComments: 2
# <>角括号空白
SpacesInAngles: false
# 容器中空格
SpacesInContainerLiterals: true
# x = (int32)y // x = ( int32 )y
SpacesInCStyleCastParentheses: false
# 圆括号中的空格
SpacesInParentheses: false
# 方括号中的空格
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
qtcreator clang-format格式
于 2023-03-12 13:56:46 首次发布