本文整理汇总了C++中CommandLine::addtoman_chapter方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLine::addtoman_chapter方法的具体用法?C++ CommandLine::addtoman_chapter怎么用?C++ CommandLine::addtoman_chapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLine
的用法示例。
在下文中一共展示了CommandLine::addtoman_chapter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArgs
void HandleArgs(CommandLine &cl, int argc, char *argv[], Error *error) {
// Arguments
cl.add(' ',2,0);
cl.addargname(' ',"input_matrix");
cl.addargname(' ',"output_matrix");
cl.add('r',1);
cl.addargname('r',"rows");
cl.adddescription('r',"Only output a selected set rows specified in the string.");
cl.add('c',1);
cl.addargname('c',"columns");
cl.adddescription('c',"Only output a selected set of columns specified in the string.");
cl.add('z',1);
cl.addargname('z',"mod_num");
cl.adddescription('z',"Reorder the matrix rows using the supplied modulus number. For a mod_num of 3, the first row in the new matrix is 0, followed by 3, 6, 9, ..., 1, 4, 7, ...");
cl.add('s',2);
cl.addargname('s',"rand_percent");
cl.addargname('s',"rest_file");
cl.adddescription('s',"Output a random subset of rows. rand_percent is the fraction of the matrix to output and must be between 0 and 1. The random selection is taken after any other slicing. If rest_file is not NO_OUTPUT, the remaining slice is output to the specified filename.");
cl.add('t',0);
cl.adddescription('t',"Output the matix in 'pretty' format.");
cl.add('b',0);
cl.adddescription('b',"Output the matix in binary format.");
cl.add('q',0);
cl.adddescription('q',"Transpose the matrix.");
// Stuff for every executable
cl.addhelp('h',0);
cl.adddescription('h',"Print out the man page for help");
cl.add('n',1);
cl.addargname('n',"notice_level");
cl.adddescription('n',"Set the degree of program output. Use: \n\n\t-n 0\tNo output\n\t-n 10\tNormal program output\n\t-n 20\tParameters useful for reproducing the results\n\t-n 30\tAll output");
// Short Description
cl.addtoman_chapter("NAME","Perform matrix slicing");
// Version
cl.addtoman_chapter("VERSION","Version "+string(YALA_VERSION));
// Full Description
const string desc[4]={
"Perform matrix slicing. The input file and output file are optional. ",
"If only one is specified, it is assumed to be the input file. ",
"If the input file or output file not specified, STDIN or STDOUT ",
"is used to allow for piping."
};
cl.addtoman_chapter("DESCRIPTION",4,desc);
ya_addftmanpage(cl);
// Authors
cl.addtoman_chapter("AUTHORS","W. Michael Brown");
// Parse the commandline
if (!cl.parse(argc,argv,error)) {
Describe(cl,cout);
error->generate_error(0,a::filenameonly(argv[0]),"Bad Command Line\n");
}
// Set the notice level
if (cl['n'])
error->note.set_notice_level(cl.argint('n',0));
// Generate a notice with the command line for records purposes
string cm=cl.program_name();
for (int j=1; j<argc; j++)
cm+=' '+string(argv[j]);
cm+="\n";
error->note.notice(19,"CommandLine",cm);
// Output the help
if (cl['h']) {
cl.write_man_page(cout,YALA_VERSION,"YALA Utilities");
exit(0);
}
}