(v0.19-24-g0617ca1 with changes)
#include "OptionsChrono.h"
#include <list>
#include "OptionsForTApplication.h"
Go to the source code of this file.
|
int | main (int argc, const char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Definition at line 6 of file optionExample.cpp.
16 options::single<double> complexDescription(
'\0',
"ComplexDescription",
"Pass here the Bremsstrahl-Tagging-Hodoscope-Engineering-Assemply-Rate in Hz", 84.);
17 options::single<double> moreComplexDescription(
'\0',
"MoreComplexDescription",
"very complicated example option with very long explanation to illustrate automatic wrapping in help output when the explanations become very long and would break readability otherwise.", 42.);
18 options::single<double> evenMoreComplexDescription(
'\0',
"EvenMoreComplexDescription",
"very complicated example option with very long explanation containing averylongwordwhichisunbreakableandthustriggersforcefulwordwrappinginaninconvenientplacetokeepthingssomehowatleastabitreadable.", 21.);
37 parser.fRequire(&number);
39 auto unusedOptions = parser.fParse(argc, argv);
41 TApplicationOptions.fFinalize(unusedOptions.begin(), unusedOptions.end());
43 for (
auto & unusedOption : unusedOptions) {
44 std::cout <<
"unused option : '" << unusedOption <<
"'" << std::endl;
46 for (
auto & num : numbers) {
47 std::cout <<
" number '" << num.first <<
"' is '" << num.second <<
"'\n";
49 for (
auto & str : strings) {
50 std::cout <<
" string '" << str.first <<
"' is '" << str.second <<
"'\n";
52 for (
double & dnum : dnums) {
53 std::cout <<
" double number '" << dnum <<
"'\n";
58 for (
auto & it : stringS) {
59 std::cout <<
" list std::string '" << it <<
"'\n";
62 std::cout <<
"and the time variable is:";
63 date.fWriteValue(std::cout);
64 auto timebuf = std::chrono::system_clock::to_time_t(date);
65 std::cout <<
", that is " << std::ctime(&timebuf);
67 std::cout <<
"the duration is: ";
68 dur.fWriteValue(std::cout);
69 std::cout <<
" or " << std::chrono::duration_cast<std::chrono::hours>(dur).count() <<
" hours \n";
References options::ForeignApplicationOptions::fFinalize(), options::parser::fParse(), options::parser::fRequire(), options::single< std::chrono::system_clock::time_point >::fWriteValue(), and options::single< T >::fWriteValue().