mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-08 03:40:21 -04:00
Run CmdLine::parse with argv as pointer to const pointer to const char
This commit is contained in:
parent
37c112ddab
commit
847b8c9478
@ -1,5 +1,5 @@
|
||||
|
||||
noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9
|
||||
noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10
|
||||
|
||||
test1_SOURCES = test1.cpp
|
||||
test2_SOURCES = test2.cpp
|
||||
@ -10,6 +10,7 @@ test6_SOURCES = test6.cpp
|
||||
test7_SOURCES = test7.cpp
|
||||
test8_SOURCES = test8.cpp
|
||||
test9_SOURCES = test9.cpp
|
||||
test10_SOURCES = test10.cpp
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
|
26
examples/test10.cpp
Normal file
26
examples/test10.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// 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[] = {"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);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ private:
|
||||
* \param argc - Number of arguments.
|
||||
* \param argv - Array of arguments.
|
||||
*/
|
||||
void parse(int argc, char** argv);
|
||||
void parse(int argc, const char * const * argv);
|
||||
|
||||
/**
|
||||
* Parses the command line.
|
||||
@ -391,7 +391,7 @@ inline void CmdLine::add( Arg* a )
|
||||
}
|
||||
|
||||
|
||||
inline void CmdLine::parse(int argc, char** argv)
|
||||
inline void CmdLine::parse(int argc, const char * const * argv)
|
||||
{
|
||||
// this step is necessary so that we have easy access to
|
||||
// mutable strings.
|
||||
|
@ -82,7 +82,7 @@ class CmdLineInterface
|
||||
* \param argc - Number of arguments.
|
||||
* \param argv - Array of arguments.
|
||||
*/
|
||||
virtual void parse(int argc, char** argv)=0;
|
||||
virtual void parse(int argc, const char * const * argv)=0;
|
||||
|
||||
/**
|
||||
* Parses the command line.
|
||||
|
Loading…
x
Reference in New Issue
Block a user