Ignore:
Timestamp:
Apr 7, 2011, 10:10:33 AM (10 years ago)
Author:
tbretz
Message:
Changed some output from cout to cerr to avoid it going to man pages cerated with help2man; added --version option, added possibility to add some text in front of the --help option
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Configuration.h

    r10220 r10296  
    4545
    4646    /// Pointer to the mapper function for environment variables
    47     boost::function1<std::string, std::string> fNameMapper;
     47    boost::function<std::string(std::string)> fNameMapper;
     48    boost::function<void()>                   fPrintUsage;
    4849
    4950    /// Helper function which return the max of the two arguments in the first argument
     
    5859    /// Print a list of all unkown options within the given vector
    5960    void PrintUnknown(std::vector<std::string> &vec, int steps=1);
     61
     62    virtual void PrintUsage() const { }
    6063
    6164public:
     
    8184    void SetArgumentPositions(const po::positional_options_description &desc);
    8285
    83     void SetNameMapper(const boost::function1<std::string, std::string> &func);
     86    void SetNameMapper(const boost::function<std::string(std::string)> &func);
    8487    void SetNameMapper();
     88
     89    void SetPrintUsage(const boost::function<void(void)> &func);
     90    void SetPrintUsage();
    8591
    8692    void AddEnv(const std::string &conf, const std::string &env)
     
    95101    // Process command line arguments
    96102    const po::variables_map &Parse(int argc, char **argv);
     103
     104    bool HasVersion() const
     105    {
     106        return Has("version");
     107    }
    97108
    98109    bool HasHelp() const
Note: See TracChangeset for help on using the changeset viewer.