Changeset 10220 for trunk/FACT++/src/Configuration.h
- Timestamp:
- 03/03/11 19:28:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Configuration.h
r10183 r10220 3 3 4 4 #include <boost/program_options.hpp> 5 /*6 \attention7 \callgraph8 \callergraph9 \category10 \dot11 \remark12 \see13 \throws14 \todo15 \warning16 17 \e italic18 \b bold19 \c typewriter20 21 \code22 \endcode23 24 \f$25 \f[ \f]26 */27 5 28 6 namespace po = boost::program_options; … … 39 17 40 18 const std::string fName; /// argv[0] 19 20 std::map<std::string, std::string> fEnvMap; 41 21 42 22 po::options_description fOptionsCommandline[2]; /// Description of the command-line options … … 59 39 60 40 /// A default mapper for environment variables skipping all of them 61 static const std::string NameMapper(const std::string &) { return ""; } 41 std::string DefaultMapper(const std::string env) 42 { 43 return fEnvMap[env]; 44 } 62 45 63 46 /// Pointer to the mapper function for environment variables 64 const std::string (*fNameMapper)(const std::string&);47 boost::function1<std::string, std::string> fNameMapper; 65 48 66 49 /// Helper function which return the max of the two arguments in the first argument … … 88 71 void AddOptionsEnvironment(const po::options_description &env, bool visible=true); 89 72 void AddOptionsDatabase(const po::options_description &db, bool visible=true); 73 void AddOptions(const po::options_description &opt, bool visible=true) 74 { 75 AddOptionsCommandline(opt, visible); 76 AddOptionsConfigfile(opt, visible); 77 AddOptionsEnvironment(opt, visible); 78 AddOptionsDatabase(opt, visible); 79 } 90 80 91 81 void SetArgumentPositions(const po::positional_options_description &desc); 92 82 93 void SetNameMapper(const std::string (*mapper)(const std::string&)); 83 void SetNameMapper(const boost::function1<std::string, std::string> &func); 84 void SetNameMapper(); 85 86 void AddEnv(const std::string &conf, const std::string &env) 87 { 88 fEnvMap[env] = conf; 89 } 94 90 95 91 // Output
Note:
See TracChangeset
for help on using the changeset viewer.