#  +-----------------------+
#  |  Created  2022-04-23  |
#  +-----------------------+

# Default to Google style
BasedOnStyle:                        Google

# Don't derive from file
DeriveLineEnding:                    false
DerivePointerAlignment:              false

# Google limits lines to 80 columns. Don't do that.
ColumnLimit:                         0

# Here there be controversy
IndentWidth:                         4
ConstructorInitializerIndentWidth:   4
ContinuationIndentWidth:             4

# Alignment checks
AlignAfterOpenBracket:               false
AlignConsecutiveAssignments:         false
AlignConsecutiveDeclarations:        false
AlignOperands:                       false
AlignTrailingComments:               true
Cpp11BracedListStyle:                false

# Sort include blocks, and regroup based on include category
SortIncludes:                        CaseInsensitive
IncludeBlocks:                       Regroup

# Allow short blocks on single line
AllowShortBlocksOnASingleLine:       Always
AllowShortEnumsOnASingleLine:        true
AllowShortFunctionsOnASingleLine:    Inline
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLambdasOnASingleLine:      Inline
AllowShortLoopsOnASingleLine:        true
# Except case statements
AllowShortCaseLabelsOnASingleLine:   false

# Line wrapping should not happen, but just in case, keep the args together
BinPackArguments:                    true
BinPackParameters:                   true
PackConstructorInitializers:         CurrentLine

# When bitfield-packing a struct, spaces go after the colon, not before
BitFieldColonSpacing:                After

# By default, braces are obnoxiously wrapped to newlines
BreakBeforeBraces:                   Custom
# Disable that
BraceWrapping:
   AfterEnum:                        false
   AfterFunction:                    false
   AfterNamespace:                   false
   AfterStruct:                      false
   AfterUnion:                       false
   AfterExternBlock:                 false
   AfterControlStatement:            false

   BeforeCatch:                      false
   BeforeElse:                       false
   BeforeLambdaBody:                 false
   BeforeWhile:                      false

   IndentBraces:                     false

   SplitEmptyFunction:               false

# Don't break before ?:, it looks ugly
BreakBeforeTernaryOperators:         false

# Trim empty lines when there are more than 1
MaxEmptyLinesToKeep:                 2

# Indent namespaces
NamespaceIndentation:                All

# Align &*s toward the variable name (i.e. int &number; char *cstring)
ReferenceAlignment:                  Pointer
PointerAlignment:                    Right

# Put spaces after (int) c_style_casts and template <T>, but !after '!' operator
SpaceAfterCStyleCast:                true
SpaceAfterLogicalNot:                false
SpaceAfterTemplateKeyword:           true

# Put spaces before \.?\= operators, initializer {lists}, inline (parentheses), // comments.
SpaceBeforeAssignmentOperators:      true
SpaceBeforeCpp11BracedList:          true
SpaceBeforeParens:                   Always
SpacesBeforeTrailingComments:        1
SpacesInLineCommentPrefix:
   Minimum: 1
# Don't put spaces in case : statements, object : inheritance,
# for (auto& loops : range), conditional ( statements ), ( parentheses ), [ brackets ]
SpaceBeforeCaseColon:                false
SpaceBeforeInheritanceColon:         false
SpaceBeforeRangeBasedForLoopColon:   false
SpacesInConditionalStatement:        false
SpacesInParentheses:                 false
SpacesInSquareBrackets:              false

# Always use LF for line breaks, and NEVER use tabs for indentation
UseCRLF:                             false
UseTab:                              Never
