Home GnuPG

Add template class for type-safe enum-based flags

Description

Add template class for type-safe enum-based flags

* src/CMakeLists.txt (Gpgmepp_HEADERS): Add new file.
* src/flags.h: New.
* tests/CMakeLists.txt: Add new test.
* tests/t-flags.cpp: New.

This class provides a way to represent combinations of enum values in a
type-safe way without having to cast manually between the enum values
and the underlying type.

The implementation is based on the BitFlags class template published at
https://voithos.io/articles/type-safe-enum-class-bit-flags/
under the MIT license.

Details

Provenance
ikloeckerAuthored on Mon, Nov 24, 5:18 PM
Parents
rGPGMEPP550a0666b25a: Allow passing flags to Context::deleteKey
Branches
Unknown
Tags
Unknown