---
# Based on LLVM style with custom modifications
BasedOnStyle: LLVM

# Basic settings
Language: Cpp
Standard: c++17

# Indentation
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 160

# Braces
BreakBeforeBraces: Allman
BraceWrapping:
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: false
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true

# Alignment
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true

# Spacing
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

# Line breaks
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes

# Pointers and references
DerivePointerAlignment: false
PointerAlignment: Left

# Includes
SortIncludes: false
IncludeBlocks: Regroup
IncludeCategories:
  - Regex: '^".*\.h"'
    Priority: 1
  - Regex: '^<.*\.h>'
    Priority: 2
  - Regex: '^<.*'
    Priority: 3

# Other
KeepEmptyLinesAtTheStartOfBlocks: false
# Keep at most one consecutive empty line (avoids stacked blanks).
MaxEmptyLinesToKeep: 1
# Always insert one empty line between adjacent top-level definitions (functions,
# classes, etc.) so function boundaries stay readable; does not target `if`/`for` bodies.
SeparateDefinitionBlocks: Always
NamespaceIndentation: None
ReflowComments: true
