summaryrefslogtreecommitdiff
path: root/boost/program_options
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/program_options
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-upstream/1.65.0.tar.gz
boost-upstream/1.65.0.tar.bz2
boost-upstream/1.65.0.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/program_options')
-rw-r--r--boost/program_options/detail/value_semantic.hpp17
-rw-r--r--boost/program_options/eof_iterator.hpp6
-rw-r--r--boost/program_options/errors.hpp9
-rw-r--r--boost/program_options/option.hpp1
-rw-r--r--boost/program_options/value_semantic.hpp15
-rw-r--r--boost/program_options/version.hpp3
6 files changed, 35 insertions, 16 deletions
diff --git a/boost/program_options/detail/value_semantic.hpp b/boost/program_options/detail/value_semantic.hpp
index 978a38a86e..9531339a34 100644
--- a/boost/program_options/detail/value_semantic.hpp
+++ b/boost/program_options/detail/value_semantic.hpp
@@ -8,6 +8,9 @@
#include <boost/throw_exception.hpp>
+// forward declaration
+namespace boost { template<class T> class optional; }
+
namespace boost { namespace program_options {
extern BOOST_PROGRAM_OPTIONS_DECL std::string arg;
@@ -152,6 +155,20 @@ namespace boost { namespace program_options {
}
}
+ /** Validates optional arguments. */
+ template<class T, class charT>
+ void validate(boost::any& v,
+ const std::vector<std::basic_string<charT> >& s,
+ boost::optional<T>*,
+ int)
+ {
+ validators::check_first_occurrence(v);
+ validators::get_single_string(s);
+ boost::any a;
+ validate(a, s, (T*)0, 0);
+ v = boost::any(boost::optional<T>(boost::any_cast<T>(a)));
+ }
+
template<class T, class charT>
void
typed_value<T, charT>::
diff --git a/boost/program_options/eof_iterator.hpp b/boost/program_options/eof_iterator.hpp
index 4eeef0e937..5e53df5b81 100644
--- a/boost/program_options/eof_iterator.hpp
+++ b/boost/program_options/eof_iterator.hpp
@@ -68,7 +68,11 @@ namespace boost {
private: // iterator core operations
- friend class iterator_core_access;
+#ifdef __DCC__
+ friend class boost::iterator_core_access;
+#else
+ friend class iterator_core_access;
+#endif
void increment()
{
diff --git a/boost/program_options/errors.hpp b/boost/program_options/errors.hpp
index f31defbd36..ba83d88f40 100644
--- a/boost/program_options/errors.hpp
+++ b/boost/program_options/errors.hpp
@@ -26,7 +26,12 @@ 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("-/"));
+ std::string::size_type i = text.find_first_not_of("-/");
+ if (i == std::string::npos) {
+ return text;
+ } else {
+ return text.substr(i);
+ }
}
/** Base class for all errors in the library. */
@@ -169,7 +174,7 @@ namespace boost { namespace program_options {
virtual void set_option_name(const std::string& option_name)
{ set_substitute("option", option_name);}
- std::string get_option_name() const throw()
+ std::string get_option_name() const
{ return get_canonical_option_name(); }
void set_original_token(const std::string& original_token)
diff --git a/boost/program_options/option.hpp b/boost/program_options/option.hpp
index 1fa6a19234..427678fa78 100644
--- a/boost/program_options/option.hpp
+++ b/boost/program_options/option.hpp
@@ -31,6 +31,7 @@ namespace boost { namespace program_options {
basic_option(const std::string& xstring_key,
const std::vector< std::string> &xvalue)
: string_key(xstring_key)
+ , position_key(-1)
, value(xvalue)
, unregistered(false)
, case_insensitive(false)
diff --git a/boost/program_options/value_semantic.hpp b/boost/program_options/value_semantic.hpp
index be3f10801e..ac9dbc663b 100644
--- a/boost/program_options/value_semantic.hpp
+++ b/boost/program_options/value_semantic.hpp
@@ -38,11 +38,6 @@ namespace boost { namespace program_options {
should be present on the command line. */
virtual unsigned max_tokens() const = 0;
- /** Returns true if the option should only take adjacent token,
- not one from further command-line arguments.
- */
- virtual bool adjacent_tokens_only() const = 0;
-
/** Returns true if values from different sources should be composed.
Otherwise, value from the first source is used and values from
other sources are discarded.
@@ -53,7 +48,7 @@ namespace boost { namespace program_options {
*/
virtual bool is_required() const = 0;
-
+
/** Parses a group of tokens that specify a value of option.
Stores the result in 'value_store', using whatever representation
is desired. May be be called several times if value of the same
@@ -139,7 +134,6 @@ namespace boost { namespace program_options {
unsigned min_tokens() const;
unsigned max_tokens() const;
- bool adjacent_tokens_only() const { return false; }
bool is_composing() const { return false; }
@@ -224,10 +218,7 @@ namespace boost { namespace program_options {
/** Specifies an implicit value, which will be used
if the option is given, but without an adjacent value.
- Using this implies that an explicit value is optional, but if
- given, must be strictly adjacent to the option, i.e.: '-ovalue'
- or '--option=value'. Giving '-o' or '--option' will cause the
- implicit value to be applied.
+ Using this implies that an explicit value is optional,
*/
typed_value* implicit_value(const T &v)
{
@@ -331,8 +322,6 @@ namespace boost { namespace program_options {
}
}
- bool adjacent_tokens_only() const { return !m_implicit_value.empty(); }
-
bool is_required() const { return m_required; }
/** Creates an instance of the 'validator' class and calls
diff --git a/boost/program_options/version.hpp b/boost/program_options/version.hpp
index 748094361b..aa27568bb8 100644
--- a/boost/program_options/version.hpp
+++ b/boost/program_options/version.hpp
@@ -15,5 +15,8 @@
#endif
#define BOOST_PROGRAM_OPTIONS_VERSION 2
+// Signal that implicit options will use values from next
+// token, if available.
+#define BOOST_PROGRAM_OPTIONS_IMPLICIT_VALUE_NEXT_TOKEN 1
#endif