格式化构造构件成员初始化,不稳定
Format constructor member initialization with 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)
{
}
我找不到任何选择。这可能是可能的还是其他代码美化/工具可以实现这种格式?
预先感谢...
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
当前,Uncrustify
是我知道的最灵活和可配置的野兽。过去,我已经尝试了不同代码格式器的音调,包括非免费代码。但是,我发现它们要么缺少一些重要的选择或包含讨厌的错误,其中包括:Eclipse CDT,Astyle,Jindent等的内置代码格式。
相关文章:
- 内部结构初始化不起作用 - C++
- 初始化不是整数的巨大常量多维数组的最佳方法是什么?
- C++ 类型 'complex<double>' 中类中的复杂初始化不提供调用运算符
- 有没有办法初始化不涉及编写构造函数的新结构变量?
- 如何初始化不是静态的const成员
- 当INT初始化为浮动点值时,为什么填充初始化不会给出错误
- C++:unique_ptr初始化不正确
- 初始化不能从const char [3]转换为std :: string *
- 聚合初始化不支持构造函数访问
- 静态初始化不安全调用的线程安全
- 使用初始化列表的 POD 类型初始化不起作用
- C++:如何初始化不是整型的静态成员变量
- 初始化不正确的价值不良样式后,正在抛出异常
- C++11 数组初始化不会调用复制构造函数
- POD变量的直接初始化不起作用,但当将变量推到向量上时,复制初始化起作用
- 一堆变量正在取消初始化.不知道该怎么办
- 是否可以保证静态初始化不会覆盖显式初始化的值
- 静态初始化不使用_initterm而是使用 _Init_thread_header() / footer() 代替
- GCC 4.8.1 中的C++11:复制构造函数的列表初始化不起作用
- 在C++14中,对浮点变量进行双重赋值的统一初始化不会产生缩小错误