|
http://www.jindent.com |
Previous: Switch-Case
|
Next: Try/Catch
|
| Brace style for enumeration declarations |

| Left brace { new line |
|
enum Season { ... |
|
enum Season { ... |
| Right brace } new line |
| Indent left brace { |
|
enum·Season ····{ ····... |
|
enum·Season { ... |
|
enum·Season·{ ... |
|
enum·Season{ ... |
| Indent right brace } |
|
enum·Season ····{ ····... ····} |
|
enum·Season { ····... } |
| Indent after right brace } |
| Cuddle braces of empty blocks {} |
|
enum Season {} |
|
enum Season { } |
| Indent cuddled braces {} |
|
enum·Season{} |
|
enum·Season·{} |
| Prohibit blank lines after left brace { |
|
enum Season { ¶ // comment with a preceding blank line WINTER, SPRING, SUMMER, FALL; ¶ // another comment ... } |
|
enum Season { // comment with a preceding blank line WINTER, SPRING, SUMMER, FALL; ¶ // another comment ... } |
|
See also: | Jindent - Settings - Formatter - C / C++ - Blank Lines - Comments , Jindent - Settings - Formatter - C / C++ - Blank Lines |
| If number of lines in body is at least ... then insert blank line after { |
|
enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ enum Color { RED,GREEN,BLUE, // comment ORANGE, BLACK, // comment BROWN, MAGENTA } |
Season looks fine,
but enumeration Color seems to be formatted too close:
The enumeration head enum Color { and the first elements declaration
RED,GREEN,BLUE; are connected too close and could cause confusion.
|
enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ enum Color { ¶ RED,GREEN,BLUE, // comment ORANGE, BLACK, // comment BROWN, MAGENTA } |
Color seems to be much clearer and
enumeration Season is still formatted as before.|
enum Season { ¶ WINTER,SPRING,SUMMER,FALL; } ¶ enum Color { ¶ RED,GREEN,BLUE, // comment ORANGE, BLACK, // comment BROWN, MAGENTA } |
infinite.| If number of lines in body is at least ... then insert blank line before } |
|
enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ enum Color { ¶ RED,GREEN,BLUE, // comment ORANGE, BLACK, // comment BROWN, MAGENTA ¶ } |
| Do not insert blank line before single left brace |
|
See also: | Jindent - Settings - Formatter - C / C++ - Braces Style - Presets |