mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-13 14:16:00 -04:00
reflects new output handling
This commit is contained in:
parent
6f2d4828a8
commit
31ab3f37ec
@ -8,28 +8,18 @@ using namespace TCLAP;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
// This exemplifies how the CmdLine class can be overridden to provide
|
// This exemplifies how the output class can be overridden to provide
|
||||||
// user defined output.
|
// user defined output.
|
||||||
class MyCmdLine : public CmdLine
|
class MyOutput : public StdOutput
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MyCmdLine(const std::string& name,
|
virtual void failure(CmdLineInterface& c, ArgException& e)
|
||||||
const std::string& message,
|
|
||||||
const std::string& version = "none" )
|
|
||||||
: CmdLine(name,message,version) { }
|
|
||||||
|
|
||||||
MyCmdLine(const std::string& message,
|
|
||||||
const char delimiter = ' ',
|
|
||||||
const std::string& version = "none" )
|
|
||||||
: CmdLine(message,delimiter,version) { }
|
|
||||||
|
|
||||||
virtual void failure(const ArgException& e)
|
|
||||||
{
|
{
|
||||||
cerr << "My special failure message for: " << endl
|
cerr << "My special failure message for: " << endl
|
||||||
<< e.what() << endl;
|
<< e.what() << endl;
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +45,11 @@ void parseOptions(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
MyCmdLine cmd("this is a message", ' ', "0.99" );
|
CmdLine cmd("this is a message", ' ', "0.99" );
|
||||||
|
|
||||||
|
// set the output
|
||||||
|
MyOutput my;
|
||||||
|
cmd.setOutput(&my);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define arguments
|
// Define arguments
|
||||||
|
Loading…
x
Reference in New Issue
Block a user