# Based on LLVM style with C++20 support
BasedOnStyle: LLVM
Language: Cpp
Standard: c++20

# Tab and indent settings
TabWidth: 4
IndentWidth: 4
UseTab: Never
ColumnLimit: 160

# Text line management
#LineEndingStyle: LF
MaxEmptyLinesToKeep: 2
InsertNewlineAtEOF: true

# Alignment settings
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
#AlignConsecutiveTableGenDefinitionColons:
#  Enabled: true
#  AcrossEmptyLines: true
#  AcrossComments: false
AlignEscapedNewlines: Left
AlignTrailingComments:
  Kind: Always
  OverEmptyLines: 1
DerivePointerAlignment: false
PointerAlignment: Right

# Single-line statements settings
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false

# Braces and wrapping settings
BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: false
  AfterControlStatement: Always
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: true
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
Cpp11BracedListStyle: false

# Line breaks and wrapping settings
#AllowAllParametersOfDeclarationOnNextLine: true
#AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AlwaysBreakAfterDefinitionReturnType: None  # Keep return type on the same line if possible
AlwaysBreakAfterReturnType: None  # Default value
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BreakAfterAttributes: Always
BreakBeforeBinaryOperators: None  # Default value: No line break before binary operators
BreakBeforeConceptDeclarations: Always
BreakConstructorInitializers: AfterColon
BreakBeforeTernaryOperators: false  # Default value
BreakConstructorInitializersBeforeComma: true
#BreakInheritanceList: AfterColon
BreakStringLiterals: false  # Default value
PackConstructorInitializers: NextLineOnly
PenaltyReturnTypeOnItsOwnLine: 200 # Prefer keeping return type on the same line if possible

# Indentation settings
AccessModifierOffset: -4
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: false
LambdaBodyIndentation: Signature
NamespaceIndentation: Inner

# Spaces around statements settings
SpaceAfterCStyleCast: false  # Default value
SpaceAfterTemplateKeyword: false  # Default value
#SpaceAroundPointerQualifiers: Left
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false  # Default value
SpacesInAngles: false  # Default value
SpacesInCStyleCastParentheses: false  # Default value
SpacesInContainerLiterals: false  # Default value
SpacesInParentheses: false  # Default value
SpacesInSquareBrackets: false  # Default value

# Macros settings
#MacroBlockBegin: [regex -> EXC_TRY...]
#MacroBlockEnd:
#StatementMacros: [-> ASSERT?]

# Scopes settings
FixNamespaceComments: true
ShortNamespaceLines: 2

# Miscellaneous settings
SeparateDefinitionBlocks: Always
ReflowComments: false

# Include order
#IncludeBlocks: Regroup
#IncludeIsMainRegex: '$?'
IncludeCategories:
#TODO: main include!
  - Regex: '"([A-Za-z0-9\/-_])+\.h"'
    Priority: 1
  - Regex: '"([A-Za-z0-9\/-_])+\.hpp"'
    Priority: 2
  - Regex: '<([A-Za-z0-9\/-_])+\.h>'
    Priority: 10
  - Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
    Priority: 20
  - Regex: '<([A-Za-z0-9\/-_])+>'
    Priority: 30
SortIncludes: false
