Last change
on this file since 29 was
29,
checked in by landauf, 16 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.3 KB
|
Line | |
---|
1 | // Copyright Vladimir Prus 2004. |
---|
2 | // Distributed under the Boost Software License, Version 1.0. |
---|
3 | // (See accompanying file LICENSE_1_0.txt |
---|
4 | // or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | |
---|
6 | #define BOOST_PROGRAM_OPTIONS_SOURCE |
---|
7 | #include <boost/program_options/config.hpp> |
---|
8 | |
---|
9 | #include <boost/program_options/positional_options.hpp> |
---|
10 | |
---|
11 | #include <boost/limits.hpp> |
---|
12 | |
---|
13 | #include <cassert> |
---|
14 | |
---|
15 | namespace boost { namespace program_options { |
---|
16 | |
---|
17 | positional_options_description::positional_options_description() |
---|
18 | {} |
---|
19 | |
---|
20 | positional_options_description& |
---|
21 | positional_options_description::add(const char* name, int max_count) |
---|
22 | { |
---|
23 | assert(max_count != -1 || m_trailing.empty()); |
---|
24 | |
---|
25 | if (max_count == -1) |
---|
26 | m_trailing = name; |
---|
27 | else { |
---|
28 | m_names.resize(m_names.size() + max_count, name); |
---|
29 | } |
---|
30 | return *this; |
---|
31 | } |
---|
32 | |
---|
33 | unsigned |
---|
34 | positional_options_description::max_total_count() const |
---|
35 | { |
---|
36 | return m_trailing.empty() ? |
---|
37 | m_names.size() : (std::numeric_limits<unsigned>::max)(); |
---|
38 | } |
---|
39 | |
---|
40 | const std::string& |
---|
41 | positional_options_description::name_for_position(unsigned position) const |
---|
42 | { |
---|
43 | assert(position < max_total_count()); |
---|
44 | |
---|
45 | if (position < m_names.size()) |
---|
46 | return m_names[position]; |
---|
47 | else |
---|
48 | return m_trailing; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | }} |
---|
53 | |
---|
Note: See
TracBrowser
for help on using the repository browser.