Chris@16: // Copyright Vladimir Prus 2004. Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt Chris@16: // or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_OPTION_HPP_VP_2004_02_25 Chris@16: #define BOOST_OPTION_HPP_VP_2004_02_25 Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace program_options { Chris@16: Chris@16: /** Option found in input source. Chris@16: Contains a key and a value. The key, in turn, can be a string (name of Chris@16: an option), or an integer (position in input source) -- in case no name Chris@16: is specified. The latter is only possible for command line. Chris@16: The template parameter specifies the type of char used for storing the Chris@16: option's value. Chris@16: */ Chris@16: template Chris@16: class basic_option { Chris@16: public: Chris@16: basic_option() Chris@16: : position_key(-1) Chris@16: , unregistered(false) Chris@16: , case_insensitive(false) Chris@16: {} Chris@16: basic_option(const std::string& xstring_key, Chris@16: const std::vector< std::string> &xvalue) Chris@16: : string_key(xstring_key) Chris@16: , value(xvalue) Chris@16: , unregistered(false) Chris@16: , case_insensitive(false) Chris@16: {} Chris@16: Chris@16: /** String key of this option. Intentionally independent of the template Chris@16: parameter. */ Chris@16: std::string string_key; Chris@16: /** Position key of this option. All options without an explicit name are Chris@16: sequentially numbered starting from 0. If an option has explicit name, Chris@16: 'position_key' is equal to -1. It is possible that both Chris@16: position_key and string_key is specified, in case name is implicitly Chris@16: added. Chris@16: */ Chris@16: int position_key; Chris@16: /** Option's value */ Chris@16: std::vector< std::basic_string > value; Chris@16: /** The original unchanged tokens this option was Chris@16: created from. */ Chris@16: std::vector< std::basic_string > original_tokens; Chris@16: /** True if option was not recognized. In that case, Chris@16: 'string_key' and 'value' are results of purely Chris@16: syntactic parsing of source. The original tokens can be Chris@16: recovered from the "original_tokens" member. Chris@16: */ Chris@16: bool unregistered; Chris@16: /** True if string_key has to be handled Chris@16: case insensitive. Chris@16: */ Chris@16: bool case_insensitive; Chris@16: }; Chris@16: typedef basic_option option; Chris@16: typedef basic_option woption; Chris@16: Chris@16: }} Chris@16: Chris@16: #endif