---
Language: Cpp
BasedOnStyle: ''

# Basic indentation and spacing rules:
IndentWidth: 4
ContinuationIndentWidth: 4
TabWidth: 4
UseCRLF: false
UseTab: Never
ColumnLimit: 120
MaxEmptyLinesToKeep: 3

IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentExternBlock: AfterExternBlock
IndentWrappedFunctionNames: true

AlignConsecutiveAssignments:
  # The column at which the = starts is constant among a block of definitions.
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: true
  AlignCompound: true
  PadOperators: true
AlignConsecutiveBitFields:
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: true
AlignConsecutiveDeclarations:
  # The column at which the name starts is constant among a block of declarations / definitions.
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: true
AlignConsecutiveMacros:
  Enabled: true
  AcrossEmptyLines: false
  AcrossComments: true

# configure braces and parens:
BraceWrapping:
  AfterEnum: false # The { is on the same line as the struct, union or enum keyword.
  AfterStruct: false # The { is on the same line as the struct, union or enum keyword.
  AfterUnion: false # The { is on the same line as the struct, union or enum keyword.
  AfterFunction: false # The { is on the same line as the ).

  AfterCaseLabel: false
  AfterControlStatement: Never

  AfterExternBlock: false
  BeforeElse: false
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: true
  SplitEmptyRecord: true

AllowShortFunctionsOnASingleLine: None # never collapse empty functions
AllowShortBlocksOnASingleLine: Never # never make single-line blocks
AllowShortIfStatementsOnASingleLine: Never # never make single-line ifs
AllowShortLoopsOnASingleLine: true # allow single-line loops
AllowShortEnumsOnASingleLine: true # allow enum { FOO = 10 };

# configure general code:

# The = has at least one space to the left and one space to the right.
SpaceBeforeAssignmentOperators: true

# configure pointers:

PointerAlignment: Right # The * is at the function name and has at least one space from the type before it.
QualifierAlignment: Right # The const is to the left of the type (unless the pointer is also a constant).
SpaceAroundPointerQualifiers: After

# include sorting:

SortIncludes: CaseInsensitive
IncludeBlocks: Regroup
IncludeCategories:
  # External headers
  - Regex: '^\<('
    Priority: 3
    SortPriority: 0
    CaseSensitive: false

  # System headers
  - Regex: '^\<(std.*|inttypes)'
    Priority: 2
    SortPriority: 0
    CaseSensitive: false

  # Assume project header
  - Regex: '^\".*'
    Priority: 1
    SortPriority: 0
    CaseSensitive: false

# all other options

# all arguments on one or on a separate line, use closing parens on separate line
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: BlockIndent
AllowAllArgumentsOnNextLine: false

BitFieldColonSpacing: Both # int bf : 2;

AlignEscapedNewlines: Right

AllowShortCaseLabelsOnASingleLine: true # don't split up "case x: return value;"

BreakBeforeTernaryOperators: true

# default values:

# AlignArrayOfStructures: None
# AlignOperands: Align
# AlignTrailingComments: true
# AllowAllParametersOfDeclarationOnNextLine: true

# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: All
# BreakBeforeBraces: Attach
# BreakStringLiterals: true
# CommentPragmas: '^ IWYU pragma:'

# ExperimentalAutoDetectBinPacking: false
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# InsertBraces: false
# InsertTrailingCommas: None
# KeepEmptyLinesAtTheStartOfBlocks: true
# ReflowComments: true
# RequiresClausePosition: OwnLine
# SeparateDefinitionBlocks: Leave

# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceBeforeCaseColon: false
# SpaceBeforeParens: ControlStatements
# SpaceBeforeParensOptions:
#   AfterControlStatements: true
#   AfterForeachMacros: true
#   AfterFunctionDefinitionName: false
#   AfterFunctionDeclarationName: false
#   AfterIfMacros: true
#   AfterOverloadedOperator: false
#   AfterRequiresInClause: false
#   AfterRequiresInExpression: false
#   BeforeNonEmptyParentheses: false
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
# SpacesInLineCommentPrefix:
#   Minimum: 1
#   Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false

# Configure some special macros:
AttributeMacros:
  - NORETURN
  - PURE
  - COLD
  - HOT
  - FORCEINLINE
  - SECTION
WhitespaceSensitiveMacros:
  - comptime_stringify
# ForEachMacros:
#   - foreach
#   - Q_FOREACH
#   - BOOST_FOREACH
# IfMacros:
#   - KJ_IF_MAYBE
# StatementMacros:
#   - Q_UNUSED
#   - QT_REQUIRE_VERSION
# StatementAttributeLikeMacros:
#   - FALLTHROUGH
# MacroBlockBegin: ''
# MacroBlockEnd: ''
---

