Skip to content

Commit 0aa7765

Browse files
authored
Apply make format to codebase (#1088)
* tweak .clang-format * apply make-format to the c++ codebase * tweak the namespaces and constructors * apply new format options Co-authored-by: ssteinbach <[email protected]>
1 parent 7c285db commit 0aa7765

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4818
-3228
lines changed

.clang-format

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ AlignTrailingComments: true
1111
# AllowAllArgumentsOnNextLine: true
1212
AllowAllParametersOfDeclarationOnNextLine: true
1313
# AllowAllConstructorInitializersOnNextLine: true
14-
AllowShortBlocksOnASingleLine: true
15-
AllowShortCaseLabelsOnASingleLine: true
14+
AllowShortBlocksOnASingleLine: false
15+
AllowShortCaseLabelsOnASingleLine: false
1616
AllowShortFunctionsOnASingleLine: InlineOnly
17-
AllowShortIfStatementsOnASingleLine: true
17+
AllowShortIfStatementsOnASingleLine: false
1818
AllowShortLoopsOnASingleLine: false
1919
# AllowShortLambdasOnASingleLine: true
2020
AlwaysBreakAfterDefinitionReturnType: TopLevel
21-
AlwaysBreakAfterReturnType: None
21+
AlwaysBreakAfterReturnType: TopLevelDefinitions
2222
AlwaysBreakBeforeMultilineStrings: false
23-
AlwaysBreakTemplateDeclarations: MultiLine
23+
AlwaysBreakTemplateDeclarations: Yes
2424
BinPackArguments: false
2525
BinPackParameters: false
2626
BraceWrapping:
2727
AfterClass: true
2828
AfterControlStatement: true
2929
AfterEnum: true
3030
AfterFunction: true
31-
AfterNamespace: true
31+
AfterNamespace: false
3232
AfterObjCDeclaration: true
3333
AfterStruct: true
3434
AfterUnion: true
@@ -50,8 +50,8 @@ BreakAfterJavaFieldAnnotations: false
5050
BreakStringLiterals: false
5151
ColumnLimit: 80
5252
CommentPragmas: '^ IWYU pragma:'
53-
CompactNamespaces: false
54-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
53+
CompactNamespaces: true
54+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
5555
ConstructorInitializerIndentWidth: 4
5656
ContinuationIndentWidth: 4
5757
Cpp11BracedListStyle: false
@@ -104,7 +104,7 @@ SpaceBeforeAssignmentOperators: true
104104
SpaceBeforeCpp11BracedList: false
105105
SpaceBeforeCtorInitializerColon: true
106106
SpaceBeforeInheritanceColon: true
107-
SpaceBeforeParens: false
107+
SpaceBeforeParens: ControlStatements
108108
SpaceBeforeRangeBasedForLoopColon: false
109109
SpaceInEmptyParentheses: false
110110
SpacesBeforeTrailingComments: 1
@@ -113,8 +113,8 @@ SpacesInContainerLiterals: true
113113
SpacesInCStyleCastParentheses: false
114114
SpacesInParentheses: false
115115
SpacesInSquareBrackets: false
116-
Standard: Cpp11
117-
TabWidth: 8
116+
Standard: c++14
117+
TabWidth: 4
118118
#UseTab: ForIndentation
119119
UseTab: Never
120120
...

src/opentime/errorStatus.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
#include "opentime/errorStatus.h"
22

3-
namespace opentime { namespace OPENTIME_VERSION {
4-
5-
std::string ErrorStatus::outcome_to_string(Outcome o) {
6-
switch(o) {
7-
case OK:
8-
return std::string();
9-
case INVALID_TIMECODE_RATE:
10-
return "invalid timecode rate";
11-
case INVALID_TIMECODE_STRING:
12-
return "string is not a valid timecode string";
13-
case TIMECODE_RATE_MISMATCH:
14-
return "timecode specifies a frame higher than its rate";
15-
case INVALID_TIME_STRING:
16-
return "invalid time string";
17-
case NEGATIVE_VALUE:
18-
return "value cannot be negative here";
19-
case INVALID_RATE_FOR_DROP_FRAME_TIMECODE:
20-
return "rate is not valid for drop frame timecode";
21-
default:
22-
return "unknown/illegal ErrorStatus::Outcome code";
3+
namespace opentime { namespace OPENTIME_VERSION {
4+
5+
std::string
6+
ErrorStatus::outcome_to_string(Outcome o)
7+
{
8+
switch (o)
9+
{
10+
case OK:
11+
return std::string();
12+
case INVALID_TIMECODE_RATE:
13+
return "invalid timecode rate";
14+
case INVALID_TIMECODE_STRING:
15+
return "string is not a valid timecode string";
16+
case TIMECODE_RATE_MISMATCH:
17+
return "timecode specifies a frame higher than its rate";
18+
case INVALID_TIME_STRING:
19+
return "invalid time string";
20+
case NEGATIVE_VALUE:
21+
return "value cannot be negative here";
22+
case INVALID_RATE_FOR_DROP_FRAME_TIMECODE:
23+
return "rate is not valid for drop frame timecode";
24+
default:
25+
return "unknown/illegal ErrorStatus::Outcome code";
2326
};
2427
}
2528

26-
} }
27-
28-
29-
30-
31-
29+
}} // namespace opentime::OPENTIME_VERSION

src/opentime/errorStatus.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#include "opentime/version.h"
44
#include <string>
55

6-
namespace opentime { namespace OPENTIME_VERSION {
7-
8-
struct ErrorStatus {
9-
enum Outcome {
6+
namespace opentime { namespace OPENTIME_VERSION {
7+
8+
struct ErrorStatus
9+
{
10+
enum Outcome
11+
{
1012
OK = 0,
1113
INVALID_TIMECODE_RATE,
1214
INVALID_TIMECODE_STRING,
@@ -16,32 +18,38 @@ struct ErrorStatus {
1618
INVALID_RATE_FOR_DROP_FRAME_TIMECODE,
1719
};
1820

19-
ErrorStatus() : outcome {OK} {}
20-
21-
ErrorStatus(Outcome in_outcome) :
22-
outcome {in_outcome},
23-
details {outcome_to_string(in_outcome)} {}
21+
ErrorStatus()
22+
: outcome{ OK }
23+
{}
24+
25+
ErrorStatus(Outcome in_outcome)
26+
: outcome{ in_outcome }
27+
, details{ outcome_to_string(in_outcome) }
28+
{}
2429

2530
ErrorStatus(Outcome in_outcome, std::string const& in_details)
26-
: outcome {in_outcome},
27-
details {in_details} {}
28-
29-
Outcome outcome;
31+
: outcome{ in_outcome }
32+
, details{ in_details }
33+
{}
34+
35+
Outcome outcome;
3036
std::string details;
31-
37+
3238
static std::string outcome_to_string(Outcome);
3339
};
3440

3541
// Check whether the given ErrorStatus is an error.
36-
constexpr bool is_error(const ErrorStatus& es) noexcept
42+
constexpr bool
43+
is_error(const ErrorStatus& es) noexcept
3744
{
3845
return ErrorStatus::Outcome::OK != es.outcome;
3946
}
4047

4148
// Check whether the given ErrorStatus is non-null and an error.
42-
constexpr bool is_error(const ErrorStatus* es) noexcept
49+
constexpr bool
50+
is_error(const ErrorStatus* es) noexcept
4351
{
4452
return es && ErrorStatus::Outcome::OK != es->outcome;
4553
}
4654

47-
} }
55+
}} // namespace opentime::OPENTIME_VERSION

0 commit comments

Comments
 (0)