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