libzypp: zypp::base::Flags< TEnum > Class Template Reference

libzypp 17.38.14

zypp::base::Flags< TEnum > Class Template Reference

A type-safe way of storing OR-combinations of enum values (like QTs QFlags). More...

`#include <zypp-core/base/Flags.h>`

## Public Types
using | Enum = TEnum
| The underlying enum type.
using | Integral = std::underlying_type_t<Enum>
| The underlying integral type.

## Public Member Functions
constexpr | Flags ()
constexpr | Flags (Enum flag_r)
constexpr | Flags (Integral flag_r)
constexpr bool | isNone () const
constexpr bool | isAll () const
Flags & | operator&= (Flags rhs)
Flags & | operator&= (Enum rhs)
Flags & | operator|= (Flags rhs)
Flags & | operator|= (Enum rhs)
Flags & | operator^= (Flags rhs)
Flags & | operator^= (Enum rhs)
constexpr | operator Integral () const
constexpr Flags | operator& (Flags rhs) const
constexpr Flags | operator& (Enum rhs) const
constexpr Flags | operator| (Flags rhs) const
constexpr Flags | operator| (Enum rhs) const
constexpr Flags | operator^ (Flags rhs) const
constexpr Flags | operator^ (Enum rhs) const
constexpr Flags | operator~ () const
constexpr bool | operator== (Enum rhs) const
constexpr bool | operator!= (Enum rhs) const
Flags & | setFlag (Flags flag_r, bool newval_r)
Flags & | setFlag (Enum flag_r, bool newval_r)
Flags & | setFlag (Flags flag_r)
Flags & | setFlag (Enum flag_r)
Flags & | unsetFlag (Flags flag_r)
Flags & | unsetFlag (Enum flag_r)
constexpr bool | testFlag (Flags flag_r) const
constexpr bool | testFlag (Enum flag_r) const

## Static Public Member Functions
static constexpr Flags | none ()
static constexpr Flags | all ()

## Private Member Functions
constexpr bool | testFlag (Integral flag) const

## Static Private Member Functions
static constexpr Integral | integral (Flags obj)
static constexpr Integral | integral (Enum obj)

## Private Attributes
Integral | _val

## Detailed Description

template<typename TEnum>
class zypp::base::Flags< TEnum >

A type-safe way of storing OR-combinations of enum values (like QTs QFlags).

See also
  QFlags Class Reference
  class RpmDb
  {
  public:
  enum DbStateInfoBits {
  DbSI_NO_INIT = 0x0000,
  DbSI_HAVE_V4 = 0x0001,
  DbSI_MADE_V4 = 0x0002,
  DbSI_MODIFIED_V4 = 0x0004,
  DbSI_HAVE_V3 = 0x0008,
  DbSI_HAVE_V3TOV4 = 0x0010,
  DbSI_MADE_V3TOV4 = 0x0020
  };
  ZYPP_DECLARE_FLAGS(DbStateInfo,DbStateInfoBits);
  };
  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(RpmDb::DbStateInfo);
  ...
  enum Other { OTHERVAL = 13 };
  {
  XRpmDb::DbStateInfo s;
  s = XRpmDb::DbSI_MODIFIED_V4|XRpmDb::DbSI_HAVE_V4;
  // s |= OTHERVAL; // As desired: it does not compile
  }
  zypp::ZYPP_DECLARE_FLAGS
  ZYPP_DECLARE_FLAGS(VendorSupportOptions, VendorSupportOption)
  zypp::ZYPP_DECLARE_OPERATORS_FOR_FLAGS
  ZYPP_DECLARE_OPERATORS_FOR_FLAGS(DiskUsageCounter::MountPoint::HintFlags)

Definition at line 58 of file Flags.h.

## Member Typedef Documentation

## ◆ Enum

template<typename TEnum>

using zypp::base::Flags< TEnum >::Enum = TEnum

The underlying enum type.

Definition at line 61 of file Flags.h.

## ◆ Integral

template<typename TEnum>

using zypp::base::Flags< TEnum >::Integral = std::underlying_type_t<Enum>

The underlying integral type.

Definition at line 62 of file Flags.h.

## Constructor & Destructor Documentation

## ◆ Flags() [1/3]

template<typename TEnum>

zypp::base::Flags< TEnum >::Flags | ( |  | ) |
| inlineconstexpr

Definition at line 65 of file Flags.h.

## ◆ Flags() [2/3]

template<typename TEnum>

zypp::base::Flags< TEnum >::Flags | ( | Enum | flag_r | ) |
| inlineconstexpr

Definition at line 66 of file Flags.h.

## ◆ Flags() [3/3]

template<typename TEnum>

zypp::base::Flags< TEnum >::Flags | ( | Integral | flag_r | ) |
| inlineexplicitconstexpr

Definition at line 67 of file Flags.h.

## Member Function Documentation

## ◆ none()

template<typename TEnum>

constexpr Flags zypp::base::Flags< TEnum >::none | ( |  | ) |
| inlinestaticconstexpr

Definition at line 69 of file Flags.h.

## ◆ all()

template<typename TEnum>

constexpr Flags zypp::base::Flags< TEnum >::all | ( |  | ) |
| inlinestaticconstexpr

Definition at line 70 of file Flags.h.

## ◆ isNone()

template<typename TEnum>

bool zypp::base::Flags< TEnum >::isNone | ( |  | ) | const
| inlineconstexpr

Definition at line 72 of file Flags.h.

## ◆ isAll()

template<typename TEnum>

bool zypp::base::Flags< TEnum >::isAll | ( |  | ) | const
| inlineconstexpr

Definition at line 73 of file Flags.h.

## ◆ operator&=() [1/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator&= | ( | Flags< TEnum > | rhs | ) |
| inline

Definition at line 75 of file Flags.h.

## ◆ operator&=() [2/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator&= | ( | Enum | rhs | ) |
| inline

Definition at line 76 of file Flags.h.

## ◆ operator|=() [1/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator|= | ( | Flags< TEnum > | rhs | ) |
| inline

Definition at line 78 of file Flags.h.

## ◆ operator|=() [2/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator|= | ( | Enum | rhs | ) |
| inline

Definition at line 79 of file Flags.h.

## ◆ operator^=() [1/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator^= | ( | Flags< TEnum > | rhs | ) |
| inline

Definition at line 81 of file Flags.h.

## ◆ operator^=() [2/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::operator^= | ( | Enum | rhs | ) |
| inline

Definition at line 82 of file Flags.h.

## ◆ operator Integral()

template<typename TEnum>

zypp::base::Flags< TEnum >::operator Integral | ( |  | ) | const
| inlineconstexpr

Definition at line 85 of file Flags.h.

## ◆ operator&() [1/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator& | ( | Flags< TEnum > | rhs | ) | const
| inlineconstexpr

Definition at line 87 of file Flags.h.

## ◆ operator&() [2/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator& | ( | Enum | rhs | ) | const
| inlineconstexpr

Definition at line 88 of file Flags.h.

## ◆ operator|() [1/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator| | ( | Flags< TEnum > | rhs | ) | const
| inlineconstexpr

Definition at line 90 of file Flags.h.

## ◆ operator|() [2/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator| | ( | Enum | rhs | ) | const
| inlineconstexpr

Definition at line 91 of file Flags.h.

## ◆ operator^() [1/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator^ | ( | Flags< TEnum > | rhs | ) | const
| inlineconstexpr

Definition at line 93 of file Flags.h.

## ◆ operator^() [2/2]

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator^ | ( | Enum | rhs | ) | const
| inlineconstexpr

Definition at line 94 of file Flags.h.

## ◆ operator~()

template<typename TEnum>

Flags zypp::base::Flags< TEnum >::operator~ | ( |  | ) | const
| inlineconstexpr

Definition at line 96 of file Flags.h.

## ◆ operator==()

template<typename TEnum>

bool zypp::base::Flags< TEnum >::operator== | ( | Enum | rhs | ) | const
| inlineconstexpr

Definition at line 98 of file Flags.h.

## ◆ operator!=()

template<typename TEnum>

bool zypp::base::Flags< TEnum >::operator!= | ( | Enum | rhs | ) | const
| inlineconstexpr

Definition at line 99 of file Flags.h.

## ◆ setFlag() [1/4]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::setFlag | ( | Flags< TEnum > | flag_r,
|  | bool | newval_r )
| inline

Definition at line 102 of file Flags.h.

## ◆ setFlag() [2/4]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::setFlag | ( | Enum | flag_r,
|  | bool | newval_r )
| inline

Definition at line 103 of file Flags.h.

## ◆ setFlag() [3/4]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::setFlag | ( | Flags< TEnum > | flag_r | ) |
| inline

Definition at line 105 of file Flags.h.

## ◆ setFlag() [4/4]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::setFlag | ( | Enum | flag_r | ) |
| inline

Definition at line 106 of file Flags.h.

## ◆ unsetFlag() [1/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::unsetFlag | ( | Flags< TEnum > | flag_r | ) |
| inline

Definition at line 108 of file Flags.h.

## ◆ unsetFlag() [2/2]

template<typename TEnum>

Flags & zypp::base::Flags< TEnum >::unsetFlag | ( | Enum | flag_r | ) |
| inline

Definition at line 109 of file Flags.h.

## ◆ testFlag() [1/3]

template<typename TEnum>

bool zypp::base::Flags< TEnum >::testFlag | ( | Flags< TEnum > | flag_r | ) | const
| inlineconstexpr

Definition at line 111 of file Flags.h.

## ◆ testFlag() [2/3]

template<typename TEnum>

bool zypp::base::Flags< TEnum >::testFlag | ( | Enum | flag_r | ) | const
| inlineconstexpr

Definition at line 112 of file Flags.h.

## ◆ testFlag() [3/3]

template<typename TEnum>

bool zypp::base::Flags< TEnum >::testFlag | ( | Integral | flag | ) | const
| inlineconstexprprivate

Definition at line 115 of file Flags.h.

## ◆ integral() [1/2]

template<typename TEnum>

constexpr Integral zypp::base::Flags< TEnum >::integral | ( | Flags< TEnum > | obj | ) |
| inlinestaticconstexprprivate

Definition at line 117 of file Flags.h.

## ◆ integral() [2/2]

template<typename TEnum>

constexpr Integral zypp::base::Flags< TEnum >::integral | ( | Enum | obj | ) |
| inlinestaticconstexprprivate

Definition at line 118 of file Flags.h.

## Member Data Documentation

## ◆ _val

template<typename TEnum>

Integral zypp::base::Flags< TEnum >::_val
| private

Definition at line 120 of file Flags.h.

The documentation for this class was generated from the following file:

- zypp-core/base/Flags.h