mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-09 04:09:31 -04:00
fixed output override bug
This commit is contained in:
parent
14ba43861a
commit
4ad3b2e82c
@ -577,15 +577,29 @@ class MyOutput : public StdOutput
|
||||
cerr << "My special failure message for: " << endl
|
||||
<< e.what() << endl;
|
||||
}
|
||||
|
||||
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" );
|
||||
CmdLine cmd("this is a message", ' ', "0.99" );
|
||||
|
||||
// set the output
|
||||
MyOutput my;
|
||||
cmd.setOutput( &my );
|
||||
// set the output
|
||||
MyOutput my;
|
||||
cmd.setOutput( &my );
|
||||
|
||||
// proceed normally ...
|
||||
</pre><p>
|
||||
|
@ -736,15 +736,29 @@ class MyOutput : public StdOutput
|
||||
cerr << "My special failure message for: " << endl
|
||||
<< e.what() << endl;
|
||||
}
|
||||
|
||||
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" );
|
||||
CmdLine cmd("this is a message", ' ', "0.99" );
|
||||
|
||||
// set the output
|
||||
MyOutput my;
|
||||
cmd.setOutput( &my );
|
||||
// set the output
|
||||
MyOutput my;
|
||||
cmd.setOutput( &my );
|
||||
|
||||
// proceed normally ...
|
||||
</programlisting>
|
||||
|
Loading…
x
Reference in New Issue
Block a user