mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 16:45:07 +03:00
libcamera: file: Turn MapFlag and OpenModeFlag into enum class
Add type safety by turning the MapFlag and OpenModeFlag enum into enum class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
91d06ae2fc
commit
6a8582dc20
6 changed files with 46 additions and 43 deletions
|
@ -23,14 +23,14 @@ namespace libcamera {
|
|||
class File
|
||||
{
|
||||
public:
|
||||
enum MapFlag {
|
||||
MapNoOption = 0,
|
||||
MapPrivate = (1 << 0),
|
||||
enum class MapFlag {
|
||||
NoOption = 0,
|
||||
Private = (1 << 0),
|
||||
};
|
||||
|
||||
using MapFlags = Flags<MapFlag>;
|
||||
|
||||
enum OpenModeFlag {
|
||||
enum class OpenModeFlag {
|
||||
NotOpen = 0,
|
||||
ReadOnly = (1 << 0),
|
||||
WriteOnly = (1 << 1),
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
ssize_t write(const Span<const uint8_t> &data);
|
||||
|
||||
Span<uint8_t> map(off_t offset = 0, ssize_t size = -1,
|
||||
MapFlags flags = MapNoOption);
|
||||
MapFlags flags = MapFlag::NoOption);
|
||||
bool unmap(uint8_t *addr);
|
||||
|
||||
static bool exists(const std::string &name);
|
||||
|
@ -80,6 +80,9 @@ private:
|
|||
std::map<void *, size_t> maps_;
|
||||
};
|
||||
|
||||
LIBCAMERA_FLAGS_ENABLE_OPERATORS(File::MapFlag)
|
||||
LIBCAMERA_FLAGS_ENABLE_OPERATORS(File::OpenModeFlag)
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
#endif /* __LIBCAMERA_BASE_FILE_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue