📄 astyle.html
字号:
<pre>fooArray[] = <span class="brace">{</span> red,
green,
blue <span class="brace">}</span>;
fooFunction(barArg1,
barArg2,
barArg3);
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--min-conditional-indent=<font color="purple">#</font>
/ -m<font color="purple">#</font></code><br>
Set the minimal indent that is added when a header is built of
multiple-lines. This indent makes helps to easily separate the header
from the command statements that follow.
The value for <font color="purple">#</font> must be less than <strong>40</strong>. The default setting for this
option is <strong>twice the current indent</strong> (e.g. <strong><code>
--min-conditional-indent=<font color="purple">8</font></code></strong>).</p>
<blockquote>
<pre><font color="#8080c0">// default setting makes this non-bracketed code clear</font>
if (a < b
|| c > d)
foo++;
<font color="#8080c0">// but creates an exaggerated indent in this bracketed code</font>
if (a < b
|| c > d)
<span class="brace">{</span>
foo++;
<span class="brace">}</span>
</pre>
<p>becomes (when setting <strong><code>--min-conditional-indent=<font
color="purple">0</font></code></strong>):</p>
<pre><font color="#8080c0">// setting makes this non-bracketed code less clear</font>
if (a < b
|| c > d)
foo++;
<font color="#8080c0">// but makes this bracketed code clearer</font>
if (a < b
|| c > d)
<span class="brace">{</span>
foo++;
<span class="brace">}</span>
</pre>
</blockquote>
</blockquote>
<hr>
<!-- * * * * * * * * * * * * * Formatting Options * * * * * * * * * * * * * -->
<h3>Formatting Options </h3>
<blockquote>
<p><code class="title">--break-blocks / -f</code><br>
Pad empty lines around header blocks (e.g. '<code>if</code>', '<code>while</code>'...).
Be sure to read the
<a href="file:///G:/USB/Projects/AStyle/doc/astyleX.html">Supplemental Documentation</a>
before using this option. </p>
<blockquote>
<pre>isFoo = true;
if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span> else <span class="brace">{</span>
anotherBar();
<span class="brace">}</span>
isBar = false;
</pre>
<p>becomes:</p>
<pre>isFoo = true;
if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span> else <span class="brace">{</span>
anotherBar();
<span class="brace">}</span>
isBar = false;
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--break-blocks=all / -F</code><br>
Pad empty lines around header blocks (e.g. '<code>if</code>', '<code>while</code>'...).
Treat closing header blocks (e.g. '<code>else</code>', '<code>catch</code>')
as stand-alone blocks. Be sure to read the
<a href="file:///G:/USB/Projects/AStyle/doc/astyleX.html">
Supplemental Documentation</a> before using this option. </p>
<blockquote>
<pre>isFoo = true;
if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span> else <span class="brace">{</span>
anotherBar();
<span class="brace">}</span>
isBar = false;
</pre>
<p>becomes:</p>
<pre>isFoo = true;
if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span> else <span class="brace">{</span>
anotherBar();
<span class="brace">}</span>
isBar = false;
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--break-elseifs / -e</code><br>
Break '<code>else if</code>' header combinations into separate lines.
This option has no effect if <code>one-line=keep-statements</code> is
used.
This option cannot be undone.</p>
<blockquote>
<pre>if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span>
else if (isFoo1()) <span class="brace">{</span>
bar1();
<span class="brace">}</span>
else if (isFoo2()) <span class="brace">}</span>
bar2;</span>
<span class="brace">}</span>
</pre>
<p>becomes:</p>
<pre>if (isFoo) <span class="brace">{</span>
bar();
<span class="brace">}</span>
else
if (isFoo1()) <span class="brace">{</span>
bar1();
<span class="brace"> }</span>
<span class="brace"> </span>else
if (isFoo2()) <span class="brace">{</span>
bar2();
<span class="brace"> }</span>
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--pad=oper / -p</code><br>
Insert space padding around operators. Operators inside block parens []
are <strong>not</strong> padded. Note that there is no option to unpad.
Once padded, they stay padded. </p>
<blockquote>
<pre>if (foo==2)
a=bar((b-c)*a,*d--);
</pre>
<p>becomes:</p>
<pre>if (foo == 2)
a = bar((b - c) * a, *d--);
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--pad=paren / -P</code><br>
Insert space padding around parenthesis on both the <strong>outside</strong>
and the <strong>inside</strong>.</p>
<blockquote>
<pre>if (isFoo(a, b))
bar(a, b);
</pre>
<p>becomes:</p>
<pre>if ( isFoo ( a, b ) )
bar ( a, b );
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--pad=paren-out / -d</code><br>
Insert space padding around parenthesis on the <strong>outside</strong>
only. This can be used with <code>unpad=paren</code> below to remove
unwanted spaces.</p>
<blockquote>
<pre>if (isFoo(a, b))
bar(a, b);
</pre>
<p>becomes:</p>
<pre>if (isFoo (a, b) )
bar (a, b);
</pre>
</blockquote>
<p><br>
</p>
<p><code class="title">--pad=paren-in / -D</code><br>
Insert space padding around parenthesis on the <strong>inside</strong>
only. This can be used with <code>unpad=paren</code> below to remove
unwanted spaces.</p>
<blockquote>
<pre>if (isFoo(a, b))
bar(a, b);
</pre>
<p>becomes:</p>
<pre>if ( isFoo( a, b ) )
bar( a, b );
</pre>
</blockquote>
<p><br></p>
<p><code class="title">--unpad=paren / -U</code><br>
Remove space padding around parenthesis on the inside and outside. Can
be used in combination with the paren padding options <code><nobr>
pad=paren-out</nobr></code> and <code><nobr>pad=paren-in</nobr></code> above. Only padding
that has not been requested by other options will be removed.</p>
<p>For example, if a source has parens padded on both the inside and
outside, and you want inside only. You need to use <code><nobr>unpad=paren</nobr></code> to remove
the outside padding, and <code><nobr>pad=paren-in</nobr></code> to retain the inside padding. Using
only <code><nobr>pad=paren-in</nobr></code> would not remove the outside padding.</p>
<blockquote>
<pre>if ( isFoo( a, b ) )
bar ( a, b );
</pre>
<p>becomes (with no padding option requested):</p>
<pre>if (isFoo(a, b))
bar(a, b);
</pre>
</blockquote>
<p><br></p>
<p><code class="title">--one-line=keep-statements / -o</code><br>
Don't break complex statements and multiple statements residing on a
single line. </p>
<blockquote>
<pre>if (isFoo)
<span class="brace">{</span>
isFoo = false; cout << isFoo << endl;
<span class="brace">}</span>
</pre>
<p>remains as is.</p>
<pre>if (isFoo) DoBar();
</pre>
<p>remains as is.</p>
</blockquote>
<p><br>
</p>
<p><code class="title">--one-line=keep-blocks / -O</code><br>
Don't break one-line blocks. </p>
<blockquote>
<pre>if (isFoo)
<span class="brace">{</span> isFoo = false; cout << isFoo << endl; <span
class="brace">}</span>
</pre>
<p>remains as is.</p>
</blockquote>
<p><br>
</p>
<p><code class="title">--convert-tabs / -V</code><br>
Converts tabs into single spaces. </p>
<p><br>
</p>
<p><code class="title">--fill-empty-lines / -E</code><br>
Fill empty lines with the white space of the previous line. </p>
<p><br>
</p>
<p><code class="title">--mode=c</code><br>
Indent a C or C++ file. The option is set from the file extension for
each file. You can override the setting with this entry. It allows the
formatter to identify language specific syntax such as C++ classes,
templates, and keywords. </p>
<p><code class="title">--mode=java</code><br>
Indent a Java file. The option is set from the file extension for each
file. You can override the setting with this entry. It allows the
formatter to identify language specific syntax such as Java classes keywords. </p>
<p><code class="title">--mode=cs</code><br>
Indent a C sharp file. The option is set from the file extension for
each file. You can override the setting with this entry. It allows the
formatter to identify language specific syntax such as C sharp classes
and keywords. </p>
</blockquote>
<hr>
<!-- * * * * * * * * * * * * * Other Options * * * * * * * * * * * * * -->
<h3>Other Options </h3>
<blockquote>
<p><code class="title">--suffix=<font color="purple">####</font></code><br>
Append the suffix <font color="purple">####</font> instead of '.orig' to
original filename (e.g. <code>--suffix=<font color="purple">.bak</font></code>).
If this is to be a file extension, the dot '.' must be included.
Otherwise the suffix will be appended to the current file extension.</p>
<p><code class="title">--suffix=none / -n</code><br>
Do not retain a backup of the original file. The original file is
purged after it is formatted.</p>
<p><code class="title">--options=<font color="purple">####</font></code><br>
Specify an options file <font color="purple">####</font> to read and
use. </p>
<p><code class="title">--options=none</code><br>
Disable the default options file. Only the command-line parameters will
be used. </p>
<p><code class="title">--errors-to-stdout / -X</code><br>
Print errors to standard-output rather than to standard-error.<br>
This option should be helpful for systems/shells that do not have this
option, such as in Windows95. </p>
<p><code class="title">--preserve-date / -Z</code><br>
Preserve the original file's date and time modified. The date and time
modified will not be changed in the formatted file. This option is not
effective if redirection is used.</p>
<p><code class="title">--version / -v</code><br>
Print version number. </p>
<p><code class="title">--help / -h / -?</code><br>
Print a help message and quit. </p>
</blockquote>
<hr>
<p> </p>
<h2 align="center">ENJOY !!!</h2>
<p> </p>
</blockquote>
<!-- CUT HERE FOR INSERTION INTO SOURCEFORGE DOC MANAGER -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -