1 // Copyright Vladimir Prus 2004. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt 4 // or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #ifndef BOOST_CMDLINE_HPP_VP_2004_03_13 7 #define BOOST_CMDLINE_HPP_VP_2004_03_13 8 9 namespace boost { namespace program_options { namespace command_line_style { 10 /** Various possible styles of options. 11 12 There are "long" options, which start with "--" and "short", 13 which start with either "-" or "/". Both kinds can be allowed or 14 disallowed, see allow_long and allow_short. The allowed character 15 for short options is also configurable. 16 17 Option's value can be specified in the same token as name 18 ("--foo=bar"), or in the next token. 19 20 It's possible to introduce long options by the same character as 21 short options, see allow_long_disguise. 22 23 Finally, guessing (specifying only prefix of option) and case 24 insensitive processing are supported. 25 */ 26 enum style_t { 27 /// Allow "--long_name" style 28 allow_long = 1, 29 /// Allow "-<single character" style 30 allow_short = allow_long << 1, 31 /// Allow "-" in short options 32 allow_dash_for_short = allow_short << 1, 33 /// Allow "/" in short options 34 allow_slash_for_short = allow_dash_for_short << 1, 35 /** Allow option parameter in the same token 36 for long option, like in 37 @verbatim 38 --foo=10 39 @endverbatim 40 */ 41 long_allow_adjacent = allow_slash_for_short << 1, 42 /** Allow option parameter in the next token for 43 long options. */ 44 long_allow_next = long_allow_adjacent << 1, 45 /** Allow option parameter in the same token for 46 short options. */ 47 short_allow_adjacent = long_allow_next << 1, 48 /** Allow option parameter in the next token for 49 short options. */ 50 short_allow_next = short_allow_adjacent << 1, 51 /** Allow to merge several short options together, 52 so that "-s -k" become "-sk". All of the options 53 but last should accept no parameter. For example, if 54 "-s" accept a parameter, then "k" will be taken as 55 parameter, not another short option. 56 Dos-style short options cannot be sticky. 57 */ 58 allow_sticky = short_allow_next << 1, 59 /** Allow abbreviated spellings for long options, 60 if they unambiguously identify long option. 61 No long option name should be prefix of other 62 long option name if guessing is in effect. 63 */ 64 allow_guessing = allow_sticky << 1, 65 /** Ignore the difference in case for long options. 66 */ 67 long_case_insensitive = allow_guessing << 1, 68 /** Ignore the difference in case for short options. 69 */ 70 short_case_insensitive = long_case_insensitive << 1, 71 /** Ignore the difference in case for all options. 72 */ 73 case_insensitive = (long_case_insensitive | short_case_insensitive), 74 /** Allow long options with single option starting character, 75 e.g <tt>-foo=10</tt> 76 */ 77 allow_long_disguise = short_case_insensitive << 1, 78 /** The more-or-less traditional unix style. */ 79 unix_style = (allow_short | short_allow_adjacent | short_allow_next 80 | allow_long | long_allow_adjacent | long_allow_next 81 | allow_sticky | allow_guessing 82 | allow_dash_for_short), 83 /** The default style. */ 84 default_style = unix_style 85 }; 86 }}} 87 88 89 #endif 90 91