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_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02 Chris@16: #define BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02 Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if defined(BOOST_MSVC) Chris@16: # pragma warning (push) Chris@16: # pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description' Chris@16: #endif Chris@16: Chris@16: namespace boost { namespace program_options { Chris@16: Chris@16: /** Describes positional options. Chris@16: Chris@16: The class allows to guess option names for positional options, which Chris@16: are specified on the command line and are identified by the position. Chris@16: The class uses the information provided by the user to associate a name Chris@16: with every positional option, or tell that no name is known. Chris@16: Chris@16: The primary assumption is that only the relative order of the Chris@16: positional options themselves matters, and that any interleaving Chris@16: ordinary options don't affect interpretation of positional options. Chris@16: Chris@16: The user initializes the class by specifying that first N positional Chris@16: options should be given the name X1, following M options should be given Chris@16: the name X2 and so on. Chris@16: */ Chris@16: class BOOST_PROGRAM_OPTIONS_DECL positional_options_description { Chris@16: public: Chris@16: positional_options_description(); Chris@16: Chris@16: /** Species that up to 'max_count' next positional options Chris@16: should be given the 'name'. The value of '-1' means 'unlimited'. Chris@16: No calls to 'add' can be made after call with 'max_value' equal to Chris@16: '-1'. Chris@16: */ Chris@16: positional_options_description& Chris@16: add(const char* name, int max_count); Chris@16: Chris@16: /** Returns the maximum number of positional options that can Chris@16: be present. Can return (numeric_limits::max)() to Chris@16: indicate unlimited number. */ Chris@16: unsigned max_total_count() const; Chris@16: Chris@16: /** Returns the name that should be associated with positional Chris@16: options at 'position'. Chris@16: Precondition: position < max_total_count() Chris@16: */ Chris@16: const std::string& name_for_position(unsigned position) const; Chris@16: Chris@16: private: Chris@16: // List of names corresponding to the positions. If the number of Chris@16: // positions is unlimited, then the last name is stored in Chris@16: // m_trailing; Chris@16: std::vector m_names; Chris@16: std::string m_trailing; Chris@16: }; Chris@16: Chris@16: }} Chris@16: Chris@16: #if defined(BOOST_MSVC) Chris@16: # pragma warning (pop) Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: