From 32a41b1abe1a4aab0892c9c2051be6ba5b379f1e Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 11 May 2020 22:17:58 +0200 Subject: New upstream version 2.2.0~rc1+repack --- boost/libs/program_options/src/cmdline.cpp | 719 ----------------------------- 1 file changed, 719 deletions(-) delete mode 100644 boost/libs/program_options/src/cmdline.cpp (limited to 'boost/libs/program_options/src/cmdline.cpp') diff --git a/boost/libs/program_options/src/cmdline.cpp b/boost/libs/program_options/src/cmdline.cpp deleted file mode 100644 index 49c7c93d..00000000 --- a/boost/libs/program_options/src/cmdline.cpp +++ /dev/null @@ -1,719 +0,0 @@ -// Copyright Vladimir Prus 2002-2004. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt -// or copy at http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_PROGRAM_OPTIONS_SOURCE -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -namespace boost { namespace program_options { - - using namespace std; - using namespace boost::program_options::command_line_style; - - - string - invalid_syntax::get_template(kind_t kind) - { - // Initially, store the message in 'const char*' variable, - // to avoid conversion to string in all cases. - const char* msg; - switch(kind) - { - case empty_adjacent_parameter: - msg = "the argument for option '%canonical_option%' should follow immediately after the equal sign"; - break; - case missing_parameter: - msg = "the required argument for option '%canonical_option%' is missing"; - break; - case unrecognized_line: - msg = "the options configuration file contains an invalid line '%invalid_line%'"; - break; - // none of the following are currently used: - case long_not_allowed: - msg = "the unabbreviated option '%canonical_option%' is not valid"; - break; - case long_adjacent_not_allowed: - msg = "the unabbreviated option '%canonical_option%' does not take any arguments"; - break; - case short_adjacent_not_allowed: - msg = "the abbreviated option '%canonical_option%' does not take any arguments"; - break; - case extra_parameter: - msg = "option '%canonical_option%' does not take any arguments"; - break; - default: - msg = "unknown command line syntax error for '%s'"; - } - return msg; - } - - -}} - - -namespace boost { namespace program_options { namespace detail { - - // vc6 needs this, but borland chokes when this is added. -#if BOOST_WORKAROUND(_MSC_VER, < 1300) - using namespace std; - using namespace program_options; -#endif - - - cmdline::cmdline(const vector& args) - { - init(args); - } - - cmdline::cmdline(int argc, const char*const * argv) - { -#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) - vector args; - copy(argv+1, argv+argc+!argc, inserter(args, args.end())); - init(args); -#else - init(vector(argv+1, argv+argc+!argc)); -#endif - } - - void - cmdline::init(const vector& args) - { - this->args = args; - m_style = command_line_style::default_style; - m_desc = 0; - m_positional = 0; - m_allow_unregistered = false; - } - - void - cmdline::style(int style) - { - if (style == 0) - style = default_style; - - check_style(style); - this->m_style = style_t(style); - } - - void - cmdline::allow_unregistered() - { - this->m_allow_unregistered = true; - } - - void - cmdline::check_style(int style) const - { - bool allow_some_long = - (style & allow_long) || (style & allow_long_disguise); - - const char* error = 0; - if (allow_some_long && - !(style & long_allow_adjacent) && !(style & long_allow_next)) - error = "boost::program_options misconfiguration: " - "choose one or other of 'command_line_style::long_allow_next' " - "(whitespace separated arguments) or " - "'command_line_style::long_allow_adjacent' ('=' separated arguments) for " - "long options."; - - if (!error && (style & allow_short) && - !(style & short_allow_adjacent) && !(style & short_allow_next)) - error = "boost::program_options misconfiguration: " - "choose one or other of 'command_line_style::short_allow_next' " - "(whitespace separated arguments) or " - "'command_line_style::short_allow_adjacent' ('=' separated arguments) for " - "short options."; - - if (!error && (style & allow_short) && - !(style & allow_dash_for_short) && !(style & allow_slash_for_short)) - error = "boost::program_options misconfiguration: " - "choose one or other of 'command_line_style::allow_slash_for_short' " - "(slashes) or 'command_line_style::allow_dash_for_short' (dashes) for " - "short options."; - - if (error) - boost::throw_exception(invalid_command_line_style(error)); - - // Need to check that if guessing and long disguise are enabled - // -f will mean the same as -foo - } - - bool - cmdline::is_style_active(style_t style) const - { - return ((m_style & style) ? true : false); - } - - void - cmdline::set_options_description(const options_description& desc) - { - m_desc = &desc; - } - - void - cmdline::set_positional_options( - const positional_options_description& positional) - { - m_positional = &positional; - } - - int - cmdline::get_canonical_option_prefix() - { - if (m_style & allow_long) - return allow_long; - - if (m_style & allow_long_disguise) - return allow_long_disguise; - - if ((m_style & allow_short) && (m_style & allow_dash_for_short)) - return allow_dash_for_short; - - if ((m_style & allow_short) && (m_style & allow_slash_for_short)) - return allow_slash_for_short; - - return 0; - } - - vector