---
# clang-format configuration for gwframe C++ bindings
# Based on LLVM style with adjustments for readability

BasedOnStyle: LLVM

# Line length
ColumnLimit: 100

# Indentation
IndentWidth: 4
ContinuationIndentWidth: 4
AccessModifierOffset: -4

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

# Braces
BreakBeforeBraces: Attach

# Line breaking
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortLambdasOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true

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

# Pointers and references
DerivePointerAlignment: false
PointerAlignment: Left

# Include sorting
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
  # nanobind headers
  - Regex:           '^<nanobind/'
    Priority:        1
  # Standard library headers
  - Regex:           '^<(memory|sstream|iostream|string|vector|tuple)>'
    Priority:        2
  # boost headers
  - Regex:           '^<boost/'
    Priority:        3
  # frameCPP headers
  - Regex:           '^<framecpp/'
    Priority:        4
  # Everything else
  - Regex:           '.*'
    Priority:        5

# Other
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ReflowComments: true
UseTab: Never
