📄 astyle.html
字号:
</pre> <p>becomes (with larger value):</p> <pre>fooArray[] = <span class="brace">{</span> red, green, blue <span class="brace">}</span>;fooFunction(barArg1, barArg2, barArg3);</pre> </div> <p> </p> <p id="_min-conditional-indent"> <code class="title">--min-conditional-indent=<span class="option">#</span> / -m<span class="option">#</span></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 <span class="option">#</span> 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=<span class="option">8</span></code></strong>).</p> <div class="code"> <pre><span class="comment">// default setting makes this non-bracketed code clear</span>if (a < b || c > d) foo++;<span class="comment">// but creates an exaggerated indent in this bracketed code</span>if (a < b || c > d)<span class="brace">{</span> foo++;<span class="brace">}</span></pre> <p>becomes (when setting <strong><code>--min-conditional-indent=<span class="option">0</span></code></strong>):</p> <pre><span class="comment">// setting makes this non-bracketed code less clear</span>if (a < b || c > d) foo++;<span class="comment">// but makes this bracketed code clearer</span>if (a < b || c > d)<span class="brace">{</span> foo++;<span class="brace">}</span></pre> </div> </div> <hr /> <!-- * * * * * * * * * * * * * Formatting Options * * * * * * * * * * * * * --> <h3 id="_Formatting_Options">Formatting Options</h3> <div class="options"> <p id="_break-blocks"><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="astyleX.html">Supplemental Documentation</a> before using this option.</p> <div class="code"> <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> </div> <p> </p> <p id="_break-blocks=all"><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="astyleX.html">Supplemental Documentation</a> before using this option.</p> <div class="code"> <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> </div> <p> </p> <p id="_break-elseifs"><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> <div class="code"> <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 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> </div> <p> </p> <p id="_pad=oper"><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> <div class="code"> <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> </div> <p> </p> <p id="_pad=paren"><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> <div class="code"> <pre>if (isFoo(a, b)) bar(a, b);</pre> <p>becomes:</p> <pre>if ( isFoo ( a, b ) ) bar ( a, b );</pre> </div> <p> </p> <p id="_pad=paren-out"><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> <div class="code"> <pre>if (isFoo(a, b)) bar(a, b);</pre> <p>becomes:</p> <pre>if (isFoo (a, b) ) bar (a, b);</pre> </div> <p> </p> <p id="_pad=paren-in"><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> <div class="code"> <pre>if (isFoo(a, b)) bar(a, b);</pre> <p>becomes:</p> <pre>if ( isFoo( a, b ) ) bar( a, b );</pre> </div> <p> </p> <p id="_unpad=paren"><code class="title">--unpad=paren / -U</code><br /> Remove extra space padding around parenthesis on the inside and outside. Can be used in combination with the paren padding options <code>pad=paren-out</code> and <code>pad=paren-in</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>unpad=paren</code> to remove the outside padding, and <code>pad=paren-in</code> to retain the inside padding. Using only <code>pad=paren-in</code> would not remove the outside padding.</p> <div class="code"> <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> </div> <p> </p> <p id="_one-line=keep-statements"><code class="title">--one-line=keep-statements / -o</code><br /> Don't break complex statements and multiple statements residing on a single line.</p> <div class="code"> <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> </div> <p> </p> <p id="_one-line=keep-blocks"><code class="title">--one-line=keep-blocks / -O</code><br /> Don't break one-line blocks.</p> <div class="code"> <pre>if (isFoo)<span class="brace">{</span> isFoo = false; cout << isFoo << endl; <span class="brace">}</span></pre> <p>remains as is.</p> </div> <p> </p> <p id="_convert-tabs"><code class="title">--convert-tabs / -c</code><br /> Converts tabs into single spaces.</p> <p> </p> <p id="_fill-empty-lines"><code class="title">--fill-empty-lines / -E</code><br /> Fill empty lines with the white space of the previous line.</p> <p> </p> <p id="_mode=c"><code class="title">--mode=c</code><br /> Indent a C or C++ file. The option is usually set from the file extension for each file. You can override the setting with this entry. It will be used for all files regardless of the file extension. It allows the formatter to identify language specific syntax such as C++ classes, templates, and keywords.</p> <p id="_mode=java"><code class="title">--mode=java</code><br /> Indent a Java file. The option is usually set from the file extension for each file. You can override the setting with this entry. It will be used for all files regardless of the file extension. It allows the formatter to identify language specific syntax such as Java class's keywords.</p> <p id="_mode=cs"><code class="title">--mode=cs</code><br /> Indent a C sharp file. The option is usually set from the file extension for each file. You can override the setting with this entry. It will be used for all files regardless of the file extension. It allows the formatter to identify language specific syntax such as C sharp classes and keywords.</p> </div> <hr /> <!-- * * * * * * * * * * * * * Other Options * * * * * * * * * * * * * --> <h3 id="_Other_Options">Other Options</h3> <div class="options"> <p id="_suffix"><code class="title">--suffix=<span class="option">####</span></code><br /> Append the suffix <span class="option">####</span> instead of '.orig' to original filename (e.g. <code>--suffix=<span class="option">.bak</span></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 id="_suffix=none"><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 id="_options"> <code class="title">--options=<span class="option">####</span></code><br /> Specify an options file <span class="option">####</span> to read and use.</p> <p id="_options=none"><code class="title">--options=none</code><br /> Disable the default options file. Only the command-line parameters will be used.</p> <p id="_recursive"><code class="title">--recursive / -r / -R</code><br /> For each directory in the command line, process all subdirectories recursively. When using the recursive option the file name statement should contain a wildcard. Linux users should place the filepath and name in double quotes so the shell will not resolve the wildcards (e.g. "$HOME/src/*.cpp"). Windows users should place the filepath and name in double quotes if the path or name contains spaces.</p> <p id="_exclude"> <code class="title">--exclude=<span class="option">####</span></code><br /> Specify a file or sub directory <span class="option">####</span> to be excluded from processing. </p> <p>Excludes are matched from the end of the filepath. An exclude option of "templates" will exclude ALL directories named "templates". An exclude option of "cpp/templates" will exclude ALL "cpp/templates" directories. You may proceed backwards in the directory tree to exclude only the required directories.</p> <p>Specific files may be excluded in the same manner. An exclude option of "default.cpp" will exclude ALL files named "default.cpp". An exclude option of "python/default.cpp" will exclude ALL files named "default.cpp" contained in a "python" subdirectory. You may proceed backwards in the directory tree to exclude only the required files.</p> <p>Wildcards are NOT allowed. There may be more than one exclude statement. The filepath and name may be placed in double quotes (e.g. ‑‑exclude="foo bar.cpp").</p> <p id="_errors-to-stdout"><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 id="_preserve-date"><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 id="_verbose"><code class="title">--verbose / -v</code><br /> Verbose mode. Display optional information, such as release number and statistical data.</p> <p id="_quiet"><code class="title">--quiet / -q</code><br /> Quiet mode. Suppress all output except error messages.</p> <p id="_version"><code class="title">--version / -V</code><br /> Print version number and quit. The short option must be by itself, it cannot be concatenated with other options.</p> <p id="_help"><code class="title">--help / -h / -?</code><br /> Print a help message and quit. The short option must be by itself, it cannot be concatenated with other options.</p> </div> <hr /> <center> <h2>ENJOY !!!</h2> </center> <p> </p><!-- CUT HERE FOR INSERTION INTO SOURCEFORGE DOC MANAGER --> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -