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_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02
\r
7 #define BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02
\r
9 #include <boost/program_options/config.hpp>
\r
14 namespace boost { namespace program_options {
\r
16 /** Describes positional options.
\r
18 The class allows to guess option names for positional options, which
\r
19 are specified on the command line and are identified by the position.
\r
20 The class uses the information provided by the user to associate a name
\r
21 with every positional option, or tell that no name is known.
\r
23 The primary assumption is that only the relative order of the
\r
24 positional options themselves matters, and that any interleaving
\r
25 ordinary options don't affect interpretation of positional options.
\r
27 The user initializes the class by specifying that first N positional
\r
28 options should be given the name X1, following M options should be given
\r
29 the name X2 and so on.
\r
31 class BOOST_PROGRAM_OPTIONS_DECL positional_options_description {
\r
33 positional_options_description();
\r
35 /** Species that up to 'max_count' next positional options
\r
36 should be given the 'name'. The value of '-1' means 'unlimited'.
\r
37 No calls to 'add' can be made after call with 'max_value' equal to
\r
40 positional_options_description&
\r
41 add(const char* name, int max_count);
\r
43 /** Returns the maximum number of positional options that can
\r
44 be present. Can return (numeric_limits<unsigned>::max)() to
\r
45 indicate unlimited number. */
\r
46 unsigned max_total_count() const;
\r
48 /** Returns the name that should be associated with positional
\r
49 options at 'position'.
\r
50 Precondition: position < max_total_count()
\r
52 const std::string& name_for_position(unsigned position) const;
\r
55 // List of names corresponding to the positions. If the number of
\r
56 // positions is unlimited, then the last name is stored in
\r
58 std::vector<std::string> m_names;
\r
59 std::string m_trailing;
\r