|
||||
File indexing completed on 2025-01-18 09:50:15
0001 // Copyright Vladimir Prus 2004. 0002 // Distributed under the Boost Software License, Version 1.0. 0003 // (See accompanying file LICENSE_1_0.txt 0004 // or copy at http://www.boost.org/LICENSE_1_0.txt) 0005 0006 #ifndef BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02 0007 #define BOOST_PROGRAM_OPTIONS_POSITIONAL_OPTIONS_VP_2004_03_02 0008 0009 #include <boost/program_options/config.hpp> 0010 0011 #include <vector> 0012 #include <string> 0013 0014 #if defined(BOOST_MSVC) 0015 # pragma warning (push) 0016 # 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' 0017 #endif 0018 0019 namespace boost { namespace program_options { 0020 0021 /** Describes positional options. 0022 0023 The class allows to guess option names for positional options, which 0024 are specified on the command line and are identified by the position. 0025 The class uses the information provided by the user to associate a name 0026 with every positional option, or tell that no name is known. 0027 0028 The primary assumption is that only the relative order of the 0029 positional options themselves matters, and that any interleaving 0030 ordinary options don't affect interpretation of positional options. 0031 0032 The user initializes the class by specifying that first N positional 0033 options should be given the name X1, following M options should be given 0034 the name X2 and so on. 0035 */ 0036 class BOOST_PROGRAM_OPTIONS_DECL positional_options_description { 0037 public: 0038 positional_options_description(); 0039 0040 /** Species that up to 'max_count' next positional options 0041 should be given the 'name'. The value of '-1' means 'unlimited'. 0042 No calls to 'add' can be made after call with 'max_value' equal to 0043 '-1'. 0044 */ 0045 positional_options_description& 0046 add(const char* name, int max_count); 0047 0048 /** Returns the maximum number of positional options that can 0049 be present. Can return (numeric_limits<unsigned>::max)() to 0050 indicate unlimited number. */ 0051 unsigned max_total_count() const; 0052 0053 /** Returns the name that should be associated with positional 0054 options at 'position'. 0055 Precondition: position < max_total_count() 0056 */ 0057 const std::string& name_for_position(unsigned position) const; 0058 0059 private: 0060 // List of names corresponding to the positions. If the number of 0061 // positions is unlimited, then the last name is stored in 0062 // m_trailing; 0063 std::vector<std::string> m_names; 0064 std::string m_trailing; 0065 }; 0066 0067 }} 0068 0069 #if defined(BOOST_MSVC) 0070 # pragma warning (pop) 0071 #endif 0072 0073 #endif 0074
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |