Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:58:05

0001 // Copyright Vladimir Prus 2004.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // (See accompanying file LICENSE_1_0.txt
0004 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_CMDLINE_HPP_VP_2004_03_13
0007 #define BOOST_CMDLINE_HPP_VP_2004_03_13
0008 
0009 namespace boost { namespace program_options { namespace command_line_style {
0010     /** Various possible styles of options.
0011         
0012     There are "long" options, which start with "--" and "short",
0013     which start with either "-" or "/". Both kinds can be allowed or
0014     disallowed, see allow_long and allow_short. The allowed character
0015     for short options is also configurable.
0016 
0017     Option's value can be specified in the same token as name
0018     ("--foo=bar"), or in the next token.
0019 
0020     It's possible to introduce long options by the same character as
0021     short options, see allow_long_disguise.
0022 
0023     Finally, guessing (specifying only prefix of option) and case
0024     insensitive processing are supported.
0025     */
0026     enum style_t {
0027         /// Allow "--long_name" style
0028         allow_long = 1,
0029         /// Allow "-<single character" style
0030         allow_short = allow_long << 1,
0031         /// Allow "-" in short options
0032         allow_dash_for_short = allow_short << 1,
0033         /// Allow "/" in short options
0034         allow_slash_for_short = allow_dash_for_short << 1,
0035         /** Allow option parameter in the same token
0036             for long option, like in
0037             @verbatim
0038             --foo=10
0039             @endverbatim
0040         */
0041         long_allow_adjacent = allow_slash_for_short << 1,
0042         /** Allow option parameter in the next token for
0043             long options. */
0044         long_allow_next = long_allow_adjacent << 1,
0045         /** Allow option parameter in the same token for
0046             short options. */
0047         short_allow_adjacent = long_allow_next << 1,
0048         /** Allow option parameter in the next token for
0049             short options. */
0050         short_allow_next = short_allow_adjacent << 1,
0051         /** Allow to merge several short options together,
0052             so that "-s -k" become "-sk". All of the options
0053             but last should accept no parameter. For example, if
0054             "-s" accept a parameter, then "k" will be taken as
0055             parameter, not another short option. 
0056             Dos-style short options cannot be sticky.
0057         */
0058         allow_sticky = short_allow_next << 1,
0059         /** Allow abbreviated spellings for long options,
0060             if they unambiguously identify long option. 
0061             No long option name should be prefix of other 
0062             long option name if guessing is in effect.
0063         */
0064         allow_guessing = allow_sticky << 1,
0065         /** Ignore the difference in case for long options.
0066         */            
0067         long_case_insensitive = allow_guessing << 1,        
0068         /** Ignore the difference in case for short options.
0069         */            
0070         short_case_insensitive = long_case_insensitive << 1,
0071         /** Ignore the difference in case for all options.
0072         */        
0073         case_insensitive = (long_case_insensitive | short_case_insensitive),        
0074         /** Allow long options with single option starting character,
0075             e.g <tt>-foo=10</tt>
0076         */
0077         allow_long_disguise = short_case_insensitive << 1,
0078         /** The more-or-less traditional unix style. */
0079         unix_style = (allow_short | short_allow_adjacent | short_allow_next
0080                       | allow_long | long_allow_adjacent | long_allow_next
0081                       | allow_sticky | allow_guessing 
0082                       | allow_dash_for_short),
0083         /** The default style. */
0084         default_style = unix_style
0085     };
0086 }}}
0087 
0088 
0089 #endif
0090