From 087c0207be781bc10ef289276664e32c22a56d2a Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 21 Mar 2020 18:19:42 -0500 Subject: [PATCH 1/2] ENH: Update TCLAP to match master upstream branch git clone https://git.code.sf.net/p/tclap/code Manually merge changes from d6419ab71623821c5dd02be3bc2835577fa7d525 --- tclap/CMakeLists.txt | 4 +- tclap/docs/Makefile.am | 3 + tclap/docs/README | 2 +- tclap/docs/index.html | 2 +- tclap/docs/manual.html | 118 ++++++++++++------------ tclap/docs/manual.xml | 2 +- tclap/examples/Makefile.am | 2 +- tclap/include/tclap/ArgException.h | 1 + tclap/include/tclap/ArgTraits.h | 1 + tclap/include/tclap/CmdLine.h | 41 ++++---- tclap/include/tclap/CmdLineInterface.h | 1 + tclap/include/tclap/CmdLineOutput.h | 1 + tclap/include/tclap/Constraint.h | 1 + tclap/include/tclap/DocBookOutput.h | 1 + tclap/include/tclap/MultiArg.h | 1 + tclap/include/tclap/MultiSwitchArg.h | 1 + tclap/include/tclap/StandardTraits.h | 1 + tclap/include/tclap/StdOutput.h | 3 +- tclap/include/tclap/SwitchArg.h | 1 + tclap/include/tclap/UnlabeledMultiArg.h | 1 + tclap/include/tclap/UnlabeledValueArg.h | 1 + tclap/include/tclap/ValueArg.h | 1 + tclap/include/tclap/ValuesConstraint.h | 5 +- tclap/include/tclap/Visitor.h | 1 + 24 files changed, 108 insertions(+), 88 deletions(-) diff --git a/tclap/CMakeLists.txt b/tclap/CMakeLists.txt index 885dbdd..4375898 100644 --- a/tclap/CMakeLists.txt +++ b/tclap/CMakeLists.txt @@ -1,4 +1,6 @@ -project(TCLAP LANGUAGES CXX) + +project(TCLAP VERSION 1.2.2 +LANGUAGES CXX) # -------------------------------------------------------------------------- # Install headers diff --git a/tclap/docs/Makefile.am b/tclap/docs/Makefile.am index 6cb7c3a..f9a0528 100644 --- a/tclap/docs/Makefile.am +++ b/tclap/docs/Makefile.am @@ -4,6 +4,9 @@ if DOC all: @DOXYGEN@ Doxyfile +manual: manual.xml + xsltproc -o manual.html --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl manual.xml + else all: diff --git a/tclap/docs/README b/tclap/docs/README index 8e99542..96d8d40 100644 --- a/tclap/docs/README +++ b/tclap/docs/README @@ -2,4 +2,4 @@ To generate the manual from the docbook xml you need and xslt processor and an xsl file that defines the output. For example: -xsltproc --stringparam html.stylesheet style.css /Users/mes/software/docbook-xsl-1.71.1/xhtml/docbook.xsl manual.xml > manual.html +xsltproc --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl manual.xml > manual.html diff --git a/tclap/docs/index.html b/tclap/docs/index.html index 4546ff0..11b15fb 100644 --- a/tclap/docs/index.html +++ b/tclap/docs/index.html @@ -45,7 +45,7 @@

Links

  • Read the API documentation

  • Visit the SourceForge project page

  • -
  • Send feedback, comments, patches, etc.

  • +
  • Send feedback, comments, patches, etc.

  • diff --git a/tclap/docs/manual.html b/tclap/docs/manual.html index dd75d66..51d4392 100644 --- a/tclap/docs/manual.html +++ b/tclap/docs/manual.html @@ -1,7 +1,5 @@ - - -Templatized C++ Command Line Parser Manual

    Templatized C++ Command Line Parser Manual

    Michael E Smoot


    Chapter 1. Basic Usage

    Overview

    +Templatized C++ Command Line Parser Manual

    Templatized C++ Command Line Parser Manual

    Michael E Smoot


    Chapter 1. Basic Usage

    Overview

    TCLAP has a few key classes to be aware of. The first is the CmdLine (command line) class. This class parses @@ -14,15 +12,15 @@ MultiArg and UnlabeledMultiArg. These classes are templatized, which means they can be defined to parse -a value of any type. Once you add the +a value of any type. Once you add the arguments to the CmdLine object, it parses the command line and assigns the data it finds to the specific argument objects it contains. Your program accesses the values parsed by calls to the getValue() methods of the argument objects. -

    Example

    -Here is a simple example ... +

    Example

    +Here is a simple example ...

     #include <string>
    @@ -137,11 +135,11 @@
        Command description message
     
     

    -

    Library Properties

    +

    Library Properties

    This example shows a number of different properties of the library... -

    • Arguments can appear in any order (...mostly, - more on this later).
    • The help, version +

      • Arguments can appear in any order (...mostly, + more on this later).
      • The help, version and --SwitchArgs are specified automatically. Using either the -h or --help flag will cause the USAGE message to be displayed, @@ -150,31 +148,31 @@ be displayed, and -- or --ignore_rest will cause the remaining labeled arguments to be ignored. These switches are -included by default on every command line. You can disable this functionality if desired (although we don't recommend it). +included by default on every command line. You can disable this functionality if desired (although we don't recommend it). How we generate the behavior behind these flags is described - later. -
      • If there is an error parsing the command line (e.g. a required + later. +
      • If there is an error parsing the command line (e.g. a required argument isn't provided), the program exits and displays a brief -USAGE and an error message.
      • The program name is assumed to always be argv[0], so it isn't -specified directly.
      • A value delimiter character can be specified. This means that if you +USAGE and an error message.
      • The program name is assumed to always be argv[0], so it isn't +specified directly.
      • A value delimiter character can be specified. This means that if you prefer arguments of the style -s=asdf instead of --s asdf, you can do so.
      • Always wrap everything in a try block that catches +-s asdf, you can do so.
      • Always wrap everything in a try block that catches ArgExceptions! Any problems found in constructing the CmdLine, constructing the Args, or parsing the command line will throw an ArgException.

      -

    Common Argument Properties

    +

    Common Argument Properties

    Arguments, whatever their type, have a few common properties. These properties are set in the constructors of the arguments. -

    • First is the flag or the character preceded by a dash(-) that -signals the beginning of the argument on the command line.
    • Arguments also have names, which can also be used +

      • First is the flag or the character preceded by a dash(-) that +signals the beginning of the argument on the command line.
      • Arguments also have names, which can also be used as an alternative flag on the command line, this time preceded by two dashes -(--) [like the familiar getopt_long()].
      • Next is the description of the argument. This is a short +(--) [like the familiar getopt_long()].
      • Next is the description of the argument. This is a short description of the argument displayed in the help/usage message -when needed.
      • The following parameters in the constructors vary depending on +when needed.
      • The following parameters in the constructors vary depending on the type of argument. Some possible values include: -
        • A boolean value indicating whether the Arg is required or not.
        • A default value.
        • A description of the type of value expected.
        • A constraint on the value expected.
        • The CmdLine instance that the Arg should be added to.
        • A Visitor.
      • See the API Documentation for more detail.

      -

    Compiling

    +

    • A boolean value indicating whether the Arg is required or not.
    • A default value.
    • A description of the type of value expected.
    • A constraint on the value expected.
    • The CmdLine instance that the Arg should be added to.
    • A Visitor.
  • See the API Documentation for more detail.
  • +

    Compiling

    TCLAP is implemented entirely in header files which means you only need to include CmdLine.h to use the library.

    @@ -204,7 +202,7 @@
     effort to keep the library compliant with the ANSI C++ standard so
     if your compiler meets the standard, then this library should work
     for you. Please let us know if this is not the case! 
    -

    Windows Note

    +

    Windows Note

    As we understand things, Visual C++ does not have the file config.h which is used to make platform specific definitions. In this situation, we assume that you @@ -217,7 +215,7 @@ should work. We think. Alternatively, just edit the files ValueArg.h and MultiArg.h.

    -

    Random Note

    +

    Random Note

    If your compiler doesn't support the using syntax used in UnlabeledValueArg and UnlabeledMultiArg to support two stage name lookup, @@ -228,26 +226,26 @@ of just _ignorable (do this for each variable or method referenced by using).

    -

    Chapter 2. Fundamental Classes

    CmdLine

    +

    Chapter 2. Fundamental Classes

    CmdLine

    The CmdLine class contains the arguments that define the command line and manages the parsing of the command line. The CmdLine doesn't parse the command line itself it only manages the parsing. The actual parsing of individual arguments occurs within the arguments themselves. The CmdLine keeps track of -of the required arguments, relationships -between arguments, and output generation. -

    SwitchArg

    SwitchArgs are what the name implies: +of the required arguments, relationships +between arguments, and output generation. +

    SwitchArg

    SwitchArgs are what the name implies: simple, on/off, boolean switches. Use SwitchArgs anytime you want to turn some sort of system property on or off. SwitchArgs don't parse a value. They return TRUE or FALSE, depending on whether the switch has been found -on the command line and what the default value was defined as.

    ValueArg

    ValueArgs are arguments that read a +on the command line and what the default value was defined as.

    ValueArg

    ValueArgs are arguments that read a value of some type from the command line. Any time you need a file name, a number, etc. use a ValueArg or one of its variants. All ValueArgs are - templatized and will attempt to parse + templatized and will attempt to parse the string its flag matches on the command line as the type it is specified as. ValueArg<int> will attempt to parse an @@ -256,7 +254,7 @@ for the specified type doesn't recognize the string on the command line as its defined type, then an exception will be thrown. -

    MultiArg

    +

    MultiArg

    A MultiArg is a ValueArg that can be specified more than once on a command line and instead of returning a single value, returns a vector of values. @@ -285,8 +283,8 @@

    Note that MultiArgs can be added to the CmdLine in any order (unlike - UnlabeledMultiArg). -

    MultiSwitchArg

    + UnlabeledMultiArg). +

    MultiSwitchArg

    A MultiSwitchArg is a SwitchArg that can be specified more than once on a command line. This can be useful @@ -307,7 +305,7 @@ MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5); cmd.add( quiet );

    -

    UnlabeledValueArg

    +

    UnlabeledValueArg

    An UnlabeledValueArg is a ValueArg that is not identified by a flag on the command line. Instead UnlabeledValueArgs are identified by their position in the argv array. @@ -316,7 +314,7 @@ identifying them on the command line, but there are some situations where flags are burdensome and not worth the effort. One example might be if you want to implement a magical command we'll -call copy. All copy does is +call copy. All copy does is copy the file specified in the first argument to the file specified in the second argument. We can do this using UnlabeledValueArgs which are pretty @@ -327,7 +325,7 @@

     
    -                UnlabeledValueArg<float>  nolabel( "name", "unlabeled test", 3.14,
    +                UnlabeledValueArg<float>  nolabel( "name", "unlabeled test", true, 3.14,
                                                       "nameString"  );
                     cmd.add( nolabel );
     
    @@ -348,7 +346,7 @@
     or in the declaration), but the UnlabeledValueArgs 
     will still be parsed in the order they are added. Just remember that order is
     important for unlabeled arguments. 
    -

    UnlabeledMultiArg

    +

    UnlabeledMultiArg

    An UnlabeledMultiArg is an UnlabeledValueArg that allows more than one value to be specified. Only one UnlabeledMultiArg can be specified per command line. The UnlabeledMultiArg simply reads the remaining @@ -356,7 +354,7 @@

    Say you want a strange command that searches each file specified for a given string (let's call it -grep), but you don't want to have to type in all of the file +grep), but you don't want to have to type in all of the file names or write a script to do it for you. Say,

    @@ -364,7 +362,7 @@
     

    First remember that the * is handled by the shell and -expanded accordingly, so what the program grep sees is +expanded accordingly, so what the program grep sees is really something like:

    @@ -413,11 +411,11 @@
     then just declare the UnlabeledMultiArg as type
     string and parse the different values yourself or use
     several UnlabeledValueArgs. 
    -

    Chapter 3. Complications

    Naturally, what we have seen to this point doesn't satisfy all of our needs. -

    I want to combine multiple switches into one argument...

    +

    I want to combine multiple switches into one argument...

    Multiple SwitchArgs can be combined into a single argument on the command line. If you have switches -a, -b and -c it is valid to do either: @@ -440,7 +438,7 @@ This is to make this library more in line with the POSIX and GNU standards (as I understand them). -

    I want one argument or the other, but not both...

    +

    I want one argument or the other, but not both...

    Suppose you have a command that must read input from one of two possible locations, either a local file or a URL. The command must read something, so one @@ -518,7 +516,7 @@

    -

    I have more arguments than single flags make sense for...

    +

    I have more arguments than single flags make sense for...

    Some commands have so many options that single flags no longer map sensibly to the available options. In this case, it is desirable to specify Args using only long options. This one is easy to @@ -534,7 +532,7 @@ SwitchArg caseSwitch("","upperCase","Print in upper case",false);

    -

    I want to constrain the values allowed for a particular +

    I want to constrain the values allowed for a particular argument...

    Interface Change!!! Sorry folks, but we've changed the interface since version 1.0.X for constraining Args. @@ -587,7 +585,7 @@ checks whether the value parsed is greater than 0 (done in the check() method) and create your Arg with your new Constraint. -

    I want the Args to add themselves to the CmdLine...

    +

    I want the Args to add themselves to the CmdLine...

    New constructors have been added for each Arg that take a CmdLine object as an argument. Each Arg then @@ -618,7 +616,7 @@ cmd.parse(argc,argv);

    -

    I want different output than what is provided...

    +

    I want different output than what is provided...

    It is straightforward to change the output generated by TCLAP. Either subclass the StdOutput class and re-implement the methods you choose, @@ -671,7 +669,7 @@ yourself. Also note that the failure method is now responsible for exiting the application (assuming that is the desired behavior). -

    I don't want the --help and --version switches to be created automatically...

    +

    I don't want the --help and --version switches to be created automatically...

    Help and version information is useful for nearly all command line applications and as such we generate flags that provide those options automatically. However, there are situations when these flags are undesirable. For these @@ -681,7 +679,7 @@

     		CmdLine cmd("this is a message", ' ', "0.99", false );
     

    -

    I want to ignore certain arguments...

    +

    I want to ignore certain arguments...

    The -- flag is automatically included in the CmdLine. As (almost) per POSIX and GNU standards, any argument specified @@ -702,8 +700,8 @@ ignore arguments after the --. To accommodate this, we can make both UnlabeledValueArgs and UnlabeledMultiArgs ignoreable in their constructors. -See the API Documentation for details. -

    I want to ignore unmatched arguments...

    +See the API Documentation for details. +

    I want to ignore unmatched arguments...

    By default, if TCLAP sees an argument that doesn't match a specified Arg, it will produce an exception. This strict handling provides some assurance that all input to a program @@ -754,7 +752,7 @@ is set to true and an UnlabeledMultiArg is added to the command line, then the UnlabeledMultiArg will "win" and all extra arguments will be added to it rather than be ignored. -

    I want to read hex integers as arguments...

    +

    I want to read hex integers as arguments...

    Sometimes it's desirable to read integers formatted in decimal, hexadecimal, and octal format. This is now possible by #defining the TCLAP_SETBASE_ZERO directive. Simply define this directive in your code and integer arguments will be parsed @@ -800,7 +798,7 @@ setbase() is meant to be used. So while we're making this functionality available, we're not turning it on by default for fear of bad things happening in different compilers. If you know otherwise, please let us know. -

    I want to use different types...

    +

    I want to use different types...

    The usual C++ types (int, long, bool, etc.) are supported by TCLAP out of the box. As long as operator>> and operator<< are supported, other types should work fine @@ -826,7 +824,7 @@ For complete examples see the files test11.cpp and test12.cpp in the examples directory. -

    I want to use Windows-style flags like "/x" and "/y"...

    +

    I want to use Windows-style flags like "/x" and "/y"...

    It is traditional in Posix environments that the "-" and "--" strings are used to signify the beginning of argument flags and long argument names. However, other environments, namely Windows, use different strings. TCLAP allows you to @@ -857,14 +855,14 @@

    -

    Chapter 4. Notes

    +

    Chapter 4. Notes

    Like all good rules, there are many exceptions.... -

    Type Descriptions

    +

    Type Descriptions

    Ideally this library would use RTTI to return a human readable name of the type declared for a particular argument. Unfortunately, at -least for g++, the names returned aren't +least for g++, the names returned aren't particularly useful. -

    Visitors

    +

    Visitors

    Disclaimer: Almost no one will have any use for Visitors, they were added to provide special handling for default arguments. Nothing @@ -933,8 +931,8 @@ the program will print the author name, Homer J. Simpson and exit without processing any further (as specified in the visit() method). -

    More Information

    -For more information, look at the +

    More Information

    +For more information, look at the API Documentation and the examples included with the distribution.

    diff --git a/tclap/docs/manual.xml b/tclap/docs/manual.xml index 3a25878..f9d1caf 100644 --- a/tclap/docs/manual.xml +++ b/tclap/docs/manual.xml @@ -461,7 +461,7 @@ The code would look like this: - UnlabeledValueArg<float> nolabel( "name", "unlabeled test", 3.14, + UnlabeledValueArg<float> nolabel( "name", "unlabeled test", true, 3.14, "nameString" ); cmd.add( nolabel ); diff --git a/tclap/examples/Makefile.am b/tclap/examples/Makefile.am index cad4369..8c06efb 100644 --- a/tclap/examples/Makefile.am +++ b/tclap/examples/Makefile.am @@ -20,7 +20,7 @@ test13_SOURCES = test13.cpp test14_SOURCES = test14.cpp test15_SOURCES = test15.cpp test16_SOURCES = test16.cpp -test17_SOURCES = test17.cpp test17-a.cpp +test17_SOURCES = test-hard-1.cpp test-hard-2.cpp test18_SOURCES = test18.cpp test19_SOURCES = test19.cpp test20_SOURCES = test20.cpp diff --git a/tclap/include/tclap/ArgException.h b/tclap/include/tclap/ArgException.h index f789d1c..2102095 100644 --- a/tclap/include/tclap/ArgException.h +++ b/tclap/include/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 diff --git a/tclap/include/tclap/ArgTraits.h b/tclap/include/tclap/ArgTraits.h index 6f364bf..0ccf5e3 100644 --- a/tclap/include/tclap/ArgTraits.h +++ b/tclap/include/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 diff --git a/tclap/include/tclap/CmdLine.h b/tclap/include/tclap/CmdLine.h index 66e428d..be78985 100644 --- a/tclap/include/tclap/CmdLine.h +++ b/tclap/include/tclap/CmdLine.h @@ -355,7 +355,7 @@ inline CmdLine::CmdLine(const std::string& m, _constructor(); } -CmdLine::~CmdLine() +inline CmdLine::~CmdLine() { ClearContainer(_argDeleteOnExitList); ClearContainer(_visitorDeleteOnExitList); @@ -366,7 +366,7 @@ CmdLine::~CmdLine() } } -void CmdLine::_constructor() +inline void CmdLine::_constructor() { _output = new StdOutput; @@ -403,7 +403,7 @@ void CmdLine::_constructor() deleteOnExit(v); } -void CmdLine::xorAdd( const std::vector& ors ) +inline void CmdLine::xorAdd( const std::vector& ors ) { _xorHandler.add( ors ); @@ -415,7 +415,7 @@ void CmdLine::xorAdd( const std::vector& ors ) } } -void CmdLine::xorAdd( Arg& a, Arg& b ) +inline void CmdLine::xorAdd( Arg& a, Arg& b ) { std::vector ors; ors.push_back( &a ); @@ -423,12 +423,12 @@ void CmdLine::xorAdd( Arg& a, Arg& b ) xorAdd( ors ); } -void CmdLine::add( Arg& a ) +inline void CmdLine::add( Arg& a ) { add( &a ); } -void CmdLine::add( Arg* a ) +inline void CmdLine::add( Arg* a ) { for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) if ( *a == *(*it) ) @@ -442,7 +442,8 @@ void CmdLine::add( Arg* a ) _numRequired++; } -void CmdLine::parse(int argc, const char * const * argv) + +inline void CmdLine::parse(int argc, const char * const * argv) { // this step is necessary so that we have easy access to // mutable strings. @@ -520,7 +521,7 @@ inline void CmdLine::parse(std::vector& args) exit(estat); } -bool CmdLine::_emptyCombined(const std::string& s) +inline bool CmdLine::_emptyCombined(const std::string& s) { if ( s.length() > 0 && s[0] != Arg::flagStartChar() ) return false; @@ -532,7 +533,7 @@ bool CmdLine::_emptyCombined(const std::string& s) return true; } -void CmdLine::missingArgsException() +inline void CmdLine::missingArgsException() { int count = 0; @@ -559,22 +560,22 @@ void CmdLine::missingArgsException() throw(CmdLineParseException(msg)); } -void CmdLine::deleteOnExit(Arg* ptr) +inline void CmdLine::deleteOnExit(Arg* ptr) { _argDeleteOnExitList.push_back(ptr); } -void CmdLine::deleteOnExit(Visitor* ptr) +inline void CmdLine::deleteOnExit(Visitor* ptr) { _visitorDeleteOnExitList.push_back(ptr); } -CmdLineOutput* CmdLine::getOutput() +inline CmdLineOutput* CmdLine::getOutput() { return _output; } -void CmdLine::setOutput(CmdLineOutput* co) +inline void CmdLine::setOutput(CmdLineOutput* co) { if ( !_userSetOutput ) delete _output; @@ -582,37 +583,37 @@ void CmdLine::setOutput(CmdLineOutput* co) _output = co; } -std::string& CmdLine::getVersion() +inline std::string& CmdLine::getVersion() { return _version; } -std::string& CmdLine::getProgramName() +inline std::string& CmdLine::getProgramName() { return _progName; } -std::list& CmdLine::getArgList() +inline std::list& CmdLine::getArgList() { return _argList; } -XorHandler& CmdLine::getXorHandler() +inline XorHandler& CmdLine::getXorHandler() { return _xorHandler; } -char CmdLine::getDelimiter() +inline char CmdLine::getDelimiter() { return _delimiter; } -std::string& CmdLine::getMessage() +inline std::string& CmdLine::getMessage() { return _message; } -bool CmdLine::hasHelpAndVersion() +inline bool CmdLine::hasHelpAndVersion() { return _helpAndVersion; } diff --git a/tclap/include/tclap/CmdLineInterface.h b/tclap/include/tclap/CmdLineInterface.h index 60a7161..a9bdca0 100644 --- a/tclap/include/tclap/CmdLineInterface.h +++ b/tclap/include/tclap/CmdLineInterface.h @@ -7,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/include/tclap/CmdLineOutput.h b/tclap/include/tclap/CmdLineOutput.h index a25bd37..cbc9a32 100644 --- a/tclap/include/tclap/CmdLineOutput.h +++ b/tclap/include/tclap/CmdLineOutput.h @@ -7,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/include/tclap/Constraint.h b/tclap/include/tclap/Constraint.h index e679c88..ff869cc 100644 --- a/tclap/include/tclap/Constraint.h +++ b/tclap/include/tclap/Constraint.h @@ -6,6 +6,7 @@ * 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 diff --git a/tclap/include/tclap/DocBookOutput.h b/tclap/include/tclap/DocBookOutput.h index 5651253..80b10e5 100644 --- a/tclap/include/tclap/DocBookOutput.h +++ b/tclap/include/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 diff --git a/tclap/include/tclap/MultiArg.h b/tclap/include/tclap/MultiArg.h index a11b375..432a120 100644 --- a/tclap/include/tclap/MultiArg.h +++ b/tclap/include/tclap/MultiArg.h @@ -6,6 +6,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/include/tclap/MultiSwitchArg.h b/tclap/include/tclap/MultiSwitchArg.h index 0b61766..e333ea7 100644 --- a/tclap/include/tclap/MultiSwitchArg.h +++ b/tclap/include/tclap/MultiSwitchArg.h @@ -8,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 diff --git a/tclap/include/tclap/StandardTraits.h b/tclap/include/tclap/StandardTraits.h index 9eb8f94..5864f77 100644 --- a/tclap/include/tclap/StandardTraits.h +++ b/tclap/include/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 diff --git a/tclap/include/tclap/StdOutput.h b/tclap/include/tclap/StdOutput.h index 09447a1..b717fc7 100644 --- a/tclap/include/tclap/StdOutput.h +++ b/tclap/include/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 @@ -168,7 +169,7 @@ StdOutput::_shortUsage( CmdLineInterface& _cmd, XorHandler xorHandler = _cmd.getXorHandler(); std::vector< std::vector > xorList = xorHandler.getXorList(); - std::string s = progName; + std::string s = progName + " "; spacePrint( os, s, 75, 2, 6 ); s.clear(); diff --git a/tclap/include/tclap/SwitchArg.h b/tclap/include/tclap/SwitchArg.h index 14489cf..4ca130d 100644 --- a/tclap/include/tclap/SwitchArg.h +++ b/tclap/include/tclap/SwitchArg.h @@ -6,6 +6,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/include/tclap/UnlabeledMultiArg.h b/tclap/include/tclap/UnlabeledMultiArg.h index 6b406b8..48feb84 100644 --- a/tclap/include/tclap/UnlabeledMultiArg.h +++ b/tclap/include/tclap/UnlabeledMultiArg.h @@ -6,6 +6,7 @@ * 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/include/tclap/UnlabeledValueArg.h b/tclap/include/tclap/UnlabeledValueArg.h index 6fdbff3..341a3c0 100644 --- a/tclap/include/tclap/UnlabeledValueArg.h +++ b/tclap/include/tclap/UnlabeledValueArg.h @@ -7,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/include/tclap/ValueArg.h b/tclap/include/tclap/ValueArg.h index b5289ba..dee023a 100644 --- a/tclap/include/tclap/ValueArg.h +++ b/tclap/include/tclap/ValueArg.h @@ -6,6 +6,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/include/tclap/ValuesConstraint.h b/tclap/include/tclap/ValuesConstraint.h index ea9d832..3c4dca0 100644 --- a/tclap/include/tclap/ValuesConstraint.h +++ b/tclap/include/tclap/ValuesConstraint.h @@ -7,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 @@ -54,7 +55,7 @@ class ValuesConstraint : public Constraint * Constructor. * \param allowed - vector of allowed values. */ - ValuesConstraint(std::vector& allowed); + ValuesConstraint(std::vectorconst& allowed); /** * Virtual destructor. @@ -93,7 +94,7 @@ class ValuesConstraint : public Constraint }; template -ValuesConstraint::ValuesConstraint(std::vector& allowed) +ValuesConstraint::ValuesConstraint(std::vector const& allowed) : _allowed(allowed), _typeDesc("") { diff --git a/tclap/include/tclap/Visitor.h b/tclap/include/tclap/Visitor.h index 0d30ca3..2a7bfd1 100644 --- a/tclap/include/tclap/Visitor.h +++ b/tclap/include/tclap/Visitor.h @@ -6,6 +6,7 @@ * 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 From f05b72bd0728654af7d9adeb322cd1337daa951f Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 27 Jan 2025 12:51:01 -0600 Subject: [PATCH 2/2] ENH: Updates to tclap branch 1.4 This is from https://git.code.sf.net/p/tclap/code commit 81b3d2a0c47895c22e9bb8c577f5ab521f76e5d2 branch 1.4 of tclap Make virtual functions calls from constructor explicit. Calling virtual functions from the ctor is safe in C++, but can be confusing. This fixes clang-tidy warnings. Fixes clan-tidy warnings (https://sourceforge.net/p/tclap/patches/18/). Allow const Constraints in constructors Constraints are only used in const-safe ways, so allow a caller to pass a const Constraint. It also allows static construction of constant constraints. Add missing call to check visitor in Unlabeled args. Fixed an error in packaging preventing proper discovery using CMake `find_package` Added packaging using CPack and discovery using pkg-config. Allowed to disable building of examples and unittests. And docs (BUILD_DOC used to have no effect, it is not the case since now.) Remove confusing statement about not supplying flag argument. This is more hurtful than helpful, flag doesn't have to be specified (our docs even have this example), but flag or name does. Fix compilation issue with C++20 and gcc-11.1 Fix some (harmless) warnings from Visual Studio. VS issues warnings for `conversion from 'size_t' to 'int', possible loss of data`. Of course since these are all short strings, it's not an issue - but better to get rid of the warnings so we don't miss anything else. Remove instructions to use cmake --install . --prefix=..., it appears flaky. It doesn't appear to work with my custom doc install targets, they still revert to using the default value of CMAKE_INSTALL_PREFIX (probably because the variable is expanded during configuration, not install phase - but that's a guess). Added docs to install targets. There appears to be no standard way to install docs with CMake, so I've setup paths for win and *NIX to the best of my ability. Include generated docs in release tarball. Also, make sure that release script doesn't have to be run from the top level tclap directory. Explicitly initiailze member variables in init-list. clang-format on unittest files. No functional change. Fixed typos. Fix compilation issue on Windows. Use ptrdiff_t (C++ type) instead of ssize_t (UNIX type). Fix a bug where help output would crash if the program name was 3 chars. https://sourceforge.net/p/tclap/patches/17/ Also added some very basic support for unit tests. We can look at pulling in some more robust unit testing framework later on, but for now keeping it simple to avoid bloat. In addition, consider only platform specific path separators. Script to copy files for release. Make a note that CMake < 3.15 needs plaform specific installer. Clarify that --prefix flag goes on the --install command. --In preparation for release of v1.4. Upload docs for 1.4 to both 1.4 and root. Run clang-format on all files in prep. for 1.4 release. Clean the news file for 1.4 release. Note current maintainer in authors file. Update ChangeLog for 1.4 release. Cleaup manual.xml for 1.4 release candidate. Update Google copyright stansa. Fix compilation error on MacOS operator>> has to be declared before inclusion of Arg.h (CmdLine.h). Update copyright notices and version info. Correct/clarify years and reorder in reverse chronological order in the manual. Added note that this manual is for v1.4 since we'll soon have two versions "live". HTML manual is now built by cmake, no need to maintain it manually. Make a note of it, and remove the checked in generated file. Add example for how to use a pair as a custom type. https://sourceforge.net/p/tclap/support-requests/2/ Update generated documentation for 1.4. Echo commands from upload script. To avoid myself getting confused when the right $USER is not set. Add documentation for ExitException. Looks like it may be useful for some users to catch this instead of having TCLAP terminate the program. Also clarify that ArgException doesn't catch *any* exception. https://sourceforge.net/p/tclap/bugs/29/ Add missing expected test output from [96fd5ea]. Add some generated file types to gitignore (and sort it). Check arguments vector is not empty before accessing first element. Some users use TCLAP to parse messages sent between long-running programs by puting arguments in a std::vector and use CmdLine::parse to parse it. Passing an empty vector to parse results in a segmentation violation (due to the fact that we always expect to be able to pop the first element). Change the behaviour to throw a more user friendly error message. https://sourceforge.net/p/tclap/bugs/30/ Revert dd2c7b6faa13ad74bce2bfe26e5483e62186ed6c that was pushed upstream by mistake. Don't catch exceptions by value. Exceptions are polymorphic, catching by value may loose information. fix sign-conversion warnings ENH: Adding travis build enviornment for CI testing CI integration for many common platforms. - Unix based platforms included - Many common unix compilers included Allow travis building of all branches ENH: Adding my.cdash.org reporting site for testing. To generate a report of the build & testing environment. ``` mkdir -p tclap-code-build cd tclap-code-build cmake ../tclap-code make Experimental # or ninja Experimental or ... ``` Then open https://my.cdash.org/index.php?project=tclap to see the resulting report. ENH: Explicitly add LANGUAGES CXX for project. STYLE: Convert CMake-language commands to lower case Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. STYLE: Remove CMake-language block-end command arguments Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. ENH: enable_testing at top level You need to move the enable_testing() call to be before you do add_subdirectory(tests). https://stackoverflow.com/questions/30250494/ctest-not-detecting-tests Clean up handling of locally allocated objects. 1) Just keep a default StdOutput around so we don't have to track if it was set by user. 2) Generalize handling of deleting allocated objects when CmdLine is destroyed. Updated TODOs Cleanup some simple setters. Inline into the class if they are only one line and make them const whenever possible. --- tclap/.clang-format | 65 + tclap/.gitignore | 22 +- tclap/.travis.yml | 182 ++ tclap/AUTHORS | 2 +- tclap/CMakeLists.txt | 162 +- tclap/COPYING | 6 +- tclap/CTestConfig.cmake | 15 + tclap/ChangeLog | 1779 +---------------- tclap/Example.xml | 66 - tclap/INSTALL | 182 -- tclap/Makefile.am | 10 - tclap/NEWS | 97 - tclap/README | 3 - tclap/TCLAPConfig.cmake.in | 6 - tclap/TCLAPInstallConfig.cmake.in | 11 - tclap/UseTCLAP.cmake.in | 1 - tclap/autotools.sh | 19 - tclap/config/Makefile.am | 7 - tclap/config/ac_cxx_have_long_long.m4 | 19 - tclap/config/ac_cxx_have_sstream.m4 | 25 - tclap/config/ac_cxx_have_strstream.m4 | 28 - tclap/config/ac_cxx_namespaces.m4 | 22 - tclap/config/ac_cxx_warn_effective_cxx.m4 | 31 - tclap/config/bb_enable_doxygen.m4 | 18 - tclap/config/depcomp | 411 ---- tclap/config/install-sh | 251 --- tclap/config/missing | 283 --- tclap/config/mkinstalldirs | 40 - tclap/config/stamp-h.in | 1 - tclap/config/stamp-h1 | 1 - tclap/configure.ac | 31 - tclap/configure.in | 22 - tclap/docs/Doxyfile.in | 1078 ---------- tclap/docs/Makefile.am | 35 - tclap/docs/README | 5 - tclap/docs/index.html | 92 - tclap/docs/manual.html | 940 --------- tclap/docs/manual.xml | 1195 ----------- tclap/docs/style.css | 117 -- tclap/docs/upload.sh | 4 - tclap/examples/Makefile.am | 40 - tclap/examples/test1.cpp | 48 - tclap/examples/test10.cpp | 28 - tclap/examples/test11.cpp | 56 - tclap/examples/test12.cpp | 72 - tclap/examples/test13.cpp | 59 - tclap/examples/test14.cpp | 60 - tclap/examples/test15.cpp | 60 - tclap/examples/test16.cpp | 45 - tclap/examples/test17-a.cpp | 3 - tclap/examples/test17.cpp | 5 - tclap/examples/test18.cpp | 29 - tclap/examples/test19.cpp | 41 - tclap/examples/test2.cpp | 97 - tclap/examples/test20.cpp | 29 - tclap/examples/test21.cpp | 54 - tclap/examples/test22.cpp | 47 - tclap/examples/test23.cpp | 80 - tclap/examples/test24.cpp | 67 - tclap/examples/test25.cpp | 37 - tclap/examples/test26.cpp | 42 - tclap/examples/test27.cpp | 26 - tclap/examples/test28.cpp | 35 - tclap/examples/test3.cpp | 95 - tclap/examples/test4.cpp | 108 - tclap/examples/test5.cpp | 120 -- tclap/examples/test6.cpp | 53 - tclap/examples/test7.cpp | 96 - tclap/examples/test8.cpp | 91 - tclap/examples/test9.cpp | 58 - tclap/include/Makefile.am | 1 - tclap/include/tclap/Arg.h | 984 +++++---- tclap/include/tclap/ArgContainer.h | 58 + tclap/include/tclap/ArgException.h | 295 ++- tclap/include/tclap/ArgGroup.h | 256 +++ tclap/include/tclap/ArgOld.h | 587 ------ tclap/include/tclap/ArgTraits.h | 85 +- tclap/include/tclap/CMakeLists.txt | 4 + tclap/include/tclap/CmdLine.h | 1066 +++++----- tclap/include/tclap/CmdLineInterface.h | 269 +-- tclap/include/tclap/CmdLineOutput.h | 152 +- tclap/include/tclap/Constraint.h | 75 +- tclap/include/tclap/DeferDelete.h | 74 + tclap/include/tclap/DocBookOutput.h | 533 +++-- tclap/include/tclap/HelpVisitor.h | 99 +- tclap/include/tclap/IgnoreRestVisitor.h | 59 +- tclap/include/tclap/Makefile.am | 29 - tclap/include/tclap/MultiArg.h | 655 +++--- tclap/include/tclap/MultiArgOld.h | 531 ----- tclap/include/tclap/MultiSwitchArg.h | 328 ++- .../include/tclap/OptionalUnlabeledTracker.h | 76 +- tclap/include/tclap/StandardTraits.h | 20 +- tclap/include/tclap/StdOutput.h | 724 ++++--- tclap/include/tclap/SwitchArg.h | 398 ++-- tclap/include/tclap/UnlabeledMultiArg.h | 487 ++--- tclap/include/tclap/UnlabeledValueArg.h | 523 +++-- tclap/include/tclap/ValueArg.h | 649 +++--- tclap/include/tclap/ValueArgOld.h | 527 ----- tclap/include/tclap/ValuesConstraint.h | 185 +- tclap/include/tclap/VersionVisitor.h | 102 +- tclap/include/tclap/Visitor.h | 71 +- tclap/include/tclap/XMLOutput.h | 261 --- tclap/include/tclap/XorHandler.h | 168 -- tclap/include/tclap/ZshCompletionOutput.h | 336 ---- tclap/include/tclap/sstream.h | 22 +- tclap/msc/Makefile.am | 9 - tclap/msc/README | 17 - tclap/msc/examples/Makefile.am | 10 - tclap/msc/examples/test1.vcproj | 134 -- tclap/msc/examples/test2.vcproj | 134 -- tclap/msc/examples/test3.vcproj | 134 -- tclap/msc/examples/test4.vcproj | 134 -- tclap/msc/examples/test5.vcproj | 134 -- tclap/msc/examples/test6.vcproj | 134 -- tclap/msc/examples/test7.vcproj | 134 -- tclap/msc/examples/test8.vcproj | 134 -- tclap/msc/tclap-beta.ncb | Bin 44032 -> 0 bytes tclap/msc/tclap-beta.sln | 78 - tclap/msc/tclap-beta.suo | Bin 24576 -> 0 bytes tclap/msc/tclap-beta.vcproj | 114 -- tclap/scripts/check_dead_headers.py | 47 - tclap/scripts/check_tests_enabled.py | 49 - tclap/scripts/fix-test.py | 63 - tclap/scripts/modeline.py | 16 - tclap/tests/Makefile.am | 184 -- tclap/tests/genOut.pl | 11 - tclap/tests/runtests.sh | 7 - tclap/tests/simple-test.sh | 19 - tclap/tests/test1.out | 1 - tclap/tests/test1.sh | 3 - tclap/tests/test10.out | 10 - tclap/tests/test10.sh | 3 - tclap/tests/test11.out | 10 - tclap/tests/test11.sh | 3 - tclap/tests/test12.out | 10 - tclap/tests/test12.sh | 3 - tclap/tests/test13.out | 7 - tclap/tests/test13.sh | 3 - tclap/tests/test14.out | 7 - tclap/tests/test14.sh | 3 - tclap/tests/test15.out | 11 - tclap/tests/test15.sh | 3 - tclap/tests/test16.out | 11 - tclap/tests/test16.sh | 3 - tclap/tests/test17.out | 11 - tclap/tests/test17.sh | 3 - tclap/tests/test18.out | 2 - tclap/tests/test18.sh | 3 - tclap/tests/test19.out | 3 - tclap/tests/test19.sh | 3 - tclap/tests/test2.out | 1 - tclap/tests/test2.sh | 3 - tclap/tests/test20.out | 7 - tclap/tests/test20.sh | 3 - tclap/tests/test21.out | 6 - tclap/tests/test21.sh | 3 - tclap/tests/test22.out | 11 - tclap/tests/test22.sh | 3 - tclap/tests/test23.out | 11 - tclap/tests/test23.sh | 3 - tclap/tests/test24.out | 11 - tclap/tests/test24.sh | 3 - tclap/tests/test25.out | 7 - tclap/tests/test25.sh | 3 - tclap/tests/test26.out | 10 - tclap/tests/test26.sh | 3 - tclap/tests/test27.out | 10 - tclap/tests/test27.sh | 3 - tclap/tests/test28.out | 10 - tclap/tests/test28.sh | 3 - tclap/tests/test29.out | 10 - tclap/tests/test29.sh | 3 - tclap/tests/test3.out | 1 - tclap/tests/test3.sh | 3 - tclap/tests/test30.out | 10 - tclap/tests/test30.sh | 3 - tclap/tests/test31.out | 11 - tclap/tests/test31.sh | 3 - tclap/tests/test32.out | 11 - tclap/tests/test32.sh | 3 - tclap/tests/test33.out | 7 - tclap/tests/test33.sh | 3 - tclap/tests/test34.out | 2 - tclap/tests/test34.sh | 3 - tclap/tests/test35.out | 10 - tclap/tests/test35.sh | 3 - tclap/tests/test36.out | 10 - tclap/tests/test36.sh | 3 - tclap/tests/test37.out | 5 - tclap/tests/test37.sh | 3 - tclap/tests/test38.out | 17 - tclap/tests/test38.sh | 3 - tclap/tests/test39.out | 17 - tclap/tests/test39.sh | 3 - tclap/tests/test4.out | 9 - tclap/tests/test4.sh | 3 - tclap/tests/test40.out | 26 - tclap/tests/test40.sh | 3 - tclap/tests/test41.out | 45 - tclap/tests/test41.sh | 3 - tclap/tests/test42.out | 43 - tclap/tests/test42.sh | 3 - tclap/tests/test43.out | 7 - tclap/tests/test43.sh | 3 - tclap/tests/test44.out | 52 - tclap/tests/test44.sh | 3 - tclap/tests/test45.out | 28 - tclap/tests/test45.sh | 3 - tclap/tests/test46.out | 66 - tclap/tests/test46.sh | 3 - tclap/tests/test47.out | 7 - tclap/tests/test47.sh | 3 - tclap/tests/test48.out | 7 - tclap/tests/test48.sh | 3 - tclap/tests/test49.out | 11 - tclap/tests/test49.sh | 3 - tclap/tests/test5.out | 9 - tclap/tests/test5.sh | 3 - tclap/tests/test50.out | 11 - tclap/tests/test50.sh | 3 - tclap/tests/test51.out | 11 - tclap/tests/test51.sh | 3 - tclap/tests/test52.out | 11 - tclap/tests/test52.sh | 3 - tclap/tests/test53.out | 11 - tclap/tests/test53.sh | 3 - tclap/tests/test54.out | 43 - tclap/tests/test54.sh | 3 - tclap/tests/test55.out | 6 - tclap/tests/test55.sh | 3 - tclap/tests/test56.out | 9 - tclap/tests/test56.sh | 3 - tclap/tests/test57.out | 11 - tclap/tests/test57.sh | 5 - tclap/tests/test58.out | 1 - tclap/tests/test58.sh | 3 - tclap/tests/test59.out | 4 - tclap/tests/test59.sh | 3 - tclap/tests/test6.out | 7 - tclap/tests/test6.sh | 3 - tclap/tests/test60.out | 29 - tclap/tests/test60.sh | 3 - tclap/tests/test61.out | 7 - tclap/tests/test61.sh | 4 - tclap/tests/test62.out | 10 - tclap/tests/test62.sh | 5 - tclap/tests/test63.out | 9 - tclap/tests/test63.sh | 5 - tclap/tests/test64.out | 1 - tclap/tests/test64.sh | 5 - tclap/tests/test65.out | 9 - tclap/tests/test65.sh | 5 - tclap/tests/test66.out | 9 - tclap/tests/test66.sh | 5 - tclap/tests/test67.out | 9 - tclap/tests/test67.sh | 5 - tclap/tests/test68.out | 3 - tclap/tests/test68.sh | 7 - tclap/tests/test69.out | 1 - tclap/tests/test69.sh | 4 - tclap/tests/test7.out | 45 - tclap/tests/test7.sh | 3 - tclap/tests/test70.out | 21 - tclap/tests/test70.sh | 4 - tclap/tests/test71.out | 1 - tclap/tests/test71.sh | 3 - tclap/tests/test72.out | 1 - tclap/tests/test72.sh | 3 - tclap/tests/test73.out | 7 - tclap/tests/test73.sh | 3 - tclap/tests/test74.out | 9 - tclap/tests/test74.sh | 4 - tclap/tests/test75.out | 9 - tclap/tests/test75.sh | 4 - tclap/tests/test76.out | 9 - tclap/tests/test76.sh | 4 - tclap/tests/test77.out | 9 - tclap/tests/test77.sh | 4 - tclap/tests/test78.out | 1 - tclap/tests/test78.sh | 3 - tclap/tests/test79.out | 9 - tclap/tests/test79.sh | 4 - tclap/tests/test8.out | 3 - tclap/tests/test8.sh | 3 - tclap/tests/test80.out | 1 - tclap/tests/test80.sh | 11 - tclap/tests/test81.out | 9 - tclap/tests/test81.sh | 11 - tclap/tests/test82.out | 9 - tclap/tests/test82.sh | 11 - tclap/tests/test83.out | 7 - tclap/tests/test83.sh | 11 - tclap/tests/test84.out | 119 -- tclap/tests/test84.sh | 13 - tclap/tests/test85.out | 10 - tclap/tests/test85.sh | 13 - tclap/tests/test86.out | 1 - tclap/tests/test86.sh | 9 - tclap/tests/test87.out | 1 - tclap/tests/test87.sh | 12 - tclap/tests/test88.out | 4 - tclap/tests/test88.sh | 9 - tclap/tests/test89.out | 1 - tclap/tests/test89.sh | 9 - tclap/tests/test9.out | 10 - tclap/tests/test9.sh | 3 - tclap/tests/testCheck.sh | 35 - 307 files changed, 4638 insertions(+), 18215 deletions(-) create mode 100644 tclap/.clang-format create mode 100644 tclap/.travis.yml create mode 100644 tclap/CTestConfig.cmake delete mode 100755 tclap/Example.xml delete mode 100644 tclap/INSTALL delete mode 100644 tclap/Makefile.am delete mode 100644 tclap/NEWS delete mode 100644 tclap/TCLAPConfig.cmake.in delete mode 100644 tclap/TCLAPInstallConfig.cmake.in delete mode 100644 tclap/UseTCLAP.cmake.in delete mode 100755 tclap/autotools.sh delete mode 100644 tclap/config/Makefile.am delete mode 100644 tclap/config/ac_cxx_have_long_long.m4 delete mode 100644 tclap/config/ac_cxx_have_sstream.m4 delete mode 100644 tclap/config/ac_cxx_have_strstream.m4 delete mode 100644 tclap/config/ac_cxx_namespaces.m4 delete mode 100644 tclap/config/ac_cxx_warn_effective_cxx.m4 delete mode 100644 tclap/config/bb_enable_doxygen.m4 delete mode 100755 tclap/config/depcomp delete mode 100755 tclap/config/install-sh delete mode 100755 tclap/config/missing delete mode 100755 tclap/config/mkinstalldirs delete mode 100644 tclap/config/stamp-h.in delete mode 100644 tclap/config/stamp-h1 delete mode 100644 tclap/configure.ac delete mode 100644 tclap/configure.in delete mode 100644 tclap/docs/Doxyfile.in delete mode 100644 tclap/docs/Makefile.am delete mode 100644 tclap/docs/README delete mode 100644 tclap/docs/index.html delete mode 100644 tclap/docs/manual.html delete mode 100644 tclap/docs/manual.xml delete mode 100755 tclap/docs/style.css delete mode 100755 tclap/docs/upload.sh delete mode 100644 tclap/examples/Makefile.am delete mode 100644 tclap/examples/test1.cpp delete mode 100644 tclap/examples/test10.cpp delete mode 100644 tclap/examples/test11.cpp delete mode 100644 tclap/examples/test12.cpp delete mode 100644 tclap/examples/test13.cpp delete mode 100644 tclap/examples/test14.cpp delete mode 100644 tclap/examples/test15.cpp delete mode 100644 tclap/examples/test16.cpp delete mode 100644 tclap/examples/test17-a.cpp delete mode 100644 tclap/examples/test17.cpp delete mode 100644 tclap/examples/test18.cpp delete mode 100644 tclap/examples/test19.cpp delete mode 100644 tclap/examples/test2.cpp delete mode 100644 tclap/examples/test20.cpp delete mode 100644 tclap/examples/test21.cpp delete mode 100644 tclap/examples/test22.cpp delete mode 100644 tclap/examples/test23.cpp delete mode 100644 tclap/examples/test24.cpp delete mode 100644 tclap/examples/test25.cpp delete mode 100644 tclap/examples/test26.cpp delete mode 100644 tclap/examples/test27.cpp delete mode 100644 tclap/examples/test28.cpp delete mode 100644 tclap/examples/test3.cpp delete mode 100644 tclap/examples/test4.cpp delete mode 100644 tclap/examples/test5.cpp delete mode 100644 tclap/examples/test6.cpp delete mode 100644 tclap/examples/test7.cpp delete mode 100644 tclap/examples/test8.cpp delete mode 100644 tclap/examples/test9.cpp delete mode 100644 tclap/include/Makefile.am create mode 100644 tclap/include/tclap/ArgContainer.h create mode 100644 tclap/include/tclap/ArgGroup.h delete mode 100644 tclap/include/tclap/ArgOld.h create mode 100644 tclap/include/tclap/CMakeLists.txt create mode 100644 tclap/include/tclap/DeferDelete.h delete mode 100644 tclap/include/tclap/Makefile.am delete mode 100644 tclap/include/tclap/MultiArgOld.h delete mode 100644 tclap/include/tclap/ValueArgOld.h delete mode 100644 tclap/include/tclap/XMLOutput.h delete mode 100644 tclap/include/tclap/XorHandler.h delete mode 100644 tclap/include/tclap/ZshCompletionOutput.h delete mode 100644 tclap/msc/Makefile.am delete mode 100644 tclap/msc/README delete mode 100644 tclap/msc/examples/Makefile.am delete mode 100755 tclap/msc/examples/test1.vcproj delete mode 100755 tclap/msc/examples/test2.vcproj delete mode 100755 tclap/msc/examples/test3.vcproj delete mode 100755 tclap/msc/examples/test4.vcproj delete mode 100755 tclap/msc/examples/test5.vcproj delete mode 100755 tclap/msc/examples/test6.vcproj delete mode 100755 tclap/msc/examples/test7.vcproj delete mode 100755 tclap/msc/examples/test8.vcproj delete mode 100755 tclap/msc/tclap-beta.ncb delete mode 100755 tclap/msc/tclap-beta.sln delete mode 100755 tclap/msc/tclap-beta.suo delete mode 100755 tclap/msc/tclap-beta.vcproj delete mode 100755 tclap/scripts/check_dead_headers.py delete mode 100755 tclap/scripts/check_tests_enabled.py delete mode 100755 tclap/scripts/fix-test.py delete mode 100644 tclap/scripts/modeline.py delete mode 100644 tclap/tests/Makefile.am delete mode 100755 tclap/tests/genOut.pl delete mode 100755 tclap/tests/runtests.sh delete mode 100755 tclap/tests/simple-test.sh delete mode 100644 tclap/tests/test1.out delete mode 100755 tclap/tests/test1.sh delete mode 100644 tclap/tests/test10.out delete mode 100755 tclap/tests/test10.sh delete mode 100644 tclap/tests/test11.out delete mode 100755 tclap/tests/test11.sh delete mode 100644 tclap/tests/test12.out delete mode 100755 tclap/tests/test12.sh delete mode 100644 tclap/tests/test13.out delete mode 100755 tclap/tests/test13.sh delete mode 100644 tclap/tests/test14.out delete mode 100755 tclap/tests/test14.sh delete mode 100644 tclap/tests/test15.out delete mode 100755 tclap/tests/test15.sh delete mode 100644 tclap/tests/test16.out delete mode 100755 tclap/tests/test16.sh delete mode 100644 tclap/tests/test17.out delete mode 100755 tclap/tests/test17.sh delete mode 100644 tclap/tests/test18.out delete mode 100755 tclap/tests/test18.sh delete mode 100644 tclap/tests/test19.out delete mode 100755 tclap/tests/test19.sh delete mode 100644 tclap/tests/test2.out delete mode 100755 tclap/tests/test2.sh delete mode 100644 tclap/tests/test20.out delete mode 100755 tclap/tests/test20.sh delete mode 100644 tclap/tests/test21.out delete mode 100755 tclap/tests/test21.sh delete mode 100644 tclap/tests/test22.out delete mode 100755 tclap/tests/test22.sh delete mode 100644 tclap/tests/test23.out delete mode 100755 tclap/tests/test23.sh delete mode 100644 tclap/tests/test24.out delete mode 100755 tclap/tests/test24.sh delete mode 100644 tclap/tests/test25.out delete mode 100755 tclap/tests/test25.sh delete mode 100644 tclap/tests/test26.out delete mode 100755 tclap/tests/test26.sh delete mode 100644 tclap/tests/test27.out delete mode 100755 tclap/tests/test27.sh delete mode 100644 tclap/tests/test28.out delete mode 100755 tclap/tests/test28.sh delete mode 100644 tclap/tests/test29.out delete mode 100755 tclap/tests/test29.sh delete mode 100644 tclap/tests/test3.out delete mode 100755 tclap/tests/test3.sh delete mode 100644 tclap/tests/test30.out delete mode 100755 tclap/tests/test30.sh delete mode 100644 tclap/tests/test31.out delete mode 100755 tclap/tests/test31.sh delete mode 100644 tclap/tests/test32.out delete mode 100755 tclap/tests/test32.sh delete mode 100644 tclap/tests/test33.out delete mode 100755 tclap/tests/test33.sh delete mode 100644 tclap/tests/test34.out delete mode 100755 tclap/tests/test34.sh delete mode 100644 tclap/tests/test35.out delete mode 100755 tclap/tests/test35.sh delete mode 100644 tclap/tests/test36.out delete mode 100755 tclap/tests/test36.sh delete mode 100644 tclap/tests/test37.out delete mode 100755 tclap/tests/test37.sh delete mode 100644 tclap/tests/test38.out delete mode 100755 tclap/tests/test38.sh delete mode 100644 tclap/tests/test39.out delete mode 100755 tclap/tests/test39.sh delete mode 100644 tclap/tests/test4.out delete mode 100755 tclap/tests/test4.sh delete mode 100644 tclap/tests/test40.out delete mode 100755 tclap/tests/test40.sh delete mode 100644 tclap/tests/test41.out delete mode 100755 tclap/tests/test41.sh delete mode 100644 tclap/tests/test42.out delete mode 100755 tclap/tests/test42.sh delete mode 100644 tclap/tests/test43.out delete mode 100755 tclap/tests/test43.sh delete mode 100644 tclap/tests/test44.out delete mode 100755 tclap/tests/test44.sh delete mode 100644 tclap/tests/test45.out delete mode 100755 tclap/tests/test45.sh delete mode 100644 tclap/tests/test46.out delete mode 100755 tclap/tests/test46.sh delete mode 100644 tclap/tests/test47.out delete mode 100755 tclap/tests/test47.sh delete mode 100644 tclap/tests/test48.out delete mode 100755 tclap/tests/test48.sh delete mode 100644 tclap/tests/test49.out delete mode 100755 tclap/tests/test49.sh delete mode 100644 tclap/tests/test5.out delete mode 100755 tclap/tests/test5.sh delete mode 100644 tclap/tests/test50.out delete mode 100755 tclap/tests/test50.sh delete mode 100644 tclap/tests/test51.out delete mode 100755 tclap/tests/test51.sh delete mode 100644 tclap/tests/test52.out delete mode 100755 tclap/tests/test52.sh delete mode 100644 tclap/tests/test53.out delete mode 100755 tclap/tests/test53.sh delete mode 100644 tclap/tests/test54.out delete mode 100755 tclap/tests/test54.sh delete mode 100644 tclap/tests/test55.out delete mode 100755 tclap/tests/test55.sh delete mode 100644 tclap/tests/test56.out delete mode 100755 tclap/tests/test56.sh delete mode 100644 tclap/tests/test57.out delete mode 100755 tclap/tests/test57.sh delete mode 100644 tclap/tests/test58.out delete mode 100755 tclap/tests/test58.sh delete mode 100644 tclap/tests/test59.out delete mode 100755 tclap/tests/test59.sh delete mode 100644 tclap/tests/test6.out delete mode 100755 tclap/tests/test6.sh delete mode 100644 tclap/tests/test60.out delete mode 100755 tclap/tests/test60.sh delete mode 100644 tclap/tests/test61.out delete mode 100755 tclap/tests/test61.sh delete mode 100644 tclap/tests/test62.out delete mode 100755 tclap/tests/test62.sh delete mode 100644 tclap/tests/test63.out delete mode 100755 tclap/tests/test63.sh delete mode 100644 tclap/tests/test64.out delete mode 100755 tclap/tests/test64.sh delete mode 100644 tclap/tests/test65.out delete mode 100755 tclap/tests/test65.sh delete mode 100644 tclap/tests/test66.out delete mode 100755 tclap/tests/test66.sh delete mode 100644 tclap/tests/test67.out delete mode 100755 tclap/tests/test67.sh delete mode 100644 tclap/tests/test68.out delete mode 100755 tclap/tests/test68.sh delete mode 100644 tclap/tests/test69.out delete mode 100755 tclap/tests/test69.sh delete mode 100644 tclap/tests/test7.out delete mode 100755 tclap/tests/test7.sh delete mode 100644 tclap/tests/test70.out delete mode 100755 tclap/tests/test70.sh delete mode 100644 tclap/tests/test71.out delete mode 100755 tclap/tests/test71.sh delete mode 100644 tclap/tests/test72.out delete mode 100755 tclap/tests/test72.sh delete mode 100644 tclap/tests/test73.out delete mode 100755 tclap/tests/test73.sh delete mode 100644 tclap/tests/test74.out delete mode 100755 tclap/tests/test74.sh delete mode 100644 tclap/tests/test75.out delete mode 100755 tclap/tests/test75.sh delete mode 100644 tclap/tests/test76.out delete mode 100755 tclap/tests/test76.sh delete mode 100644 tclap/tests/test77.out delete mode 100755 tclap/tests/test77.sh delete mode 100644 tclap/tests/test78.out delete mode 100755 tclap/tests/test78.sh delete mode 100644 tclap/tests/test79.out delete mode 100755 tclap/tests/test79.sh delete mode 100644 tclap/tests/test8.out delete mode 100755 tclap/tests/test8.sh delete mode 100644 tclap/tests/test80.out delete mode 100755 tclap/tests/test80.sh delete mode 100644 tclap/tests/test81.out delete mode 100755 tclap/tests/test81.sh delete mode 100644 tclap/tests/test82.out delete mode 100755 tclap/tests/test82.sh delete mode 100644 tclap/tests/test83.out delete mode 100755 tclap/tests/test83.sh delete mode 100644 tclap/tests/test84.out delete mode 100755 tclap/tests/test84.sh delete mode 100644 tclap/tests/test85.out delete mode 100755 tclap/tests/test85.sh delete mode 100644 tclap/tests/test86.out delete mode 100755 tclap/tests/test86.sh delete mode 100644 tclap/tests/test87.out delete mode 100755 tclap/tests/test87.sh delete mode 100644 tclap/tests/test88.out delete mode 100755 tclap/tests/test88.sh delete mode 100644 tclap/tests/test89.out delete mode 100755 tclap/tests/test89.sh delete mode 100644 tclap/tests/test9.out delete mode 100755 tclap/tests/test9.sh delete mode 100755 tclap/tests/testCheck.sh diff --git a/tclap/.clang-format b/tclap/.clang-format new file mode 100644 index 0000000..8302c8b --- /dev/null +++ b/tclap/.clang-format @@ -0,0 +1,65 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -4 +AlignAfterOpenBracket: true +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AlwaysBreakAfterDefinitionReturnType: false +AlwaysBreakTemplateDeclarations: true +AlwaysBreakBeforeMultilineStrings: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BinPackParameters: true +BinPackArguments: true +ColumnLimit: 80 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +DerivePointerAlignment: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: true +IndentWrappedFunctionNames: false +IndentFunctionDeclarationAfterType: false +MaxEmptyLinesToKeep: 1 +KeepEmptyLinesAtTheStartOfBlocks: false +NamespaceIndentation: None +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakString: 1000 +PenaltyBreakFirstLessLess: 120 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +SpacesBeforeTrailingComments: 2 +Cpp11BracedListStyle: true +Standard: Auto +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +BreakBeforeBraces: Attach +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpacesInAngles: false +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpaceAfterCStyleCast: false +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +SpaceBeforeParens: ControlStatements +DisableFormat: false +... + diff --git a/tclap/.gitignore b/tclap/.gitignore index 2fa96c9..d3aa2f9 100644 --- a/tclap/.gitignore +++ b/tclap/.gitignore @@ -1,27 +1,33 @@ -*.gcno +*# *.gcda +*.gcno +*.in *.o +*.orig +*.patch +*.pyc *~ -*# -*.in -cov/ +.vs/ +Makefile aclocal.m4 autom4te.cache/ +build/ config.log config.status config/Makefile config/Makefile.in config/config.h* config/stamp-h1 +config/test-driver configure +cov/ docs/Doxyfile docs/html/ examples/.deps/ -examples/test[0-9][0-9] examples/test[0-9] -Makefile +examples/test[0-9][0-9] +inst/ tclap.pc -config/test-driver -tests/tmp.out tests/test*.log tests/test*.trs +tests/tmp.out diff --git a/tclap/.travis.yml b/tclap/.travis.yml new file mode 100644 index 0000000..e052fdd --- /dev/null +++ b/tclap/.travis.yml @@ -0,0 +1,182 @@ +language: cpp +cache: + - ccache + - directories: + - externalobjects + - $HOME/Library/Caches/Homebrew + - /usr/local/Homebrew +dist: bionic + +git: + depth: false + +# Only build the master branch, and pull-requests. +# This turns off commit builds to other branches +# branches: +# only: +# - master + +before_cache: + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi +# Credit https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/9 +# Cache only .git files under "/usr/local/Homebrew" so "brew update" does not take 5min every build + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; fi + +addons: + apt: + sources: + - sourceline: 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main' + key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x60C317803A41BA51845E371A1E9377A2BA9EF27F' + - sourceline: 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu bionic main' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-5.0 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-6.0 main' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main' + - sourceline: 'deb https://apt.kitware.com/ubuntu/ bionic main' + key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc' + - sourceline: 'deb http://ppa.launchpad.net/jonathonf/gcc/ubuntu bionic main' + key_url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4AB0F789CBA31744CC7DA76A8CF63AD3F06FC659' + packages: + - cmake + - ninja-build + - g++-4.8 + - g++-5 + - g++-6 + - g++-7 + - g++-8 + - g++-9 + - gcc-4.8 + - gcc-5 + - gcc-6 + - gcc-7 + - gcc-8 + - gcc-9 + - clang-3.9 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7 + - clang-8 + - clang-9 + +matrix: + include: + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-4.8 CXX=g++-4.8" + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-5 CXX=g++-5" + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-6 CXX=g++-6" + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-7 CXX=g++-7" + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-8 CXX=g++-8" + - os: linux + env: + - MATRIX_EVAL="export CC=gcc-9 CXX=g++-9" +#Linux Clang Starts Here + - os: linux + env: + - MATRIX_EVAL="export CC=clang-3.9 CXX=clang++-3.9" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-4.0 CXX=clang++-4.0" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-5.0 CXX=clang++-5.0" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-6.0 CXX=clang++-6.0" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-7 CXX=clang++-7" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-8 CXX=clang++-8" + - os: linux + env: + - MATRIX_EVAL="export CC=clang-9 CXX=clang++-9" +#OSX GCC Starts here + - os: osx + osx_image: xcode11.3 + env: + - MATRIX_EVAL="export CC=gcc-6 CXX=g++-6" + addons: + homebrew: + packages: + - cmake + - ccache + - ninja + - python + - gcc@6 + update: yes + - os: osx + osx_image: xcode11.3 + env: + - MATRIX_EVAL="export CC=gcc-7 CXX=g++-7" + addons: + homebrew: + packages: + - cmake + - ccache + - ninja + - python + - gcc@7 + update: yes + - os: osx + osx_image: xcode11.3 + env: + - MATRIX_EVAL="export CC=gcc-8 CXX=g++-8" + addons: + homebrew: + packages: + - cmake + - ccache + - ninja + - python + - gcc@8 + update: yes + - os: osx + osx_image: xcode11.3 + env: + - MATRIX_EVAL="export CC=gcc-9 CXX=g++-9" + addons: + homebrew: + packages: + - cmake + - ccache + - ninja + - python + - gcc@9 + update: yes +#OSX clang starts here + - os: osx + osx_image: xcode11.3 + env: + - MATRIX_EVAL="export CC=clang CXX=clang++" + addons: + homebrew: + packages: + - cmake + - ccache + - ninja + - python + update: yes + +before_install: + - eval "${MATRIX_EVAL}" + +script: +# NOTE: ${TRAVIS_BUILD_DIR} is actually the source checkout directory ${TRAVIS_BUILD_DIR}/build is the BUILD_DIR + - mkdir -p ${TRAVIS_BUILD_DIR}/build && cd ${TRAVIS_BUILD_DIR}/build + - "export PATH=\"$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}')\"" + - cd ${TRAVIS_BUILD_DIR}/build && cmake -GNinja -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_DOC:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release ${TRAVIS_BUILD_DIR} + - cd ${TRAVIS_BUILD_DIR}/build && ctest -D Experimental -j2 diff --git a/tclap/AUTHORS b/tclap/AUTHORS index 875a852..9a291f1 100644 --- a/tclap/AUTHORS +++ b/tclap/AUTHORS @@ -1,6 +1,6 @@ original author: Michael E. Smoot -invaluable contributions: Daniel Aarno +current maintainer: Daniel Aarno more contributions: Erik Zeek more contributions: Fabien Carmagnac (Tinbergen-AM) outstanding editing: Carol Smoot diff --git a/tclap/CMakeLists.txt b/tclap/CMakeLists.txt index 4375898..dab879f 100644 --- a/tclap/CMakeLists.txt +++ b/tclap/CMakeLists.txt @@ -1,7 +1,165 @@ +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +cmake_minimum_required(VERSION 3.7) +endif() + +project(TCLAP VERSION 1.4.0 LANGUAGES CXX) +set("PROJECT_DESCRIPTION" "A header-only templatized C++ command line parser library") +set("PROJECT_HOMEPAGE_URL" "https://sourceforge.net/projects/tclap/") + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD_REQUIRED True) +endif() +add_definitions(-DHAVE_TCLAP_CONFIG_H) + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +enable_testing() +include(CTest) +include(CPackComponent) +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}") +endif() +include(CheckCXXSourceCompiles) +check_cxx_source_compiles("#include +int main() { std::istrstream iss; }" TCLAP_HAVE_STRSTREAM) + +check_cxx_source_compiles("#include +int main() { std::istringstream iss; }" TCLAP_HAVE_SSTREAM) + +set(GENERATED_CONFIG_NAME "TCLAPConfig.h") +set(GENERATED_CONFIG_BUILD_DIR "${PROJECT_BINARY_DIR}/tclap") +set(GENERATED_CONFIG_BUILD_PATH "${GENERATED_CONFIG_BUILD_DIR}/${GENERATED_CONFIG_NAME}") + +configure_file(config.h.in "${GENERATED_CONFIG_BUILD_PATH}") + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +cpack_add_component(lib + DISPLAY_NAME "library" + DESCRIPTION "The header-only library" + REQUIRED +) +endif() + +add_library(TCLAP INTERFACE) +target_include_directories(TCLAP INTERFACE + $ + $ +) + +install(TARGETS TCLAP EXPORT TCLAP + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +install(FILES "${GENERATED_CONFIG_BUILD_PATH}" + DESTINATION include/tclap + COMPONENT lib +) + + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +if(DOC_INSTALL_DIR) +else() + if(WIN32) + set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/doc) + else() + set(DOC_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/tclap) + endif() +endif() + +cpack_add_component(doc + DISPLAY_NAME "documentation" + DESCRIPTION "Documentation files for TCLAP" +) + +option(BUILD_EXAMPLES "Build examples" ON) +option(BUILD_UNITTESTS "Build unit tests" ON) +option(BUILD_DOC "Build documentation" ON) + +if(BUILD_DOC) + add_subdirectory(docs) +endif() +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() +add_subdirectory(tests) +if(BUILD_UNITTESTS) + add_subdirectory(unittests) +endif() +endif() +add_subdirectory(include/tclap) + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +set(PackagingTemplatesDir "${CMAKE_CURRENT_SOURCE_DIR}/packaging") + + +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_PACKAGE_VENDOR "tclap developers") +set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}") +set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +set(CPACK_PACKAGE_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}") +set(CPACK_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_MAINTAINER}") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README") + +set(CPACK_DEBIAN_LIB_PACKAGE_NAME "lib${PROJECT_NAME}-dev") +set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libc6-dev") +set(CPACK_DEBIAN_LIB_PACKAGE_SUGGESTS "cmake, pkg-config, pkg-conf") + +set(CPACK_DEBIAN_DOC_PACKAGE_NAME "${PROJECT_NAME}-dev") + +set(CPACK_RPM_LIB_PACKAGE_NAME "lib${PROJECT_NAME}-devel") +set(CPACK_RPM_LIB_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}") + +set(CPACK_RPM_DOC_PACKAGE_NAME "${PROJECT_NAME}-doc") -project(TCLAP VERSION 1.2.2 -LANGUAGES CXX) +set(CPACK_DEB_COMPONENT_INSTALL ON) +set(CPACK_RPM_COMPONENT_INSTALL ON) +set(CPACK_NSIS_COMPONENT_INSTALL ON) +set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") + +set(PKGCONFIG_NAME "tclap") +set(PKG_CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${PKGCONFIG_NAME}.pc") +configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" "${PKG_CONFIG_FILE_NAME}" @ONLY) +install(FILES "${PKG_CONFIG_FILE_NAME}" + DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig" + COMPONENT lib +) + +set(CONFIG_FILE_NAME_WITHOUT_EXT "${PROJECT_NAME}Config") +set(CMAKE_CONFIG_VERSION_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_FILE_NAME_WITHOUT_EXT}-version.cmake") +set(CMAKE_CONFIG_FILE_NAME "${CONFIG_FILE_NAME_WITHOUT_EXT}.cmake") +set(CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME}") + +install(EXPORT TCLAP + NAMESPACE TCLAP:: + FILE "${CMAKE_CONFIG_FILE_NAME}" + DESTINATION "${CMAKE_CONFIG_DESTINATION}" + COMPONENT lib +) +endif() + +if(${CMAKE_VERSION} VERSION_GREATER "3.14") + set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT") +endif() + +if(SLICER_DISABLE_FROM_UPSTREAM EQUAL "MINIMIZE_DIFFS_FROM_UPSTREAM") +write_basic_package_version_file("${CMAKE_CONFIG_VERSION_FILE_NAME}" + COMPATIBILITY AnyNewerVersion + ${OPTIONAL_ARCH_INDEPENDENT} +) + +install(FILES "${CMAKE_CONFIG_VERSION_FILE_NAME}" + DESTINATION "${CMAKE_CONFIG_DESTINATION}" + COMPONENT lib +) + +include(CPack) +endif() +# Slicer specific build configuration # -------------------------------------------------------------------------- # Install headers # -------------------------------------------------------------------------- diff --git a/tclap/COPYING b/tclap/COPYING index d573236..f147631 100644 --- a/tclap/COPYING +++ b/tclap/COPYING @@ -1,8 +1,8 @@ -Copyright (c) 2003 Michael E. Smoot -Copyright (c) 2004 Daniel Aarno -Copyright (c) 2017 Google Inc. +Copyright (c) 2003-2012 Michael E. Smoot +Copyright (c) 2004-2016 Daniel Aarno +Copyright (c) 2017-2021 Google LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/tclap/CTestConfig.cmake b/tclap/CTestConfig.cmake new file mode 100644 index 0000000..ec3bec0 --- /dev/null +++ b/tclap/CTestConfig.cmake @@ -0,0 +1,15 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## +## # The following are required to submit to the CDash dashboard: +## enable_testing() +## include(CTest) + +set(CTEST_PROJECT_NAME "tclap") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") + +set(CTEST_DROP_METHOD "https") +set(CTEST_DROP_SITE "my.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=tclap") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/tclap/ChangeLog b/tclap/ChangeLog index 7a40715..ccedbb4 100644 --- a/tclap/ChangeLog +++ b/tclap/ChangeLog @@ -1,1770 +1,15 @@ -2017-12-26 14:30 macbishop - * Bugfix release for 1.2 branch (v1.2.2): - - Fixed a few typos - - Fixed ZshCompletionOutput - - Fixed brief output with TCLAP_NAMESTRING defined - - Initialize theDelimiter (supress warning) in DocBookOutput - - Fixed an issue with config.h and compiling on systems - without sstream.h - - Fixed } outside of include guards in ArgTraits.h +# TCLAP 1.4 -2011-04-10 17:08 mes5k +The 1.4 release of TCLAP contains many small improvements, but the main +changes are: - * include/tclap/Arg.h: patch that allows arg start strings to be - pound defined to easily conform to different platforms - -2011-04-09 11:58 mes5k - - * docs/Makefile.am: being slightly more precise about what we clean - -2011-04-09 11:30 mes5k - - * include/tclap/: DocBookOutput.h, StdOutput.h, - ZshCompletionOutput.h: fixed shadow variable name problem - -2011-04-09 11:05 mes5k - - * include/tclap/CmdLine.h: fixed minor memory leak - -2011-03-15 04:26 macbishop - - * configure.in, config/ac_cxx_warn_effective_cxx.m4: Check if - compiler supports Weffec++ and if so use it (fixes compilation - issue with e.g. SunStudio compiler) - -2011-01-15 09:45 macbishop - - * include/tclap/ArgTraits.h: Updated documentation for ArgTraits to - reference StringLike and ValueLike classes. - -2011-01-15 09:32 macbishop - - * examples/test10.cpp: Added explicit cast to supress warning about - deprecated conversion from string constant to char* - -2011-01-02 17:18 mes5k - - * docs/Makefile.am: now using a slightly different variable for doc - install to support out-of-tree builds - -2011-01-02 16:37 mes5k - - * configure.in: bumped version number to 1.2.1 - -2011-01-02 16:30 mes5k - - * docs/style.css: tweaked style so it doesn't blink - -2011-01-02 16:21 mes5k - - * tests/: test57.out, test57.sh, test76.out: tweaked tests to - reflect fix for mutually exclusive switches - -2011-01-02 16:20 mes5k - - * include/tclap/: SwitchArg.h, XorHandler.h: finally fixed bug - relating to mutually exclusive combined switched - -2011-01-02 15:12 mes5k - - * include/tclap/Arg.h: minor reformat - -2011-01-02 15:10 mes5k - - * include/tclap/CmdLine.h: minor reformatting - -2011-01-02 12:13 mes5k - - * examples/Makefile.am, examples/test20.cpp, tests/Makefile.am, - tests/test74.out, tests/test74.sh, tests/test75.out, - tests/test75.sh, tests/test76.out, tests/test76.sh, - tests/test77.out, tests/test77.sh: added failing tests for XOR - error message bug - -2011-01-02 11:52 mes5k - - * include/tclap/StandardTraits.h: applied Tom Fogal's win64 patch - for size_t - -2011-01-02 11:38 mes5k - - * docs/Makefile.am: hopefully fixed out-of-tree doc installation - -2011-01-02 10:50 mes5k - - * include/tclap/: Arg.h, ArgTraits.h, CmdLine.h, HelpVisitor.h, - MultiArg.h, ValueArg.h, ValuesConstraint.h, VersionVisitor.h, - XorHandler.h, ZshCompletionOutput.h: fixed all effective c++ - warnings based on patch from Andrew Marlow - -2010-12-06 22:41 mes5k - - * configure.in: added more compiler warnings - -2009-10-24 20:49 mes5k - - * include/tclap/SwitchArg.h, include/tclap/ValueArg.h, - tests/test22.out, tests/test24.out: make error message a bit more - meaningful - -2009-10-23 14:42 mes5k - - * include/tclap/StandardTraits.h: added a check for wchar_t to deal - with a potential problem with MS compilers - -2009-09-28 11:28 mes5k - - * docs/index.html: updated for 1.2.0 - -2009-09-26 14:41 mes5k - - * docs/Makefile.am: another update to support older automake - -2009-09-26 14:23 mes5k - - * docs/Makefile.am: removed an errant space - -2009-09-26 14:15 mes5k - - * docs/Makefile.am: added a definition for docdir, which doesnt - exist for old versions of automake - -2009-09-26 14:02 mes5k - - * docs/Makefile.am: corrected the doc install directory structure - -2009-09-26 13:55 mes5k - - * NEWS: updated for 1.2.0 - -2009-09-26 13:53 mes5k - - * docs/: manual.html, manual.xml: updated for 1.2.0 including text - on ArgTraits - -2009-08-22 12:26 mes5k - - * Makefile.am, configure.in, tclap.pc.in, docs/Makefile.am, - examples/Makefile.am: applying patches to make gnu compiler args - conditional, to install docs, and to add pkgconfig support to the - installation - -2009-07-28 12:49 mes5k - - * configure.in, tests/Makefile.am, tests/test73.out, - tests/test73.sh: added test 73 based on bug reported by user - -2009-07-15 08:09 mes5k - - * include/tclap/UnlabeledValueArg.h: updated incorrect api docs - again - -2009-07-15 08:04 mes5k - - * include/tclap/UnlabeledValueArg.h: updated incorrect api doc - -2009-01-09 16:10 mes5k - - * AUTHORS: added author - -2009-01-09 16:05 mes5k - - * include/tclap/: Arg.h, CmdLine.h, CmdLineInterface.h, MultiArg.h, - MultiSwitchArg.h, SwitchArg.h, ValueArg.h: added support for - resetting a command line - -2008-11-07 12:04 mes5k - - * docs/manual.html, docs/manual.xml, examples/Makefile.am, - examples/test19.cpp, include/tclap/Arg.h, tests/Makefile.am, - tests/test29.out, tests/test29.sh, tests/test71.out, - tests/test71.sh, tests/test72.out, tests/test72.sh: added support - for parsing hex and octal ints as well as small fix to support - gcc 4.4 - -2008-09-10 11:29 mes5k - - * docs/manual.xml: updated note on xor - -2008-09-10 11:21 mes5k - - * docs/manual.xml: added note on xor - -2008-08-19 15:18 zeekec - - * examples/test18.cpp, include/tclap/CmdLine.h, tests/Makefile.am, - tests/test70.out, tests/test70.sh: Rethrow ExitExceptions if - we're not handling exceptions. - -2008-08-19 14:52 zeekec - - * include/tclap/Arg.h: Silence some compiler warnings. The const - on return-by-value is ignored. - -2008-07-21 10:20 zeekec - - * include/tclap/CmdLine.h, examples/Makefile.am, - examples/test18.cpp, tests/Makefile.am, tests/test69.out, - tests/test69.sh: Allow internal handling of parse errors to be - turned off. This allows exceptions for parse errors to be - propagated to the caller. Exiting the program in parse is a bad - idea generally, as we have no way of knowing what cleanup needs - to be done in the main program. - -2008-06-17 09:48 mes5k - - * include/tclap/StdOutput.h: bug in while loop - -2008-05-23 15:15 mes5k - - * include/tclap/: CmdLine.h, SwitchArg.h: added length checks to - strings that can otherwise break with Metroworks compilers - -2008-05-21 14:21 macbishop - - * examples/: Makefile.am, test17-a.cpp, test17.cpp: Added test that - tclap does not define any hard symbols (bug 1907017) - -2008-05-13 12:04 mes5k - - * include/tclap/CmdLine.h: added a new include to support exit in - environments where it isnt defined - -2008-05-05 23:02 mes5k - - * examples/test7.cpp, include/tclap/Arg.h, tests/test46.out: - tweaked tests to support dashes in arg names - -2008-05-05 22:28 mes5k - - * include/tclap/Arg.h: allowed dash char in arg names - -2008-01-18 15:05 zeekec - - * include/tclap/Makefile.am: Added Traits files to the list of - files to be installed. - -2007-10-09 11:18 macbishop - - * examples/test14.cpp, examples/test15.cpp, examples/test16.cpp, - include/tclap/Arg.h, include/tclap/ArgTraits.h, - include/tclap/StandardTraits.h, configure.in, - config/ac_cxx_have_long_long.m4, examples/Makefile.am: - Refactoring of the arg-traits functionality. The purpose is to - make it easier to make you own classes, and types defined in the - standard library work well with tclap. I'll try to write up some - documenation of how to achieve this as-well. - -2007-10-01 23:33 mes5k - - * examples/test13.cpp: added attribution - -2007-10-01 23:30 mes5k - - * examples/test13.cpp: fixed a warning message - -2007-10-01 23:27 mes5k - - * examples/Makefile.am, examples/test13.cpp, - include/tclap/SwitchArg.h, tests/Makefile.am, tests/test68.out, - tests/test68.sh: a bug fix for parsing vectors of strings and - making sure that combined switches dont get confused - -2007-09-27 13:49 mes5k - - * include/tclap/OptionalUnlabeledTracker.h: added inline - -2007-09-12 19:09 mes5k - - * include/tclap/Arg.h, tests/test42.out, tests/test54.out: fixed - the delimiter in Arg::longID and Arg::shortID - -2007-09-01 01:17 macbishop - - * examples/Makefile.am, include/tclap/Arg.h, - include/tclap/DocBookOutput.h, - include/tclap/ZshCompletionOutput.h: Suppress some warnings, - compile with -Wextra by default - -2007-06-14 14:02 macbishop - - * include/tclap/Arg.h, include/tclap/MultiArg.h, - include/tclap/ValueArg.h, tests/runtests.sh, tests/test63.out, - tests/test63.sh, tests/test64.out, tests/test64.sh, - tests/test65.out, tests/test65.sh, tests/test66.out, - tests/test66.sh, tests/test67.out, tests/test67.sh, - tests/testCheck.sh, examples/Makefile.am, examples/test11.cpp, - examples/test12.cpp: Use ArgTraits instead of ValueExtractor - specialization Bug 1711487 - -2007-05-02 13:11 macbishop - - * examples/Makefile.am, examples/test10.cpp, - include/tclap/CmdLine.h, include/tclap/CmdLineInterface.h: Run - CmdLine::parse with argv as pointer to const pointer to const - char - -2007-04-20 22:28 mes5k - - * include/tclap/Arg.h, tests/test18.out: changed the blankChar to - the bell character instead of * - -2007-03-04 11:28 mes5k - - * examples/test4.cpp, include/tclap/DocBookOutput.h, - include/tclap/Makefile.am, include/tclap/ZshCompletionOutput.h: - added patches for ZSH and DocBook output - -2007-03-04 11:08 mes5k - - * include/tclap/: CmdLine.h, CmdLineInterface.h: added a new parse - method that accepts a vector - -2007-02-17 06:59 macbishop - - * include/tclap/: MultiArg.h, MultiSwitchArg.h, - UnlabeledMultiArg.h, UnlabeledValueArg.h, ValueArg.h: Supressed - some warnings - -2007-02-17 06:59 macbishop - - * include/tclap/CmdLine.h: Catch ExitException and exit. This - allows all resources used during parsing to be released, bug - 1662188. - -2007-02-17 06:57 macbishop - - * include/tclap/: DocBookOutput.h, HelpVisitor.h, StdOutput.h, - VersionVisitor.h: raise ExitException instead of calling exit - -2007-02-17 06:54 macbishop - - * include/tclap/ArgException.h: Added exit-exception class - -2007-02-17 06:52 macbishop - - * tests/testCheck.sh: Exit with exit status 1 if a test fails - (required by runtests.sh) - -2007-02-17 06:52 macbishop - - * tests/runtests.sh: Run the correct tests (not 0) - -2007-02-17 06:51 macbishop - - * examples/: test4.cpp, test7.cpp: Supressed warnings - -2007-02-07 18:12 mes5k - - * include/tclap/StdOutput.h: minor change to support a bug in - VisualC++ 2005 - -2006-11-26 10:42 mes5k - - * docs/: README, manual.html, manual.xml: updated docs to reflect - that Output must handle the exit rather than the CmdLine object - -2006-11-26 10:32 mes5k - - * include/tclap/: CmdLine.h, DocBookOutput.h, StdOutput.h: moved - exit from CmdLine to StdOutput to provide users more control over - when/how the exit happens - -2006-11-26 10:29 mes5k - - * examples/test4.cpp: added exit() to failure method - -2006-11-26 10:13 mes5k - - * docs/: manual.html, manual.xml: fixed typo in SwitchArg - constructors - -2006-11-04 14:05 mes5k - - * include/tclap/CmdLine.h, tests/Makefile.am, tests/test10.out, - tests/test17.out, tests/test4.out, tests/test51.out, - tests/test62.out, tests/test62.sh: printing more useful message - when missing required args and catching ArgException reference - -2006-10-06 09:49 mes5k - - * include/tclap/SwitchArg.h, tests/Makefile.am, tests/test61.out, - tests/test61.sh: made a fix for a bug where - chars were within - unlabeled value args - -2006-08-21 23:13 mes5k - - * include/tclap/StdOutput.h: minor tweak to a min function - signature - -2006-08-18 20:05 mes5k - - * docs/index.html: updated for 1.1.0 - -2006-08-18 20:04 mes5k - - * AUTHORS: new author - -2006-05-14 17:55 mes5k - - * config/Makefile.am: so that m4 macros will be included in release - files to ease incorporation of tclap in other projects - -2006-05-14 17:36 mes5k - - * include/tclap/CmdLine.h: removed a deprecated constructor - -2006-05-14 17:35 mes5k - - * docs/: manual.xml, manual.html: manual update - -2006-05-14 13:11 mes5k - - * Makefile.am, configure.in: added m4 macros to help others - distributing the software and updated the version number - -2006-05-14 12:52 mes5k - - * config/bb_enable_doxygen.m4: for some reason, the AS_HELP_STRING - function was messing up autoconf 2.57 -- maybe that's just an old - version? We can change it back as necessary - -2006-05-14 12:51 mes5k - - * examples/test8.cpp, include/tclap/SwitchArg.h: SwitchArg - interface change - -2006-04-18 03:59 macbishop - - * docs/: manual.html, manual.xml: Updated the example - -2006-04-05 23:44 mes5k - - * include/tclap/ArgException.h: patch for a mem leak in - ArgException - -2006-03-18 11:16 mes5k - - * include/tclap/: CmdLineOutput.h, Visitor.h: added virtual - destructors - -2006-02-21 18:15 zeekec - - * examples/: test1.cpp, test2.cpp, test3.cpp, test4.cpp, test5.cpp, - test6.cpp, test7.cpp, test8.cpp, test9.cpp: Use local header - files first instead of installed headers. - -2006-02-21 18:12 zeekec - - * Makefile.am: Added ACLOCAL_AMFLAGS for autoreconf. - -2006-02-21 18:10 zeekec - - * config/: ac_cxx_have_sstream.m4, ac_cxx_have_strstream.m4: Moved - the requires, header check, and language save and restore outside - of the cache check. - -2006-02-21 04:00 zeekec - - * config/: stamp-h.in, stamp-h1: Removed timestamp files (generated - by configure). - -2006-02-21 03:05 zeekec - - * include/tclap/Constraint.h: Added virtual destructor to silence - warnings. - -2006-02-21 03:01 zeekec - - * ChangeLog: Generated with cvs2cl. - -2005-09-10 16:25 mes5k - - * config/stamp-h1, examples/test2.cpp, examples/test3.cpp, - examples/test5.cpp, examples/test8.cpp, include/tclap/Arg.h, - include/tclap/CmdLine.h, include/tclap/MultiArg.h, - include/tclap/StdOutput.h, include/tclap/UnlabeledMultiArg.h, - include/tclap/UnlabeledValueArg.h, include/tclap/ValueArg.h, - include/tclap/XorHandler.h: added gcc warning patch - -2005-07-12 20:36 zeekec - - * examples/Makefile.am: Set INCLUDES to top_srcdir for out of - source builds. - -2005-07-12 20:33 zeekec - - * include/tclap/: UnlabeledMultiArg.h, UnlabeledValueArg.h: Add - using toString statements (for gcc >= 3.4). - -2005-07-12 20:31 zeekec - - * config/bb_enable_doxygen.m4: Properly quote BB_ENABLE_DOXYGEN. - -2005-06-29 15:04 mes5k - - * include/tclap/Arg.h: merged some new changes - -2005-06-08 08:28 mes5k - - * docs/index.html: fixed spelling mistake - -2005-06-02 19:35 mes5k - - * include/tclap/: Makefile.am, OptionalUnlabeledTracker.h, - UnlabeledMultiArg.h, UnlabeledValueArg.h: fix to handle optional - unlabeled args - -2005-06-02 19:33 mes5k - - * examples/: test2.cpp, test3.cpp, test7.cpp, test8.cpp, test9.cpp: - Unlabeled changes - -2005-02-03 15:04 mes5k - - * include/tclap/: Arg.h, DocBookOutput.h, MultiArg.h: updated - docbook output - -2005-02-03 08:08 mes5k - - * include/tclap/: ValuesConstraint.h, XorHandler.h: add std:: - prefix to some finds - -2005-02-01 13:35 zeekec - - * include/tclap/CmdLine.h: Made deleteOnExit's protected to - facilitate derivation. - -2005-02-01 13:30 zeekec - - * config/config.h.in: Removed autotools generated file. - -2005-01-28 13:26 zeekec - - * configure.in, docs/Doxyfile.in, tests/Makefile.am, - tests/test1.sh, tests/test10.sh, tests/test11.sh, - tests/test12.sh, tests/test13.sh, tests/test14.sh, - tests/test15.sh, tests/test16.sh, tests/test17.sh, - tests/test18.sh, tests/test19.sh, tests/test2.sh, - tests/test20.sh, tests/test21.sh, tests/test22.sh, - tests/test23.sh, tests/test24.sh, tests/test25.sh, - tests/test26.sh, tests/test27.sh, tests/test28.sh, - tests/test29.sh, tests/test3.sh, tests/test30.sh, - tests/test31.sh, tests/test32.sh, tests/test33.sh, - tests/test34.sh, tests/test35.sh, tests/test36.sh, - tests/test37.sh, tests/test38.sh, tests/test39.sh, - tests/test4.sh, tests/test40.sh, tests/test41.sh, - tests/test42.sh, tests/test43.sh, tests/test44.sh, - tests/test45.sh, tests/test46.sh, tests/test47.sh, - tests/test48.sh, tests/test49.sh, tests/test5.sh, - tests/test50.sh, tests/test51.sh, tests/test52.sh, - tests/test53.sh, tests/test54.sh, tests/test55.sh, - tests/test56.sh, tests/test57.sh, tests/test58.sh, - tests/test59.sh, tests/test6.sh, tests/test60.sh, tests/test7.sh, - tests/test8.sh, tests/test9.sh: Made changes to directory - references to allow out of source builds. - -2005-01-26 10:25 mes5k - - * aclocal.m4: doh - -2005-01-23 19:18 mes5k - - * include/tclap/CmdLine.h: removed -v from version switch - -2005-01-23 19:14 mes5k - - * include/tclap/Arg.h: removed value required - -2005-01-23 19:03 mes5k - - * examples/: test2.cpp, test3.cpp, test6.cpp, test8.cpp, test9.cpp: - UnlabeledValueArg change - -2005-01-23 19:02 mes5k - - * tests/: test10.out, test11.out, test12.out, test15.out, - test16.out, test17.out, test22.out, test23.out, test24.out, - test26.out, test27.out, test28.out, test29.out, test30.out, - test31.out, test32.out, test35.out, test36.out, test38.out, - test39.out, test4.out, test40.out, test41.out, test42.out, - test43.out, test44.out, test45.out, test46.out, test49.out, - test50.out, test51.out, test52.out, test53.out, test54.out, - test57.out, test59.out, test60.out, test7.out: new output for - default version and value required - -2005-01-23 19:01 mes5k - - * tests/: test59.sh, test8.sh: new style version and required - UnlabeledValueArgs - -2005-01-23 18:59 mes5k - - * tests/testCheck.sh: a script to compare test output - -2005-01-23 17:54 mes5k - - * include/tclap/UnlabeledValueArg.h: now optionally required - -2005-01-23 16:33 mes5k - - * tests/: test58.out, test59.out, test58.sh, test59.sh, test60.out, - test60.sh, Makefile.am: tests for MultiSwitchArg - -2005-01-23 16:27 mes5k - - * include/tclap/Makefile.am, examples/Makefile.am, - examples/test9.cpp: MultiSwitchArg - -2005-01-23 16:26 mes5k - - * include/tclap/: CmdLine.h, CmdLineInterface.h, StdOutput.h: added - a bool to the constructor that allows automatic -h and -v to be - turned off - -2005-01-23 14:57 mes5k - - * docs/: manual.html, manual.xml: added MultiSwitchArg docs - -2005-01-23 14:33 mes5k - - * include/tclap/MultiSwitchArg.h: fixed typo - -2005-01-23 14:29 mes5k - - * include/tclap/SwitchArg.h: Fixed minor bug involving combined - switch error messages: now they're consistent. - -2005-01-23 14:28 mes5k - - * include/tclap/MultiSwitchArg.h: initial checkin - -2005-01-22 20:41 mes5k - - * include/tclap/UnlabeledMultiArg.h: added alreadySet - -2005-01-20 20:13 mes5k - - * tests/Makefile.am: xor test - -2005-01-20 20:04 mes5k - - * examples/test5.cpp: change for xor bug - -2005-01-20 20:04 mes5k - - * tests/: test20.out, runtests.sh, test20.sh, test21.out, - test21.sh, test22.out, test23.out, test24.out, test25.out, - test25.sh, test33.out, test33.sh, test44.out, test57.out, - test57.sh: changes for xor bug - -2005-01-20 20:03 mes5k - - * include/tclap/: Arg.h, MultiArg.h, UnlabeledMultiArg.h, - XorHandler.h: fixed xor bug - -2005-01-17 12:48 macbishop - - * include/tclap/Arg.h: Removed check on description in - Arg::operator== since multiple args should be able to have the - same description. - -2005-01-06 20:41 mes5k - - * NEWS: updated for constraints - -2005-01-06 20:37 mes5k - - * docs/: manual.html, manual.xml: updated for constraints - -2005-01-06 20:05 mes5k - - * examples/test7.cpp: changed for constraint - -2005-01-06 20:00 mes5k - - * include/tclap/: MultiArg.h, ValueArg.h: fixed exceptions and - typeDesc for constraints - -2005-01-06 19:59 mes5k - - * tests/: test35.out, test36.out, test38.out, test39.out: changed - for constraints - -2005-01-06 19:07 mes5k - - * examples/test6.cpp: changed to constraint - -2005-01-06 19:06 mes5k - - * include/tclap/Makefile.am: added constraints - -2005-01-06 19:05 mes5k - - * include/tclap/: Constraint.h, ValuesConstraint.h: initial checkin - -2005-01-06 19:05 mes5k - - * include/tclap/StdOutput.h: comment change - -2005-01-06 19:01 mes5k - - * include/tclap/CmdLine.h: added Constraint includes - -2005-01-06 18:55 mes5k - - * include/tclap/: MultiArg.h, UnlabeledMultiArg.h, - UnlabeledValueArg.h, ValueArg.h: Changed allowedList to - Constraint - -2005-01-05 16:08 mes5k - - * configure.in: next vers - -2005-01-05 12:13 mes5k - - * NEWS: update - -2005-01-05 10:51 mes5k - - * docs/: manual.html, manual.xml: fixed output override bug - -2005-01-05 10:45 mes5k - - * tests/: test18.out, test43.out: change for output override bug - -2005-01-05 10:28 mes5k - - * examples/test4.cpp: fixed output override bug - -2005-01-05 10:22 mes5k - - * include/tclap/: CmdLine.h, HelpVisitor.h, VersionVisitor.h: fixed - output bug - -2005-01-04 14:01 mes5k - - * configure.in: 1.0.4 - -2005-01-04 13:16 mes5k - - * examples/test7.cpp: changed for long prog names bug - -2005-01-04 13:15 mes5k - - * tests/: test38.out, test39.out, test46.out: changed test7 for - long prog names - -2005-01-04 12:31 mes5k - - * NEWS: updates for 1.0.3a - -2005-01-04 12:21 mes5k - - * docs/manual.html, docs/manual.xml, include/tclap/CmdLine.h: fixed - output memory leak - -2004-12-08 21:10 mes5k - - * include/tclap/StdOutput.h: hacky fix to long prog name bug - -2004-12-07 19:57 mes5k - - * configure.in: 1.0.3a - -2004-12-07 19:53 mes5k - - * tests/: Makefile.am, test15.out, test16.out, test17.out, - test31.out, test32.out, test13.sh, test14.sh, test15.sh, - test16.sh, test17.sh, test42.out, test55.out, test55.sh, - test56.out, test56.sh: updated for - arg bug - -2004-12-07 19:51 mes5k - - * examples/test3.cpp: tweaked to support tests for '-' arg bug - -2004-12-07 18:16 mes5k - - * include/tclap/Arg.h: fixed a bug involving blank _flags and - as - an UnlabeledValueArg - -2004-12-03 12:19 mes5k - - * docs/style.css: minor tweak for h1 - -2004-12-03 12:10 mes5k - - * NEWS: update - -2004-12-03 11:39 mes5k - - * include/tclap/CmdLine.h: removed ostream include - -2004-11-30 19:11 mes5k - - * include/tclap/: Arg.h, CmdLine.h, CmdLineOutput.h, StdOutput.h: - cleaned up iterator names - -2004-11-30 19:10 mes5k - - * include/tclap/DocBookOutput.h: removed ostream - -2004-11-30 18:35 mes5k - - * configure.in, docs/Doxyfile.in: added dot check - -2004-11-24 19:58 mes5k - - * configure.in: 1.0.3 - -2004-11-24 19:57 mes5k - - * include/tclap/: UnlabeledMultiArg.h, UnlabeledValueArg.h: removed - two stage lookup ifdefs - -2004-11-24 19:56 mes5k - - * docs/index.html: updated - -2004-11-24 19:45 mes5k - - * docs/: manual.html, manual.xml: updates for using stuff and new - output - -2004-11-05 21:05 mes5k - - * include/tclap/: DocBookOutput.h, Makefile.am: adding docbook - stuff - -2004-11-04 21:07 mes5k - - * examples/test4.cpp: reflects new output handling - -2004-11-04 21:07 mes5k - - * include/tclap/: Arg.h, CmdLine.h, CmdLineInterface.h, - CmdLineOutput.h, HelpVisitor.h, Makefile.am, StdOutput.h, - VersionVisitor.h, XorHandler.h: changed output around - -2004-11-04 21:06 mes5k - - * include/tclap/PrintSensibly.h: subsumed by StdOutput - -2004-10-31 14:13 mes5k - - * docs/manual.html: tweak - -2004-10-30 15:58 mes5k - - * NEWS, README: updates - -2004-10-30 15:51 mes5k - - * docs/Makefile.am: added manual.xml - -2004-10-30 15:47 mes5k - - * docs/: manual.html, manual.xml, style.css: minor tweaks - -2004-10-30 15:34 mes5k - - * configure.in: 1.0.2 - -2004-10-30 15:30 mes5k - - * docs/README: init - -2004-10-30 15:30 mes5k - - * docs/style.css: new style - -2004-10-30 15:30 mes5k - - * docs/: manual.html, manual.xml: manual.html is now generated from - manual.xml - -2004-10-30 15:26 mes5k - - * include/tclap/: MultiArg.h, ValueArg.h: yet another fix for - HAVE_SSTREAM stuff - -2004-10-30 08:42 mes5k - - * NEWS: 1.0.1 - -2004-10-30 08:03 mes5k - - * configure.in: new release - -2004-10-28 09:41 mes5k - - * include/tclap/: ValueArg.h, MultiArg.h: fixed config.h problems - -2004-10-27 19:44 mes5k - - * docs/manual.xml: manual as docbook - -2004-10-22 08:56 mes5k - - * docs/style.css: added visited color to links - -2004-10-22 07:38 mes5k - - * docs/index.html: fixed mailto - -2004-10-21 18:58 mes5k - - * docs/: manual.html: minor tweaks - -2004-10-21 18:13 mes5k - - * docs/manual.html: updated for new test1 - -2004-10-21 18:02 mes5k - - * include/tclap/CmdLine.h: catch by ref - -2004-10-21 18:01 mes5k - - * examples/: test1.cpp, test2.cpp, test3.cpp, test4.cpp, test5.cpp, - test6.cpp, test7.cpp, test8.cpp: changed test1 and now catching - exceptions by ref - -2004-10-21 17:38 mes5k - - * tests/: test1.out, test1.sh, test2.out, test3.out, test3.sh, - test4.out, test40.out: changes for new test1 - -2004-10-21 15:50 mes5k - - * examples/test1.cpp: fixed includes - -2004-10-21 10:03 mes5k - - * docs/index.html: changed link - -2004-10-21 09:02 mes5k - - * include/tclap/: ValueArg.h, MultiArg.h: changed enum names - because of alpha conflicts - -2004-10-20 20:04 mes5k - - * include/tclap/: CmdLine.h, CmdLineInterface.h, MultiArg.h, - PrintSensibly.h, SwitchArg.h, UnlabeledMultiArg.h, - UnlabeledValueArg.h, ValueArg.h, XorHandler.h: cleaned up some - includes and added ifdefs for sstream - -2004-10-20 19:00 mes5k - - * examples/test5.cpp: fixed a bizarre bug - -2004-10-20 18:59 mes5k - - * tests/: test20.out, test21.out, test25.out, test33.out: fixed a - test5 bug - -2004-10-20 16:17 mes5k - - * Makefile.am: added msc - -2004-10-20 16:06 mes5k - - * configure.in: added msc stuff - -2004-10-20 16:05 mes5k - - * msc/: examples/Makefile.am, Makefile.am: init - -2004-10-20 16:00 mes5k - - * NEWS: update - -2004-10-20 15:58 mes5k - - * msc/README: init - -2004-10-20 15:47 mes5k - - * msc/: tclap-beta.ncb, tclap-beta.sln, tclap-beta.suo, - tclap-beta.vcproj, examples/test1.vcproj, examples/test2.vcproj, - examples/test3.vcproj, examples/test4.vcproj, - examples/test5.vcproj, examples/test6.vcproj, - examples/test7.vcproj, examples/test8.vcproj: init - -2004-10-19 11:18 mes5k - - * docs/Makefile.am: added stylesheet - -2004-10-19 10:51 mes5k - - * AUTHORS: more - -2004-10-19 10:39 mes5k - - * NEWS, AUTHORS: added 1.0 notes - -2004-10-14 13:04 mes5k - - * examples/test4.cpp: shows how to alter output - -2004-10-14 13:03 mes5k - - * tests/test18.out: updated output - -2004-10-14 12:03 mes5k - - * include/tclap/CmdLineInterface.h: added failure to the interface - -2004-10-14 11:07 mes5k - - * include/tclap/ArgException.h: doh. now what() is proper - -2004-10-14 10:44 mes5k - - * include/tclap/CmdLine.h: made destructor virtual - -2004-10-14 10:20 mes5k - - * include/tclap/CmdLine.h: moved all output handling into separate - methods - -2004-10-14 10:19 mes5k - - * include/tclap/Arg.h: made processArg pure virtual - -2004-10-14 10:19 mes5k - - * include/tclap/ArgException.h: fixed documentation omission - -2004-10-12 14:09 mes5k - - * docs/style.css: tweak - -2004-10-07 11:22 mes5k - - * docs/style.css: color change - -2004-10-01 10:54 mes5k - - * include/tclap/ArgException.h: added type description - -2004-09-30 18:16 mes5k - - * docs/: index.html, manual.html, style.css: added CSS style - -2004-09-30 09:17 mes5k - - * docs/manual.html: more updates - -2004-09-29 08:24 mes5k - - * docs/: index.html, manual.html: proofing updates - -2004-09-27 14:37 mes5k - - * docs/: index.html, manual.html: xhtml and tidied - -2004-09-27 14:36 mes5k - - * docs/Doxyfile.in: added dot handling - -2004-09-27 14:30 mes5k - - * include/tclap/: Arg.h, ArgException.h, CmdLine.h, MultiArg.h, - SwitchArg.h, ValueArg.h: added new Exception classes - -2004-09-27 12:53 mes5k - - * include/tclap/ArgException.h: minor tweaks - -2004-09-26 19:32 mes5k - - * docs/manual.html: updates yet again - -2004-09-26 19:00 mes5k - - * docs/manual.html: updates - -2004-09-26 18:50 mes5k - - * docs/manual.html: substantial updates - -2004-09-26 16:54 mes5k - - * include/tclap/: Arg.h, CmdLine.h, CmdLineInterface.h, MultiArg.h, - PrintSensibly.h, ValueArg.h: minor formatting - -2004-09-26 15:50 mes5k - - * docs/manual.html: updates - -2004-09-26 15:17 mes5k - - * tests/runtests.sh: minor fix so that we run all tests - -2004-09-26 11:51 macbishop - - * docs/Doxyfile.in: Removed src subdir - -2004-09-26 11:49 macbishop - - * examples/Makefile.am: Removed libtclap.a deps - -2004-09-26 11:46 macbishop - - * configure.in: Removed creation of src/Makefile - -2004-09-26 11:34 macbishop - - * Makefile.am: Removed src subdir - -2004-09-26 11:31 macbishop - - * src/: Arg.cpp, CmdLine.cpp, Makefile.am, PrintSensibly.cpp, - SwitchArg.cpp, XorHandler.cpp: Implementation now in header files - -2004-09-26 11:27 macbishop - - * include/tclap/: Arg.h, ArgException.h, CmdLine.h, HelpVisitor.h, - Makefile.am, MultiArg.h, PrintSensibly.h, SwitchArg.h, - UnlabeledMultiArg.h, UnlabeledValueArg.h, ValueArg.h, - VersionVisitor.h, XorHandler.h, CmdLineInterface.h, - CommandLine.h: Moving the implementation of tclap to the header - files presented me with two major problems. 1) There where static - functions and variables that could cause link errors if tclap - where used in different files (e.g. file1.cc and file2.cc - included tclap then compiling both files would give hard symbols - for some variables which would produce multiple definition when - linking) 2) The dependencies of tclap was a bit strange (CmdLine - depends on Args and Args depends on CmdLine for instance) - - The first problem I solved by removing all static variables - putting them in static member functions (which are weak-symbols). - So for instance every where there previously was something like x - = _delimiter there now is x = delimiter() or in case of write - acces delimiterRef() = x instead of _delimiter = x (I had to - append the Ref because there where already functions with the - same name as the variables). To solve the problem with static - functions I simply inlined them. This causes the compiler to - produce a weak symbol or inline if appropriate. We can put the - functions inside the class declaration later to make the code - look better. This worked fine in all but two cases. In the - ValueArg and MultiArg classes I had to do a "hack" to work around - the specialization template for extractValue. The - code for this is very simple but it might look strange an stupid - at first but it is only to resolve the specialisation to a weak - symbol. What I did was I put the implementations of extractValue - in a helper class and I could then create a specialized class - instead of function and everything worked out. I think now in - retrospect there might be better solutions to this but I'll think - a bit more on it (maybe some type of inlining on the specialized - version would suffice but I'm not sure). - - To handle the dependencies I had to do some rewriting. The first - step was to introduce a new class CmdLineInterface that is a - purely abstract base of CmdLine that specifies the functions - needed by Arg and friends. Thus Arg classes now takes an - CmdLineInterface object as input instead (however only CmdLine - can ever be instantiated of-course). With this extra class - cleaning up the dependencies was quite simple, I've attached a - dependency graph to the mail (depgraph.png). I also cleaned up - the #includes so now only what actually needs inclusion is - included. A nice side effect of this is that the impl. of CmdLine - is now put back into CmdLine.h (where I guess you wanted it) - which (recursivly) includes everything else needed. - - Just to make things clear for myself regarding the class - dependencies I made a class TCLAP::Exception that inherits from - std::exception and is a base of ArgException (Exception does - nothing currently). If we don't want the Exception class it can - be removed, however I think it could be a nice logic to have a - base Exception class that every exception inherits from, but we - can discuss that when we decide how to handle exceptions. - -2004-09-26 08:07 macbishop - - * tests/runtests.sh: Now return 0 if all tests fail and 1 if any - test fail - -2004-09-26 07:58 macbishop - - * tests/runtests.sh: Runs all tests and sumarizes the result - -2004-09-20 17:09 mes5k - - * include/tclap/CommandLine.h: added some comments - -2004-09-20 17:08 mes5k - - * src/CmdLine.cpp: formatting only - -2004-09-20 10:05 macbishop - - * include/tclap/CommandLine.h: Recommit because something is - strange. The changes are that memory allocated in _construct is - deallocated when the CmdLine obj is destroyed - -2004-09-19 11:32 macbishop - - * src/CmdLine.cpp: Memory allocated in _constructor is now deleted - when the object is destroyed - -2004-09-18 09:54 mes5k - - * include/tclap/: Arg.h, ArgException.h, CmdLine.h, CommandLine.h, - HelpVisitor.h, IgnoreRestVisitor.h, MultiArg.h, PrintSensibly.h, - SwitchArg.h, UnlabeledMultiArg.h, UnlabeledValueArg.h, - ValueArg.h, VersionVisitor.h, Visitor.h, XorHandler.h: changed - ifndef labels - -2004-09-18 07:53 macbishop - - * include/tclap/Arg.h: Had to make ~Arg() public because it won't - be possible to delete Arg*s if it is not, and we want that (I - think). - -2004-09-15 21:24 mes5k - - * configure.in: version 1.0.0 - -2004-09-15 20:54 mes5k - - * include/tclap/Arg.h, include/tclap/ArgException.h, - include/tclap/HelpVisitor.h, include/tclap/IgnoreRestVisitor.h, - include/tclap/MultiArg.h, include/tclap/SwitchArg.h, - include/tclap/UnlabeledMultiArg.h, include/tclap/ValueArg.h, - include/tclap/VersionVisitor.h, include/tclap/Visitor.h, - src/Arg.cpp, src/SwitchArg.cpp: cleaned up a bunch of things - -2004-09-11 19:35 mes5k - - * tests/: Makefile.am, test47.out, test47.sh, test48.out, - test48.sh, test49.out, test49.sh, test50.out, test50.sh, - test51.out, test51.sh, test52.out, test52.sh, test53.out, - test53.sh, test54.out, test54.sh: added tests for CmdLine arg - -2004-09-11 19:33 mes5k - - * examples/: Makefile.am, test8.cpp: added new test for CmdLine arg - -2004-09-11 19:32 mes5k - - * src/Arg.cpp, src/SwitchArg.cpp, include/tclap/Arg.h, - include/tclap/MultiArg.h, include/tclap/SwitchArg.h, - include/tclap/UnlabeledMultiArg.h, - include/tclap/UnlabeledValueArg.h, include/tclap/ValueArg.h: got - CmdLine arg working - -2004-09-09 19:08 mes5k - - * configure: shouldn't be in cvs - -2004-09-09 12:56 macbishop - - * src/: Arg.cpp, SwitchArg.cpp: Added support for automatic - addition to a CmdLine parser - -2004-09-09 12:55 macbishop - - * include/tclap/: Arg.h, MultiArg.h, SwitchArg.h, - UnlabeledMultiArg.h, UnlabeledValueArg.h, ValueArg.h: Support for - automatic addition to a CmdLine parser - -2004-09-08 20:09 mes5k - - * src/CmdLine.cpp: fixed a warning in MSVC++ - -2004-09-07 16:11 mes5k - - * include/tclap/Makefile.in, docs/Makefile.in, - examples/Makefile.in, tests/Makefile.in: not needed - -2004-09-07 16:08 mes5k - - * Makefile.in, src/Makefile.in, include/Makefile.in: not needed - -2004-09-07 15:14 mes5k - - * src/CmdLine.cpp: now throws exception on matching - names/flags/desc - -2004-09-07 15:12 mes5k - - * examples/test4.cpp, examples/test7.cpp, tests/test38.out, - tests/test39.out, tests/test43.out, tests/test46.out: fixed to - handle new exception on matching names/flags/desc - -2004-09-07 13:25 mes5k - - * docs/Doxyfile.in: updated Doxyfile for newer doxygen - -2004-09-07 11:27 mes5k - - * examples/: test1.cpp, test2.cpp, test3.cpp, test4.cpp, test5.cpp, - test6.cpp: changed namespace std handling - -2004-09-07 11:25 mes5k - - * examples/test7.cpp: added more args to better test output - printing - -2004-09-07 11:24 mes5k - - * src/Arg.cpp, src/CmdLine.cpp, src/PrintSensibly.cpp, - src/SwitchArg.cpp, src/XorHandler.cpp, include/tclap/Arg.h, - include/tclap/ArgException.h, include/tclap/CommandLine.h, - include/tclap/MultiArg.h, include/tclap/PrintSensibly.h, - include/tclap/SwitchArg.h, include/tclap/UnlabeledMultiArg.h, - include/tclap/UnlabeledValueArg.h, include/tclap/ValueArg.h, - include/tclap/XorHandler.h: changed namespace std handling - -2004-09-07 11:24 mes5k - - * tests/: test15.out, test16.out, test17.out, test22.out, - test23.out, test24.out, test31.out, test32.out, test38.out, - test39.out, test42.out, test44.out, test46.out: fixed test output - for new formatting - -2004-09-04 14:09 macbishop - - * include/tclap/: UnlabeledMultiArg.h, UnlabeledValueArg.h: - Compilation was broken due to undef. symbols in compilers with 2 - stage name-lookup (such as gcc >= 3.4). The fix for this is to - tell the compiler what symbols to use withlines like: using - MultiArg::_name; - - This is now done and everything compiles fine. Since I'm not sure - about the support for things like using MultiArg::_name; on - all compilers it is ifdef:ed away by default. To get 2 stage - name-lookup to work you have to add -DTWO_STAGE_NAME_LOOKUP to - your CXXFLAGS before running configure. - -2004-08-18 12:34 mes5k - - * src/PrintSensibly.cpp: smartened printing even further - -2004-08-10 20:35 mes5k - - * src/PrintSensibly.cpp: fixed int messiness - -2004-08-10 20:32 mes5k - - * autotools.sh: made path explicit - -2004-08-10 20:05 mes5k - - * include/tclap/: MultiArg.h, ValueArg.h: changed allowed separator - -2004-08-10 19:53 mes5k - - * tests/: Makefile.am, test10.out, test11.out, test12.out, - test15.out, test16.out, test17.out, test18.out, test22.out, - test23.out, test24.out, test26.out, test27.out, test28.out, - test29.out, test30.out, test31.out, test32.out, test35.out, - test36.out, test38.out, test39.out, test4.out, test40.out, - test40.sh, test41.out, test41.sh, test42.out, test42.sh, - test43.out, test43.sh, test44.out, test44.sh, test45.out, - test45.sh, test46.out, test46.sh, test7.out, test7.sh: changed - error output and added usage stuff - -2004-08-10 19:52 mes5k - - * NEWS, README: updated - -2004-08-10 19:47 mes5k - - * configure.in: changed to 0.9.9 - -2004-08-10 19:46 mes5k - - * examples/test7.cpp: tweaked for usage - -2004-08-10 19:45 mes5k - - * include/tclap/: CmdLine.h, CommandLine.h, Makefile.am, - PrintSensibly.h, XorHandler.h: added usage stuff - -2004-08-10 19:43 mes5k - - * src/: CmdLine.cpp, Makefile.am, PrintSensibly.cpp, - XorHandler.cpp: tweaked usage - -2004-07-05 19:02 mes5k - - * docs/manual.html: updated for allowed - -2004-07-03 20:01 mes5k - - * tests/: test34.out, test34.sh, test35.out, test35.sh, test36.out, - test36.sh, test37.out, test37.sh, test38.out, test38.sh, - test39.out, test39.sh, Makefile.am: allow tests - -2004-07-03 19:56 mes5k - - * include/tclap/ValueArg.h: doh - -2004-07-03 19:34 mes5k - - * NEWS: allow - -2004-07-03 19:31 mes5k - - * include/tclap/Arg.h: made isReq virtual - -2004-07-03 19:30 mes5k - - * include/tclap/: MultiArg.h, UnlabeledMultiArg.h, - UnlabeledValueArg.h, ValueArg.h: added allow - -2004-07-03 19:29 mes5k - - * examples/: Makefile.am, test6.cpp, test7.cpp: added tests for - allowed - -2004-07-03 19:28 mes5k - - * docs/: index.html, manual.html: minor typos - -2004-04-26 08:18 mes5k - - * Makefile.am, autotools.sh, examples/Makefile.am, src/Makefile.am: - fixed for autotools for mandrake - -2004-02-13 20:09 mes5k - - * configure.in: 0.9.8a - -2004-02-13 15:23 mes5k - - * tests/: test22.out, test23.out, test24.out: output updates - -2004-02-13 15:21 mes5k - - * include/tclap/: Arg.h, UnlabeledMultiArg.h, UnlabeledValueArg.h: - now the Arg adds itself to the CmdLine arglist - -2004-02-13 15:20 mes5k - - * src/: Arg.cpp, CmdLine.cpp: reworked how we add args to list - -2004-02-10 08:52 mes5k - - * NEWS: update - -2004-02-09 21:04 mes5k - - * examples/test5.cpp: change - -2004-02-09 21:03 mes5k - - * src/SwitchArg.cpp: allowing blank flags - -2004-02-09 20:54 mes5k - - * configure.in: 0.9.8 - -2004-02-09 20:52 mes5k - - * tests/: Makefile.am, test20.out, test21.out, test22.out, - test23.out, test24.out, test25.out, test33.out, test33.sh: - updates - -2004-02-09 20:39 mes5k - - * docs/manual.html: blank args - -2004-02-09 20:16 mes5k - - * tests/: test15.out, test16.out, test17.out, test20.out, - test20.sh, test21.out, test21.sh, test22.out, test23.out, - test24.out, test25.out, test25.sh, test31.out, test32.out: - updates - -2004-02-09 20:05 mes5k - - * examples/: test5.cpp, test3.cpp: minor fixes and new args - -2004-02-09 19:56 mes5k - - * include/tclap/Arg.h: added new var - -2004-02-09 19:54 mes5k - - * src/: Arg.cpp, CmdLine.cpp, SwitchArg.cpp: allowing blank flags - -2004-02-07 15:37 mes5k - - * src/XorHandler.cpp: fix for the output - -2004-02-06 17:41 mes5k - - * NEWS: added info - -2004-02-06 17:24 mes5k - - * tests/: test12.out, test15.out, test16.out, test17.out: fixed - test3 stuff - -2004-02-06 17:20 mes5k - - * tests/: test26.out, test26.sh, test27.out, test27.sh, test28.out, - test28.sh, test29.out, test29.sh, test30.out, test30.sh, - test31.out, test31.sh, test32.out, test32.sh, Makefile.am: added - tests for reading extra incorrect values from arg - -2004-02-06 17:18 mes5k - - * examples/test3.cpp: add multi float - -2004-02-06 17:18 mes5k - - * include/tclap/: MultiArg.h, ValueArg.h: fixed error reading - incorrect extra values in an arg - -2004-02-04 18:56 mes5k - - * include/tclap/XorHandler.h: added include - -2004-02-03 20:21 mes5k - - * include/tclap/XorHandler.h: added doxyen - -2004-02-03 20:00 mes5k - - * docs/manual.html: xor stuff - -2004-02-03 19:56 mes5k - - * examples/test5.cpp: prettified - -2004-02-03 19:27 mes5k - - * examples/: Makefile.am, test5.cpp: xor stuff - -2004-02-03 19:24 mes5k - - * configure.in: 0.9.7 - -2004-02-03 19:22 mes5k - - * src/: Arg.cpp, CmdLine.cpp, Makefile.am, XorHandler.cpp: added - xor - -2004-02-03 19:20 mes5k - - * include/tclap/: Arg.h, CmdLine.h, CommandLine.h, - UnlabeledValueArg.h, XorHandler.h, Makefile.am: xor stuff - -2004-02-03 19:14 mes5k - - * tests/: test1.sh, test10.sh, test11.sh, test12.sh, test13.sh, - test14.sh, test15.sh, test16.sh, test17.sh, test18.sh, test19.sh, - test2.sh, test20.sh, test21.sh, test22.sh, test23.sh, test24.sh, - test25.sh, test3.sh, test4.sh, test5.sh, test6.sh, test7.sh, - test8.sh, test9.sh, Makefile.am, test20.out, test21.out, - test22.out, test23.out, test24.out, test25.out: added new tests - and comments - -2004-01-29 20:36 mes5k - - * include/tclap/: CmdLine.h, CommandLine.h, MultiArg.h, ValueArg.h: - fix for strings with spaces - -2004-01-10 09:39 mes5k - - * docs/index.html: spelling - -2004-01-07 22:18 mes5k - - * docs/: index.html, manual.html: updates - -2004-01-07 21:51 mes5k - - * NEWS: update - -2004-01-07 21:30 mes5k - - * include/tclap/CmdLine.h, src/CmdLine.cpp: added backward - compatibility - -2004-01-07 21:11 mes5k - - * src/Arg.cpp: fixed warning - -2004-01-07 21:04 mes5k - - * examples/: Makefile.am, test4.cpp: added new test - -2004-01-07 21:00 mes5k - - * tests/Makefile.am: added two new tests - -2004-01-07 20:59 mes5k - - * include/tclap/: Arg.h, ArgException.h, CmdLine.h, HelpVisitor.h, - IgnoreRestVisitor.h, MultiArg.h, SwitchArg.h, - UnlabeledMultiArg.h, UnlabeledValueArg.h, ValueArg.h, - VersionVisitor.h, Visitor.h: fixed combined switch stuff and - added doxygen comments - -2004-01-07 20:58 mes5k - - * src/: Arg.cpp, CmdLine.cpp, SwitchArg.cpp: fixed some combined - switch stuff - -2004-01-07 20:50 mes5k - - * tests/: test18.out, test18.sh, test19.out, test19.sh: new tests - -2003-12-21 18:32 mes5k - - * autotools.sh: init - -2003-12-21 18:31 mes5k - - * include/tclap/UnlabeledMultiArg.h: delim stuff - -2003-12-21 18:14 mes5k - - * examples/test1.cpp: new fangled - -2003-12-21 18:11 mes5k - - * configure.in: 0.9.6 - -2003-12-21 18:10 mes5k - - * tests/: test13.sh, test14.sh: updated - -2003-12-21 18:09 mes5k - - * tests/: test10.out, test11.out, test12.out, test13.out, - test14.out, test15.out, test16.out, test4.out: updates - -2003-12-21 18:07 mes5k - - * tests/Makefile.am: added test - -2003-12-21 18:06 mes5k - - * tests/: test17.out, test17.sh: first checkin - -2003-12-21 18:01 mes5k - - * src/Arg.cpp: removed message - -2003-12-21 17:59 mes5k - - * examples/Makefile.am: added warnings - -2003-12-21 17:58 mes5k - - * examples/: test2.cpp, test3.cpp: fixed warnings - -2003-12-21 17:53 mes5k - - * Makefile.am: added warnings - -2003-12-21 17:52 mes5k - - * src/Arg.cpp, src/CmdLine.cpp, src/SwitchArg.cpp, - examples/test3.cpp: added delimiter - -2003-12-21 17:50 mes5k - - * src/Makefile.am: added warnings - -2003-12-21 17:48 mes5k - - * include/tclap/: Arg.h, ArgException.h, CmdLine.h, MultiArg.h, - UnlabeledValueArg.h, ValueArg.h: delimiter changes - -2003-04-03 10:26 mes5k - - * include/tclap/Makefile.am: added new visitor - -2003-04-03 10:20 mes5k - - * include/tclap/Makefile.am: updates - -2003-04-03 10:13 mes5k - - * config/: mkinstalldirs, install-sh, missing, depcomp: init - checkin - -2003-04-03 10:11 mes5k - - * NEWS: update - -2003-04-03 10:06 mes5k - - * examples/Makefile.am, examples/test1.cpp, examples/test2.cpp, - examples/test3.cpp, INSTALL, Makefile.in: updates - -2003-04-03 10:01 mes5k - - * Makefile.am, configure.in: added tests - -2003-04-03 10:00 mes5k - - * docs/: index.html, manual.html: updated docs - -2003-04-03 09:59 mes5k - - * include/tclap/: Arg.h, CmdLine.h, IgnoreRestVisitor.h, - MultiArg.h, SwitchArg.h, UnlabeledMultiArg.h, - UnlabeledValueArg.h, ValueArg.h: big update - -2003-04-03 09:57 mes5k - - * src/: CmdLine.cpp, SwitchArg.cpp, Arg.cpp: new update - -2003-04-03 09:56 mes5k - - * tests/: test10.sh, test11.sh, test12.sh, test1.sh, test13.sh, - test14.sh, test15.sh, test16.sh, test2.sh, test3.sh, test4.sh, - test5.sh, test6.sh, test7.sh, test8.sh, test9.sh, test10.out, - test11.out, test12.out, test13.out, test14.out, test15.out, - test16.out, test1.out, test2.out, test3.out, test4.out, - test5.out, test6.out, test7.out, Makefile.am, test8.out, - test9.out, Makefile.in, genOut.pl: initial checkin - -2003-03-18 18:39 mes5k - - * NEWS, configure.in, AUTHORS, COPYING, ChangeLog, Makefile.am, - Makefile.in, README, aclocal.m4, configure, - config/ac_cxx_have_sstream.m4, config/ac_cxx_have_strstream.m4, - config/ac_cxx_namespaces.m4, config/bb_enable_doxygen.m4, - config/config.h.in, config/stamp-h.in, config/stamp-h1, - examples/Makefile.am, examples/Makefile.in, examples/test1.cpp, - examples/test2.cpp, include/Makefile.am, include/Makefile.in, - include/tclap/Arg.h, include/tclap/ArgException.h, - include/tclap/CmdLine.h, include/tclap/HelpVisitor.h, - include/tclap/MultiArg.h, docs/Doxyfile.in, docs/Makefile.am, - docs/Makefile.in, docs/index.html, docs/manual.html, - include/tclap/Makefile.am, include/tclap/Makefile.in, - include/tclap/SwitchArg.h, include/tclap/ValueArg.h, - include/tclap/VersionVisitor.h, include/tclap/Visitor.h, - src/Arg.cpp, src/CmdLine.cpp, src/Makefile.am, src/Makefile.in, - src/SwitchArg.cpp: Initial revision - -2003-03-18 18:39 mes5k - - * NEWS, configure.in, AUTHORS, COPYING, ChangeLog, Makefile.am, - Makefile.in, README, aclocal.m4, configure, - config/ac_cxx_have_sstream.m4, config/ac_cxx_have_strstream.m4, - config/ac_cxx_namespaces.m4, config/bb_enable_doxygen.m4, - config/config.h.in, config/stamp-h.in, config/stamp-h1, - examples/Makefile.am, examples/Makefile.in, examples/test1.cpp, - examples/test2.cpp, include/Makefile.am, include/Makefile.in, - include/tclap/Arg.h, include/tclap/ArgException.h, - include/tclap/CmdLine.h, include/tclap/HelpVisitor.h, - include/tclap/MultiArg.h, docs/Doxyfile.in, docs/Makefile.am, - docs/Makefile.in, docs/index.html, docs/manual.html, - include/tclap/Makefile.am, include/tclap/Makefile.in, - include/tclap/SwitchArg.h, include/tclap/ValueArg.h, - include/tclap/VersionVisitor.h, include/tclap/Visitor.h, - src/Arg.cpp, src/CmdLine.cpp, src/Makefile.am, src/Makefile.in, - src/SwitchArg.cpp: initial release +* xor args are deprecated in favour of *ArgGroup*s, a more feature + rich and general purpose way to express constraints among args. +* The help output and argument parsing now more closely resembles that + of the NetBSD style. +* Arguments can be hidden from the help text. +* Switched to cmake build system. +Most programs written for 1.2 should still continue to compile out of +the box, but there are some cases where minor API changes have been +made. diff --git a/tclap/Example.xml b/tclap/Example.xml deleted file mode 100755 index 2d1736f..0000000 --- a/tclap/Example.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - Register3d - 1.0 - This registers and resamples two images - - - - - - - - - - - - - mattes - mi - normalizedcorrelation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/INSTALL b/tclap/INSTALL deleted file mode 100644 index b42a17a..0000000 --- a/tclap/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/tclap/Makefile.am b/tclap/Makefile.am deleted file mode 100644 index 0a6ebc9..0000000 --- a/tclap/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ - -ACLOCAL_AMFLAGS = -I config - -SUBDIRS = include examples docs tests msc config - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(PACKAGE).pc -EXTRA_DIST = $(PACKAGE).pc.in - -DISTCLEANFILES = $(PACKAGE).pc diff --git a/tclap/NEWS b/tclap/NEWS deleted file mode 100644 index 7dbed98..0000000 --- a/tclap/NEWS +++ /dev/null @@ -1,97 +0,0 @@ - -4/3/03 - Checked in a good sized update that move support of the library -closer to that of the POSIX/GNU standards. Switches can now be combined into -single arguments, -- is supported and MultiArgs now allow for multiple labeled -args. I've also changed things a bit by subclassing MultiArg and ValueArg -to get unlabeled versions of these classes. I think this is a bit cleaner -design, despite two new classes. - -1/7/04 - ... and with great trepidation, I release 0.9.6. Loads of changes. -The big change is that you can now define the delimiter used to separate -argument flags and argument values. So if you prefer arguments of the style -"-s=asdf" instead of "-s asdf", you can do so. I've also fixed a number of -warnings generated and fixed a few pathologic bugs related to combined -switches. That said, I suspect that there may be a few significant bugs -in this release that I haven't uncovered yet. Please let me know ASAP if -you find any. - -2/6/04 - Another big release: 0.9.7. First is a bugfix submitted by -Matthias Stiller that specializes the _extractValue method in a couple of -places that allows strings with spaces to be correctly read by tclap. A -second bug found by John Ling has been fixed so that exceptions are thrown -if more than one value is parsed from a single arg or if the second value -parsed is invalid. A big new feature has been added that allows args to -be xor'd. This means that two (or more) args can be specified such that -one and only one of the args is required. If a second arg is found an -exception is thrown. See the manual for details. As always, let me know -if you run into any problems. - -2/10/04 - A minor release: 0.9.8. A couple of bug fixes for 0.9.7 are -included and a feature has been added that allows Args to be specified -without short options, meaning the user is forced to use only long options. -This is useful for programs with more options than map sensibly to single -chars. - -7/3/04 - Added a new constructor and handling to the various value args -that allows the user to provide a list of values that the input arg values -should be restricted to. - -8/9/04 - Created a function to print the output nicely, meaning line wraps -are handled somewhat sensibly now. Also changed error handling slightly. -Instead of printing the entire usage, I just print a short usage. If -someone really hates this, its easy to change back. Let me know if this -causes problems. I think this equals release 0.9.9! - -10/19/04 - A number of changes that should substantially improve the library. -The most important being that we've moved the implementation of the library -entirely into the header files. This means there is no longer a library to -complile against, you simply have to #include . New -constructors have been added to the various Arg classes that allow them to -be constructed with a CmdLine reference so that you no longer need to call -the add method if you prefer it that way. The output generated by the library -has been confined to a few methods in the CmdLine class. This means to -generate different output you can extend CmdLine and override the offending -methods. A number of style changes have been made in the code base to -conform better to C++ best practices. A thoughtful user has contributed -project files for the building the examples Microsoft Visual Studio. See -the README file in the msc directory for more details - -And so we have release 1.0! - -10/30/04 - A few bugfixes. Now checking for include.h before including it. -This will help Windows users who don't have it. Also changed test1 so that -it doesn't use toupper, which apparently causes problem for non-ASCII -character sets. - -10/31/04 - A few more tweaks, none of which should be noticeable to people -who are already using the lib without trouble. Maybe I shouldn't release -things early in the morning! Also note that manual.html is now generated -from manual.xml. If you have your own docbook xsl style that you prefer, -then have at it. - -12/3/04 - Some minor bug fixes including the removal of the two stage name -lookup ifdefs which means that the software should work out of the box -for gcc 3.4+. Isolated output in a separate class that should make -customization of output easier. I also included a rudimentary output class -that generated a (bad) Docbook command summary when used. - -1/4/05 - Several bug fixes, but no new features. Fixed a bug when mandatory -long args and unlabeled args were used together and weren't working properly. -Now they can be used together. Fixed another bug in spacePrint where long -program names caused an infinite loop. Finally, fixed a small memory leak. - -1/6/05 - Fixed a bug where setting the output object for a CmdLine didn't -register for version or usage generation. Doh! Created a Constraint interface -that should facilitate the creation of different constraints on Args. -This has involved changing the constructor interface, so if you've been using -allowed lists, you'll need to make a small modification to your existing code. -See examples/test6.cpp for details. - -9/26/09 - Whoa, long break. Primarily a bug-fix release, but we did switch -to using traits, which necessitates the minor version bump. Take a look -at test11.cpp and test12.cpp for examples on using ArgTraits for extending -tclap for different types. - -4/16/11 - Another long break! Several minor bug and memory leak fixes. - -12/26/17 - v1.2 bug fix release \ No newline at end of file diff --git a/tclap/README b/tclap/README index 325efef..62fe4d7 100644 --- a/tclap/README +++ b/tclap/README @@ -6,7 +6,4 @@ to either the GNU or POSIX standards, although it is close. See docs/manual.html for descriptions of how things work or look at the simple examples in the examples dir. -To find out what the latest changes are read the NEWS file in this -directory. - Any and all feedback is welcome at https://sf.net/p/tclap/discussion/ diff --git a/tclap/TCLAPConfig.cmake.in b/tclap/TCLAPConfig.cmake.in deleted file mode 100644 index 487677b..0000000 --- a/tclap/TCLAPConfig.cmake.in +++ /dev/null @@ -1,6 +0,0 @@ -# The TCLAP include directories. -set(TCLAP_INCLUDE_DIRS "@TCLAP_INCLUDE_DIRS_CONFIG@") -set(TCLAP_LIBRARY_DIRS "@TCLAP_LIBRARY_DIRS_CONFIG@") - -# The TCLAP USE file -set(TCLAP_USE_FILE "@TCLAP_USE_FILE_CONFIG@") diff --git a/tclap/TCLAPInstallConfig.cmake.in b/tclap/TCLAPInstallConfig.cmake.in deleted file mode 100644 index cbda43f..0000000 --- a/tclap/TCLAPInstallConfig.cmake.in +++ /dev/null @@ -1,11 +0,0 @@ -# tclap could be installed anywhere, so set all paths based on where -# this file was found (which should be the lib/tclap directory of the -# installation) -get_filename_component(tclap_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# The TCLAP include directories. -# tclap include files referenced as "tclap/foo.h" -set(TCLAP_INCLUDE_DIRS "${tclap_CONFIG_DIR}/../../include/") - -# The TCLAP USE file -set(TCLAP_USE_FILE "${tclap_CONFIG_DIR}/UseTCLAP.cmake") diff --git a/tclap/UseTCLAP.cmake.in b/tclap/UseTCLAP.cmake.in deleted file mode 100644 index dd15862..0000000 --- a/tclap/UseTCLAP.cmake.in +++ /dev/null @@ -1 +0,0 @@ -include_directories(BEFORE ${TCLAP_INCLUDE_DIRS}) diff --git a/tclap/autotools.sh b/tclap/autotools.sh deleted file mode 100755 index dd9defd..0000000 --- a/tclap/autotools.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -echo "Using autotools versions:" -if [[ -e /usr/bin/autoconf-2.5x && -e /usr/bin/automake-1.7 ]] -then - autoconf-2.5x --version | grep autoconf - automake-1.7 --version | grep automake - aclocal-1.7 -I config - autoconf-2.5x - autoheader-2.5x - automake-1.7 -a -else - autoconf --version | grep autoconf - automake --version | grep automake - aclocal -I config - autoconf - autoheader - automake -a -fi diff --git a/tclap/config/Makefile.am b/tclap/config/Makefile.am deleted file mode 100644 index 0fbccae..0000000 --- a/tclap/config/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ - -EXTRA_DIST = ac_cxx_have_sstream.m4\ - ac_cxx_have_strstream.m4\ - ac_cxx_namespaces.m4\ - bb_enable_doxygen.m4 - - diff --git a/tclap/config/ac_cxx_have_long_long.m4 b/tclap/config/ac_cxx_have_long_long.m4 deleted file mode 100644 index d0dd85c..0000000 --- a/tclap/config/ac_cxx_have_long_long.m4 +++ /dev/null @@ -1,19 +0,0 @@ -dnl @synopsis AC_CXX_HAVE_LONG_LONG -dnl -dnl If the C++ implementation have a long long type -dnl -AC_DEFUN([AC_CXX_HAVE_LONG_LONG], -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([],[long long x = 1; return 0;], - ac_cv_cxx_have_long_long=yes, ac_cv_cxx_have_long_long=no) - -if test "$ac_cv_cxx_have_long_long" = yes; then - AC_DEFINE(HAVE_LONG_LONG, 1, - [define if the C++ implementation have long long]) -else - AC_DEFINE(HAVE_LONG_LONG, 0, - [define if the C++ implementation have long long]) -fi -AC_LANG_RESTORE -]) diff --git a/tclap/config/ac_cxx_have_sstream.m4 b/tclap/config/ac_cxx_have_sstream.m4 deleted file mode 100644 index 677f778..0000000 --- a/tclap/config/ac_cxx_have_sstream.m4 +++ /dev/null @@ -1,25 +0,0 @@ -dnl @synopsis AC_CXX_HAVE_SSTREAM -dnl -dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. -dnl -dnl @author Ben Stanley -dnl @version $Id: ac_cxx_have_sstream.m4,v 1.2 2006/02/22 02:10:28 zeekec Exp $ -dnl -AC_DEFUN([AC_CXX_HAVE_SSTREAM], -[AC_REQUIRE([AC_CXX_NAMESPACES]) -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -AC_CHECK_HEADERS(sstream) -AC_CACHE_CHECK([whether the STL defines stringstream], -[ac_cv_cxx_have_sstream], -[AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[stringstream message; message << "Hello"; return 0;], - ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) -]) -if test "$ac_cv_cxx_have_sstream" = yes; then - AC_DEFINE(HAVE_SSTREAM,1,[define if the compiler has stringstream]) -fi -AC_LANG_RESTORE -]) diff --git a/tclap/config/ac_cxx_have_strstream.m4 b/tclap/config/ac_cxx_have_strstream.m4 deleted file mode 100644 index 1b811d1..0000000 --- a/tclap/config/ac_cxx_have_strstream.m4 +++ /dev/null @@ -1,28 +0,0 @@ -dnl @synopsis AC_CXX_HAVE_STRSTREAM -dnl -dnl If the C++ library has a working strstream, define HAVE_CLASS_STRSTREAM. -dnl -dnl Adapted from ac_cxx_have_sstream.m4 by Steve Robbins -dnl -AC_DEFUN([AC_CXX_HAVE_STRSTREAM], -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_CHECK_HEADERS(strstream) - AC_CACHE_CHECK([whether the STL defines strstream], -[ac_cv_cxx_have_class_strstream], -[AC_TRY_COMPILE([#if HAVE_STRSTREAM -# include -#else -# include -#endif -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[ostrstream message; message << "Hello"; return 0;], - ac_cv_cxx_have_class_strstream=yes, ac_cv_cxx_have_class_strstream=no) -]) -if test "$ac_cv_cxx_have_class_strstream" = yes; then - AC_DEFINE(HAVE_CLASS_STRSTREAM,1,[define if the library defines strstream]) -fi -AC_LANG_RESTORE -]) diff --git a/tclap/config/ac_cxx_namespaces.m4 b/tclap/config/ac_cxx_namespaces.m4 deleted file mode 100644 index 8ae60dd..0000000 --- a/tclap/config/ac_cxx_namespaces.m4 +++ /dev/null @@ -1,22 +0,0 @@ -dnl @synopsis AC_CXX_NAMESPACES -dnl -dnl If the compiler can prevent names clashes using namespaces, define -dnl HAVE_NAMESPACES. -dnl -dnl @version $Id: ac_cxx_namespaces.m4,v 1.1 2003/03/19 02:40:00 mes5k Exp $ -dnl @author Luc Maisonobe -dnl -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,1,[define to 1 if the compiler implements namespaces]) -fi -]) diff --git a/tclap/config/ac_cxx_warn_effective_cxx.m4 b/tclap/config/ac_cxx_warn_effective_cxx.m4 deleted file mode 100644 index 8085d24..0000000 --- a/tclap/config/ac_cxx_warn_effective_cxx.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl HAVE_WARN_EFFECTIVE_CXX -dnl ---------------------- -dnl -dnl If the C++ compiler accepts the `-Weffc++' flag, -dnl set output variable `WARN_EFFECTIVE_CXX' to `-Weffc++' and -dnl `WARN_NO_EFFECTIVE_CXX' to `-Wno-effc++'. Otherwise, -dnl leave both empty. -dnl -AC_DEFUN([HAVE_WARN_EFFECTIVE_CXX], -[ -AC_REQUIRE([AC_PROG_CXX]) -AC_MSG_CHECKING([whether the C++ compiler (${CXX}) accepts -Weffc++]) -AC_CACHE_VAL([_cv_warn_effective_cxx], -[ -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -save_cxxflags="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS -Weffc++" -AC_TRY_COMPILE([],[main();], -[_cv_warn_effective_cxx=yes], [_cv_warn_effective_cxx=no]) -CXXFLAGS="$save_cxxflags" -AC_LANG_RESTORE -]) -AC_MSG_RESULT([$_cv_warn_effective_cxx]) -if test "$_cv_warn_effective_cxx" = yes; then - WARN_EFFECTIVE_CXX=-Weffc++ - WARN_NO_EFFECTIVE_CXX=-Wno-effc++ -fi -AC_SUBST([WARN_EFFECTIVE_CXX]) -AC_SUBST([WARN_NO_EFFECTIVE_CXX]) -]) diff --git a/tclap/config/bb_enable_doxygen.m4 b/tclap/config/bb_enable_doxygen.m4 deleted file mode 100644 index 2b34542..0000000 --- a/tclap/config/bb_enable_doxygen.m4 +++ /dev/null @@ -1,18 +0,0 @@ -AC_DEFUN([BB_ENABLE_DOXYGEN], -[ -AC_ARG_ENABLE(doxygen, [--enable-doxygen enable documentation generation with doxygen (auto)]) -if test "x$enable_doxygen" = xno; then - enable_doc=no -else - AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) - if test x$DOXYGEN = x; then - if test "x$enable_doxygen" = xyes; then - AC_MSG_ERROR([could not find doxygen]) - fi - enable_doc=no - else - enable_doc=yes - fi -fi -AM_CONDITIONAL(DOC, test x$enable_doc = xyes) -]) diff --git a/tclap/config/depcomp b/tclap/config/depcomp deleted file mode 100755 index 6589965..0000000 --- a/tclap/config/depcomp +++ /dev/null @@ -1,411 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 AIX compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - - tmpdepfile1="$object.d" - tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` - if test "$libtool" = yes; then - "$@" -Wc,-MD - else - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - # X makedepend - ( - shift - cleared=no - for arg in "$@"; do - case $cleared in no) - set ""; shift - cleared=yes - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tail +3 "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/tclap/config/install-sh b/tclap/config/install-sh deleted file mode 100755 index e9de238..0000000 --- a/tclap/config/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/tclap/config/missing b/tclap/config/missing deleted file mode 100755 index 0a7fb5a..0000000 --- a/tclap/config/missing +++ /dev/null @@ -1,283 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.3 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/tclap/config/mkinstalldirs b/tclap/config/mkinstalldirs deleted file mode 100755 index eaf13ad..0000000 --- a/tclap/config/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 2003/04/03 18:13:41 mes5k Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/tclap/config/stamp-h.in b/tclap/config/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/tclap/config/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/tclap/config/stamp-h1 b/tclap/config/stamp-h1 deleted file mode 100644 index 22326a7..0000000 --- a/tclap/config/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for config/config.h diff --git a/tclap/configure.ac b/tclap/configure.ac deleted file mode 100644 index 1e9f147..0000000 --- a/tclap/configure.ac +++ /dev/null @@ -1,31 +0,0 @@ -AC_INIT(Makefile.am) -#AC_PREREQ(2.50) -AC_CONFIG_AUX_DIR(config) -AM_CONFIG_HEADER(config/config.h) -AM_INIT_AUTOMAKE(tclap,1.2.2) -AC_PROG_CXX -AC_CXX_HAVE_SSTREAM -AC_CXX_HAVE_STRSTREAM -AC_CXX_HAVE_LONG_LONG -AC_CHECK_PROG(DOT,dot,YES,NO) -AC_PROG_RANLIB -AC_PROG_INSTALL -BB_ENABLE_DOXYGEN - -HAVE_WARN_EFFECTIVE_CXX -CXXFLAGS="$CXXFLAGS $WARN_EFFECTIVE_CXX" - -AM_CONDITIONAL([HAVE_GNU_COMPILERS], [test x$ac_cv_cxx_compiler_gnu = xyes]) - -AC_OUTPUT([ Makefile \ - tclap.pc \ - examples/Makefile \ - include/Makefile \ - include/tclap/Makefile \ - config/Makefile \ - docs/Makefile \ - docs/Doxyfile \ - msc/Makefile \ - msc/examples/Makefile \ - tests/Makefile], \ - [chmod a+x $ac_top_srcdir/tests/*.sh]) diff --git a/tclap/configure.in b/tclap/configure.in deleted file mode 100644 index dd89855..0000000 --- a/tclap/configure.in +++ /dev/null @@ -1,22 +0,0 @@ -AC_INIT(Makefile.am) -#AC_PREREQ(2.50) -AC_CONFIG_AUX_DIR(config) -AM_CONFIG_HEADER(config/config.h) -AM_INIT_AUTOMAKE(tclap,1.0.5) -AC_PROG_CXX -AC_CXX_HAVE_SSTREAM -AC_CXX_HAVE_STRSTREAM -AC_CHECK_PROG(DOT,dot,YES,NO) -AC_PROG_RANLIB -AC_PROG_INSTALL -BB_ENABLE_DOXYGEN -AC_OUTPUT([ Makefile \ - examples/Makefile \ - include/Makefile \ - include/tclap/Makefile \ - docs/Makefile \ - docs/Doxyfile \ - msc/Makefile \ - msc/examples/Makefile \ - tests/Makefile], \ - [chmod a+x $ac_top_srcdir/tests/*.sh]) diff --git a/tclap/docs/Doxyfile.in b/tclap/docs/Doxyfile.in deleted file mode 100644 index 671d8c9..0000000 --- a/tclap/docs/Doxyfile.in +++ /dev/null @@ -1,1078 +0,0 @@ -# Doxyfile 1.3.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = tclap - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = "@VERSION@" - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, -# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en -# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, -# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. It is allowed to use relative paths in the argument list. - -STRIP_FROM_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explict @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# reimplements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = @top_srcdir@/include/tclap - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output dir. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = letter - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimised for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assigments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superceded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = @DOT@ - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similiar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/tclap/docs/Makefile.am b/tclap/docs/Makefile.am deleted file mode 100644 index f9a0528..0000000 --- a/tclap/docs/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ - -if DOC - -all: - @DOXYGEN@ Doxyfile - -manual: manual.xml - xsltproc -o manual.html --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl manual.xml - -else - -all: - -endif - -EXTRA_DIST = manual.xml -dist_doc_DATA = index.html manual.html style.css -docdir = ${datadir}/doc/${PACKAGE} - -install-data-local : - $(mkdir_p) $(DESTDIR)$(docdir) - cp -R $(abs_srcdir)/html $(DESTDIR)$(docdir) - -uninstall-local : - chmod -R o+w $(DESTDIR)$(docdir) - rm -rf $(DESTDIR)$(docdir) - -dist-hook : - $(mkdir_p) $(distdir) - cp -R $(abs_srcdir)/html $(distdir) - -clean-local: - $(RM) -rf $(abs_builddir)/html/* - $(RM) -rf $(abs_builddir)/doxygen_sqlite3.db - diff --git a/tclap/docs/README b/tclap/docs/README deleted file mode 100644 index 96d8d40..0000000 --- a/tclap/docs/README +++ /dev/null @@ -1,5 +0,0 @@ - -To generate the manual from the docbook xml you need and xslt processor -and an xsl file that defines the output. For example: - -xsltproc --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl manual.xml > manual.html diff --git a/tclap/docs/index.html b/tclap/docs/index.html deleted file mode 100644 index 11b15fb..0000000 --- a/tclap/docs/index.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - -tclap -- Templatized C++ Command Line Parser Library - - - - - - - - -
    -

    Templatized C++ Command Line Parser Library

    -
    -Get Templatized C++ Command Line Parser at SourceForge.net. Fast, secure and Free Open Source software downloads -
    -

    -
    - -

    -TCLAP is a small, flexible library that provides a simple interface for -defining and accessing command line arguments. It was intially -inspired by the user friendly CLAP libary. The -difference is that this library is templatized, so the argument -class is type independent. Type independence avoids identical-except-for-type -objects, such as IntArg, FloatArg, and StringArg. While the library is -not strictly compliant with the GNU or POSIX standards, it is -close. -

    - -

    -TCLAP is written in ANSI C++ and is meant to be compatible with any -standards-compliant C++ compiler. It is known to work on Linux, MacOS X, -Windows, and Solaris platforms. The library is implemented -entirely in header files making it easy to use and distribute with other -software. It is licensed under the -MIT License -for worry free distribution. -

    -

    -TCLAP is now a mature, stable, and feature rich package. -Unless I get really bored, it probably won't see much further -development aside from bug fixes and compatibility updates. -Please don't let any apparent project inactivity discourage you -from using the software! -

    -

    -Don't hesitate to -send us your feedback! -

    - -

    -Happy coding! -

    -
    - - - diff --git a/tclap/docs/manual.html b/tclap/docs/manual.html deleted file mode 100644 index 51d4392..0000000 --- a/tclap/docs/manual.html +++ /dev/null @@ -1,940 +0,0 @@ -Templatized C++ Command Line Parser Manual

    Templatized C++ Command Line Parser Manual

    Michael E Smoot


    Chapter 1. Basic Usage

    Overview

    -TCLAP has a few key classes to be aware of. -The first is the -CmdLine (command line) class. This class parses -the command line passed to it according to the arguments that it -contains. Arguments are separate objects that are added to the -CmdLine object one at a time. The six -argument classes are: ValueArg, -UnlabeledValueArg, -SwitchArg, MultiSwitchArg, -MultiArg and -UnlabeledMultiArg. -These classes are templatized, which means they can be defined to parse -a value of any type. Once you add the -arguments to the CmdLine object, it parses the -command line -and assigns the data it finds to the specific argument objects it -contains. Your program accesses the values parsed by -calls to the getValue() methods of the -argument objects. -

    Example

    -Here is a simple example ... - -

    -#include <string>
    -#include <iostream>
    -#include <algorithm>
    -#include <tclap/CmdLine.h>
    -
    -int main(int argc, char** argv)
    -{
    -
    -	// Wrap everything in a try block.  Do this every time, 
    -	// because exceptions will be thrown for problems.
    -	try {  
    -
    -	// Define the command line object, and insert a message
    -	// that describes the program. The "Command description message" 
    -	// is printed last in the help text. The second argument is the 
    -	// delimiter (usually space) and the last one is the version number. 
    -	// The CmdLine object parses the argv array based on the Arg objects
    -	// that it contains. 
    -	TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
    -
    -	// Define a value argument and add it to the command line.
    -	// A value arg defines a flag and a type of value that it expects,
    -	// such as "-n Bishop".
    -	TCLAP::ValueArg<std::string> nameArg("n","name","Name to print",true,"homer","string");
    -
    -	// Add the argument nameArg to the CmdLine object. The CmdLine object
    -	// uses this Arg to parse the command line.
    -	cmd.add( nameArg );
    -
    -	// Define a switch and add it to the command line.
    -	// A switch arg is a boolean argument and only defines a flag that
    -	// indicates true or false.  In this example the SwitchArg adds itself
    -	// to the CmdLine object as part of the constructor.  This eliminates
    -	// the need to call the cmd.add() method.  All args have support in
    -	// their constructors to add themselves directly to the CmdLine object.
    -	// It doesn't matter which idiom you choose, they accomplish the same thing.
    -	TCLAP::SwitchArg reverseSwitch("r","reverse","Print name backwards", cmd, false);
    -
    -	// Parse the argv array.
    -	cmd.parse( argc, argv );
    -
    -	// Get the value parsed by each arg. 
    -	std::string name = nameArg.getValue();
    -	bool reverseName = reverseSwitch.getValue();
    -
    -	// Do what you intend. 
    -	if ( reverseName )
    -	{
    -		std::reverse(name.begin(),name.end());
    -		std::cout << "My name (spelled backwards) is: " << name << std::endl;
    -	}
    -	else
    -		std::cout << "My name is: " << name << std::endl;
    -
    -
    -	} catch (TCLAP::ArgException &e)  // catch any exceptions
    -	{ std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; }
    -}
    -

    - -The output should look like: - -

    -
    -% test1 -n mike
    -My name is: mike
    -
    -% test1 -n mike -r
    -My name (spelled backwards) is: ekim
    -
    -% test1 -r -n mike
    -My name (spelled backwards) is: ekim
    -
    -% test1 -r
    -PARSE ERROR:
    -             One or more required arguments missing!
    -
    -Brief USAGE:
    -   test1  [-r] -n <string> [--] [-v] [-h]
    -
    -For complete USAGE and HELP type:
    -   test1 --help
    -
    -
    -% test1 --help
    -
    -USAGE:
    -
    -   test1  [-r] -n <string> [--] [-v] [-h]
    -
    -
    -Where:
    -
    -   -r,  --reverse
    -     Print name backwards
    -
    -   -n <string>  --name <string>
    -     (required)  (value required)  Name to print
    -
    -   --,  --ignore_rest
    -     Ignores the rest of the labeled arguments following this flag.
    -
    -   -v,  --version
    -     Displays version information and exits.
    -
    -   -h,  --help
    -     Displays usage information and exits.
    -
    -
    -   Command description message
    -
    -

    -

    Library Properties

    -This example shows a number of different properties of the -library... -

    • Arguments can appear in any order (...mostly, - more on this later).
    • The help, version -and --SwitchArgs -are specified automatically. Using either the -h or ---help flag will cause the USAGE message to be displayed, --v or --version will cause -any version information to -be displayed, and -- or ---ignore_rest will cause the -remaining labeled arguments to be ignored. These switches are -included by default on every command line. You can disable this functionality if desired (although we don't recommend it). -How we generate the behavior behind these flags is described - later. -
    • If there is an error parsing the command line (e.g. a required -argument isn't provided), the program exits and displays a brief -USAGE and an error message.
    • The program name is assumed to always be argv[0], so it isn't -specified directly.
    • A value delimiter character can be specified. This means that if you -prefer arguments of the style -s=asdf instead of --s asdf, you can do so.
    • Always wrap everything in a try block that catches -ArgExceptions! Any problems found in constructing the -CmdLine, constructing the Args, -or parsing the command line will throw an -ArgException.

    -

    Common Argument Properties

    -Arguments, whatever their type, have a few common properties. -These properties are set in the constructors of the arguments. -

    • First is the flag or the character preceded by a dash(-) that -signals the beginning of the argument on the command line.
    • Arguments also have names, which can also be used -as an alternative flag on the command line, this time preceded by two dashes -(--) [like the familiar getopt_long()].
    • Next is the description of the argument. This is a short -description of the argument displayed in the help/usage message -when needed.
    • The following parameters in the constructors vary depending on -the type of argument. Some possible values include: -
      • A boolean value indicating whether the Arg is required or not.
      • A default value.
      • A description of the type of value expected.
      • A constraint on the value expected.
      • The CmdLine instance that the Arg should be added to.
      • A Visitor.
    • See the API Documentation for more detail.

    -

    Compiling

    -TCLAP is implemented entirely in header files -which means you only need to include CmdLine.h to use the library. -

    -        #include <tclap/CmdLine.h>
    -

    -You'll need to make sure that your compiler can see the header -files. If you do the usual "make install" then your compiler should -see the files by default. Alternatively, you can use the -I -complier argument to specify the exact location of the libraries. -

    -        c++ -o my_program -I /some/place/tclap-1.X/include my_program.cpp
    -

    -Where /some/place/tclap-1.X is the place you have unpacked the -distribution. -

    -Finally, if you want to include TCLAP as part of -your software -(which is perfectly OK, even encouraged) then simply copy the -contents of /some/place/tclap-1.X/include (the tclap directory and -all of the header files it contains) into your include -directory. The necessary m4 macros for proper configuration are included -in the config directory. -

    -TCLAP was developed on Linux and MacOSX systems. -It is also known -to work on Windows, Sun and Alpha platforms. We've made every -effort to keep the library compliant with the ANSI C++ standard so -if your compiler meets the standard, then this library should work -for you. Please let us know if this is not the case! -

    Windows Note

    -As we understand things, Visual C++ does not have the file -config.h which is used to make platform -specific definitions. In this situation, we assume that you -have access to sstream. Our understanding is that -this should not be a problem for VC++ 7.x. However, if this -is not the case and you need to use strstream, -then simply tell your compiler to define the variable -HAVE_STRSTREAM and undefine -HAVE_SSTREAM That -should work. We think. Alternatively, just edit -the files ValueArg.h and MultiArg.h. -

    -

    Random Note

    -If your compiler doesn't support the using syntax used -in UnlabeledValueArg and -UnlabeledMultiArg to support two stage name lookup, -then you have two options. Either comment out the statements if you don't -need two stage name lookup, or do a bunch of search and replace and use -the this pointer syntax: e.g. -this->_ignoreable instead -of just _ignorable (do this for each variable -or method referenced by using). -

    -

    Chapter 2. Fundamental Classes

    CmdLine

    -The CmdLine class contains the arguments that define -the command line and manages the parsing of the command line. The -CmdLine doesn't parse the command line itself it only -manages the parsing. The actual parsing of individual arguments occurs within -the arguments themselves. The CmdLine keeps track of -of the required arguments, relationships -between arguments, and output generation. -

    SwitchArg

    SwitchArgs are what the name implies: -simple, on/off, boolean switches. Use SwitchArgs -anytime you want to turn -some sort of system property on or off. SwitchArgs -don't parse a value. They return TRUE or -FALSE, depending on whether the switch has been found -on the command line and what the default value was defined as.

    ValueArg

    ValueArgs are arguments that read a -value of some type -from the command line. Any time you need a file name, a number, -etc. use a ValueArg or one of its variants. -All ValueArgs are - templatized and will attempt to parse -the string its flag matches on the command line as the type it is -specified as. ValueArg<int> -will attempt to parse an -int, ValueArg<float> will attempt to -parse a float, etc. If operator>> -for the specified type doesn't -recognize the string on the command line as its defined type, then -an exception will be thrown. -

    MultiArg

    -A MultiArg is a ValueArg that -can be specified more than once on a command line and instead of returning -a single value, returns a vector of values. -

    -Imagine a compiler that allows you to specify multiple directories -to search for libraries... -

    -                % fooCompiler -L /dir/num1 -L /dir/num2 file.foo 
    -

    -Exceptions will occur if you try to do this -with a ValueArg or a SwitchArg. -In situations like this, you will want to use a -MultiArg. A -MultiArg is essentially a -ValueArg that appends any -value that it matches and parses onto a vector of values. When the -getValue() method is called, a vector of -values, instead of a single value is returned. A -MultiArg is declared much like -a ValueArg: - - -

    -                MultiArg<int> itest("i", "intTest", "multi int test", false,"int" );
    -                cmd.add( itest );
    -

    -Note that MultiArgs can be added to the -CmdLine in any order (unlike - UnlabeledMultiArg). -

    MultiSwitchArg

    -A MultiSwitchArg is a SwitchArg -that can be specified more than once on a command line. -This can be useful -when command lines are constructed automatically from within other applications -or when a switch occurring -more than once indicates a value (-V means a little verbose -V -V -V means a lot -verbose), You can use a MultiSwitchArg. -The call -to getValue() for a MultiSwitchArg returns the number (int) of times -the switch has been found on the command line in addition to the default value. -Here is an example using the default initial value of 0: -

    -	MultiSwitchArg quiet("q","quiet","Reduce the volume of output");
    -	cmd.add( quiet );
    -

    -Alternatively, you can specify your own initial value: -

    -	MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5);
    -	cmd.add( quiet );
    -

    -

    UnlabeledValueArg

    -An UnlabeledValueArg is a ValueArg that is not identified by a flag on the command line. Instead -UnlabeledValueArgs are identified by their position in -the argv array. -

    -To this point all of our arguments have had labels (flags) -identifying them on the command line, but there are some -situations where flags are burdensome and not worth the effort. One -example might be if you want to implement a magical command we'll -call copy. All copy does is -copy the file specified -in the first argument to the file specified in the second argument. -We can do this using UnlabeledValueArgs which are pretty -much just ValueArgs without the flag specified, -which tells -the CmdLine object to treat them accordingly. -The code would look like this: - -

    -
    -                UnlabeledValueArg<float>  nolabel( "name", "unlabeled test", true, 3.14,
    -                                                  "nameString"  );
    -                cmd.add( nolabel );
    -
    -

    - -Everything else is handled identically to what is seen above. The -only difference to be aware of, and this is important: the order -that UnlabeledValueArgs are added to the CmdLine -is the order that they will be parsed!!!! -This is not the case for normal -SwitchArgs and ValueArgs. -What happens internally is the first argument that the -CmdLine doesn't recognize is assumed to be -the first UnlabeledValueArg and -parses it as such. Note that you are allowed to intersperse labeled -args (SwitchArgs and ValueArgs) in between -UnlabeledValueArgs (either on the command line -or in the declaration), but the UnlabeledValueArgs -will still be parsed in the order they are added. Just remember that order is -important for unlabeled arguments. -

    UnlabeledMultiArg

    -An UnlabeledMultiArg is an UnlabeledValueArg that allows more than one value to be specified. Only one -UnlabeledMultiArg can be specified per command line. -The UnlabeledMultiArg simply reads the remaining -values from argv up until -- or the end of the array is reached. -

    -Say you want a strange command -that searches each file specified for a given string (let's call it -grep), but you don't want to have to type in all of the file -names or write a script to do it for you. Say, - -

    -                % grep pattern *.txt
    -

    - -First remember that the * is handled by the shell and -expanded accordingly, so what the program grep sees is -really something like: - -

    -                % grep pattern file1.txt file2.txt fileZ.txt
    -

    - -To handle situations where multiple, unlabeled arguments are needed, -we provide the UnlabeledMultiArg. -UnlabeledMultiArgs -are declared much like everything else, but with only a description -of the arguments. By default, if an UnlabeledMultiArg -is specified, then at least one is required to be present or an -exception will be thrown. The most important thing to remember is, -that like UnlabeledValueArgs: order matters! -In fact, an UnlabeledMultiArg must be the last argument added to the -CmdLine!. Here is what a declaration looks like: - -

    -
    -                //
    -                // UnlabeledMultiArg must be the LAST argument added!
    -                //
    -                UnlabeledMultiArg<string> multi("file names");
    -                cmd.add( multi );
    -                cmd.parse(argc, argv);
    -
    -                vector<string>  fileNames = multi.getValue();
    -
    -

    - -You must only ever specify one (1) UnlabeledMultiArg. -One UnlabeledMultiArg will read every unlabeled -Arg that wasn't already processed by a -UnlabeledValueArg into a -vector of type T. Any -UnlabeledValueArg or other -UnlabeledMultiArg specified after the first -UnlabeledMultiArg will be ignored, and if -they are required, -exceptions will be thrown. When you call the -getValue() -method of the UnlabeledValueArg argument, -a vector -will be returned. If you can imagine a situation where there will -be multiple args of multiple types (stings, ints, floats, etc.) -then just declare the UnlabeledMultiArg as type -string and parse the different values yourself or use -several UnlabeledValueArgs. -

    Chapter 3. Complications

    -Naturally, what we have seen to this point doesn't satisfy all of -our needs. -

    I want to combine multiple switches into one argument...

    -Multiple SwitchArgs can be combined into a -single argument on the command line. If you have switches -a, -b and -c -it is valid to do either: - -

    -                % command -a -b -c
    -

    - -or - -

    -                % command -abc
    -

    - -or - -

    -                % command -ba -c
    -

    - -This is to make this library more in line with the POSIX and GNU -standards (as I understand them). -

    I want one argument or the other, but not both...

    -Suppose you have a command that must read input from one of two -possible locations, either a local file or a URL. The command -must read something, so one -argument is required, but -not both, yet neither argument is strictly necessary by itself. -This is called "exclusive or" or "XOR". To accommodate this -situation, there is now an option to add two or more -Args to -a CmdLine that are exclusively or'd with one another: -xorAdd(). This means that exactly one of the -Args must be set and no more. -

    -xorAdd() comes in two flavors, either -xorAdd(Arg& a, Arg& b) -to add just two Args to be xor'd and -xorAdd( vector<Arg*> xorList ) -to add more than two Args. - -

    -
    -
    -        ValueArg<string>  fileArg("f","file","File name to read",true,"/dev/null", "filename");
    -        ValueArg<string>  urlArg("u","url","URL to load",true, "http://example.com", "URL");
    -
    -        cmd.xorAdd( fileArg, urlArg );
    -        cmd.parse(argc, argv);
    -
    -

    - -Once one Arg in the xor list is matched on the -CmdLine then the others in the xor list will be -marked as set. The question then, is how to determine which of the -Args has been set? This is accomplished by calling the -isSet() method for each Arg. If the -Arg has been -matched on the command line, the isSet() will return -TRUE, whereas if the Arg -has been set as a result of matching the other Arg -that was xor'd isSet() will -return FALSE. -(Of course, if the Arg was not xor'd and -wasn't matched, it will also return FALSE.) - -

    -
    -        if ( fileArg.isSet() )
    -                readFile( fileArg.getValue() );
    -        else if ( urlArg.isSet() )
    -                readURL( urlArg.getValue() );
    -        else
    -                // Should never get here because TCLAP will note that one of the
    -                // required args above has not been set.
    -                throw("Very bad things...");
    -
    -

    - -It is helpful to note that Args of any type can be xor'd together. -This means that you can xor a SwitchArg with a ValueArg. -This is helpful in situations where one of several options is necessary and one of the options -requires additional information. - -

    -
    -        SwitchArg  stdinArg("s", "stdin", "Read from STDIN", false);
    -        ValueArg<string>  fileArg("f","file","File name to read",true,"/dev/null", "filename");
    -        ValueArg<string>  urlArg("u","url","URL to load",true, "http://example.com", "URL");
    -
    -        vector<Arg*>  xorlist;
    -        xorlist.push_back(&stdinArg);
    -        xorlist.push_back(&fileArg);
    -        xorlist.push_back(&urlArg);
    -
    -        cmd.xorAdd( xorlist );
    -
    -

    - - -

    I have more arguments than single flags make sense for...

    -Some commands have so many options that single flags no longer map -sensibly to the available options. In this case, it is desirable to -specify Args using only long options. This one is easy to -accomplish, just make the flag value blank in the Arg -constructor. This will tell the Arg that only the long -option should be matched and will force users to specify the long -option on the command line. The help output is updated accordingly. - -

    -
    -        ValueArg<string>  fileArg("","file","File name",true,"homer","filename");
    -
    -        SwitchArg  caseSwitch("","upperCase","Print in upper case",false);
    -
    -

    -

    I want to constrain the values allowed for a particular -argument...

    -Interface Change!!! Sorry folks, but we've changed -the interface since version 1.0.X for constraining Args. -Constraints are now hidden behind the Constraint -interface. To -constrain an Arg simply implement the interface -and specify the new class in the constructor as before. -

    -You can still constrain Args based on -a list of values. Instead of adding a vector of -allowed values to the Arg directly, -create a ValuesConstraint object -with a vector of values and add that to the -Arg. The Arg constructors -have been modified accordingly. -

    -When the value for the -Arg is parsed, -it is checked against the list of values specified in the -ValuesConstraint. -If the value is in the list then it is accepted. If -not, then an exception is thrown. Here is a simple example: - -

    -		vector<string> allowed;
    -		allowed.push_back("homer");
    -		allowed.push_back("marge");
    -		allowed.push_back("bart");
    -		allowed.push_back("lisa");
    -		allowed.push_back("maggie");
    -		ValuesConstraint<string> allowedVals( allowed );
    -        
    -		ValueArg<string> nameArg("n","name","Name to print",true,"homer",&allowedVals);
    -		cmd.add( nameArg );
    -

    - -When a ValuesConstraint is specified, -instead of a type description being specified in the -Arg, a -type description is created by concatenating the values in the -allowed list using operator<< for the specified type. The -help/usage for the Arg therefore lists the -allowable values. Because of this, you might want to keep the list -relatively small, however there is no limit on this. -

    -Obviously, a list of allowed values isn't always the best way to -constrain things. For instance, one might wish to allow only -integers greater than 0. In this case, simply create a class that -implements the Constraint<int> interface and -checks whether the value parsed is greater than 0 (done in the -check() method) and create your -Arg with your new Constraint. -

    I want the Args to add themselves to the CmdLine...

    -New constructors have been added for each Arg -that take a CmdLine object as an argument. -Each Arg then -adds itself to the CmdLine -object. There is no difference in how the Arg -is handled between this method and calling the -add() method directly. At the moment, there is -no way to do an xorAdd() from the constructor. Here -is an example: - -

    -
    -        // Create the command line.
    -        CmdLine cmd("this is a message", '=', "0.99" );
    -
    -        // Note that the following args take the "cmd" object as arguments.
    -        SwitchArg btest("B","existTestB", "exist Test B", cmd, false );
    -
    -        ValueArg<string> stest("s", "stringTest", "string test", true, "homer", 
    -                                               "string", cmd );
    -
    -        UnlabeledValueArg<string> utest("unTest1","unlabeled test one", 
    -                                                        "default","string", cmd );
    -        
    -        // NO add() calls!
    -
    -        // Parse the command line.
    -        cmd.parse(argc,argv);
    -
    -

    -

    I want different output than what is provided...

    -It is straightforward to change the output generated by -TCLAP. Either subclass the -StdOutput class and re-implement the methods you choose, -or write your own class that implements the -CmdLineOutput interface. Once you have done this, -then use the CmdLine setOutput -method to tell the CmdLine to use your new output -class. Here is a simple example: -

    -class MyOutput : public StdOutput
    -{
    -	public:
    -		virtual void failure(CmdLineInterface& c, ArgException& e)
    -		{ 
    -			cerr << "My special failure message for: " << endl
    -				 << e.what() << endl;
    -			exit(1);
    -		}
    -
    -		virtual void usage(CmdLineInterface& c)
    -		{
    -			cout << "my usage message:" << endl;
    -			list<Arg*> args = c.getArgList();
    -			for (ArgListIterator it = args.begin(); it != args.end(); it++)
    -				cout << (*it)->longID() 
    -					 << "  (" << (*it)->getDescription() << ")" << endl;
    -		}
    -
    -		virtual void version(CmdLineInterface& c)
    -		{
    -			cout << "my version message: 0.1" << endl;
    -		}
    -};
    -
    -int main(int argc, char** argv)
    -{
    -		CmdLine cmd("this is a message", ' ', "0.99" );
    -
    -		// set the output
    -		MyOutput my;
    -		cmd.setOutput( &my );
    -
    -		// proceed normally ...
    -

    - -See test4.cpp in the examples directory for the full -example. NOTE: if you supply your own Output object, we -will not delete it in the CmdLine destructor. This -could lead to a (very small) memory leak if you don't take care of the object -yourself. Also note that the failure method is -now responsible for exiting the application (assuming that is the desired -behavior). -

    I don't want the --help and --version switches to be created automatically...

    -Help and version information is useful for nearly all command line applications -and as such we generate flags that provide those options automatically. -However, there are situations when these flags are undesirable. For these -cases we've added we've added a forth parameter to the -CmdLine constructor. Making this boolean parameter -false will disable automatic help and version generation. -

    -		CmdLine cmd("this is a message", ' ', "0.99", false );
    -

    -

    I want to ignore certain arguments...

    -The -- flag is automatically included in the -CmdLine. -As (almost) per POSIX and GNU standards, any argument specified -after the -- flag is ignored. -Almost because if an -UnlabeledValueArg that has not been set or an -UnlabeledMultiArg has been specified, by default -we will assign any arguments beyond the -- -to the those arguments as -per the rules above. This is primarily useful if you want to pass -in arguments with a dash as the first character of the argument. It -should be noted that even if the -- flag is -passed on the command line, the CmdLine will -still test to make sure all of the required -arguments are present. -

    -Of course, this isn't how POSIX/GNU handle things, they explicitly -ignore arguments after the --. To accommodate this, -we can make both UnlabeledValueArgs and -UnlabeledMultiArgs ignoreable in their constructors. -See the API Documentation for details. -

    I want to ignore unmatched arguments...

    -By default, if TCLAP sees an argument that doesn't -match a specified Arg, it will produce an exception. -This strict handling provides some assurance that all input to a program -is controlled. However, there are times when -this strict handling of arguments might not be desirable. -TCLAP provides two alternatives. The first is to -add an UnlabeledMultiArg to the command line. If -this is done, all unmatched arguments will get added to this arg. - -The second option is that -that TCLAP can simply ignore any unmatched -arguments on the command line. This is accomplished by calling the -ignoreUnmatched method with -true on the -CmdLine object that's been constructed. - -

    -
    -    // Define the command line object.
    -	CmdLine cmd("Command description message", ' ', "0.9");
    -
    -	// Tell the command line to ignore any unmatched args.
    -	cmd.ignoreUnmatched(true);
    -
    -    // Define a value argument and add it to the command line.
    -	ValueArg<string> nameArg("n","name","Name to print",true,"homer","string");
    -	cmd.add( nameArg );
    -
    -    // Parse the args.
    -    cmd.parse( argc, argv );
    -
    -

    - -Given the program above, if a user were to type: - -

    -
    -	% command -n Mike something to ignore
    -
    -

    - -The program would succeed and the name ValueArg -would be populated with "Mike" but -the strings "something", "to", and "ignore" would simply be ignored by the -parser. -

    -NOTE: If both ignoreUnmatched -is set to true and an UnlabeledMultiArg is added to -the command line, then the UnlabeledMultiArg will -"win" and all extra arguments will be added to it rather than be ignored. -

    I want to read hex integers as arguments...

    -Sometimes it's desirable to read integers formatted in decimal, hexadecimal, -and octal format. This is now possible by #defining the TCLAP_SETBASE_ZERO -directive. Simply define this directive in your code and integer arguments will be parsed -in each base. -

    -
    -#define TCLAP_SETBASE_ZERO 1
    -
    -#include "tclap/CmdLine.h"
    -#include <iostream>
    -
    -using namespace TCLAP;
    -using namespace std;
    -
    -int main(int argc, char** argv)
    -{
    -
    -	try {
    -
    -	CmdLine cmd("this is a message", ' ', "0.99" );
    -
    -	ValueArg<int> itest("i", "intTest", "integer test", true, 5, "int");
    -	cmd.add( itest );
    -
    -	//
    -	// Parse the command line.
    -	//
    -	cmd.parse(argc,argv);
    -
    -	//
    -	// Set variables
    -	//
    -	int _intTest = itest.getValue();
    -	cout << "found int: " << _intTest << endl;
    -
    -	} catch ( ArgException& e )
    -	{ cout << "ERROR: " << e.error() << " " << e.argId() << endl; }
    -}
    -

    -

    -The reason that this behavior is not the default behavior for TCLAP is that the use of -setbase(0) appears to be something of a side effect and is not necessarily how -setbase() is meant to be used. So while we're making this functionality -available, we're not turning it on by default for fear of bad things happening in different compilers. -If you know otherwise, please let us know. -

    I want to use different types...

    -The usual C++ types (int, long, bool, etc.) are supported by TCLAP out -of the box. As -long as operator>> and operator<< are supported, other types should work fine -too, you'll just need to specify the ArgTraits which -tells TCLAP how you expect the type to be handled. -

    -For example, assume that you'd like to read one argument on the command line in as a -std::pair object. All you'll need to do is tell -TCLAP whether to treat std::pair as a -String or Value. StringLike means to treat the string on the command line as a string -and use it directly, whereas ValueLike means that a value object should be extracted from the -string using operator>>. For std::pair we'll choose ValueLike. -To accomplish this, add the following declaration to your file: - -

    -
    -  template<class T, class U>
    -  struct ArgTraits<std::pair<T, U>> {
    -    typedef ValueLike ValueCategory;
    -  };
    -
    -

    - -For complete examples see the files test11.cpp -and test12.cpp in the examples directory. -

    I want to use Windows-style flags like "/x" and "/y"...

    -It is traditional in Posix environments that the "-" and "--" strings are used to signify -the beginning of argument flags and long argument names. However, other environments, -namely Windows, use different strings. TCLAP allows you to -control which strings are used with #define directives. This allows -you to use different strings based on your operating environment. Here is an example: - -

    -//
    -// This illustrates how to change the flag and name start strings for 
    -// Windows, otherwise the defaults are used.
    -//
    -// Note that these defines need to happen *before* tclap is included!
    -//
    -#ifdef WINDOWS
    -#define TCLAP_NAMESTARTSTRING "~~"
    -#define TCLAP_FLAGSTARTSTRING "/"
    -#endif
    -
    -#include "tclap/CmdLine.h"
    -
    -using namespace TCLAP;
    -using namespace std;
    -
    -int main(int argc, char** argv)
    -{
    -	// Everything else is identical!
    -	...
    -

    - - -

    Chapter 4. Notes

    -Like all good rules, there are many exceptions.... -

    Type Descriptions

    -Ideally this library would use RTTI to return a human readable name -of the type declared for a particular argument. Unfortunately, at -least for g++, the names returned aren't -particularly useful. -

    Visitors

    -Disclaimer: Almost no one will have any use for -Visitors, they were -added to provide special handling for default arguments. Nothing -that Visitors do couldn't be accomplished -by the user after the -command line has been parsed. If you're still interested, keep -reading... -

    -Some of you may be wondering how we get the --help, ---version and -- -arguments to do their thing without mucking up the -CmdLine code with lots of if -statements and type checking. This is accomplished by using a -variation on the Visitor Pattern. Actually, it may not be a Visitor -Pattern at all, but that's what inspired me. -

    -If we want some argument to do some sort of special handling, -besides simply parsing a value, then we add a Visitor -pointer to the Arg. More specifically, we add a -subclass of the Visitor -class. Once the argument has been successfully parsed, the -Visitor for that argument is -called. Any data that needs to be operated on is declared in the -Visitor constructor and then operated on in the -visit() method. A Visitor -is added to an Arg as the last argument in its -declaration. This may sound -complicated, but it is pretty straightforward. Let's see an -example. -

    -Say you want to add an --authors flag to a program that -prints the names of the authors when present. First subclass -Visitor: - -

    -
    -#include "Visitor.h"
    -#include <string>
    -#include <iostream>
    -
    -class AuthorVisitor : public Visitor
    -{
    -        protected:
    -                string _author;
    -        public:
    -                AuthorVisitor(const string& name ) : Visitor(), _author(name) {} ;
    -                void visit() { cout << "AUTHOR:  " << _author << endl;  exit(0); };
    -};
    -
    -

    - -Now include this class definition somewhere and go about creating -your command line. When you create the author switch, add the -AuthorVisitor pointer as follows: - -

    -
    -                SwitchArg author("a","author","Prints author name", false, 
    -                                         new AuthorVisitor("Homer J. Simpson") );
    -                cmd.add( author );
    -
    -

    - -Now, any time the -a or ---author flag is specified, -the program will print the author name, Homer J. Simpson and exit -without processing any further (as specified in the -visit() method). -

    More Information

    -For more information, look at the -API Documentation and the examples included with the -distribution. -

    -Happy coding! -

    diff --git a/tclap/docs/manual.xml b/tclap/docs/manual.xml deleted file mode 100644 index f9d1caf..0000000 --- a/tclap/docs/manual.xml +++ /dev/null @@ -1,1195 +0,0 @@ - - - - - - -Templatized C++ Command Line Parser Manual - - Michael - Smoot - E - - - 2003,2004,2005,2006,2009,2011,2012 - Michael E. Smoot - - - - -Basic Usage - -Overview - -TCLAP has a few key classes to be aware of. -The first is the -CmdLine (command line) class. This class parses -the command line passed to it according to the arguments that it -contains. Arguments are separate objects that are added to the -CmdLine object one at a time. The six -argument classes are: ValueArg, -UnlabeledValueArg, -SwitchArg, MultiSwitchArg, -MultiArg and -UnlabeledMultiArg. -These classes are templatized, which means they can be defined to parse -a value of any type. Once you add the -arguments to the CmdLine object, it parses the -command line -and assigns the data it finds to the specific argument objects it -contains. Your program accesses the values parsed by -calls to the getValue() methods of the -argument objects. - - - - -Example - -Here is a simple example ... - - -#include <string> -#include <iostream> -#include <algorithm> -#include <tclap/CmdLine.h> - -int main(int argc, char** argv) -{ - - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object, and insert a message - // that describes the program. The "Command description message" - // is printed last in the help text. The second argument is the - // delimiter (usually space) and the last one is the version number. - // The CmdLine object parses the argv array based on the Arg objects - // that it contains. - TCLAP::CmdLine cmd("Command description message", ' ', "0.9"); - - // Define a value argument and add it to the command line. - // A value arg defines a flag and a type of value that it expects, - // such as "-n Bishop". - TCLAP::ValueArg<std::string> nameArg("n","name","Name to print",true,"homer","string"); - - // Add the argument nameArg to the CmdLine object. The CmdLine object - // uses this Arg to parse the command line. - cmd.add( nameArg ); - - // Define a switch and add it to the command line. - // A switch arg is a boolean argument and only defines a flag that - // indicates true or false. In this example the SwitchArg adds itself - // to the CmdLine object as part of the constructor. This eliminates - // the need to call the cmd.add() method. All args have support in - // their constructors to add themselves directly to the CmdLine object. - // It doesn't matter which idiom you choose, they accomplish the same thing. - TCLAP::SwitchArg reverseSwitch("r","reverse","Print name backwards", cmd, false); - - // Parse the argv array. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - std::string name = nameArg.getValue(); - bool reverseName = reverseSwitch.getValue(); - - // Do what you intend. - if ( reverseName ) - { - std::reverse(name.begin(),name.end()); - std::cout << "My name (spelled backwards) is: " << name << std::endl; - } - else - std::cout << "My name is: " << name << std::endl; - - - } catch (TCLAP::ArgException &e) // catch any exceptions - { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; } -} - - -The output should look like: - - - -% test1 -n mike -My name is: mike - -% test1 -n mike -r -My name (spelled backwards) is: ekim - -% test1 -r -n mike -My name (spelled backwards) is: ekim - -% test1 -r -PARSE ERROR: - One or more required arguments missing! - -Brief USAGE: - test1 [-r] -n <string> [--] [-v] [-h] - -For complete USAGE and HELP type: - test1 --help - - -% test1 --help - -USAGE: - - test1 [-r] -n <string> [--] [-v] [-h] - - -Where: - - -r, --reverse - Print name backwards - - -n <string> --name <string> - (required) (value required) Name to print - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - -v, --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - Command description message - - - - - -Library Properties - -This example shows a number of different properties of the -library... - -Arguments can appear in any order (...mostly, - more on this later). - -The help, version -and -- SwitchArgs -are specified automatically. Using either the -h or ---help flag will cause the USAGE message to be displayed, --v or --version will cause -any version information to -be displayed, and -- or ---ignore_rest will cause the -remaining labeled arguments to be ignored. These switches are -included by default on every command line. You can disable this functionality if desired (although we don't recommend it). -How we generate the behavior behind these flags is described - later. - - -If there is an error parsing the command line (e.g. a required -argument isn't provided), the program exits and displays a brief -USAGE and an error message. - -The program name is assumed to always be argv[0], so it isn't -specified directly. - -A value delimiter character can be specified. This means that if you -prefer arguments of the style -s=asdf instead of --s asdf, you can do so. - -Always wrap everything in a try block that catches -ArgExceptions! Any problems found in constructing the -CmdLine, constructing the Args, -or parsing the command line will throw an -ArgException. - - - - - - -Common Argument Properties - -Arguments, whatever their type, have a few common properties. -These properties are set in the constructors of the arguments. - -First is the flag or the character preceded by a dash(-) that -signals the beginning of the argument on the command line. - -Arguments also have names, which can also be used -as an alternative flag on the command line, this time preceded by two dashes -(--) [like the familiar getopt_long()]. - -Next is the description of the argument. This is a short -description of the argument displayed in the help/usage message -when needed. - -The following parameters in the constructors vary depending on -the type of argument. Some possible values include: - -A boolean value indicating whether the Arg is required or not. -A default value. -A description of the type of value expected. -A constraint on the value expected. -The CmdLine instance that the Arg should be added to. -A Visitor. - - -See the API Documentation for more detail. - - - - - - -Compiling - -TCLAP is implemented entirely in header files -which means you only need to include CmdLine.h to use the library. - - #include <tclap/CmdLine.h> - -You'll need to make sure that your compiler can see the header -files. If you do the usual "make install" then your compiler should -see the files by default. Alternatively, you can use the -I -complier argument to specify the exact location of the libraries. - - c++ -o my_program -I /some/place/tclap-1.X/include my_program.cpp - -Where /some/place/tclap-1.X is the place you have unpacked the -distribution. - - - -Finally, if you want to include TCLAP as part of -your software -(which is perfectly OK, even encouraged) then simply copy the -contents of /some/place/tclap-1.X/include (the tclap directory and -all of the header files it contains) into your include -directory. The necessary m4 macros for proper configuration are included -in the config directory. - - - -TCLAP was developed on Linux and MacOSX systems. -It is also known -to work on Windows, Sun and Alpha platforms. We've made every -effort to keep the library compliant with the ANSI C++ standard so -if your compiler meets the standard, then this library should work -for you. Please let us know if this is not the case! - -Windows Note - -As we understand things, Visual C++ does not have the file -config.h which is used to make platform -specific definitions. In this situation, we assume that you -have access to sstream. Our understanding is that -this should not be a problem for VC++ 7.x. However, if this -is not the case and you need to use strstream, -then simply tell your compiler to define the variable -HAVE_STRSTREAM and undefine -HAVE_SSTREAM That -should work. We think. Alternatively, just edit -the files ValueArg.h and MultiArg.h. - - - -Random Note - -If your compiler doesn't support the using syntax used -in UnlabeledValueArg and -UnlabeledMultiArg to support two stage name lookup, -then you have two options. Either comment out the statements if you don't -need two stage name lookup, or do a bunch of search and replace and use -the this pointer syntax: e.g. -this->_ignoreable instead -of just _ignorable (do this for each variable -or method referenced by using). - - - - - - -Fundamental Classes - -<classname>CmdLine</classname> - -The CmdLine class contains the arguments that define -the command line and manages the parsing of the command line. The -CmdLine doesn't parse the command line itself it only -manages the parsing. The actual parsing of individual arguments occurs within -the arguments themselves. The CmdLine keeps track of -of the required arguments, relationships -between arguments, and output generation. - - - -<classname>SwitchArg</classname> -SwitchArgs are what the name implies: -simple, on/off, boolean switches. Use SwitchArgs -anytime you want to turn -some sort of system property on or off. SwitchArgs -don't parse a value. They return TRUE or -FALSE, depending on whether the switch has been found -on the command line and what the default value was defined as. - - - -<classname>ValueArg</classname> -ValueArgs are arguments that read a -value of some type -from the command line. Any time you need a file name, a number, -etc. use a ValueArg or one of its variants. -All ValueArgs are - templatized and will attempt to parse -the string its flag matches on the command line as the type it is -specified as. ValueArg<int> -will attempt to parse an -int, ValueArg<float> will attempt to -parse a float, etc. If operator>> -for the specified type doesn't -recognize the string on the command line as its defined type, then -an exception will be thrown. - - - - -<classname>MultiArg</classname> - -A MultiArg is a ValueArg that -can be specified more than once on a command line and instead of returning -a single value, returns a vector of values. - - -Imagine a compiler that allows you to specify multiple directories -to search for libraries... - - - - % fooCompiler -L /dir/num1 -L /dir/num2 file.foo - - -Exceptions will occur if you try to do this -with a ValueArg or a SwitchArg. -In situations like this, you will want to use a -MultiArg. A -MultiArg is essentially a -ValueArg that appends any -value that it matches and parses onto a vector of values. When the -getValue() method is called, a vector of -values, instead of a single value is returned. A -MultiArg is declared much like -a ValueArg: - - - - MultiArg<int> itest("i", "intTest", "multi int test", false,"int" ); - cmd.add( itest ); - -Note that MultiArgs can be added to the -CmdLine in any order (unlike - UnlabeledMultiArg). - - - - -<classname>MultiSwitchArg</classname> - -A MultiSwitchArg is a SwitchArg -that can be specified more than once on a command line. -This can be useful -when command lines are constructed automatically from within other applications -or when a switch occurring -more than once indicates a value (-V means a little verbose -V -V -V means a lot -verbose), You can use a MultiSwitchArg. -The call -to getValue() for a MultiSwitchArg returns the number (int) of times -the switch has been found on the command line in addition to the default value. -Here is an example using the default initial value of 0: - - MultiSwitchArg quiet("q","quiet","Reduce the volume of output"); - cmd.add( quiet ); - -Alternatively, you can specify your own initial value: - - MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5); - cmd.add( quiet ); - - - - - -<classname>UnlabeledValueArg</classname> - -An UnlabeledValueArg is a ValueArg that is not identified by a flag on the command line. Instead -UnlabeledValueArgs are identified by their position in -the argv array. - - -To this point all of our arguments have had labels (flags) -identifying them on the command line, but there are some -situations where flags are burdensome and not worth the effort. One -example might be if you want to implement a magical command we'll -call copy. All copy does is -copy the file specified -in the first argument to the file specified in the second argument. -We can do this using UnlabeledValueArgs which are pretty -much just ValueArgs without the flag specified, -which tells -the CmdLine object to treat them accordingly. -The code would look like this: - - - - UnlabeledValueArg<float> nolabel( "name", "unlabeled test", true, 3.14, - "nameString" ); - cmd.add( nolabel ); - - - -Everything else is handled identically to what is seen above. The -only difference to be aware of, and this is important: the order -that UnlabeledValueArgs are added to the CmdLine -is the order that they will be parsed!!!! -This is not the case for normal -SwitchArgs and ValueArgs. -What happens internally is the first argument that the -CmdLine doesn't recognize is assumed to be -the first UnlabeledValueArg and -parses it as such. Note that you are allowed to intersperse labeled -args (SwitchArgs and ValueArgs) in between -UnlabeledValueArgs (either on the command line -or in the declaration), but the UnlabeledValueArgs -will still be parsed in the order they are added. Just remember that order is -important for unlabeled arguments. - - - - -<classname>UnlabeledMultiArg</classname> - -An UnlabeledMultiArg is an UnlabeledValueArg that allows more than one value to be specified. Only one -UnlabeledMultiArg can be specified per command line. -The UnlabeledMultiArg simply reads the remaining -values from argv up until -- or the end of the array is reached. - - -Say you want a strange command -that searches each file specified for a given string (let's call it -grep), but you don't want to have to type in all of the file -names or write a script to do it for you. Say, - - - % grep pattern *.txt - - -First remember that the * is handled by the shell and -expanded accordingly, so what the program grep sees is -really something like: - - - % grep pattern file1.txt file2.txt fileZ.txt - - -To handle situations where multiple, unlabeled arguments are needed, -we provide the UnlabeledMultiArg. -UnlabeledMultiArgs -are declared much like everything else, but with only a description -of the arguments. By default, if an UnlabeledMultiArg -is specified, then at least one is required to be present or an -exception will be thrown. The most important thing to remember is, -that like UnlabeledValueArgs: order matters! -In fact, an UnlabeledMultiArg must be the last argument added to the -CmdLine!. Here is what a declaration looks like: - - - - // - // UnlabeledMultiArg must be the LAST argument added! - // - UnlabeledMultiArg<string> multi("file names"); - cmd.add( multi ); - cmd.parse(argc, argv); - - vector<string> fileNames = multi.getValue(); - - - -You must only ever specify one (1) UnlabeledMultiArg. -One UnlabeledMultiArg will read every unlabeled -Arg that wasn't already processed by a -UnlabeledValueArg into a -vector of type T. Any -UnlabeledValueArg or other -UnlabeledMultiArg specified after the first -UnlabeledMultiArg will be ignored, and if -they are required, -exceptions will be thrown. When you call the -getValue() -method of the UnlabeledValueArg argument, -a vector -will be returned. If you can imagine a situation where there will -be multiple args of multiple types (stings, ints, floats, etc.) -then just declare the UnlabeledMultiArg as type -string and parse the different values yourself or use -several UnlabeledValueArgs. - - - - - -Complications - -Naturally, what we have seen to this point doesn't satisfy all of -our needs. - - - -I want to combine multiple switches into one argument... - -Multiple SwitchArgs can be combined into a -single argument on the command line. If you have switches -a, -b and -c -it is valid to do either: - - - % command -a -b -c - - -or - - - % command -abc - - -or - - - % command -ba -c - - -This is to make this library more in line with the POSIX and GNU -standards (as I understand them). - - - - -I want one argument or the other, but not both... - -Suppose you have a command that must read input from one of two -possible locations, either a local file or a URL. The command -must read something, so one -argument is required, but -not both, yet neither argument is strictly necessary by itself. -This is called "exclusive or" or "XOR". To accommodate this -situation, there is now an option to add two or more -Args to -a CmdLine that are exclusively or'd with one another: -xorAdd(). This means that exactly one of the -Args must be set and no more. - - - -xorAdd() comes in two flavors, either -xorAdd(Arg& a, Arg& b) -to add just two Args to be xor'd and -xorAdd( vector<Arg*> xorList ) -to add more than two Args. - - - - - ValueArg<string> fileArg("f","file","File name to read",true,"/dev/null", "filename"); - ValueArg<string> urlArg("u","url","URL to load",true, "http://example.com", "URL"); - - cmd.xorAdd( fileArg, urlArg ); - cmd.parse(argc, argv); - - - -Once one Arg in the xor list is matched on the -CmdLine then the others in the xor list will be -marked as set. The question then, is how to determine which of the -Args has been set? This is accomplished by calling the -isSet() method for each Arg. If the -Arg has been -matched on the command line, the isSet() will return -TRUE, whereas if the Arg -has been set as a result of matching the other Arg -that was xor'd isSet() will -return FALSE. -(Of course, if the Arg was not xor'd and -wasn't matched, it will also return FALSE.) - - - - if ( fileArg.isSet() ) - readFile( fileArg.getValue() ); - else if ( urlArg.isSet() ) - readURL( urlArg.getValue() ); - else - // Should never get here because TCLAP will note that one of the - // required args above has not been set. - throw("Very bad things..."); - - - -It is helpful to note that Args of any type can be xor'd together. -This means that you can xor a SwitchArg with a ValueArg. -This is helpful in situations where one of several options is necessary and one of the options -requires additional information. - - - - SwitchArg stdinArg("s", "stdin", "Read from STDIN", false); - ValueArg<string> fileArg("f","file","File name to read",true,"/dev/null", "filename"); - ValueArg<string> urlArg("u","url","URL to load",true, "http://example.com", "URL"); - - vector<Arg*> xorlist; - xorlist.push_back(&stdinArg); - xorlist.push_back(&fileArg); - xorlist.push_back(&urlArg); - - cmd.xorAdd( xorlist ); - - - - - - - - - -I have more arguments than single flags make sense for... - -Some commands have so many options that single flags no longer map -sensibly to the available options. In this case, it is desirable to -specify Args using only long options. This one is easy to -accomplish, just make the flag value blank in the Arg -constructor. This will tell the Arg that only the long -option should be matched and will force users to specify the long -option on the command line. The help output is updated accordingly. - - - - ValueArg<string> fileArg("","file","File name",true,"homer","filename"); - - SwitchArg caseSwitch("","upperCase","Print in upper case",false); - - - - - - - -I want to constrain the values allowed for a particular -argument... - -Interface Change!!! Sorry folks, but we've changed -the interface since version 1.0.X for constraining Args. -Constraints are now hidden behind the Constraint -interface. To -constrain an Arg simply implement the interface -and specify the new class in the constructor as before. - - - -You can still constrain Args based on -a list of values. Instead of adding a vector of -allowed values to the Arg directly, -create a ValuesConstraint object -with a vector of values and add that to the -Arg. The Arg constructors -have been modified accordingly. - - - -When the value for the -Arg is parsed, -it is checked against the list of values specified in the -ValuesConstraint. -If the value is in the list then it is accepted. If -not, then an exception is thrown. Here is a simple example: - - - vector<string> allowed; - allowed.push_back("homer"); - allowed.push_back("marge"); - allowed.push_back("bart"); - allowed.push_back("lisa"); - allowed.push_back("maggie"); - ValuesConstraint<string> allowedVals( allowed ); - - ValueArg<string> nameArg("n","name","Name to print",true,"homer",&allowedVals); - cmd.add( nameArg ); - - -When a ValuesConstraint is specified, -instead of a type description being specified in the -Arg, a -type description is created by concatenating the values in the -allowed list using operator<< for the specified type. The -help/usage for the Arg therefore lists the -allowable values. Because of this, you might want to keep the list -relatively small, however there is no limit on this. - - - -Obviously, a list of allowed values isn't always the best way to -constrain things. For instance, one might wish to allow only -integers greater than 0. In this case, simply create a class that -implements the Constraint<int> interface and -checks whether the value parsed is greater than 0 (done in the -check() method) and create your -Arg with your new Constraint. - - - - - -I want the Args to add themselves to the CmdLine... - -New constructors have been added for each Arg -that take a CmdLine object as an argument. -Each Arg then -adds itself to the CmdLine -object. There is no difference in how the Arg -is handled between this method and calling the -add() method directly. At the moment, there is -no way to do an xorAdd() from the constructor. Here -is an example: - - - - // Create the command line. - CmdLine cmd("this is a message", '=', "0.99" ); - - // Note that the following args take the "cmd" object as arguments. - SwitchArg btest("B","existTestB", "exist Test B", cmd, false ); - - ValueArg<string> stest("s", "stringTest", "string test", true, "homer", - "string", cmd ); - - UnlabeledValueArg<string> utest("unTest1","unlabeled test one", - "default","string", cmd ); - - // NO add() calls! - - // Parse the command line. - cmd.parse(argc,argv); - - - - - - -I want different output than what is provided... - -It is straightforward to change the output generated by -TCLAP. Either subclass the -StdOutput class and re-implement the methods you choose, -or write your own class that implements the -CmdLineOutput interface. Once you have done this, -then use the CmdLine setOutput -method to tell the CmdLine to use your new output -class. Here is a simple example: - -class MyOutput : public StdOutput -{ - public: - virtual void failure(CmdLineInterface& c, ArgException& e) - { - cerr << "My special failure message for: " << endl - << e.what() << endl; - exit(1); - } - - virtual void usage(CmdLineInterface& c) - { - cout << "my usage message:" << endl; - list<Arg*> args = c.getArgList(); - for (ArgListIterator it = args.begin(); it != args.end(); it++) - cout << (*it)->longID() - << " (" << (*it)->getDescription() << ")" << endl; - } - - virtual void version(CmdLineInterface& c) - { - cout << "my version message: 0.1" << endl; - } -}; - -int main(int argc, char** argv) -{ - CmdLine cmd("this is a message", ' ', "0.99" ); - - // set the output - MyOutput my; - cmd.setOutput( &my ); - - // proceed normally ... - - -See test4.cpp in the examples directory for the full -example. NOTE: if you supply your own Output object, we -will not delete it in the CmdLine destructor. This -could lead to a (very small) memory leak if you don't take care of the object -yourself. Also note that the failure method is -now responsible for exiting the application (assuming that is the desired -behavior). - - - - -I don't want the --help and --version switches to be created automatically... - -Help and version information is useful for nearly all command line applications -and as such we generate flags that provide those options automatically. -However, there are situations when these flags are undesirable. For these -cases we've added we've added a forth parameter to the -CmdLine constructor. Making this boolean parameter -false will disable automatic help and version generation. - - CmdLine cmd("this is a message", ' ', "0.99", false ); - - - - - -I want to ignore certain arguments... - -The -- flag is automatically included in the -CmdLine. -As (almost) per POSIX and GNU standards, any argument specified -after the -- flag is ignored. -Almost because if an -UnlabeledValueArg that has not been set or an -UnlabeledMultiArg has been specified, by default -we will assign any arguments beyond the -- -to the those arguments as -per the rules above. This is primarily useful if you want to pass -in arguments with a dash as the first character of the argument. It -should be noted that even if the -- flag is -passed on the command line, the CmdLine will -still test to make sure all of the required -arguments are present. - - - -Of course, this isn't how POSIX/GNU handle things, they explicitly -ignore arguments after the --. To accommodate this, -we can make both UnlabeledValueArgs and -UnlabeledMultiArgs ignoreable in their constructors. -See the API Documentation for details. - - - - -I want to ignore unmatched arguments... - -By default, if TCLAP sees an argument that doesn't -match a specified Arg, it will produce an exception. -This strict handling provides some assurance that all input to a program -is controlled. However, there are times when -this strict handling of arguments might not be desirable. -TCLAP provides two alternatives. The first is to -add an UnlabeledMultiArg to the command line. If -this is done, all unmatched arguments will get added to this arg. - -The second option is that -that TCLAP can simply ignore any unmatched -arguments on the command line. This is accomplished by calling the -ignoreUnmatched method with -true on the -CmdLine object that's been constructed. - - - - // Define the command line object. - CmdLine cmd("Command description message", ' ', "0.9"); - - // Tell the command line to ignore any unmatched args. - cmd.ignoreUnmatched(true); - - // Define a value argument and add it to the command line. - ValueArg<string> nameArg("n","name","Name to print",true,"homer","string"); - cmd.add( nameArg ); - - // Parse the args. - cmd.parse( argc, argv ); - - - -Given the program above, if a user were to type: - - - - % command -n Mike something to ignore - - - -The program would succeed and the name ValueArg -would be populated with "Mike" but -the strings "something", "to", and "ignore" would simply be ignored by the -parser. - - -NOTE: If both ignoreUnmatched -is set to true and an UnlabeledMultiArg is added to -the command line, then the UnlabeledMultiArg will -"win" and all extra arguments will be added to it rather than be ignored. - - - - -I want to read hex integers as arguments... - -Sometimes it's desirable to read integers formatted in decimal, hexadecimal, -and octal format. This is now possible by #defining the TCLAP_SETBASE_ZERO -directive. Simply define this directive in your code and integer arguments will be parsed -in each base. - - -#define TCLAP_SETBASE_ZERO 1 - -#include "tclap/CmdLine.h" -#include <iostream> - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - - try { - - CmdLine cmd("this is a message", ' ', "0.99" ); - - ValueArg<int> itest("i", "intTest", "integer test", true, 5, "int"); - cmd.add( itest ); - - // - // Parse the command line. - // - cmd.parse(argc,argv); - - // - // Set variables - // - int _intTest = itest.getValue(); - cout << "found int: " << _intTest << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - -The reason that this behavior is not the default behavior for TCLAP is that the use of -setbase(0) appears to be something of a side effect and is not necessarily how -setbase() is meant to be used. So while we're making this functionality -available, we're not turning it on by default for fear of bad things happening in different compilers. -If you know otherwise, please let us know. - - - - -I want to use different types... - -The usual C++ types (int, long, bool, etc.) are supported by TCLAP out -of the box. As -long as operator>> and operator<< are supported, other types should work fine -too, you'll just need to specify the ArgTraits which -tells TCLAP how you expect the type to be handled. - - -For example, assume that you'd like to read one argument on the command line in as a -std::pair object. All you'll need to do is tell -TCLAP whether to treat std::pair as a -String or Value. StringLike means to treat the string on the command line as a string -and use it directly, whereas ValueLike means that a value object should be extracted from the -string using operator>>. For std::pair we'll choose ValueLike. -To accomplish this, add the following declaration to your file: - - - - template<class T, class U> - struct ArgTraits<std::pair<T, U>> { - typedef ValueLike ValueCategory; - }; - - - -For complete examples see the files test11.cpp -and test12.cpp in the examples directory. - - - - -I want to use Windows-style flags like "/x" and "/y"... - -It is traditional in Posix environments that the "-" and "--" strings are used to signify -the beginning of argument flags and long argument names. However, other environments, -namely Windows, use different strings. TCLAP allows you to -control which strings are used with #define directives. This allows -you to use different strings based on your operating environment. Here is an example: - - -// -// This illustrates how to change the flag and name start strings for -// Windows, otherwise the defaults are used. -// -// Note that these defines need to happen *before* tclap is included! -// -#ifdef WINDOWS -#define TCLAP_NAMESTARTSTRING "~~" -#define TCLAP_FLAGSTARTSTRING "/" -#endif - -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Everything else is identical! - ... - - - - - - - - - -Notes - -Like all good rules, there are many exceptions.... - - - -Type Descriptions - -Ideally this library would use RTTI to return a human readable name -of the type declared for a particular argument. Unfortunately, at -least for g++, the names returned aren't -particularly useful. - - - -Visitors - - -Disclaimer: Almost no one will have any use for -Visitors, they were -added to provide special handling for default arguments. Nothing -that Visitors do couldn't be accomplished -by the user after the -command line has been parsed. If you're still interested, keep -reading... - - - -Some of you may be wondering how we get the --help, ---version and -- -arguments to do their thing without mucking up the -CmdLine code with lots of if -statements and type checking. This is accomplished by using a -variation on the Visitor Pattern. Actually, it may not be a Visitor -Pattern at all, but that's what inspired me. - - - -If we want some argument to do some sort of special handling, -besides simply parsing a value, then we add a Visitor -pointer to the Arg. More specifically, we add a -subclass of the Visitor -class. Once the argument has been successfully parsed, the -Visitor for that argument is -called. Any data that needs to be operated on is declared in the -Visitor constructor and then operated on in the -visit() method. A Visitor -is added to an Arg as the last argument in its -declaration. This may sound -complicated, but it is pretty straightforward. Let's see an -example. - - - -Say you want to add an --authors flag to a program that -prints the names of the authors when present. First subclass -Visitor: - - - -#include "Visitor.h" -#include <string> -#include <iostream> - -class AuthorVisitor : public Visitor -{ - protected: - string _author; - public: - AuthorVisitor(const string& name ) : Visitor(), _author(name) {} ; - void visit() { cout << "AUTHOR: " << _author << endl; exit(0); }; -}; - - - -Now include this class definition somewhere and go about creating -your command line. When you create the author switch, add the -AuthorVisitor pointer as follows: - - - - SwitchArg author("a","author","Prints author name", false, - new AuthorVisitor("Homer J. Simpson") ); - cmd.add( author ); - - - -Now, any time the -a or ---author flag is specified, -the program will print the author name, Homer J. Simpson and exit -without processing any further (as specified in the -visit() method). - - - - -More Information - -For more information, look at the -API Documentation and the examples included with the -distribution. - - - -Happy coding! - - - - - diff --git a/tclap/docs/style.css b/tclap/docs/style.css deleted file mode 100755 index 91bbabb..0000000 --- a/tclap/docs/style.css +++ /dev/null @@ -1,117 +0,0 @@ -/* -color:#ffffff; white -color:#e0e0e0; light gray -color:#f8f8f8; light gray -color:#003366; dark blue -color:#555555; gray -color:#ff9933; light orange -color:#cc3300; red/brown/orange -color:#660066; purple -color:#669900; green -*/ - -a { - color:#003366; - text-decoration:underline; -} - -a:hover { - color:#ff9933; -} - -body { - font-family: verdana, tahoma, helvetica, arial, sans-serif; - font-size: 90%; - background-color:#ffffff; - margin: 1em; -} - -pre { - font-family: courier, serif; - background-color:#f8f8f8; - margin: 1.5em; - font-size:90%; -} - -ul { - list-style: circle outside; - font-stretch:extra-expanded; -/* font-size:90%;*/ -} - -ul.menu { /* inherits from ul */ - padding-left: 1em; -} - - -em { - color:#ff9933; - font-size:110%; -} - -h1,h2,h3{ - color:#ff9933; -} - -h1 { - border-color:#d0d0d0; - border-style:solid; - border-width:1px; - font-weight:bold; - padding: 0.2em; - background-color:#f8f8f8 -} - -h2 { - font-size:120%; - font-weight:bold; - border-bottom-style:solid; - border-bottom-width:1px; - border-bottom-color:#d0d0d0; -} - -h3 { - font-size:110%; - font-weight:bold; - font-style:italic; -} - -tt { - font-family: courier, serif; -} - -tt.classname { - font-weight:bold; -} - -tt.constant { - font-weight:bold; -} - - -p { - line-height: 1.5em; -} - - -div.links{ - float: left; - clear: left; - width: 12em; - background-color:#f8f8f8; - border-style:solid; - border-width:1px; - border-color:#d0d0d0; - margin-bottom: 0.5em; - padding: 0.5em 0.5em 0.5em 0.5em; - margin: 0.5em 0.5em 0em 0em; -} - -div.main{ - border-style:solid; - border-width:1px; - border-color:#d0d0d0; - margin: 0.5em 0em 0.5em 14em; - padding: 0.5em 0.5em 0.5em 0.5em; -} - diff --git a/tclap/docs/upload.sh b/tclap/docs/upload.sh deleted file mode 100755 index 7dfeb3a..0000000 --- a/tclap/docs/upload.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rsync -aP html index.html manual.html style.css \ - $USER@web.sourceforge.net:/home/project-web/tclap/htdocs diff --git a/tclap/examples/Makefile.am b/tclap/examples/Makefile.am deleted file mode 100644 index 8c06efb..0000000 --- a/tclap/examples/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ - -noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \ - test10 test11 test12 test13 test14 test15 test16 \ - test17 test18 test19 test20 test21 test22 test23 test24 \ - test25 test26 test27 test28 - -test1_SOURCES = test1.cpp -test2_SOURCES = test2.cpp -test3_SOURCES = test3.cpp -test4_SOURCES = test4.cpp -test5_SOURCES = test5.cpp -test6_SOURCES = test6.cpp -test7_SOURCES = test7.cpp -test8_SOURCES = test8.cpp -test9_SOURCES = test9.cpp -test10_SOURCES = test10.cpp -test11_SOURCES = test11.cpp -test12_SOURCES = test12.cpp -test13_SOURCES = test13.cpp -test14_SOURCES = test14.cpp -test15_SOURCES = test15.cpp -test16_SOURCES = test16.cpp -test17_SOURCES = test-hard-1.cpp test-hard-2.cpp -test18_SOURCES = test18.cpp -test19_SOURCES = test19.cpp -test20_SOURCES = test20.cpp -test21_SOURCES = test21.cpp -test22_SOURCES = test22.cpp -test23_SOURCES = test23.cpp -test24_SOURCES = test24.cpp -test25_SOURCES = test25.cpp -test26_SOURCES = test26.cpp -test27_SOURCES = test27.cpp -test28_SOURCES = test28.cpp - -AM_CPPFLAGS = -I$(top_srcdir)/include - -if HAVE_GNU_COMPILERS - AM_CXXFLAGS = -Wall -Wextra -endif diff --git a/tclap/examples/test1.cpp b/tclap/examples/test1.cpp deleted file mode 100644 index 81e873b..0000000 --- a/tclap/examples/test1.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message", ' ', "0.9"); - - // Define a value argument and add it to the command line. - ValueArg nameArg("n","name","Name to print",true,"homer","string"); - cmd.add( nameArg ); - - // Define a switch and add it to the command line. - SwitchArg reverseSwitch("r","reverse","Print name backwards", false); - cmd.add( reverseSwitch ); - - // Parse the args. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - string name = nameArg.getValue(); - bool reverseName = reverseSwitch.getValue(); - - // Do what you intend too... - if ( reverseName ) - { - reverse(name.begin(),name.end()); - cout << "My name (spelled backwards) is: " << name << endl; - } - else - cout << "My name is: " << name << endl; - - - } catch (ArgException &e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/examples/test10.cpp b/tclap/examples/test10.cpp deleted file mode 100644 index 0d18a76..0000000 --- a/tclap/examples/test10.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -// Test only makes sure we can use different argv types for the -// parser. Don't run, just compile. - -#include "tclap/CmdLine.h" - -using namespace TCLAP; -int main() -{ - char *argv5[] = {(char*)"Foo", 0}; - const char *argv6[] = {"Foo", 0}; - const char * const argv7[] = {"Foo", 0}; - char **argv1 = argv5; - const char **argv2 = argv6; - const char * const * argv3 = argv7; - const char * const * const argv4 = argv7; - - CmdLine cmd("Command description message", ' ', "0.9"); - cmd.parse(0, argv1); - cmd.parse(0, argv2); - cmd.parse(0, argv3); - cmd.parse(0, argv4); - cmd.parse(0, argv5); - cmd.parse(0, argv6); - cmd.parse(0, argv7); -} - diff --git a/tclap/examples/test11.cpp b/tclap/examples/test11.cpp deleted file mode 100644 index e20d87a..0000000 --- a/tclap/examples/test11.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include - -#include - -using namespace TCLAP; - -// Define a simple 3D vector type -struct Vect3D { - double v[3]; - - // operator= will be used to assign to the vector - Vect3D& operator=(const std::string &str) - { - std::istringstream iss(str); - if (!(iss >> v[0] >> v[1] >> v[2])) - throw TCLAP::ArgParseException(str + " is not a 3D vector"); - - return *this; - } - - std::ostream& print(std::ostream &os) const - { - std::copy(v, v + 3, std::ostream_iterator(os, " ")); - return os; - } -}; - -// Create an ArgTraits for the 3D vector type that declares it to be -// of string like type -namespace TCLAP { -template<> -struct ArgTraits { - typedef StringLike ValueCategory; -}; -} - -int main(int argc, char *argv[]) -{ - CmdLine cmd("Command description message", ' ', "0.9"); - ValueArg vec("v", "vect", "vector", - true, Vect3D(), "3D vector", cmd); - - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - vec.getValue().print(std::cout); - std::cout << std::endl; -} - diff --git a/tclap/examples/test12.cpp b/tclap/examples/test12.cpp deleted file mode 100644 index dd51b47..0000000 --- a/tclap/examples/test12.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -#include - -using namespace TCLAP; - -// Define a simple 3D vector type -struct Vect3D { - double v[3]; - - // operator= will be used to assign to the vector - Vect3D& operator=(const std::string &str) - { - std::istringstream iss(str); - if (!(iss >> v[0] >> v[1] >> v[2])) - throw TCLAP::ArgParseException(str + " is not a 3D vector"); - - return *this; - } - - std::ostream& print(std::ostream &os) const - { - std::copy(v, v + 3, std::ostream_iterator(os, " ")); - return os; - } - -}; - -std::ostream& operator<<(std::ostream &os, const Vect3D &v) -{ - return v.print(os); -} - -// Create an ArgTraits for the 3D vector type that declares it to be -// of string like type -namespace TCLAP { -template<> -struct ArgTraits { - typedef StringLike ValueCategory; -}; -} - -int main(int argc, char *argv[]) -{ - CmdLine cmd("Command description message", ' ', "0.9"); - MultiArg vec("v", "vect", "vector", - true, "3D vector", cmd); - - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - std::copy(vec.begin(), vec.end(), - std::ostream_iterator(std::cout, "\n")); - - std::cout << "REVERSED" << std::endl; - - // use alt. form getValue() - std::vector v(vec.getValue()); - std::reverse(v.begin(), v.end()); - - std::copy(v.begin(), v.end(), - std::ostream_iterator(std::cout, "\n")); -} - diff --git a/tclap/examples/test13.cpp b/tclap/examples/test13.cpp deleted file mode 100644 index bcb64d5..0000000 --- a/tclap/examples/test13.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include - -#include - -using namespace TCLAP; - -// -// This file tests that we can parse args from a vector -// of strings rather than argv. This also tests a bug -// where a single element in the vector contains both -// the flag and value AND the value contains the flag -// from another switch arg. This would fool the parser -// into thinking that the string was a combined switches -// string rather than a flag value combo. -// -// This should not print an error -// -// Contributed by Nico Lugil. -// -int main() -{ - - try - { - CmdLine cmd("Test", ' ', "not versioned",true); - - MultiArg Arg("X","fli","fli module",false,"string"); - cmd.add(Arg); - MultiSwitchArg ArgMultiSwitch("d","long_d","example"); - cmd.add(ArgMultiSwitch); - - std::vector in; - in.push_back("prog name"); - in.push_back("-X module"); - cmd.parse(in); - - std::vector s = Arg.getValue(); - for(unsigned int i = 0 ; i < s.size() ; i++) - { - std::cout << s[i] << "\n"; - } - std::cout << "MultiSwtichArg was found " << ArgMultiSwitch.getValue() << " times.\n"; - - } - catch (ArgException &e) // catch any exceptions - { - std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; - } - - std::cout << "done...\n"; - - return 0; -} - - - diff --git a/tclap/examples/test14.cpp b/tclap/examples/test14.cpp deleted file mode 100644 index 9d640c7..0000000 --- a/tclap/examples/test14.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -#include - -// Define a simple 3D vector type -template -struct Vect : public TCLAP::StringLikeTrait { - //typedef TCLAP::StringLike ValueCategory; - T v[LEN]; - - // operator= will be used to assign to the vector - Vect& operator=(const std::string &str) - { - std::istringstream iss(str); - for (size_t n = 0; n < LEN; n++) { - if (!(iss >> v[n])) { - std::ostringstream oss; - oss << " is not a vector of size " << LEN; - throw TCLAP::ArgParseException(str + oss.str()); - } - } - - if (!iss.eof()) { - std::ostringstream oss; - oss << " is not a vector of size " << LEN; - throw TCLAP::ArgParseException(str + oss.str()); - } - - return *this; - } - - std::ostream& print(std::ostream &os) const - { - std::copy(v, v + LEN, std::ostream_iterator(os, ", ")); - return os; - } - -}; - -int main(int argc, char *argv[]) -{ - TCLAP::CmdLine cmd("Command description message", ' ', "0.9"); - TCLAP::ValueArg< Vect > vec("v", "vect", "vector", - true, Vect(), - "3D vector", cmd); - - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - vec.getValue().print(std::cout); - std::cout << std::endl; -} diff --git a/tclap/examples/test15.cpp b/tclap/examples/test15.cpp deleted file mode 100644 index d681f00..0000000 --- a/tclap/examples/test15.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -#include - -// Define a simple 3D vector type -template -struct Vect { - typedef TCLAP::StringLike ValueCategory; - T v[LEN]; - - // operator= will be used to assign to the vector - Vect& operator=(const std::string &str) - { - std::istringstream iss(str); - for (size_t n = 0; n < LEN; n++) { - if (!(iss >> v[n])) { - std::ostringstream oss; - oss << " is not a vector of size " << LEN; - throw TCLAP::ArgParseException(str + oss.str()); - } - } - - if (!iss.eof()) { - std::ostringstream oss; - oss << " is not a vector of size " << LEN; - throw TCLAP::ArgParseException(str + oss.str()); - } - - return *this; - } - - std::ostream& print(std::ostream &os) const - { - std::copy(v, v + LEN, std::ostream_iterator(os, " ")); - return os; - } - -}; - -int main(int argc, char *argv[]) -{ - TCLAP::CmdLine cmd("Command description message", ' ', "0.9"); - TCLAP::ValueArg< Vect > vec("v", "vect", "vector", - true, Vect(), - "3D vector", cmd); - - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - vec.getValue().print(std::cout); - std::cout << std::endl; -} diff --git a/tclap/examples/test16.cpp b/tclap/examples/test16.cpp deleted file mode 100644 index a3a3b77..0000000 --- a/tclap/examples/test16.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -#include - -namespace TCLAP { - template<> - struct ArgTraits< std::vector > { - typedef StringLike ValueCategory; - }; - - template<> - void SetString< std::vector >(std::vector &v, - const std::string &s) - { - std::istringstream iss(s); - while (iss) { - double tmp; - iss >> tmp; - v.push_back(tmp); - } - } -} - -int main(int argc, char *argv[]) -{ - TCLAP::CmdLine cmd("Command description message", ' ', "0.9"); - TCLAP::ValueArg< std::vector > vec("v", "vect", "vector", - true, std::vector(), - "3D vector", cmd); - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - const std::vector &v = vec.getValue(); - std::copy(v.begin(), v.end(), - std::ostream_iterator(std::cout, "\n")); - std::cout << std::endl; -} diff --git a/tclap/examples/test17-a.cpp b/tclap/examples/test17-a.cpp deleted file mode 100644 index 9d3279f..0000000 --- a/tclap/examples/test17-a.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include diff --git a/tclap/examples/test17.cpp b/tclap/examples/test17.cpp deleted file mode 100644 index 2eff281..0000000 --- a/tclap/examples/test17.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include - -int main() { } diff --git a/tclap/examples/test18.cpp b/tclap/examples/test18.cpp deleted file mode 100644 index fad25de..0000000 --- a/tclap/examples/test18.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - try { - - CmdLine cmd("Command description message", ' ', "0.9", true); - - cmd.setExceptionHandling(false); - - cmd.parse(argc, argv); - - } catch (ArgException &e) { // catch any exceptions - cerr << "error: " << e.error() << " for arg " << e.argId() << endl; - return 1; - } catch (ExitException &e) { // catch any exceptions - cerr << "Exiting on ExitException." << endl; - return e.getExitStatus(); - } -} - diff --git a/tclap/examples/test19.cpp b/tclap/examples/test19.cpp deleted file mode 100644 index cda29bd..0000000 --- a/tclap/examples/test19.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - - -#define TCLAP_SETBASE_ZERO 1 - -#include "tclap/CmdLine.h" -#include -#include - - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - - try { - - CmdLine cmd("this is a message", ' ', "0.99" ); - - ValueArg itest("i", "intTest", "integer test", true, 5, "int"); - cmd.add( itest ); - - // - // Parse the command line. - // - cmd.parse(argc,argv); - - // - // Set variables - // - int _intTest = itest.getValue(); - cout << "found int: " << _intTest << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test2.cpp b/tclap/examples/test2.cpp deleted file mode 100644 index 50dacc4..0000000 --- a/tclap/examples/test2.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -int _intTest; -float _floatTest; -bool _boolTestA; -bool _boolTestB; -bool _boolTestC; -string _stringTest; -string _utest; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for float we got : " << _floatTest << endl - << "for int we got : " << _intTest<< endl - << "for string we got : " << _stringTest<< endl - << "for ulabeled we got : " << _utest << endl - << "for bool A we got : " << _boolTestA << endl - << "for bool B we got : " << _boolTestB << endl - << "for bool C we got : " << _boolTestC << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", ' ', "0.99" ); - - // - // Define arguments - // - - SwitchArg btest("B","existTestB", "tests for the existence of B", false); - cmd.add( btest ); - - SwitchArg ctest("C","existTestC", "tests for the existence of C", false); - cmd.add( ctest ); - - SwitchArg atest("A","existTestA", "tests for the existence of A", false); - cmd.add( atest ); - - ValueArg stest("s","stringTest","string test",true,"homer", - "string"); - cmd.add( stest ); - - ValueArg itest("i", "intTest", "integer test", true, 5, "int"); - cmd.add( itest ); - - ValueArg ftest("f", "floatTest", "float test", false, 3.7, "float"); - cmd.add( ftest ); - - UnlabeledValueArg utest("unTest","unlabeld test", true, - "default","string"); - cmd.add( utest ); - - UnlabeledMultiArg mtest("fileName", "file names", false, "string"); - cmd.add( mtest ); - - // - // Parse the command line. - // - cmd.parse(argc,argv); - - // - // Set variables - // - _intTest = itest.getValue(); - _floatTest = ftest.getValue(); - _stringTest = stest.getValue(); - _boolTestB = btest.getValue(); - _boolTestC = ctest.getValue(); - _boolTestA = atest.getValue(); - _utest = utest.getValue(); - - vector v = mtest.getValue(); - for ( int i = 0; static_cast(i) < v.size(); i++ ) - cout << i << " " << v[i] << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test20.cpp b/tclap/examples/test20.cpp deleted file mode 100644 index 879039f..0000000 --- a/tclap/examples/test20.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include -#include -#include - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message", '=', "0.9"); - - SwitchArg atmcSwitch("a", "atmc", "aContinuous time semantics", false); - SwitchArg btmcSwitch("b", "btmc", "bDiscrete time semantics", false); - cmd.xorAdd(atmcSwitch, btmcSwitch); - - // Parse the args. - cmd.parse( argc, argv ); - - } catch (ArgException &e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} diff --git a/tclap/examples/test21.cpp b/tclap/examples/test21.cpp deleted file mode 100644 index b4921d1..0000000 --- a/tclap/examples/test21.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - -// This illustrates how to change the flag and name start strings. -// Note that these defines need to happen *before* tclap is included! -#define TCLAP_NAMESTARTSTRING "~~" -#define TCLAP_FLAGSTARTSTRING "/" - -#include -#include -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message", ' ', "0.9"); - - // Define a value argument and add it to the command line. - ValueArg nameArg("n","name","Name to print",true,"homer","string"); - cmd.add( nameArg ); - - // Define a switch and add it to the command line. - SwitchArg reverseSwitch("r","reverse","Print name backwards", false); - cmd.add( reverseSwitch ); - - // Parse the args. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - string name = nameArg.getValue(); - bool reverseName = reverseSwitch.getValue(); - - // Do what you intend too... - if ( reverseName ) - { - reverse(name.begin(),name.end()); - cout << "My name (spelled backwards) is: " << name << endl; - } - else - cout << "My name is: " << name << endl; - - - } catch (ArgException &e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/examples/test22.cpp b/tclap/examples/test22.cpp deleted file mode 100644 index 2129543..0000000 --- a/tclap/examples/test22.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message", ' ', "0.9"); - cmd.ignoreUnmatched(true); - - // Define a value argument and add it to the command line. - ValueArg nameArg("n","name","Name to print",true,"homer","string"); - cmd.add( nameArg ); - - // Define a switch and add it to the command line. - SwitchArg reverseSwitch("r","reverse","Print name backwards", false); - cmd.add( reverseSwitch ); - - // Parse the args. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - string name = nameArg.getValue(); - bool reverseName = reverseSwitch.getValue(); - - // Do what you intend too... - if ( reverseName ) - { - reverse(name.begin(),name.end()); - cout << "My name (spelled backwards) is: " << name << endl; - } - else - cout << "My name is: " << name << endl; - - - } catch (ArgException &e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/examples/test23.cpp b/tclap/examples/test23.cpp deleted file mode 100644 index 7087d9e..0000000 --- a/tclap/examples/test23.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -bool _boolTestB; -string _stringTest; -string _utest; -string _ztest; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for string we got : " << _stringTest<< endl - << "for bool B we got : " << _boolTestB << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", '=', "0.99" ); - cmd.ignoreUnmatched(true); - - // - // Define arguments - // - - SwitchArg btest("B","existTestB", "exist Test B", cmd, false); - - ValueArg stest("s", "stringTest", "string test", true, "homer", - "string", cmd ); - - MultiArg itest("i", "intTest", "multi int test", false,"int", cmd ); - - MultiArg ftest("f", "floatTest", "multi float test", false,"float", - cmd ); - - UnlabeledMultiArg mtest("fileName","file names", false, - "fileNameString", cmd); - // - // Parse the command line. - // - cmd.parse(argc,argv); - - - // - // Set variables - // - _stringTest = stest.getValue(); - _boolTestB = btest.getValue(); - - vector vi = itest.getValue(); - for ( int i = 0; static_cast(i) < vi.size(); i++ ) - cout << "[-i] " << i << " " << vi[i] << endl; - - vector vf = ftest.getValue(); - for ( int i = 0; static_cast(i) < vf.size(); i++ ) - cout << "[-f] " << i << " " << vf[i] << endl; - - vector v = mtest.getValue(); - for ( int i = 0; static_cast(i) < v.size(); i++ ) - cout << "[ ] " << i << " " << v[i] << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test24.cpp b/tclap/examples/test24.cpp deleted file mode 100644 index 5964694..0000000 --- a/tclap/examples/test24.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -// Test various Arg properties such as invalid flag/names - -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main() { - CmdLine cmd("Command description message", ' ', "0.9"); - try { // Argument with two character 'flag' - ValueArg nameArg("nx","name","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // space as flag - ValueArg nameArg(" ","name","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // - as flag - ValueArg nameArg("-","name","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // -- as flag - ValueArg nameArg("--","name","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // space as name - ValueArg nameArg("n"," ","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // - as flag - ValueArg nameArg("n","-","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } - - try { // -- as flag - ValueArg nameArg("n","--","Name to print",true, - "homer","string"); - return EXIT_FAILURE; - } catch(SpecificationException e) { - cout << e.what() << std::endl; // Expected - } -} diff --git a/tclap/examples/test25.cpp b/tclap/examples/test25.cpp deleted file mode 100644 index a799347..0000000 --- a/tclap/examples/test25.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include "tclap/DocBookOutput.h" -#include "tclap/ZshCompletionOutput.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - CmdLine cmd("this is a message", ' ', "0.99" ); - DocBookOutput docoutput; - ZshCompletionOutput zshoutput; - CmdLineOutput *output = &zshoutput; - - if (argc > 2) - output = &docoutput; - - cmd.setOutput(output); - - SwitchArg btest("B","sB", "exist Test B", false); - MultiArg atest("A","sA", "exist Test A", false, "integer"); - - ValueArg stest("s", "Bs", "string test", true, "homer", - "string"); - - cmd.xorAdd(stest, btest); - cmd.add( atest ); - - cmd.parse(argc,argv); -} - - - diff --git a/tclap/examples/test26.cpp b/tclap/examples/test26.cpp deleted file mode 100644 index db7f673..0000000 --- a/tclap/examples/test26.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "tclap/CmdLine.h" -#include - -using namespace TCLAP; - -// Define a simple 3D vector type -struct Vect3D { - double v[3]; - - std::ostream& print(std::ostream &os) const - { - std::copy(v, v + 3, std::ostream_iterator(os, " ")); - return os; - } -}; - -// operator>> will be used to assign to the vector since the default -// is that all types are ValueLike. -std::istream &operator>>(std::istream &is, Vect3D &v) -{ - if (!(is >> v.v[0] >> v.v[1] >> v.v[2])) - throw TCLAP::ArgParseException(" Argument is not a 3D vector"); - - return is; -} - -int main(int argc, char *argv[]) -{ - CmdLine cmd("Command description message", ' ', "0.9"); - ValueArg vec("v", "vect", "vector", - true, Vect3D(), "3D vector", cmd); - - try { - cmd.parse(argc, argv); - } catch(std::exception &e) { - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } - - vec.getValue().print(std::cout); - std::cout << std::endl; -} diff --git a/tclap/examples/test27.cpp b/tclap/examples/test27.cpp deleted file mode 100644 index 74adbaa..0000000 --- a/tclap/examples/test27.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - - CmdLine cmd("test arg conversion operator"); - SwitchArg falseSwitch("f","false", "test false condition", cmd, false); - SwitchArg trueSwitch("t","true", "tests true condition", cmd, true); - ValueArg strArg("s","str", "test string arg", false, "defStr", "string", cmd); - ValueArg intArg("i","int", "tests int arg", false, 4711, "integer", cmd); - - cmd.parse(argc, argv); - - string s = strArg; - int i = intArg; - - cout << "for falseSwitch we got : " << falseSwitch << endl - << "for trueSwitch we got : " << trueSwitch << endl - << "for strArg we got : " << s << endl - << "for intArg we got : " << i << endl; -} diff --git a/tclap/examples/test28.cpp b/tclap/examples/test28.cpp deleted file mode 100644 index a8960a1..0000000 --- a/tclap/examples/test28.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main() -{ - try { - CmdLine cmd("test constraint bug"); - ValueArg arg("i","int", "tests int arg", false, 4711, NULL, cmd); - cout << "Expected exception" << endl; - } catch(std::logic_error &e) { /* expected */ } - - try { - CmdLine cmd("test constraint bug"); - ValueArg arg1("i","int", "tests int arg", false, 4711, NULL, NULL); - cout << "Expected exception" << endl; - } catch(std::logic_error &e) { /* expected */ } - - try { - CmdLine cmd("test constraint bug"); - MultiArg arg1("i","int", "tests int arg", false, NULL, NULL); - cout << "Expected exception" << endl; - } catch(std::logic_error &e) { /* expected */ } - - try { - CmdLine cmd("test constraint bug"); - MultiArg arg1("i","int", "tests int arg", false, NULL, cmd); - cout << "Expected exception" << endl; - } catch(std::logic_error &e) { /* expected */ } - - cout << "Passed" << endl; -} diff --git a/tclap/examples/test3.cpp b/tclap/examples/test3.cpp deleted file mode 100644 index 11e00af..0000000 --- a/tclap/examples/test3.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -bool _boolTestB; -string _stringTest; -string _utest; -string _ztest; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for string we got : " << _stringTest<< endl - << "for ulabeled one we got : " << _utest << endl - << "for ulabeled two we got : " << _ztest << endl - << "for bool B we got : " << _boolTestB << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", '=', "0.99" ); - - // - // Define arguments - // - - SwitchArg btest("B","existTestB", "exist Test B", false); - cmd.add( btest ); - - ValueArg stest("", "stringTest", "string test", true, "homer", - "string"); - cmd.add( stest ); - - UnlabeledValueArg utest("unTest1","unlabeled test one", true, - "default","string"); - cmd.add( utest ); - - UnlabeledValueArg ztest("unTest2","unlabeled test two", true, - "default","string"); - cmd.add( ztest ); - - MultiArg itest("i", "intTest", "multi int test", false,"int" ); - cmd.add( itest ); - - MultiArg ftest("f", "floatTest", "multi float test", false,"float" ); - cmd.add( ftest ); - - UnlabeledMultiArg mtest("fileName","file names",false, - "fileNameString"); - cmd.add( mtest ); - // - // Parse the command line. - // - cmd.parse(argc,argv); - - - // - // Set variables - // - _stringTest = stest.getValue(); - _boolTestB = btest.getValue(); - _utest = utest.getValue(); - _ztest = ztest.getValue(); - - vector vi = itest.getValue(); - for ( int i = 0; static_cast(i) < vi.size(); i++ ) - cout << "[-i] " << i << " " << vi[i] << endl; - - vector vf = ftest.getValue(); - for ( int i = 0; static_cast(i) < vf.size(); i++ ) - cout << "[-f] " << i << " " << vf[i] << endl; - - vector v = mtest.getValue(); - for ( int i = 0; static_cast(i) < v.size(); i++ ) - cout << "[ ] " << i << " " << v[i] << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test4.cpp b/tclap/examples/test4.cpp deleted file mode 100644 index 1d89133..0000000 --- a/tclap/examples/test4.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - - -#include "tclap/CmdLine.h" -#include "tclap/DocBookOutput.h" -#include "tclap/ZshCompletionOutput.h" -#include -#include - -using namespace TCLAP; -using namespace std; - - -// This exemplifies how the output class can be overridden to provide -// user defined output. -class MyOutput : public StdOutput -{ - public: - - virtual void failure(CmdLineInterface& c, ArgException& e) - { - static_cast(c); // Ignore input, don't warn - cerr << "my failure message: " << endl - << e.what() << endl; - exit(1); - } - - virtual void usage(CmdLineInterface& c) - { - cout << "my usage message:" << endl; - list args = c.getArgList(); - for (ArgListIterator it = args.begin(); it != args.end(); it++) - cout << (*it)->longID() - << " (" << (*it)->getDescription() << ")" << endl; - } - - virtual void version(CmdLineInterface& c) - { - static_cast(c); // Ignore input, don't warn - cout << "my version message: 0.1" << endl; - } -}; - - -bool _boolTestB; -bool _boolTestA; -string _stringTest; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for string we got : " << _stringTest<< endl - << "for bool B we got : " << _boolTestB << endl - << "for bool A we got : " << _boolTestA << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", ' ', "0.99" ); - - // set the output - MyOutput my; - //ZshCompletionOutput my; - //DocBookOutput my; - cmd.setOutput(&my); - - // - // Define arguments - // - - SwitchArg btest("B","sB", "exist Test B", false); - SwitchArg atest("A","sA", "exist Test A", false); - - ValueArg stest("s", "Bs", "string test", true, "homer", - "string"); - cmd.add( stest ); - cmd.add( btest ); - cmd.add( atest ); - - // - // Parse the command line. - // - cmd.parse(argc,argv); - - - // - // Set variables - // - _stringTest = stest.getValue(); - _boolTestB = btest.getValue(); - _boolTestA = atest.getValue(); - - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test5.cpp b/tclap/examples/test5.cpp deleted file mode 100644 index 68c38b3..0000000 --- a/tclap/examples/test5.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - - -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -string _orTest; -string _orTest2; -string _testc; -bool _testd; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for A OR B we got : " << _orTest<< endl - << "for string C we got : " << _testc << endl - << "for string D we got : " << _testd << endl - << "for E or F or G we got: " << _orTest2 << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", ' ', "0.99" ); - - // - // Define arguments - // - - ValueArg atest("a", "aaa", "or test a", true, "homer", "string"); - ValueArg btest("b", "bbb", "or test b", true, "homer", "string"); - cmd.xorAdd( atest, btest ); - - ValueArg ctest("c", "ccc", "c test", true, "homer", "string"); - cmd.add( ctest ); - - SwitchArg dtest("", "ddd", "d test", false); - cmd.add( dtest ); - - ValueArg etest("", "eee", "e test", false, "homer", "string"); - ValueArg ftest("", "fff", "f test", false, "homer", "string"); - ValueArg gtest("g", "ggg", "g test", false, "homer", "string"); - vector xorlist; - xorlist.push_back(&etest); - xorlist.push_back(&ftest); - xorlist.push_back(>est); - cmd.xorAdd( xorlist ); - - MultiArg itest("i", "iii", "or test i", true, "string"); - MultiArg jtest("j", "jjj", "or test j", true, "string"); - cmd.xorAdd( itest, jtest ); - - // - // Parse the command line. - // - cmd.parse(argc,argv); - - - // - // Set variables - // - - if ( atest.isSet() ) - _orTest = atest.getValue(); - else if ( btest.isSet() ) - _orTest = btest.getValue(); - else - // Should never get here because TCLAP will note that one of the - // required args above has not been set. - throw("very bad things..."); - - _testc = ctest.getValue(); - _testd = dtest.getValue(); - - if ( etest.isSet() ) - _orTest2 = etest.getValue(); - else if ( ftest.isSet() ) - _orTest2 = ftest.getValue(); - else if ( gtest.isSet() ) - _orTest2 = gtest.getValue(); - else - throw("still bad"); - - if ( jtest.isSet() ) - { - cout << "for J:" << endl; - vector v = jtest.getValue(); - for ( int z = 0; static_cast(z) < v.size(); z++ ) - cout << " " << z << " " << v[z] << endl; - } - else if ( itest.isSet() ) - { - cout << "for I:" << endl; - vector v = itest.getValue(); - for ( int z = 0; static_cast(z) < v.size(); z++ ) - cout << " " << z << " " << v[z] << endl; - } - else - throw("yup, still bad"); - - - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test6.cpp b/tclap/examples/test6.cpp deleted file mode 100644 index 05cc8d9..0000000 --- a/tclap/examples/test6.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message", ' ', "0.9"); - - vector allowed; - allowed.push_back("homer"); - allowed.push_back("marge"); - allowed.push_back("bart"); - allowed.push_back("lisa"); - allowed.push_back("maggie"); - ValuesConstraint allowedVals( allowed ); - - ValueArg nameArg("n","name","Name to print",true,"homer", - &allowedVals); - cmd.add( nameArg ); - - vector iallowed; - iallowed.push_back(1); - iallowed.push_back(2); - iallowed.push_back(3); - ValuesConstraint iallowedVals( iallowed ); - - UnlabeledValueArg intArg("times","Number of times to print",true,1, - &iallowedVals,false); - cmd.add( intArg ); - - // Parse the args. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - int num = intArg.getValue(); - string name = nameArg.getValue(); - - for ( int i = 0; i < num; i++ ) - cout << "My name is " << name << endl; - - } catch ( ArgException& e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/examples/test7.cpp b/tclap/examples/test7.cpp deleted file mode 100644 index 7ea48ee..0000000 --- a/tclap/examples/test7.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char **argv) -{ - // Wrap everything in a try block. Do this every time, - // because exceptions will be thrown for problems. - try { - - // Define the command line object. - CmdLine cmd("Command description message. This is a long multi-line message meant to test line wrapping. This is more text that doesn't really do anything besides take up lots of space that otherwise might be used for something real. That should be enough, don't you think?", ' ', "0.9"); - - vector allowed; - allowed.push_back("homer"); - allowed.push_back("marge"); - allowed.push_back("bart"); - allowed.push_back("lisa"); - allowed.push_back("maggie"); - ValuesConstraint vallowed( allowed ); - - MultiArg nameArg("n","name","Name to print. This is a long, nonsensical message to test line wrapping. Hopefully it works.",true,&vallowed); - cmd.add( nameArg ); - - vector iallowed; - iallowed.push_back(1); - iallowed.push_back(2); - iallowed.push_back(3); - ValuesConstraint iiallowed( iallowed ); - - UnlabeledMultiArg intArg("times","Number of times to print",false, - &iiallowed); - cmd.add( intArg ); - - // Ignore the names and comments! These args mean nothing (to this - // program) and are here solely to take up space. - ValueArg gapCreate("f","gapCreate", "The cost of creating a gap", - false, -10, "negative int"); - cmd.add( gapCreate ); - - ValueArg gapExtend("g","gap-Extend", - "The cost for each extension of a gap", false, -2, "negative int"); - cmd.add( gapExtend ); - - SwitchArg dna("d","isDna","The input sequences are DNA", false); - cmd.add( dna ); - - ValueArg scoringMatrixName("s","scoring--Matrix", - "Scoring Matrix name", false,"BLOSUM50","name string"); - cmd.add( scoringMatrixName ); - - ValueArg seq1Filename ("x","filename1", - "Sequence 1 filename (FASTA format)", false,"","filename"); - cmd.add( seq1Filename ); - - ValueArg seq2Filename ("z","filename2", - "Sequence 2 filename (FASTA format)", false,"","filename"); - cmd.add( seq2Filename ); - - ValueArg lowerBound("b","lowerBound", "lower percentage bound", - false,1.0,"float lte 1"); - cmd.add( lowerBound ); - - ValueArg upperBound("u","upperBound", "upper percentage bound", - false,1.0,"float lte 1"); - cmd.add( upperBound ); - - ValueArg limit("l","limit","Max number of alignments allowed", - false, 1000,"int"); - cmd.add( limit ); - - argv[0] = const_cast("ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblemsWithLongProgramNamesIThinkItIsNowLongEnough"); - - // Parse the args. - cmd.parse( argc, argv ); - - // Get the value parsed by each arg. - vector num = intArg.getValue(); - - for ( unsigned int i = 0; i < num.size(); i++ ) - cout << "Got num " << num[i] << endl; - - vector name = nameArg.getValue(); - - for ( unsigned int i = 0; i < name.size(); i++ ) - cout << "Got name " << name[i] << endl; - - - } catch (ArgException& e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/examples/test8.cpp b/tclap/examples/test8.cpp deleted file mode 100644 index 187cc83..0000000 --- a/tclap/examples/test8.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - - -#include "tclap/CmdLine.h" -#include -#include - -using namespace TCLAP; -using namespace std; - -bool _boolTestB; -string _stringTest; -string _utest; -string _ztest; - -void parseOptions(int argc, char** argv); - -int main(int argc, char** argv) -{ - - parseOptions(argc,argv); - - cout << "for string we got : " << _stringTest<< endl - << "for ulabeled one we got : " << _utest << endl - << "for ulabeled two we got : " << _ztest << endl - << "for bool B we got : " << _boolTestB << endl; - -} - - -void parseOptions(int argc, char** argv) -{ - try { - - CmdLine cmd("this is a message", '=', "0.99" ); - - // - // Define arguments - // - - SwitchArg btest("B","existTestB", "exist Test B", cmd, false); - - ValueArg stest("s", "stringTest", "string test", true, "homer", - "string", cmd ); - - UnlabeledValueArg utest("unTest1","unlabeled test one", true, - "default","string", cmd ); - - UnlabeledValueArg ztest("unTest2","unlabeled test two", true, - "default","string", cmd ); - - MultiArg itest("i", "intTest", "multi int test", false,"int", cmd ); - - MultiArg ftest("f", "floatTest", "multi float test", false,"float", - cmd ); - - UnlabeledMultiArg mtest("fileName","file names", false, - "fileNameString", cmd); - // - // Parse the command line. - // - cmd.parse(argc,argv); - - - // - // Set variables - // - _stringTest = stest.getValue(); - _boolTestB = btest.getValue(); - _utest = utest.getValue(); - _ztest = ztest.getValue(); - - vector vi = itest.getValue(); - for ( int i = 0; static_cast(i) < vi.size(); i++ ) - cout << "[-i] " << i << " " << vi[i] << endl; - - vector vf = ftest.getValue(); - for ( int i = 0; static_cast(i) < vf.size(); i++ ) - cout << "[-f] " << i << " " << vf[i] << endl; - - vector v = mtest.getValue(); - for ( int i = 0; static_cast(i) < v.size(); i++ ) - cout << "[ ] " << i << " " << v[i] << endl; - - } catch ( ArgException& e ) - { cout << "ERROR: " << e.error() << " " << e.argId() << endl; } -} - - - diff --git a/tclap/examples/test9.cpp b/tclap/examples/test9.cpp deleted file mode 100644 index 27a1359..0000000 --- a/tclap/examples/test9.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -#include -#include -#include -#include "tclap/CmdLine.h" - -using namespace TCLAP; -using namespace std; - -int main(int argc, char** argv) -{ - try { - - CmdLine cmd("Command description message", ' ', "0.9",false); - - SwitchArg reverseSwitch("r","reverse","REVERSE instead of FORWARDS", false); - cmd.add( reverseSwitch ); - - MultiSwitchArg verbose("V","verbose","Level of verbosity"); - cmd.add( verbose ); - - MultiSwitchArg noise("N","noise","Level of noise",5); - cmd.add( noise ); - - UnlabeledValueArg word("word","a random word", false, "string", - "won't see this",false); - cmd.add( word ); - - // Uncommenting the next arg will (correctly) cause an exception - // to be thrown. - -// UnlabeledMultiArg badword("badword","a bad word", false,"string"); -// -// cmd.add( badword ); - - cmd.parse( argc, argv ); - - bool reverseName = reverseSwitch.getValue(); - - if ( reverseName ) - cout << "REVERSE" << endl; - else - cout << "FORWARD" << endl; - - if ( verbose.isSet() ) - cout << "Verbose level: " << verbose.getValue() << endl; - - if ( noise.isSet() ) - cout << "Noise level: " << noise.getValue() << endl; - - if ( word.isSet() ) - cout << "Word: " << word.getValue() << endl; - - } catch (ArgException &e) // catch any exceptions - { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } -} - diff --git a/tclap/include/Makefile.am b/tclap/include/Makefile.am deleted file mode 100644 index 766f299..0000000 --- a/tclap/include/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = tclap diff --git a/tclap/include/tclap/Arg.h b/tclap/include/tclap/Arg.h index f8c4a5f..4f81cf1 100644 --- a/tclap/include/tclap/Arg.h +++ b/tclap/include/tclap/Arg.h @@ -22,28 +22,26 @@ * *****************************************************************************/ +#ifndef TCLAP_ARG_H +#define TCLAP_ARG_H -#ifndef TCLAP_ARGUMENT_H -#define TCLAP_ARGUMENT_H - -#ifdef HAVE_CONFIG_H -#include +#ifdef HAVE_TCLAP_CONFIG_H +#include #endif -#include -#include -#include -#include -#include -#include - -#include - #include -#include -#include #include +#include #include +#include +#include + +#include +#include +#include +#include +#include +#include namespace TCLAP { @@ -52,349 +50,344 @@ namespace TCLAP { * This class, or one of its existing children, must be subclassed to do * anything. */ -class Arg -{ - private: - /** - * Prevent accidental copying. - */ - Arg(const Arg& rhs); - - /** - * Prevent accidental copying. - */ - Arg& operator=(const Arg& rhs); - - /** - * Indicates whether the rest of the arguments should be ignored. - */ - static bool& ignoreRestRef() { static bool ign = false; return ign; } - - /** - * The delimiter that separates an argument flag/name from the - * value. - */ - static char& delimiterRef() { static char delim = ' '; return delim; } - - protected: - - /** - * The single char flag used to identify the argument. - * This value (preceded by a dash {-}), can be used to identify - * an argument on the command line. The _flag can be blank, - * in fact this is how unlabeled args work. Unlabeled args must - * override appropriate functions to get correct handling. Note - * that the _flag does NOT include the dash as part of the flag. - */ - std::string _flag; - - /** - * A single word namd identifying the argument. - * This value (preceded by two dashed {--}) can also be used - * to identify an argument on the command line. Note that the - * _name does NOT include the two dashes as part of the _name. The - * _name cannot be blank. - */ - std::string _name; - - /** - * Description of the argument. - */ - std::string _description; - - /** - * Indicating whether the argument is required. - */ - bool _required; - - /** - * Label to be used in usage description. Normally set to - * "required", but can be changed when necessary. - */ - std::string _requireLabel; - - /** - * Indicates whether a value is required for the argument. - * Note that the value may be required but the argument/value - * combination may not be, as specified by _required. - */ - bool _valueRequired; - - /** - * Indicates whether the argument has been set. - * Indicates that a value on the command line has matched the - * name/flag of this argument and the values have been set accordingly. - */ - bool _alreadySet; - - /** - * A pointer to a visitor object. - * The visitor allows special handling to occur as soon as the - * argument is matched. This defaults to NULL and should not - * be used unless absolutely necessary. - */ - Visitor* _visitor; - - /** - * Whether this argument can be ignored, if desired. - */ - bool _ignoreable; - - /** - * Indicates that the arg was set as part of an XOR and not on the - * command line. - */ - bool _xorSet; - - bool _acceptsMultipleValues; - - /** - * Performs the special handling described by the Visitor. - */ - void _checkWithVisitor() const; - - /** - * Primary constructor. YOU (yes you) should NEVER construct an Arg - * directly, this is a base class that is extended by various children - * that are meant to be used. Use SwitchArg, ValueArg, MultiArg, - * UnlabeledValueArg, or UnlabeledMultiArg instead. - * - * \param flag - The flag identifying the argument. - * \param name - The name identifying the argument. - * \param desc - The description of the argument, used in the usage. - * \param req - Whether the argument is required. - * \param valreq - Whether the a value is required for the argument. - * \param v - The visitor checked by the argument. Defaults to NULL. - */ - Arg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - bool valreq, - Visitor* v = NULL ); - - public: - /** - * Destructor. - */ - virtual ~Arg(); - - /** - * Adds this to the specified list of Args. - * \param argList - The list to add this to. - */ - virtual void addToList( std::list& argList ) const; - - /** - * Begin ignoring arguments since the "--" argument was specified. - */ - static void beginIgnoring() { ignoreRestRef() = true; } - - /** - * Whether to ignore the rest. - */ - static bool ignoreRest() { return ignoreRestRef(); } - - /** - * The delimiter that separates an argument flag/name from the - * value. - */ - static char delimiter() { return delimiterRef(); } - - /** - * The char used as a place holder when SwitchArgs are combined. - * Currently set to the bell char (ASCII 7). - */ - static char blankChar() { return (char)7; } - - /** - * The char that indicates the beginning of a flag. Defaults to '-', but - * clients can define TCLAP_FLAGSTARTCHAR to override. - */ +class Arg { +private: + /** + * Prevent accidental copying. + */ + Arg(const Arg &rhs); + + /** + * Prevent accidental copying. + */ + Arg &operator=(const Arg &rhs); + + /** + * The delimiter that separates an argument flag/name from the + * value. + */ + static char &delimiterRef() { + static char delim = ' '; + return delim; + } + +protected: + /** + * The single char flag used to identify the argument. + * This value (preceded by a dash {-}), can be used to identify + * an argument on the command line. The _flag can be blank, + * in fact this is how unlabeled args work. Unlabeled args must + * override appropriate functions to get correct handling. Note + * that the _flag does NOT include the dash as part of the flag. + */ + std::string _flag; + + /** + * A single word namd identifying the argument. + * This value (preceded by two dashed {--}) can also be used + * to identify an argument on the command line. Note that the + * _name does NOT include the two dashes as part of the _name. The + * _name cannot be blank. + */ + std::string _name; + + /** + * Description of the argument. + */ + std::string _description; + + /** + * Indicating whether the argument is required. + */ + const bool _required; + + /** + * Label to be used in usage description. Normally set to + * "required", but can be changed when necessary. + */ + std::string _requireLabel; + + /** + * Indicates whether a value is required for the argument. + * Note that the value may be required but the argument/value + * combination may not be, as specified by _required. + */ + bool _valueRequired; + + /** + * Indicates whether the argument has been set. + * Indicates that a value on the command line has matched the + * name/flag of this argument and the values have been set accordingly. + */ + bool _alreadySet; + + /** Indicates the value specified to set this flag (like -a or --all). + */ + std::string _setBy; + + /** + * A pointer to a visitor object. + * The visitor allows special handling to occur as soon as the + * argument is matched. This defaults to NULL and should not + * be used unless absolutely necessary. + */ + Visitor *_visitor; + + /** + * Whether this argument can be ignored, if desired. + */ + bool _ignoreable; + + bool _acceptsMultipleValues; + + /** + * Indicates if the argument is visible in the help output (e.g., + * when specifying --help). + */ + bool _visibleInHelp; + + /** + * Performs the special handling described by the Visitor. + */ + void _checkWithVisitor() const; + + /** + * Primary constructor. YOU (yes you) should NEVER construct an Arg + * directly, this is a base class that is extended by various children + * that are meant to be used. Use SwitchArg, ValueArg, MultiArg, + * UnlabeledValueArg, or UnlabeledMultiArg instead. + * + * \param flag - The flag identifying the argument. + * \param name - The name identifying the argument. + * \param desc - The description of the argument, used in the usage. + * \param req - Whether the argument is required. + * \param valreq - Whether the a value is required for the argument. + * \param v - The visitor checked by the argument. Defaults to NULL. + */ + Arg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, bool valreq, Visitor *v = NULL); + +public: + /** + * Destructor. + */ + virtual ~Arg(); + + /** + * Adds this to the specified list of Args. + * \param argList - The list to add this to. + */ + virtual void addToList(std::list &argList) const; + + /** + * The delimiter that separates an argument flag/name from the + * value. + */ + static char delimiter() { return delimiterRef(); } + + /** + * The char used as a place holder when SwitchArgs are combined. + * Currently set to the bell char (ASCII 7). + */ + static char blankChar() { return '\a'; } + +/** + * The char that indicates the beginning of a flag. Defaults to '-', but + * clients can define TCLAP_FLAGSTARTCHAR to override. + */ #ifndef TCLAP_FLAGSTARTCHAR #define TCLAP_FLAGSTARTCHAR '-' #endif - static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; } + static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; } - /** - * The sting that indicates the beginning of a flag. Defaults to "-", but - * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same - * as TCLAP_FLAGSTARTCHAR. - */ +/** + * The sting that indicates the beginning of a flag. Defaults to "-", but + * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same + * as TCLAP_FLAGSTARTCHAR. + */ #ifndef TCLAP_FLAGSTARTSTRING #define TCLAP_FLAGSTARTSTRING "-" #endif - static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; } + static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; } - /** - * The sting that indicates the beginning of a name. Defaults to "--", but - * clients can define TCLAP_NAMESTARTSTRING to override. - */ +/** + * The sting that indicates the beginning of a name. Defaults to "--", but + * clients can define TCLAP_NAMESTARTSTRING to override. + */ #ifndef TCLAP_NAMESTARTSTRING #define TCLAP_NAMESTARTSTRING "--" #endif - static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; } - - /** - * The name used to identify the ignore rest argument. - */ - static const std::string ignoreNameString() { return "ignore_rest"; } - - /** - * Sets the delimiter for all arguments. - * \param c - The character that delimits flags/names from values. - */ - static void setDelimiter( char c ) { delimiterRef() = c; } - - /** - * Pure virtual method meant to handle the parsing and value assignment - * of the string on the command line. - * \param i - Pointer the the current argument in the list. - * \param args - Mutable list of strings. What is - * passed in from main. - */ - virtual bool processArg(int *i, std::vector& args) = 0; - - /** - * Operator ==. - * Equality operator. Must be virtual to handle unlabeled args. - * \param a - The Arg to be compared to this. - */ - virtual bool operator==(const Arg& a) const; - - /** - * Returns the argument flag. - */ - const std::string& getFlag() const; - - /** - * Returns the argument name. - */ - const std::string& getName() const; - - /** - * Returns the argument description. - */ - std::string getDescription() const; - - /** - * Indicates whether the argument is required. - */ - virtual bool isRequired() const; - - /** - * Sets _required to true. This is used by the XorHandler. - * You really have no reason to ever use it. - */ - void forceRequired(); - - /** - * Sets the _alreadySet value to true. This is used by the XorHandler. - * You really have no reason to ever use it. - */ - void xorSet(); - - /** - * Indicates whether a value must be specified for argument. - */ - bool isValueRequired() const; - - /** - * Indicates whether the argument has already been set. Only true - * if the arg has been matched on the command line. - */ - bool isSet() const; - - /** - * Indicates whether the argument can be ignored, if desired. - */ - bool isIgnoreable() const; - - /** - * A method that tests whether a string matches this argument. - * This is generally called by the processArg() method. This - * method could be re-implemented by a child to change how - * arguments are specified on the command line. - * \param s - The string to be compared to the flag/name to determine - * whether the arg matches. - */ - virtual bool argMatches( const std::string& s ) const; - - /** - * Returns a simple string representation of the argument. - * Primarily for debugging. - */ - virtual std::string toString() const; - - /** - * Returns a short ID for the usage. - * \param valueId - The value used in the id. - */ - virtual std::string shortID( const std::string& valueId = "val" ) const; - - /** - * Returns a long ID for the usage. - * \param valueId - The value used in the id. - */ - virtual std::string longID( const std::string& valueId = "val" ) const; - - /** - * Trims a value off of the flag. - * \param flag - The string from which the flag and value will be - * trimmed. Contains the flag once the value has been trimmed. - * \param value - Where the value trimmed from the string will - * be stored. - */ - virtual void trimFlag( std::string& flag, std::string& value ) const; - - /** - * Checks whether a given string has blank chars, indicating that - * it is a combined SwitchArg. If so, return true, otherwise return - * false. - * \param s - string to be checked. - */ - bool _hasBlanks( const std::string& s ) const; - - /** - * Sets the requireLabel. Used by XorHandler. You shouldn't ever - * use this. - * \param s - Set the requireLabel to this value. - */ - void setRequireLabel( const std::string& s ); - - /** - * Used for MultiArgs and XorHandler to determine whether args - * can still be set. - */ - virtual bool allowMore(); - - /** - * Use by output classes to determine whether an Arg accepts - * multiple values. - */ - virtual bool acceptsMultipleValues(); - - /** - * Clears the Arg object and allows it to be reused by new - * command lines. - */ - virtual void reset(); + static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; } + + /** + * The name used to identify the ignore rest argument. + */ + static const std::string ignoreNameString() { return "ignore_rest"; } + + /** + * Sets the delimiter for all arguments. + * \param c - The character that delimits flags/names from values. + */ + static void setDelimiter(char c) { delimiterRef() = c; } + + /** + * Pure virtual method meant to handle the parsing and value assignment + * of the string on the command line. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. What is + * passed in from main. + */ + virtual bool processArg(int *i, std::vector &args) = 0; + + /** + * Operator ==. + * Equality operator. Must be virtual to handle unlabeled args. + * \param a - The Arg to be compared to this. + */ + virtual bool operator==(const Arg &a) const; + + /** + * Returns the argument flag. + */ + const std::string &getFlag() const; + + /** + * Returns the argument name. + */ + const std::string &getName() const; + + /** + * Returns the argument description. + */ + std::string getDescription() const { return getDescription(_required); } + + /** + * Returns the argument description. + * + * @param required if the argument should be treated as + * required when described. + */ + std::string getDescription(bool required) const { + return (required ? "(" + _requireLabel + ") " : "") + _description; + } + + /** + * Indicates whether the argument is required. + */ + virtual bool isRequired() const; + + /** + * Indicates whether a value must be specified for argument. + */ + bool isValueRequired() const; + + /** + * Indicates whether the argument has already been set. Only true + * if the arg has been matched on the command line. + */ + bool isSet() const; + + /** + * Returns the value specified to set this flag (like -a or --all). + */ + const std::string &setBy() const { return _setBy; } + + /** + * Indicates whether the argument can be ignored, if desired. + */ + bool isIgnoreable() const; + + /** + * A method that tests whether a string matches this argument. + * This is generally called by the processArg() method. This + * method could be re-implemented by a child to change how + * arguments are specified on the command line. + * \param s - The string to be compared to the flag/name to determine + * whether the arg matches. + */ + virtual bool argMatches(const std::string &s) const; + + /** + * Returns a simple string representation of the argument. + * Primarily for debugging. + */ + virtual std::string toString() const; + + /** + * Returns a short ID for the usage. + * \param valueId - The value used in the id. + */ + virtual std::string shortID(const std::string &valueId = "val") const; + + /** + * Returns a long ID for the usage. + * \param valueId - The value used in the id. + */ + virtual std::string longID(const std::string &valueId = "val") const; + + /** + * Trims a value off of the flag. + * \param flag - The string from which the flag and value will be + * trimmed. Contains the flag once the value has been trimmed. + * \param value - Where the value trimmed from the string will + * be stored. + */ + virtual void trimFlag(std::string &flag, std::string &value) const; + + /** + * Checks whether a given string has blank chars, indicating that + * it is a combined SwitchArg. If so, return true, otherwise return + * false. + * \param s - string to be checked. + */ + bool _hasBlanks(const std::string &s) const; + + /** + * Used for MultiArgs to determine whether args can still be + * set. + */ + virtual bool allowMore(); + + /** + * Use by output classes to determine whether an Arg accepts + * multiple values. + */ + virtual bool acceptsMultipleValues(); + + /** + * Clears the Arg object and allows it to be reused by new + * command lines. + */ + virtual void reset(); + + /** + * Hide this argument from the help output (e.g., when + * specifying the --help flag or on error. + */ + virtual void hideFromHelp(bool hide = true) { _visibleInHelp = !hide; } + + /** + * Returns true if this Arg is visible in the help output. + */ + virtual bool visibleInHelp() const { return _visibleInHelp; } + + virtual bool hasLabel() const { return true; } }; /** * Typedef of an Arg list iterator. */ -typedef std::list::const_iterator ArgListIterator; +typedef std::list::const_iterator ArgListIterator; /** * Typedef of an Arg vector iterator. */ -typedef std::vector::const_iterator ArgVectorIterator; +typedef std::vector::const_iterator ArgVectorIterator; /** * Typedef of a Visitor list iterator. */ -typedef std::list::const_iterator VisitorListIterator; +typedef std::list::const_iterator VisitorListIterator; /* * Extract a value of type T from it's string representation contained @@ -402,35 +395,36 @@ typedef std::list::const_iterator VisitorListIterator; * specialization of ExtractValue depending on the value traits of T. * ValueLike traits use operator>> to assign the value from strVal. */ -template void -ExtractValue(T &destVal, const std::string& strVal, ValueLike vl) -{ - static_cast(vl); // Avoid warning about unused vl +template +void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl) { + static_cast(vl); // Avoid warning about unused vl istringstream is(strVal.c_str()); int valuesRead = 0; - while ( is.good() ) { - if ( is.peek() != EOF ) + while (is.good()) { + if (is.peek() != EOF) #ifdef TCLAP_SETBASE_ZERO - is >> std::setbase(0) >> destVal; + is >> std::setbase(0) >> destVal; #else - is >> destVal; + is >> destVal; #endif - else - break; + else + break; - valuesRead++; + valuesRead++; } - if ( is.fail() ) - throw( ArgParseException("Couldn't read argument value " - "from string '" + strVal + "'")); - - - if ( valuesRead > 1 ) - throw( ArgParseException("More than one valid value parsed from " - "string '" + strVal + "'")); - + if (is.fail()) + throw( + ArgParseException("Couldn't read argument value " + "from string '" + + strVal + "'")); + + if (valuesRead > 1) + throw( + ArgParseException("More than one valid value parsed from " + "string '" + + strVal + "'")); } /* @@ -439,245 +433,171 @@ ExtractValue(T &destVal, const std::string& strVal, ValueLike vl) * specialization of ExtractValue depending on the value traits of T. * StringLike uses assignment (operator=) to assign from strVal. */ -template void -ExtractValue(T &destVal, const std::string& strVal, StringLike sl) -{ - static_cast(sl); // Avoid warning about unused sl +template +void ExtractValue(T &destVal, const std::string &strVal, StringLike sl) { + static_cast(sl); // Avoid warning about unused sl SetString(destVal, strVal); } ////////////////////////////////////////////////////////////////////// -//BEGIN Arg.cpp +// BEGIN Arg.cpp ////////////////////////////////////////////////////////////////////// -inline Arg::Arg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - bool valreq, - Visitor* v) : - _flag(flag), - _name(name), - _description(desc), - _required(req), - _requireLabel("required"), - _valueRequired(valreq), - _alreadySet(false), - _visitor( v ), - _ignoreable(true), - _xorSet(false), - _acceptsMultipleValues(false) -{ - if ( _flag.length() > 1 ) - throw(SpecificationException( - "Argument flag can only be one character long", toString() ) ); - - if ( _name != ignoreNameString() && - ( _flag == Arg::flagStartString() || - _flag == Arg::nameStartString() || - _flag == " " ) ) - throw(SpecificationException("Argument flag cannot be either '" + - Arg::flagStartString() + "' or '" + - Arg::nameStartString() + "' or a space.", - toString() ) ); - - if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) || - ( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) || - ( _name.find( " ", 0 ) != std::string::npos ) ) - throw(SpecificationException("Argument name begin with either '" + - Arg::flagStartString() + "' or '" + - Arg::nameStartString() + "' or space.", - toString() ) ); - +inline Arg::Arg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, bool valreq, Visitor *v) + : _flag(flag), + _name(name), + _description(desc), + _required(req), + _requireLabel("required"), + _valueRequired(valreq), + _alreadySet(false), + _setBy(), + _visitor(v), + _ignoreable(true), + _acceptsMultipleValues(false), + _visibleInHelp(true) { + if (_flag.length() > 1) + throw(SpecificationException( + "Argument flag can only be one character long", Arg::toString())); + + if (_name != ignoreNameString() && + (_flag == Arg::flagStartString() || _flag == Arg::nameStartString() || + _flag == " ")) + throw(SpecificationException( + "Argument flag cannot be either '" + Arg::flagStartString() + + "' or '" + Arg::nameStartString() + "' or a space.", + Arg::toString())); + + if ((_name.substr(0, Arg::flagStartString().length()) == + Arg::flagStartString()) || + (_name.substr(0, Arg::nameStartString().length()) == + Arg::nameStartString()) || + (_name.find(" ", 0) != std::string::npos)) + throw(SpecificationException("Argument name begin with either '" + + Arg::flagStartString() + "' or '" + + Arg::nameStartString() + "' or space.", + Arg::toString())); } -inline Arg::~Arg() { } +inline Arg::~Arg() {} -inline std::string Arg::shortID( const std::string& valueId ) const -{ - std::string id = ""; +inline std::string Arg::shortID(const std::string &valueId) const { + std::string id = ""; - if ( _flag != "" ) - id = Arg::flagStartString() + _flag; - else - id = Arg::nameStartString() + _name; + if (_flag != "") + id = Arg::flagStartString() + _flag; + else + id = Arg::nameStartString() + _name; - if ( _valueRequired ) - id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + if (_valueRequired) id += std::string(1, Arg::delimiter()) + valueId; - if ( !_required ) - id = "[" + id + "]"; - - return id; + return id; } -inline std::string Arg::longID( const std::string& valueId ) const -{ - std::string id = ""; - - if ( _flag != "" ) - { - id += Arg::flagStartString() + _flag; +inline std::string Arg::longID(const std::string &valueId) const { + std::string id = ""; - if ( _valueRequired ) - id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + if (_flag != "") { + id += Arg::flagStartString() + _flag; - id += ", "; - } + if (_valueRequired) id += std::string(1, Arg::delimiter()) + valueId; - id += Arg::nameStartString() + _name; + id += ", "; + } - if ( _valueRequired ) - id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">"; + id += Arg::nameStartString() + _name; - return id; + if (_valueRequired) id += std::string(1, Arg::delimiter()) + valueId; + return id; } -inline bool Arg::operator==(const Arg& a) const -{ - if ( ( _flag != "" && _flag == a._flag ) || _name == a._name) - return true; - else - return false; -} - -inline std::string Arg::getDescription() const -{ - std::string desc = ""; - if ( _required ) - desc = "(" + _requireLabel + ") "; - -// if ( _valueRequired ) -// desc += "(value required) "; - - desc += _description; - return desc; +inline bool Arg::operator==(const Arg &a) const { + if ((_flag != "" && _flag == a._flag) || _name == a._name) + return true; + else + return false; } -inline const std::string& Arg::getFlag() const { return _flag; } +inline const std::string &Arg::getFlag() const { return _flag; } -inline const std::string& Arg::getName() const { return _name; } +inline const std::string &Arg::getName() const { return _name; } inline bool Arg::isRequired() const { return _required; } inline bool Arg::isValueRequired() const { return _valueRequired; } -inline bool Arg::isSet() const -{ - if ( _alreadySet && !_xorSet ) - return true; - else - return false; -} +inline bool Arg::isSet() const { return _alreadySet; } inline bool Arg::isIgnoreable() const { return _ignoreable; } -inline void Arg::setRequireLabel( const std::string& s) -{ - _requireLabel = s; -} - -inline bool Arg::argMatches( const std::string& argFlag ) const -{ - if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) || - argFlag == Arg::nameStartString() + _name ) - return true; - else - return false; +inline bool Arg::argMatches(const std::string &argFlag) const { + if ((argFlag == Arg::flagStartString() + _flag && _flag != "") || + argFlag == Arg::nameStartString() + _name) + return true; + else + return false; } -inline std::string Arg::toString() const -{ - std::string s = ""; +inline std::string Arg::toString() const { + std::string s = ""; - if ( _flag != "" ) - s += Arg::flagStartString() + _flag + " "; + if (_flag != "") s += Arg::flagStartString() + _flag + " "; - s += "(" + Arg::nameStartString() + _name + ")"; + s += "(" + Arg::nameStartString() + _name + ")"; - return s; + return s; } -inline void Arg::_checkWithVisitor() const -{ - if ( _visitor != NULL ) - _visitor->visit(); +inline void Arg::_checkWithVisitor() const { + if (_visitor != NULL) _visitor->visit(); } /** * Implementation of trimFlag. */ -inline void Arg::trimFlag(std::string& flag, std::string& value) const -{ - int stop = 0; - for ( int i = 0; static_cast(i) < flag.length(); i++ ) - if ( flag[i] == Arg::delimiter() ) - { - stop = i; - break; - } - - if ( stop > 1 ) - { - value = flag.substr(stop+1); - flag = flag.substr(0,stop); - } - +inline void Arg::trimFlag(std::string &flag, std::string &value) const { + int stop = 0; + for (int i = 0; static_cast(i) < flag.length(); i++) + if (flag[i] == Arg::delimiter()) { + stop = i; + break; + } + + if (stop > 1) { + value = flag.substr(stop + 1); + flag = flag.substr(0, stop); + } } /** * Implementation of _hasBlanks. */ -inline bool Arg::_hasBlanks( const std::string& s ) const -{ - for ( int i = 1; static_cast(i) < s.length(); i++ ) - if ( s[i] == Arg::blankChar() ) - return true; - - return false; -} +inline bool Arg::_hasBlanks(const std::string &s) const { + for (int i = 1; static_cast(i) < s.length(); i++) + if (s[i] == Arg::blankChar()) return true; -inline void Arg::forceRequired() -{ - _required = true; -} - -inline void Arg::xorSet() -{ - _alreadySet = true; - _xorSet = true; + return false; } /** * Overridden by Args that need to added to the end of the list. */ -inline void Arg::addToList( std::list& argList ) const -{ - argList.push_front( const_cast(this) ); +inline void Arg::addToList(std::list &argList) const { + argList.push_front(const_cast(this)); } -inline bool Arg::allowMore() -{ - return false; -} +inline bool Arg::allowMore() { return false; } -inline bool Arg::acceptsMultipleValues() -{ - return _acceptsMultipleValues; -} +inline bool Arg::acceptsMultipleValues() { return _acceptsMultipleValues; } -inline void Arg::reset() -{ - _xorSet = false; - _alreadySet = false; -} +inline void Arg::reset() { _alreadySet = false; } ////////////////////////////////////////////////////////////////////// -//END Arg.cpp +// END Arg.cpp ////////////////////////////////////////////////////////////////////// -} //namespace TCLAP - -#endif +} // namespace TCLAP +#endif // TCLAP_ARG_H diff --git a/tclap/include/tclap/ArgContainer.h b/tclap/include/tclap/ArgContainer.h new file mode 100644 index 0000000..05fbc87 --- /dev/null +++ b/tclap/include/tclap/ArgContainer.h @@ -0,0 +1,58 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ArgContainer.h + * + * Copyright (c) 2018 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, + * 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_ARG_CONTAINER_H +#define TCLAP_ARG_CONTAINER_H + +namespace TCLAP { + +class Arg; + +/** + * Interface that allows adding an Arg to a "container". + * + * A container does not have to be a container in the C++ standard + * library sense, just something that wants to hold on to references + * to Arg's. The container does not own the added Arg's and it is the + * user's responsibility to ensure the life time (scope) of the Arg's + * outlives any operations on the container. + */ +class ArgContainer { +public: + virtual ~ArgContainer() {} + + /** + * Adds an argument. Ownership is not transfered. + * \param a - Argument to be added. + */ + virtual ArgContainer &add(Arg &a) = 0; + + /** + * Adds an argument. Ownership is not transfered. + * \param a - Argument to be added. + */ + virtual ArgContainer &add(Arg *a) = 0; +}; + +} // namespace TCLAP + +#endif // TCLAP_ARG_CONTAINER_H diff --git a/tclap/include/tclap/ArgException.h b/tclap/include/tclap/ArgException.h index 2102095..cabd244 100644 --- a/tclap/include/tclap/ArgException.h +++ b/tclap/include/tclap/ArgException.h @@ -1,32 +1,31 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- -/****************************************************************************** - * +/****************************************************************************** + * * 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 * 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_ARG_EXCEPTION_H #define TCLAP_ARG_EXCEPTION_H -#include #include +#include namespace TCLAP { @@ -34,168 +33,158 @@ namespace TCLAP { * A simple class that defines and argument exception. Should be caught * whenever a CmdLine is created and parsed. */ -class ArgException : public std::exception -{ - public: - - /** - * Constructor. - * \param text - The text of the exception. - * \param id - The text identifying the argument source. - * \param td - Text describing the type of ArgException it is. - * of the exception. - */ - ArgException( const std::string& text = "undefined exception", - const std::string& id = "undefined", - const std::string& td = "Generic ArgException") - : std::exception(), - _errorText(text), - _argId( id ), - _typeDescription(td) - { } - - /** - * Destructor. - */ - virtual ~ArgException() throw() { } - - /** - * Returns the error text. - */ - std::string error() const { return ( _errorText ); } - - /** - * Returns the argument id. - */ - std::string argId() const - { - if ( _argId == "undefined" ) - return " "; - else - return ( "Argument: " + _argId ); - } - - /** - * Returns the arg id and error text. - */ - const char* what() const throw() - { - static std::string ex; - ex = _argId + " -- " + _errorText; - return ex.c_str(); - } - - /** - * Returns the type of the exception. Used to explain and distinguish - * between different child exceptions. - */ - std::string typeDescription() const - { - return _typeDescription; - } - - - private: - - /** - * The text of the exception message. - */ - std::string _errorText; - - /** - * The argument related to this exception. - */ - std::string _argId; - - /** - * Describes the type of the exception. Used to distinguish - * between different child exceptions. - */ - std::string _typeDescription; +class ArgException : public std::exception { +public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source. + * \param td - Text describing the type of ArgException it is. + * of the exception. + */ + ArgException(const std::string &text = "undefined exception", + const std::string &id = "undefined", + const std::string &td = "Generic ArgException") + : std::exception(), + _errorText(text), + _argId(id), + _typeDescription(td) {} + + /** + * Destructor. + */ + virtual ~ArgException() throw() {} + + /** + * Returns the error text. + */ + std::string error() const { return (_errorText); } + + /** + * Returns the argument id. + */ + std::string argId() const { + if (_argId == "undefined") + return " "; + else + return ("Argument: " + _argId); + } + + /** + * Returns the arg id and error text. + */ + const char *what() const throw() { + static std::string ex; + ex = _argId + " -- " + _errorText; + return ex.c_str(); + } + + /** + * Returns the type of the exception. Used to explain and distinguish + * between different child exceptions. + */ + std::string typeDescription() const { return _typeDescription; } +private: + /** + * The text of the exception message. + */ + std::string _errorText; + + /** + * The argument related to this exception. + */ + std::string _argId; + + /** + * Describes the type of the exception. Used to distinguish + * between different child exceptions. + */ + std::string _typeDescription; }; /** * Thrown from within the child Arg classes when it fails to properly * parse the argument it has been passed. */ -class ArgParseException : public ArgException -{ - public: - /** - * Constructor. - * \param text - The text of the exception. - * \param id - The text identifying the argument source - * of the exception. - */ - ArgParseException( const std::string& text = "undefined exception", - const std::string& id = "undefined" ) - : ArgException( text, - id, - std::string( "Exception found while parsing " ) + - std::string( "the value the Arg has been passed." )) - { } +class ArgParseException : public ArgException { +public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + ArgParseException(const std::string &text = "undefined exception", + const std::string &id = "undefined") + : ArgException(text, id, + std::string("Exception found while parsing ") + + std::string("the value the Arg has been passed.")) {} }; /** * Thrown from CmdLine when the arguments on the command line are not * properly specified, e.g. too many arguments, required argument missing, etc. */ -class CmdLineParseException : public ArgException -{ - public: - /** - * Constructor. - * \param text - The text of the exception. - * \param id - The text identifying the argument source - * of the exception. - */ - CmdLineParseException( const std::string& text = "undefined exception", - const std::string& id = "undefined" ) - : ArgException( text, - id, - std::string( "Exception found when the values ") + - std::string( "on the command line do not meet ") + - std::string( "the requirements of the defined ") + - std::string( "Args." )) - { } +class CmdLineParseException : public ArgException { +public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + CmdLineParseException(const std::string &text = "undefined exception", + const std::string &id = "undefined") + : ArgException(text, id, + std::string("Exception found when the values ") + + std::string("on the command line do not meet ") + + std::string("the requirements of the defined ") + + std::string("Args.")) {} }; /** - * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. + * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. * same flag as another Arg, same name, etc. */ -class SpecificationException : public ArgException -{ - public: - /** - * Constructor. - * \param text - The text of the exception. - * \param id - The text identifying the argument source - * of the exception. - */ - SpecificationException( const std::string& text = "undefined exception", - const std::string& id = "undefined" ) - : ArgException( text, - id, - std::string("Exception found when an Arg object ")+ - std::string("is improperly defined by the ") + - std::string("developer." )) - { } - +class SpecificationException : public ArgException { +public: + /** + * Constructor. + * \param text - The text of the exception. + * \param id - The text identifying the argument source + * of the exception. + */ + SpecificationException(const std::string &text = "undefined exception", + const std::string &id = "undefined") + : ArgException(text, id, + std::string("Exception found when an Arg object ") + + std::string("is improperly defined by the ") + + std::string("developer.")) {} }; +/** + * 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) {} + explicit ExitException(int estat) : _estat(estat) {} - int getExitStatus() const { return _estat; } + int getExitStatus() const { return _estat; } private: - int _estat; + int _estat; }; -} // namespace TCLAP - -#endif +} // namespace TCLAP +#endif // TCLAP_ARG_EXCEPTION_H diff --git a/tclap/include/tclap/ArgGroup.h b/tclap/include/tclap/ArgGroup.h new file mode 100644 index 0000000..0a3dd37 --- /dev/null +++ b/tclap/include/tclap/ArgGroup.h @@ -0,0 +1,256 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: ArgGroup.h + * + * 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, + * 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_ARG_GROUP_H +#define TCLAP_ARG_GROUP_H + +#include +#include +#include + +#include +#include + +namespace TCLAP { + +/** + * ArgGroup is the base class for implementing groups of arguments + * that are mutually exclusive (it replaces the deprecated xor + * handler). It is not expected to be used directly, rather one of the + * EitherOf or OneOf derived classes are used. + */ +class ArgGroup : public ArgContainer { +public: + typedef std::list Container; + typedef Container::iterator iterator; + typedef Container::const_iterator const_iterator; + + virtual ~ArgGroup() {} + + /// Add an argument to this arg group + virtual ArgContainer &add(Arg &arg) { return add(&arg); } + + /// Add an argument to this arg group + virtual ArgContainer &add(Arg *arg); + + /** + * Validates that the constraints of the ArgGroup are satisfied. + * + * @internal + * Throws an CmdLineParseException if there is an issue (except + * missing required argument, in which case true is returned). + * + * @retval true iff a required argument was missing. + */ + virtual bool validate() = 0; + + /** + * Returns true if this argument group is required + * + * @internal + */ + virtual bool isRequired() const = 0; + + /** + * Returns true if this argument group is exclusive. + * + * @internal + * Being exclusive means there is a constraint so that some + * arguments cannot be selected at the same time. + */ + virtual bool isExclusive() const = 0; + + /** + * Used by the parser to connect itself to this arg group. + * + * @internal + * This is needed so that existing and subsequently added args (in + * this arg group) are also added to the parser (and checked for + * consistency with other args). + */ + void setParser(CmdLineInterface &parser) { + if (_parser) { + throw SpecificationException("Arg group can have only one parser"); + } + + _parser = &parser; + for (iterator it = begin(); it != end(); ++it) { + parser.addToArgList(*it); + } + } + + /** + * If arguments in this group should show up as grouped in help. + */ + virtual bool showAsGroup() const { return true; } + + /// Returns the argument group's name. + const std::string getName() const; + + iterator begin() { return _args.begin(); } + iterator end() { return _args.end(); } + const_iterator begin() const { return _args.begin(); } + const_iterator end() const { return _args.end(); } + +protected: + // No direct instantiation + ArgGroup() : _parser(0), _args() {} + +private: + explicit ArgGroup(const ArgGroup &); + ArgGroup &operator=(const ArgGroup &); // no copy + +protected: + CmdLineInterface *_parser; + Container _args; +}; + +/** + * Implements common functionality for exclusive argument groups. + * + * @internal + */ +class ExclusiveArgGroup : public ArgGroup { +public: + inline bool validate(); + bool isExclusive() const { return true; } + ArgContainer &add(Arg &arg) { return add(&arg); } + ArgContainer &add(Arg *arg) { + if (arg->isRequired()) { + throw SpecificationException( + "Required arguments are not allowed" + " in an exclusive grouping.", + arg->longID()); + } + + return ArgGroup::add(arg); + } + +protected: + ExclusiveArgGroup() {} + explicit ExclusiveArgGroup(CmdLineInterface &parser) { parser.add(*this); } +}; + +/** + * Implements a group of arguments where at most one can be selected. + */ +class EitherOf : public ExclusiveArgGroup { +public: + EitherOf() {} + explicit EitherOf(CmdLineInterface &parser) : ExclusiveArgGroup(parser) {} + + bool isRequired() const { return false; } +}; + +/** + * Implements a group of arguments where exactly one must be + * selected. This corresponds to the deprecated "xoradd". + */ +class OneOf : public ExclusiveArgGroup { +public: + OneOf() {} + explicit OneOf(CmdLineInterface &parser) : ExclusiveArgGroup(parser) {} + + bool isRequired() const { return true; } +}; + +/** + * Implements a group of arguments where any combination is possible + * (including all or none). This is mostly used in case one optional + * argument allows additional arguments to be specified (for example + * [-c [-de] [-n ]]). + */ +class AnyOf : public ArgGroup { +public: + AnyOf() {} + explicit AnyOf(CmdLineInterface &parser) { parser.add(*this); } + + bool validate() { return false; /* All good */ } + bool isExclusive() const { return false; } + bool isRequired() const { return false; } +}; + +inline ArgContainer &ArgGroup::add(Arg *arg) { + for (iterator it = begin(); it != end(); it++) { + if (*arg == **it) { + throw SpecificationException( + "Argument with same flag/name already exists!", arg->longID()); + } + } + + _args.push_back(arg); + if (_parser) { + _parser->addToArgList(arg); + } + + return *this; +} + +inline bool ExclusiveArgGroup::validate() { + Arg *arg = NULL; + std::string flag; + + for (const_iterator it = begin(); it != end(); ++it) { + if ((*it)->isSet()) { + if (arg != NULL && !(*arg == **it)) { + // We found a matching argument, but one was + // already found previously. + throw CmdLineParseException( + "Only one is allowed.", + flag + " AND " + (*it)->setBy() + " provided."); + } + + arg = *it; + flag = arg->setBy(); + } + } + + return isRequired() && !arg; +} + +inline const std::string ArgGroup::getName() const { + std::string name; + std::string sep = "{"; // TODO: this should change for + // non-exclusive arg groups + for (const_iterator it = begin(); it != end(); ++it) { + name += sep + (*it)->getName(); + sep = " | "; + } + + return name + '}'; +} + +/// @internal +inline int CountVisibleArgs(const ArgGroup &g) { + int visible = 0; + for (ArgGroup::const_iterator it = g.begin(); it != g.end(); ++it) { + if ((*it)->visibleInHelp()) { + visible++; + } + } + + return visible; +} + +} // namespace TCLAP + +#endif // TCLAP_ARG_GROUP_H diff --git a/tclap/include/tclap/ArgOld.h b/tclap/include/tclap/ArgOld.h deleted file mode 100644 index 8abbeb9..0000000 --- a/tclap/include/tclap/ArgOld.h +++ /dev/null @@ -1,587 +0,0 @@ - -/****************************************************************************** - * - * file: Arg.h - * - * Copyright (c) 2003, Michael E. Smoot . - * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno . - * All rights reverved. - * - * 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, - * 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_ARGUMENT_H -#define TCLAP_ARGUMENT_H - -#include -#include -#include -#include - -#include -#include -#include - -namespace TCLAP { - -/** - * A virtual base class that defines the essential data for all arguments. - * This class, or one of its existing children, must be subclassed to do - * anything. - */ -class Arg -{ -private: - - /** - * Indicates whether the rest of the arguments should be ignored. - */ - static bool& ignoreRestRef() { static bool ign = false; return ign; } - - /** - * The delimiter that separates an argument flag/name from the - * value. - */ - static char& delimiterRef() { static char delim = ' '; return delim; } - -protected: - - /** - * The single char flag used to identify the argument. - * This value (preceded by a dash {-}), can be used to identify - * an argument on the command line. The _flag can be blank, - * in fact this is how unlabeled args work. Unlabeled args must - * override appropriate functions to get correct handling. Note - * that the _flag does NOT include the dash as part of the flag. - */ - std::string _flag; - - /** - * A single work namd indentifying the argument. - * This value (preceded by two dashed {--}) can also be used - * to identify an argument on the command line. Note that the - * _name does NOT include the two dashes as part of the _name. The - * _name cannot be blank. - */ - std::string _name; - - /** - * Description of the argument. - */ - std::string _description; - - /** - * Indicating whether the argument is required. - */ - bool _required; - - /** - * Label to be used in usage description. Normally set to - * "required", but can be changed when necessary. - */ - std::string _requireLabel; - - /** - * Indicates whether a value is required for the argument. - * Note that the value may be required but the argument/value - * combination may not be, as specified by _required. - */ - bool _valueRequired; - - /** - * Indicates whether the argument has been set. - * Indicates that a value on the command line has matched the - * name/flag of this argument and the values have been set accordingly. - */ - bool _alreadySet; - - /** - * A pointer to a vistitor object. - * The visitor allows special handling to occur as soon as the - * argument is matched. This defaults to NULL and should not - * be used unless absolutely necessary. - */ - Visitor* _visitor; - - /** - * Whether this argument can be ignored, if desired. - */ - bool _ignoreable; - - /** - * Indicates that the arg was set as part of an XOR and not on the - * command line. - */ - bool _xorSet; - - bool _acceptsMultipleValues; - - /** - * Performs the special handling described by the Vistitor. - */ - void _checkWithVisitor() const; - - /** - * Primary constructor. YOU (yes you) should NEVER construct an Arg - * directly, this is a base class that is extended by various children - * that are meant to be used. Use SwitchArg, ValueArg, MultiArg, - * UnlabeledValueArg, or UnlabeledMultiArg instead. - * - * \param flag - The flag identifying the argument. - * \param name - The name identifying the argument. - * \param desc - The description of the argument, used in the usage. - * \param req - Whether the argument is required. - * \param valreq - Whether the a value is required for the argument. - * \param v - The visitor checked by the argument. Defaults to NULL. - */ - Arg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - bool valreq, - Visitor* v = NULL ); - -public: - /** - * Destructor. - */ - virtual ~Arg(); - - /** - * Adds this to the specified list of Args. - * \param argList - The list to add this to. - */ - virtual void addToList( std::list& argList ) const; - - /** - * Begin ignoring arguments since the "--" argument was specified. - */ - static void beginIgnoring() { ignoreRestRef() = true; } - - /** - * Whether to ignore the rest. - */ - static bool ignoreRest() { return ignoreRestRef(); } - - /** - * The delimiter that separates an argument flag/name from the - * value. - */ - static char delimiter() { return delimiterRef(); } - - /** - * The char used as a place holder when SwitchArgs are combined. - * Currently set to '*', which shouldn't cause many problems since - * *'s are expanded by most shells on the command line. - */ - static const char blankChar() { return '*'; } - - /** - * The char that indicates the beginning of a flag. Currently '-'. - */ - static const char flagStartChar() { return '-'; } - - /** - * The sting that indicates the beginning of a flag. Currently "-". - * Should be identical to flagStartChar. - */ - static const std::string flagStartString() { return "-"; } - - /** - * The sting that indicates the beginning of a name. Currently "--". - * Should be flagStartChar twice. - */ - static const std::string nameStartString() { return "--"; } - - /** - * The name used to identify the ignore rest argument. - */ - static const std::string ignoreNameString() { return "ignore_rest"; } - - /** - * Sets the delimiter for all arguments. - * \param c - The character that delimits flags/names from values. - */ - static void setDelimiter( char c ) { delimiterRef() = c; } - - /** - * Pure virtual method meant to handle the parsing and value assignment - * of the string on the command line. - * \param i - Pointer the the current argument in the list. - * \param args - Mutable list of strings. What is - * passed in from main. - */ - virtual bool processArg(int *i, std::vector& args) = 0; - - /** - * Operator ==. - * Equality operator. Must be virtual to handle unlabeled args. - * \param a - The Arg to be compared to this. - */ - virtual bool operator==(const Arg& a) const; - - /** - * Returns the argument flag. - */ - const std::string& getFlag() const; - - /** - * Returns the argument name. - */ - const std::string& getName() const; - - /** - * Returns the argument description. - */ - std::string getDescription() const; - - /** - * Indicates whether the argument is required. - */ - virtual bool isRequired() const; - - /** - * Sets _required to true. This is used by the XorHandler. - * You really have no reason to ever use it. - */ - void forceRequired(); - - /** - * Sets the _alreadySet value to true. This is used by the XorHandler. - * You really have no reason to ever use it. - */ - void xorSet(); - - /** - * Indicates whether a value must be specified for argument. - */ - bool isValueRequired() const; - - /** - * Indicates whether the argument has already been set. Only true - * if the arg has been matched on the command line. - */ - bool isSet() const; - - /** - * Indicates whether the argument can be ignored, if desired. - */ - bool isIgnoreable() const; - - /** - * A method that tests whether a string matches this argument. - * This is generally called by the processArg() method. This - * method could be re-implemented by a child to change how - * arguments are specified on the command line. - * \param s - The string to be compared to the flag/name to determine - * whether the arg matches. - */ - virtual bool argMatches( const std::string& s ) const; - - /** - * Returns a simple string representation of the argument. - * Primarily for debugging. - */ - virtual std::string toString() const; - - /** - * Returns a short ID for the usage. - * \param valueId - The value used in the id. - */ - virtual std::string shortID( const std::string& valueId = "val" ) const; - - /** - * Returns a long ID for the usage. - * \param valueId - The value used in the id. - */ - virtual std::string longID( const std::string& valueId = "val" ) const; - - /** - * Trims a value off of the flag. - * \param flag - The string from which the flag and value will be - * trimmed. Contains the flag once the value has been trimmed. - * \param value - Where the value trimmed from the string will - * be stored. - */ - virtual void trimFlag( std::string& flag, std::string& value ) const; - - /** - * Checks whether a given string has blank chars, indicating that - * it is a combined SwitchArg. If so, return true, otherwise return - * false. - * \param s - string to be checked. - */ - bool _hasBlanks( const std::string& s ) const; - - /** - * Sets the requireLabel. Used by XorHandler. You shouldn't ever - * use this. - * \param s - Set the requireLabel to this value. - */ - void setRequireLabel( const std::string& s ); - - virtual bool allowMore(); - virtual void printXMLDescription() {} - virtual bool acceptsMultipleValues(); - -}; - -/** - * Typedef of an Arg list iterator. - */ -typedef std::list::iterator ArgListIterator; - -/** - * Typedef of an Arg vector iterator. - */ -typedef std::vector::iterator ArgVectorIterator; - -/** - * Typedef of a Visitor list iterator. - */ -typedef std::list::iterator VisitorListIterator; - - -////////////////////////////////////////////////////////////////////// -//BEGIN Arg.cpp -////////////////////////////////////////////////////////////////////// - -inline Arg::Arg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - bool valreq, - Visitor* v) : - _flag(flag), - _name(name), - _description(desc), - _required(req), - _requireLabel("required"), - _valueRequired(valreq), - _alreadySet(false), - _visitor( v ), - _ignoreable(true), - _xorSet(false), - _acceptsMultipleValues(false) -{ - if ( _flag.length() > 1 ) - throw(SpecificationException( - "Argument flag can only be one character long", toString() ) ); - - if ( _name != ignoreNameString() && - ( _flag == Arg::flagStartString() || - _flag == Arg::nameStartString() || - _flag == " " ) ) - throw(SpecificationException("Argument flag cannot be either '" + - Arg::flagStartString() + "' or '" + - Arg::nameStartString() + "' or a space.", - toString() ) ); - - if ( ( _name.find( Arg::flagStartString(), 0 ) != std::string::npos ) || - ( _name.find( Arg::nameStartString(), 0 ) != std::string::npos ) || - ( _name.find( " ", 0 ) != std::string::npos ) ) - throw(SpecificationException("Argument name cannot contain either '" + - Arg::flagStartString() + "' or '" + - Arg::nameStartString() + "' or space.", - toString() ) ); - -} - -inline Arg::~Arg() { } - -inline std::string Arg::shortID( const std::string& valueId ) const -{ - std::string id = ""; - - if ( _flag != "" ) - id = Arg::flagStartString() + _flag; - else - id = Arg::nameStartString() + _name; - - std::string delim = " "; - delim[0] = Arg::delimiter(); // ugly!!! - - if ( _valueRequired ) - id += delim + "<" + valueId + ">"; - - if ( !_required ) - id = "[" + id + "]"; - - return id; -} - -inline std::string Arg::longID( const std::string& valueId ) const -{ - std::string id = ""; - - if ( _flag != "" ) - { - id += Arg::flagStartString() + _flag; - - if ( _valueRequired ) - id += " <" + valueId + ">"; - - id += ", "; - } - - id += Arg::nameStartString() + _name; - - if ( _valueRequired ) - id += " <" + valueId + ">"; - - return id; - -} - -inline bool Arg::operator==(const Arg& a) const -{ - if ( ( _flag != "" && _flag == a._flag ) || _name == a._name) - return true; - else - return false; -} - -inline std::string Arg::getDescription() const -{ - std::string desc = ""; - if ( _required ) - desc = "(" + _requireLabel + ") "; - -// if ( _valueRequired ) -// desc += "(value required) "; - - desc += _description; - return desc; -} - -inline const std::string& Arg::getFlag() const { return _flag; } - -inline const std::string& Arg::getName() const { return _name; } - -inline bool Arg::isRequired() const { return _required; } - -inline bool Arg::isValueRequired() const { return _valueRequired; } - -inline bool Arg::isSet() const -{ - if ( _alreadySet && !_xorSet ) - return true; - else - return false; -} - -inline bool Arg::isIgnoreable() const { return _ignoreable; } - -inline void Arg::setRequireLabel( const std::string& s) -{ - _requireLabel = s; -} - -inline bool Arg::argMatches( const std::string& argFlag ) const -{ - if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) || - argFlag == Arg::nameStartString() + _name ) - return true; - else - return false; -} - -inline std::string Arg::toString() const -{ - std::string s = ""; - - if ( _flag != "" ) - s += Arg::flagStartString() + _flag + " "; - - s += "(" + Arg::nameStartString() + _name + ")"; - - return s; -} - -inline void Arg::_checkWithVisitor() const -{ - if ( _visitor != NULL ) - _visitor->visit(); -} - -/** - * Implementation of trimFlag. - */ -inline void Arg::trimFlag(std::string& flag, std::string& value) const -{ - int stop = 0; - for ( int i = 0; static_cast(i) < flag.length(); i++ ) - if ( flag[i] == Arg::delimiter() ) - { - stop = i; - break; - } - - if ( stop > 1 ) - { - value = flag.substr(stop+1); - flag = flag.substr(0,stop); - } - -} - -/** - * Implementation of _hasBlanks. - */ -inline bool Arg::_hasBlanks( const std::string& s ) const -{ - for ( int i = 1; static_cast(i) < s.length(); i++ ) - if ( s[i] == Arg::blankChar() ) - return true; - - return false; -} - -inline void Arg::forceRequired() -{ - _required = true; -} - -inline void Arg::xorSet() -{ - _alreadySet = true; - _xorSet = true; -} - -/** - * Overridden by Args that need to added to the end of the list. - */ -inline void Arg::addToList( std::list& argList ) const -{ - argList.push_front( const_cast(this) ); -} - -inline bool Arg::allowMore() -{ - return false; -} - -inline bool Arg::acceptsMultipleValues() -{ - return _acceptsMultipleValues; -} - -////////////////////////////////////////////////////////////////////// -//END Arg.cpp -////////////////////////////////////////////////////////////////////// - -} //namespace TCLAP - -#endif - diff --git a/tclap/include/tclap/ArgTraits.h b/tclap/include/tclap/ArgTraits.h index 0ccf5e3..dbd0599 100644 --- a/tclap/include/tclap/ArgTraits.h +++ b/tclap/include/tclap/ArgTraits.h @@ -24,8 +24,8 @@ // This is an internal tclap file, you should probably not have to // include this directly -#ifndef TCLAP_ARGTRAITS_H -#define TCLAP_ARGTRAITS_H +#ifndef TCLAP_ARG_TRAITS_H +#define TCLAP_ARG_TRAITS_H namespace TCLAP { @@ -38,7 +38,7 @@ namespace TCLAP { */ struct ValueLike { typedef ValueLike ValueCategory; - virtual ~ValueLike() {} + virtual ~ValueLike() {} }; /** @@ -47,7 +47,7 @@ struct ValueLike { * will be broken up into individual tokens by operator>>. */ struct StringLike { - virtual ~StringLike() {} + virtual ~StringLike() {} }; /** @@ -57,7 +57,7 @@ struct StringLike { */ struct StringLikeTrait { typedef StringLike ValueCategory; - virtual ~StringLikeTrait() {} + virtual ~StringLikeTrait() {} }; /** @@ -67,7 +67,7 @@ struct StringLikeTrait { */ struct ValueLikeTrait { typedef ValueLike ValueCategory; - virtual ~ValueLikeTrait() {} + virtual ~ValueLikeTrait() {} }; /** @@ -78,45 +78,46 @@ struct ValueLikeTrait { * default and means that operator>> will be used to assign values to * the type. */ -template +template 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(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 static short test(typename C::ValueCategory*); - template static long test(...); - static const bool hasTrait = sizeof(test(0)) == sizeof(short); - - template - struct DefaultArgTrait { - typedef ValueLike ValueCategory; - }; - - template - struct DefaultArgTrait { - typedef typename C::ValueCategory ValueCategory; - }; + // 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(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 + static short test(typename C::ValueCategory *); // NOLINT + template + static long test(...); // NOLINT + static const bool hasTrait = sizeof(test(0)) == sizeof(short); // NOLINT + + template + struct DefaultArgTrait { + typedef ValueLike ValueCategory; + }; + + template + struct DefaultArgTrait { + typedef typename C::ValueCategory ValueCategory; + }; public: - typedef typename DefaultArgTrait::ValueCategory ValueCategory; + typedef typename DefaultArgTrait::ValueCategory ValueCategory; }; -} // namespace - -#endif +} // namespace TCLAP +#endif // TCLAP_ARG_TRAITS_H diff --git a/tclap/include/tclap/CMakeLists.txt b/tclap/include/tclap/CMakeLists.txt new file mode 100644 index 0000000..79bad0b --- /dev/null +++ b/tclap/include/tclap/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB HEADER_FILES *.h) + +#target_sources(TCLAP INTERFACE ${HEADER_FILES}) +install(FILES ${HEADER_FILES} DESTINATION include/tclap COMPONENT lib) diff --git a/tclap/include/tclap/CmdLine.h b/tclap/include/tclap/CmdLine.h index be78985..8a53c07 100644 --- a/tclap/include/tclap/CmdLine.h +++ b/tclap/include/tclap/CmdLine.h @@ -6,6 +6,7 @@ * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. + * Copyright (c) 2018, Google LLC * All rights reserved. * * See the file COPYING in the top directory of this distribution for @@ -21,18 +22,17 @@ * *****************************************************************************/ -#ifndef TCLAP_CMDLINE_H -#define TCLAP_CMDLINE_H +#ifndef TCLAP_CMD_LINE_H +#define TCLAP_CMD_LINE_H -#include #include -#include +#include #include +#include -#include #include -#include #include +#include #include #include @@ -40,612 +40,572 @@ #include #include +#include +#include + +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include // Needed for exit(), which isn't defined in some envs. namespace TCLAP { -template void DelPtr(T ptr) -{ - delete ptr; -} +class StandaloneArgs : public AnyOf { +public: + StandaloneArgs() {} -template void ClearContainer(C &c) -{ - typedef typename C::value_type value_type; - std::for_each(c.begin(), c.end(), DelPtr); - c.clear(); -} + ArgContainer &add(Arg *arg) { + // std::cerr << "Adding " << arg->getName() << " to StandaloneArgs\n"; + for (iterator it = begin(); it != end(); it++) { + if (*arg == **it) { + throw SpecificationException( + "Argument with same flag/name already exists!", + arg->longID()); + } + } + _args.push_back(arg); + + return *this; + } + + bool showAsGroup() const { return false; } +}; /** * The base class that manages the command line definition and passes * along the parsing to the appropriate Arg classes. */ -class CmdLine : public CmdLineInterface -{ - protected: - - /** - * The list of arguments that will be tested against the - * command line. - */ - std::list _argList; - - /** - * The name of the program. Set to argv[0]. - */ - std::string _progName; - - /** - * A message used to describe the program. Used in the usage output. - */ - std::string _message; - - /** - * The version to be displayed with the --version switch. - */ - std::string _version; - - /** - * The number of arguments that are required to be present on - * the command line. This is set dynamically, based on the - * Args added to the CmdLine object. - */ - int _numRequired; - - /** - * The character that is used to separate the argument flag/name - * from the value. Defaults to ' ' (space). - */ - char _delimiter; - - /** - * The handler that manages xoring lists of args. - */ - XorHandler _xorHandler; - - /** - * A list of Args to be explicitly deleted when the destructor - * is called. At the moment, this only includes the three default - * Args. - */ - std::list _argDeleteOnExitList; - - /** - * A list of Visitors to be explicitly deleted when the destructor - * is called. At the moment, these are the Visitors created for the - * default Args. - */ - std::list _visitorDeleteOnExitList; - - /** - * Object that handles all output for the CmdLine. - */ - CmdLineOutput* _output; - - /** - * Should CmdLine handle parsing exceptions internally? - */ - bool _handleExceptions; - - /** - * Throws an exception listing the missing args. - */ - void missingArgsException(); - - /** - * Checks whether a name/flag string matches entirely matches - * the Arg::blankChar. Used when multiple switches are combined - * into a single argument. - * \param s - The message to be used in the usage. - */ - bool _emptyCombined(const std::string& s); - - /** - * Perform a delete ptr; operation on ptr when this object is deleted. - */ - void deleteOnExit(Arg* ptr); - - /** - * Perform a delete ptr; operation on ptr when this object is deleted. - */ - void deleteOnExit(Visitor* ptr); +class CmdLine : public CmdLineInterface { +protected: + /** + * The list of arguments that will be tested against the + * command line. + */ + std::list _argList; + + StandaloneArgs _standaloneArgs; + StandaloneArgs _autoArgs; // --help, --version, etc + + /** + * Some args have set constraints on them (i.e., exactly or at + * most one must be specified. + */ + std::list _argGroups; + + /** + * The name of the program. Set to argv[0]. + */ + std::string _progName; + + /** + * A message used to describe the program. Used in the usage output. + */ + std::string _message; + + /** + * The version to be displayed with the --version switch. + */ + std::string _version; + + /** + * The number of arguments that are required to be present on + * the command line. This is set dynamically, based on the + * Args added to the CmdLine object. + */ + int _numRequired; + + /** + * The character that is used to separate the argument flag/name + * from the value. Defaults to ' ' (space). + */ + char _delimiter; + + /** + * Add pointers that should be deleted as part of cleanup when + * this object is destroyed. + * @internal. + */ + DeferDelete _deleteOnExit; + + /** + * Default output handler if nothing is specified. + */ + StdOutput _defaultOutput; + + /** + * Object that handles all output for the CmdLine. + */ + CmdLineOutput *_output; + + /** + * Should CmdLine handle parsing exceptions internally? + */ + bool _handleExceptions; + + /** + * Throws an exception listing the missing args. + */ + void missingArgsException(const std::list &missing); + + /** + * Checks whether a name/flag string matches entirely matches + * the Arg::blankChar. Used when multiple switches are combined + * into a single argument. + * \param s - The message to be used in the usage. + */ + bool _emptyCombined(const std::string &s); private: - - /** - * Prevent accidental copying. - */ - CmdLine(const CmdLine& rhs); - CmdLine& operator=(const CmdLine& rhs); - - /** - * Encapsulates the code common to the constructors - * (which is all of it). - */ - void _constructor(); - - - /** - * Is set to true when a user sets the output object. We use this so - * that we don't delete objects that are created outside of this lib. - */ - bool _userSetOutput; - - /** - * Whether or not to automatically create help and version switches. - */ - bool _helpAndVersion; - - /** - * Whether or not to ignore unmatched args. - */ - bool _ignoreUnmatched; - - public: - - /** - * Command line constructor. Defines how the arguments will be - * parsed. - * \param message - The message to be used in the usage - * output. - * \param delimiter - The character that is used to separate - * the argument flag/name from the value. Defaults to ' ' (space). - * \param version - The version number to be used in the - * --version switch. - * \param helpAndVersion - Whether or not to create the Help and - * Version switches. Defaults to true. - */ - CmdLine(const std::string& message, - const char delimiter = ' ', - const std::string& version = "none", - bool helpAndVersion = true); - - /** - * Deletes any resources allocated by a CmdLine object. - */ - virtual ~CmdLine(); - - /** - * Adds an argument to the list of arguments to be parsed. - * \param a - Argument to be added. - */ - void add( Arg& a ); - - /** - * An alternative add. Functionally identical. - * \param a - Argument to be added. - */ - void add( Arg* a ); - - /** - * Add two Args that will be xor'd. If this method is used, add does - * not need to be called. - * \param a - Argument to be added and xor'd. - * \param b - Argument to be added and xor'd. - */ - void xorAdd( Arg& a, Arg& b ); - - /** - * Add a list of Args that will be xor'd. If this method is used, - * add does not need to be called. - * \param xors - List of Args to be added and xor'd. - */ - void xorAdd( const std::vector& xors ); - - /** - * Parses the command line. - * \param argc - Number of arguments. - * \param argv - Array of arguments. - */ - void parse(int argc, const char * const * argv); - - /** - * Parses the command line. - * \param args - A vector of strings representing the args. - * args[0] is still the program name. - */ - void parse(std::vector& args); - - /** - * - */ - CmdLineOutput* getOutput(); - - /** - * - */ - void setOutput(CmdLineOutput* co); - - /** - * - */ - std::string& getVersion(); - - /** - * - */ - std::string& getProgramName(); - - /** - * - */ - std::list& getArgList(); - - /** - * - */ - XorHandler& getXorHandler(); - - /** - * - */ - char getDelimiter(); - - /** - * - */ - std::string& getMessage(); - - /** - * - */ - bool hasHelpAndVersion(); - - /** - * Disables or enables CmdLine's internal parsing exception handling. - * - * @param state Should CmdLine handle parsing exceptions internally? - */ - void setExceptionHandling(const bool state); - - /** - * Returns the current state of the internal exception handling. - * - * @retval true Parsing exceptions are handled internally. - * @retval false Parsing exceptions are propagated to the caller. - */ - bool getExceptionHandling() const; - - /** - * Allows the CmdLine object to be reused. - */ - 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); + /** + * Prevent accidental copying. + */ + CmdLine(const CmdLine &rhs); + CmdLine &operator=(const CmdLine &rhs); + + /** + * Encapsulates the code common to the constructors + * (which is all of it). + */ + void _constructor(); + + /** + * Whether or not to automatically create help and version switches. + */ + bool _helpAndVersion; + + /** + * Whether or not to ignore unmatched args. + */ + bool _ignoreUnmatched; + + /** + * Ignoring arguments (e.g., after we have seen "--") + */ + bool _ignoring; + +public: + /** + * Command line constructor. Defines how the arguments will be + * parsed. + * \param message - The message to be used in the usage + * output. + * \param delimiter - The character that is used to separate + * the argument flag/name from the value. Defaults to ' ' (space). + * \param version - The version number to be used in the + * --version switch. + * \param helpAndVersion - Whether or not to create the Help and + * Version switches. Defaults to true. + */ + CmdLine(const std::string &message, const char delimiter = ' ', + const std::string &version = "none", bool helpAndVersion = true); + + /** + * Deletes any resources allocated by a CmdLine object. + */ + virtual ~CmdLine() {} + + /** + * Adds an argument to the list of arguments to be parsed. + * + * @param a - Argument to be added. + * @retval A reference to this so that add calls can be chained + */ + ArgContainer &add(Arg &a); + + /** + * An alternative add. Functionally identical. + * + * @param a - Argument to be added. + * @retval A reference to this so that add calls can be chained + */ + ArgContainer &add(Arg *a); + + /** + * Adds an argument group to the list of arguments to be parsed. + * + * All arguments in the group are added and the ArgGroup + * object will validate that the input matches its + * constraints. + * + * @param args - Argument group to be added. + * @retval A reference to this so that add calls can be chained + */ + ArgContainer &add(ArgGroup &args); + + // Internal, do not use + void addToArgList(Arg *a); + + /** + * \deprecated Use OneOf instead. + */ + void xorAdd(Arg &a, Arg &b); + + /** + * \deprecated Use OneOf instead. + */ + void xorAdd(const std::vector &xors); + + /** + * Parses the command line. + * \param argc - Number of arguments. + * \param argv - Array of arguments. + */ + void parse(int argc, const char *const *argv); + + /** + * Parses the command line. + * \param args - A vector of strings representing the args. + * args[0] is still the program name. + */ + void parse(std::vector &args); + + void setOutput(CmdLineOutput *co); + + std::string getVersion() const { return _version; } + + std::string getProgramName() const { return _progName; } + + // TOOD: Get rid of getArgList + std::list getArgList() const { return _argList; } + std::list getArgGroups() { + std::list groups = _argGroups; + groups.push_back(&_autoArgs); + return groups; + } + + char getDelimiter() const { return _delimiter; } + std::string getMessage() const { return _message; } + bool hasHelpAndVersion() const { return _helpAndVersion; } + + /** + * Disables or enables CmdLine's internal parsing exception handling. + * + * @param state Should CmdLine handle parsing exceptions internally? + */ + void setExceptionHandling(const bool state); + + /** + * Returns the current state of the internal exception handling. + * + * @retval true Parsing exceptions are handled internally. + * @retval false Parsing exceptions are propagated to the caller. + */ + bool hasExceptionHandling() const { return _handleExceptions; } + + /** + * Allows the CmdLine object to be reused. + */ + 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); + + void beginIgnoring() { _ignoring = true; } + bool ignoreRest() { return _ignoring; } }; - /////////////////////////////////////////////////////////////////////////////// -//Begin CmdLine.cpp +// Begin CmdLine.cpp /////////////////////////////////////////////////////////////////////////////// -inline CmdLine::CmdLine(const std::string& m, - char delim, - const std::string& v, - bool help ) - : - _argList(std::list()), - _progName("not_set_yet"), - _message(m), - _version(v), - _numRequired(0), - _delimiter(delim), - _xorHandler(XorHandler()), - _argDeleteOnExitList(std::list()), - _visitorDeleteOnExitList(std::list()), - _output(0), - _handleExceptions(true), - _userSetOutput(false), - _helpAndVersion(help), - _ignoreUnmatched(false) -{ - _constructor(); +inline CmdLine::CmdLine(const std::string &m, char delim, const std::string &v, + bool help) + : _argList(), + _standaloneArgs(), + _autoArgs(), + _argGroups(), + _progName("not_set_yet"), + _message(m), + _version(v), + _numRequired(0), + _delimiter(delim), + _deleteOnExit(), + _defaultOutput(), + _output(&_defaultOutput), + _handleExceptions(true), + _helpAndVersion(help), + _ignoreUnmatched(false), + _ignoring(false) { + _constructor(); } -inline CmdLine::~CmdLine() -{ - ClearContainer(_argDeleteOnExitList); - ClearContainer(_visitorDeleteOnExitList); - - if ( !_userSetOutput ) { - delete _output; - _output = 0; - } -} - -inline void CmdLine::_constructor() -{ - _output = new StdOutput; - - Arg::setDelimiter( _delimiter ); - - Visitor* v; - - if ( _helpAndVersion ) - { - v = new HelpVisitor( this, &_output ); - SwitchArg* help = new SwitchArg("h","help", - "Displays usage information and exits.", - false, v); - add( help ); - deleteOnExit(help); - deleteOnExit(v); - - v = new VersionVisitor( this, &_output ); - SwitchArg* vers = new SwitchArg("","version", - "Displays version information and exits.", - false, v); - add( vers ); - deleteOnExit(vers); - deleteOnExit(v); - } - - v = new IgnoreRestVisitor(); - SwitchArg* ignore = new SwitchArg(Arg::flagStartString(), - Arg::ignoreNameString(), - "Ignores the rest of the labeled arguments following this flag.", - false, v); - add( ignore ); - deleteOnExit(ignore); - deleteOnExit(v); +inline void CmdLine::_constructor() { + Arg::setDelimiter(_delimiter); + + Visitor *v; + CmdLine::add(_standaloneArgs); + _autoArgs.setParser(*this); + // add(_autoArgs); + + v = new IgnoreRestVisitor(*this); + SwitchArg *ignore = new SwitchArg( + Arg::flagStartString(), Arg::ignoreNameString(), + "Ignores the rest of the labeled arguments following this flag.", false, + v); + _deleteOnExit(ignore); + _deleteOnExit(v); + _autoArgs.add(ignore); + CmdLine::addToArgList(ignore); + + if (_helpAndVersion) { + v = new HelpVisitor(this, &_output); + SwitchArg *help = new SwitchArg( + "h", "help", "Displays usage information and exits.", false, v); + _deleteOnExit(help); + _deleteOnExit(v); + + v = new VersionVisitor(this, &_output); + SwitchArg *vers = new SwitchArg( + "", "version", "Displays version information and exits.", false, v); + _deleteOnExit(vers); + _deleteOnExit(v); + + // A bit of a hack on the order to make tests easier to fix, + // to be reverted + _autoArgs.add(vers); + CmdLine::addToArgList(vers); + _autoArgs.add(help); + CmdLine::addToArgList(help); + } } -inline void CmdLine::xorAdd( const std::vector& ors ) -{ - _xorHandler.add( ors ); +inline void CmdLine::xorAdd(const std::vector &args) { + OneOf *group = new OneOf(*this); + _deleteOnExit(group); - for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) - { - (*it)->forceRequired(); - (*it)->setRequireLabel( "OR required" ); - add( *it ); - } + for (std::vector::const_iterator it = args.begin(); it != args.end(); + ++it) { + group->add(**it); + } } -inline void CmdLine::xorAdd( Arg& a, Arg& b ) -{ - std::vector ors; - ors.push_back( &a ); - ors.push_back( &b ); - xorAdd( ors ); +inline void CmdLine::xorAdd(Arg &a, Arg &b) { + std::vector ors; + ors.push_back(&a); + ors.push_back(&b); + xorAdd(ors); } -inline void CmdLine::add( Arg& a ) -{ - add( &a ); -} - -inline void CmdLine::add( Arg* a ) -{ - for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) - if ( *a == *(*it) ) - throw( SpecificationException( - "Argument with same flag/name already exists!", - a->longID() ) ); - - a->addToList( _argList ); - - if ( a->isRequired() ) - _numRequired++; -} - - -inline void CmdLine::parse(int argc, const char * const * argv) -{ - // this step is necessary so that we have easy access to - // mutable strings. - std::vector args; - for (int i = 0; i < argc; i++) - args.push_back(argv[i]); - - parse(args); -} +inline ArgContainer &CmdLine::add(ArgGroup &args) { + args.setParser(*this); + _argGroups.push_back(&args); -inline void CmdLine::parse(std::vector& args) -{ - bool shouldExit = false; - int estat = 0; - - try { - _progName = args.front(); - args.erase(args.begin()); - - int requiredCount = 0; - - for (int i = 0; static_cast(i) < args.size(); i++) - { - bool matched = false; - for (ArgListIterator it = _argList.begin(); - it != _argList.end(); it++) { - if ( (*it)->processArg( &i, args ) ) - { - requiredCount += _xorHandler.check( *it ); - matched = true; - break; - } - } - - // checks to see if the argument is an empty combined - // switch and if so, then we've actually matched it - if ( !matched && _emptyCombined( args[i] ) ) - matched = true; - - if ( !matched && !Arg::ignoreRest() && !_ignoreUnmatched) - throw(CmdLineParseException("Couldn't find match " - "for argument", - args[i])); - } - - if ( requiredCount < _numRequired ) - missingArgsException(); - - if ( requiredCount > _numRequired ) - throw(CmdLineParseException("Too many arguments!")); - - } catch ( ArgException& e ) { - // If we're not handling the exceptions, rethrow. - if ( !_handleExceptions) { - throw; - } - - try { - _output->failure(*this,e); - } catch ( ExitException &ee ) { - estat = ee.getExitStatus(); - shouldExit = true; - } - } catch (ExitException &ee) { - // If we're not handling the exceptions, rethrow. - if ( !_handleExceptions) { - throw; - } - - estat = ee.getExitStatus(); - shouldExit = true; - } - - if (shouldExit) - exit(estat); + return *this; } -inline bool CmdLine::_emptyCombined(const std::string& s) -{ - if ( s.length() > 0 && s[0] != Arg::flagStartChar() ) - return false; +inline ArgContainer &CmdLine::add(Arg &a) { return add(&a); } - for ( int i = 1; static_cast(i) < s.length(); i++ ) - if ( s[i] != Arg::blankChar() ) - return false; +// TODO: Rename this to something smarter or refactor this logic so +// it's not needed. +inline void CmdLine::addToArgList(Arg *a) { + for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) + if (*a == *(*it)) + throw(SpecificationException( + "Argument with same flag/name already exists!", a->longID())); - return true; -} + a->addToList(_argList); -inline void CmdLine::missingArgsException() -{ - int count = 0; - - std::string missingArgList; - for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) - { - if ( (*it)->isRequired() && !(*it)->isSet() ) - { - missingArgList += (*it)->getName(); - missingArgList += ", "; - count++; - } - } - missingArgList = missingArgList.substr(0,missingArgList.length()-2); - - std::string msg; - if ( count > 1 ) - msg = "Required arguments missing: "; - else - msg = "Required argument missing: "; - - msg += missingArgList; - - throw(CmdLineParseException(msg)); + if (a->isRequired()) _numRequired++; } -inline void CmdLine::deleteOnExit(Arg* ptr) -{ - _argDeleteOnExitList.push_back(ptr); -} +inline ArgContainer &CmdLine::add(Arg *a) { + addToArgList(a); + _standaloneArgs.add(a); -inline void CmdLine::deleteOnExit(Visitor* ptr) -{ - _visitorDeleteOnExitList.push_back(ptr); + return *this; } -inline CmdLineOutput* CmdLine::getOutput() -{ - return _output; -} +inline void CmdLine::parse(int argc, const char *const *argv) { + // this step is necessary so that we have easy access to + // mutable strings. + std::vector args; + for (int i = 0; i < argc; i++) args.push_back(argv[i]); -inline void CmdLine::setOutput(CmdLineOutput* co) -{ - if ( !_userSetOutput ) - delete _output; - _userSetOutput = true; - _output = co; + parse(args); } -inline std::string& CmdLine::getVersion() -{ - return _version; +inline void CmdLine::parse(std::vector &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."); + } + + // TODO(macbishop): Maybe store the full name somewhere? + _progName = basename(args.front()); + args.erase(args.begin()); + + int requiredCount = 0; + std::list missingArgGroups; + + // Check that the right amount of arguments are provided for + // each ArgGroup, and if there are any required arguments + // missing, store them for later. Other errors will cause an + // exception to be thrown and parse will exit early. + /* + for (std::list::iterator it = _argGroups.begin(); + it != _argGroups.end(); ++it) { + bool missingRequired = (*it)->validate(args); + if (missingRequired) { + missingArgGroups.push_back(*it); + } + } + */ + + for (int i = 0; static_cast(i) < args.size(); i++) { + bool matched = false; + for (ArgListIterator it = _argList.begin(); it != _argList.end(); + it++) { + Arg &arg = **it; + // We check if the argument was already set (e.g., for + // a Multi-Arg) since then we don't want to count it + // as required again. This is a hack/workaround to + // make isRequired() imutable so it can be used to + // display help correctly (also it's a good idea). + // + // TODO: This logic should probably be refactored to + // remove this logic from here. + bool alreadySet = arg.isSet(); + bool ignore = arg.isIgnoreable() && ignoreRest(); + if (!ignore && arg.processArg(&i, args)) { + requiredCount += (!alreadySet && arg.isRequired()) ? 1 : 0; + matched = true; + break; + } + } + + // checks to see if the argument is an empty combined + // switch and if so, then we've actually matched it + if (!matched && _emptyCombined(args[i])) matched = true; + + if (!matched && !ignoreRest() && !_ignoreUnmatched) + throw( + CmdLineParseException("Couldn't find match " + "for argument", + args[i])); + } + + // Once all arguments have been parsed, check that we don't + // violate any constraints. + for (std::list::iterator it = _argGroups.begin(); + it != _argGroups.end(); ++it) { + bool missingRequired = (*it)->validate(); + if (missingRequired) { + missingArgGroups.push_back(*it); + } + } + + if (requiredCount < _numRequired || !missingArgGroups.empty()) { + missingArgsException(missingArgGroups); + } + + if (requiredCount > _numRequired) { + throw(CmdLineParseException("Too many arguments!")); + } + } catch (ArgException &e) { + // If we're not handling the exceptions, rethrow. + if (!_handleExceptions) { + throw; + } + + try { + _output->failure(*this, e); + } catch (ExitException &ee) { + estat = ee.getExitStatus(); + shouldExit = true; + } + } catch (ExitException &ee) { + // If we're not handling the exceptions, rethrow. + if (!_handleExceptions) { + throw; + } + + estat = ee.getExitStatus(); + shouldExit = true; + } + + if (shouldExit) exit(estat); } -inline std::string& CmdLine::getProgramName() -{ - return _progName; -} +inline bool CmdLine::_emptyCombined(const std::string &s) { + if (s.length() > 0 && s[0] != Arg::flagStartChar()) return false; -inline std::list& CmdLine::getArgList() -{ - return _argList; -} + for (int i = 1; static_cast(i) < s.length(); i++) + if (s[i] != Arg::blankChar()) return false; -inline XorHandler& CmdLine::getXorHandler() -{ - return _xorHandler; + return true; } -inline char CmdLine::getDelimiter() -{ - return _delimiter; +inline void CmdLine::missingArgsException( + const std::list &missing) { + int count = 0; + + std::string missingArgList; + for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) { + if ((*it)->isRequired() && !(*it)->isSet()) { + missingArgList += (*it)->getName(); + missingArgList += ", "; + count++; + } + } + + for (std::list::const_iterator it = missing.begin(); + it != missing.end(); it++) { + missingArgList += (*it)->getName(); + missingArgList += ", "; + count++; + } + + missingArgList = missingArgList.substr(0, missingArgList.length() - 2); + + std::string msg; + if (count > 1) + msg = "Required arguments missing: "; + else + msg = "Required argument missing: "; + + msg += missingArgList; + + throw(CmdLineParseException(msg)); } -inline std::string& CmdLine::getMessage() -{ - return _message; -} +inline void CmdLine::setOutput(CmdLineOutput *co) { _output = co; } -inline bool CmdLine::hasHelpAndVersion() -{ - return _helpAndVersion; +inline void CmdLine::setExceptionHandling(const bool state) { + _handleExceptions = state; } -inline void CmdLine::setExceptionHandling(const bool state) -{ - _handleExceptions = state; -} +inline void CmdLine::reset() { + // TODO: This is no longer correct (or perhaps we don't need "reset") + for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++) + (*it)->reset(); -inline bool CmdLine::getExceptionHandling() const -{ - return _handleExceptions; + _progName.clear(); } -inline void CmdLine::reset() -{ - for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ ) - (*it)->reset(); - - _progName.clear(); -} - -inline void CmdLine::ignoreUnmatched(const bool ignore) -{ - _ignoreUnmatched = ignore; +inline void CmdLine::ignoreUnmatched(const bool ignore) { + _ignoreUnmatched = ignore; } /////////////////////////////////////////////////////////////////////////////// -//End CmdLine.cpp +// End CmdLine.cpp /////////////////////////////////////////////////////////////////////////////// +} // namespace TCLAP - -} //namespace TCLAP -#endif +#endif // TCLAP_CMD_LINE_H diff --git a/tclap/include/tclap/CmdLineInterface.h b/tclap/include/tclap/CmdLineInterface.h index a9bdca0..1535684 100644 --- a/tclap/include/tclap/CmdLineInterface.h +++ b/tclap/include/tclap/CmdLineInterface.h @@ -1,10 +1,9 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** - * +/****************************************************************************** + * * file: CmdLineInterface.h - * + * * Copyright (c) 2003, Michael E. Smoot . * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. * Copyright (c) 2017, Google LLC @@ -12,142 +11,156 @@ * * 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, - * 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_COMMANDLINE_INTERFACE_H -#define TCLAP_COMMANDLINE_INTERFACE_H + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_CMD_LINE_INTERFACE_H +#define TCLAP_CMD_LINE_INTERFACE_H +#include + +#include +#include +#include #include #include -#include -#include -#include - namespace TCLAP { - + class Arg; +class ArgGroup; class CmdLineOutput; -class XorHandler; /** * The base class that manages the command line definition and passes * along the parsing to the appropriate Arg classes. */ -class CmdLineInterface -{ - public: - - /** - * Destructor - */ - virtual ~CmdLineInterface() {} - - /** - * Adds an argument to the list of arguments to be parsed. - * \param a - Argument to be added. - */ - virtual void add( Arg& a )=0; - - /** - * An alternative add. Functionally identical. - * \param a - Argument to be added. - */ - virtual void add( Arg* a )=0; - - /** - * Add two Args that will be xor'd. - * If this method is used, add does - * not need to be called. - * \param a - Argument to be added and xor'd. - * \param b - Argument to be added and xor'd. - */ - virtual void xorAdd( Arg& a, Arg& b )=0; - - /** - * Add a list of Args that will be xor'd. If this method is used, - * add does not need to be called. - * \param xors - List of Args to be added and xor'd. - */ - virtual void xorAdd( const std::vector& xors )=0; - - /** - * Parses the command line. - * \param argc - Number of arguments. - * \param argv - Array of arguments. - */ - virtual void parse(int argc, const char * const * argv)=0; - - /** - * Parses the command line. - * \param args - A vector of strings representing the args. - * args[0] is still the program name. - */ - void parse(std::vector& args); - - /** - * Returns the CmdLineOutput object. - */ - virtual CmdLineOutput* getOutput()=0; - - /** - * \param co - CmdLineOutput object that we want to use instead. - */ - virtual void setOutput(CmdLineOutput* co)=0; - - /** - * Returns the version string. - */ - virtual std::string& getVersion()=0; - - /** - * Returns the program name string. - */ - virtual std::string& getProgramName()=0; - - /** - * Returns the argList. - */ - virtual std::list& getArgList()=0; - - /** - * Returns the XorHandler. - */ - virtual XorHandler& getXorHandler()=0; - - /** - * Returns the delimiter string. - */ - virtual char getDelimiter()=0; - - /** - * Returns the message string. - */ - virtual std::string& getMessage()=0; - - /** - * Indicates whether or not the help and version switches were created - * automatically. - */ - virtual bool hasHelpAndVersion()=0; - - /** - * Resets the instance as if it had just been constructed so that the - * instance can be reused. - */ - virtual void reset()=0; +class CmdLineInterface : public ArgContainer { +public: + /** + * Destructor + */ + virtual ~CmdLineInterface() {} + + /** + * Adds an argument. Ownership is not transfered. + * @param a - Argument to be added. + * @retval A reference to this so that add calls can be chained + */ + virtual ArgContainer &add(Arg &a) = 0; + + /** + * Adds an argument. Ownership is not transfered. + * @param a - Argument to be added. + * @retval A reference to this so that add calls can be chained + */ + virtual ArgContainer &add(Arg *a) = 0; + + // TODO: Rename this to something smarter or refactor this logic so + // it's not needed. + // Internal - do not use + virtual void addToArgList(Arg *a) = 0; + + /** + * Adds an argument group to the list of arguments to be parsed. + * + * All arguments in the group are added and the ArgGroup + * object will validate that the input matches its + * constraints. + * + * @param args - Argument group to be added. + * @retval A reference to this so that add calls can be chained + */ + virtual ArgContainer &add(ArgGroup &args) = 0; + + /** + * \deprecated Use OneOf instead. + */ + virtual void xorAdd(Arg &a, Arg &b) = 0; + + /** + * \deprecated Use OneOf instead. + */ + virtual void xorAdd(const std::vector &xors) = 0; + + /** + * Parses the command line. + * \param argc - Number of arguments. + * \param argv - Array of arguments. + */ + virtual void parse(int argc, const char *const *argv) = 0; + + /** + * Parses the command line. + * \param args - A vector of strings representing the args. + * args[0] is still the program name. + */ + void parse(std::vector &args); + + /** + * \param co - CmdLineOutput object that we want to use instead. + */ + virtual void setOutput(CmdLineOutput *co) = 0; + + /** + * Returns the version string. + */ + virtual std::string getVersion() const = 0; + + /** + * Returns the program name string. + */ + virtual std::string getProgramName() const = 0; + + /** + * Returns the list of ArgGroups. + */ + virtual std::list getArgGroups() = 0; + virtual std::list getArgList() const = 0; // TODO: get rid of this + + /** + * Returns the delimiter string. + */ + virtual char getDelimiter() const = 0; + + /** + * Returns the message string. + */ + virtual std::string getMessage() const = 0; + + /** + * Indicates whether or not the help and version switches were created + * automatically. + */ + virtual bool hasHelpAndVersion() const = 0; + + /** + * Resets the instance as if it had just been constructed so that the + * instance can be reused. + */ + virtual void reset() = 0; + + /** + * Begin ignoring arguments since the "--" argument was specified. + * \internal + */ + virtual void beginIgnoring() = 0; + + /** + * Whether to ignore the rest. + * \internal + */ + virtual bool ignoreRest() = 0; }; -} //namespace - +} // namespace TCLAP -#endif +#endif // TCLAP_CMD_LINE_INTERFACE_H diff --git a/tclap/include/tclap/CmdLineOutput.h b/tclap/include/tclap/CmdLineOutput.h index cbc9a32..c44ee2c 100644 --- a/tclap/include/tclap/CmdLineOutput.h +++ b/tclap/include/tclap/CmdLineOutput.h @@ -1,39 +1,47 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - -/****************************************************************************** - * +/****************************************************************************** + * * 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 * 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, - * 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_CMDLINEOUTPUT_H -#define TCLAP_CMDLINEOUTPUT_H + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_CMD_LINE_OUTPUT_H +#define TCLAP_CMD_LINE_OUTPUT_H +#include +#include + +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include namespace TCLAP { +const char PATH_SEPARATOR = +#ifdef _WIN32 + '\\'; +#else + '/'; +#endif class CmdLineInterface; class ArgException; @@ -41,37 +49,73 @@ class ArgException; /** * The interface that any output object must implement. */ -class CmdLineOutput -{ - - public: - - /** - * Virtual destructor. - */ - virtual ~CmdLineOutput() {} - - /** - * Generates some sort of output for the USAGE. - * \param c - The CmdLine object the output is generated for. - */ - virtual void usage(CmdLineInterface& c)=0; - - /** - * Generates some sort of output for the version. - * \param c - The CmdLine object the output is generated for. - */ - virtual void version(CmdLineInterface& c)=0; - - /** - * Generates some sort of output for a failure. - * \param c - The CmdLine object the output is generated for. - * \param e - The ArgException that caused the failure. - */ - virtual void failure( CmdLineInterface& c, - ArgException& e )=0; +class CmdLineOutput { +public: + /** + * Virtual destructor. + */ + virtual ~CmdLineOutput() {} + + /** + * Generates some sort of output for the USAGE. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface &c) = 0; + + /** + * Generates some sort of output for the version. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface &c) = 0; + /** + * Generates some sort of output for a failure. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface &c, ArgException &e) = 0; }; -} //namespace TCLAP -#endif +inline bool isInArgGroup(const Arg *arg, const std::list &argSets) { + for (std::list::const_iterator it = argSets.begin(); + it != argSets.end(); ++it) { + if (std::find((*it)->begin(), (*it)->end(), arg) != (*it)->end()) { + return true; + } + } + return false; +} + +inline void removeArgsInArgGroups(std::list &argList, + const std::list &argSets) { + for (std::list::iterator it = argList.begin(); + it != argList.end();) { + if (isInArgGroup(*it, argSets)) { + it = argList.erase(it); + } else { + ++it; + } + } +} + +inline std::string removeSuffix(std::string s, const std::string &suffix) { + std::ptrdiff_t start = s.length() - suffix.length(); + if (start >= 0 && s.substr(start) == suffix) { + return s.substr(0, start); + } + + return s; +} + +inline std::string basename(std::string s) { + size_t p = s.find_last_of(PATH_SEPARATOR); + if (p != std::string::npos) { + s.erase(0, p + 1); + } + + return removeSuffix(s, ".exe"); +} + +} // namespace TCLAP + +#endif // TCLAP_CMD_LINE_OUTPUT_H diff --git a/tclap/include/tclap/Constraint.h b/tclap/include/tclap/Constraint.h index ff869cc..73f88d8 100644 --- a/tclap/include/tclap/Constraint.h +++ b/tclap/include/tclap/Constraint.h @@ -1,6 +1,5 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - /****************************************************************************** * * file: Constraint.h @@ -25,54 +24,54 @@ #ifndef TCLAP_CONSTRAINT_H #define TCLAP_CONSTRAINT_H -#include -#include -#include -#include -#include #include +#include +#include +#include #include +#include +#include namespace TCLAP { /** * The interface that defines the interaction between the Arg and Constraint. */ -template -class Constraint -{ - - public: - /** - * Returns a description of the Constraint. - */ - virtual std::string description() const =0; +template +class Constraint { +public: + /** + * Returns a description of the Constraint. + */ + virtual std::string description() const = 0; - /** - * Returns the short ID for the Constraint. - */ - virtual std::string shortID() const =0; + /** + * Returns the short ID for the Constraint. + */ + virtual std::string shortID() const = 0; - /** - * The method used to verify that the value parsed from the command - * line meets the constraint. - * \param value - The value that will be checked. - */ - virtual bool check(const T& value) const =0; + /** + * The method used to verify that the value parsed from the command + * line meets the constraint. + * \param value - The value that will be checked. + */ + virtual bool check(const T &value) const = 0; - /** - * Destructor. - * Silences warnings about Constraint being a base class with virtual - * functions but without a virtual destructor. - */ - virtual ~Constraint() { ; } + /** + * Destructor. + * Silences warnings about Constraint being a base class with virtual + * functions but without a virtual destructor. + */ + virtual ~Constraint() { ; } - static std::string shortID(Constraint *constraint) { - if (!constraint) - throw std::logic_error("Cannot create a ValueArg with a NULL constraint"); - return constraint->shortID(); - } + static std::string shortID(const Constraint *constraint) { + if (!constraint) + throw std::logic_error( + "Cannot create a ValueArg with a NULL constraint"); + return constraint->shortID(); + } }; -} //namespace TCLAP -#endif +} // namespace TCLAP + +#endif // TCLAP_CONSTRAINT_H diff --git a/tclap/include/tclap/DeferDelete.h b/tclap/include/tclap/DeferDelete.h new file mode 100644 index 0000000..7cf05a0 --- /dev/null +++ b/tclap/include/tclap/DeferDelete.h @@ -0,0 +1,74 @@ +// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- + +/****************************************************************************** + * + * file: DeferDelete.h + * + * Copyright (c) 2020, 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, + * 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_DEFER_DELETE_H +#define TCLAP_DEFER_DELETE_H + +#include + +namespace TCLAP { + +/** + * DeferDelete can be used by objects that need to allocate arbitrary other + * objects to live for the duration of the first object. Any object + * added to DeferDelete (by calling operator()) will be deleted when + * the DeferDelete object is destroyed. + */ +class DeferDelete { + class DeletableBase { + public: + virtual ~DeletableBase() {} + }; + + template + class Deletable : public DeletableBase { + public: + Deletable(T *o) : _o(o) {} + virtual ~Deletable() { delete _o; } + + private: + Deletable(const Deletable &) {} + Deletable operator=(const Deletable &) {} + + T *_o; + }; + + std::list _toBeDeleted; + +public: + DeferDelete() : _toBeDeleted() {} + ~DeferDelete() { + for (std::list::iterator it = _toBeDeleted.begin(); + it != _toBeDeleted.end(); ++it) { + delete *it; + } + } + + template + void operator()(T *toDelete) { + _toBeDeleted.push_back(new Deletable(toDelete)); + } +}; + +} // namespace TCLAP + +#endif // TCLAP_DEFER_DELETE_H diff --git a/tclap/include/tclap/DocBookOutput.h b/tclap/include/tclap/DocBookOutput.h index 80b10e5..0f4b361 100644 --- a/tclap/include/tclap/DocBookOutput.h +++ b/tclap/include/tclap/DocBookOutput.h @@ -1,303 +1,300 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- -/****************************************************************************** - * +/****************************************************************************** + * * 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 * 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, - * 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_DOCBOOKOUTPUT_H -#define TCLAP_DOCBOOKOUTPUT_H - -#include -#include -#include -#include -#include + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_DOC_BOOK_OUTPUT_H +#define TCLAP_DOC_BOOK_OUTPUT_H +#include #include #include -#include -#include + +#include +#include +#include +#include +#include namespace TCLAP { /** - * A class that generates DocBook output for usage() method for the + * A class that generates DocBook output for usage() method for the * given CmdLine and its Args. */ -class DocBookOutput : public CmdLineOutput -{ - - public: - - /** - * Prints the usage to stdout. Can be overridden to - * produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void usage(CmdLineInterface& c); - - /** - * Prints the version to stdout. Can be overridden - * to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void version(CmdLineInterface& c); - - /** - * Prints (to stderr) an error message, short usage - * Can be overridden to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - * \param e - The ArgException that caused the failure. - */ - virtual void failure(CmdLineInterface& c, - ArgException& e ); - - DocBookOutput() : theDelimiter('=') {} - protected: - - /** - * Substitutes the char r for string x in string s. - * \param s - The string to operate on. - * \param r - The char to replace. - * \param x - What to replace r with. - */ - void substituteSpecialChars( std::string& s, char r, std::string& x ); - void removeChar( std::string& s, char r); - void basename( std::string& s ); - - void printShortArg(Arg* it); - void printLongArg(Arg* it); - - char theDelimiter; +class DocBookOutput : public CmdLineOutput { +public: + /** + * Prints the usage to stdout. Can be overridden to + * produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface &c); + + /** + * Prints the version to stdout. Can be overridden + * to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface &c); + + /** + * Prints (to stderr) an error message, short usage + * Can be overridden to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface &c, ArgException &e); + + DocBookOutput() : theDelimiter('=') {} + +protected: + /** + * Substitutes the char r for string x in string s. + * \param s - The string to operate on. + * \param r - The char to replace. + * \param x - What to replace r with. + */ + void substituteSpecialChars(std::string &s, char r, + const std::string &x) const; + void removeChar(std::string &s, char r) const; + + void printShortArg(Arg *it, bool required); + void printLongArg(const ArgGroup &it) const; + + char theDelimiter; }; - -inline void DocBookOutput::version(CmdLineInterface& _cmd) -{ - std::cout << _cmd.getVersion() << std::endl; +inline void DocBookOutput::version(CmdLineInterface &_cmd) { + std::cout << _cmd.getVersion() << std::endl; } -inline void DocBookOutput::usage(CmdLineInterface& _cmd ) -{ - std::list argList = _cmd.getArgList(); - std::string progName = _cmd.getProgramName(); - std::string xversion = _cmd.getVersion(); - theDelimiter = _cmd.getDelimiter(); - XorHandler xorHandler = _cmd.getXorHandler(); - const std::vector< std::vector > xorList = xorHandler.getXorList(); - basename(progName); - - std::cout << "" << std::endl; - std::cout << "" << std::endl << std::endl; - - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "" << progName << "" << std::endl; - std::cout << "1" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "" << progName << "" << std::endl; - std::cout << "" << _cmd.getMessage() << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << progName << "" << std::endl; - - // xor - for ( int i = 0; (unsigned int)i < xorList.size(); i++ ) - { - std::cout << "" << std::endl; - for ( ArgVectorIterator it = xorList[i].begin(); - it != xorList[i].end(); it++ ) - printShortArg((*it)); - - std::cout << "" << std::endl; - } - - // rest of args - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - if ( !xorHandler.contains( (*it) ) ) - printShortArg((*it)); - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "Description" << std::endl; - std::cout << "" << std::endl; - std::cout << _cmd.getMessage() << std::endl; - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "Options" << std::endl; - - std::cout << "" << std::endl; - - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - printLongArg((*it)); - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "Version" << std::endl; - std::cout << "" << std::endl; - std::cout << xversion << std::endl; - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; +namespace internal { +const char *GroupChoice(const ArgGroup &group) { + if (!group.showAsGroup()) { + return "plain"; + } -} + if (group.isRequired()) { + return "req"; + } -inline void DocBookOutput::failure( CmdLineInterface& _cmd, - ArgException& e ) -{ - static_cast(_cmd); // unused - std::cout << e.what() << std::endl; - throw ExitException(1); + return "opt"; } - -inline void DocBookOutput::substituteSpecialChars( std::string& s, - char r, - std::string& x ) -{ - size_t p; - while ( (p = s.find_first_of(r)) != std::string::npos ) - { - s.erase(p,1); - s.insert(p,x); - } +} // namespace internal + +inline void DocBookOutput::usage(CmdLineInterface &_cmd) { + std::list argSets = _cmd.getArgGroups(); + std::string progName = _cmd.getProgramName(); + std::string xversion = _cmd.getVersion(); + theDelimiter = _cmd.getDelimiter(); + + std::cout << "\n"; + std::cout + << "\n\n"; + + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "" << progName << "\n"; + std::cout << "1\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "" << progName << "\n"; + std::cout << "" << _cmd.getMessage() << "\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "" << progName << "\n"; + + for (std::list::iterator sit = argSets.begin(); + sit != argSets.end(); ++sit) { + int visible = CountVisibleArgs(**sit); + if (visible > 1) { + std::cout << "\n"; + } + for (ArgGroup::iterator it = (*sit)->begin(); it != (*sit)->end(); + ++it) { + if (!(*it)->visibleInHelp()) { + continue; + } + + printShortArg(*it, (*it)->isRequired() || + (visible == 1 && (**sit).isRequired())); + } + if (visible > 1) { + std::cout << "\n"; + } + } + + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "Description\n"; + std::cout << "\n"; + std::cout << _cmd.getMessage() << '\n'; + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "Options\n"; + + std::cout << "\n"; + + for (std::list::iterator sit = argSets.begin(); + sit != argSets.end(); ++sit) { + printLongArg(**sit); + } + + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "Version\n"; + std::cout << "\n"; + std::cout << xversion << '\n'; + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "" << std::endl; } -inline void DocBookOutput::removeChar( std::string& s, char r) -{ - size_t p; - while ( (p = s.find_first_of(r)) != std::string::npos ) - { - s.erase(p,1); - } +inline void DocBookOutput::failure(CmdLineInterface &_cmd, ArgException &e) { + static_cast(_cmd); // unused + std::cout << e.what() << std::endl; + throw ExitException(1); } -inline void DocBookOutput::basename( std::string& s ) -{ - size_t p = s.find_last_of('/'); - if ( p != std::string::npos ) - { - s.erase(0, p + 1); - } +inline void DocBookOutput::substituteSpecialChars(std::string &s, char r, + const std::string &x) const { + size_t p; + while ((p = s.find_first_of(r)) != std::string::npos) { + s.erase(p, 1); + s.insert(p, x); + } } -inline void DocBookOutput::printShortArg(Arg* a) -{ - std::string lt = "<"; - std::string gt = ">"; - - std::string id = a->shortID(); - substituteSpecialChars(id,'<',lt); - substituteSpecialChars(id,'>',gt); - removeChar(id,'['); - removeChar(id,']'); - - std::string choice = "opt"; - if ( a->isRequired() ) - choice = "plain"; - - std::cout << "acceptsMultipleValues() ) - std::cout << " rep='repeat'"; - - - std::cout << '>'; - if ( !a->getFlag().empty() ) - std::cout << a->flagStartChar() << a->getFlag(); - else - std::cout << a->nameStartString() << a->getName(); - if ( a->isValueRequired() ) - { - std::string arg = a->shortID(); - removeChar(arg,'['); - removeChar(arg,']'); - removeChar(arg,'<'); - removeChar(arg,'>'); - removeChar(arg,'.'); - arg.erase(0, arg.find_last_of(theDelimiter) + 1); - std::cout << theDelimiter; - std::cout << "" << arg << ""; - } - std::cout << "" << std::endl; +inline void DocBookOutput::removeChar(std::string &s, char r) const { + size_t p; + while ((p = s.find_first_of(r)) != std::string::npos) { + s.erase(p, 1); + } +} +inline void DocBookOutput::printShortArg(Arg *a, bool required) { + std::string lt = "<"; + std::string gt = ">"; + + std::string id = a->shortID(); + substituteSpecialChars(id, '<', lt); + substituteSpecialChars(id, '>', gt); + removeChar(id, '['); + removeChar(id, ']'); + + std::string choice = "opt"; + if (required) { + choice = "plain"; + } + + std::cout << "acceptsMultipleValues()) std::cout << " rep='repeat'"; + + std::cout << '>'; + if (!a->getFlag().empty()) + std::cout << a->flagStartChar() << a->getFlag(); + else + std::cout << a->nameStartString() << a->getName(); + if (a->isValueRequired()) { + std::string arg = a->shortID(); + removeChar(arg, '['); + removeChar(arg, ']'); + removeChar(arg, '<'); + removeChar(arg, '>'); + removeChar(arg, '.'); + arg.erase(0, arg.find_last_of(theDelimiter) + 1); + std::cout << theDelimiter; + std::cout << "" << arg << ""; + } + std::cout << "" << std::endl; } -inline void DocBookOutput::printLongArg(Arg* a) -{ - std::string lt = "<"; - std::string gt = ">"; - - std::string desc = a->getDescription(); - substituteSpecialChars(desc,'<',lt); - substituteSpecialChars(desc,'>',gt); - - std::cout << "" << std::endl; - - if ( !a->getFlag().empty() ) - { - std::cout << "" << std::endl; - std::cout << "" << std::endl; - std::cout << "" << std::endl; - } - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - std::cout << desc << std::endl; - std::cout << "" << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; +inline void DocBookOutput::printLongArg(const ArgGroup &group) const { + const std::string lt = "<"; + const std::string gt = ">"; + + bool forceRequired = group.isRequired() && CountVisibleArgs(group) == 1; + for (ArgGroup::const_iterator it = group.begin(); it != group.end(); ++it) { + Arg &a = **it; + if (!a.visibleInHelp()) { + continue; + } + + std::string desc = a.getDescription(forceRequired || a.isRequired()); + substituteSpecialChars(desc, '<', lt); + substituteSpecialChars(desc, '>', gt); + + std::cout << "\n"; + + if (!a.getFlag().empty()) { + std::cout << "\n"; + std::cout << "\n"; + std::cout << "\n"; + } + + std::cout << "\n"; + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "\n"; + std::cout << "\n"; + std::cout << desc << '\n'; + std::cout << "\n"; + std::cout << "\n"; + + std::cout << "" << std::endl; + } } -} //namespace TCLAP -#endif +} // namespace TCLAP +#endif // TCLAP_DOC_BOOK_OUTPUT_H diff --git a/tclap/include/tclap/HelpVisitor.h b/tclap/include/tclap/HelpVisitor.h index 5ee3756..30b42b8 100644 --- a/tclap/include/tclap/HelpVisitor.h +++ b/tclap/include/tclap/HelpVisitor.h @@ -1,25 +1,24 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** - * +/****************************************************************************** + * * file: HelpVisitor.h - * + * * Copyright (c) 2003, Michael E. Smoot . * 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, - * 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. - * - *****************************************************************************/ + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_HELP_VISITOR_H #define TCLAP_HELP_VISITOR_H @@ -34,45 +33,43 @@ namespace TCLAP { * A Visitor object that calls the usage method of the given CmdLineOutput * object for the specified CmdLine object. */ -class HelpVisitor: public Visitor -{ - private: - /** - * Prevent accidental copying. - */ - HelpVisitor(const HelpVisitor& rhs); - HelpVisitor& operator=(const HelpVisitor& rhs); - - protected: +class HelpVisitor : public Visitor { +private: + /** + * Prevent accidental copying. + */ + HelpVisitor(const HelpVisitor &rhs); + HelpVisitor &operator=(const HelpVisitor &rhs); - /** - * The CmdLine the output will be generated for. - */ - CmdLineInterface* _cmd; +protected: + /** + * The CmdLine the output will be generated for. + */ + CmdLineInterface *_cmd; - /** - * The output object. - */ - CmdLineOutput** _out; + /** + * The output object. + */ + CmdLineOutput **_out; - public: +public: + /** + * Constructor. + * \param cmd - The CmdLine the output will be generated for. + * \param out - The type of output. + */ + HelpVisitor(CmdLineInterface *cmd, CmdLineOutput **out) + : Visitor(), _cmd(cmd), _out(out) {} - /** - * Constructor. - * \param cmd - The CmdLine the output will be generated for. - * \param out - The type of output. - */ - HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) - : Visitor(), _cmd( cmd ), _out( out ) { } - - /** - * Calls the usage method of the CmdLineOutput for the - * specified CmdLine. - */ - void visit() { (*_out)->usage(*_cmd); throw ExitException(0); } - + /** + * Calls the usage method of the CmdLineOutput for the + * specified CmdLine. + */ + void visit() { + (*_out)->usage(*_cmd); + throw ExitException(0); + } }; +} // namespace TCLAP -} - -#endif +#endif // TCLAP_HELP_VISITOR_H diff --git a/tclap/include/tclap/IgnoreRestVisitor.h b/tclap/include/tclap/IgnoreRestVisitor.h index 1824c3c..09811b6 100644 --- a/tclap/include/tclap/IgnoreRestVisitor.h +++ b/tclap/include/tclap/IgnoreRestVisitor.h @@ -1,32 +1,31 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** - * +/****************************************************************************** + * * file: IgnoreRestVisitor.h - * + * * Copyright (c) 2003, Michael E. Smoot . + * Copyright (c) 2020, 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_IGNORE_REST_VISITOR_H #define TCLAP_IGNORE_REST_VISITOR_H +#include #include -#include namespace TCLAP { @@ -34,21 +33,15 @@ namespace TCLAP { * A Visitor that tells the CmdLine to begin ignoring arguments after * this one is parsed. */ -class IgnoreRestVisitor: public Visitor -{ - public: - - /** - * Constructor. - */ - IgnoreRestVisitor() : Visitor() {} - - /** - * Sets Arg::_ignoreRest. - */ - void visit() { Arg::beginIgnoring(); } +class IgnoreRestVisitor : public Visitor { +public: + IgnoreRestVisitor(CmdLineInterface &cmdLine) + : Visitor(), cmdLine_(cmdLine) {} + void visit() { cmdLine_.beginIgnoring(); } + +private: + CmdLineInterface &cmdLine_; }; +} // namespace TCLAP -} - -#endif +#endif // TCLAP_IGNORE_REST_VISITOR_H diff --git a/tclap/include/tclap/Makefile.am b/tclap/include/tclap/Makefile.am deleted file mode 100644 index 5424fdf..0000000 --- a/tclap/include/tclap/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ - -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/include/tclap/MultiArg.h b/tclap/include/tclap/MultiArg.h index 432a120..15f05af 100644 --- a/tclap/include/tclap/MultiArg.h +++ b/tclap/include/tclap/MultiArg.h @@ -1,433 +1,354 @@ // -*- 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 * 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, - * 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. - * + * + * 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. + * *****************************************************************************/ +#ifndef TCLAP_MULTI_ARG_H +#define TCLAP_MULTI_ARG_H -#ifndef TCLAP_MULTIPLE_ARGUMENT_H -#define TCLAP_MULTIPLE_ARGUMENT_H +#include +#include #include #include -#include -#include - namespace TCLAP { /** * An argument that allows multiple values of type T to be specified. Very * similar to a ValueArg, except a vector of values will be returned * instead of just one. */ -template -class MultiArg : public Arg -{ +template +class MultiArg : public Arg { public: - typedef std::vector container_type; - typedef typename container_type::iterator iterator; - typedef typename container_type::const_iterator const_iterator; + typedef std::vector container_type; + typedef typename container_type::iterator iterator; + typedef typename container_type::const_iterator const_iterator; protected: - - /** - * The list of values parsed from the CmdLine. - */ - std::vector _values; - - /** - * The description of type T to be used in the usage. - */ - std::string _typeDesc; - - /** - * A list of constraint on this Arg. - */ - Constraint* _constraint; - - /** - * Extracts the value from the string. - * Attempts to parse string as type T, if this fails an exception - * is thrown. - * \param val - The string to be read. - */ - void _extractValue( const std::string& val ); - - /** - * Used by XorHandler to decide whether to keep parsing for this arg. - */ - bool _allowMore; + /** + * The list of values parsed from the CmdLine. + */ + std::vector _values; + + /** + * The description of type T to be used in the usage. + */ + std::string _typeDesc; + + /** + * A constraint that the values of this Arg must conform to. + */ + const Constraint *_constraint; + + /** + * Extracts the value from the string. + * Attempts to parse string as type T, if this fails an exception + * is thrown. + * \param val - The string to be read. + */ + void _extractValue(const std::string &val); + + /** + * Used by MultiArg to decide whether to keep parsing for this + * arg. + */ + bool _allowMore; public: - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - Visitor* v = NULL); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v = NULL ); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - Visitor* v = NULL ); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - 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 from main(). - */ - virtual bool processArg(int* i, std::vector& args); - - /** - * Returns a vector of type T containing the values parsed from - * the command line. - */ - const std::vector& getValue() const { return _values; } - - /** - * Returns an iterator over the values parsed from the command - * line. - */ - const_iterator begin() const { return _values.begin(); } - - /** - * Returns the end of the values parsed from the command - * line. - */ - const_iterator end() const { return _values.end(); } - - /** - * Returns the a short id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string shortID(const std::string& val="val") const; - - /** - * Returns the a long id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string longID(const std::string& val="val") const; - - /** - * Once we've matched the first value, then the arg is no longer - * required. - */ - virtual bool isRequired() const; - - virtual bool allowMore(); - - virtual void reset(); + /** + * 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 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. + */ + MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, const std::string &typeDesc, + Visitor *v = NULL); + + /** + * 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 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. + */ + MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, const std::string &typeDesc, + ArgContainer &parser, Visitor *v = NULL); + + /** + * 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 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. + */ + MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, const Constraint *constraint, + Visitor *v = NULL); + + /** + * 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 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. + */ + MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, const Constraint *constraint, + ArgContainer &parser, 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 from main(). + */ + virtual bool processArg(int *i, std::vector &args); + + /** + * Returns a vector of type T containing the values parsed from + * the command line. + */ + const std::vector &getValue() const { return _values; } + + /** + * Returns an iterator over the values parsed from the command + * line. + */ + const_iterator begin() const { return _values.begin(); } + + /** + * Returns the end of the values parsed from the command + * line. + */ + const_iterator end() const { return _values.end(); } + + /** + * Returns the a short id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string shortID(const std::string &val = "val") const; + + /** + * Returns the a long id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string longID(const std::string &val = "val") const; + + virtual bool allowMore(); + + virtual void reset(); private: /** * Prevent accidental copying */ - MultiArg(const MultiArg& rhs); - MultiArg& operator=(const MultiArg& rhs); - + MultiArg(const MultiArg& rhs); + MultiArg& operator=(const MultiArg& rhs); }; -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - Visitor* v) : - Arg( flag, name, desc, req, true, v ), - _values(std::vector()), - _typeDesc( typeDesc ), - _constraint( NULL ), - _allowMore(false) -{ - _acceptsMultipleValues = true; +template +MultiArg::MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, + const std::string &typeDesc, Visitor *v) + : Arg(flag, name, desc, req, true, v), + _values(std::vector()), + _typeDesc(typeDesc), + _constraint(NULL), + _allowMore(false) { + _acceptsMultipleValues = true; } -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _values(std::vector()), - _typeDesc( typeDesc ), - _constraint( NULL ), - _allowMore(false) -{ - parser.add( this ); - _acceptsMultipleValues = true; +template +MultiArg::MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, + const std::string &typeDesc, ArgContainer &parser, + Visitor *v) + : Arg(flag, name, desc, req, true, v), + _values(std::vector()), + _typeDesc(typeDesc), + _constraint(NULL), + _allowMore(false) { + parser.add(this); + _acceptsMultipleValues = true; } /** * */ -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _values(std::vector()), - _typeDesc( Constraint::shortID(constraint) ), - _constraint( constraint ), - _allowMore(false) -{ - _acceptsMultipleValues = true; +template +MultiArg::MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, + const Constraint *constraint, Visitor *v) + : Arg(flag, name, desc, req, true, v), + _values(std::vector()), + _typeDesc(Constraint::shortID(constraint)), + _constraint(constraint), + _allowMore(false) { + _acceptsMultipleValues = true; } -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _values(std::vector()), - _typeDesc( Constraint::shortID(constraint) ), - _constraint( constraint ), - _allowMore(false) -{ - parser.add( this ); - _acceptsMultipleValues = true; +template +MultiArg::MultiArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, + const Constraint *constraint, ArgContainer &parser, + Visitor *v) + : Arg(flag, name, desc, req, true, v), + _values(std::vector()), + _typeDesc(Constraint::shortID(constraint)), + _constraint(constraint), + _allowMore(false) { + parser.add(this); + _acceptsMultipleValues = true; } -template -bool MultiArg::processArg(int *i, std::vector& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; - - if ( _hasBlanks( args[*i] ) ) - return false; - - std::string flag = args[*i]; - std::string value = ""; - - trimFlag( flag, value ); - - if ( argMatches( flag ) ) - { - if ( Arg::delimiter() != ' ' && value == "" ) - throw( ArgParseException( - "Couldn't find delimiter for this argument!", - toString() ) ); - - // always take the first one, regardless of start string - if ( value == "" ) - { - (*i)++; - if ( static_cast(*i) < args.size() ) - _extractValue( args[*i] ); - else - throw( ArgParseException("Missing a value for this argument!", - toString() ) ); - } - else - _extractValue( value ); - - /* - // continuing taking the args until we hit one with a start string - while ( (unsigned int)(*i)+1 < args.size() && - args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && - args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) - _extractValue( args[++(*i)] ); - */ - - _alreadySet = true; - _checkWithVisitor(); - - return true; - } - else - return false; +template +bool MultiArg::processArg(int *i, std::vector &args) { + if (_hasBlanks(args[*i])) return false; + + std::string flag = args[*i]; + std::string value = ""; + + trimFlag(flag, value); + + if (argMatches(flag)) { + if (Arg::delimiter() != ' ' && value == "") + throw(ArgParseException( + "Couldn't find delimiter for this argument!", toString())); + + // always take the first one, regardless of start string + if (value == "") { + (*i)++; + if (static_cast(*i) < args.size()) + _extractValue(args[*i]); + else + throw(ArgParseException("Missing a value for this argument!", + toString())); + } else { + _extractValue(value); + } + + _alreadySet = true; + _setBy = flag; + _checkWithVisitor(); + + return true; + } else { + return false; + } } /** * */ -template -std::string MultiArg::shortID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return Arg::shortID(_typeDesc) + " ..."; +template +std::string MultiArg::shortID(const std::string &val) const { + static_cast(val); // Ignore input, don't warn + return Arg::shortID("<" + _typeDesc + ">") + " ..."; } /** * */ -template -std::string MultiArg::longID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return Arg::longID(_typeDesc) + " (accepted multiple times)"; -} - -/** - * Once we've matched the first value, then the arg is no longer - * required. - */ -template -bool MultiArg::isRequired() const -{ - if ( _required ) - { - if ( _values.size() > 1 ) - return false; - else - return true; - } - else - return false; - +template +std::string MultiArg::longID(const std::string &val) const { + static_cast(val); // Ignore input, don't warn + return Arg::longID("<" + _typeDesc + ">") + " (accepted multiple times)"; } -template -void MultiArg::_extractValue( const std::string& val ) -{ +template +void MultiArg::_extractValue(const std::string &val) { try { - T tmp; - ExtractValue(tmp, val, typename ArgTraits::ValueCategory()); - _values.push_back(tmp); - } catch( ArgParseException &e) { - throw ArgParseException(e.error(), toString()); + T tmp; + ExtractValue(tmp, val, typename ArgTraits::ValueCategory()); + _values.push_back(tmp); + } catch (ArgParseException &e) { + throw ArgParseException(e.error(), toString()); } - if ( _constraint != NULL ) - if ( ! _constraint->check( _values.back() ) ) - throw( CmdLineParseException( "Value '" + val + - "' does not meet constraint: " + - _constraint->description(), - toString() ) ); + if (_constraint != NULL) + if (!_constraint->check(_values.back())) + throw(CmdLineParseException( + "Value '" + val + + "' does not meet constraint: " + _constraint->description(), + toString())); } - -template -bool MultiArg::allowMore() -{ - bool am = _allowMore; - _allowMore = true; - return am; + +template +bool MultiArg::allowMore() { + bool am = _allowMore; + _allowMore = true; + return am; } -template -void MultiArg::reset() -{ - Arg::reset(); - _values.clear(); +template +void MultiArg::reset() { + Arg::reset(); + _values.clear(); } -} // namespace TCLAP +} // namespace TCLAP -#endif +#endif // TCLAP_MULTI_ARG_H diff --git a/tclap/include/tclap/MultiArgOld.h b/tclap/include/tclap/MultiArgOld.h deleted file mode 100644 index dcf3966..0000000 --- a/tclap/include/tclap/MultiArgOld.h +++ /dev/null @@ -1,531 +0,0 @@ -/****************************************************************************** - * - * file: MultiArg.h - * - * Copyright (c) 2003, Michael E. Smoot . - * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. - * All rights reverved. - * - * 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, - * 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_MULTIPLE_ARGUMENT_H -#define TCLAP_MULTIPLE_ARGUMENT_H - -#include -#include - -#include -#include - -#ifdef HAVE_CONFIG_H -#include -#else -# ifndef HAVE_SSTREAM //This may have been defined elsewhere -# define HAVE_SSTREAM 1 -# endif -#endif - -#if defined(HAVE_SSTREAM) -#include -#elif defined(HAVE_STRSTREAM) -#include -#else -#error "Need a stringstream (sstream or strstream) to compile!" -#endif - -namespace TCLAP { - -template class MultiArg; - -namespace MULTI_ARG_HELPER { - -enum Error_e { EXTRACT_FAILURE = 1000, EXTRACT_TOO_MANY }; - -/** - * This class is used to extract a value from an argument. - * It is used because we need a special implementation to - * deal with std::string and making a specialiced function - * puts it in the T segment, thus generating link errors. - * Having a specialiced class makes the symbols weak. - * This is not pretty but I don't know how to make it - * work any other way. - */ -template -class ValueExtractor -{ - friend class MultiArg; - - private: - - /** - * Reference to the vector of values where the result of the - * extraction will be put. - */ - std::vector &_values; - - /** - * Constructor. - * \param values - Where the values extracted will be put. - */ - ValueExtractor(std::vector &values) : _values(values) {} - - /** - * Method that will attempt to parse the input stream for values - * of type T. - * \param val - Where the values parsed will be put. - */ - int extractValue( const std::string& val ) - { - T temp; - -#if defined(HAVE_SSTREAM) - std::istringstream is(val); -#elif defined(HAVE_STRSTREAM) - std::istrstream is(val.c_str()); -#else -#error "Need a stringstream (sstream or strstream) to compile!" -#endif - - int valuesRead = 0; - - while ( is.good() ) - { - if ( is.peek() != EOF ) - is >> temp; - else - break; - - valuesRead++; - } - - if ( is.fail() ) - return EXTRACT_FAILURE; - - if ( valuesRead > 1 ) - return EXTRACT_TOO_MANY; - - _values.push_back(temp); - - return 0; - } -}; - -/** - * Specialization for string. This is necessary because istringstream - * operator>> is not able to ignore spaces... meaning -x "X Y" will only - * read 'X'... and thus the specialization. - */ -template<> -class ValueExtractor -{ - friend class MultiArg; - - private: - - /** - * Reference to the vector of strings where the result of the - * extraction will be put. - */ - std::vector &_values; - - /** - * Constructor. - * \param values - Where the strings extracted will be put. - */ - ValueExtractor(std::vector &values) : _values(values) {} - - /** - * Method that will attempt to parse the input stream for values - * of type std::string. - * \param val - Where the values parsed will be put. - */ - int extractValue( const std::string& val ) - { - _values.push_back( val ); - return 0; - } -}; - -} //namespace MULTI_ARG_HELPER - -/** - * An argument that allows multiple values of type T to be specified. Very - * similar to a ValueArg, except a vector of values will be returned - * instead of just one. - */ -template -class MultiArg : public Arg -{ - protected: - - /** - * The list of values parsed from the CmdLine. - */ - std::vector _values; - - /** - * The description of type T to be used in the usage. - */ - std::string _typeDesc; - - /** - * A list of constraint on this Arg. - */ - Constraint* _constraint; - - /** - * Extracts the value from the string. - * Attempts to parse string as type T, if this fails an exception - * is thrown. - * \param val - The string to be read. - */ - void _extractValue( const std::string& val ); - - bool _allowMore; - - public: - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - Visitor* v = NULL); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v = NULL ); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - Visitor* v = NULL ); - - /** - * 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 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. - */ - MultiArg( const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - 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 from main(). - */ - virtual bool processArg(int* i, std::vector& args); - - /** - * Returns a vector of type T containing the values parsed from - * the command line. - */ - const std::vector& getValue(); - - /** - * Returns the a short id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string shortID(const std::string& val="val") const; - - /** - * Returns the a long id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string longID(const std::string& val="val") const; - - /** - * Once we've matched the first value, then the arg is no longer - * required. - */ - virtual bool isRequired() const; - - virtual bool allowMore(); - virtual void printXMLDescription() { - std::cout << - -}; - -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _typeDesc( typeDesc ), - _constraint( NULL ), - _allowMore(false) -{ - _acceptsMultipleValues = true; -} - -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _typeDesc( typeDesc ), - _constraint( NULL ), - _allowMore(false) -{ - parser.add( this ); - _acceptsMultipleValues = true; -} - -/** - * - */ -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _typeDesc( constraint->shortID() ), - _constraint( constraint ), - _allowMore(false) -{ - _acceptsMultipleValues = true; -} - -template -MultiArg::MultiArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - Visitor* v) -: Arg( flag, name, desc, req, true, v ), - _typeDesc( constraint->shortID() ), - _constraint( constraint ), - _allowMore(false) -{ - parser.add( this ); - _acceptsMultipleValues = true; -} - -template -const std::vector& MultiArg::getValue() { return _values; } - -template -bool MultiArg::processArg(int *i, std::vector& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; - - if ( _hasBlanks( args[*i] ) ) - return false; - - std::string flag = args[*i]; - std::string value = ""; - - trimFlag( flag, value ); - - if ( argMatches( flag ) ) - { - if ( Arg::delimiter() != ' ' && value == "" ) - throw( ArgParseException( - "Couldn't find delimiter for this argument!", - toString() ) ); - - // always take the first one, regardless of start string - if ( value == "" ) - { - (*i)++; - if ( static_cast(*i) < args.size() ) - _extractValue( args[*i] ); - else - throw( ArgParseException("Missing a value for this argument!", - toString() ) ); - } - else - _extractValue( value ); - - /* - // continuing taking the args until we hit one with a start string - while ( (unsigned int)(*i)+1 < args.size() && - args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && - args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) - _extractValue( args[++(*i)] ); - */ - - _alreadySet = true; - _checkWithVisitor(); - - return true; - } - else - return false; -} - -/** - * - */ -template -std::string MultiArg::shortID(const std::string& val) const -{ - std::string id = Arg::shortID(_typeDesc) + " ... "; - - return id; -} - -/** - * - */ -template -std::string MultiArg::longID(const std::string& val) const -{ - std::string id = Arg::longID(_typeDesc) + " (accepted multiple times)"; - - return id; -} - -/** - * Once we've matched the first value, then the arg is no longer - * required. - */ -template -bool MultiArg::isRequired() const -{ - if ( _required ) - { - if ( _values.size() > 1 ) - return false; - else - return true; - } - else - return false; - -} - -template -void MultiArg::_extractValue( const std::string& val ) -{ - MULTI_ARG_HELPER::ValueExtractor ve(_values); - - int err = ve.extractValue(val); - - if ( err == MULTI_ARG_HELPER::EXTRACT_FAILURE ) - throw( ArgParseException("Couldn't read argument value " - "from string '" + val + "'", toString() ) ); - - if(err == MULTI_ARG_HELPER::EXTRACT_TOO_MANY) - throw( ArgParseException("More than one valid value " - "parsed from string '" + val + "'", - toString() ) ); - if ( _constraint != NULL ) - if ( ! _constraint->check( _values.back() ) ) - throw( CmdLineParseException( "Value '" + val + - "' does not meet constraint: " + - _constraint->description(), - toString() ) ); -} - -template -bool MultiArg::allowMore() -{ - bool am = _allowMore; - _allowMore = true; - return am; -} - -} // namespace TCLAP - -#endif diff --git a/tclap/include/tclap/MultiSwitchArg.h b/tclap/include/tclap/MultiSwitchArg.h index e333ea7..a651cae 100644 --- a/tclap/include/tclap/MultiSwitchArg.h +++ b/tclap/include/tclap/MultiSwitchArg.h @@ -1,217 +1,175 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** -* -* file: MultiSwitchArg.h -* -* 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 -* 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, -* 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. -* -*****************************************************************************/ - +/****************************************************************************** + * + * file: MultiSwitchArg.h + * + * 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 + * 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, + * 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_MULTI_SWITCH_ARG_H #define TCLAP_MULTI_SWITCH_ARG_H +#include + #include #include -#include - namespace TCLAP { /** -* A multiple switch argument. If the switch is set on the command line, then -* the getValue method will return the number of times the switch appears. -*/ -class MultiSwitchArg : public SwitchArg -{ - protected: - - /** - * The value of the switch. - */ - int _value; - - /** - * Used to support the reset() method so that ValueArg can be - * reset to their constructed value. - */ - int _default; - - public: - - /** - * MultiSwitchArg 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 init - Optional. The initial/default value of this Arg. - * Defaults to 0. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - int init = 0, - Visitor* v = NULL); - - - /** - * MultiSwitchArg 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 init - Optional. The initial/default value of this Arg. - * Defaults to 0. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - CmdLineInterface& parser, - int init = 0, - Visitor* v = NULL); - - - /** - * Handles the processing of the argument. - * This re-implements the SwitchArg 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& args); - - /** - * Returns int, the number of times the switch has been set. - */ - int getValue() const { return _value; } - - /** - * Returns the shortID for this Arg. - */ - std::string shortID(const std::string& val) const; - - /** - * Returns the longID for this Arg. - */ - std::string longID(const std::string& val) const; - - void reset(); - + * A multiple switch argument. If the switch is set on the command line, then + * the getValue method will return the number of times the switch appears. + */ +class MultiSwitchArg : public SwitchArg { +protected: + /** + * The value of the switch. + */ + int _value; + + /** + * Used to support the reset() method so that ValueArg can be + * reset to their constructed value. + */ + int _default; + +public: + /** + * MultiSwitchArg 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 init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string &flag, const std::string &name, + const std::string &desc, int init = 0, Visitor *v = NULL); + + /** + * MultiSwitchArg 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 init - Optional. The initial/default value of this Arg. + * Defaults to 0. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + MultiSwitchArg(const std::string &flag, const std::string &name, + const std::string &desc, ArgContainer &parser, int init = 0, + Visitor *v = NULL); + + /** + * Handles the processing of the argument. + * This re-implements the SwitchArg 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 &args); + + /** + * Returns int, the number of times the switch has been set. + */ + int getValue() const { return _value; } + + /** + * Returns the shortID for this Arg. + */ + std::string shortID(const std::string &val) const; + + /** + * Returns the longID for this Arg. + */ + std::string longID(const std::string &val) const; + + void reset(); }; -////////////////////////////////////////////////////////////////////// -//BEGIN MultiSwitchArg.cpp -////////////////////////////////////////////////////////////////////// -inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - int init, - Visitor* v ) -: SwitchArg(flag, name, desc, false, v), -_value( init ), -_default( init ) -{ } - -inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, - const std::string& name, - const std::string& desc, - CmdLineInterface& parser, - int init, - Visitor* v ) -: SwitchArg(flag, name, desc, false, v), -_value( init ), -_default( init ) -{ - parser.add( this ); +inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, + const std::string &name, + const std::string &desc, int init, + Visitor *v) + : SwitchArg(flag, name, desc, false, v), _value(init), _default(init) {} + +inline MultiSwitchArg::MultiSwitchArg(const std::string &flag, + const std::string &name, + const std::string &desc, + ArgContainer &parser, int init, + Visitor *v) + : SwitchArg(flag, name, desc, false, v), _value(init), _default(init) { + parser.add(this); } -inline bool MultiSwitchArg::processArg(int *i, std::vector& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; +inline bool MultiSwitchArg::processArg(int *i, std::vector &args) { + if (argMatches(args[*i])) { + // so the isSet() method will work + _alreadySet = true; + _setBy = args[*i]; - if ( argMatches( args[*i] )) - { - // so the isSet() method will work - _alreadySet = true; + // Matched argument: increment value. + ++_value; - // Matched argument: increment value. - ++_value; + _checkWithVisitor(); - _checkWithVisitor(); + return true; + } else if (combinedSwitchesMatch(args[*i])) { + // so the isSet() method will work + _alreadySet = true; - return true; - } - else if ( combinedSwitchesMatch( args[*i] ) ) - { - // so the isSet() method will work - _alreadySet = true; + // Matched argument: increment value. + ++_value; - // Matched argument: increment value. - ++_value; + // Check for more in argument and increment value. + while (combinedSwitchesMatch(args[*i])) ++_value; - // Check for more in argument and increment value. - while ( combinedSwitchesMatch( args[*i] ) ) - ++_value; + _checkWithVisitor(); - _checkWithVisitor(); - - return false; - } - else - return false; + return false; + } else { + return false; + } } -inline std::string -MultiSwitchArg::shortID(const std::string& val) const -{ - return Arg::shortID(val) + " ..."; +inline std::string MultiSwitchArg::shortID(const std::string &val) const { + return Arg::shortID(val) + " ..."; } -inline std::string -MultiSwitchArg::longID(const std::string& val) const -{ - return Arg::longID(val) + " (accepted multiple times)"; +inline std::string MultiSwitchArg::longID(const std::string &val) const { + return Arg::longID(val) + " (accepted multiple times)"; } -inline void -MultiSwitchArg::reset() -{ - MultiSwitchArg::_value = MultiSwitchArg::_default; +inline void MultiSwitchArg::reset() { + MultiSwitchArg::_value = MultiSwitchArg::_default; } -////////////////////////////////////////////////////////////////////// -//END MultiSwitchArg.cpp -////////////////////////////////////////////////////////////////////// - -} //namespace TCLAP +} // namespace TCLAP -#endif +#endif // TCLAP_MULTI_SWITCH_ARG_H diff --git a/tclap/include/tclap/OptionalUnlabeledTracker.h b/tclap/include/tclap/OptionalUnlabeledTracker.h index aa64116..0608461 100644 --- a/tclap/include/tclap/OptionalUnlabeledTracker.h +++ b/tclap/include/tclap/OptionalUnlabeledTracker.h @@ -1,64 +1,60 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - -/****************************************************************************** - * +/****************************************************************************** + * * file: OptionalUnlabeledTracker.h - * + * * Copyright (c) 2005, Michael E. Smoot . * 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H +#include + #include namespace TCLAP { -class OptionalUnlabeledTracker -{ - - public: +class OptionalUnlabeledTracker { +public: + static void check(bool req, const std::string &argName); - static void check( bool req, const std::string& argName ); + static void gotOptional() { alreadyOptionalRef() = true; } - static void gotOptional() { alreadyOptionalRef() = true; } + static bool &alreadyOptional() { return alreadyOptionalRef(); } - static bool& alreadyOptional() { return alreadyOptionalRef(); } - - private: - - static bool& alreadyOptionalRef() { static bool ct = false; return ct; } +private: + static bool &alreadyOptionalRef() { + static bool ct = false; + return ct; + } }; +inline void OptionalUnlabeledTracker::check(bool req, + const std::string &argName) { + if (OptionalUnlabeledTracker::alreadyOptional()) + throw(SpecificationException( + "You can't specify ANY Unlabeled Arg following an optional " + "Unlabeled Arg", + argName)); -inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) -{ - if ( OptionalUnlabeledTracker::alreadyOptional() ) - throw( SpecificationException( - "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", - argName ) ); - - if ( !req ) - OptionalUnlabeledTracker::gotOptional(); + if (!req) OptionalUnlabeledTracker::gotOptional(); } +} // namespace TCLAP -} // namespace TCLAP - -#endif +#endif // TCLAP_OPTIONAL_UNLABELED_TRACKER_H diff --git a/tclap/include/tclap/StandardTraits.h b/tclap/include/tclap/StandardTraits.h index 5864f77..36e9835 100644 --- a/tclap/include/tclap/StandardTraits.h +++ b/tclap/include/tclap/StandardTraits.h @@ -27,11 +27,11 @@ #ifndef TCLAP_STANDARD_TRAITS_H #define TCLAP_STANDARD_TRAITS_H -#ifdef HAVE_CONFIG_H -#include // To check for long long -#endif +#include + +#include -// If Microsoft has already typedef'd wchar_t as an unsigned +// If Microsoft has already typedef'd wchar_t as an unsigned // short, then compiles will break because it's as if we're // creating ArgTraits twice for unsigned short. Thus... #ifdef _MSC_VER @@ -46,18 +46,16 @@ namespace TCLAP { // have value-like semantics. // Strings have string like argument traits. -template<> +template <> struct ArgTraits { typedef StringLike ValueCategory; }; -template -void SetString(T &dst, const std::string &src) -{ +template +void SetString(T &dst, const std::string &src) { dst = src; } -} // namespace - -#endif +} // namespace TCLAP +#endif // TCLAP_STANDARD_TRAITS_H diff --git a/tclap/include/tclap/StdOutput.h b/tclap/include/tclap/StdOutput.h index b717fc7..5551592 100644 --- a/tclap/include/tclap/StdOutput.h +++ b/tclap/include/tclap/StdOutput.h @@ -1,45 +1,42 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- -/****************************************************************************** - * +/****************************************************************************** + * * 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 * 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, - * 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_STDCMDLINEOUTPUT_H -#define TCLAP_STDCMDLINEOUTPUT_H - -#include -#include -#include -#include -#include + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_STD_OUTPUT_H +#define TCLAP_STD_OUTPUT_H +#include +#include #include #include -#include -#include - -// Conditionally undefine the min macro that Visual Studio defines. -#ifdef min -#undef min -#endif +#include +#include +#include +#include +#include +#include +#include +#include namespace TCLAP { @@ -47,263 +44,462 @@ namespace TCLAP { * A class that isolates any output from the CmdLine object so that it * may be easily modified. */ -class StdOutput : public CmdLineOutput -{ - - public: - - /** - * Prints the usage to stdout. Can be overridden to - * produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void usage(CmdLineInterface& c); - - /** - * Prints the version to stdout. Can be overridden - * to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void version(CmdLineInterface& c); - - /** - * Prints (to stderr) an error message, short usage - * Can be overridden to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - * \param e - The ArgException that caused the failure. - */ - virtual void failure(CmdLineInterface& c, - ArgException& e ); - - protected: - - /** - * Writes a brief usage message with short args. - * \param c - The CmdLine object the output is generated for. - * \param os - The stream to write the message to. - */ - void _shortUsage( CmdLineInterface& c, std::ostream& os ) const; - - /** - * Writes a longer usage message with long and short args, - * provides descriptions and prints message. - * \param c - The CmdLine object the output is generated for. - * \param os - The stream to write the message to. - */ - void _longUsage( CmdLineInterface& c, std::ostream& os ) const; - - /** - * This function inserts line breaks and indents long strings - * according the params input. It will only break lines at spaces, - * commas and pipes. - * \param os - The stream to be printed to. - * \param s - The string to be printed. - * \param maxWidth - The maxWidth allowed for the output line. - * \param indentSpaces - The number of spaces to indent the first line. - * \param secondLineOffset - The number of spaces to indent the second - * and all subsequent lines in addition to indentSpaces. - */ - void spacePrint( std::ostream& os, - const std::string& s, - int maxWidth, - int indentSpaces, - int secondLineOffset ) const; - +class StdOutput : public CmdLineOutput { +public: + /** + * Prints the usage to stdout. Can be overridden to + * produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void usage(CmdLineInterface &c); + + /** + * Prints the version to stdout. Can be overridden + * to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + */ + virtual void version(CmdLineInterface &c); + + /** + * Prints (to stderr) an error message, short usage + * Can be overridden to produce alternative behavior. + * \param c - The CmdLine object the output is generated for. + * \param e - The ArgException that caused the failure. + */ + virtual void failure(CmdLineInterface &c, ArgException &e); + +protected: + /** + * Writes a brief usage message with short args. + * \param c - The CmdLine object the output is generated for. + * \param os - The stream to write the message to. + */ + void _shortUsage(CmdLineInterface &c, std::ostream &os) const; + + /** + * Writes a longer usage message with long and short args, + * provides descriptions and prints message. + * \param c - The CmdLine object the output is generated for. + * \param os - The stream to write the message to. + */ + void _longUsage(CmdLineInterface &c, std::ostream &os) const; + + /** + * This function inserts line breaks and indents long strings + * according the params input. It will only break lines at spaces, + * commas and pipes. + * \param os - The stream to be printed to. + * \param s - The string to be printed. + * \param maxWidth - The maxWidth allowed for the output line. + * \param indentSpaces - The number of spaces to indent the first line. + * \param secondLineOffset - The number of spaces to indent the second + * and all subsequent lines in addition to indentSpaces. + */ + void spacePrint(std::ostream &os, const std::string &s, int maxWidth, + int indentSpaces, int secondLineOffset) const; }; +inline void StdOutput::version(CmdLineInterface &_cmd) { + std::string progName = _cmd.getProgramName(); + std::string xversion = _cmd.getVersion(); + + std::cout << std::endl + << progName << " version: " << xversion << std::endl + << std::endl; +} + +inline void StdOutput::usage(CmdLineInterface &_cmd) { + std::cout << std::endl << "USAGE: " << std::endl << std::endl; + + _shortUsage(_cmd, std::cout); + + std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl; -inline void StdOutput::version(CmdLineInterface& _cmd) -{ - std::string progName = _cmd.getProgramName(); - std::string xversion = _cmd.getVersion(); + _longUsage(_cmd, std::cout); - std::cout << std::endl << progName << " version: " - << xversion << std::endl << std::endl; + std::cout << std::endl; } -inline void StdOutput::usage(CmdLineInterface& _cmd ) -{ - std::cout << std::endl << "USAGE: " << std::endl << std::endl; +inline void StdOutput::failure(CmdLineInterface &_cmd, ArgException &e) { + std::string progName = _cmd.getProgramName(); - _shortUsage( _cmd, std::cout ); + std::cerr << "PARSE ERROR: " << e.argId() << std::endl + << " " << e.error() << std::endl + << std::endl; - std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl; + if (_cmd.hasHelpAndVersion()) { + std::cerr << "Brief USAGE: " << std::endl; - _longUsage( _cmd, std::cout ); + _shortUsage(_cmd, std::cerr); - std::cout << std::endl; + std::cerr << std::endl + << "For complete USAGE and HELP type: " << std::endl + << " " << progName << " " << Arg::nameStartString() + << "help" << std::endl + << std::endl; + } else { + usage(_cmd); + } + throw ExitException(1); } -inline void StdOutput::failure( CmdLineInterface& _cmd, - ArgException& e ) -{ - std::string progName = _cmd.getProgramName(); +// TODO: Remove this +inline void removeChar(std::string &s, char r) { + size_t p; + while ((p = s.find_first_of(r)) != std::string::npos) { + s.erase(p, 1); + } +} - std::cerr << "PARSE ERROR: " << e.argId() << std::endl - << " " << e.error() << std::endl << std::endl; +inline bool cmpSwitch(const char &a, const char &b) { + int lowa = std::tolower(a); + int lowb = std::tolower(b); - if ( _cmd.hasHelpAndVersion() ) - { - std::cerr << "Brief USAGE: " << std::endl; + if (lowa == lowb) { + return a < b; + } - _shortUsage( _cmd, std::cerr ); + return lowa < lowb; +} - std::cerr << std::endl << "For complete USAGE and HELP type: " - << std::endl << " " << progName << " " - << Arg::nameStartString() << "help" - << std::endl << std::endl; - } - else - usage(_cmd); +namespace internal { +inline bool IsVisibleShortSwitch(const Arg &arg) { + return !(arg.getName() == Arg::ignoreNameString() || + arg.isValueRequired() || arg.getFlag() == "") && + arg.visibleInHelp(); +} - throw ExitException(1); +inline bool IsVisibleLongSwitch(const Arg &arg) { + return (arg.getName() != Arg::ignoreNameString() && + !arg.isValueRequired() && arg.getFlag() == "" && + arg.visibleInHelp()); } -inline void -StdOutput::_shortUsage( CmdLineInterface& _cmd, - std::ostream& os ) const -{ - std::list argList = _cmd.getArgList(); - std::string progName = _cmd.getProgramName(); - XorHandler xorHandler = _cmd.getXorHandler(); - std::vector< std::vector > xorList = xorHandler.getXorList(); - - std::string s = progName + " "; - - spacePrint( os, s, 75, 2, 6 ); - s.clear(); - const int secondLineOffset = 4; - - // first the xor - for ( int i = 0; static_cast(i) < xorList.size(); i++ ) - { - s += " {"; - for ( ArgVectorIterator it = xorList[i].begin(); - it != xorList[i].end(); it++ ) - s += (*it)->shortID() + "|"; - - s[s.length()-1] = '}'; - spacePrint( os, s, 75, secondLineOffset, 3*secondLineOffset ); - s.clear(); - } - - // then the rest - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - { - if ( !xorHandler.contains( (*it) ) ) - s += " " + (*it)->shortID(); - spacePrint( os, s, 75, secondLineOffset, 3*secondLineOffset ); - s.clear(); - } +inline bool IsVisibleOption(const Arg &arg) { + return (arg.getName() != Arg::ignoreNameString() && arg.isValueRequired() && + arg.hasLabel() && arg.visibleInHelp()); } -inline void -StdOutput::_longUsage( CmdLineInterface& _cmd, - std::ostream& os ) const -{ - std::list argList = _cmd.getArgList(); - std::string message = _cmd.getMessage(); - XorHandler xorHandler = _cmd.getXorHandler(); - std::vector< std::vector > xorList = xorHandler.getXorList(); - - // first the xor - for ( int i = 0; static_cast(i) < xorList.size(); i++ ) - { - for ( ArgVectorIterator it = xorList[i].begin(); - it != xorList[i].end(); - it++ ) - { - spacePrint( os, (*it)->longID(), 75, 3, 3 ); - spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); - - if ( it+1 != xorList[i].end() ) - spacePrint(os, "-- OR --", 75, 9, 0); - } - os << std::endl << std::endl; - } - - // then the rest - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - if ( !xorHandler.contains( (*it) ) ) - { - spacePrint( os, (*it)->longID(), 75, 3, 3 ); - spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); - os << std::endl; - } - - os << std::endl; - - spacePrint( os, message, 75, 3, 0 ); +inline bool CompareShortID(const Arg *a, const Arg *b) { + if (a->getFlag() == "" && b->getFlag() != "") { + return false; + } + if (b->getFlag() == "" && a->getFlag() != "") { + return true; + } + + return a->shortID() < b->shortID(); } -inline void StdOutput::spacePrint( std::ostream& os, - const std::string& s, - int maxWidth, - int indentSpaces, - int secondLineOffset ) const -{ - int len = static_cast(s.length()); - - if ( (len + indentSpaces > maxWidth) && maxWidth > 0 ) - { - int allowedLen = maxWidth - indentSpaces; - int start = 0; - while ( start < len ) - { - // find the substring length - // int stringLen = std::min( len - start, allowedLen ); - // doing it this way to support a VisualC++ 2005 bug - using namespace std; - int stringLen = min( len - start, allowedLen ); - - // trim the length so it doesn't end in middle of a word - if ( stringLen == allowedLen ) - while ( stringLen >= 0 && - s[stringLen+start] != ' ' && - s[stringLen+start] != ',' && - s[stringLen+start] != '|' ) - stringLen--; - - // ok, the word is longer than the line, so just split - // wherever the line ends - if ( stringLen <= 0 ) - stringLen = allowedLen; - - // check for newlines - for ( int i = 0; i < stringLen; i++ ) - if ( s[start+i] == '\n' ) - stringLen = i+1; - - // print the indent - for ( int i = 0; i < indentSpaces; i++ ) - os << " "; - - if ( start == 0 ) - { - // handle second line offsets - indentSpaces += secondLineOffset; - - // adjust allowed len - allowedLen -= secondLineOffset; - } - - os << s.substr(start,stringLen) << std::endl; - - // so we don't start a line with a space - while ( s[stringLen+start] == ' ' && start < len ) - start++; - - start += stringLen; - } - } - else - { - for ( int i = 0; i < indentSpaces; i++ ) - os << " "; - os << s << std::endl; - } +// TODO: Fix me not to put --gopt before -f +inline bool CompareOptions(std::pair a, + std::pair b) { + // First optional, then required + if (!a.second && b.second) { + return true; + } + if (a.second && !b.second) { + return false; + } + + return CompareShortID(a.first, b.first); } +} // namespace internal + +/** + * Usage statements should look like the manual pages. Options w/o + * operands come first, in alphabetical order inside a single set of + * braces, upper case before lower case (AaBbCc...). Next are options + * with operands, in the same order, each in braces. Then required + * arguments in the order they are specified, followed by optional + * arguments in the order they are specified. A bar (`|') separates + * either/or options/arguments, and multiple options/arguments which + * are specified together are placed in a single set of braces. + * + * Use getprogname() instead of hardcoding the program name. + * + * "usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\n" + * "usage: f [-a | -b] [-c [-de] [-n number]]\n" + */ +inline void StdOutput::_shortUsage(CmdLineInterface &_cmd, + std::ostream &os) const { + std::list argSets = _cmd.getArgGroups(); + + std::ostringstream outp; + outp << _cmd.getProgramName() + " "; + + std::string switches = Arg::flagStartString(); + + std::list exclusiveGroups; + std::list nonExclusiveGroups; + for (std::list::iterator sit = argSets.begin(); + sit != argSets.end(); ++sit) { + if (CountVisibleArgs(**sit) <= 0) { + continue; + } + + if ((*sit)->isExclusive()) { + exclusiveGroups.push_back(*sit); + } else { + nonExclusiveGroups.push_back(*sit); + } + } + + // Move "exclusive groups" that have at most a single item to + // non-exclusive groups as exclusivit doesn't make sense with a + // single option. This can happen if args are hidden in help for + // example. + for (std::list::iterator it = exclusiveGroups.begin(); + it != exclusiveGroups.end();) { + if (CountVisibleArgs(**it) < 2) { + nonExclusiveGroups.push_back(*it); + it = exclusiveGroups.erase(it); + } else { + ++it; + } + } + + // First short switches (needs to be special because they are all + // stuck together). + for (std::list::iterator sit = nonExclusiveGroups.begin(); + sit != nonExclusiveGroups.end(); ++sit) { + for (ArgGroup::iterator it = (*sit)->begin(); it != (*sit)->end(); + ++it) { + if (internal::IsVisibleShortSwitch(**it)) { + switches += (*it)->getFlag(); + } + } + + std::sort(switches.begin(), switches.end(), cmpSwitch); + } + + outp << " [" << switches << ']'; + + // Now do long switches (e.g., --version, but no -v) + std::vector longSwitches; + for (std::list::iterator sit = nonExclusiveGroups.begin(); + sit != nonExclusiveGroups.end(); ++sit) { + for (ArgGroup::iterator it = (*sit)->begin(); it != (*sit)->end(); + ++it) { + Arg &arg = **it; + if (internal::IsVisibleLongSwitch(arg)) { + longSwitches.push_back(&arg); + } + } + } + + std::sort(longSwitches.begin(), longSwitches.end(), + internal::CompareShortID); + for (std::vector::const_iterator it = longSwitches.begin(); + it != longSwitches.end(); ++it) { + outp << " [" << (**it).shortID() << ']'; + } + + // Now do all exclusive groups + for (std::list::iterator sit = exclusiveGroups.begin(); + sit != exclusiveGroups.end(); ++sit) { + ArgGroup &argGroup = **sit; + outp << (argGroup.isRequired() ? " {" : " ["); + + std::vector args; + for (ArgGroup::iterator it = argGroup.begin(); it != argGroup.end(); + ++it) { + if ((**it).visibleInHelp()) { + args.push_back(*it); + } + } + + std::sort(args.begin(), args.end(), internal::CompareShortID); + std::string sep = ""; + for (std::vector::const_iterator it = args.begin(); + it != args.end(); ++it) { + outp << sep << (**it).shortID(); + sep = "|"; + } + + outp << (argGroup.isRequired() ? '}' : ']'); + } + + // Next do options, we sort them later by optional first. + std::vector > options; + for (std::list::iterator sit = nonExclusiveGroups.begin(); + sit != nonExclusiveGroups.end(); ++sit) { + for (ArgGroup::iterator it = (*sit)->begin(); it != (*sit)->end(); + ++it) { + Arg &arg = **it; + int visible = CountVisibleArgs(**sit); + bool required = arg.isRequired(); + if (internal::IsVisibleOption(arg)) { + if (visible == 1 && (**sit).isRequired()) { + required = true; + } + + options.push_back(std::make_pair(&arg, required)); + } + } + } + + std::sort(options.begin(), options.end(), internal::CompareOptions); + for (std::vector >::const_iterator it = + options.begin(); + it != options.end(); ++it) { + const Arg &arg = *it->first; + bool required = it->second; + outp << (required ? " " : " ["); + outp << arg.shortID(); + outp << (required ? "" : "]"); + } + + // Next do argsuments ("unlabled") in order of definition + for (std::list::iterator sit = nonExclusiveGroups.begin(); + sit != nonExclusiveGroups.end(); ++sit) { + for (ArgGroup::iterator it = (*sit)->begin(); it != (*sit)->end(); + ++it) { + Arg &arg = **it; + if (arg.getName() == Arg::ignoreNameString()) { + continue; + } + + if (arg.isValueRequired() && !arg.hasLabel() && + arg.visibleInHelp()) { + outp << (arg.isRequired() ? " " : " ["); + outp << arg.shortID(); + outp << (arg.isRequired() ? "" : "]"); + } + } + } + + // if the program name is too long, then adjust the second line offset + int secondLineOffset = static_cast(_cmd.getProgramName().length()) + 2; + if (secondLineOffset > 75 / 2) secondLineOffset = static_cast(75 / 2); + + spacePrint(os, outp.str(), 75, 3, secondLineOffset); +} + +inline void StdOutput::_longUsage(CmdLineInterface &_cmd, + std::ostream &os) const { + std::string message = _cmd.getMessage(); + std::list argSets = _cmd.getArgGroups(); + + std::list unlabled; + for (std::list::iterator sit = argSets.begin(); + sit != argSets.end(); ++sit) { + ArgGroup &argGroup = **sit; + + int visible = CountVisibleArgs(argGroup); + bool exclusive = visible > 1 && argGroup.isExclusive(); + bool forceRequired = visible == 1 && argGroup.isRequired(); + if (exclusive) { + spacePrint(os, argGroup.isRequired() ? "One of:" : "Either of:", 75, + 3, 0); + } + + for (ArgGroup::iterator it = argGroup.begin(); it != argGroup.end(); + ++it) { + Arg &arg = **it; + if (!arg.visibleInHelp()) { + continue; + } + + if (!arg.hasLabel()) { + unlabled.push_back(&arg); + continue; + } + + bool required = arg.isRequired() || forceRequired; + if (exclusive) { + spacePrint(os, arg.longID(), 75, 6, 3); + spacePrint(os, arg.getDescription(required), 75, 8, 0); + } else { + spacePrint(os, arg.longID(), 75, 3, 3); + spacePrint(os, arg.getDescription(required), 75, 5, 0); + } + os << '\n'; + } + } + + for (ArgListIterator it = unlabled.begin(); it != unlabled.end(); ++it) { + const Arg &arg = **it; + spacePrint(os, arg.longID(), 75, 3, 3); + spacePrint(os, arg.getDescription(), 75, 5, 0); + os << '\n'; + } + + if (!message.empty()) { + spacePrint(os, message, 75, 3, 0); + } + + os.flush(); +} + +namespace { +inline void fmtPrintLine(std::ostream &os, const std::string &s, int maxWidth, + int indentSpaces, int secondLineOffset) { + const std::string splitChars(" ,|"); + size_t maxChars = std::max(maxWidth - indentSpaces, 0); + std::string indentString(indentSpaces, ' '); + size_t from = 0; + size_t to = 0; + size_t end = s.length(); + for (;;) { + if (end - from <= maxChars) { + // Rest of string fits on line, just print the remainder + os << indentString << s.substr(from) << std::endl; + return; + } + + // Find the next place where it is good to break the string + // (to) by finding the place where it is too late (tooFar) and + // taking the previous one. + size_t tooFar = to; + while (tooFar - from <= maxChars && tooFar != std::string::npos) { + to = tooFar; + tooFar = s.find_first_of(splitChars, to + 1); + } + + if (to == from) { + // In case there was no good place to break the string, + // just break it in the middle of a word at line length. + to = from + maxChars - 1; + } + + if (s[to] != ' ') { + // Include delimiter before line break, unless it's a space + to++; + } + + os << indentString << s.substr(from, to - from) << '\n'; + + // Avoid printing extra white space at start of a line + for (; s[to] == ' '; to++) { + } + from = to; + + if (secondLineOffset != 0) { + // Adjust offset for following lines + indentString.insert(indentString.end(), secondLineOffset, ' '); + maxChars -= secondLineOffset; + secondLineOffset = 0; + } + } +} +} // namespace + +inline void StdOutput::spacePrint(std::ostream &os, const std::string &s, + int maxWidth, int indentSpaces, + int secondLineOffset) const { + std::stringstream ss(s); + std::string line; + std::getline(ss, line); + fmtPrintLine(os, line, maxWidth, indentSpaces, secondLineOffset); + indentSpaces += secondLineOffset; + + while (std::getline(ss, line)) { + fmtPrintLine(os, line, maxWidth, indentSpaces, 0); + } +} + +} // namespace TCLAP -} //namespace TCLAP -#endif +#endif // TCLAP_STD_OUTPUT_H diff --git a/tclap/include/tclap/SwitchArg.h b/tclap/include/tclap/SwitchArg.h index 4ca130d..e298b9d 100644 --- a/tclap/include/tclap/SwitchArg.h +++ b/tclap/include/tclap/SwitchArg.h @@ -1,36 +1,35 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- -/****************************************************************************** - * +/****************************************************************************** + * * file: SwitchArg.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 + * + * 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. - * + * 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 #define TCLAP_SWITCH_ARG_H +#include + #include #include -#include - namespace TCLAP { /** @@ -38,236 +37,199 @@ namespace TCLAP { * the getValue method will return the opposite of the default value for the * switch. */ -class SwitchArg : public Arg -{ +class SwitchArg : public Arg { protected: + /** + * The value of the switch. + */ + bool _value; - /** - * 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; + /** + * 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& 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(); + /** + * 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, ArgContainer &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 &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(); + /** + * 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 +// 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 ) -{ } - -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) -{ - parser.add( this ); +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) {} + +inline SwitchArg::SwitchArg(const std::string &flag, const std::string &name, + const std::string &desc, ArgContainer &parser, + bool default_val, Visitor *v) + : Arg(flag, name, desc, false, false, v), + _value(default_val), + _default(default_val) { + parser.add(this); } -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; -} +inline bool SwitchArg::lastCombined(std::string &combinedSwitches) { + for (unsigned int i = 1; i < combinedSwitches.length(); i++) + if (combinedSwitches[i] != Arg::blankChar()) return false; -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; + return true; +} - // make sure it isn't a long name - if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) == - Arg::nameStartString() ) - return false; +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); + _setBy = Arg::flagStartString() + combinedSwitches[i]; + combinedSwitches[i] = Arg::blankChar(); + return true; + } + } - // make sure the delimiter isn't in the string - if ( combinedSwitches.find_first_of(Arg::delimiter()) != std::string::npos) + // none of the switches passed in the list match. 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 ( _alreadySet ) - throw(CmdLineParseException("Argument already set!", toString())); +inline void SwitchArg::commonProcessing() { + 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& 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] ); +inline bool SwitchArg::processArg(int *i, std::vector &args) { + if (argMatches(args[*i])) { + // The whole string matches the flag or name string + _setBy = args[*i]; + commonProcessing(); + + return true; + } else if (combinedSwitchesMatch(args[*i])) { + // A substring matches the flag as part of a combination + // 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; +inline void SwitchArg::reset() { + Arg::reset(); + _value = _default; } -////////////////////////////////////////////////////////////////////// -//End SwitchArg.cpp -////////////////////////////////////////////////////////////////////// -} //namespace TCLAP +} // namespace TCLAP -#endif +#endif // TCLAP_SWITCH_ARG_H diff --git a/tclap/include/tclap/UnlabeledMultiArg.h b/tclap/include/tclap/UnlabeledMultiArg.h index 48feb84..515e800 100644 --- a/tclap/include/tclap/UnlabeledMultiArg.h +++ b/tclap/include/tclap/UnlabeledMultiArg.h @@ -1,304 +1,261 @@ // -*- 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 * 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_UNLABELED_MULTI_ARG_H +#define TCLAP_UNLABELED_MULTI_ARG_H -#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H -#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H +#include +#include +#include #include #include -#include -#include - namespace TCLAP { /** * Just like a MultiArg, except that the arguments are unlabeled. Basically, - * this Arg will slurp up everything that hasn't been matched to another + * this Arg will slurp up everything that hasn't been matched to another * Arg. */ -template -class UnlabeledMultiArg : public MultiArg -{ - - // If compiler has two stage name lookup (as gcc >= 3.4 does) - // this is required to prevent undef. symbols - using MultiArg::_ignoreable; - using MultiArg::_hasBlanks; - using MultiArg::_extractValue; - using MultiArg::_typeDesc; - using MultiArg::_name; - using MultiArg::_description; - using MultiArg::_alreadySet; - using MultiArg::toString; - - public: - - /** - * Constructor. - * \param name - The name of the Arg. Note that this is used for - * identification, not as a long flag. - * \param desc - A description of what the argument is for or - * does. - * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored - * using the "--" flag. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - UnlabeledMultiArg( const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - bool ignoreable = false, - Visitor* v = NULL ); - /** - * Constructor. - * \param name - The name of the Arg. Note that this is used for - * identification, not as a long flag. - * \param desc - A description of what the argument is for or - * does. - * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored - * using the "--" flag. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - UnlabeledMultiArg( const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - bool ignoreable = false, - Visitor* v = NULL ); - - /** - * Constructor. - * \param name - The name of the Arg. Note that this is used for - * identification, not as a long flag. - * \param desc - A description of what the argument is for or - * does. - * \param req - Whether the argument is required on the command - * line. - * \param constraint - A pointer to a Constraint object used - * to constrain this Arg. - * \param ignoreable - Whether or not this argument can be ignored - * using the "--" flag. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - UnlabeledMultiArg( const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - bool ignoreable = false, - Visitor* v = NULL ); - - /** - * Constructor. - * \param name - The name of the Arg. Note that this is used for - * identification, not as a long flag. - * \param desc - A description of what the argument is for or - * does. - * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored - * using the "--" flag. - * \param v - An optional visitor. You probably should not - * use this unless you have a very good reason. - */ - UnlabeledMultiArg( const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - bool ignoreable = 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. 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 from main(). - */ - virtual bool processArg(int* i, std::vector& args); - - /** - * Returns the a short id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string shortID(const std::string& val="val") const; - - /** - * Returns the a long id string. Used in the usage. - * \param val - value to be used. - */ - virtual std::string longID(const std::string& val="val") const; - - /** - * Operator ==. - * \param a - The Arg to be compared to this. - */ - virtual bool operator==(const Arg& a) const; - - /** - * Pushes this to back of list rather than front. - * \param argList - The list this should be added to. - */ - virtual void addToList( std::list& argList ) const; +template +class UnlabeledMultiArg : public MultiArg { + // If compiler has two stage name lookup (as gcc >= 3.4 does) + // this is required to prevent undef. symbols + using MultiArg::_ignoreable; + using MultiArg::_hasBlanks; + using MultiArg::_extractValue; + using MultiArg::_typeDesc; + using MultiArg::_name; + using MultiArg::_description; + using MultiArg::_alreadySet; + using MultiArg::_setBy; + using MultiArg::toString; + +public: + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg(const std::string &name, const std::string &desc, + bool req, const std::string &typeDesc, + bool ignoreable = false, Visitor *v = NULL); + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg(const std::string &name, const std::string &desc, + bool req, const std::string &typeDesc, + ArgContainer &parser, bool ignoreable = false, + Visitor *v = NULL); + + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required on the command + * line. + * \param constraint - A pointer to a Constraint object used + * to constrain this Arg. + * \param ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg(const std::string &name, const std::string &desc, + bool req, const Constraint *constraint, + bool ignoreable = false, Visitor *v = NULL); + + /** + * Constructor. + * \param name - The name of the Arg. Note that this is used for + * identification, not as a long flag. + * \param desc - A description of what the argument is for or + * does. + * \param req - Whether the argument is required 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 ignoreable - Whether or not this argument can be ignored + * using the "--" flag. + * \param v - An optional visitor. You probably should not + * use this unless you have a very good reason. + */ + UnlabeledMultiArg(const std::string &name, const std::string &desc, + bool req, const Constraint *constraint, + ArgContainer &parser, bool ignoreable = 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. 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 from main(). + */ + virtual bool processArg(int *i, std::vector &args); + + /** + * Returns the a short id string. Used in the usage. + */ + virtual std::string shortID(const std::string &) const { + return Arg::getName() + " ..."; + } + + /** + * Returns the a long id string. Used in the usage. + * \param val - value to be used. + */ + virtual std::string longID(const std::string &) const { + return Arg::getName() + " (accepted multiple times) <" + _typeDesc + + ">"; + } + + /** + * Operator ==. + * \param a - The Arg to be compared to this. + */ + virtual bool operator==(const Arg &a) const; + + /** + * Pushes this to back of list rather than front. + * \param argList - The list this should be added to. + */ + virtual void addToList(std::list &argList) const; + + virtual bool hasLabel() const { return false; } }; -template -UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - bool ignoreable, - Visitor* v) -: MultiArg("", name, desc, req, typeDesc, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(true, toString()); +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string &name, + const std::string &desc, bool req, + const std::string &typeDesc, + bool ignoreable, Visitor *v) + : MultiArg("", name, desc, req, typeDesc, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); } -template -UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, - const std::string& desc, - bool req, - const std::string& typeDesc, - CmdLineInterface& parser, - bool ignoreable, - Visitor* v) -: MultiArg("", name, desc, req, typeDesc, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(true, toString()); - parser.add( this ); +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string &name, + const std::string &desc, bool req, + const std::string &typeDesc, + ArgContainer &parser, bool ignoreable, + Visitor *v) + : MultiArg("", name, desc, req, typeDesc, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); + parser.add(this); } - -template -UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - bool ignoreable, - Visitor* v) -: MultiArg("", name, desc, req, constraint, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(true, toString()); +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string &name, + const std::string &desc, bool req, + const Constraint *constraint, + bool ignoreable, Visitor *v) + : MultiArg("", name, desc, req, constraint, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); } -template -UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, - const std::string& desc, - bool req, - Constraint* constraint, - CmdLineInterface& parser, - bool ignoreable, - Visitor* v) -: MultiArg("", name, desc, req, constraint, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(true, toString()); - parser.add( this ); +template +UnlabeledMultiArg::UnlabeledMultiArg(const std::string &name, + const std::string &desc, bool req, + const Constraint *constraint, + ArgContainer &parser, bool ignoreable, + Visitor *v) + : MultiArg("", name, desc, req, constraint, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(true, toString()); + parser.add(this); } +template +bool UnlabeledMultiArg::processArg(int *i, std::vector &args) { + if (_hasBlanks(args[*i])) return false; -template -bool UnlabeledMultiArg::processArg(int *i, std::vector& args) -{ - - if ( _hasBlanks( args[*i] ) ) - return false; - - // never ignore an unlabeled multi arg - - - // always take the first value, regardless of the start string - _extractValue( args[(*i)] ); + // never ignore an unlabeled multi arg - /* - // continue taking args until we hit the end or a start string - while ( (unsigned int)(*i)+1 < args.size() && - args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && - args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) - _extractValue( args[++(*i)] ); - */ + // always take the first value, regardless of the start string + _extractValue(args[(*i)]); - _alreadySet = true; - - return true; -} - -template -std::string UnlabeledMultiArg::shortID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return std::string("<") + _typeDesc + "> ..."; -} - -template -std::string UnlabeledMultiArg::longID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return std::string("<") + _typeDesc + "> (accepted multiple times)"; -} + /* + // continue taking args until we hit the end or a start string + while ( (unsigned int)(*i)+1 < args.size() && + args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && + args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) + _extractValue( args[++(*i)] ); + */ -template -bool UnlabeledMultiArg::operator==(const Arg& a) const -{ - if ( _name == a.getName() || _description == a.getDescription() ) - return true; - else - return false; + _alreadySet = true; + _setBy = args[*i]; + this->_checkWithVisitor(); + return true; } -template -void UnlabeledMultiArg::addToList( std::list& argList ) const -{ - argList.push_back( const_cast(static_cast(this)) ); +template +bool UnlabeledMultiArg::operator==(const Arg &a) const { + if (_name == a.getName() || _description == a.getDescription()) + return true; + else + return false; } +template +void UnlabeledMultiArg::addToList(std::list &argList) const { + argList.push_back(const_cast(static_cast(this))); } +} // namespace TCLAP -#endif +#endif // TCLAP_UNLABELED_MULTI_ARG_H diff --git a/tclap/include/tclap/UnlabeledValueArg.h b/tclap/include/tclap/UnlabeledValueArg.h index 341a3c0..8ba205c 100644 --- a/tclap/include/tclap/UnlabeledValueArg.h +++ b/tclap/include/tclap/UnlabeledValueArg.h @@ -1,39 +1,37 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** - * +/****************************************************************************** + * * file: UnlabeledValueArg.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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_UNLABELED_VALUE_ARG_H +#define TCLAP_UNLABELED_VALUE_ARG_H -#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H -#define TCLAP_UNLABELED_VALUE_ARGUMENT_H +#include +#include +#include #include #include -#include -#include - - namespace TCLAP { /** @@ -42,302 +40,247 @@ namespace TCLAP { * that a given object will attempt to parse when an UnlabeledValueArg * is reached in the list of args that the CmdLine iterates over. */ -template -class UnlabeledValueArg : public ValueArg -{ - - // If compiler has two stage name lookup (as gcc >= 3.4 does) - // this is required to prevent undef. symbols - using ValueArg::_ignoreable; - using ValueArg::_hasBlanks; - using ValueArg::_extractValue; - using ValueArg::_typeDesc; - using ValueArg::_name; - using ValueArg::_description; - using ValueArg::_alreadySet; - using ValueArg::toString; - - public: - - /** - * UnlabeledValueArg constructor. - * \param name - A one word name for the argument. Note that this is used for - * identification, not as a long flag. - * \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 ignoreable - Allows you to specify that this argument can be - * ignored if the '--' flag is set. This defaults to false (cannot - * be ignored) and should generally stay that way unless you have - * some special need for certain arguments to be ignored. - * \param v - Optional Visitor. You should leave this blank unless - * you have a very good reason. - */ - UnlabeledValueArg( const std::string& name, - const std::string& desc, - bool req, - T value, - const std::string& typeDesc, - bool ignoreable = false, - Visitor* v = NULL); - - /** - * UnlabeledValueArg constructor. - * \param name - A one word name for the argument. Note that this is used for - * identification, not as a long flag. - * \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 ignoreable - Allows you to specify that this argument can be - * ignored if the '--' flag is set. This defaults to false (cannot - * be ignored) and should generally stay that way unless you have - * some special need for certain arguments to be ignored. - * \param v - Optional Visitor. You should leave this blank unless - * you have a very good reason. - */ - UnlabeledValueArg( const std::string& name, - const std::string& desc, - bool req, - T value, - const std::string& typeDesc, - CmdLineInterface& parser, - bool ignoreable = false, - Visitor* v = NULL ); - - /** - * UnlabeledValueArg constructor. - * \param name - A one word name for the argument. Note that this is used for - * identification, not as a long flag. - * \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 ignoreable - Allows you to specify that this argument can be - * ignored if the '--' flag is set. This defaults to false (cannot - * be ignored) and should generally stay that way unless you have - * some special need for certain arguments to be ignored. - * \param v - Optional Visitor. You should leave this blank unless - * you have a very good reason. - */ - UnlabeledValueArg( const std::string& name, - const std::string& desc, - bool req, - T value, - Constraint* constraint, - bool ignoreable = false, - Visitor* v = NULL ); - - - /** - * UnlabeledValueArg constructor. - * \param name - A one word name for the argument. Note that this is used for - * identification, not as a long flag. - * \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 ignoreable - Allows you to specify that this argument can be - * ignored if the '--' flag is set. This defaults to false (cannot - * be ignored) and should generally stay that way unless you have - * some special need for certain arguments to be ignored. - * \param v - Optional Visitor. You should leave this blank unless - * you have a very good reason. - */ - UnlabeledValueArg( const std::string& name, - const std::string& desc, - bool req, - T value, - Constraint* constraint, - CmdLineInterface& parser, - bool ignoreable = 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. Handling specific to - * unlabeled arguments. - * \param i - Pointer the the current argument in the list. - * \param args - Mutable list of strings. - */ - virtual bool processArg(int* i, std::vector& args); - - /** - * Overrides shortID for specific behavior. - */ - virtual std::string shortID(const std::string& val="val") const; - - /** - * Overrides longID for specific behavior. - */ - virtual std::string longID(const std::string& val="val") const; - - /** - * Overrides operator== for specific behavior. - */ - virtual bool operator==(const Arg& a ) const; - - /** - * Instead of pushing to the front of list, push to the back. - * \param argList - The list to add this to. - */ - virtual void addToList( std::list& argList ) const; - +template +class UnlabeledValueArg : public ValueArg { + // If compiler has two stage name lookup (as gcc >= 3.4 does) + // this is required to prevent undef. symbols + using ValueArg::_ignoreable; + using ValueArg::_hasBlanks; + using ValueArg::_extractValue; + using ValueArg::_typeDesc; + using ValueArg::_name; + using ValueArg::_description; + using ValueArg::_alreadySet; + using ValueArg::_setBy; + using ValueArg::toString; + +public: + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used + * for + * identification, not as a long flag. + * \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 ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg(const std::string &name, const std::string &desc, + bool req, T value, const std::string &typeDesc, + bool ignoreable = false, Visitor *v = NULL); + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used + * for + * identification, not as a long flag. + * \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 ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg(const std::string &name, const std::string &desc, + bool req, T value, const std::string &typeDesc, + CmdLineInterface &parser, bool ignoreable = false, + Visitor *v = NULL); + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used + * for + * identification, not as a long flag. + * \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 ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg(const std::string &name, const std::string &desc, + bool req, T value, const Constraint *constraint, + bool ignoreable = false, Visitor *v = NULL); + + /** + * UnlabeledValueArg constructor. + * \param name - A one word name for the argument. Note that this is used + * for + * identification, not as a long flag. + * \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 ignoreable - Allows you to specify that this argument can be + * ignored if the '--' flag is set. This defaults to false (cannot + * be ignored) and should generally stay that way unless you have + * some special need for certain arguments to be ignored. + * \param v - Optional Visitor. You should leave this blank unless + * you have a very good reason. + */ + UnlabeledValueArg(const std::string &name, const std::string &desc, + bool req, T value, const Constraint *constraint, + CmdLineInterface &parser, bool ignoreable = 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. Handling specific to + * unlabeled arguments. + * \param i - Pointer the the current argument in the list. + * \param args - Mutable list of strings. + */ + virtual bool processArg(int *i, std::vector &args); + + /** + * Overrides shortID for specific behavior. + */ + virtual std::string shortID(const std::string &) const { + return Arg::getName(); + } + + /** + * Overrides longID for specific behavior. + */ + virtual std::string longID(const std::string &) const { + return Arg::getName() + " <" + _typeDesc + ">"; + } + + /** + * Overrides operator== for specific behavior. + */ + virtual bool operator==(const Arg &a) const; + + /** + * Instead of pushing to the front of list, push to the back. + * \param argList - The list to add this to. + */ + virtual void addToList(std::list &argList) const; + + virtual bool hasLabel() const { return false; } }; /** * Constructor implementation. */ -template -UnlabeledValueArg::UnlabeledValueArg(const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - bool ignoreable, - Visitor* v) -: ValueArg("", name, desc, req, val, typeDesc, v) -{ - _ignoreable = ignoreable; - - OptionalUnlabeledTracker::check(req, toString()); - +template +UnlabeledValueArg::UnlabeledValueArg(const std::string &name, + const std::string &desc, bool req, + T val, const std::string &typeDesc, + bool ignoreable, Visitor *v) + : ValueArg("", name, desc, req, val, typeDesc, v) { + _ignoreable = ignoreable; + + OptionalUnlabeledTracker::check(req, toString()); } -template -UnlabeledValueArg::UnlabeledValueArg(const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - CmdLineInterface& parser, - bool ignoreable, - Visitor* v) -: ValueArg("", name, desc, req, val, typeDesc, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(req, toString()); - parser.add( this ); +template +UnlabeledValueArg::UnlabeledValueArg(const std::string &name, + const std::string &desc, bool req, + T val, const std::string &typeDesc, + CmdLineInterface &parser, + bool ignoreable, Visitor *v) + : ValueArg("", name, desc, req, val, typeDesc, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); + parser.add(this); } /** * Constructor implementation. */ -template -UnlabeledValueArg::UnlabeledValueArg(const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - bool ignoreable, - Visitor* v) -: ValueArg("", name, desc, req, val, constraint, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(req, toString()); +template +UnlabeledValueArg::UnlabeledValueArg(const std::string &name, + const std::string &desc, bool req, + T val, const Constraint *constraint, + bool ignoreable, Visitor *v) + : ValueArg("", name, desc, req, val, constraint, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); } -template -UnlabeledValueArg::UnlabeledValueArg(const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - CmdLineInterface& parser, - bool ignoreable, - Visitor* v) -: ValueArg("", name, desc, req, val, constraint, v) -{ - _ignoreable = ignoreable; - OptionalUnlabeledTracker::check(req, toString()); - parser.add( this ); +template +UnlabeledValueArg::UnlabeledValueArg(const std::string &name, + const std::string &desc, bool req, + T val, const Constraint *constraint, + CmdLineInterface &parser, + bool ignoreable, Visitor *v) + : ValueArg("", name, desc, req, val, constraint, v) { + _ignoreable = ignoreable; + OptionalUnlabeledTracker::check(req, toString()); + parser.add(this); } /** * Implementation of processArg(). */ -template -bool UnlabeledValueArg::processArg(int *i, std::vector& args) -{ - - if ( _alreadySet ) - return false; - - if ( _hasBlanks( args[*i] ) ) - return false; - - // never ignore an unlabeled arg - - _extractValue( args[*i] ); - _alreadySet = true; - return true; -} +template +bool UnlabeledValueArg::processArg(int *i, std::vector &args) { + if (_alreadySet) return false; -/** - * Overriding shortID for specific output. - */ -template -std::string UnlabeledValueArg::shortID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return std::string("<") + _typeDesc + ">"; -} + if (_hasBlanks(args[*i])) return false; -/** - * Overriding longID for specific output. - */ -template -std::string UnlabeledValueArg::longID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn + // never ignore an unlabeled arg - // Ideally we would like to be able to use RTTI to return the name - // of the type required for this argument. However, g++ at least, - // doesn't appear to return terribly useful "names" of the types. - return std::string("<") + _typeDesc + ">"; + _extractValue(args[*i]); + _alreadySet = true; + _setBy = args[*i]; + this->_checkWithVisitor(); + return true; } /** * Overriding operator== for specific behavior. */ -template -bool UnlabeledValueArg::operator==(const Arg& a ) const -{ - if ( _name == a.getName() || _description == a.getDescription() ) - return true; - else - return false; +template +bool UnlabeledValueArg::operator==(const Arg &a) const { + if (_name == a.getName() || _description == a.getDescription()) + return true; + else + return false; } -template -void UnlabeledValueArg::addToList( std::list& argList ) const -{ - argList.push_back( const_cast(static_cast(this)) ); +template +void UnlabeledValueArg::addToList(std::list &argList) const { + argList.push_back(const_cast(static_cast(this))); } +} // namespace TCLAP -} -#endif +#endif // TCLAP_UNLABELED_VALUE_ARG_H diff --git a/tclap/include/tclap/ValueArg.h b/tclap/include/tclap/ValueArg.h index dee023a..7089bad 100644 --- a/tclap/include/tclap/ValueArg.h +++ b/tclap/include/tclap/ValueArg.h @@ -1,37 +1,36 @@ // -*- 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 + * + * 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. - * + * 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_ARG_H +#define TCLAP_VALUE_ARG_H -#ifndef TCLAP_VALUE_ARGUMENT_H -#define TCLAP_VALUE_ARGUMENT_H +#include +#include #include #include -#include -#include - namespace TCLAP { /** @@ -42,389 +41,313 @@ namespace TCLAP { * an unflagged ValueArg, it is unwise and would cause significant problems. * Instead use an UnlabeledValueArg. */ -template -class ValueArg : public Arg -{ +template +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* _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 ); + /** + * 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. + */ + const Constraint *_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* 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* 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& 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() ; + /** + * Labeled ValueArg 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. + * + * \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, ArgContainer &parser, + Visitor *v = NULL); + + /** + * Labeled ValueArg 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, + const Constraint *constraint, ArgContainer &parser, + Visitor *v = NULL); + + /** + * Labeled ValueArg 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, + const Constraint *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 &args); + + /** + * Returns the value of the argument. + */ + const T &getValue() const { 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(); private: /** * Prevent accidental copying */ - ValueArg(const ValueArg& rhs); - ValueArg& operator=(const ValueArg& rhs); + ValueArg(const ValueArg& rhs); + ValueArg& operator=(const ValueArg& rhs); }; - /** * Constructor implementation. */ -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - Visitor* v) - : Arg(flag, name, desc, req, true, v), - _value( val ), - _default( val ), - _typeDesc( typeDesc ), - _constraint( NULL ) -{ } - -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v) - : Arg(flag, name, desc, req, true, v), - _value( val ), - _default( val ), - _typeDesc( typeDesc ), - _constraint( NULL ) -{ - parser.add( this ); +template +ValueArg::ValueArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, T val, + const std::string &typeDesc, Visitor *v) + : Arg(flag, name, desc, req, true, v), + _value(val), + _default(val), + _typeDesc(typeDesc), + _constraint(NULL) {} + +template +ValueArg::ValueArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, T val, + const std::string &typeDesc, ArgContainer &parser, + Visitor *v) + : Arg(flag, name, desc, req, true, v), + _value(val), + _default(val), + _typeDesc(typeDesc), + _constraint(NULL) { + parser.add(this); } -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - Visitor* v) - : Arg(flag, name, desc, req, true, v), - _value( val ), - _default( val ), - _typeDesc( Constraint::shortID(constraint) ), - _constraint( constraint ) -{ } - -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - CmdLineInterface& parser, - Visitor* v) - : Arg(flag, name, desc, req, true, v), - _value( val ), - _default( val ), - _typeDesc( Constraint::shortID(constraint) ), // TODO(macbishop): Will crash - // if constraint is NULL - _constraint( constraint ) -{ - parser.add( this ); +template +ValueArg::ValueArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, T val, + const Constraint *constraint, Visitor *v) + : Arg(flag, name, desc, req, true, v), + _value(val), + _default(val), + _typeDesc(Constraint::shortID(constraint)), + _constraint(constraint) {} + +template +ValueArg::ValueArg(const std::string &flag, const std::string &name, + const std::string &desc, bool req, T val, + const Constraint *constraint, ArgContainer &parser, + Visitor *v) + : Arg(flag, name, desc, req, true, v), + _value(val), + _default(val), + _typeDesc(Constraint::shortID(constraint)), + _constraint(constraint) { + parser.add(this); } /** * Implementation of processArg(). */ -template -bool ValueArg::processArg(int *i, std::vector& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; - - if ( _hasBlanks( args[*i] ) ) - return false; - - std::string flag = args[*i]; - - std::string value = ""; - trimFlag( flag, value ); - - if ( argMatches( flag ) ) - { - if ( _alreadySet ) - { - if ( _xorSet ) - throw( CmdLineParseException("Mutually exclusive argument" - " already set!", toString())); - else - throw( CmdLineParseException("Argument already set!", - toString()) ); +template +bool ValueArg::processArg(int *i, std::vector &args) { + if (_hasBlanks(args[*i])) return false; + + std::string flag = args[*i]; + + std::string value = ""; + trimFlag(flag, value); + + if (argMatches(flag)) { + if (_alreadySet) { + 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(*i) < args.size() ) - _extractValue( args[*i] ); - else - throw( ArgParseException("Missing a value for this argument!", - toString() ) ); + if (Arg::delimiter() != ' ' && value == "") + throw(ArgParseException( + "Couldn't find delimiter for this argument!", toString())); + + if (value == "") { + (*i)++; + if (static_cast(*i) < args.size()) + _extractValue(args[*i]); + else + throw(ArgParseException("Missing a value for this argument!", + toString())); + } else { + _extractValue(value); } - else - _extractValue( value ); - - _alreadySet = true; - _checkWithVisitor(); - return true; - } - else - return false; + + _alreadySet = true; + _setBy = flag; + _checkWithVisitor(); + return true; + } else { + return false; + } } /** * Implementation of shortID. */ -template -std::string ValueArg::shortID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return Arg::shortID( _typeDesc ); +template +std::string ValueArg::shortID(const std::string &) const { + return Arg::shortID("<" + _typeDesc + ">"); } /** * Implementation of longID. */ -template -std::string ValueArg::longID(const std::string& val) const -{ - static_cast(val); // Ignore input, don't warn - return Arg::longID( _typeDesc ); +template +std::string ValueArg::longID(const std::string &) const { + return Arg::longID("<" + _typeDesc + ">"); } -template -void ValueArg::_extractValue( const std::string& val ) -{ - try { - ExtractValue(_value, val, typename ArgTraits::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() ) ); +template +void ValueArg::_extractValue(const std::string &val) { + try { + ExtractValue(_value, val, typename ArgTraits::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())); } -template -void ValueArg::reset() -{ - Arg::reset(); - _value = _default; +template +void ValueArg::reset() { + Arg::reset(); + _value = _default; } -} // namespace TCLAP +} // namespace TCLAP -#endif +#endif // TCLAP_VALUE_ARG_H diff --git a/tclap/include/tclap/ValueArgOld.h b/tclap/include/tclap/ValueArgOld.h deleted file mode 100644 index 4b258ac..0000000 --- a/tclap/include/tclap/ValueArgOld.h +++ /dev/null @@ -1,527 +0,0 @@ -/****************************************************************************** - * - * file: ValueArg.h - * - * Copyright (c) 2003, Michael E. Smoot . - * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. - * All rights reverved. - * - * 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, - * 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 -#define TCLAP_VALUE_ARGUMENT_H - -#include -#include - -#include -#include - -#ifdef HAVE_CONFIG_H -#include -#else -# ifndef HAVE_SSTREAM //This may have been defined elsewhere -# define HAVE_SSTREAM 1 -# endif -#endif - -#if defined(HAVE_SSTREAM) -#include -#elif defined(HAVE_STRSTREAM) -#include -#else -#error "Need a stringstream (sstream or strstream) to compile!" -#endif - -namespace TCLAP { - -template class ValueArg; - -namespace VALUE_ARG_HELPER { - -enum Error_e { EXTRACT_FAILURE = 1000, EXTRACT_TOO_MANY }; - -/** - * This class is used to extract a value from an argument. - * It is used because we need a special implementation to - * deal with std::string and making a specialiced function - * puts it in the T segment, thus generating link errors. - * Having a specialiced class makes the symbols weak. - * This is not pretty but I don't know how to make it - * work any other way. - */ -template class ValueExtractor -{ - /** - * - */ - friend class ValueArg; - - private: - - /** - * Reference to the value where the result of the extraction will - * be put. - */ - T &_value; - - /** - * Constructor. - * \param value - Where the value extracted will be put. - */ - ValueExtractor(T &value) : _value(value) { } - - /** - * Method that will attempt to parse the input stream for a value - * of type T. - * \param val - Where the value parsed will be put. - */ - int extractValue( const std::string& val ) - { - -#if defined(HAVE_SSTREAM) - std::istringstream is(val); -#elif defined(HAVE_STRSTREAM) - std::istrstream is(val.c_str()); -#else -#error "Need a stringstream (sstream or strstream) to compile!" -#endif - - int valuesRead = 0; - while ( is.good() ) - { - if ( is.peek() != EOF ) - is >> _value; - else - break; - - valuesRead++; - } - - if ( is.fail() ) - return EXTRACT_FAILURE; - - if ( valuesRead > 1 ) - return EXTRACT_TOO_MANY; - - return 0; - } -}; - -/** - * Specialization for string. This is necessary because istringstream - * operator>> is not able to ignore spaces... meaning -x "X Y" will only - * read 'X'... and thus the specialization. - */ -template<> class ValueExtractor -{ - /** - * - */ - friend class ValueArg; - - private: - - /** - * Reference to the value where the result of the extraction will - * be put. - */ - std::string &_value; - - /** - * Constructor. - * \param value - Where the value extracted will be put. - */ - ValueExtractor(std::string &value) : _value(value) {} - - /** - * Method that will attempt to parse the input stream for a value - * of type std::string. - * \param val - Where the string parsed will be put. - */ - int extractValue( const std::string& val ) - { - _value = val; - return 0; - } -}; - -} //namespace VALUE_ARG_HELPER - -/** - * The basic labeled argument that parses a value. - * This is a template class, which means the type T defines the type - * that a given object will attempt to parse when the flag/name is matched - * on the command line. While there is nothing stopping you from creating - * an unflagged ValueArg, it is unwise and would cause significant problems. - * Instead use an UnlabeledValueArg. - */ -template -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; - - /** - * 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* _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* 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* 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& 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; - virtual std::string getTypeDescription() { return _typeDesc; }; - -}; - - -/** - * Constructor implementation. - */ -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - Visitor* v) -: Arg(flag, name, desc, req, true, v), - _value( val ), - _typeDesc( typeDesc ), - _constraint( NULL ) -{ } - -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - const std::string& typeDesc, - CmdLineInterface& parser, - Visitor* v) -: Arg(flag, name, desc, req, true, v), - _value( val ), - _typeDesc( typeDesc ), - _constraint( NULL ) -{ - parser.add( this ); -} - -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - Visitor* v) -: Arg(flag, name, desc, req, true, v), - _value( val ), - _typeDesc( constraint->shortID() ), - _constraint( constraint ) -{ } - -template -ValueArg::ValueArg(const std::string& flag, - const std::string& name, - const std::string& desc, - bool req, - T val, - Constraint* constraint, - CmdLineInterface& parser, - Visitor* v) -: Arg(flag, name, desc, req, true, v), - _value( val ), - _typeDesc( constraint->shortID() ), - _constraint( constraint ) -{ - parser.add( this ); -} - - -/** - * Implementation of getValue(). - */ -template -T& ValueArg::getValue() { return _value; } - -/** - * Implementation of processArg(). - */ -template -bool ValueArg::processArg(int *i, std::vector& args) -{ - if ( _ignoreable && Arg::ignoreRest() ) - return false; - - if ( _hasBlanks( args[*i] ) ) - return false; - - std::string flag = args[*i]; - - std::string value = ""; - trimFlag( flag, value ); - - if ( argMatches( flag ) ) - { - if ( _alreadySet ) - 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(*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; -} - -/** - * Implementation of shortID. - */ -template -std::string ValueArg::shortID(const std::string& val) const -{ - return Arg::shortID( _typeDesc ); -} - -/** - * Implementation of longID. - */ -template -std::string ValueArg::longID(const std::string& val) const -{ - return Arg::longID( _typeDesc ); -} - -template -void ValueArg::_extractValue( const std::string& val ) -{ - VALUE_ARG_HELPER::ValueExtractor ve(_value); - - int err = ve.extractValue(val); - - if ( err == VALUE_ARG_HELPER::EXTRACT_FAILURE ) - throw( ArgParseException("Couldn't read argument value from string '" + - val + "'", toString() ) ); - - if ( err == VALUE_ARG_HELPER::EXTRACT_TOO_MANY ) - throw( ArgParseException( - "More than one valid value parsed from string '" + - val + "'", toString() ) ); - - if ( _constraint != NULL ) - if ( ! _constraint->check( _value ) ) - throw( CmdLineParseException( "Value '" + val + - "' does not meet constraint: " + - _constraint->description(), - toString() ) ); -} - -} // namespace TCLAP - -#endif diff --git a/tclap/include/tclap/ValuesConstraint.h b/tclap/include/tclap/ValuesConstraint.h index 3c4dca0..cee236d 100644 --- a/tclap/include/tclap/ValuesConstraint.h +++ b/tclap/include/tclap/ValuesConstraint.h @@ -1,138 +1,115 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - -/****************************************************************************** - * +/****************************************************************************** + * * 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 * 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, - * 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_VALUESCONSTRAINT_H -#define TCLAP_VALUESCONSTRAINT_H - -#ifdef HAVE_CONFIG_H -# include -#else -# ifndef HAVE_SSTREAM //This may have been defined elsewhere -# define HAVE_SSTREAM 1 -# endif -#endif + * + * 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. + * + *****************************************************************************/ + +#ifndef TCLAP_VALUES_CONSTRAINT_H +#define TCLAP_VALUES_CONSTRAINT_H -#include -#include #include #include +#include +#include + namespace TCLAP { /** * A Constraint that constrains the Arg to only those values specified * in the constraint. */ -template -class ValuesConstraint : public Constraint -{ - - public: - - /** - * Constructor. - * \param allowed - vector of allowed values. - */ - ValuesConstraint(std::vectorconst& allowed); - - /** - * Virtual destructor. - */ - virtual ~ValuesConstraint() {} - - /** - * Returns a description of the Constraint. - */ - virtual std::string description() const; - - /** - * Returns the short ID for the Constraint. - */ - virtual std::string shortID() const; - - /** - * The method used to verify that the value parsed from the command - * line meets the constraint. - * \param value - The value that will be checked. - */ - virtual bool check(const T& value) const; - - protected: - - /** - * The list of valid values. - */ - std::vector _allowed; - - /** - * The string used to describe the allowed values of this constraint. - */ - std::string _typeDesc; - +template +class ValuesConstraint : public Constraint { +public: + /** + * Constructor. + * \param allowed - vector of allowed values. + */ + explicit ValuesConstraint(std::vector &allowed); + + /** + * Virtual destructor. + */ + virtual ~ValuesConstraint() {} + + /** + * Returns a description of the Constraint. + */ + virtual std::string description() const; + + /** + * Returns the short ID for the Constraint. + */ + virtual std::string shortID() const; + + /** + * The method used to verify that the value parsed from the command + * line meets the constraint. + * \param value - The value that will be checked. + */ + virtual bool check(const T &value) const; + +protected: + /** + * The list of valid values. + */ + std::vector _allowed; + + /** + * The string used to describe the allowed values of this constraint. + */ + std::string _typeDesc; }; -template -ValuesConstraint::ValuesConstraint(std::vector const& allowed) -: _allowed(allowed), - _typeDesc("") -{ - for ( unsigned int i = 0; i < _allowed.size(); i++ ) - { +template +ValuesConstraint::ValuesConstraint(std::vector &allowed) + : _allowed(allowed), _typeDesc("") { + for (unsigned int i = 0; i < _allowed.size(); i++) { std::ostringstream os; os << _allowed[i]; - std::string temp( os.str() ); + std::string temp(os.str()); - if ( i > 0 ) - _typeDesc += "|"; + if (i > 0) _typeDesc += "|"; _typeDesc += temp; } } -template -bool ValuesConstraint::check( const T& val ) const -{ - if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() ) - return false; - else - return true; +template +bool ValuesConstraint::check(const T &val) const { + if (std::find(_allowed.begin(), _allowed.end(), val) == _allowed.end()) + return false; + else + return true; } -template -std::string ValuesConstraint::shortID() const -{ - return _typeDesc; +template +std::string ValuesConstraint::shortID() const { + return _typeDesc; } -template -std::string ValuesConstraint::description() const -{ - return _typeDesc; +template +std::string ValuesConstraint::description() const { + return _typeDesc; } - -} //namespace TCLAP -#endif - +} // namespace TCLAP +#endif // TCLAP_VALUES_CONSTRAINT_H diff --git a/tclap/include/tclap/VersionVisitor.h b/tclap/include/tclap/VersionVisitor.h index 3ef8b58..e9f0f13 100644 --- a/tclap/include/tclap/VersionVisitor.h +++ b/tclap/include/tclap/VersionVisitor.h @@ -1,25 +1,24 @@ // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- -/****************************************************************************** - * +/****************************************************************************** + * * file: VersionVisitor.h - * + * * Copyright (c) 2003, Michael E. Smoot . * 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_VERSION_VISITOR_H #define TCLAP_VERSION_VISITOR_H @@ -34,48 +33,43 @@ namespace TCLAP { * A Visitor that will call the version method of the given CmdLineOutput * for the specified CmdLine object and then exit. */ -class VersionVisitor: public Visitor -{ - private: - /** - * Prevent accidental copying - */ - VersionVisitor(const VersionVisitor& rhs); - VersionVisitor& operator=(const VersionVisitor& rhs); - - protected: - - /** - * The CmdLine of interest. - */ - CmdLineInterface* _cmd; +class VersionVisitor : public Visitor { +private: + /** + * Prevent accidental copying + */ + VersionVisitor(const VersionVisitor &rhs); + VersionVisitor &operator=(const VersionVisitor &rhs); - /** - * The output object. - */ - CmdLineOutput** _out; +protected: + /** + * The CmdLine of interest. + */ + CmdLineInterface *_cmd; - public: + /** + * The output object. + */ + CmdLineOutput **_out; - /** - * Constructor. - * \param cmd - The CmdLine the output is generated for. - * \param out - The type of output. - */ - VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) - : Visitor(), _cmd( cmd ), _out( out ) { } - - /** - * Calls the version method of the output object using the - * specified CmdLine. - */ - void visit() { - (*_out)->version(*_cmd); - throw ExitException(0); - } +public: + /** + * Constructor. + * \param cmd - The CmdLine the output is generated for. + * \param out - The type of output. + */ + VersionVisitor(CmdLineInterface *cmd, CmdLineOutput **out) + : Visitor(), _cmd(cmd), _out(out) {} + /** + * Calls the version method of the output object using the + * specified CmdLine. + */ + void visit() { + (*_out)->version(*_cmd); + throw ExitException(0); + } }; +} // namespace TCLAP -} - -#endif +#endif // TCLAP_VERSION_VISITOR_H diff --git a/tclap/include/tclap/Visitor.h b/tclap/include/tclap/Visitor.h index 2a7bfd1..c1b2ea3 100644 --- a/tclap/include/tclap/Visitor.h +++ b/tclap/include/tclap/Visitor.h @@ -1,27 +1,25 @@ // -*- 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 * 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, - * 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. - * - *****************************************************************************/ - + * + * 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. + * + *****************************************************************************/ #ifndef TCLAP_VISITOR_H #define TCLAP_VISITOR_H @@ -31,27 +29,24 @@ namespace TCLAP { /** * A base class that defines the interface for visitors. */ -class Visitor -{ - public: - - /** - * Constructor. Does nothing. - */ - Visitor() { } - - /** - * Destructor. Does nothing. - */ - virtual ~Visitor() { } - - /** - * This method (to implemented by children) will be - * called when the visitor is visited. - */ - virtual void visit() = 0; +class Visitor { +public: + /** + * Constructor. Does nothing. + */ + Visitor() {} + + /** + * Destructor. Does nothing. + */ + virtual ~Visitor() {} + + /** + * This method (to implemented by children) will be + * called when the visitor is visited. + */ + virtual void visit() = 0; }; +} // namespace TCLAP -} - -#endif +#endif // TCLAP_VISITOR_H diff --git a/tclap/include/tclap/XMLOutput.h b/tclap/include/tclap/XMLOutput.h deleted file mode 100644 index 9362168..0000000 --- a/tclap/include/tclap/XMLOutput.h +++ /dev/null @@ -1,261 +0,0 @@ - -/****************************************************************************** - * - * file: XMLOutput.h - * - * Copyright (c) 2004, Michael E. Smoot - * All rights reverved. - * - * 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, - * 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_XMLOUTPUT_H -#define TCLAP_XMLOUTPUT_H - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace TCLAP { - -/** - * A class that generates XML output for usage() method for the - * given CmdLine and its Args. - */ -class XMLOutput : public CmdLineOutput -{ - - public: - - /** - * Prints the usage to stdout. Can be overridden to - * produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void usage(CmdLineInterface& c); - - /** - * Prints the version to stdout. Can be overridden - * to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void version(CmdLineInterface& c); - - /** - * Prints (to stderr) an error message, short usage - * Can be overridden to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - * \param e - The ArgException that caused the failure. - */ - virtual void failure(CmdLineInterface& c, - ArgException& e ); - - protected: - - /** - * Substitutes the char r for string x in string s. - * \param s - The string to operate on. - * \param r - The char to replace. - * \param x - What to replace r with. - */ - void substituteSpecialChars( std::string& s, char r, std::string& x ); - void removeChar( std::string& s, char r); - - void printShortArg(Arg* it); - void printLongArg(Arg* it); -}; - - -inline void XMLOutput::version(CmdLineInterface& _cmd) -{ - std::cout << _cmd.getVersion() << std::endl; -} - -inline void XMLOutput::usage(CmdLineInterface& _cmd ) -{ - std::list argList = _cmd.getArgList(); - std::string progName = _cmd.getProgramName(); - std::string version = _cmd.getVersion(); - XorHandler xorHandler = _cmd.getXorHandler(); - std::vector< std::vector > xorList = xorHandler.getXorList(); - - - std::cout << "" << std::endl; - std::cout << "" << std::endl; - std::cout << "" << generateSafeString ( progName ) << "" << std::endl; - std::cout << "" << generateSafeString ( version ) << "" << std::endl; - std::cout << "" << std::endl; - - // Start the parameters - std::cout << "" << std::endl; - - // Do the xor's first - for ( int i = 0; (unsigned int)i < xorList.size(); i++ ) - { - std::cout << "" << std::endl; - for ( ArgVectorIterator it = xorList[i].begin(); - it != xorList[i].end(); it++ ) - { - printLongArg((*it)); - } - std::cout << "" << std::endl; - } - - // rest of args - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - { - if ( !xorHandler.contains( (*it) ) ) - { - printLongArg((*it)); - } - } - std::cout << "" << std::endl; - std::cout << "" << std::endl; -} - -inline void XMLOutput::failure( CmdLineInterface& _cmd, - ArgException& e ) -{ - std::cout << e.what() << std::endl; -} - -inline void XMLOutput::substituteSpecialChars( std::string& s, - char r, - std::string& x ) -{ - std::string::size_type p; - while ( (p = s.find_first_of(r)) != std::string::npos ) - { - s.erase(p,1); - s.insert(p,x); - } -} - -inline void XMLOutput::removeChar( std::string& s, char r) -{ - std::string::size_type p; - while ( (p = s.find_first_of(r)) != std::string::npos ) - { - s.erase(p,1); - } -} - - inline std::string XMLOutput::generateSafeString ( std::string s ) - { - std::string lt = "<"; - std::string gt = ">"; - std::string amp = "&"; - std::string apos = "'"; - std::string quot = """; - - std::out ( s ); - substituteSpecialChars(out,'<',lt); - substituteSpecialChars(out,'>',gt); - substituteSpecialChars(out,'&',amp); - substituteSpecialChars(out,'\'',apos); - substituteSpecialChars(out,'"',quot); - removeChar(out,'['); - removeChar(out,']'); - return out; - } - - -inline void XMLOutput::printShortArg(Arg* a) -{ - std::string lt = "<"; - std::string gt = ">"; - - std::string id = a->shortID(); - substituteSpecialChars(id,'<',lt); - substituteSpecialChars(id,'>',gt); - removeChar(id,'['); - removeChar(id,']'); - - std::string choice = "opt"; - if ( a->isRequired() ) - choice = "req"; - - std::string repeat = "norepeat"; - if ( a->acceptsMultipleValues() ) - repeat = "repeat"; - - - - std::cout << "" - << id << "" << std::endl; - -} - -inline void XMLOutput::printLongArg(Arg* a) -{ - - std::string id = a->longID(); - std::string desc = a->getDescription(); - - - if ( a->isValueRequired() ) - { - std::cout << "getName() ) << " "; - std::cout << "flag=\"" << generateSafeString ( a->getFlag() ) << " "; - if ( a->isRequired() ) - { - std::cout << "required=\"true\" "; - } - else - { - std::cout << "required=\"false\" "; - } - if ( a->acceptsMultipleValues() ) - { - std::cout << "allowrepeats=\"true\" "; - } - else - { - std::cout << "allowrepeats=\"false\" "; - } - std::cout << "type=\"" << a->getTypeDescription() << "\" "; - std::cout << ">" << std::endl; - - - - - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << id << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; - std::cout << desc << std::endl; - std::cout << "" << std::endl; - - std::cout << "" << std::endl; -} - -} //namespace TCLAP -#endif diff --git a/tclap/include/tclap/XorHandler.h b/tclap/include/tclap/XorHandler.h deleted file mode 100644 index e80f9ee..0000000 --- a/tclap/include/tclap/XorHandler.h +++ /dev/null @@ -1,168 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - - -/****************************************************************************** - * - * file: XorHandler.h - * - * Copyright (c) 2003, Michael E. Smoot . - * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. - * 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, - * 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_XORHANDLER_H -#define TCLAP_XORHANDLER_H - -#include -#include -#include -#include -#include - -namespace TCLAP { - -/** - * This class handles lists of Arg's that are to be XOR'd on the command - * line. This is used by CmdLine and you shouldn't ever use it. - */ -class XorHandler -{ - protected: - - /** - * The list of of lists of Arg's to be or'd together. - */ - std::vector< std::vector > _orList; - - public: - - /** - * Constructor. Does nothing. - */ - XorHandler( ) : _orList(std::vector< std::vector >()) {} - - /** - * Add a list of Arg*'s that will be xor'd together. - * \param ors - list of Arg* that will be xor'd. - */ - void add( const std::vector& 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 - * Arg matched. If the Arg matches, then it also sets the rest of - * the Arg's in the list. You shouldn't use this. - * \param a - The Arg to be checked. - */ - int check( const Arg* a ); - - /** - * Returns the XOR specific short usage. - */ - std::string shortUsage(); - - /** - * Prints the XOR specific long usage. - * \param os - Stream to print to. - */ - void printLongUsage(std::ostream& os); - - /** - * Simply checks whether the Arg is contained in one of the arg - * lists. - * \param a - The Arg to be checked. - */ - bool contains( const Arg* a ); - - const std::vector< std::vector >& getXorList() const; - -}; - - -////////////////////////////////////////////////////////////////////// -//BEGIN XOR.cpp -////////////////////////////////////////////////////////////////////// -inline void XorHandler::add( const std::vector& ors ) -{ - _orList.push_back( ors ); -} - -inline int XorHandler::check( const Arg* a ) -{ - // iterate over each XOR list - for ( int i = 0; static_cast(i) < _orList.size(); i++ ) - { - // if the XOR list contains the arg.. - ArgVectorIterator ait = std::find( _orList[i].begin(), - _orList[i].end(), a ); - if ( ait != _orList[i].end() ) - { - // first check to see if a mutually exclusive switch - // has not already been set - for ( ArgVectorIterator it = _orList[i].begin(); - it != _orList[i].end(); - it++ ) - if ( a != (*it) && (*it)->isSet() ) - throw(CmdLineParseException( - "Mutually exclusive argument already set!", - (*it)->toString())); - - // go through and set each arg that is not a - for ( ArgVectorIterator it = _orList[i].begin(); - it != _orList[i].end(); - it++ ) - if ( a != (*it) ) - (*it)->xorSet(); - - // return the number of required args that have now been set - if ( (*ait)->allowMore() ) - return 0; - else - return static_cast(_orList[i].size()); - } - } - - if ( a->isRequired() ) - return 1; - else - return 0; -} - -inline bool XorHandler::contains( const Arg* a ) -{ - for ( int i = 0; static_cast(i) < _orList.size(); i++ ) - for ( ArgVectorIterator it = _orList[i].begin(); - it != _orList[i].end(); - it++ ) - if ( a == (*it) ) - return true; - - return false; -} - -inline const std::vector< std::vector >& XorHandler::getXorList() const -{ - return _orList; -} - - - -////////////////////////////////////////////////////////////////////// -//END XOR.cpp -////////////////////////////////////////////////////////////////////// - -} //namespace TCLAP - -#endif diff --git a/tclap/include/tclap/ZshCompletionOutput.h b/tclap/include/tclap/ZshCompletionOutput.h deleted file mode 100644 index 5a9268c..0000000 --- a/tclap/include/tclap/ZshCompletionOutput.h +++ /dev/null @@ -1,336 +0,0 @@ -// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- - -/****************************************************************************** - * - * file: ZshCompletionOutput.h - * - * Copyright (c) 2006, Oliver Kiddle - * Copyright (c) 2017 Google Inc. - * 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, - * 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_ZSHCOMPLETIONOUTPUT_H -#define TCLAP_ZSHCOMPLETIONOUTPUT_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace TCLAP { - -/** - * A class that generates a Zsh completion function as output from the usage() - * method for the given CmdLine and its Args. - */ -class ZshCompletionOutput : public CmdLineOutput -{ - - public: - - ZshCompletionOutput(); - - /** - * Prints the usage to stdout. Can be overridden to - * produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void usage(CmdLineInterface& c); - - /** - * Prints the version to stdout. Can be overridden - * to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - */ - virtual void version(CmdLineInterface& c); - - /** - * Prints (to stderr) an error message, short usage - * Can be overridden to produce alternative behavior. - * \param c - The CmdLine object the output is generated for. - * \param e - The ArgException that caused the failure. - */ - virtual void failure(CmdLineInterface& c, - ArgException& e ); - - protected: - - void basename( std::string& s ); - void quoteSpecialChars( std::string& s ); - - std::string getMutexList( CmdLineInterface& _cmd, Arg* a ); - void printOption( Arg* it, std::string mutex ); - void printArg( Arg* it ); - - std::map common; - char theDelimiter; -}; - -ZshCompletionOutput::ZshCompletionOutput() -: common(std::map()), - theDelimiter('=') -{ - common["host"] = "_hosts"; - common["hostname"] = "_hosts"; - common["file"] = "_files"; - common["filename"] = "_files"; - common["user"] = "_users"; - common["username"] = "_users"; - common["directory"] = "_directories"; - common["path"] = "_directories"; - common["url"] = "_urls"; -} - -inline void ZshCompletionOutput::version(CmdLineInterface& _cmd) -{ - std::cout << _cmd.getVersion() << std::endl; -} - -inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd ) -{ - std::list argList = _cmd.getArgList(); - std::string progName = _cmd.getProgramName(); - std::string xversion = _cmd.getVersion(); - theDelimiter = _cmd.getDelimiter(); - basename(progName); - - std::cout << "#compdef " << progName << std::endl << std::endl << - "# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl << - "_arguments -s -S"; - - for (ArgListIterator it = argList.begin(); it != argList.end(); it++) - { - if ( (*it)->shortID().at(0) == '<' ) - printArg((*it)); - else if ( (*it)->getFlag() != "-" ) - printOption((*it), getMutexList(_cmd, *it)); - } - - std::cout << std::endl; -} - -inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd, - ArgException& e ) -{ - static_cast(_cmd); // unused - std::cout << e.what() << std::endl; -} - -inline void ZshCompletionOutput::quoteSpecialChars( std::string& s ) -{ - size_t idx = s.find_last_of(':'); - while ( idx != std::string::npos ) - { - s.insert(idx, 1, '\\'); - idx = s.find_last_of(':', idx); - } - idx = s.find_last_of('\''); - while ( idx != std::string::npos ) - { - s.insert(idx, "'\\'"); - if (idx == 0) - idx = std::string::npos; - else - idx = s.find_last_of('\'', --idx); - } -} - -inline void ZshCompletionOutput::basename( std::string& s ) -{ - size_t p = s.find_last_of('/'); - if ( p != std::string::npos ) - { - s.erase(0, p + 1); - } -} - -inline void ZshCompletionOutput::printArg(Arg* a) -{ - static int count = 1; - - std::cout << " \\" << std::endl << " '"; - if ( a->acceptsMultipleValues() ) - std::cout << '*'; - else - std::cout << count++; - std::cout << ':'; - if ( !a->isRequired() ) - std::cout << ':'; - - std::cout << a->getName() << ':'; - std::map::iterator compArg = common.find(a->getName()); - if ( compArg != common.end() ) - { - std::cout << compArg->second; - } - else - { - std::cout << "_guard \"^-*\" " << a->getName(); - } - std::cout << '\''; -} - -inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex) -{ - std::string flag = a->flagStartChar() + a->getFlag(); - std::string name = a->nameStartString() + a->getName(); - std::string desc = a->getDescription(); - - // remove full stop and capitalization from description as - // this is the convention for zsh function - if (!desc.compare(0, 12, "(required) ")) - { - desc.erase(0, 12); - } - if (!desc.compare(0, 15, "(OR required) ")) - { - desc.erase(0, 15); - } - size_t len = desc.length(); - if (len && desc.at(--len) == '.') - { - desc.erase(len); - } - if (len) - { - desc.replace(0, 1, 1, tolower(desc.at(0))); - } - - std::cout << " \\" << std::endl << " '" << mutex; - - if ( a->getFlag().empty() ) - { - std::cout << name; - } - else - { - std::cout << "'{" << flag << ',' << name << "}'"; - } - if ( theDelimiter == '=' && a->isValueRequired() ) - std::cout << "=-"; - quoteSpecialChars(desc); - std::cout << '[' << desc << ']'; - - if ( a->isValueRequired() ) - { - std::string arg = a->shortID(); - // Example arg: "[-A ] ..." - size_t pos = arg.rfind(" ..."); - - if (pos != std::string::npos) { - arg.erase(pos); - } - - arg.erase(0, arg.find_last_of(theDelimiter) + 1); - if ( arg.at(arg.length()-1) == ']' ) - arg.erase(arg.length()-1); - if ( arg.at(arg.length()-1) == ']' ) - { - arg.erase(arg.length()-1); - } - if ( arg.at(0) == '<' ) - { - arg.erase(arg.length()-1); - arg.erase(0, 1); - } - size_t p = arg.find('|'); - if ( p != std::string::npos ) - { - do - { - arg.replace(p, 1, 1, ' '); - } - while ( (p = arg.find_first_of('|', p)) != std::string::npos ); - quoteSpecialChars(arg); - std::cout << ": :(" << arg << ')'; - } - else - { - std::cout << ':' << arg; - std::map::iterator compArg = common.find(arg); - if ( compArg != common.end() ) - { - std::cout << ':' << compArg->second; - } - } - } - - std::cout << '\''; -} - -inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a) -{ - XorHandler xorHandler = _cmd.getXorHandler(); - std::vector< std::vector > xorList = xorHandler.getXorList(); - - if (a->getName() == "help" || a->getName() == "version") - { - return "(-)"; - } - - ostringstream list; - if ( a->acceptsMultipleValues() ) - { - list << '*'; - } - - for ( int i = 0; static_cast(i) < xorList.size(); i++ ) - { - for ( ArgVectorIterator it = xorList[i].begin(); - it != xorList[i].end(); - it++) - if ( a == (*it) ) - { - list << '('; - for ( ArgVectorIterator iu = xorList[i].begin(); - iu != xorList[i].end(); - iu++ ) - { - bool notCur = (*iu) != a; - bool hasFlag = !(*iu)->getFlag().empty(); - if ( iu != xorList[i].begin() && (notCur || hasFlag) ) - list << ' '; - if (hasFlag) - list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' '; - if ( notCur || hasFlag ) - list << (*iu)->nameStartString() << (*iu)->getName(); - } - list << ')'; - return list.str(); - } - } - - // wasn't found in xor list - if (!a->getFlag().empty()) { - list << "(" << a->flagStartChar() << a->getFlag() << ' ' << - a->nameStartString() << a->getName() << ')'; - } - - return list.str(); -} - -} //namespace TCLAP -#endif diff --git a/tclap/include/tclap/sstream.h b/tclap/include/tclap/sstream.h index a99bcf3..b6bdbcf 100644 --- a/tclap/include/tclap/sstream.h +++ b/tclap/include/tclap/sstream.h @@ -25,26 +25,24 @@ #ifndef TCLAP_SSTREAM_H #define TCLAP_SSTREAM_H -#if !defined(HAVE_STRSTREAM) +#if !defined(TCLAP_HAVE_STRSTREAM) // Assume sstream is available if strstream is not specified // (https://sourceforge.net/p/tclap/bugs/23/) -# ifndef HAVE_SSTREAM //This may have been defined elsewhere -# define HAVE_SSTREAM 1 -# endif +#define TCLAP_HAVE_SSTREAM #endif -#if defined(HAVE_SSTREAM) +#if defined(TCLAP_HAVE_SSTREAM) #include namespace TCLAP { - typedef std::istringstream istringstream; - typedef std::ostringstream ostringstream; -} -#elif defined(HAVE_STRSTREAM) +typedef std::istringstream istringstream; +typedef std::ostringstream ostringstream; +} // namespace TCLAP +#elif defined(TCLAP_HAVE_STRSTREAM) #include namespace TCLAP { - typedef std::istrstream istringstream; - typedef std::ostrstream ostringstream; -} +typedef std::istrstream istringstream; +typedef std::ostrstream ostringstream; +} // namespace TCLAP #else #error "Need a stringstream (sstream or strstream) to compile!" #endif diff --git a/tclap/msc/Makefile.am b/tclap/msc/Makefile.am deleted file mode 100644 index bc6e8d9..0000000 --- a/tclap/msc/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -SUBDIRS = examples - -EXTRA_DIST = README\ - tclap-beta.ncb\ - tclap-beta.sln\ - tclap-beta.suo\ - tclap-beta.vcproj - - diff --git a/tclap/msc/README b/tclap/msc/README deleted file mode 100644 index ec7774b..0000000 --- a/tclap/msc/README +++ /dev/null @@ -1,17 +0,0 @@ - -Disclaimer! -=========== - -The various files included in the subdirectory for provided as a courtesy -to Microsoft Visual Studio users. The files were contributed by a thoughtful -user and were not created by the authors of this project. Moreover, the -(current) authors have no way of maintaining, improving or even using the -files. - -** This means we can't answer any questions about the files! ** - -That said, we have several reports of people successfully using the TCLAP -library on various Windows platforms. As long as you use a reasonably modern -compiler (and Visual C++ apparently is), you shouldn't have any trouble. - -Good luck! diff --git a/tclap/msc/examples/Makefile.am b/tclap/msc/examples/Makefile.am deleted file mode 100644 index 0c178ce..0000000 --- a/tclap/msc/examples/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ - -EXTRA_DIST = test1.vcproj\ - test2.vcproj\ - test3.vcproj\ - test4.vcproj\ - test5.vcproj\ - test6.vcproj\ - test7.vcproj\ - test8.vcproj - diff --git a/tclap/msc/examples/test1.vcproj b/tclap/msc/examples/test1.vcproj deleted file mode 100755 index c16506a..0000000 --- a/tclap/msc/examples/test1.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test2.vcproj b/tclap/msc/examples/test2.vcproj deleted file mode 100755 index 998da8c..0000000 --- a/tclap/msc/examples/test2.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test3.vcproj b/tclap/msc/examples/test3.vcproj deleted file mode 100755 index 1dcbcc2..0000000 --- a/tclap/msc/examples/test3.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test4.vcproj b/tclap/msc/examples/test4.vcproj deleted file mode 100755 index a3e1bca..0000000 --- a/tclap/msc/examples/test4.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test5.vcproj b/tclap/msc/examples/test5.vcproj deleted file mode 100755 index b429a6b..0000000 --- a/tclap/msc/examples/test5.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test6.vcproj b/tclap/msc/examples/test6.vcproj deleted file mode 100755 index deb50bd..0000000 --- a/tclap/msc/examples/test6.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test7.vcproj b/tclap/msc/examples/test7.vcproj deleted file mode 100755 index 6a7c93c..0000000 --- a/tclap/msc/examples/test7.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/examples/test8.vcproj b/tclap/msc/examples/test8.vcproj deleted file mode 100755 index 082a7ae..0000000 --- a/tclap/msc/examples/test8.vcproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/msc/tclap-beta.ncb b/tclap/msc/tclap-beta.ncb deleted file mode 100755 index 8374d10224e6ac7c5b4f1c16afcf8090426135c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44032 zcmeHQTWlQF8UAN|jT2)#2_cD-FmV#cB#ke*I?e?Ditws zS`B`h*Pwd)q)n{>t%2)Y1MN47T-KyDpfzwqYCs^k}+5 z19Ktaxc)t;+@-XWH+|4K)%?d2k@+|?t9ro)kS9B#(*MBzHkfD1$+RyABZw>pF9I(C z-wI}yF#DLrCU_~h0n9AsE%^%Ye#|OnE3=)i0n>OhSd-R(*1*(ifMuHPKZ}2E`_Jn3 zsmXOmkh zxphKFLb3pz^->Je#pLrEr~_t56J@+KX@pQGRLRnSzY>fAW=dN?R*GR725P8B3@^S4 zi~|iqOa{Q|18(P56D8QT)!QVm0+x2EvryoOIhGeYQI#~6V;S? z<-bhTCm#jEmaFnVFW|2NQ$CpVK~&kgqYCo|X11PCbw@Sk6zZ}vb>CW9Cie>K3zs(_ zZq^-cU83s|=8vXNs|N6@gC1q^(WEt?HE@GzfaCTT`OK&QIA`yg%9_V8JC)ZwE>kCZ z^4a5EOwSVV8npjga8WM@b8etU8DgFhQz}g{OgUG%wA7ew80bxeN-I0Dlu*f`h$+&E zHHA)eSk8z;MyQk0PMAfIo37`OCiY+KWs=;5rL#!`tcVI`}No z^aj|ThjAC!+@MpPE-1FwjT`4&H9%yi>%gufn3v@^j_;biAg3&jG1cihV=}+TBR3!4 zN4hu;y+U7)nc3iZo-6B^V+-Y6tIH<)vGY0Q$lP>2!xsiG(Y00{Kg%b%2GjKp(sk{< z_c@uXFSQ1)K@FfdgC14Qq?^3lxxPZ?|A`O!pYT6iyVL7`ZWidX*1%QKKri|%H3Bf5 zDVS{+X_dER1!S{lY(4DCny}VaPZ?9>_*;p^d1vm>ldX^yav2qh-`{eef$DO?HcDe) zje+-V!0}X0*d;&?{UJwYA_2Q?*?Cx1nit3dd5E$yvITuKcNhE z*Wax`CVgGW(w=NFRunGf_*;gV!X+3@ushg^!NfugEgqL|=g2DMNua4bei>o6v%GSwOadk0J#y6eyz#3*e7*8>96{M` zc?E|jQ(^Z=i_wt{t7Q9StFgm)A`ssJc@~E!Q~vIf%TjF|2#Kt>wl#F3+$@y4P`|Xw z4#?IXP9#_c>mgeue=^!2D{pAoZp#khO}#~oM7xASb0vg&AOs{~2#CQD%4P^|A(Y1u z%0dYBMhNJ{5Xx}~cL)I~7?Rt-O%h7hN@#lx;@F7m72xIIb>Ow&W^gO`GZIRObm9Kz z@Jub>K`^gr-|f2|&pi$QWUeogiKpb6!a1;eru=!Zd;SLeaD9PiSLU86I|{!u9sj>T zI_UOe=bU?evm>u`&bin5);}5FEWAJCoq3;2PMjBV&aNAENss1o!KKzgBb5q9k|KM7`jsFR* z*W37?;Cj7{|KWUHcCFus{~7$ZbKhd{Kc7==th;8>#lG@?w=Vy-dbFuEaNTNP%<+F$gZE#b zvBv+wvHldz|51}Bjbi5ij_CP6s!WsCK#>~YK0BPpV_D|^^c1cg^XL3;FaOKS`F#F= zmpEz8<8$7gm?4e_I5)?&e6HPZfapFjmXzg#zob6cHFSCNKfd!)C9nNNoDP1NDKymm zXfMNB0&zaHSHdK&gZ5=GiAUh=UjANyZ}4#Q+8NGVWeoE0SWOrv@eFqJY=4{1^>j8P~HNQ*bUk@!6aUb z_A;2vZ(PcU@X!2)N~N-?&LFmmerD3dk7;Ov{Cz}D{|8_vW{iG9Fp1xxy#XdMShUZA zNz4uXABTV9mnaAFL%oNzm&279A=*ut#1+xL1SWB6w6lLo%nR*pFjcz*yL8nlTnXhJ zkZ-|xJO{d9wRU&VAAC9GIFM(N#Gwo&2O$Z_BhJUlb(mMcE=~MW1`Q(iRmkZ%uZX+h4`JUA9ub{|NjRX)c^k}?lr1CV@l`vLEQIC z|NqB^+>fs<_kUa>dj21p()0fly)N4QI?{mN|966|hV}lx1?;pO*#7t$-~V?i`u`l! zuour>Ge=Wy|DSzs_VLH+|J%L)iTeNS`*RF1R{x)Ue~tmBqW?b~`~OlK3&6Si|8i?) z{`ZDkGINJdZr{m$g*leh`~N}-nzRP4vIh9SI89muS_3zx2Gln(Iywfen3b{i$9qmi zGjcSVj^a}u=Bi{SC0(gu+v0pbqoc#INF;&pdzkpdM@L6GlZwWN%|?7GBpn{M9H+>M zaLPo?(UEAzN}1ctb!+nla=ror_l9^PZZ+id!>^Etmx3?3N$@1$!9hEvVRdQ@XFZ=v zq`Kg$(s|N~;K8=4XWDKy!YOV0AISP2RZkF&XG{yqI2w*2VXawbC$(8YGMq|VvOCWw zOGeU>;AczLHlK_nQ;GXe@3aO+hfm)fjYA{Fg*=Fi3a2e6?1Udmu}3fc1BpcJFut3z zLp*DD*4icgb_UW56ve!herP~l_m5^MR*$(qnZfs3($YT^ON4D_Wh?9<)=m2Hy^uvd zzWpVZ{)f~P6r||&lTM=-vdA>rpMEJQaT_L`I4@*w;y!uzlXp3asplq0`#bvZx7=8| zZ?E@NP}BvZC<2Evql3|e*}Sjku(`IibzR@l$fiEL%;CrbDDUaMWD0L|G?r<`J|Km? z3~iHs7B6J(vrI6Ow?7)R)qcOX%U1P?p%$kKX+E)CM#9m!;I${4_|{QGR1LOj73?P^ zUs)UL3qwxahaQY(A}3JWFm^|FBpwS7pb!tDW*N1{aN9c?%S3~2#}cXDaC|UkrF@a~ zTCt>4Tl=I(?awM*>9A`!jxRJFL~-`J*_9#^7>lMeI7Jgskrf_+HEW9|M#AxE60&e? zIFX8GPQd+e_nxi;{oQ+a?%B1kr@vQhfm=1Y=Us8s{zKu2uLAFfM)%-ucCF0&I(4!e zrlX@D73J_gR{Opd#^>xdHC_|Ye?`sQA0Hh#XnkQcnz9CcA-xt!Wv|Zx&4Ht0$!go@ zjzsVDwUg=re7Cn-%`1GUKx z-z9DtKq8ER+Z&Jw?I7`U5H1lK!YvO7tsoI5LE@GIghRZ^xt|>3azCLAej0^8LL*3o zsc>o7CBg>$M97FsT(Wus*IN*l+d80Fl3O%v1rwIREhxApM9R@4 z<01saPlUq|;*yWJ4Fvzb-tG%en1)M)qVTV?++v6HFqn{_8gvf`%Xu35BCIBt2;bqB z6Ws2CkP$x-4nqivOF!gRUk(wrk&n2YgiC~Z5RSv`Cb(qV3kSkj2nX_0ig+3yajOgx zx5OZEOASI^Tq1;sTOV*so728D(Vbfg5@y3KJ^Zu){s@C1goV%*!h5()2jMySh;Sql zx4p>n4r=JNB<_RV?JJ)BO0qCScko!vCFHGrjn~W9^g2 z|Gjg27XR1zQhQY~_`lxQ+N+Ae|0QuR7yozsLVHy{{9p2gxgP%SW%w@!|Mv#`Pc{DU zIG&Lm5azqa|BYYYP)E7chX#^uY_Z?}WczP|bJzde^**lsaea_$5A|TK2fFKjTqES) z|5-0_tx$je6H3seH84#Y;Fi0Zv<9>WZcGih_&<(cbHD$)8GWa#_Wj=$?jSyr7#xjR zE%~O}0}wNNDu1FNW6jP_6fSTpjsN?U;s0*Taz55mPZ$1g8E%-{|K}3pOfcu^Oz={0 z1DN9lxBt)ahTH$=oSg3eLkXI+2Bt{^%cm(`9j(@Y)_~T4)_~T4)_~T4)_~T4)_~T4 e)_~T4)_~T4)_~T4)_~T4)_~T4*1-Qy1OEj`F5`Xx diff --git a/tclap/msc/tclap-beta.sln b/tclap/msc/tclap-beta.sln deleted file mode 100755 index 822c17b..0000000 --- a/tclap/msc/tclap-beta.sln +++ /dev/null @@ -1,78 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test1", "examples\test1.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test2", "examples\test2.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test3", "examples\test3.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test4", "examples\test4.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - {BEAE199F-D6F3-499A-9478-AD81FFDC9449} = {BEAE199F-D6F3-499A-9478-AD81FFDC9449} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test5", "examples\test5.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test6", "examples\test6.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test7", "examples\test7.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test8", "examples\test8.vcproj", "{BEAE199F-D6F3-499A-9478-AD81FFDC9449}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.ActiveCfg = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Debug.Build.0 = Debug|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.ActiveCfg = Release|Win32 - {BEAE199F-D6F3-499A-9478-AD81FFDC9449}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/tclap/msc/tclap-beta.suo b/tclap/msc/tclap-beta.suo deleted file mode 100755 index d77caab42cdf1fb961327512229f459d274dbcb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24576 zcmeI4TWlOx8OM+9q`6<3v`HIES(@h35(g)CleBKy#+O`5oTPDXKntwxwc}*HYrGpL zp-s!J7t#WeDx``RK+0Q%5Dy?BM3Jh#Ac2DD3l9iUDhhAqflGk4=J!7{$2+^59nWr@ z#UXR7|IC@0GxMEu=KKEVJKvo3uP@#FhwuGx)mx?{J!G292NUzmO@Z?b_&> zt!LVQ^o~SVmHyhPQKI%Fom$eB8XxXYB|5X2{8%<^O>Rl&*x6h@nNA!`jb_L4_S~$l zWIicT^N;oHP4xC3PmS2aMP0+mbap7wJusZlsx!>eo^0Q6I+Zw@>Pzg*j*Zyc=M^2z z@63*jW;3ab_v}SShcg4&)44+NS-TJQ=#87jo$2AxzHD-AAaQUwqZec5>`G-)V@bV` zt4s~kaQ|kW@hDpUI2zE8mL$=PX0wTLvc;kqZb@-1Nr@3OrQd3z1SjF2Bj|1qy6-XZ zsO6tLqdhOR;uQ`@J}Nb#R;feB>t0Ly61HvuMe#q;!nJLlsc&u$2qcZ%@wS$ z7ypTiBwMLMv7*yAaU@?wsZ_pNouUpW>BB76r!g_C9_x`mhv#_Gqsdo!agb7}e2sr% z{!!!(Q-e&Xba7>)m96n4YWr1IP;&a`X@_^NmTeO^iI4VMJ#=GQ4o&N!9sO39arMx5c#bj3Yc@D|>m&O#AD)rixTi~57)xVv*g$(bamv?c>_OeE#$_f2zkltw& zh^l`o`%;7V%*yi5(&zGt!b#TYzho;_u4&=QQnHoozX#hJL8|=Vqkdmx8BHs3zy{y` zJn7NoYtAHJK}q(WN9Gv4E^AQ#r#a5~e0+j@KP5V;lej2lw}sj~P=oyC$em@SPtQjD zUz)DwoSqf+{!+Qs9?v!n(nPslnzTOAw7mg$cVc2~<0Lh{(0*~@cOSgCQ03F3IZOh($?fbviHTjS76eOG*DrQA$du$lNij5i zk?Z?%@Pz!}1;G}-%$4_W>bOM2sQiD3T_`i*jxu0t#y#mRtFjP)j`IVI>^{s2N~Nc$PiaolCN=6ah8G~ z^_1_owBkQ|F_*$MMVIoH(K0ZOyogRLND;7{^~qCsI@Pfd@h=6vdVGXZ z9cXGl>b)K)hCNX9tm3G~F!$)4-T@Ahm!~c5PZ1mQJfCP*b7S@zomQ5P zU6S`xd%9Zwit;Ap?=<7hCD>-zj^NQrd*p@Q=vwW*bGYvxy+q!`!Qv%(#Zxh$_}>zr zzlov=aw}c@so=LoxwE{?!W#Hj^{pPuno1^mYcFO*xM1E^6!nvoG z_V3}oS-#H05KY2ikX&sOK9>(u#H9PL>ndkp|@e4&Rg1(Jr ztTA&}tKTTz|#dUOcWad)&nTE#D><7;f5Z~q4Cm}`H1Qdq6f&N=;Z!7jAp+wLa2dT1xM z)Wt$KZ$**T9rW;}Ds5*v-l_q`El;6m?pwZ|?ZtfC?QcZFpIE*|shP-07i*O^A#*3W zPP=+Z<<7BUV}Lai#d7x}J8xU$q-uqFaT!-PZ=HeHdaVna&bqZz@2Q^XzJF=mRxL^2 zpX5_F0F8oCo^gai7e%}zCtu6NYDu+x|4Jh0w z)@jy~T>HhMQRU0pe(ATrgGh<@dy5WiNNXnw)~Mep6t9wKx4)a3P95D?A|bdAV~tVA{B`{O@gWYb{Csul!DzqCDfP6msj&qLiPijFYYXRAsNl_3K%F@V7YO^W4}Az4B`D zaQ`ayLa%2pG#-0r_Sjn*v6!i|nVG9cas0G$Y&S~$G>&G(u{gz8;#gc*lqvRtVlPO) z_^;-hSsY2$FSERve>l55%%paDBmI@;dSNym`(DBC%(3>y+FQI%pps36+xE+#7YZP0YP9_r}~?@V3La_rDefCRYFe diff --git a/tclap/msc/tclap-beta.vcproj b/tclap/msc/tclap-beta.vcproj deleted file mode 100755 index 257659c..0000000 --- a/tclap/msc/tclap-beta.vcproj +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tclap/scripts/check_dead_headers.py b/tclap/scripts/check_dead_headers.py deleted file mode 100755 index f5fc259..0000000 --- a/tclap/scripts/check_dead_headers.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2018 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, -# 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. - -import glob -import os -import sys -import re - -def get_files(path, pattern): - return map(os.path.basename, - glob.glob(os.path.join(path, pattern))) - -def get_includes(path): - with file(os.path.join(path, 'Makefile.am')) as f: - lines = [] - - for line in f: - m = re.match(r'^(.+\.h)', line.strip()) - if m: - lines.append(m.group(1)) - - return lines - -def main(): - headers = set(get_files('./include/tclap', '*.h')) - includes = set(get_includes('./include/tclap')) - diff = headers - includes - if diff: - print 'The following files are not in Makefile.am' - print diff - sys.exit(1) - -if __name__ == '__main__': - main() diff --git a/tclap/scripts/check_tests_enabled.py b/tclap/scripts/check_tests_enabled.py deleted file mode 100755 index 1600197..0000000 --- a/tclap/scripts/check_tests_enabled.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2017 Google Inc. -# 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, -# 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. - -import glob -import os -import sys -import re - -ignored_files = frozenset(['testCheck.sh']) - -def get_test_files(path): - return map(os.path.basename, - glob.glob(os.path.join(path, 'test*.sh'))) - -def get_test_cases(path): - with file(os.path.join(path, 'Makefile.am')) as f: - lines = [] - for line in f: - m = re.match(r'.*(test\d+\.sh).*', line.strip()) - if m: - lines.append(m.group(1)) - - return lines - -def main(): - test_files = set(get_test_files('./tests')) - ignored_files - test_cases = set(get_test_cases('./tests')) - diff = test_files - test_cases - if diff: - print 'The following files are not in Makefile.am' - print diff - sys.exit(1) - -if __name__ == '__main__': - main() - diff --git a/tclap/scripts/fix-test.py b/tclap/scripts/fix-test.py deleted file mode 100755 index 75f3167..0000000 --- a/tclap/scripts/fix-test.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2018 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, -# 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. - -import sys -import re - -def process_file(path): - args = None - out = None - test = None - - lines = [] - - with open(path) as f: - for line in f.readlines(): - if line.startswith('#'): - lines.append(line) - continue - - m = re.match(r'../examples/(test[0-9]+) (.*) > tmp.out.*', line) - if m: - (test, args) = m.groups() - lines.append("./simple-test.sh `basename $0 .sh` %s %s\n" - % (test, args)) - continue - - m = re.match(r'../examples/(test[0-9]+) > tmp.out.*', line) - if m: - test = m.group(1) - args = "" - lines.append("./simple-test.sh `basename $0 .sh` %s\n" - % test) - - continue - - m = re.match(r'.*(test[0-9]+).out.*', line) - if m: - out = m.group(1) - - if not all([v != None for v in [out, test, args]]): - print "Failed to parse", path - print out, test, args - return - - with open(path, 'w') as f: - for line in lines: - f.write(line) - -for path in sys.argv[1:]: - process_file(path) diff --git a/tclap/scripts/modeline.py b/tclap/scripts/modeline.py deleted file mode 100644 index af2f38d..0000000 --- a/tclap/scripts/modeline.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys - -modline = "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n" - -for path in sys.argv[1:]: - lines = [modline] - with file(path) as f: - lines += f.readlines() - - has_modeline = any([l for l in lines[1:] if l.find('Mode: c++') != -1]) - if has_modeline: - continue - - with file(path, 'w') as f: - for line in lines: - f.write(line) diff --git a/tclap/tests/Makefile.am b/tclap/tests/Makefile.am deleted file mode 100644 index a7900ab..0000000 --- a/tclap/tests/Makefile.am +++ /dev/null @@ -1,184 +0,0 @@ - - -TESTS = test1.sh \ - test2.sh \ - test3.sh \ - test4.sh \ - test5.sh \ - test6.sh \ - test7.sh \ - test8.sh \ - test9.sh \ - test10.sh \ - test11.sh \ - test12.sh \ - test13.sh \ - test14.sh \ - test15.sh \ - test16.sh \ - test17.sh \ - test18.sh \ - test19.sh \ - test20.sh \ - test21.sh \ - test22.sh \ - test23.sh \ - test24.sh \ - test25.sh \ - test26.sh \ - test27.sh \ - test28.sh \ - test29.sh \ - test30.sh \ - test31.sh \ - test32.sh \ - test33.sh \ - test34.sh \ - test35.sh \ - test36.sh \ - test37.sh \ - test38.sh \ - test39.sh \ - test40.sh \ - test41.sh \ - test42.sh \ - test43.sh \ - test44.sh \ - test45.sh \ - test46.sh \ - test47.sh \ - test48.sh \ - test49.sh \ - test50.sh \ - test51.sh \ - test52.sh \ - test53.sh \ - test54.sh \ - test55.sh \ - test56.sh \ - test57.sh \ - test58.sh \ - test59.sh \ - test60.sh \ - test61.sh \ - test62.sh \ - test63.sh \ - test64.sh \ - test65.sh \ - test66.sh \ - test67.sh \ - test68.sh \ - test69.sh \ - test70.sh \ - test71.sh \ - test72.sh \ - test73.sh \ - test74.sh \ - test75.sh \ - test76.sh \ - test77.sh \ - test78.sh \ - test79.sh \ - test80.sh \ - test81.sh \ - test82.sh \ - test83.sh \ - test84.sh \ - test85.sh \ - test86.sh \ - test87.sh \ - test88.sh \ - test89.sh - -EXTRA_DIST = $(TESTS) \ - test1.out \ - test2.out \ - test3.out \ - test4.out \ - test5.out \ - test6.out \ - test7.out \ - test8.out \ - test9.out \ - test10.out \ - test11.out \ - test12.out \ - test13.out \ - test14.out \ - test15.out \ - test16.out \ - test17.out \ - test18.out \ - test19.out \ - test20.out \ - test21.out \ - test22.out \ - test23.out \ - test24.out \ - test25.out \ - test26.out \ - test27.out \ - test28.out \ - test29.out \ - test30.out \ - test31.out \ - test32.out \ - test33.out \ - test34.out \ - test35.out \ - test36.out \ - test37.out \ - test38.out \ - test39.out \ - test40.out \ - test41.out \ - test42.out \ - test43.out \ - test44.out \ - test45.out \ - test46.out \ - test47.out \ - test48.out \ - test49.out \ - test50.out \ - test51.out \ - test52.out \ - test53.out \ - test54.out \ - test55.out \ - test56.out \ - test57.out \ - test58.out \ - test59.out \ - test60.out \ - test61.out \ - test62.out \ - test63.out \ - test64.out \ - test65.out \ - test66.out \ - test67.out \ - test68.out \ - test69.out \ - test70.out \ - test71.out \ - test72.out \ - test73.out \ - test74.out \ - test75.out \ - test76.out \ - test77.out \ - test78.out \ - test79.out \ - test80.out \ - test81.out \ - test82.out \ - test83.out \ - test84.out \ - test85.out \ - test86.out \ - test87.out \ - test88.out \ - test89.out - -CLEANFILES = tmp.out diff --git a/tclap/tests/genOut.pl b/tclap/tests/genOut.pl deleted file mode 100755 index 9a93035..0000000 --- a/tclap/tests/genOut.pl +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -# -# Simple perl script to generate the expected output of test scripts. -# This should never really be run. -# If you do run it, make sure the output conforms to what you expect. -# - -for ( $i = 1; $i <= $ARGV[0]; $i++ ) -{ - system "test$i.sh; mv tmp.out test$i.out"; -} diff --git a/tclap/tests/runtests.sh b/tclap/tests/runtests.sh deleted file mode 100755 index caec752..0000000 --- a/tclap/tests/runtests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Always run in script-dir -DIR=`dirname $0` -cd $DIR - -make check diff --git a/tclap/tests/simple-test.sh b/tclap/tests/simple-test.sh deleted file mode 100755 index 89545ef..0000000 --- a/tclap/tests/simple-test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -if [ -z "$srcdir" ]; then - srcdir=`dirname $0` -fi - -TEST_RESULT=$srcdir/$1 -shift - -../examples/"$@" 2>&1 | tee tmp.out - -if cmp -s tmp.out $TEST_RESULT.out; then - echo "OK" - exit 0 -else - echo "FAIL" - diff tmp.out $TEST_RESULT.out - exit 1 -fi diff --git a/tclap/tests/test1.out b/tclap/tests/test1.out deleted file mode 100644 index 6c0e533..0000000 --- a/tclap/tests/test1.out +++ /dev/null @@ -1 +0,0 @@ -My name (spelled backwards) is: ekim diff --git a/tclap/tests/test1.sh b/tclap/tests/test1.sh deleted file mode 100755 index 5805886..0000000 --- a/tclap/tests/test1.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./simple-test.sh test1 `basename $0 .sh` -r -n mike diff --git a/tclap/tests/test10.out b/tclap/tests/test10.out deleted file mode 100644 index da6dd86..0000000 --- a/tclap/tests/test10.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: - Required argument missing: unTest - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test10.sh b/tclap/tests/test10.sh deleted file mode 100755 index d3e9f92..0000000 --- a/tclap/tests/test10.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello diff --git a/tclap/tests/test11.out b/tclap/tests/test11.out deleted file mode 100644 index 2c0d7a1..0000000 --- a/tclap/tests/test11.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Argument already set! - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test11.sh b/tclap/tests/test11.sh deleted file mode 100755 index 7d3faa8..0000000 --- a/tclap/tests/test11.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello -i 9 diff --git a/tclap/tests/test12.out b/tclap/tests/test12.out deleted file mode 100644 index 2d957e0..0000000 --- a/tclap/tests/test12.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -f (--floatTest) - Couldn't read argument value from string 'nine' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test12.sh b/tclap/tests/test12.sh deleted file mode 100755 index 57c36a8..0000000 --- a/tclap/tests/test12.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello -f nine diff --git a/tclap/tests/test13.out b/tclap/tests/test13.out deleted file mode 100644 index 076f079..0000000 --- a/tclap/tests/test13.out +++ /dev/null @@ -1,7 +0,0 @@ -[-i] 0 9 -[-i] 1 8 -[ ] 0 bart -for string we got : bill -for ulabeled one we got : homer -for ulabeled two we got : marge -for bool B we got : 1 diff --git a/tclap/tests/test13.sh b/tclap/tests/test13.sh deleted file mode 100755 index 3f8b8f4..0000000 --- a/tclap/tests/test13.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test3 --stringTest=bill -i=9 -i=8 -B homer marge bart diff --git a/tclap/tests/test14.out b/tclap/tests/test14.out deleted file mode 100644 index 404d810..0000000 --- a/tclap/tests/test14.out +++ /dev/null @@ -1,7 +0,0 @@ -[ ] 0 bart -[ ] 1 one -[ ] 2 two -for string we got : aaa -for ulabeled one we got : homer -for ulabeled two we got : marge -for bool B we got : 0 diff --git a/tclap/tests/test14.sh b/tclap/tests/test14.sh deleted file mode 100755 index 6de1bb6..0000000 --- a/tclap/tests/test14.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test3 --stringTest=aaa homer marge bart -- one two diff --git a/tclap/tests/test15.out b/tclap/tests/test15.out deleted file mode 100644 index e817436..0000000 --- a/tclap/tests/test15.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: (--stringTest) - Couldn't find delimiter for this argument! - -Brief USAGE: - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test3 --help - diff --git a/tclap/tests/test15.sh b/tclap/tests/test15.sh deleted file mode 100755 index 4c3fbb6..0000000 --- a/tclap/tests/test15.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test3 --stringTest bbb homer marge bart -- -hv two diff --git a/tclap/tests/test16.out b/tclap/tests/test16.out deleted file mode 100644 index e817436..0000000 --- a/tclap/tests/test16.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: (--stringTest) - Couldn't find delimiter for this argument! - -Brief USAGE: - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test3 --help - diff --git a/tclap/tests/test16.sh b/tclap/tests/test16.sh deleted file mode 100755 index 6646a17..0000000 --- a/tclap/tests/test16.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test3 --stringTest one homer -B -Bh diff --git a/tclap/tests/test17.out b/tclap/tests/test17.out deleted file mode 100644 index 343a5d5..0000000 --- a/tclap/tests/test17.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: - Required argument missing: unTest2 - -Brief USAGE: - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test3 --help - diff --git a/tclap/tests/test17.sh b/tclap/tests/test17.sh deleted file mode 100755 index 45b71c4..0000000 --- a/tclap/tests/test17.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test3 --stringTest=one homer -B diff --git a/tclap/tests/test18.out b/tclap/tests/test18.out deleted file mode 100644 index f9db41c..0000000 --- a/tclap/tests/test18.out +++ /dev/null @@ -1,2 +0,0 @@ -my failure message: --s -- Couldn't find match for argument diff --git a/tclap/tests/test18.sh b/tclap/tests/test18.sh deleted file mode 100755 index 0e4c930..0000000 --- a/tclap/tests/test18.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test4 -Bs --Bs asdf diff --git a/tclap/tests/test19.out b/tclap/tests/test19.out deleted file mode 100644 index 02db97c..0000000 --- a/tclap/tests/test19.out +++ /dev/null @@ -1,3 +0,0 @@ -for string we got : asdf -for bool B we got : 1 -for bool A we got : 1 diff --git a/tclap/tests/test19.sh b/tclap/tests/test19.sh deleted file mode 100755 index d22ce7f..0000000 --- a/tclap/tests/test19.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test4 -BA --Bs asdf diff --git a/tclap/tests/test2.out b/tclap/tests/test2.out deleted file mode 100644 index 9797c85..0000000 --- a/tclap/tests/test2.out +++ /dev/null @@ -1 +0,0 @@ -My name is: mike diff --git a/tclap/tests/test2.sh b/tclap/tests/test2.sh deleted file mode 100755 index d293b6b..0000000 --- a/tclap/tests/test2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test1 -n mike diff --git a/tclap/tests/test20.out b/tclap/tests/test20.out deleted file mode 100644 index 1120da8..0000000 --- a/tclap/tests/test20.out +++ /dev/null @@ -1,7 +0,0 @@ -for I: - 0 sss - 1 fdsf -for A OR B we got : asdf -for string C we got : fdas -for string D we got : 0 -for E or F or G we got: blah diff --git a/tclap/tests/test20.sh b/tclap/tests/test20.sh deleted file mode 100755 index c78ed73..0000000 --- a/tclap/tests/test20.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test5 -a asdf -c fdas --eee blah -i sss -i fdsf diff --git a/tclap/tests/test21.out b/tclap/tests/test21.out deleted file mode 100644 index d9905f4..0000000 --- a/tclap/tests/test21.out +++ /dev/null @@ -1,6 +0,0 @@ -for J: - 0 homer -for A OR B we got : asdf -for string C we got : fdas -for string D we got : 0 -for E or F or G we got: asdf diff --git a/tclap/tests/test21.sh b/tclap/tests/test21.sh deleted file mode 100755 index 2924938..0000000 --- a/tclap/tests/test21.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test5 -b asdf -c fdas -g asdf -j homer diff --git a/tclap/tests/test22.out b/tclap/tests/test22.out deleted file mode 100644 index f6669d9..0000000 --- a/tclap/tests/test22.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -b (--bbb) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test5 {-a |-b } {--eee |--fff - |-g } {-i ...|-j - ...} [--ddd] -c [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test5 --help - diff --git a/tclap/tests/test22.sh b/tclap/tests/test22.sh deleted file mode 100755 index ee01f9c..0000000 --- a/tclap/tests/test22.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test5 -a fdsa -b asdf -c fdas diff --git a/tclap/tests/test23.out b/tclap/tests/test23.out deleted file mode 100644 index 4a008d1..0000000 --- a/tclap/tests/test23.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -d - Couldn't find match for argument - -Brief USAGE: - ../examples/test5 {-a |-b } {--eee |--fff - |-g } {-i ...|-j - ...} [--ddd] -c [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test5 --help - diff --git a/tclap/tests/test23.sh b/tclap/tests/test23.sh deleted file mode 100755 index 67ff31b..0000000 --- a/tclap/tests/test23.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test5 -d junk -c fdas diff --git a/tclap/tests/test24.out b/tclap/tests/test24.out deleted file mode 100644 index f6669d9..0000000 --- a/tclap/tests/test24.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -b (--bbb) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test5 {-a |-b } {--eee |--fff - |-g } {-i ...|-j - ...} [--ddd] -c [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test5 --help - diff --git a/tclap/tests/test24.sh b/tclap/tests/test24.sh deleted file mode 100755 index 3e196c9..0000000 --- a/tclap/tests/test24.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test5 --aaa dilbert -b asdf -c fdas diff --git a/tclap/tests/test25.out b/tclap/tests/test25.out deleted file mode 100644 index 6ab8e92..0000000 --- a/tclap/tests/test25.out +++ /dev/null @@ -1,7 +0,0 @@ -for I: - 0 one - 1 two -for A OR B we got : asdf -for string C we got : fdas -for string D we got : 0 -for E or F or G we got: blah diff --git a/tclap/tests/test25.sh b/tclap/tests/test25.sh deleted file mode 100755 index f1c930a..0000000 --- a/tclap/tests/test25.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test5 --aaa asdf -c fdas --fff blah -i one -i two diff --git a/tclap/tests/test26.out b/tclap/tests/test26.out deleted file mode 100644 index f449c00..0000000 --- a/tclap/tests/test26.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -f (--floatTest) - More than one valid value parsed from string '4..2' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test26.sh b/tclap/tests/test26.sh deleted file mode 100755 index 894d1af..0000000 --- a/tclap/tests/test26.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 2 -f 4..2 -s asdf asdf diff --git a/tclap/tests/test27.out b/tclap/tests/test27.out deleted file mode 100644 index 9b149cf..0000000 --- a/tclap/tests/test27.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -f (--floatTest) - More than one valid value parsed from string '4.0.2' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test27.sh b/tclap/tests/test27.sh deleted file mode 100755 index 04d5f0d..0000000 --- a/tclap/tests/test27.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 2 -f 4.0.2 -s asdf asdf diff --git a/tclap/tests/test28.out b/tclap/tests/test28.out deleted file mode 100644 index efd8b4e..0000000 --- a/tclap/tests/test28.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Couldn't read argument value from string '2a' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test28.sh b/tclap/tests/test28.sh deleted file mode 100755 index b0315ab..0000000 --- a/tclap/tests/test28.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 2a -f 4.2 -s asdf asdf diff --git a/tclap/tests/test29.out b/tclap/tests/test29.out deleted file mode 100644 index 20d1692..0000000 --- a/tclap/tests/test29.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Couldn't read argument value from string '0xA' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test29.sh b/tclap/tests/test29.sh deleted file mode 100755 index 7ba1728..0000000 --- a/tclap/tests/test29.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure... no hex here, but see test19.cpp for how to use hex -./simple-test.sh `basename $0 .sh` test2 -i 0xA -f 4.2 -s asdf asdf diff --git a/tclap/tests/test3.out b/tclap/tests/test3.out deleted file mode 100644 index 6c0e533..0000000 --- a/tclap/tests/test3.out +++ /dev/null @@ -1 +0,0 @@ -My name (spelled backwards) is: ekim diff --git a/tclap/tests/test3.sh b/tclap/tests/test3.sh deleted file mode 100755 index 041f120..0000000 --- a/tclap/tests/test3.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test1 -n mike -r diff --git a/tclap/tests/test30.out b/tclap/tests/test30.out deleted file mode 100644 index 7a8083b..0000000 --- a/tclap/tests/test30.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Couldn't read argument value from string '2.1' - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test30.sh b/tclap/tests/test30.sh deleted file mode 100755 index a2575e6..0000000 --- a/tclap/tests/test30.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test2 -i 2.1 -f 4.2 -s asdf asdf diff --git a/tclap/tests/test31.out b/tclap/tests/test31.out deleted file mode 100644 index 7e3e9a1..0000000 --- a/tclap/tests/test31.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Couldn't read argument value from string '9a' - -Brief USAGE: - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test3 --help - diff --git a/tclap/tests/test31.sh b/tclap/tests/test31.sh deleted file mode 100755 index 2a8e46e..0000000 --- a/tclap/tests/test31.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test3 -i=9a -i=1 -s=asdf asdf asdf diff --git a/tclap/tests/test32.out b/tclap/tests/test32.out deleted file mode 100644 index 021f1b8..0000000 --- a/tclap/tests/test32.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -f (--floatTest) - More than one valid value parsed from string '1.0.0' - -Brief USAGE: - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test3 --help - diff --git a/tclap/tests/test32.sh b/tclap/tests/test32.sh deleted file mode 100755 index c6ec68a..0000000 --- a/tclap/tests/test32.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test3 -f=9 -f=1.0.0 -s=asdf asdf asdf diff --git a/tclap/tests/test33.out b/tclap/tests/test33.out deleted file mode 100644 index 733f05c..0000000 --- a/tclap/tests/test33.out +++ /dev/null @@ -1,7 +0,0 @@ -for J: - 0 o - 1 t -for A OR B we got : asdf -for string C we got : fdas -for string D we got : 1 -for E or F or G we got: blah diff --git a/tclap/tests/test33.sh b/tclap/tests/test33.sh deleted file mode 100755 index 58adb5f..0000000 --- a/tclap/tests/test33.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test5 -a asdf -c fdas --eee blah --ddd -j o --jjj t diff --git a/tclap/tests/test34.out b/tclap/tests/test34.out deleted file mode 100644 index 4280e73..0000000 --- a/tclap/tests/test34.out +++ /dev/null @@ -1,2 +0,0 @@ -My name is homer -My name is homer diff --git a/tclap/tests/test34.sh b/tclap/tests/test34.sh deleted file mode 100755 index b115150..0000000 --- a/tclap/tests/test34.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test6 -n homer 2 diff --git a/tclap/tests/test35.out b/tclap/tests/test35.out deleted file mode 100644 index 68d234f..0000000 --- a/tclap/tests/test35.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: -n (--name) - Value 'mike' does not meet constraint: homer|marge|bart|lisa|maggie - -Brief USAGE: - ../examples/test6 -n [--] [--version] - [-h] <1|2|3> - -For complete USAGE and HELP type: - ../examples/test6 --help - diff --git a/tclap/tests/test35.sh b/tclap/tests/test35.sh deleted file mode 100755 index 789a193..0000000 --- a/tclap/tests/test35.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test6 -n mike 2 diff --git a/tclap/tests/test36.out b/tclap/tests/test36.out deleted file mode 100644 index faf4983..0000000 --- a/tclap/tests/test36.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: Argument: (--times) - Value '6' does not meet constraint: 1|2|3 - -Brief USAGE: - ../examples/test6 -n [--] [--version] - [-h] <1|2|3> - -For complete USAGE and HELP type: - ../examples/test6 --help - diff --git a/tclap/tests/test36.sh b/tclap/tests/test36.sh deleted file mode 100755 index 485a81c..0000000 --- a/tclap/tests/test36.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test6 -n homer 6 diff --git a/tclap/tests/test37.out b/tclap/tests/test37.out deleted file mode 100644 index bb395c3..0000000 --- a/tclap/tests/test37.out +++ /dev/null @@ -1,5 +0,0 @@ -Got num 2 -Got num 1 -Got num 3 -Got name homer -Got name marge diff --git a/tclap/tests/test37.sh b/tclap/tests/test37.sh deleted file mode 100755 index 6c3ba7a..0000000 --- a/tclap/tests/test37.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test7 -n homer 2 -n marge 1 3 diff --git a/tclap/tests/test38.out b/tclap/tests/test38.out deleted file mode 100644 index d0b0cfb..0000000 --- a/tclap/tests/test38.out +++ /dev/null @@ -1,17 +0,0 @@ -PARSE ERROR: Argument: -n (--name) - Value 'mike' does not meet constraint: homer|marge|bart|lisa|maggie - -Brief USAGE: - ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblem - sWithLongProgramNamesIThinkItIsNowL - ongEnough [-l ] [-u ] [-b ] [-z - ] [-x ] [-s - ] [-d] [-g ] [-f ] -n ... [--] - [--version] [-h] <1|2|3> ... - -For complete USAGE and HELP type: - ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblemsWithLongProgramNamesIThinkItIsNowLongEnough --help - diff --git a/tclap/tests/test38.sh b/tclap/tests/test38.sh deleted file mode 100755 index 78ec7d3..0000000 --- a/tclap/tests/test38.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test7 -n mike 2 1 diff --git a/tclap/tests/test39.out b/tclap/tests/test39.out deleted file mode 100644 index 1850094..0000000 --- a/tclap/tests/test39.out +++ /dev/null @@ -1,17 +0,0 @@ -PARSE ERROR: Argument: (--times) - Value '6' does not meet constraint: 1|2|3 - -Brief USAGE: - ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblem - sWithLongProgramNamesIThinkItIsNowL - ongEnough [-l ] [-u ] [-b ] [-z - ] [-x ] [-s - ] [-d] [-g ] [-f ] -n ... [--] - [--version] [-h] <1|2|3> ... - -For complete USAGE and HELP type: - ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblemsWithLongProgramNamesIThinkItIsNowLongEnough --help - diff --git a/tclap/tests/test39.sh b/tclap/tests/test39.sh deleted file mode 100755 index 0c84f29..0000000 --- a/tclap/tests/test39.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test7 2 -n homer -n bart 6 diff --git a/tclap/tests/test4.out b/tclap/tests/test4.out deleted file mode 100644 index caa2664..0000000 --- a/tclap/tests/test4.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: - Required argument missing: name - -Brief USAGE: - ../examples/test1 [-r] -n [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test1 --help - diff --git a/tclap/tests/test4.sh b/tclap/tests/test4.sh deleted file mode 100755 index 68a0c93..0000000 --- a/tclap/tests/test4.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test1 diff --git a/tclap/tests/test40.out b/tclap/tests/test40.out deleted file mode 100644 index 8cafa16..0000000 --- a/tclap/tests/test40.out +++ /dev/null @@ -1,26 +0,0 @@ - -USAGE: - - ../examples/test1 [-r] -n [--] [--version] [-h] - - -Where: - - -r, --reverse - Print name backwards - - -n , --name - (required) Name to print - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - Command description message - diff --git a/tclap/tests/test40.sh b/tclap/tests/test40.sh deleted file mode 100755 index 9f04234..0000000 --- a/tclap/tests/test40.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test1 --help diff --git a/tclap/tests/test41.out b/tclap/tests/test41.out deleted file mode 100644 index 2f583f5..0000000 --- a/tclap/tests/test41.out +++ /dev/null @@ -1,45 +0,0 @@ - -USAGE: - - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - - -Where: - - -f , --floatTest - float test - - -i , --intTest - (required) integer test - - -s , --stringTest - (required) string test - - -A, --existTestA - tests for the existence of A - - -C, --existTestC - tests for the existence of C - - -B, --existTestB - tests for the existence of B - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - (required) unlabeld test - - (accepted multiple times) - file names - - - this is a message - diff --git a/tclap/tests/test41.sh b/tclap/tests/test41.sh deleted file mode 100755 index 50563b6..0000000 --- a/tclap/tests/test41.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 --help diff --git a/tclap/tests/test42.out b/tclap/tests/test42.out deleted file mode 100644 index 5cb8427..0000000 --- a/tclap/tests/test42.out +++ /dev/null @@ -1,43 +0,0 @@ - -USAGE: - - ../examples/test3 [-f=] ... [-i=] ... --stringTest= - [-B] [--] [--version] [-h] - ... - - -Where: - - -f=, --floatTest= (accepted multiple times) - multi float test - - -i=, --intTest= (accepted multiple times) - multi int test - - --stringTest= - (required) string test - - -B, --existTestB - exist Test B - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - (required) unlabeled test one - - - (required) unlabeled test two - - (accepted multiple times) - file names - - - this is a message - diff --git a/tclap/tests/test42.sh b/tclap/tests/test42.sh deleted file mode 100755 index 10751de..0000000 --- a/tclap/tests/test42.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test3 --help diff --git a/tclap/tests/test43.out b/tclap/tests/test43.out deleted file mode 100644 index 766f462..0000000 --- a/tclap/tests/test43.out +++ /dev/null @@ -1,7 +0,0 @@ -my usage message: --A, --sA (exist Test A) --B, --sB (exist Test B) --s , --Bs ((required) string test) ---, --ignore_rest (Ignores the rest of the labeled arguments following this flag.) ---version (Displays version information and exits.) --h, --help (Displays usage information and exits.) diff --git a/tclap/tests/test43.sh b/tclap/tests/test43.sh deleted file mode 100755 index 879947f..0000000 --- a/tclap/tests/test43.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test4 --help diff --git a/tclap/tests/test44.out b/tclap/tests/test44.out deleted file mode 100644 index 3363e1e..0000000 --- a/tclap/tests/test44.out +++ /dev/null @@ -1,52 +0,0 @@ - -USAGE: - - ../examples/test5 {-a |-b } {--eee |--fff - |-g } {-i ...|-j - ...} [--ddd] -c [--] [--version] [-h] - - -Where: - - -a , --aaa - (OR required) or test a - -- OR -- - -b , --bbb - (OR required) or test b - - - --eee - (OR required) e test - -- OR -- - --fff - (OR required) f test - -- OR -- - -g , --ggg - (OR required) g test - - - -i , --iii (accepted multiple times) - (OR required) or test i - -- OR -- - -j , --jjj (accepted multiple times) - (OR required) or test j - - - --ddd - d test - - -c , --ccc - (required) c test - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - this is a message - diff --git a/tclap/tests/test44.sh b/tclap/tests/test44.sh deleted file mode 100755 index 7c30ae9..0000000 --- a/tclap/tests/test44.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test5 --help diff --git a/tclap/tests/test45.out b/tclap/tests/test45.out deleted file mode 100644 index 8edeec9..0000000 --- a/tclap/tests/test45.out +++ /dev/null @@ -1,28 +0,0 @@ - -USAGE: - - ../examples/test6 -n [--] [--version] - [-h] <1|2|3> - - -Where: - - -n , --name - (required) Name to print - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - <1|2|3> - (required) Number of times to print - - - Command description message - diff --git a/tclap/tests/test45.sh b/tclap/tests/test45.sh deleted file mode 100755 index 369007c..0000000 --- a/tclap/tests/test45.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test6 --help diff --git a/tclap/tests/test46.out b/tclap/tests/test46.out deleted file mode 100644 index dfb67d9..0000000 --- a/tclap/tests/test46.out +++ /dev/null @@ -1,66 +0,0 @@ - -USAGE: - - ThisIsAVeryLongProgramNameDesignedToTestSpacePrintWhichUsedToHaveProblem - sWithLongProgramNamesIThinkItIsNowL - ongEnough [-l ] [-u ] [-b ] [-z - ] [-x ] [-s - ] [-d] [-g ] [-f ] -n ... [--] - [--version] [-h] <1|2|3> ... - - -Where: - - -l , --limit - Max number of alignments allowed - - -u , --upperBound - upper percentage bound - - -b , --lowerBound - lower percentage bound - - -z , --filename2 - Sequence 2 filename (FASTA format) - - -x , --filename1 - Sequence 1 filename (FASTA format) - - -s , --scoring--Matrix - Scoring Matrix name - - -d, --isDna - The input sequences are DNA - - -g , --gap-Extend - The cost for each extension of a gap - - -f , --gapCreate - The cost of creating a gap - - -n , --name (accepted multiple times) - (required) Name to print. This is a long, nonsensical message to test - line wrapping. Hopefully it works. - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - <1|2|3> (accepted multiple times) - Number of times to print - - - Command description message. This is a long multi-line message meant to - test line wrapping. This is more text that doesn't really do anything - besides take up lots of space that otherwise might be used for something - real. That should be enough, don't you think? - diff --git a/tclap/tests/test46.sh b/tclap/tests/test46.sh deleted file mode 100755 index ee33671..0000000 --- a/tclap/tests/test46.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test7 --help diff --git a/tclap/tests/test47.out b/tclap/tests/test47.out deleted file mode 100644 index 076f079..0000000 --- a/tclap/tests/test47.out +++ /dev/null @@ -1,7 +0,0 @@ -[-i] 0 9 -[-i] 1 8 -[ ] 0 bart -for string we got : bill -for ulabeled one we got : homer -for ulabeled two we got : marge -for bool B we got : 1 diff --git a/tclap/tests/test47.sh b/tclap/tests/test47.sh deleted file mode 100755 index 14c4df4..0000000 --- a/tclap/tests/test47.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test8 -s=bill -i=9 -i=8 -B homer marge bart diff --git a/tclap/tests/test48.out b/tclap/tests/test48.out deleted file mode 100644 index 404d810..0000000 --- a/tclap/tests/test48.out +++ /dev/null @@ -1,7 +0,0 @@ -[ ] 0 bart -[ ] 1 one -[ ] 2 two -for string we got : aaa -for ulabeled one we got : homer -for ulabeled two we got : marge -for bool B we got : 0 diff --git a/tclap/tests/test48.sh b/tclap/tests/test48.sh deleted file mode 100755 index 0482e7b..0000000 --- a/tclap/tests/test48.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test8 -s=aaa homer marge bart -- one two diff --git a/tclap/tests/test49.out b/tclap/tests/test49.out deleted file mode 100644 index 5e85eb4..0000000 --- a/tclap/tests/test49.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -s (--stringTest) - Couldn't find delimiter for this argument! - -Brief USAGE: - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test8 --help - diff --git a/tclap/tests/test49.sh b/tclap/tests/test49.sh deleted file mode 100755 index 1240d99..0000000 --- a/tclap/tests/test49.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test8 -s bbb homer marge bart -- -hv two diff --git a/tclap/tests/test5.out b/tclap/tests/test5.out deleted file mode 100644 index 43367e9..0000000 --- a/tclap/tests/test5.out +++ /dev/null @@ -1,9 +0,0 @@ -0 bart -1 lisa -for float we got : 3.7 -for int we got : 10 -for string we got : homer -for ulabeled we got : marge -for bool A we got : 0 -for bool B we got : 0 -for bool C we got : 0 diff --git a/tclap/tests/test5.sh b/tclap/tests/test5.sh deleted file mode 100755 index f0570e8..0000000 --- a/tclap/tests/test5.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 -i 10 -s homer marge bart lisa diff --git a/tclap/tests/test50.out b/tclap/tests/test50.out deleted file mode 100644 index 5e85eb4..0000000 --- a/tclap/tests/test50.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -s (--stringTest) - Couldn't find delimiter for this argument! - -Brief USAGE: - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test8 --help - diff --git a/tclap/tests/test50.sh b/tclap/tests/test50.sh deleted file mode 100755 index fa3365b..0000000 --- a/tclap/tests/test50.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test8 -s one homer -B -Bh diff --git a/tclap/tests/test51.out b/tclap/tests/test51.out deleted file mode 100644 index 077714f..0000000 --- a/tclap/tests/test51.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: - Required argument missing: unTest2 - -Brief USAGE: - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test8 --help - diff --git a/tclap/tests/test51.sh b/tclap/tests/test51.sh deleted file mode 100755 index 7cb43a6..0000000 --- a/tclap/tests/test51.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test8 -s=one homer -B diff --git a/tclap/tests/test52.out b/tclap/tests/test52.out deleted file mode 100644 index 89df1f5..0000000 --- a/tclap/tests/test52.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -i (--intTest) - Couldn't read argument value from string '9a' - -Brief USAGE: - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test8 --help - diff --git a/tclap/tests/test52.sh b/tclap/tests/test52.sh deleted file mode 100755 index b26bcff..0000000 --- a/tclap/tests/test52.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test8 -i=9a -i=1 -s=asdf asdf asdf diff --git a/tclap/tests/test53.out b/tclap/tests/test53.out deleted file mode 100644 index d2e03c0..0000000 --- a/tclap/tests/test53.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -f (--floatTest) - More than one valid value parsed from string '1.0.0' - -Brief USAGE: - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - -For complete USAGE and HELP type: - ../examples/test8 --help - diff --git a/tclap/tests/test53.sh b/tclap/tests/test53.sh deleted file mode 100755 index ba26b9e..0000000 --- a/tclap/tests/test53.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test8 -f=9 -f=1.0.0 -s=asdf asdf asdf diff --git a/tclap/tests/test54.out b/tclap/tests/test54.out deleted file mode 100644 index ec7077e..0000000 --- a/tclap/tests/test54.out +++ /dev/null @@ -1,43 +0,0 @@ - -USAGE: - - ../examples/test8 [-f=] ... [-i=] ... -s= [-B] [--] - [--version] [-h] - ... - - -Where: - - -f=, --floatTest= (accepted multiple times) - multi float test - - -i=, --intTest= (accepted multiple times) - multi int test - - -s=, --stringTest= - (required) string test - - -B, --existTestB - exist Test B - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - (required) unlabeled test one - - - (required) unlabeled test two - - (accepted multiple times) - file names - - - this is a message - diff --git a/tclap/tests/test54.sh b/tclap/tests/test54.sh deleted file mode 100755 index f2f5439..0000000 --- a/tclap/tests/test54.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test8 --help diff --git a/tclap/tests/test55.out b/tclap/tests/test55.out deleted file mode 100644 index 3105e3d..0000000 --- a/tclap/tests/test55.out +++ /dev/null @@ -1,6 +0,0 @@ -[ ] 0 zero -[ ] 1 one -for string we got : asdf -for ulabeled one we got : - -for ulabeled two we got : asdf -for bool B we got : 0 diff --git a/tclap/tests/test55.sh b/tclap/tests/test55.sh deleted file mode 100755 index 87d417b..0000000 --- a/tclap/tests/test55.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test3 --stringTest=asdf - asdf zero one diff --git a/tclap/tests/test56.out b/tclap/tests/test56.out deleted file mode 100644 index f77f3ba..0000000 --- a/tclap/tests/test56.out +++ /dev/null @@ -1,9 +0,0 @@ -0 one -1 two -for float we got : 3.7 -for int we got : 1 -for string we got : fdsa -for ulabeled we got : - -for bool A we got : 0 -for bool B we got : 0 -for bool C we got : 0 diff --git a/tclap/tests/test56.sh b/tclap/tests/test56.sh deleted file mode 100755 index 2d4f2fa..0000000 --- a/tclap/tests/test56.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 -i 1 - -s fdsa one two diff --git a/tclap/tests/test57.out b/tclap/tests/test57.out deleted file mode 100644 index cd51b85..0000000 --- a/tclap/tests/test57.out +++ /dev/null @@ -1,11 +0,0 @@ -PARSE ERROR: Argument: -i (--iii) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test5 {-a |-b } {--eee |--fff - |-g } {-i ...|-j - ...} [--ddd] -c [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test5 --help - diff --git a/tclap/tests/test57.sh b/tclap/tests/test57.sh deleted file mode 100755 index 47a1d99..0000000 --- a/tclap/tests/test57.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# failure -# This used to fail on the "Too many arguments!" but now fails sooner, -# and on a more approriate error. -./simple-test.sh `basename $0 .sh` test5 --aaa asdf -c fdas --fff blah -i one -i two -j huh diff --git a/tclap/tests/test58.out b/tclap/tests/test58.out deleted file mode 100644 index ee9ac0e..0000000 --- a/tclap/tests/test58.out +++ /dev/null @@ -1 +0,0 @@ -FORWARD diff --git a/tclap/tests/test58.sh b/tclap/tests/test58.sh deleted file mode 100755 index 06fab72..0000000 --- a/tclap/tests/test58.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test9 diff --git a/tclap/tests/test59.out b/tclap/tests/test59.out deleted file mode 100644 index 7460c6d..0000000 --- a/tclap/tests/test59.out +++ /dev/null @@ -1,4 +0,0 @@ -REVERSE -Verbose level: 3 -Noise level: 7 -Word: blah diff --git a/tclap/tests/test59.sh b/tclap/tests/test59.sh deleted file mode 100755 index 16dd28f..0000000 --- a/tclap/tests/test59.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test9 -VVV -N --noise -r blah diff --git a/tclap/tests/test6.out b/tclap/tests/test6.out deleted file mode 100644 index feb3cfd..0000000 --- a/tclap/tests/test6.out +++ /dev/null @@ -1,7 +0,0 @@ -for float we got : 3.7 -for int we got : 10 -for string we got : hello -for ulabeled we got : goodbye -for bool A we got : 1 -for bool B we got : 1 -for bool C we got : 1 diff --git a/tclap/tests/test6.sh b/tclap/tests/test6.sh deleted file mode 100755 index f6211c3..0000000 --- a/tclap/tests/test6.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello goodbye -ABC diff --git a/tclap/tests/test60.out b/tclap/tests/test60.out deleted file mode 100644 index d669a46..0000000 --- a/tclap/tests/test60.out +++ /dev/null @@ -1,29 +0,0 @@ -PARSE ERROR: Argument: -r (--reverse) - Argument already set! - - -USAGE: - - ../examples/test9 [-N] ... [-V] ... [-r] [--] - - -Where: - - -N, --noise (accepted multiple times) - Level of noise - - -V, --verbose (accepted multiple times) - Level of verbosity - - -r, --reverse - REVERSE instead of FORWARDS - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - - a random word - - - Command description message - diff --git a/tclap/tests/test60.sh b/tclap/tests/test60.sh deleted file mode 100755 index 364fbbf..0000000 --- a/tclap/tests/test60.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# failure -./simple-test.sh `basename $0 .sh` test9 -VVV -N --noise -rr diff --git a/tclap/tests/test61.out b/tclap/tests/test61.out deleted file mode 100644 index 66777a6..0000000 --- a/tclap/tests/test61.out +++ /dev/null @@ -1,7 +0,0 @@ -for float we got : 3.7 -for int we got : 10 -for string we got : hello -for ulabeled we got : -1 -1 -for bool A we got : 0 -for bool B we got : 0 -for bool C we got : 0 diff --git a/tclap/tests/test61.sh b/tclap/tests/test61.sh deleted file mode 100755 index 1c2b5f7..0000000 --- a/tclap/tests/test61.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# this tests a bug in handling of - chars in Unlabeled args -# success -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello "-1 -1" diff --git a/tclap/tests/test62.out b/tclap/tests/test62.out deleted file mode 100644 index 1fd8d7c..0000000 --- a/tclap/tests/test62.out +++ /dev/null @@ -1,10 +0,0 @@ -PARSE ERROR: - Required arguments missing: intTest, stringTest, unTest - -Brief USAGE: - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - -For complete USAGE and HELP type: - ../examples/test2 --help - diff --git a/tclap/tests/test62.sh b/tclap/tests/test62.sh deleted file mode 100755 index 9f3ecd4..0000000 --- a/tclap/tests/test62.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test2 diff --git a/tclap/tests/test63.out b/tclap/tests/test63.out deleted file mode 100644 index b391217..0000000 --- a/tclap/tests/test63.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: - Required argument missing: vect - -Brief USAGE: - ../examples/test11 -v <3D vector> [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test11 --help - diff --git a/tclap/tests/test63.sh b/tclap/tests/test63.sh deleted file mode 100755 index 3ee284c..0000000 --- a/tclap/tests/test63.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test11 diff --git a/tclap/tests/test64.out b/tclap/tests/test64.out deleted file mode 100644 index 46786e9..0000000 --- a/tclap/tests/test64.out +++ /dev/null @@ -1 +0,0 @@ -1 2 3 diff --git a/tclap/tests/test64.sh b/tclap/tests/test64.sh deleted file mode 100755 index f79a098..0000000 --- a/tclap/tests/test64.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test11 -v "1 2 3" diff --git a/tclap/tests/test65.out b/tclap/tests/test65.out deleted file mode 100644 index acab2e6..0000000 --- a/tclap/tests/test65.out +++ /dev/null @@ -1,9 +0,0 @@ -1 2 3 -4 5 6 -7 8 9 --1 0.2 0.4 -REVERSED --1 0.2 0.4 -7 8 9 -4 5 6 -1 2 3 diff --git a/tclap/tests/test65.sh b/tclap/tests/test65.sh deleted file mode 100755 index 4893196..0000000 --- a/tclap/tests/test65.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test12 -v "1 2 3" -v "4 5 6" -v "7 8 9" -v "-1 0.2 0.4" diff --git a/tclap/tests/test66.out b/tclap/tests/test66.out deleted file mode 100644 index db7f81a..0000000 --- a/tclap/tests/test66.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: - Required argument missing: vect - -Brief USAGE: - ../examples/test12 -v <3D vector> ... [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test12 --help - diff --git a/tclap/tests/test66.sh b/tclap/tests/test66.sh deleted file mode 100755 index 50fcb0e..0000000 --- a/tclap/tests/test66.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test12 diff --git a/tclap/tests/test67.out b/tclap/tests/test67.out deleted file mode 100644 index 545fa3f..0000000 --- a/tclap/tests/test67.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: Argument: -v (--vect) - a 1 0.3 is not a 3D vector - -Brief USAGE: - ../examples/test12 -v <3D vector> ... [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test12 --help - diff --git a/tclap/tests/test67.sh b/tclap/tests/test67.sh deleted file mode 100755 index abb364e..0000000 --- a/tclap/tests/test67.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -./simple-test.sh `basename $0 .sh` test12 -v "a 1 0.3" diff --git a/tclap/tests/test68.out b/tclap/tests/test68.out deleted file mode 100644 index 912bb3b..0000000 --- a/tclap/tests/test68.out +++ /dev/null @@ -1,3 +0,0 @@ -module -MultiSwtichArg was found 0 times. -done... diff --git a/tclap/tests/test68.sh b/tclap/tests/test68.sh deleted file mode 100755 index 4350c51..0000000 --- a/tclap/tests/test68.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# this tests whether we can parse args from -# a vector of strings and that combined switch -# handling doesn't get fooled if the delimiter -# is in the string -# success -./simple-test.sh `basename $0 .sh` test13 diff --git a/tclap/tests/test69.out b/tclap/tests/test69.out deleted file mode 100644 index a26b21e..0000000 --- a/tclap/tests/test69.out +++ /dev/null @@ -1 +0,0 @@ -error: Couldn't find match for argument for arg Argument: --bob diff --git a/tclap/tests/test69.sh b/tclap/tests/test69.sh deleted file mode 100755 index 29a7df6..0000000 --- a/tclap/tests/test69.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Checks that parsing exceptions are properly -# propagated to the caller. -./simple-test.sh `basename $0 .sh` test18 --bob diff --git a/tclap/tests/test7.out b/tclap/tests/test7.out deleted file mode 100644 index 2f583f5..0000000 --- a/tclap/tests/test7.out +++ /dev/null @@ -1,45 +0,0 @@ - -USAGE: - - ../examples/test2 [-f ] -i -s [-A] [-C] [-B] [--] - [--version] [-h] ... - - -Where: - - -f , --floatTest - float test - - -i , --intTest - (required) integer test - - -s , --stringTest - (required) string test - - -A, --existTestA - tests for the existence of A - - -C, --existTestC - tests for the existence of C - - -B, --existTestB - tests for the existence of B - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - (required) unlabeld test - - (accepted multiple times) - file names - - - this is a message - diff --git a/tclap/tests/test7.sh b/tclap/tests/test7.sh deleted file mode 100755 index 4359080..0000000 --- a/tclap/tests/test7.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello goodbye -hABC diff --git a/tclap/tests/test70.out b/tclap/tests/test70.out deleted file mode 100644 index afba767..0000000 --- a/tclap/tests/test70.out +++ /dev/null @@ -1,21 +0,0 @@ - -USAGE: - - ../examples/test18 [--] [--version] [-h] - - -Where: - - --, --ignore_rest - Ignores the rest of the labeled arguments following this flag. - - --version - Displays version information and exits. - - -h, --help - Displays usage information and exits. - - - Command description message - -Exiting on ExitException. diff --git a/tclap/tests/test70.sh b/tclap/tests/test70.sh deleted file mode 100755 index 1f40bc8..0000000 --- a/tclap/tests/test70.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Checks that parsing exceptions are properly -# propagated to the caller. -./simple-test.sh `basename $0 .sh` test18 --help diff --git a/tclap/tests/test71.out b/tclap/tests/test71.out deleted file mode 100644 index 9fda70a..0000000 --- a/tclap/tests/test71.out +++ /dev/null @@ -1 +0,0 @@ -found int: 10 diff --git a/tclap/tests/test71.sh b/tclap/tests/test71.sh deleted file mode 100755 index 27ea038..0000000 --- a/tclap/tests/test71.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success test hex -./simple-test.sh `basename $0 .sh` test19 -i 0xA diff --git a/tclap/tests/test72.out b/tclap/tests/test72.out deleted file mode 100644 index 9fda70a..0000000 --- a/tclap/tests/test72.out +++ /dev/null @@ -1 +0,0 @@ -found int: 10 diff --git a/tclap/tests/test72.sh b/tclap/tests/test72.sh deleted file mode 100755 index 842e4c7..0000000 --- a/tclap/tests/test72.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success test octal -./simple-test.sh `basename $0 .sh` test19 -i 012 diff --git a/tclap/tests/test73.out b/tclap/tests/test73.out deleted file mode 100644 index 1b45a51..0000000 --- a/tclap/tests/test73.out +++ /dev/null @@ -1,7 +0,0 @@ -for float we got : 3.7 -for int we got : 1 -for string we got : asdf -for ulabeled we got : fff*fff -for bool A we got : 0 -for bool B we got : 0 -for bool C we got : 0 diff --git a/tclap/tests/test73.sh b/tclap/tests/test73.sh deleted file mode 100755 index ebc3e5a..0000000 --- a/tclap/tests/test73.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success tests whether * in UnlabeledValueArg passes -./simple-test.sh `basename $0 .sh` test2 -i 1 -s asdf fff*fff diff --git a/tclap/tests/test74.out b/tclap/tests/test74.out deleted file mode 100644 index 36013d9..0000000 --- a/tclap/tests/test74.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: Argument: -b (--btmc) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test20 {-a|-b} [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test20 --help - diff --git a/tclap/tests/test74.sh b/tclap/tests/test74.sh deleted file mode 100755 index 9024f4d..0000000 --- a/tclap/tests/test74.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# failure validates that the correct error message -# is displayed for XOR'd args -./simple-test.sh `basename $0 .sh` test20 -a -b diff --git a/tclap/tests/test75.out b/tclap/tests/test75.out deleted file mode 100644 index 9686405..0000000 --- a/tclap/tests/test75.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: Argument: -a (--atmc) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test20 {-a|-b} [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test20 --help - diff --git a/tclap/tests/test75.sh b/tclap/tests/test75.sh deleted file mode 100755 index 8af013a..0000000 --- a/tclap/tests/test75.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# failure validates that the correct error message -# is displayed for XOR'd args -./simple-test.sh `basename $0 .sh` test20 -b -a diff --git a/tclap/tests/test76.out b/tclap/tests/test76.out deleted file mode 100644 index 36013d9..0000000 --- a/tclap/tests/test76.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: Argument: -b (--btmc) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test20 {-a|-b} [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test20 --help - diff --git a/tclap/tests/test76.sh b/tclap/tests/test76.sh deleted file mode 100755 index 9205a5e..0000000 --- a/tclap/tests/test76.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# failure validates that the correct error message -# is displayed for XOR'd args -./simple-test.sh `basename $0 .sh` test20 -ba diff --git a/tclap/tests/test77.out b/tclap/tests/test77.out deleted file mode 100644 index 36013d9..0000000 --- a/tclap/tests/test77.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: Argument: -b (--btmc) - Mutually exclusive argument already set! - -Brief USAGE: - ../examples/test20 {-a|-b} [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test20 --help - diff --git a/tclap/tests/test77.sh b/tclap/tests/test77.sh deleted file mode 100755 index 6177344..0000000 --- a/tclap/tests/test77.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# failure validates that the correct error message -# is displayed for XOR'd args -./simple-test.sh `basename $0 .sh` test20 -ab diff --git a/tclap/tests/test78.out b/tclap/tests/test78.out deleted file mode 100644 index 6c0e533..0000000 --- a/tclap/tests/test78.out +++ /dev/null @@ -1 +0,0 @@ -My name (spelled backwards) is: ekim diff --git a/tclap/tests/test78.sh b/tclap/tests/test78.sh deleted file mode 100755 index 1164b58..0000000 --- a/tclap/tests/test78.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test21 ~~reverse /n mike diff --git a/tclap/tests/test79.out b/tclap/tests/test79.out deleted file mode 100644 index 9e7b467..0000000 --- a/tclap/tests/test79.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: - Required argument missing: name - -Brief USAGE: - ../examples/test21 [/r] /n [//] [~~version] [/h] - -For complete USAGE and HELP type: - ../examples/test21 ~~help - diff --git a/tclap/tests/test79.sh b/tclap/tests/test79.sh deleted file mode 100755 index b5a388c..0000000 --- a/tclap/tests/test79.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# success -./simple-test.sh `basename $0 .sh` test21 diff --git a/tclap/tests/test8.out b/tclap/tests/test8.out deleted file mode 100644 index 1b4af57..0000000 --- a/tclap/tests/test8.out +++ /dev/null @@ -1,3 +0,0 @@ - -../examples/test2 version: 0.99 - diff --git a/tclap/tests/test8.sh b/tclap/tests/test8.sh deleted file mode 100755 index ba891c2..0000000 --- a/tclap/tests/test8.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 --version diff --git a/tclap/tests/test80.out b/tclap/tests/test80.out deleted file mode 100644 index 9797c85..0000000 --- a/tclap/tests/test80.out +++ /dev/null @@ -1 +0,0 @@ -My name is: mike diff --git a/tclap/tests/test80.sh b/tclap/tests/test80.sh deleted file mode 100755 index 7d82341..0000000 --- a/tclap/tests/test80.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# success (everything but -n mike should be ignored) -../examples/test22 asdf -n mike asdf fds xxx > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test80.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test81.out b/tclap/tests/test81.out deleted file mode 100644 index eda65fb..0000000 --- a/tclap/tests/test81.out +++ /dev/null @@ -1,9 +0,0 @@ -PARSE ERROR: - Required argument missing: name - -Brief USAGE: - ../examples/test22 [-r] -n [--] [--version] [-h] - -For complete USAGE and HELP type: - ../examples/test22 --help - diff --git a/tclap/tests/test81.sh b/tclap/tests/test81.sh deleted file mode 100755 index 673ada3..0000000 --- a/tclap/tests/test81.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# failure, still looking for -n -../examples/test22 asdf asdf -r fds xxx > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test81.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test82.out b/tclap/tests/test82.out deleted file mode 100644 index e24b39c..0000000 --- a/tclap/tests/test82.out +++ /dev/null @@ -1,9 +0,0 @@ -[-i] 0 9 -[-i] 1 8 -[ ] 0 blah -[ ] 1 --blah -[ ] 2 homer -[ ] 3 marge -[ ] 4 bart -for string we got : bill -for bool B we got : 1 diff --git a/tclap/tests/test82.sh b/tclap/tests/test82.sh deleted file mode 100755 index dba6a18..0000000 --- a/tclap/tests/test82.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# success - all unmatched args get slurped up in the UnlabeledMultiArg -../examples/test23 blah --blah -s=bill -i=9 -i=8 -B homer marge bart > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test82.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test83.out b/tclap/tests/test83.out deleted file mode 100644 index 7198bc1..0000000 --- a/tclap/tests/test83.out +++ /dev/null @@ -1,7 +0,0 @@ --nx (--name) -- Argument flag can only be one character long -- (--name) -- Argument flag cannot be either '-' or '--' or a space. --- (--name) -- Argument flag cannot be either '-' or '--' or a space. ---- (--name) -- Argument flag can only be one character long --n (-- ) -- Argument name begin with either '-' or '--' or space. --n (---) -- Argument name begin with either '-' or '--' or space. --n (----) -- Argument name begin with either '-' or '--' or space. diff --git a/tclap/tests/test83.sh b/tclap/tests/test83.sh deleted file mode 100755 index 5aab222..0000000 --- a/tclap/tests/test83.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# success -../examples/test24 > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test83.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test84.out b/tclap/tests/test84.out deleted file mode 100644 index 92ed5ad..0000000 --- a/tclap/tests/test84.out +++ /dev/null @@ -1,119 +0,0 @@ - - - - - -test25 -1 - - -test25 -this is a message - - - -test25 - --s string --B - --A --- ---version --h - - - -Description - -this is a message - - - -Options - - - - - - - - - - -exist Test A - - - - - - - - - - - - -(OR required) exist Test B - - - - - - - - - - - - -(OR required) string test - - - - - - - - - - - - -Ignores the rest of the labeled arguments following this flag. - - - - - - - - - -Displays version information and exits. - - - - - - - - - - - - -Displays usage information and exits. - - - - - - -Version - -0.99 - - - diff --git a/tclap/tests/test84.sh b/tclap/tests/test84.sh deleted file mode 100755 index 4a35dd7..0000000 --- a/tclap/tests/test84.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# docbookoutput. The when this test fails due to e.g. formatting -# changes the results needs to be manually reviewed and the test81.out -# updated -../examples/test25 -h x > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test84.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test85.out b/tclap/tests/test85.out deleted file mode 100644 index 87a7b2c..0000000 --- a/tclap/tests/test85.out +++ /dev/null @@ -1,10 +0,0 @@ -#compdef test25 - -# test25 version 0.99 - -_arguments -s -S \ - '*(-A --sA)'{-A,--sA}'[exist Test A]:integer' \ - '(-s --Bs -B --sB)'{-B,--sB}'[exist Test B]' \ - '(-s --Bs -B --sB)'{-s,--Bs}'[string test]:string' \ - '(-)--version[displays version information and exits]' \ - '(-)'{-h,--help}'[displays usage information and exits]' diff --git a/tclap/tests/test85.sh b/tclap/tests/test85.sh deleted file mode 100755 index 4816a55..0000000 --- a/tclap/tests/test85.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# zshcompletionoutput. The when this test fails due to e.g. formatting -# changes the results needs to be manually reviewed and the test81.out -# updated -../examples/test25 -h > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test85.out; then - exit 0 -else - exit 1 -fi - diff --git a/tclap/tests/test86.out b/tclap/tests/test86.out deleted file mode 100644 index b5588ec..0000000 --- a/tclap/tests/test86.out +++ /dev/null @@ -1 +0,0 @@ -3.2, -47.11, 0, diff --git a/tclap/tests/test86.sh b/tclap/tests/test86.sh deleted file mode 100755 index d1cfa3a..0000000 --- a/tclap/tests/test86.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -../examples/test14 -v "3.2 -47.11 0" > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test86.out; then - exit 0 -else - exit 1 -fi diff --git a/tclap/tests/test87.out b/tclap/tests/test87.out deleted file mode 100644 index 46786e9..0000000 --- a/tclap/tests/test87.out +++ /dev/null @@ -1 +0,0 @@ -1 2 3 diff --git a/tclap/tests/test87.sh b/tclap/tests/test87.sh deleted file mode 100755 index 1230dc7..0000000 --- a/tclap/tests/test87.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# this tests whether all required args are listed as -# missing when no arguments are specified -# failure -../examples/test26 -v "1 2 3" > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test87.out; then - exit 0 -else - exit 1 -fi diff --git a/tclap/tests/test88.out b/tclap/tests/test88.out deleted file mode 100644 index 94bf86e..0000000 --- a/tclap/tests/test88.out +++ /dev/null @@ -1,4 +0,0 @@ -for falseSwitch we got : 0 -for trueSwitch we got : 1 -for strArg we got : defStr -for intArg we got : 4711 diff --git a/tclap/tests/test88.sh b/tclap/tests/test88.sh deleted file mode 100755 index a8ef586..0000000 --- a/tclap/tests/test88.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -../examples/test27 > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test88.out; then - exit 0 -else - exit 1 -fi diff --git a/tclap/tests/test89.out b/tclap/tests/test89.out deleted file mode 100644 index 863339f..0000000 --- a/tclap/tests/test89.out +++ /dev/null @@ -1 +0,0 @@ -Passed diff --git a/tclap/tests/test89.sh b/tclap/tests/test89.sh deleted file mode 100755 index 68482cb..0000000 --- a/tclap/tests/test89.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -../examples/test28 > tmp.out 2>&1 - -if cmp -s tmp.out $srcdir/test89.out; then - exit 0 -else - exit 1 -fi diff --git a/tclap/tests/test9.out b/tclap/tests/test9.out deleted file mode 100644 index 3575646..0000000 --- a/tclap/tests/test9.out +++ /dev/null @@ -1,10 +0,0 @@ -0 -hv -1 one -2 two -for float we got : 3.7 -for int we got : 10 -for string we got : hello -for ulabeled we got : goodbye -for bool A we got : 0 -for bool B we got : 0 -for bool C we got : 0 diff --git a/tclap/tests/test9.sh b/tclap/tests/test9.sh deleted file mode 100755 index 49a89e6..0000000 --- a/tclap/tests/test9.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# success -./simple-test.sh `basename $0 .sh` test2 -i 10 -s hello goodbye -- -hv one two diff --git a/tclap/tests/testCheck.sh b/tclap/tests/testCheck.sh deleted file mode 100755 index efe21c3..0000000 --- a/tclap/tests/testCheck.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# -# A script to easily compare the output of old test results and new. -# -if [ "$1" == "" ] -then - echo "USAGE: testCheck.sh " -else - cmd="sh ./test$1.sh" - out="test$1.out" - $cmd - if cmp -s tmp.out $out - then - echo "$cmd OK -- output identical" - else - echo "$cmd Problem!" - echo - echo "TEST ======================================================" - echo - cat tmp.out - echo "EXPECTED ==================================================" - echo - cat $out - echo - echo "DIFF ======================================================" - echo "diff tmp.out $out" - echo "< = test(new) = tmp.out" - echo "> = expected = $out" - echo - diff tmp.out $out - echo - exit 1 - fi -fi