#
# aGrUM clang-format specification (version clang-format-17.06)
# Pierre-Henri Wuillemin - 2016-2024
#
BasedOnStyle: LLVM
Language: Cpp
Standard: c++20

ColumnLimit: 100
MaxEmptyLinesToKeep: 2
KeepEmptyLinesAtTheStartOfBlocks: false
ReflowComments: true
CommentPragmas: "\\@headerfile"

IndentPPDirectives: AfterHash
SeparateDefinitionBlocks: Always
BreakBeforeBraces: Attach
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBinaryOperators: All
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true
BreakConstructorInitializers: AfterColon
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakAfterReturnType: None
BreakInheritanceList: AfterColon

CompactNamespaces: false
FixNamespaceComments: true

IndentWidth: 2
ContinuationIndentWidth: 4
UseTab: Never
AccessModifierOffset: 0
IndentCaseLabels: true
IndentWrappedFunctionNames: true
NamespaceIndentation: All
EmptyLineBeforeAccessModifier: Always

SpacesInAngles: true
Cpp11BracedListStyle: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 3
SpacesInContainerLiterals: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeCpp11BracedList: false
SpaceAfterLogicalNot: false
SpaceBeforeCaseColon: true

PointerAlignment: Left
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: Consecutive
AlignConsecutiveDeclarations: Consecutive
AlignOperands: AlignAfterOperator

AlignTrailingComments:
  Kind: Always
  OverEmptyLines: 2

AllowAllParametersOfDeclarationOnNextLine: false
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AlignEscapedNewlines: Left

BinPackArguments: false
BinPackParameters: false

AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
LambdaBodyIndentation: Signature

SortUsingDeclarations: false
SortIncludes: CaseInsensitive
IncludeBlocks: Regroup

# see https://www.regextester.com/
IncludeCategories:
  - Regex:           '<[[:alnum:].]+>'
    Priority:        1
  - Regex:           '<gumtest\/AgrumTestSuite\.h>'
    Priority:        2
  - Regex:           '<gumtest\/utils\.h>'
    Priority:        2
  - Regex:           '<agrum\/agrum\.h>'
    Priority:        3
  - Regex:           '<agrum\/config\.h>'
    Priority:        3
  - Regex:           '<gumtest\/AgrumApproximationUtils\.h>'
    Priority:        7
  - Regex:           '<agrum\/tools\/[[:alnum:]|\/]+\.h>'
    Priority:        4
  - Regex:           '<agrum\/[[:alnum:]|\/]+\.h>'
    Priority:        5
  - Regex:           '"[^.]+\.h"'
    Priority:        6

MacroBlockBegin: '^GUM_APPROX_TEST_BEGIN_ITERATION'
MacroBlockEnd: '^GUM_APPROX_TEST_END_ITERATION'
StatementMacros: ['TS_ASSERT_EQUALS','TS_ASSERT_DIFFERS','TS_ASSERT_THROWS','TS_ASSERT',
                  'GUM_CHECKPOINT','GUM_TRACE','GUM_TRACE_VAR',
                  'GUM_ASSERT',
                  'GUM_CONSTRUCTOR','GUM_DESTRUCTOR','GUM_CONS_CPY','GUM_CONS_MOV','GUM_OP_CPY','GUM_OP_MOV',
                  'GUM_DEBUG_ONLY']

#InsertNewLineAtEOF: true
#InsertTrailingCommas: Wrapped
#InsertLiteralSeparator:
#  Binary: 0
#  Decimal: 3
#  DecimalMinDigits: 5
#  Hex: -1
