9#ifndef CMDLINEOPTIONS_HPP
10#define CMDLINEOPTIONS_HPP
18#include <unordered_map>
23 namespace fs = std::filesystem;
26 static inline std::unordered_map<std::type_index, std::string>
type_names
28 {std::type_index(
typeid(std::vector<double>)),
"ARRAY<DOUBLE>"},
29 {std::type_index(
typeid(std::vector<fs::path>)),
"ARRAY<FILE>"},
30 {std::type_index(
typeid(std::vector<int>)),
"ARRAY<INT>"},
31 {std::type_index(
typeid(std::vector<std::string>)),
"ARRAY<STRING>"},
32 {std::type_index(
typeid(
double)),
"DOUBLE"},
33 {std::type_index(
typeid(fs::path)),
"FILE"},
34 {std::type_index(
typeid(
int)),
"INT"},
35 {std::type_index(
typeid(std::string)),
"STRING"}
39 template<
template<
typename>
class... Mixins>
51 template<
typename Derived>
55 const Derived*
pDerived {
static_cast<const Derived*
>(
this)};
60 std::stringstream strm;
61 strm <<
" -" <<
pDerived->flag << (Derived::usePrefix ?
" REQUIRED: " :
" ") <<
pDerived->helpMessageLine;
67 template<
typename Derived>
71 const Derived*
pDerived {
static_cast<const Derived*
>(
this)};
76 std::stringstream strm;
77 strm <<
" -" <<
pDerived->flag << (Derived::usePrefix ?
" OPTIONAL: " :
" ") <<
pDerived->helpMessageLine;
83 template<
typename Derived>
87 const Derived*
pDerived {
static_cast<const Derived*
>(
this)};
94 template<
typename T,
typename Derived>
99 const Derived*
pDerived {
static_cast<const Derived*
>(
this)};
106 std::stringstream strm;
115 template<
typename Derived>
118 template<
typename Derived>
121 template<
typename Derived>
124 template<
typename Derived>
Definition cmdLineOptions.hpp:69
const Derived * pDerived
Definition cmdLineOptions.hpp:71
std::string getHelpMessage() const
Definition cmdLineOptions.hpp:74
Definition cmdLineOptions.hpp:53
std::string getHelpMessage() const
Definition cmdLineOptions.hpp:58
const Derived * pDerived
Definition cmdLineOptions.hpp:55
Definition cmdLineOptions.hpp:96
static constexpr bool usePrefix
Definition cmdLineOptions.hpp:102
std::string generateUsage() const
Definition cmdLineOptions.hpp:104
double var
Definition cmdLineOptions.hpp:98
const Derived * pDerived
Definition cmdLineOptions.hpp:99
Definition cmdLineOptions.hpp:85
std::string generateUsage() const
Definition cmdLineOptions.hpp:91
const Derived * pDerived
Definition cmdLineOptions.hpp:87
static constexpr bool usePrefix
Definition cmdLineOptions.hpp:90
Definition cmdLineOptions.hpp:22
CommandLineOption< Required, WithDoubleArgument > RequiredFlagWithDouble
Definition cmdLineOptions.hpp:136
CommandLineOption< Required, WithStringArgument > RequiredFlagWithString
Definition cmdLineOptions.hpp:139
CommandLineOption< Optional, WithIntegerArgument > OptionalFlagWithInteger
Definition cmdLineOptions.hpp:132
static std::unordered_map< std::type_index, std::string > type_names
Definition cmdLineOptions.hpp:27
WithArgument< fs::path, Derived > WithFileArgument
Definition cmdLineOptions.hpp:119
WithArgument< std::string, Derived > WithStringArgument
Definition cmdLineOptions.hpp:125
CommandLineOption< Optional, WithStringArgument > OptionalFlagWithString
Definition cmdLineOptions.hpp:133
CommandLineOption< Required, WithFileArgument > RequiredFlagWithFile
Definition cmdLineOptions.hpp:137
CommandLineOption< Optional, WithFileArgument > OptionalFlagWithFile
Definition cmdLineOptions.hpp:131
CommandLineOption< Optional, WithDoubleArgument > OptionalFlagWithDouble
Definition cmdLineOptions.hpp:130
CommandLineOption< Required, WithIntegerArgument > RequiredFlagWithInteger
Definition cmdLineOptions.hpp:138
CommandLineOption< Optional, WithoutArgument > OptionalFlag
Definition cmdLineOptions.hpp:129
WithArgument< int, Derived > WithIntegerArgument
Definition cmdLineOptions.hpp:122
CommandLineOption< Required, WithoutArgument > RequiredFlag
Definition cmdLineOptions.hpp:135
WithArgument< double, Derived > WithDoubleArgument
Definition cmdLineOptions.hpp:116
Definition cmdLineOptions.hpp:41
char flag
Definition cmdLineOptions.hpp:42
CommandLineOption(char Flag, const std::string &HelpMessageLine)
Definition cmdLineOptions.hpp:45
std::string helpMessageLine
Definition cmdLineOptions.hpp:43