1# Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
2#
3# You may use this file under the terms of the 3-clause BSD license.
4# See the file LICENSE from this package for details.
5
6---
7BasedOnStyle: WebKit
8
9Standard: Cpp11
10
11ColumnLimit: 240
12# How much weight do extra characters after the line length limit have.
13# PenaltyExcessCharacter: 4
14
15# Disable reflow of qdoc comments: indentation rules are different.
16# Translation comments are also excluded.
17CommentPragmas: "^!|^:"
18
19# We want a space between the type and the star for pointer types.
20PointerBindsToType: false
21
22# We use template< without space.
23SpaceAfterTemplateKeyword: false
24
25# We want to break before the operators, but not before a '='.
26BreakBeforeBinaryOperators: NonAssignment
27
28# Braces are usually attached, but not after functions or class declarations.
29BreakBeforeBraces: Custom
30BraceWrapping:
31    AfterClass: true
32    AfterControlStatement: false
33    AfterEnum: true
34    AfterFunction: true
35    AfterNamespace: false
36    AfterObjCDeclaration: false
37    AfterStruct: true
38    AfterUnion: false
39    BeforeCatch: false
40    BeforeElse: false
41    IndentBraces: false
42
43# When constructor initializers do not fit on one line, put them each on a new line.
44ConstructorInitializerAllOnOneLineOrOnePerLine: true
45# Indent initializers by 4 spaces
46ConstructorInitializerIndentWidth: 4
47
48# Indent width for line continuations.
49ContinuationIndentWidth: 8
50
51# No indentation for namespaces.
52NamespaceIndentation: None
53
54# Allow indentation for preprocessing directives (if/ifdef/endif). https://reviews.llvm.org/rL312125
55IndentPPDirectives: AfterHash
56
57# Horizontally align arguments after an open bracket.
58# The coding style does not specify the following, but this is what gives
59# results closest to the existing code.
60AlignAfterOpenBracket: true
61AlwaysBreakTemplateDeclarations: true
62
63# Ideally we should also allow less short function in a single line, but
64# clang-format does not handle that.
65AllowShortFunctionsOnASingleLine: Inline
66
67# The coding style specifies some include order categories, but also tells to
68# separate categories with an empty line. It does not specify the order within
69# the categories. Since the SortInclude feature of clang-format does not
70# re-order includes separated by empty lines, the feature is not used.
71SortIncludes: false
72
73# macros for which the opening brace stays attached.
74ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
75
76# Break constructor initializers before the colon and after the commas.
77BreakConstructorInitializers: BeforeColon
78