# conformallab++ formatting policy
#
# Captures the style already present in code/include/.  Documented here
# so clang-format can enforce it locally (scripts/quality/clang-format.sh)
# and so new contributors get the same output their editor would on save.
#
# This is NOT the upstream CGAL clang-format (there isn't one published);
# it's the style our tree already uses, mechanically extracted.

BasedOnStyle: LLVM
Language: Cpp
Standard: c++17

IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 100                  # loose; readability over hard wrap

# Brace placement — matches the project tree:
#   functions / methods → opening brace on a new line  (CGAL convention)
#   structs / classes   → opening brace on a new line
#   else / catch        → on the same line as the closing brace of the preceding block
BreakBeforeBraces: Custom
BraceWrapping:
  AfterClass:            true
  AfterStruct:           true
  AfterEnum:             true
  AfterFunction:         true
  AfterNamespace:        false
  AfterUnion:            true
  AfterControlStatement: false
  BeforeElse:            false
  BeforeCatch:           false
  IndentBraces:          false
  SplitEmptyFunction:    false
  SplitEmptyRecord:      false
  SplitEmptyNamespace:   true

# Reference & pointer modifiers attach to the type (`int& x`, not `int &x`).
PointerAlignment: Left
ReferenceAlignment: Left

# Aligned `using = ...` blocks are intentional in the trait classes.
AlignConsecutiveDeclarations: AcrossEmptyLines
AlignConsecutiveAssignments: AcrossEmptyLines
AlignTrailingComments: true
AlignAfterOpenBracket: Align

AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline

# Template-related: break before each parameter when the template line
# would otherwise exceed ColumnLimit (matches existing
# `template <typename TriangleMesh, typename ...>` patterns).
BreakBeforeBinaryOperators: NonAssignment
BinPackParameters: false
BinPackArguments: false
AlwaysBreakTemplateDeclarations: Yes
SpaceAfterTemplateKeyword: true

NamespaceIndentation: None
AccessModifierOffset: -4
IndentCaseLabels: false

# Includes: keep manual ordering — re-ordering can break Eigen / CGAL
# transitive-include assumptions in subtle ways.  We just enforce no
# accidental duplicate blank lines.
SortIncludes: Never
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false

# Comments: don't touch.
ReflowComments: false
