9 changed files with 634 additions and 681 deletions
@ -1,409 +1,362 @@ |
|||||
--- |
--- |
||||
|
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html |
||||
|
|
||||
|
BasedOnStyle: LLVM |
||||
Language: Cpp |
Language: Cpp |
||||
|
|
||||
# 基于的编码规范, 可选: |
# this style configuration is based on google style configuration. |
||||
# - LLVM: https://llvm.org/docs/CodingStandards.html |
# The following configuration is different from the basic configuration. |
||||
# - Google: https://google.github.io/styleguide/cppguide.html |
|
||||
# - Chromium: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md |
# 缩进宽度 |
||||
# - Mozilla: https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html |
IndentWidth: 4 |
||||
# - WebKit: https://www.webkit.org/coding/coding-style.html |
|
||||
# - Microsoft: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference |
# 访问权限说明符(public/private等)的偏移 |
||||
# - GNU: https://www.gnu.org/prep/standards/standards.html |
|
||||
# - InheritParentConfig: 继承父目录的编码规范, 如果有的话, 不是一个真正的编码规范 |
|
||||
# - None: 不使用, 即自动配置, 也就是本文件中的自定义内容 |
|
||||
# BasedOnStyle: LLVM |
|
||||
|
|
||||
#访问声明符缩进 |
|
||||
AccessModifierOffset: -4 |
AccessModifierOffset: -4 |
||||
# 开括号后的对齐(包括小括号/大括号/尖括号), 建议使用Align |
|
||||
# - Align: 对于开括号, 即在换行情况下, 换行的参数跟开括号对齐, 建议使用 |
# # 开括号(开圆括号、尖括号、方括号)后的对齐: Align, DontAlign, AlwaysBreak(总是在开括号后换行) |
||||
# - DontAlign: 不对于开括号, 即换行时使用配置的空格数 |
# AlignAfterOpenBracket: Align |
||||
# - AlwaysBreak: 永远换行, 即第一个参数都不允许粘连括号, 会强制换行, 换行后使用配置空格数对齐 |
|
||||
# - BlockIndent: 同AlwaysBreak, 多了一个操作: 如果参数不固定在同一行, 闭括号将在下一行 |
# # 连续赋值时,对齐所有等号 |
||||
AlignAfterOpenBracket: Align |
# AlignConsecutiveAssignments: false |
||||
|
|
||||
# - 结构休数组统一初始化对齐, 建议不配置, 没过多必要, 详见clang-format doc |
# # 连续声明时,对齐所有声明的变量名 |
||||
# - None: 不做处理, 即保留开发者的代码 |
# AlignConsecutiveDeclarations: false |
||||
# - Left: 左对齐 |
|
||||
# - Right: 右对齐 |
# 反斜杆换行的对齐方式 |
||||
AlignArrayOfStructures: None |
# -- DontAlign - 不进行对齐 |
||||
|
# -- Left - 反斜杠靠左对齐 |
||||
# 连续赋值语句的对齐,即多个赋值语句连续出现时的对齐策略配置, 包含多个子配置项 |
# -- Right - 反斜杠靠右对齐 |
||||
AlignConsecutiveAssignments: |
# AlignEscapedNewlines: Right |
||||
# 是否启用, 建议不启用 |
|
||||
Enabled: false |
# 二元、三元表达式的对齐方式(当表达式需要占用多行时) |
||||
# 是否跨过空行, 即多个对齐语句中间有空行时, 是否跨过, 如果要开启连续赋值语句的配置, 建议为false |
# -- DontAlign - 不进行对齐 |
||||
AcrossEmptyLines: false |
# -- Align - 从操作符开始对齐 |
||||
# 同AcrossComments: 即是否跨过注释, 建议false |
# -- AlignAfterOperator - 从操作数开始对齐 |
||||
AcrossComments: false |
AlignOperands: true |
||||
# 是否跨过复合语句(包括空行及注释), 建议False |
|
||||
AlignCompound: false |
# # 是否对齐行尾注释 |
||||
# 是否(右)对齐赋值操作的操作符, 建议true |
# AlignTrailingComments: true |
||||
PadOperators: true |
|
||||
|
# # 函数声明的所有参数在放在下一行 |
||||
# 同AlignConsecutiveAssignments, 表示连续位定义语句出现时, 是否需要对齐:符号, 位变量定义用得少, 可以不开启 |
# AllowAllParametersOfDeclarationOnNextLine: false |
||||
AlignConsecutiveBitFields: |
|
||||
# 是否启用, 建议不启用 |
# # 是否允许短的代码块放在同一行 |
||||
Enabled: false |
# AllowShortBlocksOnASingleLine: false |
||||
# 同AlignConsecutiveAssignments |
|
||||
AcrossEmptyLines: false |
# # 短的case标签和语句放在同一行 |
||||
# 同AlignConsecutiveAssignments |
# AllowShortCaseLabelsOnASingleLine: true |
||||
AcrossComments: false |
|
||||
# 只在AlignConsecutiveAssignments配置中有效, 自动生成的clang-format有此项, 忽略 |
# # 短的函数放在同一行 |
||||
AlignCompound: false |
# -- None - 不把短的函数放在同一行 |
||||
# 只在AlignConsecutiveAssignments配置中有效, 自动生成的clang-format有此项, 忽略 |
# -- InlineOnly - 只把类内的内联函数放在同一行,全局的空函数不放在同一行 |
||||
PadOperators: false |
# -- Empty - 只把空的函数放在同一行 |
||||
|
# -- Inline - 把类内的内联函数放在同一行,全局的空函数不放在同一行 |
||||
# 是否对齐连续声明, 同AlignConsecutiveDeclarations |
# -- All - 都允许放在同一行 |
||||
AlignConsecutiveDeclarations: |
AllowShortFunctionsOnASingleLine: InlineOnly |
||||
Enabled: false |
|
||||
AcrossEmptyLines: false |
# # 短的if语句保持在同一行 |
||||
AcrossComments: false |
# AllowShortIfStatementsOnASingleLine: true |
||||
AlignCompound: false |
|
||||
PadOperators: false |
# # 短的循环保持在同一行 |
||||
AlignConsecutiveMacros: |
# AllowShortLoopsOnASingleLine: true |
||||
Enabled: false |
|
||||
AcrossEmptyLines: false |
# # 总是在返回类型后换行: None, All, TopLevel(顶级函数,不包括在类中的函数), |
||||
AcrossComments: false |
# # AllDefinitions(所有的定义,不包括声明), TopLevelDefinitions(所有的顶级函数的定义) |
||||
# 只在AlignConsecutiveAssignments配置中有效, 自动生成的clang-format有此项, 忽略 |
# AlwaysBreakAfterReturnType: None |
||||
AlignCompound: false |
|
||||
# 只在AlignConsecutiveAssignments配置中有效, 自动生成的clang-format有此项, 忽略 |
# # 总是在多行string字面量前换行 |
||||
PadOperators: false |
# AlwaysBreakBeforeMultilineStrings: true |
||||
|
|
||||
# 续行符(\\)对齐: |
# # 总是在template声明后换行 |
||||
# - DontAlign: 不做操作 |
AlwaysBreakTemplateDeclarations: true |
||||
# - Left: 尽可能向左对齐, 即最长一行代码为准 |
|
||||
# - Right: 跟开发都写的最远的\\对齐(即不会自动缩减你的空格), 建议使用这个 |
# # 函数调用时,参数的放置规则 |
||||
AlignEscapedNewlines: Right |
# -- false - 参数要么放在同一行,要么每个参数占用一行 |
||||
|
# -- true - 不做强制要求 |
||||
# 在二元/一元表达式中的操作数对齐, 可选值: |
# BinPackArguments: true |
||||
# - DontAlign: 不做对齐, 在操作数换行后, 将使用ContinuationIndentWidth来对齐 |
|
||||
# - Align: 即换行时, 操作数(or 操作符加操作数)跟上一行的第一个操作数左对齐, 具体操作符要不要换行, 由BreakBeforeBinaryOperators配置决定 |
# 函数声明、定义时,参数的放置规则 |
||||
AlignOperands: Align |
# -- false - 参数要么放在同一行,要么每个参数占用一行 |
||||
AlignTrailingComments: true |
# -- true - 不做强制要求 |
||||
AllowAllArgumentsOnNextLine: true |
# BinPackParameters: true |
||||
AllowAllParametersOfDeclarationOnNextLine: true |
|
||||
AllowShortEnumsOnASingleLine: true |
# 大括号放置风格 |
||||
AllowShortBlocksOnASingleLine: Never |
# -- Attach - 大括号紧随前方内容,放在同一行 |
||||
AllowShortCaseLabelsOnASingleLine: false |
# -- Linux - 与 Attach 类似,除了 函数、命名空间、类定义 的大括号放在下一行 |
||||
# 允许短的函数放在同一行, 可选值: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All |
# -- Mozilla - 与 Attach 类似,除了枚举、函数、结构(class\struct\union)的大括号放在下一行 |
||||
AllowShortFunctionsOnASingleLine: All |
# -- Stroustrup - 与 Attach 类似,但函数定义前、catch前方、else前方的"{}"放在单独一行 |
||||
# 允许lambda在一行中, 同上, 建议All |
# -- Allman - 总是换行 |
||||
AllowShortLambdasOnASingleLine: All |
# -- Whitesmiths - 类似 Allman,但"{}"和内部的语句对齐到同样位置 |
||||
# 是否将简单的if(else/else if)语句中的body跟if(else/else if)放置于同一行,可选值 |
# -- GNU - 总是换行,但在控制语句后的"{}"总是对齐到下一个位置 |
||||
# - Never: 永远不, 建议值 |
# -- WebKit - 与 Attach 类似,但在函数定义前换行 |
||||
# - WithoutElse: 没有else/else if时, 允许 |
# -- Custom - 依赖 BraceWrapping |
||||
# - OnlyFirstIf: 只有第一个if允许 |
# 注:这里认为语句块也属于函数 |
||||
# - AllIfAndElse: 所有的if/else都允许 |
BreakBeforeBraces: Attach |
||||
AllowShortIfStatementsOnASingleLine: Never |
|
||||
# 是否允许loop语句体跟loop语句共行, true/false, 建议false |
# 大括号换行,只有当BreakBeforeBraces设置为Custom时才有效 |
||||
AllowShortLoopsOnASingleLine: false |
|
||||
# Deprecated, 废弃定义, 设置为None即可 |
|
||||
AlwaysBreakAfterDefinitionReturnType: None |
|
||||
# Return类型后是否换行, 诡异的定义, 请设置为None即可 |
|
||||
AlwaysBreakAfterReturnType: None |
|
||||
# 多常量字符串定义是, 是否在第一个字符串常量前换行, true/false, 建议false |
|
||||
AlwaysBreakBeforeMultilineStrings: false |
|
||||
# 模板声明换行风格, 可选值: |
|
||||
# - No: 永远不对开发者的风格作处理 |
|
||||
# - MultiLine: 建议值, 即仅在开发者写的模板声明(包括函数)跨越多行时, 进行换行, 否则维持原样 |
|
||||
# - Yes: 不管如何都进行分行, 不建议 |
|
||||
AlwaysBreakTemplateDeclarations: MultiLine |
|
||||
# 属性宏列表, 自定义, 用于语言扩展或静态分析注解, 可忽略 |
|
||||
AttributeMacros: |
|
||||
- __capability |
|
||||
# 函数调用时的参数(Arguments)是否放置于一行, false不放置, true强制一个调用参数一行, 建议false |
|
||||
BinPackArguments: false |
|
||||
# 函数定义参数(Parameters)是否放置于一行, 同BinPackArguments |
|
||||
BinPackParameters: false |
|
||||
|
|
||||
# 大括号换行 |
|
||||
BraceWrapping: |
BraceWrapping: |
||||
# 在case后的大括号是否换行 |
# class定义后面 |
||||
AfterCaseLabel: true |
AfterClass: false |
||||
# class后 |
# 控制语句后面 |
||||
AfterClass: true |
AfterControlStatement: false |
||||
# 控制语句(if/for/while/switch/...)后是否换行 |
# enum定义后面 |
||||
# - Never: 永远不, 即永远将语句体的大括号放置于控制语句同一行 |
AfterEnum: false |
||||
# - MultiLine: 多行控制语句才进行换行 |
# 函数定义后面 |
||||
# - Always: 永远换行, 建议 |
|
||||
AfterControlStatement: Always |
|
||||
# 下面比较容易理解, 不再作无意义的解释 |
|
||||
AfterEnum: true |
|
||||
AfterFunction: true |
AfterFunction: true |
||||
|
# 命名空间定义后面 |
||||
AfterNamespace: true |
AfterNamespace: true |
||||
AfterObjCDeclaration: true |
# ObjC定义后面 |
||||
AfterStruct: true |
AfterObjCDeclaration: false |
||||
AfterUnion: true |
# struct定义后面 |
||||
|
AfterStruct: false |
||||
|
# union定义后面 |
||||
|
AfterUnion: false |
||||
|
# extern之后 |
||||
AfterExternBlock: true |
AfterExternBlock: true |
||||
|
# catch之前 |
||||
BeforeCatch: false |
BeforeCatch: false |
||||
BeforeElse: true |
# else之前 |
||||
BeforeLambdaBody: false |
BeforeElse: false |
||||
BeforeWhile: false |
# 继续缩进大括号 |
||||
IndentBraces: false |
IndentBraces: false |
||||
|
# 分离空函数 |
||||
|
# # 当空白函数的"{}"和函数名称不需要放在同一行时,是否拆分函数体 |
||||
SplitEmptyFunction: true |
SplitEmptyFunction: true |
||||
|
# 分离空语句 |
||||
|
# # 当空白结构(class\struct\union)的"{}"需要放在单独的行时,是否拆分"{}" |
||||
SplitEmptyRecord: true |
SplitEmptyRecord: true |
||||
|
# 分离空命名空间 |
||||
|
# # 当空白的命名空间的"{}"需要放在单独的行时,是否拆分"{}" |
||||
SplitEmptyNamespace: true |
SplitEmptyNamespace: true |
||||
# 二元操作符前是否换行, 建议为None |
|
||||
BreakBeforeBinaryOperators: None |
# # 在二元运算符前换行: None(在操作符后换行), NonAssignment(在非赋值的操作符前换行), All(在操作符前换行) |
||||
# 概念声明前是否换行, 建议Always |
BreakBeforeBinaryOperators: NonAssignment |
||||
BreakBeforeConceptDeclarations: Always |
|
||||
# 大括号换行风格,Custom即可, 具体值可参考上方文档 |
# BreakBeforeInheritanceComma: false |
||||
BreakBeforeBraces: Custom |
|
||||
# 继承列表括号前换行, false即可 |
# # 在三元运算符前换行 |
||||
BreakBeforeInheritanceComma: false |
# 当三元表达式不能放在同一行时,是否在三元操作符前方换行 |
||||
# 是否将整个继承列表换行 |
# -- true - 操作符位于新行的首部 |
||||
BreakInheritanceList: BeforeColon |
# -- false - 操作符位于上一行的尾部 |
||||
BreakBeforeTernaryOperators: true |
BreakBeforeTernaryOperators: true |
||||
# 是否在构造函数初始化列表的,前换行 |
|
||||
BreakConstructorInitializersBeforeComma: false |
# BreakConstructorInitializersBeforeComma: false |
||||
# 继承列表换行风格, 使用BeforeComma适合 |
|
||||
BreakConstructorInitializers: BeforeComma |
# # 构造函数初始化列表分割方式 |
||||
# Java注解相关, 跳过 |
# -- BeforeColon - 在冒号 ':' 前方分割,冒号位于行首,逗号','位于行尾 |
||||
BreakAfterJavaFieldAnnotations: false |
# -- BeforeComma - 在冒号和逗号前方分割,冒号和逗号都位于行首,并且对齐 |
||||
# 字面字符串是否换行, true |
# -- AfterColon - 在冒号和逗号后方分割,冒号和逗号位于行尾 |
||||
BreakStringLiterals: true |
BreakConstructorInitializers: BeforeColon |
||||
# 代码列字符上限 |
|
||||
ColumnLimit: 120 |
# # 是否在每个java注解后方换行 |
||||
# pragma注释 |
# BreakAfterJavaFieldAnnotations: false |
||||
CommentPragmas: '^ IWYU pragma:' |
|
||||
# 注释关键字对齐(const/volatile), 建议Leave |
# # 是否分割过长的字符串 |
||||
# - Leave: - 不改变开发者定义 |
# BreakStringLiterals: false |
||||
# - Left: 位于类型前 |
|
||||
# - Right: 位于类型后 |
# # 每行字符长度的限制,0表示没有限制 |
||||
# - Custom: 自定义 |
ColumnLimit: 100 |
||||
QualifierAlignment: Leave |
|
||||
# 未在文档中找到 |
# # 用于匹配注释信息的正则表达式,被匹配的行不会做任何修改 |
||||
|
# CommentPragmas: '^ IWYU pragma:' |
||||
|
# 是否压缩紧接的命名空间 |
||||
|
# -- true - 将紧跟的命名空间放在同一行 |
||||
|
# -- false - 每个命名空间位于新的一行 |
||||
CompactNamespaces: false |
CompactNamespaces: false |
||||
# 构造函数初始化列表缩进, 建议0 |
|
||||
ConstructorInitializerIndentWidth: 0 |
# # 构造函数的初始化列表要么都在同一行,要么都各自一行 |
||||
# 函数调用续行对齐, 建议4 |
# -- true - 如果可能,初始化列表放在同一行;如果不满足长度选择,则每个单独放一行 |
||||
|
# -- false - 初始化列表可以随意放置 |
||||
|
# ConstructorInitializerAllOnOneLineOrOnePerLine: false |
||||
|
|
||||
|
# # 构造函数的初始化列表和基类集成列表的对齐宽度 |
||||
|
ConstructorInitializerIndentWidth: 4 |
||||
|
|
||||
|
# # 延续语句的对齐宽度 |
||||
ContinuationIndentWidth: 4 |
ContinuationIndentWidth: 4 |
||||
# C++11的统一初始化列表大括号风格, 建议true |
|
||||
|
# # 去除C++11的列表初始化的大括号{后和}前的空格 |
||||
Cpp11BracedListStyle: true |
Cpp11BracedListStyle: true |
||||
# 提取行结束符并标准化, 建议false, 不要进行分析及自动运用, 而是强制使用UseCRLF设定来做 |
|
||||
DeriveLineEnding: true |
# 是否自动分析指针的对齐方式 |
||||
# 是否开启文件分析, 根据文件中的*/&使用情况更新clang-format设定, 在无法决定时, 使用PointerAlignment代替, 不建议开启 |
# -- true - 自动分析并使用指针的对齐方式,若无法分析,则使用 PointerAlignment |
||||
DerivePointerAlignment: false |
# -- false - 不自动分析 |
||||
|
# DerivePointerAlignment: true |
||||
|
|
||||
|
# 是否禁用格式化 |
||||
DisableFormat: false |
DisableFormat: false |
||||
# 访问限定后是否添加空行, 建议Never |
# ExperimentalAutoDetectBinPacking: false |
||||
EmptyLineAfterAccessModifier: Never |
|
||||
# 访问限定前是否要求空行, 建议LogicalBlock |
# 是否自动修正命名空间的结束注释 |
||||
EmptyLineBeforeAccessModifier: LogicalBlock |
# -- true - 在短的命名空间尾部,自动添加或修改错误的命名空间结束注释 |
||||
# 实验性的自动检测同行并进行操作, 建议false |
# -- false - 不自动修正 |
||||
ExperimentalAutoDetectBinPacking: false |
|
||||
# 是否打包构造函数初始化列表, 建议Never, 可选: |
|
||||
# - Never: 永远不做操作, 即一个参数一行 |
|
||||
# - BinPack: 两个参数一行 |
|
||||
# - CurrentLine: 所有参数放置于一行, 如果放不下, 就一个参数一行 |
|
||||
# - NextLine: 同CurrentLine有点像, 唯一不同就是如果放不行, 将剩余参数放置于下一行(即不自动一参一行) |
|
||||
PackConstructorInitializers: Never |
|
||||
BasedOnStyle: '' |
|
||||
# 废弃配置 |
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false |
|
||||
# 废弃配置 |
|
||||
AllowAllConstructorInitializersOnNextLine: true |
|
||||
# 是否强制在namespace结尾增加 // namespace xxx, 建议为true |
|
||||
FixNamespaceComments: true |
FixNamespaceComments: true |
||||
# 大于多少行namespace内的代码行时才在namespace结尾添加 // namespace xxx, 建议0,即无论如何都添加 |
|
||||
ShortNamespaceLines: 0 |
# foreach 循环 |
||||
# Macro宏 |
|
||||
ForEachMacros: |
ForEachMacros: |
||||
- foreach |
- foreach |
||||
- Q_FOREACH |
- Q_FOREACH |
||||
- BOOST_FOREACH |
- BOOST_FOREACH |
||||
#If宏 |
|
||||
IfMacros: |
# 多个 include 块(有空行分隔的include)排序时的分组规则 |
||||
- KJ_IF_MAYBE |
# -- Preserve - 保留原有的块分隔,各自排序 |
||||
# include代码块操作, 前提是SortIncludes开启: |
# -- Merge - 将所有的块视为同一个,然后进行排序 |
||||
# - Preserve: 只对每个代码块排序 |
# -- Regroup - 将所有的块视为同一个进行排序,然后按照 IncludeCategories 的规则进行分组 |
||||
# - Merge: 对所有代码块合并, 并在合并后排序 |
|
||||
# - Regroup: 对所有include块进行分析, 并重新分块, 不建议! |
|
||||
IncludeBlocks: Preserve |
IncludeBlocks: Preserve |
||||
# Include Sort选项, 可选: |
|
||||
# - Never: 永远不, 建议 |
# IncludeCategories: |
||||
# - CaseSensitive: 大小写敏感排序 |
# - Regex: '^<ext/.*\.h>' |
||||
# - CaseInsensitive: 大小写不敏感排序 |
# Priority: 2 |
||||
SortIncludes: Never |
# - Regex: '^<.*\.h>' |
||||
# Include种类, 默认即可 |
# Priority: 1 |
||||
IncludeCategories: |
# - Regex: '^<.*' |
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' |
# Priority: 2 |
||||
Priority: 2 |
# - Regex: '.*' |
||||
SortPriority: 0 |
# Priority: 3 |
||||
CaseSensitive: false |
# IncludeIsMainRegex: '([-_](test|unittest))?$' |
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)' |
|
||||
Priority: 3 |
# # 缩进case标签 |
||||
SortPriority: 0 |
# -- true - case 不与 switch 对齐 |
||||
CaseSensitive: false |
# -- false - case 和 switch 对齐 |
||||
- Regex: '.*' |
IndentCaseLabels: true |
||||
Priority: 1 |
|
||||
SortPriority: 0 |
# 预处理命令(#if\#ifdef\#endif等)的缩进规则 |
||||
CaseSensitive: false |
# -- None - 不进行缩进 |
||||
IncludeIsMainRegex: '(Test)?$' |
# -- AfterHash - 在前导'#'后缩进,'#'放在最左侧,之后的语句参与缩进 |
||||
IncludeIsMainSourceRegex: '' |
# -- BeforeHash - 在前导'#'前进行缩进 |
||||
# 缩进访问控制 |
IndentPPDirectives: AfterHash |
||||
IndentAccessModifiers: false |
|
||||
# 缩进case语句, 建议false |
# # 函数返回类型换行时,缩进函数声明或函数定义的函数名 |
||||
IndentCaseLabels: false |
# IndentWrappedFunctionNames: false |
||||
# 缩进case body, 建议true |
|
||||
IndentCaseBlocks: true |
# JavaScript 中的字符串引号规则 |
||||
# 缩进goto标签 |
# -- Leave - 保持原样 |
||||
IndentGotoLabels: true |
# -- Single - 全部使用单引号 |
||||
# 预处理指示(PPD-PreProcessor Directive)缩进, 建议None |
# -- Double - 全部使用双引号 |
||||
# - None: 不缩进 |
|
||||
# - AfterHash: #不缩进, #后面的指示缩进 |
|
||||
# - BeforeHash: #跟前缩进 |
|
||||
IndentPPDirectives: None |
|
||||
# extern "C"缩进, 建议AfterExternBlock |
|
||||
IndentExternBlock: AfterExternBlock |
|
||||
# 模板require是否缩进 |
|
||||
IndentRequiresClause: true |
|
||||
# 缩进宽度 |
|
||||
IndentWidth: 4 |
|
||||
# 函数名换行时, 是否缩进(即返回值跟名字不同行时), 建议false |
|
||||
IndentWrappedFunctionNames: false |
|
||||
# 是否在代码块中(if/else/for/do/while)强制插入大括号, 建议false |
|
||||
InsertBraces: false |
|
||||
# 是否强制插入拖尾的',', 建议为None |
|
||||
InsertTrailingCommas: None |
|
||||
# Java相关, 跳过 |
|
||||
JavaScriptQuotes: Leave |
JavaScriptQuotes: Leave |
||||
JavaScriptWrapImports: true |
|
||||
# 是否block开始前有一个empty line, 诡异, 直接false |
# 是否在 JavaScript 的 import/export 语句后换行 |
||||
KeepEmptyLinesAtTheStartOfBlocks: false |
# JavaScriptWrapImports: true |
||||
# 未找到定义 |
|
||||
LambdaBodyIndentation: Signature |
# # 保留在块开始处的空行 |
||||
# 宏开始的正则, 不使用 |
# -- true - 保留块起始的空行 |
||||
MacroBlockBegin: '' |
# -- false - 删除块起始的空行 |
||||
# 宏结束的正则, 不使用 |
KeepEmptyLinesAtTheStartOfBlocks: true |
||||
MacroBlockEnd: '' |
|
||||
# 空行保持, 建议为1 |
# 用于识别宏定义型块起始的正则表达式 |
||||
|
# MacroBlockBegin: '' |
||||
|
|
||||
|
# 用于识别宏定义型块结束的正则表达式 |
||||
|
# MacroBlockEnd: '' |
||||
|
|
||||
|
# # 连续空行的最大数量 |
||||
MaxEmptyLinesToKeep: 1 |
MaxEmptyLinesToKeep: 1 |
||||
# Namespace内的对齐, 直接使用None即可, 即所有namespace内(包括内嵌的)都不indent |
|
||||
NamespaceIndentation: None |
# # 命名空间内部的缩进规则 |
||||
# Obj-C语言设置, 跳过 |
# -- None - 都不缩进 |
||||
ObjCBinPackProtocolList: Auto |
# -- Inner - 只缩进嵌套的命名空间内容 |
||||
ObjCBlockIndentWidth: 4 |
# -- All - 缩进所有命名空间内容 |
||||
ObjCBreakBeforeNestedBlockParam: true |
NamespaceIndentation: Inner |
||||
ObjCSpaceAfterProperty: false |
|
||||
ObjCSpaceBeforeProtocolList: true |
# Objective-C 相关配置 |
||||
# 罚分设定(根据你的"违规"值选择罚分少的) |
# ObjCBlockIndentWidth: 2 |
||||
PenaltyBreakAssignment: 2 |
# ObjCSpaceAfterProperty: false |
||||
PenaltyBreakBeforeFirstCallParameter: 19 |
# ObjCSpaceBeforeProtocolList: false |
||||
PenaltyBreakComment: 300 |
# PenaltyBreakAssignment: 2 |
||||
PenaltyBreakFirstLessLess: 120 |
# PenaltyBreakBeforeFirstCallParameter: 1 |
||||
PenaltyBreakOpenParenthesis: 0 |
# PenaltyBreakComment: 300 |
||||
PenaltyBreakString: 1000 |
# PenaltyBreakFirstLessLess: 120 |
||||
PenaltyBreakTemplateDeclaration: 10 |
# PenaltyBreakString: 1000 |
||||
PenaltyExcessCharacter: 1000000 |
# PenaltyExcessCharacter: 1000000 |
||||
PenaltyReturnTypeOnItsOwnLine: 60 |
# PenaltyReturnTypeOnItsOwnLine: 200 |
||||
PenaltyIndentedWhitespace: 0 |
|
||||
# 指针对齐, 建议Right |
# # 指针和引用(*和&)的对齐规则 |
||||
|
# -- Left - * 靠近左侧 |
||||
|
# -- Right - * 靠近右侧 |
||||
|
# -- Middle - * 放在中间 |
||||
|
# NOTE : 在 SpaceAroundPointerQualifiers 为 Default, |
||||
|
# 且 DerivePointerAlignment 失效后启用 |
||||
PointerAlignment: Right |
PointerAlignment: Right |
||||
# 引用对齐, 可选: |
|
||||
# - Pointer: 使用'PointerAlignment'配置, 建议使用 |
# RawStringFormats: |
||||
# - Left: Left |
# - Delimiter: pb |
||||
# - Right: Right |
# Language: TextProto |
||||
ReferenceAlignment: Pointer |
# BasedOnStyle: google |
||||
# 预处理对齐宽度 |
|
||||
PPIndentWidth: -1 |
# # 重新排版注释 |
||||
# 是否允许clang-format尝试重新粘合注释(true/false), 不建议使用 |
|
||||
ReflowComments: false |
ReflowComments: false |
||||
# 是否移除多余的{}, 不建议 |
|
||||
RemoveBracesLLVM: false |
# # 重新排序#include |
||||
# 模板中的require语句位置, 建议OwnLine |
# -- Never - 不进行排序 |
||||
RequiresClausePosition: OwnLine |
# -- CaseSensitive - 排序时大小写敏感 |
||||
# 分隔不同定义块, 建议Always, 可选: |
# -- CaseInsensitive - 排序时大小写不敏感 |
||||
# - Leave - 不处理, 建议, 即由业务决定, 也可以使用Always |
SortIncludes: false |
||||
# - Always - 永远进行分隔 |
|
||||
# - Never: 永远 不进行, 不建议 |
# java 中静态 import 的排序规则 |
||||
SeparateDefinitionBlocks: Leave |
# -- Before - 静态放在非静态前方 |
||||
# Java项, 跳过 |
# -- After - 静态放在非静态后方 |
||||
SortJavaStaticImport: Before |
# SortJavaStaticImport: Before |
||||
# 排序using语句(true/false), 不建议开启 |
|
||||
|
# # 重新排序using声明 |
||||
SortUsingDeclarations: false |
SortUsingDeclarations: false |
||||
# C风格cast的类型括号后面是否增加space(true/false), 比较诡异, 建议false |
|
||||
|
# # 在C风格类型转换后添加空格 |
||||
SpaceAfterCStyleCast: false |
SpaceAfterCStyleCast: false |
||||
# 逻辑非操作(!)后面是否加space(true/false), 比较诡异, 建议false |
|
||||
SpaceAfterLogicalNot: false |
# # 在Template关键字后面添加空格 |
||||
# template关键字后面是否加space(true/false), 建议true, 即template <xxx>, 而不是template<xxx> |
|
||||
SpaceAfterTemplateKeyword: true |
SpaceAfterTemplateKeyword: true |
||||
# 赋值语句操作符前是否添加space(true/false), 建议true |
|
||||
|
# # 在赋值运算符之前添加空格 |
||||
SpaceBeforeAssignmentOperators: true |
SpaceBeforeAssignmentOperators: true |
||||
# case语句:前是否增加space(true/false), 建议false |
|
||||
SpaceBeforeCaseColon: false |
# # 在 C++11 的初始化列表前加空格 |
||||
# c++11的统一初始化列表的大括号中是否添加space(true/false), 建议false |
# SpaceBeforeCpp11BracedList: true |
||||
SpaceBeforeCpp11BracedList: false |
|
||||
# 构造函数初始化列表:前是否加space(true/false), 建议false |
# 在构造函数的初始化冒号":"前加空格 |
||||
SpaceBeforeCtorInitializerColon: false |
# SpaceBeforeCtorInitializerColon: true |
||||
# 继承列表的:前是否加space(true/false), 建议true |
|
||||
SpaceBeforeInheritanceColon: true |
# 在构造函数的继承冒号":"前加空格 |
||||
# 圆括号前是否增加空格: 建议只在控制语句的贺括号前增加, 即配置为ControlStatements即可 |
# SpaceBeforeInheritanceColon: true |
||||
|
|
||||
|
# 小括号"()"前加空格的规则 |
||||
|
# -- Never - 从不加空格 |
||||
|
# -- ControlStatements - 只在控制语句(for/if/while...)时加空格 |
||||
|
# -- ControlStatementsExceptForEachMacros - 类型 ControlStatements,只是不再 ForEach 后加空格 |
||||
|
# -- Always - 总是添加空格 |
||||
|
# -- NonEmptyParentheses - 类似 Always,只是不再空白括号前加空格 |
||||
SpaceBeforeParens: ControlStatements |
SpaceBeforeParens: ControlStatements |
||||
# SpaceBeforeParens为Custom时使用 |
|
||||
SpaceBeforeParensOptions: |
# 在 for 循环的冒号":"前加空格 |
||||
AfterControlStatements: true |
# SpaceBeforeRangeBasedForLoopColon: true |
||||
AfterForeachMacros: true |
|
||||
AfterFunctionDefinitionName: false |
# # 在空白的小括号"()"中添加空格 |
||||
AfterFunctionDeclarationName: false |
|
||||
AfterIfMacros: true |
|
||||
AfterOverloadedOperator: false |
|
||||
AfterRequiresInClause: false |
|
||||
AfterRequiresInExpression: false |
|
||||
BeforeNonEmptyParentheses: false |
|
||||
# 指针修饰的space添加, 建议Default, 即使用PointerAlignment代替 |
|
||||
SpaceAroundPointerQualifiers: Default |
|
||||
# Loop关键字前前是否增加space, 建议true |
|
||||
SpaceBeforeRangeBasedForLoopColon: true |
|
||||
# 空body是否添加space, 建议true |
|
||||
SpaceInEmptyBlock: true |
|
||||
# 圆括号前是否增加space, 建议false, true太多影响代码紧凑 |
|
||||
SpaceInEmptyParentheses: false |
SpaceInEmptyParentheses: false |
||||
# Trailing注释前的空格数, 建议1 |
|
||||
|
# # 在行尾的注释前添加的空格数(只适用于//) |
||||
SpacesBeforeTrailingComments: 1 |
SpacesBeforeTrailingComments: 1 |
||||
# <>里面是否增加space, 不建议, 配置成Never即可 |
|
||||
SpacesInAngles: Never |
# # 在尖括号的"<"后,和">"前添加空格 |
||||
# 条件语句()里面是否增加space, 不建议, 配置成Never即可 |
SpacesInAngles: false |
||||
SpacesInConditionalStatement: false |
|
||||
# 容器初始化列表[]/{}里面是否增加space, 不建议(跟C++11风格保持一致) |
# # 在容器(ObjC和JavaScript的数组和字典等)字面量中添加空格 |
||||
SpacesInContainerLiterals: false |
SpacesInContainerLiterals: true |
||||
# C风格的转换()里面是否增加space, 不建议 |
|
||||
|
# # 在C风格类型转换的括号中添加空格 |
||||
SpacesInCStyleCastParentheses: false |
SpacesInCStyleCastParentheses: false |
||||
# 行注释前的空格范围数量, 建议Maximum关闭, 设置成-1, 即//到你的注释内容前的空格数量至少是1, 至多是无穷 |
|
||||
SpacesInLineCommentPrefix: |
# # 在圆括号的"("后,和")"前添加空格 |
||||
Minimum: 1 |
|
||||
Maximum: -1 |
|
||||
# 贺括号内是否加space, false |
|
||||
SpacesInParentheses: false |
SpacesInParentheses: false |
||||
# 中括号内是否加space, false |
|
||||
|
# 在中括号中加空格 |
||||
|
# 当中括号内没有数据时,不受本规则影响(如空白的lambda 捕获表、不定长度的数组声明) |
||||
SpacesInSquareBrackets: false |
SpacesInSquareBrackets: false |
||||
# 大括号内是否加space, false |
|
||||
SpaceBeforeSquareBrackets: false |
# 语言标准: Cpp03, Cpp11, Auto |
||||
# 位定义:前后是否增加空格, 可选: |
Standard: Auto |
||||
# - Both: 前后都添加 |
|
||||
# - Before: 只在前增加 |
# # tab宽度 |
||||
# - After: 只在后增加 |
|
||||
# - None: 不增加, 建议, 没有必要因为过多的space(s)影响代码紧凑 |
|
||||
BitFieldColonSpacing: None |
|
||||
# C++标准, Latest即可 |
|
||||
Standard: Latest |
|
||||
StatementAttributeLikeMacros: |
|
||||
- Q_EMIT |
|
||||
StatementMacros: |
|
||||
- Q_UNUSED |
|
||||
- QT_REQUIRE_VERSION |
|
||||
# Tab宽度, 建议4 |
|
||||
TabWidth: 4 |
TabWidth: 4 |
||||
# 不使用CRLF, 强制关闭, 如果DeriveLineEnding为true却未自动决策出来, 此项用于fallback策略 |
|
||||
UseCRLF: false |
|
||||
# Tab使用, 没有必要使用, 直接Never |
|
||||
UseTab: Never |
|
||||
# 空格敏感宏列表 |
|
||||
WhitespaceSensitiveMacros: |
|
||||
- STRINGIZE |
|
||||
- PP_STRINGIZE |
|
||||
- BOOST_PP_STRINGIZE |
|
||||
- NS_SWIFT_NAME |
|
||||
- CF_SWIFT_NAME |
|
||||
... |
|
||||
|
|
||||
|
# # 使用tab字符: Never, ForIndentation, ForContinuationAndIndentation, Always |
||||
|
UseTab: Never |
||||
|
--- |
||||
|
|||||
@ -1,8 +1,9 @@ |
|||||
cmake_minimum_required(VERSION 3.27) |
cmake_minimum_required(VERSION 3.25) |
||||
project(PMClassifier) |
project(PMClassifier) |
||||
|
|
||||
set(CMAKE_CXX_STANDARD 20) |
set(CMAKE_CXX_STANDARD 20) |
||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True) |
||||
|
|
||||
include_directories(include) |
include_directories(./include) |
||||
|
|
||||
add_executable(PMClassifier main.cpp) |
add_executable(PMClassifier main.cpp) |
||||
|
|||||
@ -1,11 +1,8 @@ |
|||||
#pragma once |
#pragma once |
||||
|
|
||||
enum PtBoundaryRelation { |
enum PtBoundaryRelation { Inside = -1, OnBoundary, Outside = 1 }; |
||||
Inside = 1, |
|
||||
OnBoundary, |
|
||||
Outside = -1 |
|
||||
}; |
|
||||
|
|
||||
bool isEqual(double a, double b) { |
bool isEqual(double a, double b) { |
||||
// TODO
|
// TODO
|
||||
return a == b; } |
return a == b; |
||||
|
} |
||||
Loading…
Reference in new issue