Options.h
Go to the documentation of this file.
60 explicit Option(const char *nameThatEnables, const char *nameThatDisables = nullptr, ValueExpectation vex = valueNone);
133 explicit TypedOption(const char *nameThatEnables, const char *nameThatDisables = nullptr, ValueExpectation vex = valueNone):
146 bool disabled() const override { return recipient_ && recipient_->disabled && /* paranoid: */ offName; }
Stores configuration of a typical boolean flag or a single-value Option.
Definition: Options.h:100
bool enabled() const
whether the option is explicitly turned "on" (with or without a value)
Definition: Options.h:114
A single option supported by an ACL: -x[=value] or –name[=value].
Definition: Options.h:57
virtual bool configured() const =0
virtual void enable() const =0
called after parsing onName without a value (e.g., -x or –enable-x)
const char *const onName
A name that must be used to explicitly enable this Option (required).
Definition: Options.h:88
virtual void print(std::ostream &os) const =0
prints a configuration snippet (as an admin could have typed)
virtual void configureWith(const SBuf &rawValue) const =0
called after parsing onName and a value (e.g., -x=v or –enable-x=v)
virtual void disable() const =0
called after parsing offName (e.g., +i or –disable-x)
virtual void unconfigure() const =0
clear enable(), configureWith(), or disable() effects
Option(const char *nameThatEnables, const char *nameThatDisables=nullptr, ValueExpectation vex=valueNone)
Definition: Options.cc:66
virtual bool valued() const =0
a type-specific Option (e.g., a boolean –toggle or -m=SBuf)
Definition: Options.h:130
void disable() const override
called after parsing offName (e.g., +i or –disable-x)
Definition: Options.h:172
void unconfigure() const override
clear enable(), configureWith(), or disable() effects
Definition: Options.h:149
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
Definition: Options.h:137
void configureWith(const SBuf &rawValue) const override
called after parsing onName and a value (e.g., -x=v or –enable-x=v)
Definition: Options.h:163
void print(std::ostream &os) const override
prints a configuration snippet (as an admin could have typed)
Definition: Options.h:181
TypedOption(const char *nameThatEnables, const char *nameThatDisables=nullptr, ValueExpectation vex=valueNone)
Definition: Options.h:133
void enable() const override
called after parsing onName without a value (e.g., -x or –enable-x)
Definition: Options.h:154