C++ - Braces Layout
Braces Layout
Namespace declaration
Property names:
[resharper_]cpp_namespace_declaration_braces
, [resharper_]cpp_brace_style
, [resharper_]namespace_declaration_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
namespace·ns
··{
··void·a();
··} |
next_line_shifted_2 |
namespace·ns
··{
····void·a();
··} |
next_line |
namespace·ns
{
··void·a();
} |
end_of_line |
namespace·ns·{
··void·a();
} |
end_of_line_no_space |
namespace·ns{
··void·a();
} |
Type declaration
Property names:
[resharper_]cpp_type_declaration_braces
, [resharper_]cpp_brace_style
, [resharper_]type_declaration_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
class·C
··{
public:
··void·a();
··}; |
next_line_shifted_2 |
class·C
··{
··public:
····void·a();
··}; |
next_line |
class·C
{
public:
··void·a();
}; |
end_of_line |
class·C·{
public:
··void·a();
}; |
end_of_line_no_space |
class·C{
public:
··void·a();
}; |
Place namespace definitions on the same line
Property names:
[resharper_]cpp_place_namespace_definitions_on_same_line
, [resharper_]place_namespace_definitions_on_same_line
Possible values:
true | false
Examples:
true |
namespace·A·{·namespace·B
{
··void·a();
}} |
false |
namespace·A
{
··namespace·B
··{
····void·a();
··}
} |
Function declaration
Property names:
[resharper_]cpp_invocable_declaration_braces
, [resharper_]cpp_brace_style
, [resharper_]invocable_declaration_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
void·a()
··{
··b();
··} |
next_line_shifted_2 |
void·a()
··{
····b();
··} |
next_line |
void·a()
{
··b();
} |
end_of_line |
void·a()·{
··b();
} |
end_of_line_no_space |
void·a(){
··b();
} |
Anonymous method declaration
Property names:
[resharper_]cpp_anonymous_method_declaration_braces
, [resharper_]cpp_brace_style
, [resharper_]anonymous_method_declaration_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
auto·a·=·[]()
··{
··int·x·=·0;
··return·x;
··}; |
next_line_shifted_2 |
auto·a·=·[]()
··{
····int·x·=·0;
····return·x;
··}; |
next_line |
auto·a·=·[]()
{
··int·x·=·0;
··return·x;
}; |
end_of_line |
auto·a·=·[]()·{
··int·x·=·0;
··return·x;
}; |
end_of_line_no_space |
auto·a·=·[](){
··int·x·=·0;
··return·x;
}; |
Block under "case" label
Property names:
[resharper_]cpp_case_block_braces
, [resharper_]cpp_brace_style
, [resharper_]case_block_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
switch·(expression)
{
case·0:
··{
··foo();
··break;
··}
} |
next_line_shifted_2 |
switch·(expression)
{
case·0:
··{
····foo();
····break;
··}
} |
next_line |
switch·(expression)
{
case·0:
{
··foo();
··break;
}
} |
end_of_line |
switch·(expression)
{
case·0:·{
··foo();
··break;
}
} |
end_of_line_no_space |
switch·(expression)
{
case·0:·{
··foo();
··break;
}
} |
Other statements and blocks
Property names:
[resharper_]cpp_other_braces
, [resharper_]cpp_brace_style
, [resharper_]other_braces
, [resharper_]brace_style
Possible values:
-
next_line_shifted
: At next line indented (Whitesmiths style) -
next_line_shifted_2
: At next line indented 2 (GNU style) -
next_line
: At next line (BSD style) -
end_of_line
: At end of line (K&R style) -
end_of_line_no_space
: At end of line (no space)
Examples:
next_line_shifted |
if·(condition)
··{
··foo();
··}
else
··{
··foo();
··} |
next_line_shifted_2 |
if·(condition)
··{
····foo();
··}
else
··{
····foo();
··} |
next_line |
if·(condition)
{
··foo();
}
else
{
··foo();
} |
end_of_line |
if·(condition)·{
··foo();
}
else·{
··foo();
} |
end_of_line_no_space |
if·(condition){
··foo();
}
else{
··foo();
} |
Other braces
Property names:
[resharper_]cpp_expression_braces
, [resharper_]expression_braces
Possible values:
-
outside_and_inside
: Parenthesis 1x, inside 2x (GNU style) -
none
: No indent -
inside
: Inside parenthesis (BSD/K&R style) -
outside
: Parenthesis and inside equally (Whitesmiths style)
Examples:
outside_and_inside |
int·a[10]·=
··{
····1,·2,·3
··}; |
none |
int·a[10]·=
{
1,·2,·3
}; |
inside |
int·a[10]·=
{
··1,·2,·3
}; |
outside |
int·a[10]·=
··{
··1,·2,·3
··}; |
Empty braces formatting
Property names:
[resharper_]cpp_empty_block_style
, [resharper_]empty_block_style
Possible values:
-
together_same_line
: Together on the same line -
together
: Place braces together -
multiline
: On different lines
Examples:
together_same_line |
class·C·{}; |
together |
class·C
{}; |
multiline |
class·C
{
}; |
Keep simple compound statements in one line
Property names:
[resharper_]cpp_simple_block_style
, [resharper_]simple_block_style
Possible values:
-
line_break
: Force line breaks -
on_single_line
: Force put on single line -
do_not_change
: Do not change
Examples:
line_break |
int·foo()
{
··return·0;
} |
on_single_line |
int·foo()·{·return·0;·} |
do_not_change |
int·foo()·{·return·0;·} |