Compare commits

..

1 Commits

Author SHA1 Message Date
Marshall Clow
e257904044 Release 1.53.0
[SVN r82734]
2013-02-04 18:11:49 +00:00
9 changed files with 3424 additions and 60 deletions

View File

@@ -8,7 +8,7 @@
#ifndef PROGRAM_OPTIONS_VP_2003_05_19
#define PROGRAM_OPTIONS_VP_2003_05_19
#if defined(_MSC_VER)
#if _MSC_VER >= 1020
#pragma once
#endif

View File

@@ -105,9 +105,12 @@ namespace boost { namespace program_options {
int);
#endif
// For some reason, this declaration, which is require by the standard,
// cause msvc 7.1 to not generate code to specialization defined in
// cause gcc 3.2 to not generate code to specialization defined in
// value_semantic.cpp
#if ! ( BOOST_WORKAROUND(BOOST_MSVC, == 1310) )
#if ! ( ( BOOST_WORKAROUND(__GNUC__, <= 3) &&\
BOOST_WORKAROUND(__GNUC_MINOR__, < 3) ) || \
( BOOST_WORKAROUND(BOOST_MSVC, == 1310) ) \
)
BOOST_PROGRAM_OPTIONS_DECL void validate(boost::any& v,
const std::vector<std::string>& xs,
std::string*,

View File

@@ -25,8 +25,7 @@ namespace boost { namespace program_options {
inline std::string strip_prefixes(const std::string& text)
{
// "--foo-bar" -> "foo-bar"
return text.substr(text.find_first_not_of("-/"));
return text.substr(text.find_last_of("-/") + 1);
}
/** Base class for all errors in the library. */
@@ -105,13 +104,13 @@ namespace boost { namespace program_options {
std::map<std::string, string_pair > m_substitution_defaults;
public:
/** template with placeholders */
std::string m_error_template;
/** template with placeholders */
std::string m_error_template;
error_with_option_name(const std::string& template_,
const std::string& option_name = "",
const std::string& original_token = "",
int option_style = 0);
error_with_option_name(const std::string& template_,
const std::string& option_name = "",
const std::string& original_token = "",
int option_style = 0);
/** gcc says that throw specification on dtor is loosened
* without this line

View File

@@ -61,8 +61,8 @@ namespace program_options {
Alas, derived->base conversion for auto_ptr does not really work,
see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2000/n1232.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#84
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2000/n1232.pdf
http://std.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#84
So, we have to use plain old pointers. Besides, users are not
expected to use the constructor directly.
@@ -199,10 +199,6 @@ namespace program_options {
*/
options_description& add(const options_description& desc);
/** Find the maximum width of the option column, including options
in groups. */
unsigned get_option_column_width() const;
public:
/** Returns an object of implementation-defined type suitable for adding
options to options_description. The returned object will
@@ -233,7 +229,7 @@ namespace program_options {
/** Outputs 'desc' to the specified stream, calling 'f' to output each
option_description element. */
void print(std::ostream& os, unsigned width = 0) const;
void print(std::ostream& os) const;
private:
typedef std::map<std::string, int>::const_iterator name2index_iterator;

View File

@@ -98,7 +98,7 @@ namespace boost { namespace program_options {
void store(const basic_parsed_options<char>& options,
variables_map& m, bool);
friend class BOOST_PROGRAM_OPTIONS_DECL variables_map;
friend BOOST_PROGRAM_OPTIONS_DECL class variables_map;
};
/** Implements string->string mapping with convenient value casting

View File

@@ -455,7 +455,7 @@ namespace boost { namespace program_options { namespace detail {
// if they look like options
if (opt.value.size() <= min_tokens)
{
min_tokens -= static_cast<unsigned>(opt.value.size());
min_tokens -= static_cast<unsigned>(opt.value.size());
}
else
{

View File

@@ -604,9 +604,12 @@ namespace boost { namespace program_options {
}
}
unsigned
options_description::get_option_column_width() const
void
options_description::print(std::ostream& os) const
{
if (!m_caption.empty())
os << m_caption << ":\n";
/* Find the maximum width of the option column */
unsigned width(23);
unsigned i; // vc6 has broken for loop scoping
@@ -617,11 +620,6 @@ namespace boost { namespace program_options {
ss << " " << opt.format_name() << ' ' << opt.format_parameter();
width = (max)(width, static_cast<unsigned>(ss.str().size()));
}
/* Get width of groups as well*/
for (unsigned j = 0; j < groups.size(); ++j)
width = max(width, groups[j]->get_option_column_width());
/* this is the column were description should start, if first
column is longer, we go to a new line */
const unsigned start_of_description_column = m_line_length - m_min_description_length;
@@ -630,20 +628,9 @@ namespace boost { namespace program_options {
/* add an additional space to improve readability */
++width;
return width;
}
void
options_description::print(std::ostream& os, unsigned width) const
{
if (!m_caption.empty())
os << m_caption << ":\n";
if (!width)
width = get_option_column_width();
/* The options formatting style is stolen from Subversion. */
for (unsigned i = 0; i < m_options.size(); ++i)
for (i = 0; i < m_options.size(); ++i)
{
if (belong_to_group[i])
continue;
@@ -656,8 +643,7 @@ namespace boost { namespace program_options {
}
for (unsigned j = 0; j < groups.size(); ++j) {
os << "\n";
groups[j]->print(os, width);
os << "\n" << *groups[j];
}
}

View File

@@ -32,7 +32,6 @@ test-suite program_options :
[ po-test split_test.cpp ]
[ po-test unrecognized_test.cpp ]
[ po-test required_test.cpp : required_test.cfg ]
[ po-test exception_txt_test.cpp ]
;
exe test_convert : test_convert.cpp ;

File diff suppressed because it is too large Load Diff