mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-10 12:49:08 -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
|
cerr << "My special failure message for: " << endl
|
||||||
<< e.what() << 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)
|
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
|
// set the output
|
||||||
MyOutput my;
|
MyOutput my;
|
||||||
cmd.setOutput( &my );
|
cmd.setOutput( &my );
|
||||||
|
|
||||||
// proceed normally ...
|
// proceed normally ...
|
||||||
</pre><p>
|
</pre><p>
|
||||||
|
@ -736,15 +736,29 @@ class MyOutput : public StdOutput
|
|||||||
cerr << "My special failure message for: " << endl
|
cerr << "My special failure message for: " << endl
|
||||||
<< e.what() << 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)
|
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
|
// set the output
|
||||||
MyOutput my;
|
MyOutput my;
|
||||||
cmd.setOutput( &my );
|
cmd.setOutput( &my );
|
||||||
|
|
||||||
// proceed normally ...
|
// proceed normally ...
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user