Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/TCLAP
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2021-11-24 03:38:55 +0300
committerFormerLurker <hochgebe@gmail.com>2021-11-24 03:38:55 +0300
commit274b33a225485571a012471e997738e437607fcc (patch)
treedaeefcb0e521feca19465727b2359e42953bdadb /TCLAP
parent499c995652b829e42097ea88f93faf2c9c0aeaa5 (diff)
Allow Travel Arcs is now false by default, else it didn't make any sense as a flag. Enhance command line processing in the inverse processor. Update TCLAP library.
Diffstat (limited to 'TCLAP')
-rw-r--r--TCLAP/TCLAP.vcxproj2
-rw-r--r--TCLAP/TCLAP.vcxproj.filters2
-rw-r--r--TCLAP/tclap/AUTHORS6
-rw-r--r--TCLAP/tclap/Arg.h16
-rw-r--r--TCLAP/tclap/ArgException.h13
-rw-r--r--TCLAP/tclap/ArgTraits.h44
-rw-r--r--TCLAP/tclap/COPYING27
-rw-r--r--TCLAP/tclap/CmdLine.h34
-rw-r--r--TCLAP/tclap/CmdLineInterface.h5
-rw-r--r--TCLAP/tclap/CmdLineOutput.h3
-rw-r--r--TCLAP/tclap/Constraint.h10
-rw-r--r--TCLAP/tclap/DocBookOutput.h7
-rw-r--r--TCLAP/tclap/HelpVisitor.h2
-rw-r--r--TCLAP/tclap/IgnoreRestVisitor.h2
-rw-r--r--TCLAP/tclap/Makefile.am29
-rw-r--r--TCLAP/tclap/Makefile.in556
-rw-r--r--TCLAP/tclap/MultiArg.h18
-rw-r--r--TCLAP/tclap/MultiSwitchArg.h9
-rw-r--r--TCLAP/tclap/OptionalUnlabeledTracker.h2
-rw-r--r--TCLAP/tclap/StandardTraits.h153
-rw-r--r--TCLAP/tclap/StdOutput.h1
-rw-r--r--TCLAP/tclap/SwitchArg.h379
-rw-r--r--TCLAP/tclap/UnlabeledMultiArg.h3
-rw-r--r--TCLAP/tclap/UnlabeledValueArg.h3
-rw-r--r--TCLAP/tclap/ValueArg.h573
-rw-r--r--TCLAP/tclap/ValuesConstraint.h15
-rw-r--r--TCLAP/tclap/Visitor.h8
-rw-r--r--TCLAP/tclap/XorHandler.h14
-rw-r--r--TCLAP/tclap/ZshCompletionOutput.h5
29 files changed, 1263 insertions, 678 deletions
diff --git a/TCLAP/TCLAP.vcxproj b/TCLAP/TCLAP.vcxproj
index 6527598..6b577ac 100644
--- a/TCLAP/TCLAP.vcxproj
+++ b/TCLAP/TCLAP.vcxproj
@@ -195,6 +195,8 @@
</ItemDefinitionGroup>
<ItemGroup>
<None Include="COPYING" />
+ <None Include="tclap\AUTHORS" />
+ <None Include="tclap\COPYING" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
diff --git a/TCLAP/TCLAP.vcxproj.filters b/TCLAP/TCLAP.vcxproj.filters
index 0441038..3b2bed8 100644
--- a/TCLAP/TCLAP.vcxproj.filters
+++ b/TCLAP/TCLAP.vcxproj.filters
@@ -16,6 +16,8 @@
</ItemGroup>
<ItemGroup>
<None Include="COPYING" />
+ <None Include="tclap\AUTHORS" />
+ <None Include="tclap\COPYING" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
diff --git a/TCLAP/tclap/AUTHORS b/TCLAP/tclap/AUTHORS
new file mode 100644
index 0000000..9a291f1
--- /dev/null
+++ b/TCLAP/tclap/AUTHORS
@@ -0,0 +1,6 @@
+
+original author: Michael E. Smoot
+current maintainer: Daniel Aarno
+more contributions: Erik Zeek
+more contributions: Fabien Carmagnac (Tinbergen-AM)
+outstanding editing: Carol Smoot
diff --git a/TCLAP/tclap/Arg.h b/TCLAP/tclap/Arg.h
index 3ad3e77..f8c4a5f 100644
--- a/TCLAP/tclap/Arg.h
+++ b/TCLAP/tclap/Arg.h
@@ -39,16 +39,6 @@
#include <tclap/sstream.h>
-#if defined(HAVE_SSTREAM)
-#include <sstream>
-typedef std::istringstream istringstream;
-#elif defined(HAVE_STRSTREAM)
-#include <strstream>
-typedef std::istrstream istringstream;
-#else
-#error "Need a stringstream (sstream or strstream) to compile!"
-#endif
-
#include <tclap/ArgException.h>
#include <tclap/Visitor.h>
#include <tclap/CmdLineInterface.h>
@@ -394,17 +384,17 @@ class Arg
/**
* Typedef of an Arg list iterator.
*/
-typedef std::list<Arg*>::iterator ArgListIterator;
+typedef std::list<Arg*>::const_iterator ArgListIterator;
/**
* Typedef of an Arg vector iterator.
*/
-typedef std::vector<Arg*>::iterator ArgVectorIterator;
+typedef std::vector<Arg*>::const_iterator ArgVectorIterator;
/**
* Typedef of a Visitor list iterator.
*/
-typedef std::list<Visitor*>::iterator VisitorListIterator;
+typedef std::list<Visitor*>::const_iterator VisitorListIterator;
/*
* Extract a value of type T from it's string representation contained
diff --git a/TCLAP/tclap/ArgException.h b/TCLAP/tclap/ArgException.h
index f789d1c..1e0f659 100644
--- a/TCLAP/tclap/ArgException.h
+++ b/TCLAP/tclap/ArgException.h
@@ -5,6 +5,7 @@
* file: ArgException.h
*
* Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2017 Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -184,6 +185,18 @@ class SpecificationException : public ArgException
};
+/**
+ * Thrown when TCLAP thinks the program should exit.
+ *
+ * For example after parse error this exception will be thrown (and
+ * normally caught). This allows any resource to be clened properly
+ * before exit.
+ *
+ * If exception handling is disabled (CmdLine::setExceptionHandling),
+ * this exception will propagate to the call site, allowing the
+ * program to catch it and avoid program termination, or do it's own
+ * cleanup. See for example, https://sourceforge.net/p/tclap/bugs/29.
+ */
class ExitException {
public:
ExitException(int estat) : _estat(estat) {}
diff --git a/TCLAP/tclap/ArgTraits.h b/TCLAP/tclap/ArgTraits.h
index 7ae85a9..0ccf5e3 100644
--- a/TCLAP/tclap/ArgTraits.h
+++ b/TCLAP/tclap/ArgTraits.h
@@ -5,6 +5,7 @@
* file: ArgTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
+ * Copyright (c) 2017 Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -73,13 +74,46 @@ struct ValueLikeTrait {
* Arg traits are used to get compile type specialization when parsing
* argument values. Using an ArgTraits you can specify the way that
* values gets assigned to any particular type during parsing. The two
- * supported types are StringLike and ValueLike.
+ * supported types are StringLike and ValueLike. ValueLike is the
+ * default and means that operator>> will be used to assign values to
+ * the type.
*/
template<typename T>
-struct ArgTraits {
- typedef typename T::ValueCategory ValueCategory;
- virtual ~ArgTraits() {}
- //typedef ValueLike ValueCategory;
+class ArgTraits {
+ // This is a bit silly, but what we want to do is:
+ // 1) If there exists a specialization of ArgTraits for type X,
+ // use it.
+ //
+ // 2) If no specialization exists but X has the typename
+ // X::ValueCategory, use the specialization for X::ValueCategory.
+ //
+ // 3) If neither (1) nor (2) defines the trait, use the default
+ // which is ValueLike.
+
+ // This is the "how":
+ //
+ // test<T>(0) (where 0 is the NULL ptr) will match
+ // test(typename C::ValueCategory*) iff type T has the
+ // corresponding typedef. If it does not test(...) will be
+ // matched. This allows us to determine if T::ValueCategory
+ // exists by checking the sizeof for the test function (return
+ // value must have different sizeof).
+ template<typename C> static short test(typename C::ValueCategory*);
+ template<typename C> static long test(...);
+ static const bool hasTrait = sizeof(test<T>(0)) == sizeof(short);
+
+ template <typename C, bool>
+ struct DefaultArgTrait {
+ typedef ValueLike ValueCategory;
+ };
+
+ template <typename C>
+ struct DefaultArgTrait<C, true> {
+ typedef typename C::ValueCategory ValueCategory;
+ };
+
+public:
+ typedef typename DefaultArgTrait<T, hasTrait>::ValueCategory ValueCategory;
};
} // namespace
diff --git a/TCLAP/tclap/COPYING b/TCLAP/tclap/COPYING
new file mode 100644
index 0000000..d573236
--- /dev/null
+++ b/TCLAP/tclap/COPYING
@@ -0,0 +1,27 @@
+
+
+Copyright (c) 2003 Michael E. Smoot
+Copyright (c) 2004 Daniel Aarno
+Copyright (c) 2017 Google Inc.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
diff --git a/TCLAP/tclap/CmdLine.h b/TCLAP/tclap/CmdLine.h
index c91e656..dc49bae 100644
--- a/TCLAP/tclap/CmdLine.h
+++ b/TCLAP/tclap/CmdLine.h
@@ -183,6 +183,11 @@ private:
*/
bool _helpAndVersion;
+ /**
+ * Whether or not to ignore unmatched args.
+ */
+ bool _ignoreUnmatched;
+
public:
/**
@@ -232,7 +237,7 @@ private:
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
- void xorAdd( std::vector<Arg*>& xors );
+ void xorAdd( const std::vector<Arg*>& xors );
/**
* Parses the command line.
@@ -313,6 +318,13 @@ private:
*/
void reset();
+ /**
+ * Allows unmatched args to be ignored. By default false.
+ *
+ * @param ignore If true the cmdline will ignore any unmatched args
+ * and if false it will behave as normal.
+ */
+ void ignoreUnmatched(const bool ignore);
};
@@ -337,7 +349,8 @@ inline CmdLine::CmdLine(const std::string& m,
_output(0),
_handleExceptions(true),
_userSetOutput(false),
- _helpAndVersion(help)
+ _helpAndVersion(help),
+ _ignoreUnmatched(false)
{
_constructor();
}
@@ -390,7 +403,7 @@ inline void CmdLine::_constructor()
deleteOnExit(v);
}
-inline void CmdLine::xorAdd( std::vector<Arg*>& ors )
+inline void CmdLine::xorAdd( const std::vector<Arg*>& ors )
{
_xorHandler.add( ors );
@@ -445,8 +458,14 @@ inline void CmdLine::parse(std::vector<std::string>& args)
{
bool shouldExit = false;
int estat = 0;
-
try {
+ if (args.empty()) {
+ // https://sourceforge.net/p/tclap/bugs/30/
+ throw CmdLineParseException("The args vector must not be empty, "
+ "the first entry should contain the "
+ "program's name.");
+ }
+
_progName = args.front();
args.erase(args.begin());
@@ -470,7 +489,7 @@ inline void CmdLine::parse(std::vector<std::string>& args)
if ( !matched && _emptyCombined( args[i] ) )
matched = true;
- if ( !matched && !Arg::ignoreRest() )
+ if ( !matched && !Arg::ignoreRest() && !_ignoreUnmatched)
throw(CmdLineParseException("Couldn't find match "
"for argument",
args[i]));
@@ -623,6 +642,11 @@ inline void CmdLine::reset()
_progName.clear();
}
+inline void CmdLine::ignoreUnmatched(const bool ignore)
+{
+ _ignoreUnmatched = ignore;
+}
+
///////////////////////////////////////////////////////////////////////////////
//End CmdLine.cpp
///////////////////////////////////////////////////////////////////////////////
diff --git a/TCLAP/tclap/CmdLineInterface.h b/TCLAP/tclap/CmdLineInterface.h
index cf60f34..a9bdca0 100644
--- a/TCLAP/tclap/CmdLineInterface.h
+++ b/TCLAP/tclap/CmdLineInterface.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
@@ -5,6 +7,7 @@
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -75,7 +78,7 @@ class CmdLineInterface
* add does not need to be called.
* \param xors - List of Args to be added and xor'd.
*/
- virtual void xorAdd( std::vector<Arg*>& xors )=0;
+ virtual void xorAdd( const std::vector<Arg*>& xors )=0;
/**
* Parses the command line.
diff --git a/TCLAP/tclap/CmdLineOutput.h b/TCLAP/tclap/CmdLineOutput.h
index 11b8939..cbc9a32 100644
--- a/TCLAP/tclap/CmdLineOutput.h
+++ b/TCLAP/tclap/CmdLineOutput.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
@@ -5,6 +7,7 @@
* file: CmdLineOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
diff --git a/TCLAP/tclap/Constraint.h b/TCLAP/tclap/Constraint.h
index 21dc06f..ff869cc 100644
--- a/TCLAP/tclap/Constraint.h
+++ b/TCLAP/tclap/Constraint.h
@@ -1,9 +1,12 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
* file: Constraint.h
*
* Copyright (c) 2005, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -28,6 +31,7 @@
#include <iostream>
#include <iomanip>
#include <algorithm>
+#include <stdexcept>
namespace TCLAP {
@@ -62,6 +66,12 @@ class Constraint
* functions but without a virtual destructor.
*/
virtual ~Constraint() { ; }
+
+ static std::string shortID(Constraint<T> *constraint) {
+ if (!constraint)
+ throw std::logic_error("Cannot create a ValueArg with a NULL constraint");
+ return constraint->shortID();
+ }
};
} //namespace TCLAP
diff --git a/TCLAP/tclap/DocBookOutput.h b/TCLAP/tclap/DocBookOutput.h
index f023824..80b10e5 100644
--- a/TCLAP/tclap/DocBookOutput.h
+++ b/TCLAP/tclap/DocBookOutput.h
@@ -5,6 +5,7 @@
* file: DocBookOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -100,7 +101,7 @@ inline void DocBookOutput::usage(CmdLineInterface& _cmd )
std::string xversion = _cmd.getVersion();
theDelimiter = _cmd.getDelimiter();
XorHandler xorHandler = _cmd.getXorHandler();
- std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
+ const std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
basename(progName);
std::cout << "<?xml version='1.0'?>" << std::endl;
@@ -134,7 +135,7 @@ inline void DocBookOutput::usage(CmdLineInterface& _cmd )
std::cout << "</group>" << std::endl;
}
-
+
// rest of args
for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
if ( !xorHandler.contains( (*it) ) )
@@ -242,6 +243,7 @@ inline void DocBookOutput::printShortArg(Arg* a)
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
+ removeChar(arg,'.');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
@@ -280,6 +282,7 @@ inline void DocBookOutput::printLongArg(Arg* a)
removeChar(arg,']');
removeChar(arg,'<');
removeChar(arg,'>');
+ removeChar(arg,'.');
arg.erase(0, arg.find_last_of(theDelimiter) + 1);
std::cout << theDelimiter;
std::cout << "<replaceable>" << arg << "</replaceable>";
diff --git a/TCLAP/tclap/HelpVisitor.h b/TCLAP/tclap/HelpVisitor.h
index ee09144..5ee3756 100644
--- a/TCLAP/tclap/HelpVisitor.h
+++ b/TCLAP/tclap/HelpVisitor.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
diff --git a/TCLAP/tclap/IgnoreRestVisitor.h b/TCLAP/tclap/IgnoreRestVisitor.h
index d20f6e0..1824c3c 100644
--- a/TCLAP/tclap/IgnoreRestVisitor.h
+++ b/TCLAP/tclap/IgnoreRestVisitor.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
diff --git a/TCLAP/tclap/Makefile.am b/TCLAP/tclap/Makefile.am
new file mode 100644
index 0000000..5424fdf
--- /dev/null
+++ b/TCLAP/tclap/Makefile.am
@@ -0,0 +1,29 @@
+
+libtclapincludedir = $(includedir)/tclap
+
+libtclapinclude_HEADERS = \
+ Arg.h \
+ ArgException.h \
+ ArgTraits.h \
+ CmdLine.h \
+ CmdLineInterface.h \
+ CmdLineOutput.h \
+ Constraint.h \
+ DocBookOutput.h \
+ HelpVisitor.h \
+ IgnoreRestVisitor.h \
+ MultiArg.h \
+ MultiSwitchArg.h \
+ OptionalUnlabeledTracker.h \
+ StandardTraits.h \
+ StdOutput.h \
+ SwitchArg.h \
+ UnlabeledMultiArg.h \
+ UnlabeledValueArg.h \
+ ValueArg.h \
+ ValuesConstraint.h \
+ VersionVisitor.h \
+ Visitor.h \
+ XorHandler.h \
+ ZshCompletionOutput.h \
+ sstream.h
diff --git a/TCLAP/tclap/Makefile.in b/TCLAP/tclap/Makefile.in
new file mode 100644
index 0000000..e84d5f4
--- /dev/null
+++ b/TCLAP/tclap/Makefile.in
@@ -0,0 +1,556 @@
+# Makefile.in generated by automake 1.16.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = include/tclap
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
+ $(top_srcdir)/config/ac_cxx_have_sstream.m4 \
+ $(top_srcdir)/config/ac_cxx_have_strstream.m4 \
+ $(top_srcdir)/config/ac_cxx_namespaces.m4 \
+ $(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \
+ $(top_srcdir)/config/bb_enable_doxygen.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(libtclapinclude_HEADERS) \
+ $(am__DIST_COMMON)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libtclapincludedir)"
+HEADERS = $(libtclapinclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/mkinstalldirs
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOT = @DOT@
+DOXYGEN = @DOXYGEN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@
+WARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+libtclapincludedir = $(includedir)/tclap
+libtclapinclude_HEADERS = \
+ Arg.h \
+ ArgException.h \
+ ArgTraits.h \
+ CmdLine.h \
+ CmdLineInterface.h \
+ CmdLineOutput.h \
+ Constraint.h \
+ DocBookOutput.h \
+ HelpVisitor.h \
+ IgnoreRestVisitor.h \
+ MultiArg.h \
+ MultiSwitchArg.h \
+ OptionalUnlabeledTracker.h \
+ StandardTraits.h \
+ StdOutput.h \
+ SwitchArg.h \
+ UnlabeledMultiArg.h \
+ UnlabeledValueArg.h \
+ ValueArg.h \
+ ValuesConstraint.h \
+ VersionVisitor.h \
+ Visitor.h \
+ XorHandler.h \
+ ZshCompletionOutput.h \
+ sstream.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/tclap/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu include/tclap/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libtclapincludeHEADERS: $(libtclapinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(libtclapinclude_HEADERS)'; test -n "$(libtclapincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libtclapincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libtclapincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libtclapincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libtclapincludedir)" || exit $$?; \
+ done
+
+uninstall-libtclapincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libtclapinclude_HEADERS)'; test -n "$(libtclapincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libtclapincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libtclapincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libtclapincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libtclapincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ cscopelist-am ctags ctags-am distclean distclean-generic \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libtclapincludeHEADERS install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+ uninstall-libtclapincludeHEADERS
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/TCLAP/tclap/MultiArg.h b/TCLAP/tclap/MultiArg.h
index d478df9..e0df8b9 100644
--- a/TCLAP/tclap/MultiArg.h
+++ b/TCLAP/tclap/MultiArg.h
@@ -1,9 +1,12 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
* file: MultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -185,7 +188,7 @@ public:
* Returns a vector of type T containing the values parsed from
* the command line.
*/
- const std::vector<T>& getValue();
+ const std::vector<T>& getValue() const { return _values; }
/**
* Returns an iterator over the values parsed from the command
@@ -225,8 +228,8 @@ private:
/**
* Prevent accidental copying
*/
- MultiArg<T>(const MultiArg<T>& rhs);
- MultiArg<T>& operator=(const MultiArg<T>& rhs);
+ MultiArg(const MultiArg<T>& rhs);
+ MultiArg& operator=(const MultiArg<T>& rhs);
};
@@ -276,7 +279,7 @@ MultiArg<T>::MultiArg(const std::string& flag,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_values(std::vector<T>()),
- _typeDesc( constraint->shortID() ),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
_constraint( constraint ),
_allowMore(false)
{
@@ -293,7 +296,7 @@ MultiArg<T>::MultiArg(const std::string& flag,
Visitor* v)
: Arg( flag, name, desc, req, true, v ),
_values(std::vector<T>()),
- _typeDesc( constraint->shortID() ),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
_constraint( constraint ),
_allowMore(false)
{
@@ -302,9 +305,6 @@ MultiArg<T>::MultiArg(const std::string& flag,
}
template<class T>
-const std::vector<T>& MultiArg<T>::getValue() { return _values; }
-
-template<class T>
bool MultiArg<T>::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
@@ -362,7 +362,7 @@ template<class T>
std::string MultiArg<T>::shortID(const std::string& val) const
{
static_cast<void>(val); // Ignore input, don't warn
- return Arg::shortID(_typeDesc) + " ... ";
+ return Arg::shortID(_typeDesc) + " ...";
}
/**
diff --git a/TCLAP/tclap/MultiSwitchArg.h b/TCLAP/tclap/MultiSwitchArg.h
index 208d998..e333ea7 100644
--- a/TCLAP/tclap/MultiSwitchArg.h
+++ b/TCLAP/tclap/MultiSwitchArg.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
@@ -6,6 +8,7 @@
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
* Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek.
+* Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -108,7 +111,7 @@ class MultiSwitchArg : public SwitchArg
/**
* Returns int, the number of times the switch has been set.
*/
- int getValue();
+ int getValue() const { return _value; }
/**
* Returns the shortID for this Arg.
@@ -150,8 +153,6 @@ _default( init )
parser.add( this );
}
-inline int MultiSwitchArg::getValue() { return _value; }
-
inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)
{
if ( _ignoreable && Arg::ignoreRest() )
@@ -192,7 +193,7 @@ inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)
inline std::string
MultiSwitchArg::shortID(const std::string& val) const
{
- return Arg::shortID(val) + " ... ";
+ return Arg::shortID(val) + " ...";
}
inline std::string
diff --git a/TCLAP/tclap/OptionalUnlabeledTracker.h b/TCLAP/tclap/OptionalUnlabeledTracker.h
index 92f8929..aa64116 100644
--- a/TCLAP/tclap/OptionalUnlabeledTracker.h
+++ b/TCLAP/tclap/OptionalUnlabeledTracker.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
diff --git a/TCLAP/tclap/StandardTraits.h b/TCLAP/tclap/StandardTraits.h
index 75c9c64..5864f77 100644
--- a/TCLAP/tclap/StandardTraits.h
+++ b/TCLAP/tclap/StandardTraits.h
@@ -5,6 +5,7 @@
* file: StandardTraits.h
*
* Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -41,156 +42,10 @@
namespace TCLAP {
-// ======================================================================
-// Integer types
-// ======================================================================
+// Integer types (signed, unsigned and bool) and floating point types all
+// have value-like semantics.
-/**
- * longs have value-like semantics.
- */
-template<>
-struct ArgTraits<long> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * ints have value-like semantics.
- */
-template<>
-struct ArgTraits<int> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * shorts have value-like semantics.
- */
-template<>
-struct ArgTraits<short> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * chars have value-like semantics.
- */
-template<>
-struct ArgTraits<char> {
- typedef ValueLike ValueCategory;
-};
-
-#ifdef HAVE_LONG_LONG
-/**
- * long longs have value-like semantics.
- */
-template<>
-struct ArgTraits<long long> {
- typedef ValueLike ValueCategory;
-};
-#endif
-
-// ======================================================================
-// Unsigned integer types
-// ======================================================================
-
-/**
- * unsigned longs have value-like semantics.
- */
-template<>
-struct ArgTraits<unsigned long> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * unsigned ints have value-like semantics.
- */
-template<>
-struct ArgTraits<unsigned int> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * unsigned shorts have value-like semantics.
- */
-template<>
-struct ArgTraits<unsigned short> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * unsigned chars have value-like semantics.
- */
-template<>
-struct ArgTraits<unsigned char> {
- typedef ValueLike ValueCategory;
-};
-
-// Microsoft implements size_t awkwardly.
-#if defined(_MSC_VER) && defined(_M_X64)
-/**
- * size_ts have value-like semantics.
- */
-template<>
-struct ArgTraits<size_t> {
- typedef ValueLike ValueCategory;
-};
-#endif
-
-
-#ifdef HAVE_LONG_LONG
-/**
- * unsigned long longs have value-like semantics.
- */
-template<>
-struct ArgTraits<unsigned long long> {
- typedef ValueLike ValueCategory;
-};
-#endif
-
-// ======================================================================
-// Float types
-// ======================================================================
-
-/**
- * floats have value-like semantics.
- */
-template<>
-struct ArgTraits<float> {
- typedef ValueLike ValueCategory;
-};
-
-/**
- * doubles have value-like semantics.
- */
-template<>
-struct ArgTraits<double> {
- typedef ValueLike ValueCategory;
-};
-
-// ======================================================================
-// Other types
-// ======================================================================
-
-/**
- * bools have value-like semantics.
- */
-template<>
-struct ArgTraits<bool> {
- typedef ValueLike ValueCategory;
-};
-
-
-/**
- * wchar_ts have value-like semantics.
- */
-#ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
-template<>
-struct ArgTraits<wchar_t> {
- typedef ValueLike ValueCategory;
-};
-#endif
-
-/**
- * Strings have string like argument traits.
- */
+// Strings have string like argument traits.
template<>
struct ArgTraits<std::string> {
typedef StringLike ValueCategory;
diff --git a/TCLAP/tclap/StdOutput.h b/TCLAP/tclap/StdOutput.h
index f224ea2..cfef79a 100644
--- a/TCLAP/tclap/StdOutput.h
+++ b/TCLAP/tclap/StdOutput.h
@@ -5,6 +5,7 @@
* file: StdOutput.h
*
* Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
diff --git a/TCLAP/tclap/SwitchArg.h b/TCLAP/tclap/SwitchArg.h
index c2e8395..4ca130d 100644
--- a/TCLAP/tclap/SwitchArg.h
+++ b/TCLAP/tclap/SwitchArg.h
@@ -1,3 +1,4 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
/******************************************************************************
*
@@ -5,20 +6,21 @@
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- *****************************************************************************/
+ *****************************************************************************/
#ifndef TCLAP_SWITCH_ARG_H
@@ -38,224 +40,229 @@ namespace TCLAP {
*/
class SwitchArg : public Arg
{
- protected:
-
- /**
- * The value of the switch.
- */
- bool _value;
-
- /**
- * Used to support the reset() method so that ValueArg can be
- * reset to their constructed value.
- */
- bool _default;
-
- public:
-
- /**
- * SwitchArg constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param def - The default value for this Switch.
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- SwitchArg(const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool def = false,
- Visitor* v = NULL);
-
-
- /**
- * SwitchArg constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param parser - A CmdLine parser object to add this Arg to
- * \param def - The default value for this Switch.
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- SwitchArg(const std::string& flag,
- const std::string& name,
- const std::string& desc,
- CmdLineInterface& parser,
- bool def = false,
- Visitor* v = NULL);
-
-
- /**
- * Handles the processing of the argument.
- * This re-implements the Arg version of this method to set the
- * _value of the argument appropriately.
- * \param i - Pointer the the current argument in the list.
- * \param args - Mutable list of strings. Passed
- * in from main().
- */
- virtual bool processArg(int* i, std::vector<std::string>& args);
-
- /**
- * Checks a string to see if any of the chars in the string
- * match the flag for this Switch.
- */
- bool combinedSwitchesMatch(std::string& combined);
-
- /**
- * Returns bool, whether or not the switch has been set.
- */
- bool getValue();
-
- virtual void reset();
-
- private:
- /**
- * Checks to see if we've found the last match in
- * a combined string.
- */
- bool lastCombined(std::string& combined);
-
- /**
- * Does the common processing of processArg.
- */
- void commonProcessing();
+protected:
+
+ /**
+ * The value of the switch.
+ */
+ bool _value;
+
+ /**
+ * Used to support the reset() method so that ValueArg can be
+ * reset to their constructed value.
+ */
+ bool _default;
+
+public:
+
+ /**
+ * SwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param def - The default value for this Switch.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool def = false,
+ Visitor* v = NULL);
+
+
+ /**
+ * SwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param def - The default value for this Switch.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ bool def = false,
+ Visitor* v = NULL);
+
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed
+ * in from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Checks a string to see if any of the chars in the string
+ * match the flag for this Switch.
+ */
+ bool combinedSwitchesMatch(std::string& combined);
+
+ /**
+ * Returns bool, whether or not the switch has been set.
+ */
+ bool getValue() const { return _value; }
+
+ /**
+ * A SwitchArg can be used as a boolean, indicating
+ * whether or not the switch has been set. This is the
+ * same as calling getValue()
+ */
+ operator bool() const { return _value; }
+
+ virtual void reset();
+
+private:
+ /**
+ * Checks to see if we've found the last match in
+ * a combined string.
+ */
+ bool lastCombined(std::string& combined);
+
+ /**
+ * Does the common processing of processArg.
+ */
+ void commonProcessing();
};
//////////////////////////////////////////////////////////////////////
//BEGIN SwitchArg.cpp
//////////////////////////////////////////////////////////////////////
inline SwitchArg::SwitchArg(const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool default_val,
- Visitor* v )
-: Arg(flag, name, desc, false, false, v),
- _value( default_val ),
- _default( default_val )
+ const std::string& name,
+ const std::string& desc,
+ bool default_val,
+ Visitor* v )
+ : Arg(flag, name, desc, false, false, v),
+ _value( default_val ),
+ _default( default_val )
{ }
inline SwitchArg::SwitchArg(const std::string& flag,
- const std::string& name,
- const std::string& desc,
- CmdLineInterface& parser,
- bool default_val,
- Visitor* v )
-: Arg(flag, name, desc, false, false, v),
- _value( default_val ),
- _default(default_val)
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ bool default_val,
+ Visitor* v )
+ : Arg(flag, name, desc, false, false, v),
+ _value( default_val ),
+ _default(default_val)
{
- parser.add( this );
+ parser.add( this );
}
-inline bool SwitchArg::getValue() { return _value; }
-
inline bool SwitchArg::lastCombined(std::string& combinedSwitches )
{
- for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
- if ( combinedSwitches[i] != Arg::blankChar() )
- return false;
-
- return true;
+ for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
+ if ( combinedSwitches[i] != Arg::blankChar() )
+ return false;
+
+ return true;
}
inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )
{
- // make sure this is actually a combined switch
- if ( combinedSwitches.length() > 0 &&
- combinedSwitches[0] != Arg::flagStartString()[0] )
- return false;
-
- // make sure it isn't a long name
- if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
- Arg::nameStartString() )
- return false;
-
- // make sure the delimiter isn't in the string
- if ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos )
- return false;
-
- // ok, we're not specifying a ValueArg, so we know that we have
- // a combined switch list.
- for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
- if ( _flag.length() > 0 &&
- combinedSwitches[i] == _flag[0] &&
- _flag[0] != Arg::flagStartString()[0] )
- {
- // update the combined switches so this one is no longer present
- // this is necessary so that no unlabeled args are matched
- // later in the processing.
- //combinedSwitches.erase(i,1);
- combinedSwitches[i] = Arg::blankChar();
- return true;
- }
-
- // none of the switches passed in the list match.
- return false;
+ // make sure this is actually a combined switch
+ if ( combinedSwitches.length() > 0 &&
+ combinedSwitches[0] != Arg::flagStartString()[0] )
+ return false;
+
+ // make sure it isn't a long name
+ if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
+ Arg::nameStartString() )
+ return false;
+
+ // make sure the delimiter isn't in the string
+ if ( combinedSwitches.find_first_of(Arg::delimiter()) != std::string::npos)
+ return false;
+
+ // ok, we're not specifying a ValueArg, so we know that we have
+ // a combined switch list.
+ for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
+ if ( _flag.length() > 0 &&
+ combinedSwitches[i] == _flag[0] &&
+ _flag[0] != Arg::flagStartString()[0] )
+ {
+ // update the combined switches so this one is no longer present
+ // this is necessary so that no unlabeled args are matched
+ // later in the processing.
+ //combinedSwitches.erase(i,1);
+ combinedSwitches[i] = Arg::blankChar();
+ return true;
+ }
+
+ // none of the switches passed in the list match.
+ return false;
}
inline void SwitchArg::commonProcessing()
{
- if ( _xorSet )
- throw(CmdLineParseException(
- "Mutually exclusive argument already set!", toString()));
+ if ( _xorSet )
+ throw(CmdLineParseException(
+ "Mutually exclusive argument already set!", toString()));
- if ( _alreadySet )
- throw(CmdLineParseException("Argument already set!", toString()));
+ if ( _alreadySet )
+ throw(CmdLineParseException("Argument already set!", toString()));
- _alreadySet = true;
+ _alreadySet = true;
- if ( _value == true )
- _value = false;
- else
- _value = true;
+ if ( _value == true )
+ _value = false;
+ else
+ _value = true;
- _checkWithVisitor();
+ _checkWithVisitor();
}
inline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)
{
- if ( _ignoreable && Arg::ignoreRest() )
- return false;
-
- // if the whole string matches the flag or name string
- if ( argMatches( args[*i] ) )
- {
- commonProcessing();
-
- return true;
- }
- // if a substring matches the flag as part of a combination
- else if ( combinedSwitchesMatch( args[*i] ) )
- {
- // check again to ensure we don't misinterpret
- // this as a MultiSwitchArg
- if ( combinedSwitchesMatch( args[*i] ) )
- throw(CmdLineParseException("Argument already set!",
- toString()));
-
- commonProcessing();
-
- // We only want to return true if we've found the last combined
- // match in the string, otherwise we return true so that other
- // switches in the combination will have a chance to match.
- return lastCombined( args[*i] );
- }
- else
- return false;
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
+
+ // if the whole string matches the flag or name string
+ if ( argMatches( args[*i] ) )
+ {
+ commonProcessing();
+
+ return true;
+ }
+ // if a substring matches the flag as part of a combination
+ else if ( combinedSwitchesMatch( args[*i] ) )
+ {
+ // check again to ensure we don't misinterpret
+ // this as a MultiSwitchArg
+ if ( combinedSwitchesMatch( args[*i] ) )
+ throw(CmdLineParseException("Argument already set!",
+ toString()));
+
+ commonProcessing();
+
+ // We only want to return true if we've found the last combined
+ // match in the string, otherwise we return true so that other
+ // switches in the combination will have a chance to match.
+ return lastCombined( args[*i] );
+ }
+ else
+ return false;
}
inline void SwitchArg::reset()
{
- Arg::reset();
- _value = _default;
+ Arg::reset();
+ _value = _default;
}
//////////////////////////////////////////////////////////////////////
//End SwitchArg.cpp
diff --git a/TCLAP/tclap/UnlabeledMultiArg.h b/TCLAP/tclap/UnlabeledMultiArg.h
index 7995bc2..48feb84 100644
--- a/TCLAP/tclap/UnlabeledMultiArg.h
+++ b/TCLAP/tclap/UnlabeledMultiArg.h
@@ -1,9 +1,12 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
* file: UnlabeledMultiArg.h
*
* Copyright (c) 2003, Michael E. Smoot.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
diff --git a/TCLAP/tclap/UnlabeledValueArg.h b/TCLAP/tclap/UnlabeledValueArg.h
index 25e85ff..341a3c0 100644
--- a/TCLAP/tclap/UnlabeledValueArg.h
+++ b/TCLAP/tclap/UnlabeledValueArg.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
@@ -5,6 +7,7 @@
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
diff --git a/TCLAP/tclap/ValueArg.h b/TCLAP/tclap/ValueArg.h
index 2f65e4c..791d93f 100644
--- a/TCLAP/tclap/ValueArg.h
+++ b/TCLAP/tclap/ValueArg.h
@@ -1,23 +1,26 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
* file: ValueArg.h
*
* Copyright (c) 2003, Michael E. Smoot .
* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- *****************************************************************************/
+ *****************************************************************************/
#ifndef TCLAP_VALUE_ARGUMENT_H
@@ -42,206 +45,216 @@ namespace TCLAP {
template<class T>
class ValueArg : public Arg
{
- protected:
-
- /**
- * The value parsed from the command line.
- * Can be of any type, as long as the >> operator for the type
- * is defined.
- */
- T _value;
-
- /**
- * Used to support the reset() method so that ValueArg can be
- * reset to their constructed value.
- */
- T _default;
-
- /**
- * A human readable description of the type to be parsed.
- * This is a hack, plain and simple. Ideally we would use RTTI to
- * return the name of type T, but until there is some sort of
- * consistent support for human readable names, we are left to our
- * own devices.
- */
- std::string _typeDesc;
-
- /**
- * A Constraint this Arg must conform to.
- */
- Constraint<T>* _constraint;
-
- /**
- * Extracts the value from the string.
- * Attempts to parse string as type T, if this fails an exception
- * is thrown.
- * \param val - value to be parsed.
- */
- void _extractValue( const std::string& val );
-
- public:
-
- /**
- * Labeled ValueArg constructor.
- * You could conceivably call this constructor with a blank flag,
- * but that would make you a bad person. It would also cause
- * an exception to be thrown. If you want an unlabeled argument,
- * use the other constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param req - Whether the argument is required on the command
- * line.
- * \param value - The default value assigned to this argument if it
- * is not present on the command line.
- * \param typeDesc - A short, human readable description of the
- * type that this object expects. This is used in the generation
- * of the USAGE statement. The goal is to be helpful to the end user
- * of the program.
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- ValueArg( const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool req,
- T value,
- const std::string& typeDesc,
- Visitor* v = NULL);
-
-
- /**
- * Labeled ValueArg constructor.
- * You could conceivably call this constructor with a blank flag,
- * but that would make you a bad person. It would also cause
- * an exception to be thrown. If you want an unlabeled argument,
- * use the other constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param req - Whether the argument is required on the command
- * line.
- * \param value - The default value assigned to this argument if it
- * is not present on the command line.
- * \param typeDesc - A short, human readable description of the
- * type that this object expects. This is used in the generation
- * of the USAGE statement. The goal is to be helpful to the end user
- * of the program.
- * \param parser - A CmdLine parser object to add this Arg to
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- ValueArg( const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool req,
- T value,
- const std::string& typeDesc,
- CmdLineInterface& parser,
- Visitor* v = NULL );
+protected:
+
+ /**
+ * The value parsed from the command line.
+ * Can be of any type, as long as the >> operator for the type
+ * is defined.
+ */
+ T _value;
+
+ /**
+ * Used to support the reset() method so that ValueArg can be
+ * reset to their constructed value.
+ */
+ T _default;
+
+ /**
+ * A human readable description of the type to be parsed.
+ * This is a hack, plain and simple. Ideally we would use RTTI to
+ * return the name of type T, but until there is some sort of
+ * consistent support for human readable names, we are left to our
+ * own devices.
+ */
+ std::string _typeDesc;
+
+ /**
+ * A Constraint this Arg must conform to.
+ */
+ Constraint<T>* _constraint;
+
+ /**
+ * Extracts the value from the string.
+ * Attempts to parse string as type T, if this fails an exception
+ * is thrown.
+ * \param val - value to be parsed.
+ */
+ void _extractValue( const std::string& val );
+
+public:
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ Visitor* v = NULL);
+
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
- /**
- * Labeled ValueArg constructor.
- * You could conceivably call this constructor with a blank flag,
- * but that would make you a bad person. It would also cause
- * an exception to be thrown. If you want an unlabeled argument,
- * use the other constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param req - Whether the argument is required on the command
- * line.
- * \param value - The default value assigned to this argument if it
- * is not present on the command line.
- * \param constraint - A pointer to a Constraint object used
- * to constrain this Arg.
- * \param parser - A CmdLine parser object to add this Arg to.
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- ValueArg( const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool req,
- T value,
- Constraint<T>* constraint,
- CmdLineInterface& parser,
- Visitor* v = NULL );
-
- /**
- * Labeled ValueArg constructor.
- * You could conceivably call this constructor with a blank flag,
- * but that would make you a bad person. It would also cause
- * an exception to be thrown. If you want an unlabeled argument,
- * use the other constructor.
- * \param flag - The one character flag that identifies this
- * argument on the command line.
- * \param name - A one word name for the argument. Can be
- * used as a long flag on the command line.
- * \param desc - A description of what the argument is for or
- * does.
- * \param req - Whether the argument is required on the command
- * line.
- * \param value - The default value assigned to this argument if it
- * is not present on the command line.
- * \param constraint - A pointer to a Constraint object used
- * to constrain this Arg.
- * \param v - An optional visitor. You probably should not
- * use this unless you have a very good reason.
- */
- ValueArg( const std::string& flag,
- const std::string& name,
- const std::string& desc,
- bool req,
- T value,
- Constraint<T>* constraint,
- Visitor* v = NULL );
-
- /**
- * Handles the processing of the argument.
- * This re-implements the Arg version of this method to set the
- * _value of the argument appropriately. It knows the difference
- * between labeled and unlabeled.
- * \param i - Pointer the the current argument in the list.
- * \param args - Mutable list of strings. Passed
- * in from main().
- */
- virtual bool processArg(int* i, std::vector<std::string>& args);
-
- /**
- * Returns the value of the argument.
- */
- T& getValue() ;
-
- /**
- * Specialization of shortID.
- * \param val - value to be used.
- */
- virtual std::string shortID(const std::string& val = "val") const;
-
- /**
- * Specialization of longID.
- * \param val - value to be used.
- */
- virtual std::string longID(const std::string& val = "val") const;
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param parser - A CmdLine parser object to add this Arg to.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ Visitor* v = NULL );
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately. It knows the difference
+ * between labeled and unlabeled.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed
+ * in from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Returns the value of the argument.
+ */
+ const T& getValue() const { return _value; }
+
+ // TODO(macbishop): Non-const variant is deprecated, don't
+ // use. Remove in next major.
+ T& getValue() { return _value; }
+
+ /**
+ * A ValueArg can be used as as its value type (T) This is the
+ * same as calling getValue()
+ */
+ operator const T&() const { return getValue(); }
+
+ /**
+ * Specialization of shortID.
+ * \param val - value to be used.
+ */
+ virtual std::string shortID(const std::string& val = "val") const;
+
+ /**
+ * Specialization of longID.
+ * \param val - value to be used.
+ */
+ virtual std::string longID(const std::string& val = "val") const;
- virtual void reset() ;
+ virtual void reset() ;
private:
- /**
- * Prevent accidental copying
- */
- ValueArg<T>(const ValueArg<T>& rhs);
- ValueArg<T>& operator=(const ValueArg<T>& rhs);
+ /**
+ * Prevent accidental copying
+ */
+ ValueArg(const ValueArg<T>& rhs);
+ ValueArg& operator=(const ValueArg<T>& rhs);
};
@@ -256,11 +269,11 @@ ValueArg<T>::ValueArg(const std::string& flag,
T val,
const std::string& typeDesc,
Visitor* v)
-: Arg(flag, name, desc, req, true, v),
- _value( val ),
- _default( val ),
- _typeDesc( typeDesc ),
- _constraint( NULL )
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( typeDesc ),
+ _constraint( NULL )
{ }
template<class T>
@@ -272,13 +285,13 @@ ValueArg<T>::ValueArg(const std::string& flag,
const std::string& typeDesc,
CmdLineInterface& parser,
Visitor* v)
-: Arg(flag, name, desc, req, true, v),
- _value( val ),
- _default( val ),
- _typeDesc( typeDesc ),
- _constraint( NULL )
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( typeDesc ),
+ _constraint( NULL )
{
- parser.add( this );
+ parser.add( this );
}
template<class T>
@@ -289,11 +302,11 @@ ValueArg<T>::ValueArg(const std::string& flag,
T val,
Constraint<T>* constraint,
Visitor* v)
-: Arg(flag, name, desc, req, true, v),
- _value( val ),
- _default( val ),
- _typeDesc( constraint->shortID() ),
- _constraint( constraint )
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
+ _constraint( constraint )
{ }
template<class T>
@@ -305,75 +318,67 @@ ValueArg<T>::ValueArg(const std::string& flag,
Constraint<T>* constraint,
CmdLineInterface& parser,
Visitor* v)
-: Arg(flag, name, desc, req, true, v),
- _value( val ),
- _default( val ),
- _typeDesc( constraint->shortID() ),
- _constraint( constraint )
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( Constraint<T>::shortID(constraint) ), // TODO(macbishop): Will crash
+ // if constraint is NULL
+ _constraint( constraint )
{
- parser.add( this );
+ parser.add( this );
}
-
-/**
- * Implementation of getValue().
- */
-template<class T>
-T& ValueArg<T>::getValue() { return _value; }
-
/**
* Implementation of processArg().
*/
template<class T>
bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
{
- if ( _ignoreable && Arg::ignoreRest() )
- return false;
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
- if ( _hasBlanks( args[*i] ) )
- return false;
+ if ( _hasBlanks( args[*i] ) )
+ return false;
- std::string flag = args[*i];
+ std::string flag = args[*i];
- std::string value = "";
- trimFlag( flag, value );
+ std::string value = "";
+ trimFlag( flag, value );
- if ( argMatches( flag ) )
+ if ( argMatches( flag ) )
{
- if ( _alreadySet )
- {
- if ( _xorSet )
- throw( CmdLineParseException(
- "Mutually exclusive argument already set!",
- toString()) );
- else
- throw( CmdLineParseException("Argument already set!",
- toString()) );
- }
-
- if ( Arg::delimiter() != ' ' && value == "" )
- throw( ArgParseException(
- "Couldn't find delimiter for this argument!",
- toString() ) );
-
- if ( value == "" )
+ if ( _alreadySet )
+ {
+ if ( _xorSet )
+ throw( CmdLineParseException("Mutually exclusive argument"
+ " already set!", toString()));
+ else
+ throw( CmdLineParseException("Argument already set!",
+ toString()) );
+ }
+
+ if ( Arg::delimiter() != ' ' && value == "" )
+ throw( ArgParseException("Couldn't find delimiter for this argument!",
+ toString() ) );
+
+ if ( value == "" )
{
- (*i)++;
- if ( static_cast<unsigned int>(*i) < args.size() )
- _extractValue( args[*i] );
- else
- throw( ArgParseException("Missing a value for this argument!",
- toString() ) );
+ (*i)++;
+ if ( static_cast<unsigned int>(*i) < args.size() )
+ _extractValue( args[*i] );
+ else
+ throw( ArgParseException("Missing a value for this argument!",
+ toString() ) );
}
- else
- _extractValue( value );
-
- _alreadySet = true;
- _checkWithVisitor();
- return true;
- }
- else
- return false;
+ else
+ _extractValue( value );
+
+ _alreadySet = true;
+ _checkWithVisitor();
+ return true;
+ }
+ else
+ return false;
}
/**
@@ -382,8 +387,8 @@ bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
template<class T>
std::string ValueArg<T>::shortID(const std::string& val) const
{
- static_cast<void>(val); // Ignore input, don't warn
- return Arg::shortID( _typeDesc );
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::shortID( _typeDesc );
}
/**
@@ -392,32 +397,32 @@ std::string ValueArg<T>::shortID(const std::string& val) const
template<class T>
std::string ValueArg<T>::longID(const std::string& val) const
{
- static_cast<void>(val); // Ignore input, don't warn
- return Arg::longID( _typeDesc );
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::longID( _typeDesc );
}
template<class T>
void ValueArg<T>::_extractValue( const std::string& val )
{
- try {
- ExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());
- } catch( ArgParseException &e) {
- throw ArgParseException(e.error(), toString());
- }
+ try {
+ ExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());
+ } catch( ArgParseException &e) {
+ throw ArgParseException(e.error(), toString());
+ }
- if ( _constraint != NULL )
- if ( ! _constraint->check( _value ) )
- throw( CmdLineParseException( "Value '" + val +
- + "' does not meet constraint: "
- + _constraint->description(),
- toString() ) );
+ if ( _constraint != NULL )
+ if ( ! _constraint->check( _value ) )
+ throw( CmdLineParseException( "Value '" + val +
+ + "' does not meet constraint: "
+ + _constraint->description(),
+ toString() ) );
}
template<class T>
void ValueArg<T>::reset()
{
- Arg::reset();
- _value = _default;
+ Arg::reset();
+ _value = _default;
}
} // namespace TCLAP
diff --git a/TCLAP/tclap/ValuesConstraint.h b/TCLAP/tclap/ValuesConstraint.h
index d1c1df7..9851432 100644
--- a/TCLAP/tclap/ValuesConstraint.h
+++ b/TCLAP/tclap/ValuesConstraint.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
@@ -5,6 +7,7 @@
* file: ValuesConstraint.h
*
* Copyright (c) 2005, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -48,7 +51,7 @@ class ValuesConstraint : public Constraint<T>
* Constructor.
* \param allowed - vector of allowed values.
*/
- ValuesConstraint(std::vector<T>& allowed);
+ ValuesConstraint(std::vector<T>const& allowed);
/**
* Virtual destructor.
@@ -87,21 +90,13 @@ class ValuesConstraint : public Constraint<T>
};
template<class T>
-ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)
+ValuesConstraint<T>::ValuesConstraint(std::vector<T> const& allowed)
: _allowed(allowed),
_typeDesc("")
{
for ( unsigned int i = 0; i < _allowed.size(); i++ )
{
-
-#if defined(HAVE_SSTREAM)
std::ostringstream os;
-#elif defined(HAVE_STRSTREAM)
- std::ostrstream os;
-#else
-#error "Need a stringstream (sstream or strstream) to compile!"
-#endif
-
os << _allowed[i];
std::string temp( os.str() );
diff --git a/TCLAP/tclap/Visitor.h b/TCLAP/tclap/Visitor.h
index 393320a..2a7bfd1 100644
--- a/TCLAP/tclap/Visitor.h
+++ b/TCLAP/tclap/Visitor.h
@@ -1,9 +1,12 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2017, Google LLC
* All rights reserved.
*
* See the file COPYING in the top directory of this distribution for
@@ -43,9 +46,10 @@ class Visitor
virtual ~Visitor() { }
/**
- * Does nothing. Should be overridden by child.
+ * This method (to implemented by children) will be
+ * called when the visitor is visited.
*/
- virtual void visit() { }
+ virtual void visit() = 0;
};
}
diff --git a/TCLAP/tclap/XorHandler.h b/TCLAP/tclap/XorHandler.h
index 64fcffc..e80f9ee 100644
--- a/TCLAP/tclap/XorHandler.h
+++ b/TCLAP/tclap/XorHandler.h
@@ -1,3 +1,5 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
/******************************************************************************
*
@@ -55,8 +57,8 @@ class XorHandler
* Add a list of Arg*'s that will be xor'd together.
* \param ors - list of Arg* that will be xor'd.
*/
- void add( std::vector<Arg*>& ors );
-
+ void add( const std::vector<Arg*>& ors );
+
/**
* Checks whether the specified Arg is in one of the xor lists and
* if it does match one, returns the size of the xor list that the
@@ -84,7 +86,7 @@ class XorHandler
*/
bool contains( const Arg* a );
- std::vector< std::vector<Arg*> >& getXorList();
+ const std::vector< std::vector<Arg*> >& getXorList() const;
};
@@ -92,8 +94,8 @@ class XorHandler
//////////////////////////////////////////////////////////////////////
//BEGIN XOR.cpp
//////////////////////////////////////////////////////////////////////
-inline void XorHandler::add( std::vector<Arg*>& ors )
-{
+inline void XorHandler::add( const std::vector<Arg*>& ors )
+{
_orList.push_back( ors );
}
@@ -150,7 +152,7 @@ inline bool XorHandler::contains( const Arg* a )
return false;
}
-inline std::vector< std::vector<Arg*> >& XorHandler::getXorList()
+inline const std::vector< std::vector<Arg*> >& XorHandler::getXorList() const
{
return _orList;
}
diff --git a/TCLAP/tclap/ZshCompletionOutput.h b/TCLAP/tclap/ZshCompletionOutput.h
index acf655b..5a9268c 100644
--- a/TCLAP/tclap/ZshCompletionOutput.h
+++ b/TCLAP/tclap/ZshCompletionOutput.h
@@ -237,8 +237,9 @@ inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex)
if ( a->isValueRequired() )
{
std::string arg = a->shortID();
- // Example arg: "[-A <integer>] ... "
- size_t pos = arg.rfind(" ... ");
+ // Example arg: "[-A <integer>] ..."
+ size_t pos = arg.rfind(" ...");
+
if (pos != std::string::npos) {
arg.erase(pos);
}