if (argc >= 2 && (strcmp(argv[1],"--xml") == 0))
{
std::cout << "" << std::endl;
std::cout << "" << std::endl;
std::cout << " utility" << std::endl;
std::cout << " NAMIC Command Line Processing Code Generator" << std::endl;
std::cout << " Generates C++ code that will parse command lines" << std::endl;
std::cout << " 1.0" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " Bill Lorensen" << std::endl;
std::cout << "" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " Parameters used for command line processing" << std::endl;
std::cout << " " << std::endl;
std::cout << " UseTCLAP" << std::endl;
std::cout << " --TCLAP" << std::endl;
std::cout << " Generate TCLAP Code" << std::endl;
std::cout << " " << std::endl;
std::cout << " true" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " Input/Output parameters" << std::endl;
std::cout << " " << std::endl;
std::cout << " InputXML" << std::endl;
std::cout << " " << std::endl;
std::cout << " input" << std::endl;
std::cout << " 0" << std::endl;
std::cout << " XML description of interface" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << " OutputCxx" << std::endl;
std::cout << " " << std::endl;
std::cout << " output" << std::endl;
std::cout << " 1" << std::endl;
std::cout << " C++ Code to process command line arguments" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << std::endl;
std::cout << "" << std::endl;
std::cout << "" << std::endl;
return EXIT_SUCCESS;
}
bool UseTCLAP = true;
std::string InputXML;
std::string OutputCxx;
bool echoSwitch = false;
bool xmlSwitch = false;
try
{
TCLAP::CmdLine commandLine (
"Generates C++ code that will parse command lines",
' ',
"$Revision: $" );
itksys_ios::ostringstream msg;
msg.str("");msg << "Generate TCLAP Code (default: " << UseTCLAP << ")";
TCLAP::SwitchArg UseTCLAPArg("", "TCLAP", msg.str(), commandLine, 0);
msg.str("");msg << "XML description of interface"; TCLAP::UnlabeledValueArg InputXMLArg("InputXML", msg.str(), 1, InputXML, "std::string", commandLine);
msg.str("");msg << "C++ Code to process command line arguments"; TCLAP::UnlabeledValueArg OutputCxxArg("OutputCxx", msg.str(), 1, OutputCxx, "std::string", commandLine);
msg.str("");msg << "Echo the command line arguments (default: " << echoSwitch << ")";
TCLAP::SwitchArg echoSwitchArg("", "echo", msg.str(), commandLine, 0);
msg.str("");msg << "Produce xml description of command line arguments (default: " << xmlSwitch << ")";
TCLAP::SwitchArg xmlSwitchArg("", "xml", msg.str(), commandLine, 0);
commandLine.parse ( argc, (char**) argv );
UseTCLAP = UseTCLAPArg.getValue();
InputXML = InputXMLArg.getValue();
OutputCxx = OutputCxxArg.getValue();
echoSwitch = echoSwitchArg.getValue();
xmlSwitch = xmlSwitchArg.getValue();
}
catch ( TCLAP::ArgException e )
{
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
exit ( EXIT_FAILURE );
}
if (echoSwitch)
{
std::cout << "Command Line Arguments" << std::endl;
std::cout << " UseTCLAP: " << UseTCLAP << std::endl;
std::cout << " InputXML: " << InputXML << std::endl;
std::cout << " OutputCxx: " << OutputCxx << std::endl;
std::cout << " echoSwitch: " << echoSwitch << std::endl;
std::cout << " xmlSwitch: " << xmlSwitch << std::endl;
}