Changeset 10805 for trunk/FACT++


Ignore:
Timestamp:
05/24/11 19:34:55 (14 years ago)
Author:
tbretz
Message:
Simplified program options handling.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/test3.cc

    r10669 r10805  
    22#include <boost/filesystem.hpp>
    33
    4 #include "FACT.h"
    54#include "Dim.h"
    65#include "Shell.h"
     
    8281        vm = conf.Parse(argc, argv);
    8382    }
    84     catch (std::exception &e)
     83#if BOOST_VERSION > 104000
     84    catch (po::multiple_occurrences &e)
    8585    {
    86 #if BOOST_VERSION > 104000
    87         po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
    88         if (MO)
    89             cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
    90         else
     86        cerr << "Program options invalid due to: " << e.what() << " of '" << e.get_option_name() << "'." << endl;
     87        return -1;
     88    }
    9189#endif
    92             cout << "Error: " << e.what() << endl;
    93         cout << endl;
    94 
     90    catch (exception& e)
     91    {
     92        cerr << "Program options invalid due to: " << e.what() << endl;
    9593        return -1;
    9694    }
    9795
    98     if (conf.HasPrint())
     96    if (conf.HasVersion() || conf.HasPrint())
    9997        return -1;
    100 
    101     if (conf.HasVersion())
    102     {
    103         FACT::PrintVersion(argv[0]);
    104         return -1;
    105     }
    10698
    10799    if (conf.HasHelp())
Note: See TracChangeset for help on using the changeset viewer.