From 4ad3b2e82c73839c6aaf09d6e78ac99b8cea2e48 Mon Sep 17 00:00:00 2001 From: mes5k Date: Wed, 5 Jan 2005 18:51:12 +0000 Subject: [PATCH] fixed output override bug --- docs/manual.html | 22 ++++++++++++++++++---- docs/manual.xml | 22 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/docs/manual.html b/docs/manual.html index 0da48ce..0bf1671 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -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 ...

diff --git a/docs/manual.xml b/docs/manual.xml index 5651813..10abac9 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -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 ...