astyle 是个好工具
From: xuyibo.net Date: 2012-01-06 04:06 PM
刚下载最新版本astyle,发现otbs样式正是自己的编码风格,这下爽了。
--style=1tbs / --style=otbs / -A10
"One True Brace Style" formatting/indenting uses linux brackets and adds brackets to unbracketed one line conditional statements. In the following example brackets have been added to the "return 0;" statement. The option ‑‑add‑one‑line‑brackets can also be used with this style.
int Foo(bool isBar) { if (isFoo) { bar(); return 1; } else { return 0; } }
批处理命令:for /R %%i in (*.cpp;*.c;*.h) do astyle --style=1tbs "%%i"
附件:astyle.zip