C++ の EditorConfig プロパティ: インデントとアライメント
インデントーション
連続行インデント
プロパティ名:
[resharper_]cpp_continuous_line_indent, [resharper_]continuous_line_indent
使用可能な値:
none: なしsingle: 単一double: ダブル
例:
none |
|---|
int x = foo1() +
foo2();
|
single |
|---|
int x = foo1() +
foo2();
|
double |
|---|
int x = foo1() +
foo2();
|
関数宣言および呼び出しの丸括弧で連続行インデントを使用する
プロパティ名:
[resharper_]cpp_use_continuous_line_indent_in_method_pars, [resharper_]use_continuous_line_indent_in_method_pars
使用可能な値:
true | false
例:
true |
|---|
void Method(
int parameter1,
int parameter2
)
{
Method(
parameter1,
parameter2
);
}
|
false |
|---|
void Method(
int parameter1,
int parameter2
)
{
Method(
parameter1,
parameter2
);
}
|
イニシャライザーリストで連続行インデントを使用する
プロパティ名:
[resharper_]cpp_use_continuous_line_indent_in_expression_braces, [resharper_]use_continuous_line_indent_in_expression_braces
使用可能な値:
true | false
例:
true |
|---|
int a[3] =
{
1, 2, 3
};
|
false |
|---|
int a[3] =
{
1, 2, 3
};
|
名前空間メンバーをインデントする
プロパティ名:
[resharper_]cpp_namespace_indentation, [resharper_]namespace_indentation
使用可能な値:
none: インデントしないinner: 内部の名前空間にのみインデントするall: インデントすべて
例:
none |
|---|
namespace ns
{
void a();
namespace inner
{
void b();
};
};
|
inner |
|---|
namespace ns
{
void a();
namespace inner
{
void b();
};
};
|
all |
|---|
namespace ns
{
void a();
namespace inner
{
void b();
};
};
|
リンケージ指定ブロックメンバーをインデントする
プロパティ名:
[resharper_]cpp_linkage_specification_indentation, [resharper_]linkage_specification_indentation
使用可能な値:
none: インデントしないinner: 内部の名前空間にのみインデントするall: インデントすべて
例:
none |
|---|
extern "C++" {
void a();
extern "C++" {
void b();
};
};
|
inner |
|---|
extern "C++" {
void a();
extern "C++" {
void b();
};
};
|
all |
|---|
extern "C++" {
void a();
extern "C++" {
void b();
};
};
|
エクスポート宣言ブロックメンバーをインデントする
プロパティ名:
[resharper_]cpp_indent_export_declaration_members, [resharper_]indent_export_declaration_members
使用可能な値:
true | false
例:
true |
|---|
export
{
void a();
};
|
false |
|---|
export
{
void a();
};
|
クラスからアクセス指定子をインデントする
プロパティ名:
[resharper_]cpp_indent_access_specifiers_from_class, [resharper_]indent_access_specifiers_from_class
使用可能な値:
true | false
例:
true |
|---|
class C
{
public:
void a();
};
|
false |
|---|
class C
{
public:
void a();
};
|
アクセス指定子からクラスメンバーをインデントする
プロパティ名:
[resharper_]cpp_indent_class_members_from_access_specifiers, [resharper_]indent_class_members_from_access_specifiers
使用可能な値:
true | false
例:
true |
|---|
class C
{
public:
void a();
};
|
false |
|---|
class C
{
public:
void a();
};
|
メンバーイニシャライザーリストをインデントする
プロパティ名:
[resharper_]cpp_indent_member_initializer_list, [resharper_]indent_member_initializer_list
使用可能な値:
true | false
例:
true |
|---|
class C
{
C(int x)
: y(x)
{
}
int y;
};
|
false |
|---|
class C
{
C(int x)
: y(x)
{
}
int y;
};
|
型の後に関数定義または宣言が折り返された場合にインデントする
プロパティ名:
[resharper_]cpp_indent_wrapped_function_names, [resharper_]indent_wrapped_function_names
使用可能な値:
true | false
例:
true |
|---|
void
foo()
{
}
|
false |
|---|
void
foo()
{
}
|
'switch' から 'case' をインデント
プロパティ名:
[resharper_]cpp_indent_switch_labels, [resharper_]indent_switch_labels
使用可能な値:
true | false
例:
true |
|---|
switch (expression)
{
case 0:
{
foo();
break;
}
}
|
false |
|---|
switch (expression)
{
case 0:
{
foo();
break;
}
}
|
関数宣言の丸括弧をインデントする
プロパティ名:
[resharper_]cpp_indent_method_decl_pars, [resharper_]indent_method_decl_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
void Method(
int parameter1,
int parameter2
);
|
outside |
|---|
void Method(
int parameter1,
int parameter2
);
|
outside_and_inside |
|---|
void Method(
int parameter1,
int parameter2
);
|
none |
|---|
void Method(
int parameter1,
int parameter2
);
|
メソッド呼び出しの丸括弧をインデントする
プロパティ名:
[resharper_]cpp_indent_invocation_pars, [resharper_]indent_invocation_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
Method(
parameter1,
parameter2
);
|
outside |
|---|
Method(
parameter1,
parameter2
);
|
outside_and_inside |
|---|
Method(
parameter1,
parameter2
);
|
none |
|---|
Method(
parameter1,
parameter2
);
|
ステートメント(if、while、for など)の丸括弧をインデントする
プロパティ名:
[resharper_]cpp_indent_statement_pars, [resharper_]indent_statement_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
inside |
|---|
if (
condition1 &&
condition2
)
return;
|
outside |
|---|
if (
condition1 &&
condition2
)
return;
|
outside_and_inside |
|---|
if (
condition1 &&
condition2
)
return;
|
none |
|---|
if (
condition1 &&
condition2
)
return;
|
プリプロセッサディレクティブをインデントする
プロパティ名:
[resharper_]cpp_indent_preprocessor_directives, [resharper_]indent_preprocessor_directives
使用可能な値:
none: インデントしないnormal: インデントdo_not_change: 変更しない
例:
none |
|---|
void sections()
{
#pragma omp sections
{
int x;
}
}
|
normal |
|---|
void sections()
{
#pragma omp sections
{
int x;
}
}
|
do_not_change |
|---|
void sections()
{
#pragma omp sections
{
int x;
}
}
|
C++ /CLI ジェネリクス制約をインデントする
プロパティ名:
[resharper_]cpp_indent_type_constraints, [resharper_]indent_type_constraints
使用可能な値:
true | false
例:
true |
|---|
generic<class T1>
class C1
where T1 : I1
{};
|
false |
|---|
generic<class T1>
class C1
where T1 : I1
{};
|
最初の列から始まるコメントをインデントする
プロパティ名:
[resharper_]cpp_indent_comment, [resharper_]indent_comment
使用可能な値:
true | false
例:
true |
|---|
namespace N
{
// Some comment
class C1
{
};
};
|
false |
|---|
namespace N
{
// Some comment
class C1
{
};
};
|
コードをコメントアウトするときは、最初の列にコメントを配置する
プロパティ名:
[resharper_]cpp_place_comments_at_first_column, [resharper_]place_comments_at_first_column
使用可能な値:
true | false
複数行構成要素を整列
宣言内の宣言子
プロパティ名:
[resharper_]cpp_align_multiple_declaration, [resharper_]align_multiple_declaration
使用可能な値:
true | false
例:
true |
|---|
int first,
second
|
false |
|---|
int first,
second
|
関数パラメーター
プロパティ名:
[resharper_]cpp_align_multiline_parameter, [resharper_]align_multiline_parameter
使用可能な値:
true | false
例:
true |
|---|
double average(double first,
double second);
|
false |
|---|
double average(double first,
double second);
|
呼び出し引数
プロパティ名:
[resharper_]cpp_align_multiline_argument, [resharper_]align_multiline_argument
使用可能な値:
true | false
例:
true |
|---|
object.method(first,
second);
|
false |
|---|
object.method(first,
second);
|
最初の引数を '(' でそろえる
プロパティ名:
[resharper_]cpp_align_first_arg_by_paren, [resharper_]align_first_arg_by_paren
使用可能な値:
true | false
例:
true |
|---|
object.method(
first,
second);
|
false |
|---|
object.method(
first,
second);
|
イニシャライザーリストの引数
プロパティ名:
[resharper_]cpp_align_multiline_expression_braces, [resharper_]align_multiline_expression_braces
使用可能な値:
true | false
例:
true |
|---|
int a[6] = {1, 2, 3
4, 5, 6};
|
false |
|---|
int a[6] = {1, 2, 3
4, 5, 6};
|
テンプレート宣言内のテンプレートパラメーター
プロパティ名:
[resharper_]cpp_align_multiline_type_parameter, [resharper_]align_multiline_type_parameter
使用可能な値:
true | false
例:
true |
|---|
template <typename K,
typename V>
struct map;
|
false |
|---|
template <typename K,
typename V>
struct map;
|
テンプレート引数
プロパティ名:
[resharper_]cpp_align_multiline_type_argument, [resharper_]align_multiline_type_argument
使用可能な値:
true | false
例:
true |
|---|
std::map<char*,
MyStruct> my_map;
|
false |
|---|
std::map<char*,
MyStruct> my_map;
|
クラス基本節の基底クラス
プロパティ名:
[resharper_]cpp_align_multiline_extends_list, [resharper_]align_multiline_extends_list
使用可能な値:
true | false
例:
true |
|---|
struct MyStruct : Base1,
Base2
{
};
|
false |
|---|
struct MyStruct : Base1,
Base2
{
};
|
メンバーイニシャライザーリスト内のメンバーイニシャライザー
プロパティ名:
[resharper_]cpp_align_multiline_ctor_init, [resharper_]align_multiline_ctor_init
使用可能な値:
true | false
例:
true |
|---|
struct MyStruct
{
MyStruct() : first(f),
second(s)
{
}
};
|
false |
|---|
struct MyStruct
{
MyStruct() : first(f),
second(s)
{
}
};
|
インデント解除されたコンマ
プロパティ名:
[resharper_]cpp_outdent_commas, [resharper_]outdent_commas
使用可能な値:
true | false
例:
true |
|---|
class Class<
T1
, T3> :
Base
, SomeInterface
{
void fooCall(
int firstParameter
, int secondParameter)
{
fooCall(
firstParameter
, secondParameter);
}
}
|
false |
|---|
class Class<
T1
, T3> :
Base
, SomeInterface
{
void fooCall(
int firstParameter
, int secondParameter)
{
fooCall(
firstParameter
, secondParameter);
}
}
|
?: 演算子
プロパティ名:
[resharper_]cpp_align_ternary, [resharper_]align_ternary
使用可能な値:
align_all: 位置合わせalign_not_nested: ネストされている場合を除いて整列するnone: 整列していない
例:
align_all |
|---|
int var = 56 + (cond1
? result1
: cond2
? result2
: result3);
|
align_not_nested |
|---|
int var = 56 + (cond1
? result1
: cond2
? result2
: result3);
|
none |
|---|
int var = 56 + (cond1
? result1
: cond2
? result2
: result3);
|
インデントを揃えた ?: 演算子
プロパティ名:
[resharper_]cpp_indent_aligned_ternary, [resharper_]indent_aligned_ternary
使用可能な値:
true | false
例:
true |
|---|
int var = 56 + (cond1
? result1
: cond2
? result2
: result3);
|
false |
|---|
int var = 56 + (cond1
? result1
: cond2
? result2
: result3);
|
チェーンメソッド呼び出し
プロパティ名:
[resharper_]cpp_align_multiline_calls_chain, [resharper_]align_multiline_calls_chain
使用可能な値:
true | false
例:
true |
|---|
struct X
{
X foo(X x)
{
x.foo()
.foo()
.foo();
}
};
|
false |
|---|
struct X
{
X foo(X x)
{
x.foo()
.foo()
.foo();
}
};
|
チェーンメソッド呼び出し内の「.」および「->」をインデント解除する
プロパティ名:
[resharper_]cpp_outdent_dots, [resharper_]outdent_dots
使用可能な値:
true | false
例:
true |
|---|
auto a =
MyVar
.SomeMethod()
->OtherMethod()
.ThirdMethod();
auto b = MyVar
.SomeMethod()
->OtherMethod()
.ThirdMethod();
|
false |
|---|
auto a =
MyVar
.SomeMethod()
->OtherMethod()
.ThirdMethod();
auto b = MyVar
.SomeMethod()
->OtherMethod()
.ThirdMethod();
|
連鎖バイナリ式
プロパティ名:
[resharper_]cpp_align_multiline_binary_expressions_chain, [resharper_]align_multiline_binary_expressions_chain
使用可能な値:
true | false
例:
true |
|---|
int var = 1
+ 2
+ 3;
|
false |
|---|
int var = 1
+ 2
+ 3;
|
類似のコードを列に整列する
隣接する行の列位置合わせを修正
プロパティ名:
[resharper_]cpp_int_align_fix_in_adjacent, [resharper_]int_align_fix_in_adjacent
使用可能な値:
true | false
代入
プロパティ名:
[resharper_]cpp_int_align_eq, [resharper_]int_align_eq
使用可能な値:
true | false
例:
true |
|---|
const char* x = "x";
SomeClass xxxxx = "xxxxx";
int xxx;
int& y = xxx;
|
false |
|---|
const char* x = "x";
SomeClass xxxxx = "xxxxx";
int xxx;
int& y = xxx;
|
宣言名
プロパティ名:
[resharper_]cpp_int_align_declaration_names, [resharper_]int_align_declaration_names
使用可能な値:
true | false
例:
true |
|---|
const char* x = "x";
SomeClass xxxxx = "xxxxx";
int xxx;
int& y = xxx;
|
false |
|---|
const char* x = "x";
SomeClass xxxxx = "xxxxx";
int xxx;
int& y = xxx;
|
列挙型イニシャライザー
プロパティ名:
[resharper_]cpp_int_align_enum_initializers, [resharper_]int_align_enum_initializers
使用可能な値:
true | false
例:
true |
|---|
enum class Direction
{
up = 0b00000001,
down = 0b00000010,
left = 0b00000100,
right = 0b00001000
};
|
false |
|---|
enum class Direction
{
up = 0b00000001,
down = 0b00000010,
left = 0b00000100,
right = 0b00001000
};
|
ビットフィールドのサイズ
プロパティ名:
[resharper_]cpp_int_align_bitfield_sizes, [resharper_]int_align_bitfield_sizes
使用可能な値:
true | false
例:
true |
|---|
struct C
{
int first : 1;
int second : 2;
};
|
false |
|---|
struct C
{
int first : 1;
int second : 2;
};
|
コメントの終了
プロパティ名:
[resharper_]cpp_int_align_comments, [resharper_]int_align_comments
使用可能な値:
true | false
例:
true |
|---|
void foo()
{
DoSomething(); // I'm
auto y = 6; // forced
while (y > 0) y--; // to
DoSomethingElse(); /* document */
auto z = 10; /* my code */
while (z < 100) z++; /* profusely */
}
|
false |
|---|
void foo()
{
DoSomething(); // I'm
auto y = 6; // forced
while (y > 0) y--; // to
DoSomethingElse(); /* document */
auto z = 10; /* my code */
while (z < 100) z++; /* profusely */
}
|