3

uncrustify 0.56を使用していますが、次のようなコンストラクターをフォーマットできるかどうかを知りたいです。

MyClass::MyClass(int arg1, int arg2, int arg3) : m_arg1(arg1), m_arg2(arg2), m_arg3(arg3) {}

// shall be formatted to

MyClass::MyClass(int arg1, int arg2, int arg3) : 
   m_arg1(arg1), 
   m_arg2(arg2), 
   m_arg3(arg3)
{
}

オプションが見つかりませんでした。これは可能ですか、それともこの種のフォーマットを実現するための別のコードビューティファー/ツールがありますか?

前もって感謝します ...

4

1 に答える 1

3

Uncrustify 0.59:

# Whether to indent the stuff after a leading class colon.
# The term "class colon" refers to both 'class Dog: public Animal'
#                                                 ^
# and 'Dog::Dog(): Animal(), _fur(BLACK)'.
#                ^
indent_class_colon = true

# Add or remove a newline around a class colon.
# Related to <pos_class_colon>, <nl_class_init_args>, and <pos_comma>.
nl_class_colon     = force

# Add or remove newline after each ',' in the constructor member initialization.
nl_class_init_args = force

Currently, Uncrustify is the most flexible and configurable beast that I am aware of. I've tried tones of different code formatters in the past, including non-free ones. However, I found them to be either lacking some vital options or containing nasty bugs, these include: built-in code formatter of Eclipse CDT, AStyle, Jindent, and some others.

于 2012-12-22T15:25:26.063 に答える