fixed output bug

This commit is contained in:
mes5k 2005-01-05 18:22:15 +00:00
parent cc18d11de7
commit aa7d526623
3 changed files with 9 additions and 8 deletions

View File

@ -310,7 +310,7 @@ inline void CmdLine::_constructor()
Arg::setDelimiter( _delimiter );
v = new HelpVisitor( this, _output );
v = new HelpVisitor( this, &_output );
SwitchArg* help = new SwitchArg("h","help",
"Displays usage information and exits.",
false, v);
@ -318,7 +318,7 @@ inline void CmdLine::_constructor()
deleteOnExit(help);
deleteOnExit(v);
v = new VersionVisitor( this, _output );
v = new VersionVisitor( this, &_output );
SwitchArg* vers = new SwitchArg("v","version",
"Displays version information and exits.",
false, v);

View File

@ -44,7 +44,7 @@ class HelpVisitor: public Visitor
/**
* The output object.
*/
CmdLineOutput* _out;
CmdLineOutput** _out;
public:
@ -53,14 +53,14 @@ class HelpVisitor: public Visitor
* \param cmd - The CmdLine the output will be generated for.
* \param out - The type of output.
*/
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput* out)
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the usage method of the CmdLineOutput for the
* specified CmdLine.
*/
void visit() { _out->usage(*_cmd); exit(0); }
void visit() { (*_out)->usage(*_cmd); exit(0); }
};

View File

@ -45,7 +45,7 @@ class VersionVisitor: public Visitor
/**
* The output object.
*/
CmdLineOutput* _out;
CmdLineOutput** _out;
public:
@ -54,14 +54,15 @@ class VersionVisitor: public Visitor
* \param cmd - The CmdLine the output is generated for.
* \param out - The type of output.
*/
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput* out )
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out )
: Visitor(), _cmd( cmd ), _out( out ) { }
/**
* Calls the version method of the output object using the
* specified CmdLine.
*/
void visit() { _out->version(*_cmd); exit(0); }
void visit() { (*_out)->version(*_cmd); exit(0); }
};
}