# Formatting rules for rtphone's own C++ sources (src/engine, src/libs/ice, test).
# Third-party code under src/libs/ is excluded via .clang-format-ignore.
---
Language:        Cpp
BasedOnStyle:    LLVM
Standard:        c++20

# Indentation: 4 columns, spaces only.
IndentWidth:     4
TabWidth:        4
UseTab:          Never
AccessModifierOffset: -4
NamespaceIndentation: None
IndentCaseLabels: false

ColumnLimit:     120

# Allman braces, as used throughout the codebase.
BreakBeforeBraces: Allman

PointerAlignment: Left
ReferenceAlignment: Left
DerivePointerAlignment: false

AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty

# Include order matters here (platform headers, windows.h, vendored libs),
# so never reorder them.
SortIncludes:    Never
IndentPPDirectives: None
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
FixNamespaceComments: true
SpaceAfterTemplateKeyword: false
AlwaysBreakTemplateDeclarations: Yes
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments

# Objective-C++ (src/libs/ice/ICEIosSupport.mm) — same rules as C++.
---
Language:        ObjC
BasedOnStyle:    LLVM
IndentWidth:     4
TabWidth:        4
UseTab:          Never
AccessModifierOffset: -4
NamespaceIndentation: None
IndentCaseLabels: false
ColumnLimit:     120
BreakBeforeBraces: Allman
PointerAlignment: Left
ReferenceAlignment: Left
DerivePointerAlignment: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
SortIncludes:    Never
IndentPPDirectives: None
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
FixNamespaceComments: true
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
