.clang-format 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. # This is the clang-format configuration style to be used by Qt,
  6. # based on the rules from https://wiki.qt.io/Qt_Coding_Style and
  7. # https://wiki.qt.io/Coding_Conventions
  8. ---
  9. # Webkit style was loosely based on the Qt style
  10. BasedOnStyle: WebKit
  11. Standard: Cpp11
  12. ColumnLimit: 0
  13. # Disable reflow of qdoc comments: indentation rules are different.
  14. # Translation comments are also excluded
  15. CommentPragmas: "^!|^:"
  16. # We want a space between the type and the star for pointer types
  17. PointerBindsToType: false
  18. # We want to break before the operators, but not before a '='
  19. BreakBeforeBinaryOperators: NonAssignment
  20. # Braces are usually attached, but not after functions or classes declaration
  21. BreakBeforeBraces: Custom
  22. BraceWrapping:
  23. AfterClass: true
  24. AfterControlStatement: false
  25. AfterEnum: false
  26. AfterFunction: true
  27. AfterNamespace: false
  28. AfterObjCDeclaration: false
  29. AfterStruct: true
  30. AfterUnion: false
  31. BeforeCatch: false
  32. BeforeElse: false
  33. IndentBraces: false
  34. # The coding style does not specify the following, but this is what gives
  35. # results closest to the existing code.
  36. AlignAfterOpenBracket: DontAlign
  37. AlwaysBreakTemplateDeclarations: true
  38. # Ideally we should also allow less short function in a single line, but
  39. # clang-format does not handle that
  40. AllowShortFunctionsOnASingleLine: Inline
  41. # The coding style specifies some include order categories, but also tells to
  42. # separate categories with an empty line. It does not specify the order within
  43. # the categories. Since the SortInclude feature of clang-format does not
  44. # re-order includes separated by empty lines, the feature is not used.
  45. SortIncludes: false
  46. # macros for which the opening brace stays attached
  47. ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
  48. # Allow two empty lines for structuring
  49. MaxEmptyLinesToKeep: 2
  50. KeepEmptyLinesAtTheStartOfBlocks: false