summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT/Attribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibVT/Attribute.h')
-rw-r--r--Userland/Libraries/LibVT/Attribute.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibVT/Attribute.h b/Userland/Libraries/LibVT/Attribute.h
index 5bc71531fe..684a403b3a 100644
--- a/Userland/Libraries/LibVT/Attribute.h
+++ b/Userland/Libraries/LibVT/Attribute.h
@@ -6,6 +6,7 @@
#pragma once
+#include <AK/EnumBits.h>
#include <AK/Noncopyable.h>
#include <AK/Vector.h>
#include <LibVT/Color.h>
@@ -35,15 +36,12 @@ struct Attribute {
Color foreground_color { default_foreground_color };
Color background_color { default_background_color };
- constexpr Color effective_background_color() const { return flags & Negative ? foreground_color : background_color; }
- constexpr Color effective_foreground_color() const { return flags & Negative ? background_color : foreground_color; }
-
#ifndef KERNEL
String href;
String href_id;
#endif
- enum Flags : u8 {
+ enum class Flags : u8 {
NoAttributes = 0x00,
Bold = 0x01,
Italic = 0x02,
@@ -52,12 +50,14 @@ struct Attribute {
Blink = 0x10,
Touched = 0x20,
};
+ AK_ENUM_BITWISE_FRIEND_OPERATORS(Flags);
+
+ constexpr Color effective_background_color() const { return has_flag(flags, Flags::Negative) ? foreground_color : background_color; }
+ constexpr Color effective_foreground_color() const { return has_flag(flags, Flags::Negative) ? background_color : foreground_color; }
- constexpr bool is_untouched() const { return !(flags & Touched); }
+ constexpr bool is_untouched() const { return has_flag(flags, Flags::Touched); }
- // TODO: it would be really nice if we had a helper for enums that
- // exposed bit ops for class enums...
- u8 flags { Flags::NoAttributes };
+ Flags flags { Flags::NoAttributes };
constexpr bool operator==(const Attribute& other) const
{