diff options
author | Daniil Rozanov <dev@rozanov.info> | 2025-03-15 18:03:23 +0400 |
---|---|---|
committer | Daniil Rozanov <dev@rozanov.info> | 2025-03-15 18:03:23 +0400 |
commit | 4a9ce6e2555dfaf9155fa279f25667350377f688 (patch) | |
tree | 11bc0ea3a7b1c0be2c47419b7058d46d16e5f9f4 /include/ncurses/utils/modifiers.hpp |
feat: chtype wrap
Diffstat (limited to 'include/ncurses/utils/modifiers.hpp')
-rw-r--r-- | include/ncurses/utils/modifiers.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/ncurses/utils/modifiers.hpp b/include/ncurses/utils/modifiers.hpp new file mode 100644 index 0000000..79e4139 --- /dev/null +++ b/include/ncurses/utils/modifiers.hpp @@ -0,0 +1,31 @@ +#ifndef INCLUDE_UTILS_MODIFIERS_HPP_ +#define INCLUDE_UTILS_MODIFIERS_HPP_ + +#include <type_traits> + +#include <ncurses/utils/flags.hpp> + +namespace NCURSES_CPP_NAMESPACE { + +template <typename Derived, typename ApplicantType> class composable { +public: + using flags_type = multiflags<ApplicantType>; + using flags_mask_type = multiflags<ApplicantType>; + + NCURSES_CPP_CONSTEXPR_14 composable & + operator&(const ApplicantType applicant) { + static_cast<Derived *>(this)->value_(); + } + + NCURSES_CPP_CONSTEXPR_14 composable &operator&(const flags_type &flags) { + value_ &= static_cast<flags_mask_type>(flags); + return *this; + } + +private: + value_type value_; +}; + +} // namespace NCURSES_CPP_NAMESPACE + +#endif // INCLUDE_UTILS_MODIFIERS_HPP_ |