Artistic Style使用说明

来源:互联网 发布:java中什么是类 编辑:程序博客网 时间:2024/05/18 17:41
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 files
mode=c
# brackets should be attached to pre-bracket lines
brackets=break
# set 6 spaces per indent
indent=spaces=4
# indent switch blocks
indent-switches
# suffix of original files should be .pre
suffix=.pre
#Add extra indentation to namespace blocks
indent-namespaces
max-instatement-indent=80
min-conditional-indent=0
pad=oper