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_OPTION_HPP_VP_2004_02_25
0007 #define BOOST_OPTION_HPP_VP_2004_02_25
0008 
0009 #include <boost/program_options/config.hpp>
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 namespace boost { namespace program_options {
0015 
0016     /** Option found in input source.
0017         Contains a key and a value. The key, in turn, can be a string (name of
0018         an option), or an integer (position in input source) \-- in case no name
0019         is specified. The latter is only possible for command line.
0020         The template parameter specifies the type of char used for storing the
0021         option's value.
0022     */
0023     template<class charT>
0024     class basic_option {
0025     public:
0026         basic_option() 
0027         : position_key(-1)
0028         , unregistered(false) 
0029         , case_insensitive(false)
0030         {}
0031         basic_option(const std::string& xstring_key, 
0032                const std::vector< std::string> &xvalue)
0033         : string_key(xstring_key)
0034         , position_key(-1)
0035         , value(xvalue)
0036         , unregistered(false)
0037         , case_insensitive(false)
0038         {}
0039 
0040         /** String key of this option. Intentionally independent of the template
0041             parameter. */
0042         std::string string_key;
0043         /** Position key of this option. All options without an explicit name are
0044             sequentially numbered starting from 0. If an option has explicit name,
0045             'position_key' is equal to -1. It is possible that both
0046             position_key and string_key is specified, in case name is implicitly
0047             added.
0048          */
0049         int position_key;
0050         /** Option's value */
0051         std::vector< std::basic_string<charT> > value;
0052         /** The original unchanged tokens this option was
0053             created from. */
0054         std::vector< std::basic_string<charT> > original_tokens;
0055         /** True if option was not recognized. In that case,
0056             'string_key' and 'value' are results of purely
0057             syntactic parsing of source. The original tokens can be
0058             recovered from the "original_tokens" member.
0059         */
0060         bool unregistered;
0061         /** True if string_key has to be handled
0062             case insensitive.
0063         */
0064         bool case_insensitive;
0065     };
0066     typedef basic_option<char> option;
0067     typedef basic_option<wchar_t> woption;
0068 
0069 }}
0070 
0071 #endif