|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
22 #ifndef ELM_OPTION_ENUM_OPTION_H
23 #define ELM_OPTION_ENUM_OPTION_H
25 #include <elm/option/Option.h>
27 namespace elm {
namespace option {
43 inline Make&
def(T v) { _def = v; _def_set =
true;
return *
this; }
53 val(m._def_set ? m._def : m._values[0].snd), vals(m._values), arg(m._arg) { }
55 inline T
value(
void)
const {
return val; }
62 for(
auto v: vals)
if(arg == v.fst) { val = v.snd;
return; }
69 inline operator T(
void)
const {
return value(); }
80 #endif // ELM_OPTION_ENUM_OPTION_H
Make & def(T v)
Definition: EnumOption.h:43
Pair< T1, T2 > pair(const T1 &v1, const T2 &v2)
Definition: Pair.h:63
Make & description(cstring desc)
Definition: Option.h:59
usage_t
Definition: Option.h:41
void set(const T &value)
Definition: EnumOption.h:56
Definition: EnumOption.h:31
Make & val(cstring n, T v)
Definition: EnumOption.h:42
cstring argDescription(void) override
Definition: EnumOption.h:66
T value(void) const
Definition: EnumOption.h:55
AutoStringStartup & _
Definition: debug_CrashHandler.cpp:232
Definition: EnumOption.h:35
Make & arg(cstring d)
Definition: EnumOption.h:44
Make(Manager &m)
Definition: EnumOption.h:39
EnumOption(const Make &m)
Definition: EnumOption.h:52
Make & cmd(string cmd)
Definition: Option.h:57
Make & description(cstring desc)
Definition: EnumOption.h:41
Make & cmd(string cmd)
Definition: EnumOption.h:40
Make(Manager *m)
Definition: EnumOption.h:38
@ arg_required
Definition: Option.h:44
usage_t usage(void) override
Definition: EnumOption.h:59
Pair< cstring, T > value_t
Definition: EnumOption.h:33
void process(String arg) override
Definition: EnumOption.h:61
EnumOption & operator=(const T &value)
Definition: EnumOption.h:70
cstring desc
Definition: Option.h:75