Artistic Style是一个 C,C++,C#,JAVA的源代码格式化,美观化的工具。可以到sourceforge.net上下载,它是一个开源工具。地址是“http://sourceforge.net/projects/astyle”。
下载的
Artistic Style windows
版本的包里带有exe文件。也可以使用visual studio .net 2003或2005编译。这个工具是一个命令行的工具。
命令行格式如下:
astyle [options] SourceFile1.cpp SourceFile2.cpp SourceFile3.cpp [ . . . ]
例如:astyle --options=c.opt foo.cpp
--options=命令行选项指定了选项文件。
这是我用的options文件:style=ansi# set default parsing to c/cpp filesmode=c# brackets should be attached to pre-bracket linesbrackets=break# set 6 spaces per indentindent=spaces=4# indent switch blocksindent-switches# suffix of original files should be .presuffix=.pre#Add extra indentation to namespace blocksindent-namespacesmax-instatement-indent=80min-conditional-indent=0pad=oper