[libcamera-devel] [PATCH v2 0/5] libcamera: Add type-safe enum-based flags
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sun Jul 25 19:18:22 CEST 2021
Hello,
This small series contains patches that I've carried in my tree for some
time, and that I think could be useful. Please see patches for details.
The API is influenced by https://doc.qt.io/qt-5/qflags.html but goes a
step further by disallowing some invalid usage of the operators that Qt
silently allows for internal implementation reasons.
Compared to v1, the code has been rebased on top of the latest libcamera
master branch, and moved to the base library. Patches 3/5 to 5/5 have
been added to showcase usage of Flags in a real world use case. Please
make sure to use a Doxygen version that contains commit 309b397be106
("issue #8281: Out-of-line documentation of scoped enums in the same
namespace"), which at this point of time means the Doxygen master
branch, or you will get documentation warnings.
The Flags class will be used by the camera configuration API.
Laurent Pinchart (5):
libcamera: flags: Add type-safe enum-based flags
test: Add tests for the Flags class
libcamera: file: Use Flags<> class for map flags
libcamera: file: Use Flags<> class for open flags
libcamera: file: Turn MapFlag and OpenModeFlag into enum class
include/libcamera/base/file.h | 18 ++-
include/libcamera/base/flags.h | 195 +++++++++++++++++++++++++++
include/libcamera/base/meson.build | 1 +
src/ipa/vimc/vimc.cpp | 2 +-
src/libcamera/base/file.cpp | 48 ++++---
src/libcamera/base/flags.cpp | 192 +++++++++++++++++++++++++++
src/libcamera/base/meson.build | 1 +
src/libcamera/ipa_manager.cpp | 2 +-
src/libcamera/ipa_module.cpp | 6 +-
test/file.cpp | 32 ++---
test/flags.cpp | 204 +++++++++++++++++++++++++++++
test/meson.build | 1 +
12 files changed, 657 insertions(+), 45 deletions(-)
create mode 100644 include/libcamera/base/flags.h
create mode 100644 src/libcamera/base/flags.cpp
create mode 100644 test/flags.cpp
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list