Changes between Version 8 and Version 9 of Documentation/Configuration
- Timestamp:
- Feb 4, 2010, 5:05:38 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/Configuration
v8 v9 21 21 function, as in the {{{main.cpp}}} of the !PingPong sample. The given configuration file will be read and is accessible throughout the whole process. You can check if there is a configuration file available using 22 22 {{{ 23 #!cpp 23 24 if( Configuration::haveConfig() ) 24 25 }}} 25 26 and get a reference to the configuration singleton using 26 27 {{{ 28 #!cpp 27 29 Configuration& config = Configuration::instance(); 28 30 }}} … … 34 36 where value can be a string, integer, or {{{true|false}}}. Reading from the configuration file is parametrized using the desired type: 35 37 {{{ 38 #!cpp 36 39 string name = config.read<string>("name"); 37 40 int count = config.read<int>("count"); … … 41 44 The !PingPong sample uses the following to read the {{{endpoint}}} and {{{bootstrap.hints}}} from the configuration file: 42 45 {{{ 46 #!cpp 43 47 if (config.exists("ariba.endpoints")) 44 48 ariba->setProperty("endpoints", config.read<string>("ariba.endpoints"));