Changeset 10707 for trunk/FACT++/src/Configuration.cc
- Timestamp:
- 05/13/11 15:48:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Configuration.cc
r10634 r10707 92 92 po::options_description config("Section"); 93 93 config.add_options() 94 ("option1", po_string(), "This is option1") 95 ("option2", po_int(22), "This is option2") 96 ("option3,o", po_double()->required(), "This option is mandatory") 97 ("option4", po_int(&opt), "This is option 4") 98 ("option5", po_strings(), "A list of strings") 99 ("option6", po_strings(), "A list of strings") 100 ("option7", po_strings(), "A list of strings") 94 ("option1", var<string>(), "This is option1") 95 ("option2", var<int>(22), "This is option2") 96 ("option3,o", var<double>->required(), "This option is mandatory") 97 ("option4", var<int>(&opt), "This is option 4") 98 ("option5", vars<string>(), "A list of strings") 99 ("option6", vars<string>(), "A list of strings") 100 ("option7", vars<string>, "A list of strings") 101 ("option8", var<string>()->implicit_value("val"), "Just a string") 102 ("option9", var<string>()->default_value("def"), "Just a string") 103 ("optionA", var<string>("def"), "Just a string") 104 ("bool", po_bool(), "A special switch") 101 105 ; 102 106 … … 119 123 Abbreviations po_ints(), po_doubles() and po_strings() are available. 120 124 121 In addition to options introduced by a minus, so calles positional options 122 can be given on the command line. To describe these options use 125 There are several ways to define the behaviour of the options. In the 126 example above Parse will throw an exception if the "--option3" or "-o" 127 option is not given. "option9" will evaluate to "def" if it is not 128 given on the command line. The syntax of "optionA" is just an 129 abbreviation. "option8" will evaluate to "val" if just "--option5" but 130 no argument is given. Note, that these modifiers can be concatenated. 131 132 A special type po_bool() is provided which is an abbreviation of 133 var<bool>()->implicit_value(true)->default_value(false). In 134 contradiction to po_switch() this allows to set a true and 135 false value in the setup file. 136 137 In addition to options introduced by a minus or double minus, so called 138 positional options can be given on the command line. To describe these 139 options use 123 140 124 141 \code
Note:
See TracChangeset
for help on using the changeset viewer.