Changeset 93:06761445a086 in qutecom-coip
- Timestamp:
- Mar 12, 2008 2:32:32 PM (5 years ago)
- Branch:
- default
- Files:
-
- 2 edited
-
CMakeLists.txt (modified) (1 diff)
-
crashreport/main.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r1 r93 66 66 ) 67 67 68 if (WIN32)68 #if (WIN32) 69 69 subdirs( 70 70 crashreport 71 71 ) 72 endif (WIN32)72 #endif (WIN32) 73 73 74 74 # This target MUST be the last one. It gathers all unit-tests available -
crashreport/main.cpp
r1 r93 25 25 using namespace std; 26 26 27 #include <boost/program_options.hpp>28 using namespace boost::program_options;29 27 30 28 #include <QtGui/QApplication> 29 30 const char usage[] = 31 "--help display this message\n" 32 "--dumpfile dump file name\n" 33 "--name application name\n" 34 "--lang applicatiion language\n" 35 "--info additional info\n"; 31 36 32 37 int main(int argc, char * argv[]) { … … 39 44 string style; 40 45 string info; 46 QStringList args = app.arguments(); 47 int i; 41 48 42 try { 49 for(i = 1; i < args.size(); i++) 50 { 51 const QString& av = args.at(i); 52 if (av == "--help" || av == "--h") { 53 cout << usage << endl; 54 exit(0); 55 } 56 else if (av == "--dumpfile" || av == "--d") { 57 dumpfile = av.toStdString(); 58 cout << "dumpfile = " << dumpfile << endl; 59 } 60 else if (av == "--name" || av == "--n") { 61 applicationName = av.toStdString(); 62 cout << "name = " << applicationName << endl; 63 } 64 else if (av == "--lang" || av == "--l") { 65 lang = av.toStdString(); 66 cout << "lang = " << lang << endl; 67 } 68 else if (av == "--info" || av == "--i") { 69 info = av.toStdString(); 70 cout << "info = " << info << endl; 71 } 43 72 44 options_description desc("Allowed options"); 45 desc.add_options() 46 // First parameter describes option name/short name 47 // The second is parameter to option 48 // The third is description 49 ("help,h", "print usage message") 50 ("dumpfile,d", value(&dumpfile), "path to the memory dump file") 51 ("name,n", value(&applicationName), "the application name") 52 ("lang,l", value(&lang), "the application language") 53 ("info,i", value(&info), "additionnal info") 54 ; 73 74 } 55 75 56 variables_map vm;57 store(parse_command_line(argc, argv, desc), vm);58 59 if (vm.count("help")) {60 cout << desc << "\n";61 return 0;62 }63 64 if (vm.count("dumpfile")) {65 cout << "dumpfile = " << vm["dumpfile"].as<string>() << "\n";66 dumpfile = vm["dumpfile"].as<string>();67 } else {68 cout << "No dump file specified" << endl;69 return 1;70 }71 72 if (vm.count("name")) {73 cout << "name = " << vm["name"].as<string>() << "\n";74 applicationName = vm["name"].as<string>();75 } else {76 cout << "No name specified" << endl;77 return 1;78 }79 80 if (vm.count("lang")) {81 cout << "lang = " << vm["lang"].as<string>() << "\n";82 lang = vm["lang"].as<string>();83 } else {84 cout << "No lang specified" << endl;85 }86 87 if (vm.count("info")) {88 cout << "info = " << vm["info"].as<string>() << "\n";89 info = vm["info"].as<string>();90 } else {91 cout << "No info specified" << endl;92 }93 94 }95 catch(exception& e) {96 cerr << e.what() << "\n";97 }98 76 99 77 QtCrashReport * crashReport = new QtCrashReport(dumpfile, applicationName, lang, info);
Note: See TracChangeset
for help on using the changeset viewer.
