Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/program_options/cmdline.hpp @ 46

Last change on this file since 46 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.3 KB
Line 
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
9namespace 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        /// Alow "-<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 options.
66            @todo Should this apply to long options only?
67        */           
68        case_insensitive = allow_guessing << 1,
69        /** Allow long options with single option starting character,
70            e.g <tt>-foo=10</tt>
71        */
72        allow_long_disguise = case_insensitive << 1,
73        /** The more-or-less traditional unix style. */
74        unix_style = (allow_short | short_allow_adjacent | short_allow_next
75                      | allow_long | long_allow_adjacent | long_allow_next
76                      | allow_sticky | allow_guessing
77                      | allow_dash_for_short),
78        /** The default style. */
79        default_style = unix_style
80    };
81}}}
82
83
84#endif
85
Note: See TracBrowser for help on using the repository browser.