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_OPTION_HPP_VP_2004_02_25
\r
7 #define BOOST_OPTION_HPP_VP_2004_02_25
\r
9 #include <boost/program_options/config.hpp>
\r
14 namespace boost { namespace program_options {
\r
16 /** Option found in input source.
\r
17 Contains a key and a value. The key, in turn, can be a string (name of
\r
18 an option), or an integer (position in input source) -- in case no name
\r
19 is specified. The latter is only possible for command line.
\r
20 The template parameter specifies the type of char used for storing the
\r
23 template<class charT>
\r
24 class basic_option {
\r
28 , unregistered(false)
\r
29 , case_insensitive(false)
\r
31 basic_option(const std::string& string_key,
\r
32 const std::vector< std::string> &value)
\r
33 : string_key(string_key)
\r
35 , unregistered(false)
\r
36 , case_insensitive(false)
\r
39 /** String key of this option. Intentionally independent of the template
\r
41 std::string string_key;
\r
42 /** Position key of this option. All options without an explicit name are
\r
43 sequentially numbered starting from 0. If an option has explicit name,
\r
44 'position_key' is equal to -1. It is possible that both
\r
45 position_key and string_key is specified, in case name is implicitly
\r
49 /** Option's value */
\r
50 std::vector< std::basic_string<charT> > value;
\r
51 /** The original unchanged tokens this option was
\r
53 std::vector< std::basic_string<charT> > original_tokens;
\r
54 /** True if option was not recognized. In that case,
\r
55 'string_key' and 'value' are results of purely
\r
56 syntactic parsing of source. The original tokens can be
\r
57 recovered from the "original_tokens" member.
\r
60 /** True if string_key has to be handled
\r
63 bool case_insensitive;
\r
65 typedef basic_option<char> option;
\r
66 typedef basic_option<wchar_t> woption;
\r