mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-19 00:56:08 -04:00
fixed output bug
This commit is contained in:
parent
cc18d11de7
commit
aa7d526623
@ -310,7 +310,7 @@ inline void CmdLine::_constructor()
|
|||||||
|
|
||||||
Arg::setDelimiter( _delimiter );
|
Arg::setDelimiter( _delimiter );
|
||||||
|
|
||||||
v = new HelpVisitor( this, _output );
|
v = new HelpVisitor( this, &_output );
|
||||||
SwitchArg* help = new SwitchArg("h","help",
|
SwitchArg* help = new SwitchArg("h","help",
|
||||||
"Displays usage information and exits.",
|
"Displays usage information and exits.",
|
||||||
false, v);
|
false, v);
|
||||||
@ -318,7 +318,7 @@ inline void CmdLine::_constructor()
|
|||||||
deleteOnExit(help);
|
deleteOnExit(help);
|
||||||
deleteOnExit(v);
|
deleteOnExit(v);
|
||||||
|
|
||||||
v = new VersionVisitor( this, _output );
|
v = new VersionVisitor( this, &_output );
|
||||||
SwitchArg* vers = new SwitchArg("v","version",
|
SwitchArg* vers = new SwitchArg("v","version",
|
||||||
"Displays version information and exits.",
|
"Displays version information and exits.",
|
||||||
false, v);
|
false, v);
|
||||||
|
@ -44,7 +44,7 @@ class HelpVisitor: public Visitor
|
|||||||
/**
|
/**
|
||||||
* The output object.
|
* The output object.
|
||||||
*/
|
*/
|
||||||
CmdLineOutput* _out;
|
CmdLineOutput** _out;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -53,14 +53,14 @@ class HelpVisitor: public Visitor
|
|||||||
* \param cmd - The CmdLine the output will be generated for.
|
* \param cmd - The CmdLine the output will be generated for.
|
||||||
* \param out - The type of output.
|
* \param out - The type of output.
|
||||||
*/
|
*/
|
||||||
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput* out)
|
HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
|
||||||
: Visitor(), _cmd( cmd ), _out( out ) { }
|
: Visitor(), _cmd( cmd ), _out( out ) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the usage method of the CmdLineOutput for the
|
* Calls the usage method of the CmdLineOutput for the
|
||||||
* specified CmdLine.
|
* specified CmdLine.
|
||||||
*/
|
*/
|
||||||
void visit() { _out->usage(*_cmd); exit(0); }
|
void visit() { (*_out)->usage(*_cmd); exit(0); }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class VersionVisitor: public Visitor
|
|||||||
/**
|
/**
|
||||||
* The output object.
|
* The output object.
|
||||||
*/
|
*/
|
||||||
CmdLineOutput* _out;
|
CmdLineOutput** _out;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -54,14 +54,15 @@ class VersionVisitor: public Visitor
|
|||||||
* \param cmd - The CmdLine the output is generated for.
|
* \param cmd - The CmdLine the output is generated for.
|
||||||
* \param out - The type of output.
|
* \param out - The type of output.
|
||||||
*/
|
*/
|
||||||
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput* out )
|
VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out )
|
||||||
: Visitor(), _cmd( cmd ), _out( out ) { }
|
: Visitor(), _cmd( cmd ), _out( out ) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the version method of the output object using the
|
* Calls the version method of the output object using the
|
||||||
* specified CmdLine.
|
* specified CmdLine.
|
||||||
*/
|
*/
|
||||||
void visit() { _out->version(*_cmd); exit(0); }
|
void visit() { (*_out)->version(*_cmd); exit(0); }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user