首页 > 其他分享 >AStyle配置简介

AStyle配置简介

时间:2022-11-21 12:34:23浏览次数:36  
标签:indent brackets ## 简介 配置 -- AStyle .## 大括号

转自:https://www.cnblogs.com/vonly/p/13853169.html

#### 大括号三种基本风格:

## attach:大括号前一个与上一行在同一行(java)
## break:大括号与前一块隔开为两行 (allman,bsd)
## linux:大括号在class,namespace,function分行,其他不分行(K&R,linux)
## --brackets=attach OR  -a 大括号前一个与上一行在同一行 Attach brackets to pre-block code (i.e. Java style).
## --brackets=break  OR  -b 大括号与前一块隔开为两行  Break brackets from pre-block code (i.e. ANSI C/C++, allman, bsd style).
## --brackets=linux  OR  -l 定义块 和 函数块中的大括号都被处理 Break definition-block brackets and attach command-block brackets.(k/r, linux)
## --brackets=stroustrup  OR  -u  只处理函数中的大括号   Attach all brackets except function definition brackets.

 

#### 风格花括号Style定义(默认都不处理namespace, 默认都在语句和代码块后分行):

##  --style=allman or --style=bsd or -A1
##  --style=java or -A2
##  --style=k&r or  --style=k/r or -A3
##  --style=stroustrup or -A4
##  --style=whitesmith or -A5
##  --style=banner or -A6
##  --style=gnu or -A7
##  --style=linux or -A8

 

#### tab选项: 默认tab是4个空格.

## --indent=spaces=#  OR  -s#  默认行缩进为4个空格,可以将#替换为缩进量
s4
## --indent=tab  OR  --indent=tab=#  OR  -t  OR  -t#  行缩进用tab, 续行语句用空格
## --indent=force-tab=#  OR  -T#  行缩进用tab, 续行语句用也用tab
## --indent=force-tab-x OR --indent=force-tab-x=# OR -xT OR -xT#  比较复杂,不建议使用

#### 大括号选项: If no brackets option is set, the brackets will not be changed.
## --attach-namespaces / -xn  namespaces后的大括号不分行
## --attach-classes / -xc class后的大括号不分行
## --attach-inlines / -xl C++中定义的inlines函数的大括号不分行
## --attach-extern-c / -xk  C++中的extern "C" 后的大括号不分行
## --attach-closing-while / -xV  do while中的while条件不分行

 

#### 缩进选项:

## --indent-classes  OR  -C 缩进类定义中的public private protected标签.
## Indent 'class' blocks, so that the inner 'public:','protected:' and 'private: 
## headers are indented in relation to the class block.


##--indent-modifiers / -xG 类中的public private protected标签缩进改为1/2.
## Indent 'class ' and 'struct' access modifiers, 'public:', 'protected:' and 'private:', one half indent. 
## The rest of the class is not indented. This option is effective for C++ files only.
## If used with indent‑classes this option will be ignored.

 

## --indent-switches  OR  -S 缩进switch中的case块,case和switch不在同一列
## Indent 'switch' blocks, so that the inner 'case XXX:' headers are indented in relation to the switch block.
S


## --indent-cases  OR  -K 缩进case下面的语句
## Indent case blocks from the 'case XXX:' headers.
## Case statements not enclosed in blocks are NOT indented.
K


## --indent-blocks  OR  -G 缩进块, 包括大括号
## Add extra indentation entire blocks (including brackets).

 

## --indent-brackets  OR  -B 缩进大括号
## Add extra indentation to '{' and '}' block brackets.

 

## --indent-namespaces  OR  -N 缩进命名空间定义行
## Indent the contents of namespace blocks.

 

## --indent-labels  OR  -L 缩进标签
## Indent labels so that they appear one indent less than the current indentation level, 
## rather than being flushed completely to the left (which is the default).

 

## --indent-preprocessor  OR  -w 缩进多行宏定义
## Indent multi-line #define statements.

 

## --max-instatement-indent=#  OR  -M#   跨行缩进,比如函数定义中的参数处在多行,那么参数缩进到同一列
## Indent a maximal # spaces in a continuous statement, relative to the previous line.

 

## --min-conditional-indent=#  OR  -m#
## Indent a minimal # spaces in a continuous conditional belonging to a conditional header.

 


#### 格式化选项:

## --break-blocks  OR  -f   空行分隔没有关系的块,类,标签(不包括函数块)
## Insert empty lines around unrelated blocks, labels, classes, ...

 

## --break-blocks=all  OR  -F    空行分隔无关系的块,包括else catch等
## Like --break-blocks, 
## except also insert empty lines around closing headers (e.g. 'else', 'catch', ...).


## --break-closing-brackets  OR  -y   else catch左边的大括号与else catch分隔
## Break brackets before closing headers (e.g. 'else', 'catch', ...).
## Use with --brackets=attach, --brackets=linux, or --brackets=stroustrup.

 

## --break-elseifs  OR  -e  else if()分隔为两行
## Break 'else if()' statements into two different lines.

 

## --pad-comma / -xg 参数之间插入空格
## Insert space padding after commas. 


## --delete-empty-lines  OR  -x   删除多余空行
## Delete empty lines within a function or method.
## It will NOT delete lines added by the break-blocks options.

 

## --pad-oper  OR  -p    操作符两端插入一个空格
## Insert space paddings around operators.


## --pad-paren  OR  -P   括号内外都插入空格
## Insert space padding around parenthesis on both the outside and the inside.


## --pad-paren-out  OR  -d 括号外部插入空格

## Insert space padding around parenthesis on the outside only.


## --pad-paren-in  OR  -D 括号内部插入空格

## Insert space padding around parenthesis on the inside only.

 

## --pad-header / -H 在if for while 等条件语句中,(前增加空格
## Insert space padding between a header (e.g. 'if', 'for', 'while'...) and the following paren.


## --unpad-paren  OR  -U  移除括号两端多余空格
## Remove unnecessary space padding around parenthesis.  
## This can be used in combination with the 'pad' options above.

## --keep-one-line-statements  OR  -o  一行中的多个申明不分隔  int x;int y;int z 不被分为3行
## Don't break lines containing multiple statements into multiple single-statement lines.

## --keep-one-line-blocks  OR  -O  大括号中的单行语句不被拆分
## Don't break blocks residing completely on one line.

## --convert-tabs  OR  -c  tab转换为空格
## Convert tabs to the appropriate number of spaces.

## --fill-empty-lines  OR  -E  块间空行的换行符前插入一个空格
## Fill empty lines with the white space of their previous lines.

 

## --align-pointer=type   / -k1 指针对齐方式
## --align-pointer=middle / -k2 指针对齐方式
## --align-pointer=name   / -k3 指针对齐方式

## --align-reference=none   / -W0 引用对齐方式
## --align-reference=type   / -W1 引用对齐方式
## --align-reference=middle / -W2 引用对齐方式
## --align-reference=name   / -W3 引用对齐方式

## --add-braces / -j if,for, while 语句没有大括号就增加大括号
## Add braces to unbraced one line conditional statements (e.g. 'if', 'for', 'while'...).

## --add-one-line-braces / -J if,for, while 语句没有大括号就增加大括号,单语句不换行
## Add one line braces to unbraced one line conditional statements (e.g. 'if', 'for', 'while'...). 
## --remove-braces / -xj 删除if,for, while 单语句中的大括号
## Remove one line braces to unbraced one line conditional statements (e.g. 'if', 'for', 'while'...).

## --max-code-length=#   / -xC# 代码最长数,有效值为50-200
## The option max‑code‑length will break a line if the code exceeds # characters. The valid values are 50 thru 200. 

## --break-after-logical / -xL 逻辑代码中的,多个逻辑分行

## --mode=c    处理c文件
## Indent a C or C++ source file (this is the default).

 

## --mode=java 处理jave文件
## Indent a Java source file.

 

## --mode=cs   处理c#文件
## Indent a C# source file.

 

## 其他选项: 

## --suffix=#### 指定备份文件的后缀
## Append the suffix #### instead of '.orig' to original filename.

 

## --suffix=none OR -n 不备份文件
## Do not retain a backup of the original file.

## --options=#### 指定从####文件读取选项信息
## Specify an options file #### to read and use.

 

## --options=none 禁止从文件读取选项信息
## Disable the default options file.Only the command-line parameters will be used.

 

## --recursive OR -r OR -R 递归处理子目录
## Process subdirectories recursively.

 

## --exclude=#### 排除不处理的文件夹
## Specify a file or directory #### to be excluded from processing.

 

## --errors-to-stdout OR -X
## Print errors and help information to standard-output rather than to standard-error.

 

## --preserve-date OR -Z 不修改时间
## The date and time modified will not be changed in the formatted file.

## --verbose OR -v 输出详细处理信息
## Verbose mode. Extra informational messages will be displayed.

 

## --formatted OR -Q 输出信息中只包括被修改的文件信息
## Formatted display mode. Display only the files that have been formatted.

 

## --quiet OR -q 忽略所有错误
## Quiet mode. Suppress all output except error messages.

 

## --version OR -V 输出astyle版本
## Print version number.

 

## --help OR -h OR -? 帮助信息
## Print this help message.

 

## --lineend=windows / -z1  行尾\r\n
## --lineend=linux   / -z2  行尾\n
## --lineend=macold  / -z3  行尾\r

 

标签:indent,brackets,##,简介,配置,--,AStyle,.##,大括号
From: https://www.cnblogs.com/jh-fight-furture/p/16911052.html

相关文章

  • springboot配置多数据源
    最近在做一个换电站的项目需要用到多数据源,配置方法如下一:在yml文件里先把数据源信息配置好spring:application:name:base-serverdatasource:type:co......
  • vue 3.0 常用api 的简介
    vue3.0生命周期写法一和vue2.x一致区别在于(beforeUnmount、unmount)名称不一样写法二在setup中使用,需要引用如:import{onBeforeMount}from‘vue’Setup(){......
  • WGCLOUD v3.4.2 配置使用监测 MongoDB 教程
    WGCLOUD是一款高效轻量的运维平台它可以监测各种数据库的运行状态,如果出现连不上的情况,也会及时告警,比如SQLServer、Oracle、MySQL、PostgreSQL、Redis等,我们就看下它怎么......
  • 网卡配置文件
    TYPE=#设备类型,一般为Ethernet#使用ifconfig确认网卡的默认名称(ifconfig需安装net-tools)BOOTPROTO=#地址分配模式。static、DHCP、NAME=#网卡名称ONBOOT=#是否开机自......
  • 超级详细的Vue安装与配置教程
    原文: https://www.jb51.net/article/251371.htm超级详细的Vue安装与配置教程 Vue web前端三大主流框架之一,是一套用于构建用户界面的渐进式框架,下面这篇文章主要......
  • Prometheus监控之热加载更新配置
    在Prometheus的日常维护中,一定会对配置文件prometheus.yml进行再编辑操作,通常对Prometheus服务进行重启操作即可完成对配置文件的加载。当然也可以通过动态的热加载来......
  • Nacos配置管理-统一配置管理、配置自动刷新、多环境多服务共享配置
    目录​​一、Nacos统一配置管理​​​​二、配置自动刷新​​​​方式一:在@Value注入的变量所在类上添加注解@RefreshScope​​​​方式二:使用@ConfigurationProperties注解......
  • PyCharm、Python、Django安装以及环境变量配置
    开发Python有很多IDE工具,我选择了PyCharm工具,因为风格和AndroidStudio极其的相似,对于我来说这个工具很容易上手。一、PyCharmPyCharm官网下载地址:http://www.jetbrains.com/......
  • k8s:配置启动参数时,一个小小的技巧提示:参数是可以多次指定的,以最后指定的为准
    参数是可以多次指定的,以【最后】指定的为准!参数是可以多次指定的,以【最后】指定的为准!参数是可以多次指定的,以【最后】指定的为准!  例子:多次指定同一个参数,最后的配......
  • mediapipe + pyside2 在mac m1下的环境配置
    mediapipe1.需要安装homebrew,且需要安装在/usr/local(若安装到/opt/,则后续步骤会出错,原因不详)/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/maste......