Changeset 93:06761445a086 in qutecom-coip


Ignore:
Timestamp:
Mar 12, 2008 2:32:32 PM (5 years ago)
Author:
vadim@…
Branch:
default
Message:

Remove boost dependency form crashreport app

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r1 r93  
    6666) 
    6767 
    68 if (WIN32) 
     68#if (WIN32) 
    6969        subdirs( 
    7070                crashreport 
    7171        ) 
    72 endif (WIN32) 
     72#endif (WIN32) 
    7373 
    7474# This target MUST be the last one. It gathers all unit-tests available 
  • crashreport/main.cpp

    r1 r93  
    2525using namespace std; 
    2626 
    27 #include <boost/program_options.hpp> 
    28 using namespace boost::program_options; 
    2927 
    3028#include <QtGui/QApplication> 
     29 
     30const 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"; 
    3136 
    3237int main(int argc, char * argv[]) { 
     
    3944        string style; 
    4045        string info; 
     46        QStringList args = app.arguments(); 
     47        int i; 
    4148 
    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            } 
    4372 
    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          } 
    5575 
    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         } 
    9876 
    9977        QtCrashReport * crashReport = new QtCrashReport(dumpfile, applicationName, lang, info); 
Note: See TracChangeset for help on using the changeset viewer.