20#ifndef PALUDIS_GUARD_PALUDIS_UTIL_OPTIONS_HH
21#define PALUDIS_GUARD_PALUDIS_UTIL_OPTIONS_HH 1
25#include <initializer_list>
58 OptionsStore(
const OptionsStore &) =
default;
59 ~OptionsStore() =
default;
61 OptionsStore & operator= (
const OptionsStore &) =
default;
71 void add(
const unsigned);
101 bool test(
const unsigned)
const;
124 template <
typename E_>
132 Options(
const Options &) =
default;
133 Options & operator= (
const Options &) =
default;
135 Options(std::initializer_list<E_> e)
137 for (
const auto option : e)
138 _store.
add(
static_cast<unsigned>(option));
146 Options result(*
this);
147 result._store.
add(
static_cast<unsigned>(e));
156 _store.add(
static_cast<unsigned>(e));
165 Options result(*
this);
166 result._store.
remove(
static_cast<unsigned>(e));
175 _store.remove(
static_cast<unsigned>(e));
184 Options result(*
this);
185 result._store.
combine(e._store);
194 _store.combine(e._store);
203 Options result(*
this);
213 _store.intersect(e._store);
231 return _store.test(
static_cast<unsigned>(e));
247 return ! _store.any();
257 return static_cast<E_
>(_store.highest_bit());
void subtract(const OptionsStore &)
void combine(const OptionsStore &)
void remove(const unsigned)
unsigned highest_bit() const
bool test(const unsigned) const
void intersect(const OptionsStore &)
Options & operator+=(const E_ &e)
Definition options.hh:154
Options & subtract(const Options< E_ > &e)
Definition options.hh:220
Options operator-(const E_ &e) const
Definition options.hh:163
Options & operator|=(const Options< E_ > &e)
Definition options.hh:192
Options & operator-=(const E_ &e)
Definition options.hh:173
bool operator[](const E_ &e) const
Definition options.hh:229
Options operator+(const E_ &e) const
Definition options.hh:144
E_ highest_bit() const
Definition options.hh:255
Options operator&(const Options< E_ > &e) const
Definition options.hh:201
bool any() const
Definition options.hh:237
Options & operator&=(const Options< E_ > &e)
Definition options.hh:211
bool none() const
Definition options.hh:245
Options operator|(const Options< E_ > &e) const
Definition options.hh:182
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24