.clang-format 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # 基于配置文件
  2. BasedOnStyle: LLVM
  3. # 访问说明符的偏移(public private)
  4. AccessModifierOffset: -4
  5. # 括号之后,水平对齐参数: Align DontAlign AlwaysBreak
  6. AlignAfterOpenBracket: Align
  7. # 连续的赋值时,对齐所有的等号
  8. AlignConsecutiveAssignments: true
  9. # 连续声明时,对齐所有声明的变量名
  10. AlignConsecutiveDeclarations: true
  11. # 左对齐换行(使用反斜杠换行)的反斜杠
  12. AlignEscapedNewlinesLeft: true
  13. # 水平对齐二元和三元表达式的操作数
  14. AlignOperands: true
  15. # 对齐连续的尾随的注释
  16. AlignTrailingComments: true
  17. # 对齐连续的宏定义
  18. AlignConsecutiveMacros: true
  19. # 允许函数声明的所有参数在放在下一行
  20. AllowAllParametersOfDeclarationOnNextLine: true
  21. # 允许短的块放在同一行
  22. AllowShortBlocksOnASingleLine : true
  23. # 允许短的case标签放在同一行
  24. AllowShortCaseLabelsOnASingleLine: false
  25. # 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All
  26. AllowShortFunctionsOnASingleLine: Empty
  27. # 是否允许短if单行 If true, if (a) return; 可以放到同一行
  28. AllowShortIfStatementsOnASingleLine: false
  29. # 允许短的循环保持在同一行
  30. AllowShortLoopsOnASingleLine: false
  31. # 总是在定义返回类型后换行(deprecated)
  32. AlwaysBreakAfterDefinitionReturnType: None
  33. # 每行字符的限制,0表示没有限制
  34. ColumnLimit: 150
  35. # 描述具有特殊意义的注释的正则表达式,它不应该被分割为多行或以其它方式改变
  36. CommentPragmas: '^(/\*|\s*/\*|\s*\*)'
  37. # 语言: None Cpp Java Objc Protp
  38. Language: Cpp
  39. # 指针的*的挨着哪边
  40. PointerAlignment: Right
  41. #缩进宽度
  42. IndentWidth: 4
  43. # 连续的空行保留几行
  44. MaxEmptyLinesToKeep: 1
  45. # 在 @property 后面添加空格, \@property (readonly) 而不是 \@property(readonly).
  46. ObjCSpaceAfterProperty: true
  47. # OC block后面的缩进
  48. ObjCBlockIndentWidth: 4
  49. # 是否允许短方法单行
  50. AllowShortFunctionsOnASingleLine: false
  51. # 换行的时候对齐操作符
  52. # AlignOperands: true
  53. # 中括号两边空格 []
  54. SpacesInSquareBrackets: false
  55. # 小括号两边添加空格
  56. SpacesInParentheses : false
  57. #等号两边的空格
  58. SpaceBeforeAssignmentOperators: true
  59. # 容器类的空格 例如 OC的字典
  60. SpacesInContainerLiterals: true
  61. #缩进
  62. IndentWrappedFunctionNames: true
  63. #在block从空行开始
  64. KeepEmptyLinesAtTheStartOfBlocks: true
  65. #在构造函数初始化时按逗号断行,并以冒号对齐
  66. BreakConstructorInitializersBeforeComma: true
  67. #括号后添加空格
  68. SpaceAfterCStyleCast: false
  69. # 允许排序#include, 造成编译错误
  70. SortIncludes: false
  71. # 缩进case 标签
  72. IndentCaseLabels: false
  73. #tab键盘的宽度
  74. TabWidth: 4
  75. UseTab: Never
  76. # 大括号换行方式
  77. BreakBeforeBraces: Custom
  78. BraceWrapping:
  79. # class定义后面
  80. AfterClass: true
  81. # 控制语句后面
  82. AfterControlStatement: true
  83. # enum定义后面
  84. AfterEnum: true
  85. # 函数定义后面
  86. AfterFunction: true
  87. # 命名空间定义后面
  88. AfterNamespace: true
  89. # struct定义后面
  90. AfterStruct: true
  91. # union定义后面
  92. AfterUnion: true
  93. # extern之后
  94. AfterExternBlock: false
  95. # catch之前
  96. BeforeCatch: true
  97. # else之前
  98. BeforeElse: true
  99. # 缩进大括号
  100. IndentBraces: false
  101. # 分离空函数
  102. SplitEmptyFunction: false
  103. # 分离空语句
  104. SplitEmptyRecord: false
  105. # 分离空命名空间
  106. SplitEmptyNamespace: false
  107. # 缩进换行的括号
  108. IndentBraces: false