Changeset 88:18444049848b in lemon-main for demo
- Timestamp:
- 03/16/08 01:39:19 (17 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/arg_parser_demo.cc
r85 r88 21 21 ///\brief Argument parser demo 22 22 /// 23 /// This example shows how can the argument parserused.23 /// This example shows how the argument parser can be used. 24 24 /// 25 /// \include arg_parser .cc25 /// \include arg_parser_demo.cc 26 26 27 27 #include <lemon/arg_parser.h> … … 36 36 bool b,sil; 37 37 bool g1,g2,g3; 38 ap.refOption("n", " an integer input", i, true)39 .refOption("val", " a double input", d)38 ap.refOption("n", "An integer input.", i, true) 39 .refOption("val", "A double input.", d) 40 40 .synonym("vals","val") 41 .refOption("name", " a string input", s)42 .refOption("f", " a switch", b)41 .refOption("name", "A string input.", s) 42 .refOption("f", "A switch.", b) 43 43 .refOption("nohelp", "", sil) 44 .refOption("gra","Choi se A",g1)45 .refOption("grb","Choi se B",g2)46 .refOption("grc","Choi se C",g3)44 .refOption("gra","Choice A",g1) 45 .refOption("grb","Choice B",g2) 46 .refOption("grc","Choice C",g3) 47 47 .optionGroup("gr","gra") 48 48 .optionGroup("gr","grb") … … 50 50 .mandatoryGroup("gr") 51 51 .onlyOneGroup("gr") 52 .other("infile","The input file ")52 .other("infile","The input file.") 53 53 .other("..."); 54 54 … … 62 62 if(ap.given("f")) std::cout << " -f is given\n"; 63 63 if(ap.given("nohelp")) std::cout << " Value of -nohelp: " << sil << std::endl; 64 64 if(ap.given("gra")) std::cout << " -gra is given\n"; 65 if(ap.given("grb")) std::cout << " -grb is given\n"; 66 if(ap.given("grc")) std::cout << " -grc is given\n"; 67 65 68 switch(ap.files().size()) { 66 69 case 0:
Note: See TracChangeset
for help on using the changeset viewer.