Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class template basic_option

boost::program_options::basic_option

Synopsis

// In header: <boost/program_options/option.hpp>

template<typename charT> 
class basic_option {
public:
  // construct/copy/destruct
  basic_option();
  basic_option(const std::string &, const std::vector< std::string > &);

  // public data members
  std::string string_key;
  int position_key;
  std::vector< std::basic_string< charT > > value;
  std::vector< std::basic_string< charT > > original_tokens;
  bool unregistered;
  bool case_insensitive;
};

Description

Option found in input source. Contains a key and a value. The key, in turn, can be a string (name of an option), or an integer (position in input source) <ndash></ndash> in case no name is specified. The latter is only possible for command line. The template parameter specifies the type of char used for storing the option's value.

basic_option public construct/copy/destruct

  1. basic_option();
  2. basic_option(const std::string & xstring_key, 
                 const std::vector< std::string > & xvalue);

basic_option public public data members

  1. std::string string_key;

    String key of this option. Intentionally independent of the template parameter.

  2. int position_key;

    Position key of this option. All options without an explicit name are sequentially numbered starting from 0. If an option has explicit name, 'position_key' is equal to -1. It is possible that both position_key and string_key is specified, in case name is implicitly added.

  3. std::vector< std::basic_string< charT > > value;

    Option's value

  4. std::vector< std::basic_string< charT > > original_tokens;

    The original unchanged tokens this option was created from.

  5. bool unregistered;

    True if option was not recognized. In that case, 'string_key' and 'value' are results of purely syntactic parsing of source. The original tokens can be recovered from the "original_tokens" member.

  6. bool case_insensitive;

    True if string_key has to be handled case insensitive.


PrevUpHomeNext