From d008a9b64331c466703c0687e7e353789903c1ff Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 27 Dec 2016 17:15:42 +0100 Subject: superblock: Define predefined enums --- src/fs/detail/superblock.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/fs/detail/superblock.cpp (limited to 'src/fs/detail/superblock.cpp') diff --git a/src/fs/detail/superblock.cpp b/src/fs/detail/superblock.cpp new file mode 100644 index 0000000..f238098 --- /dev/null +++ b/src/fs/detail/superblock.cpp @@ -0,0 +1,65 @@ +#include "fs/detail/superblock.hpp" + +#include + +namespace fs::detail + { + + bool superblock::has(superblock::compatible_feature const feature) const + { + return compatible_features_bitmap & static_cast(feature); + } + + bool superblock::has_all(std::initializer_list const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return compatible_features_bitmap & static_cast(feature); + }); + } + + bool superblock::has_any(std::initializer_list const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return compatible_features_bitmap & static_cast(feature); + }); + } + + bool superblock::has(superblock::incompatible_feature const feature) const + { + return incompatible_features_bitmap & static_cast(feature); + } + + bool superblock::has_all(std::initializer_list const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return incompatible_features_bitmap & static_cast(feature); + }); + } + + bool superblock::has_any(std::initializer_list const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return incompatible_features_bitmap & static_cast(feature); + }); + } + + bool superblock::has(superblock::read_only_compatible_feature const feature) const + { + return read_only_compatible_features_bitmap & static_cast(feature); + } + + bool superblock::has_all(std::initializer_list const features) const + { + return std::all_of(features.begin(), features.end(), [&](auto const feature){ + return read_only_compatible_features_bitmap & static_cast(feature); + }); + } + + bool superblock::has_any(std::initializer_list const features) const + { + return std::any_of(features.begin(), features.end(), [&](auto const feature){ + return read_only_compatible_features_bitmap & static_cast(feature); + }); + } + + } -- cgit v1.2.3