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

source code of boost/boost/program_options/option.hpp