diff --git a/.clang-format b/.clang-format index d2314f72ac2..8a109530e56 100644 --- a/.clang-format +++ b/.clang-format @@ -10,4 +10,3 @@ IndentPPDirectives: AfterHash BreakBeforeBraces: Custom BraceWrapping: AfterFunction: true - AfterEnum: true diff --git a/AK/AKString.h b/AK/AKString.h index a229f746e70..612dae31cc1 100644 --- a/AK/AKString.h +++ b/AK/AKString.h @@ -84,8 +84,7 @@ public: { } - enum class CaseSensitivity - { + enum class CaseSensitivity { CaseInsensitive, CaseSensitive, }; diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index d74798983c4..c472e940224 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -60,8 +60,7 @@ public: void grow(int size); private: - enum ConstructionMode - { + enum ConstructionMode { Uninitialized, Copy, Wrap, diff --git a/AK/RetainPtr.h b/AK/RetainPtr.h index 70fe38dc915..0044202dee3 100644 --- a/AK/RetainPtr.h +++ b/AK/RetainPtr.h @@ -8,8 +8,7 @@ namespace AK { template class RetainPtr { public: - enum AdoptTag - { + enum AdoptTag { Adopt }; diff --git a/AK/Retained.h b/AK/Retained.h index 1ba84ae53be..e1aa22f8ecb 100644 --- a/AK/Retained.h +++ b/AK/Retained.h @@ -34,8 +34,7 @@ inline void release_if_not_null(T* ptr) template class CONSUMABLE(unconsumed) Retained { public: - enum AdoptTag - { + enum AdoptTag { Adopt }; diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index 6585b3d555c..2e132a5a1ee 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -271,16 +271,14 @@ struct RemovePointer { template struct IsSame { - enum - { + enum { value = 0 }; }; template struct IsSame { - enum - { + enum { value = 1 }; }; diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 56bf4832c59..babca34e104 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -6,8 +6,7 @@ namespace AK { -enum ShouldChomp -{ +enum ShouldChomp { NoChomp, Chomp }; @@ -40,8 +39,7 @@ public: } private: - enum ConstructTheEmptyStringImplTag - { + enum ConstructTheEmptyStringImplTag { ConstructTheEmptyStringImpl }; explicit StringImpl(ConstructTheEmptyStringImplTag) @@ -49,8 +47,7 @@ private: { } - enum ConstructWithInlineBufferTag - { + enum ConstructWithInlineBufferTag { ConstructWithInlineBuffer }; StringImpl(ConstructWithInlineBufferTag, ssize_t length); diff --git a/AK/Types.h b/AK/Types.h index f0684655ccd..12f65115e35 100644 --- a/AK/Types.h +++ b/AK/Types.h @@ -1,5 +1,7 @@ #pragma once +#include + #ifdef __serenity__ typedef unsigned char byte; typedef unsigned short word; @@ -48,12 +50,6 @@ constexpr unsigned KB = 1024; constexpr unsigned MB = KB * KB; constexpr unsigned GB = KB * KB * KB; -enum class IterationDecision -{ - Continue, - Abort -}; - namespace std { typedef decltype(nullptr) nullptr_t; } diff --git a/Applications/FileManager/DirectoryView.h b/Applications/FileManager/DirectoryView.h index fa8d7cba101..c7e2f08bc58 100644 --- a/Applications/FileManager/DirectoryView.h +++ b/Applications/FileManager/DirectoryView.h @@ -26,8 +26,7 @@ public: Function on_status_message; Function on_thumbnail_progress; - enum ViewMode - { + enum ViewMode { Invalid, List, Icon diff --git a/Applications/IRCClient/IRCChannelMemberListModel.h b/Applications/IRCClient/IRCChannelMemberListModel.h index ac380ec62d9..df0e762264b 100644 --- a/Applications/IRCClient/IRCChannelMemberListModel.h +++ b/Applications/IRCClient/IRCChannelMemberListModel.h @@ -7,8 +7,7 @@ class IRCChannel; class IRCChannelMemberListModel final : public GModel { public: - enum Column - { + enum Column { Name }; static Retained create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); } diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp index 051d82540df..9a897806224 100644 --- a/Applications/IRCClient/IRCClient.cpp +++ b/Applications/IRCClient/IRCClient.cpp @@ -14,8 +14,7 @@ #define IRC_DEBUG -enum IRCNumeric -{ +enum IRCNumeric { RPL_WHOISUSER = 311, RPL_WHOISSERVER = 312, RPL_WHOISOPERATOR = 313, @@ -106,8 +105,7 @@ void IRCClient::process_line(ByteBuffer&& line) Vector prefix; Vector command; Vector current_parameter; - enum - { + enum { Start, InPrefix, InCommand, diff --git a/Applications/IRCClient/IRCLogBufferModel.h b/Applications/IRCClient/IRCLogBufferModel.h index d5479da8870..5be8237d075 100644 --- a/Applications/IRCClient/IRCLogBufferModel.h +++ b/Applications/IRCClient/IRCLogBufferModel.h @@ -6,8 +6,7 @@ class IRCLogBuffer; class IRCLogBufferModel final : public GModel { public: - enum Column - { + enum Column { Timestamp = 0, Name, Text, diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h index f8fe692542b..2fce542fe53 100644 --- a/Applications/IRCClient/IRCWindow.h +++ b/Applications/IRCClient/IRCWindow.h @@ -11,8 +11,7 @@ class GTextEditor; class IRCWindow : public GWidget { public: - enum Type - { + enum Type { Server, Channel, Query, diff --git a/Applications/IRCClient/IRCWindowListModel.h b/Applications/IRCClient/IRCWindowListModel.h index 93fa6b6abda..47e4621c963 100644 --- a/Applications/IRCClient/IRCWindowListModel.h +++ b/Applications/IRCClient/IRCWindowListModel.h @@ -8,8 +8,7 @@ class IRCWindow; class IRCWindowListModel final : public GModel { public: - enum Column - { + enum Column { Name, }; diff --git a/Applications/ProcessManager/ProcessModel.h b/Applications/ProcessManager/ProcessModel.h index 06d896870f7..cebe524d263 100644 --- a/Applications/ProcessManager/ProcessModel.h +++ b/Applications/ProcessManager/ProcessModel.h @@ -11,8 +11,7 @@ class GraphWidget; class ProcessModel final : public GModel { public: - enum Column - { + enum Column { Icon = 0, Name, CPU, diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/Terminal.h index ecadcf76822..43229860088 100644 --- a/Applications/Terminal/Terminal.h +++ b/Applications/Terminal/Terminal.h @@ -98,8 +98,7 @@ private: byte foreground_color; byte background_color; - enum Flags - { + enum Flags { NoAttributes = 0x00, Bold = 0x01, Italic = 0x02, @@ -160,8 +159,7 @@ private: void execute_escape_sequence(byte final); void execute_xterm_command(); - enum EscapeState - { + enum EscapeState { Normal, ExpectBracket, ExpectParameter, diff --git a/DevTools/VisualBuilder/VBWidget.h b/DevTools/VisualBuilder/VBWidget.h index 73951570989..8717e519d3a 100644 --- a/DevTools/VisualBuilder/VBWidget.h +++ b/DevTools/VisualBuilder/VBWidget.h @@ -15,8 +15,7 @@ class VBForm; class VBProperty; class VBWidgetPropertyModel; -enum class Direction -{ +enum class Direction { None, Left, UpLeft, diff --git a/DevTools/VisualBuilder/VBWidgetPropertyModel.h b/DevTools/VisualBuilder/VBWidgetPropertyModel.h index 2aa45424244..b84bffc697a 100644 --- a/DevTools/VisualBuilder/VBWidgetPropertyModel.h +++ b/DevTools/VisualBuilder/VBWidgetPropertyModel.h @@ -7,8 +7,7 @@ class VBProperty; class VBWidgetPropertyModel : public GModel { public: - enum Column - { + enum Column { Name = 0, Value, __Count diff --git a/DevTools/VisualBuilder/VBWidgetType.h b/DevTools/VisualBuilder/VBWidgetType.h index 2f6c8a6b7c5..3c441051fb5 100644 --- a/DevTools/VisualBuilder/VBWidgetType.h +++ b/DevTools/VisualBuilder/VBWidgetType.h @@ -1,7 +1,6 @@ #pragma once -enum class VBWidgetType -{ +enum class VBWidgetType { None = 0, GWidget, GButton, diff --git a/Games/Minesweeper/Field.h b/Games/Minesweeper/Field.h index 5af284a4661..1725ceefda6 100644 --- a/Games/Minesweeper/Field.h +++ b/Games/Minesweeper/Field.h @@ -71,8 +71,7 @@ private: template void for_each_square(Callback); - enum class Face - { + enum class Face { Default, Good, Bad diff --git a/Kernel/File.h b/Kernel/File.h index b4ac7144b07..03fb9d4aefb 100644 --- a/Kernel/File.h +++ b/Kernel/File.h @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include class FileDescription; class Process; diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h index 8cbb60513aa..baad9bd8a15 100644 --- a/Kernel/FileSystem/FIFO.h +++ b/Kernel/FileSystem/FIFO.h @@ -8,8 +8,7 @@ class FileDescription; class FIFO final : public File { public: - enum class Direction : byte - { + enum class Direction : byte { Neither, Reader, Writer diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h index e107d8255ab..4c8e0175e7a 100644 --- a/Kernel/FileSystem/FileDescription.h +++ b/Kernel/FileSystem/FileDescription.h @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include class File; class TTY; diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 94e4218604d..c7fdff4916e 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -14,8 +14,7 @@ #include #include -enum ProcParentDirectory -{ +enum ProcParentDirectory { PDI_AbstractRoot = 0, PDI_Root, PDI_Root_sys, @@ -23,8 +22,7 @@ enum ProcParentDirectory PDI_PID_fd, }; -enum ProcFileType -{ +enum ProcFileType { FI_Invalid = 0, FI_Root = 1, // directory @@ -601,8 +599,7 @@ ByteBuffer procfs$inodes(InodeIdentifier) struct SysVariableData final : public ProcFSInodeCustomData { virtual ~SysVariableData() override {} - enum Type - { + enum Type { Invalid, Boolean, String, diff --git a/Kernel/KResult.h b/Kernel/KResult.h index 291e9ea2eac..4108b889476 100644 --- a/Kernel/KResult.h +++ b/Kernel/KResult.h @@ -3,8 +3,7 @@ #include #include -enum KSuccessTag -{ +enum KSuccessTag { KSuccess }; diff --git a/Kernel/KeyCode.h b/Kernel/KeyCode.h index 67c065625fd..310c950ca92 100644 --- a/Kernel/KeyCode.h +++ b/Kernel/KeyCode.h @@ -2,8 +2,7 @@ #include -enum KeyCode : byte -{ +enum KeyCode : byte { Key_Invalid = 0, Key_Escape, Key_Tab, @@ -114,8 +113,7 @@ enum KeyCode : byte Key_Shift = Key_LeftShift, }; -enum KeyModifier -{ +enum KeyModifier { Mod_None = 0x00, Mod_Alt = 0x01, Mod_Ctrl = 0x02, diff --git a/Kernel/Net/ARP.h b/Kernel/Net/ARP.h index 2fecc2b0a0d..5c544e3fc65 100644 --- a/Kernel/Net/ARP.h +++ b/Kernel/Net/ARP.h @@ -5,16 +5,14 @@ #include struct ARPOperation { - enum : word - { + enum : word { Request = 1, Response = 2, }; }; struct ARPHardwareType { - enum : word - { + enum : word { Ethernet = 1, }; }; diff --git a/Kernel/Net/EtherType.h b/Kernel/Net/EtherType.h index 42edc16427f..ae845d5bf59 100644 --- a/Kernel/Net/EtherType.h +++ b/Kernel/Net/EtherType.h @@ -3,8 +3,7 @@ #include struct EtherType { - enum : word - { + enum : word { ARP = 0x0806, IPv4 = 0x0800, }; diff --git a/Kernel/Net/ICMP.h b/Kernel/Net/ICMP.h index 2433626a64d..40bb691181d 100644 --- a/Kernel/Net/ICMP.h +++ b/Kernel/Net/ICMP.h @@ -4,8 +4,7 @@ #include struct ICMPType { - enum - { + enum { EchoReply = 0, EchoRequest = 8, }; diff --git a/Kernel/Net/IPv4.h b/Kernel/Net/IPv4.h index 0c858d94d02..3463bf3ceee 100644 --- a/Kernel/Net/IPv4.h +++ b/Kernel/Net/IPv4.h @@ -5,8 +5,7 @@ #include #include -enum class IPv4Protocol : word -{ +enum class IPv4Protocol : word { ICMP = 1, TCP = 6, UDP = 17, diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h index 336dc8623b2..ff129f8e540 100644 --- a/Kernel/Net/Socket.h +++ b/Kernel/Net/Socket.h @@ -9,16 +9,14 @@ #include #include -enum class SocketRole : byte -{ +enum class SocketRole : byte { None, Listener, Accepted, Connected, Connecting }; -enum class ShouldBlock -{ +enum class ShouldBlock { No = 0, Yes = 1 }; diff --git a/Kernel/Net/TCP.h b/Kernel/Net/TCP.h index 8138ed3d525..611c4511058 100644 --- a/Kernel/Net/TCP.h +++ b/Kernel/Net/TCP.h @@ -3,8 +3,7 @@ #include struct TCPFlags { - enum : word - { + enum : word { FIN = 0x01, SYN = 0x02, RST = 0x04, diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index 7ced06f56f5..a54d04417df 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -7,8 +7,7 @@ public: static Retained create(int protocol); virtual ~TCPSocket() override; - enum class State - { + enum class State { Disconnected, Connecting, Connected, diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 3b9eb50d974..71d3949a43d 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1441,8 +1441,7 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options) return current->m_waitee_pid; } -enum class KernelMemoryCheckResult -{ +enum class KernelMemoryCheckResult { NotInsideKernelMemory, AccessGranted, AccessDenied @@ -2654,7 +2653,7 @@ int Process::sys$donate(int tid) for_each_thread([&](Thread& thread) { if (thread.tid() == tid) { beneficiary = &thread; - return IterationDecision::Abort; + return IterationDecision::Break; } return IterationDecision::Continue; }); diff --git a/Kernel/Process.h b/Kernel/Process.h index 495ac50a044..7dbf2e5f5ff 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -38,8 +38,7 @@ public: static Vector all_pids(); static Vector all_processes(); - enum Priority - { + enum Priority { IdlePriority, FirstPriority = IdlePriority, LowPriority, @@ -48,8 +47,7 @@ public: LastPriority = HighPriority, }; - enum RingLevel - { + enum RingLevel { Ring0 = 0, Ring3 = 3, }; @@ -398,7 +396,7 @@ inline void Process::for_each(Callback callback) ASSERT_INTERRUPTS_DISABLED(); for (auto* process = g_processes->head(); process;) { auto* next_process = process->next(); - if (callback(*process) == IterationDecision::Abort) + if (callback(*process) == IterationDecision::Break) break; process = next_process; } @@ -427,7 +425,7 @@ inline void Process::for_each_thread(Callback callback) const for (auto* thread = g_runnable_threads->head(); thread;) { auto* next_thread = thread->next(); if (thread->pid() == my_pid) { - if (callback(*thread) == IterationDecision::Abort) + if (callback(*thread) == IterationDecision::Break) break; } thread = next_thread; @@ -435,7 +433,7 @@ inline void Process::for_each_thread(Callback callback) const for (auto* thread = g_nonrunnable_threads->head(); thread;) { auto* next_thread = thread->next(); if (thread->pid() == my_pid) { - if (callback(*thread) == IterationDecision::Abort) + if (callback(*thread) == IterationDecision::Break) break; } thread = next_thread; diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index cdfd5184e01..fd2f7fceef4 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -3,7 +3,9 @@ #include #include -extern "C" { struct timeval; } +extern "C" { +struct timeval; +} #define ENUMERATE_SYSCALLS \ __ENUMERATE_SYSCALL(sleep) \ @@ -114,8 +116,7 @@ extern "C" { struct timeval; } namespace Syscall { -enum Function -{ +enum Function { #undef __ENUMERATE_SYSCALL #define __ENUMERATE_SYSCALL(x) SC_##x, ENUMERATE_SYSCALLS diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 8a8a28ac041..a79cfeda4b8 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -128,8 +128,7 @@ inline bool is_valid_final_character(byte ch) return ch >= 0x40 && ch <= 0x7e; } -enum class VGAColor : byte -{ +enum class VGAColor : byte { Black = 0, Blue, Green, @@ -148,8 +147,7 @@ enum class VGAColor : byte White, }; -enum class ANSIColor : byte -{ +enum class ANSIColor : byte { Black = 0, Red, Green, diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h index 8e89fac8535..7d9bb850da2 100644 --- a/Kernel/TTY/VirtualConsole.h +++ b/Kernel/TTY/VirtualConsole.h @@ -9,8 +9,7 @@ class VirtualConsole final : public TTY , public ConsoleImplementation { AK_MAKE_ETERNAL public: - enum InitialContents - { + enum InitialContents { Cleared, AdoptCurrentVGABuffer }; @@ -73,8 +72,7 @@ private: void execute_escape_sequence(byte final); - enum EscapeState - { + enum EscapeState { Normal, ExpectBracket, ExpectParameter, diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 9c9a261a1c5..7903f2d9bb0 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -254,8 +254,7 @@ ShouldUnblockThread Thread::dispatch_one_pending_signal() return dispatch_signal(signal); } -enum class DefaultSignalAction -{ +enum class DefaultSignalAction { Terminate, Ignore, DumpCore, diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 3ab123722b1..d8281a90392 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include #include class Alarm; @@ -17,8 +17,7 @@ class Process; class Region; class Thread; -enum class ShouldUnblockThread -{ +enum class ShouldUnblockThread { No = 0, Yes }; @@ -54,8 +53,7 @@ public: void finalize(); - enum State : byte - { + enum State : byte { Invalid = 0, Runnable, Running, @@ -245,7 +243,7 @@ inline void Thread::for_each_runnable(Callback callback) ASSERT_INTERRUPTS_DISABLED(); for (auto* thread = g_runnable_threads->head(); thread;) { auto* next_thread = thread->next(); - if (callback(*thread) == IterationDecision::Abort) + if (callback(*thread) == IterationDecision::Break) return; thread = next_thread; } @@ -257,7 +255,7 @@ inline void Thread::for_each_nonrunnable(Callback callback) ASSERT_INTERRUPTS_DISABLED(); for (auto* thread = g_nonrunnable_threads->head(); thread;) { auto* next_thread = thread->next(); - if (callback(*thread) == IterationDecision::Abort) + if (callback(*thread) == IterationDecision::Break) return; thread = next_thread; } diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index de9fff2b47b..7b101ba29fa 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -12,17 +12,16 @@ #include #include #include -#include #include #include #include +#include #define PAGE_ROUND_UP(x) ((((dword)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1))) class SynthFSInode; -enum class PageFaultResponse -{ +enum class PageFaultResponse { ShouldCrash, Continue, }; @@ -55,8 +54,7 @@ public: bool validate_user_read(const Process&, VirtualAddress) const; bool validate_user_write(const Process&, VirtualAddress) const; - enum class ShouldZeroFill - { + enum class ShouldZeroFill { No, Yes }; @@ -126,8 +124,7 @@ private: dword raw() const { return *m_pde; } dword* ptr() { return m_pde; } - enum Flags - { + enum Flags { Present = 1 << 0, ReadWrite = 1 << 1, UserSupervisor = 1 << 2, @@ -177,8 +174,7 @@ private: dword raw() const { return *m_pte; } dword* ptr() { return m_pte; } - enum Flags - { + enum Flags { Present = 1 << 0, ReadWrite = 1 << 1, UserSupervisor = 1 << 2, diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 9d6455ce776..8480ce03cdc 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -12,8 +12,7 @@ class Region : public Retainable { friend class MemoryManager; public: - enum Access - { + enum Access { Read = 1, Write = 2, Execute = 4, diff --git a/Kernel/i386.h b/Kernel/i386.h index 476d9c83ece..bb0f7a037b2 100644 --- a/Kernel/i386.h +++ b/Kernel/i386.h @@ -49,8 +49,7 @@ union [[gnu::packed]] Descriptor dword high; }; - enum Type - { + enum Type { Invalid = 0, AvailableTSS_16bit = 0x1, LDT = 0x2, @@ -180,8 +179,7 @@ private: #define IRQ_VECTOR_BASE 0x50 struct PageFaultFlags { - enum Flags - { + enum Flags { NotPresent = 0x00, ProtectionViolation = 0x01, Read = 0x00, diff --git a/LibC/locale.h b/LibC/locale.h index 0f5c52e6683..26b5367434d 100644 --- a/LibC/locale.h +++ b/LibC/locale.h @@ -4,8 +4,7 @@ __BEGIN_DECLS -enum -{ +enum { LC_ALL, LC_NUMERIC, LC_CTYPE, diff --git a/LibC/sys/ioctl_numbers.h b/LibC/sys/ioctl_numbers.h index f8ac61aedaa..dd6711c43c8 100644 --- a/LibC/sys/ioctl_numbers.h +++ b/LibC/sys/ioctl_numbers.h @@ -1,7 +1,6 @@ #pragma once -enum IOCtlNumber -{ +enum IOCtlNumber { TIOCGPGRP, TIOCSPGRP, TCGETS, diff --git a/LibC/unistd.h b/LibC/unistd.h index 4dd3a7f1b19..cfe5c26b26d 100644 --- a/LibC/unistd.h +++ b/LibC/unistd.h @@ -91,8 +91,7 @@ int chown(const char* pathname, uid_t, gid_t); int fchown(int fd, uid_t, gid_t); int ftruncate(int fd, off_t length); -enum -{ +enum { _PC_NAME_MAX, }; diff --git a/LibCore/CDirIterator.h b/LibCore/CDirIterator.h index 1d3395ef135..08c9040b487 100644 --- a/LibCore/CDirIterator.h +++ b/LibCore/CDirIterator.h @@ -5,8 +5,7 @@ class CDirIterator { public: - enum Flags - { + enum Flags { NoFlags = 0x0, SkipDots = 0x1, }; diff --git a/LibCore/CEvent.h b/LibCore/CEvent.h index 1920df26881..9d262c4a763 100644 --- a/LibCore/CEvent.h +++ b/LibCore/CEvent.h @@ -9,8 +9,7 @@ class CObject; class CEvent { public: - enum Type - { + enum Type { Invalid = 0, Quit, Timer, diff --git a/LibCore/CEventLoop.h b/LibCore/CEventLoop.h index dbcc67ddb72..8cab0bbe997 100644 --- a/LibCore/CEventLoop.h +++ b/LibCore/CEventLoop.h @@ -21,8 +21,7 @@ public: int exec(); - enum class WaitMode - { + enum class WaitMode { WaitForEvents, PollForEvents, }; diff --git a/LibCore/CFile.h b/LibCore/CFile.h index 669f0df4eb4..976d5718d9e 100644 --- a/LibCore/CFile.h +++ b/LibCore/CFile.h @@ -14,8 +14,7 @@ public: virtual bool open(CIODevice::OpenMode) override; - enum class ShouldCloseFileDescription - { + enum class ShouldCloseFileDescription { No = 0, Yes }; diff --git a/LibCore/CHttpJob.h b/LibCore/CHttpJob.h index c8d2c8c361b..5b714a7f779 100644 --- a/LibCore/CHttpJob.h +++ b/LibCore/CHttpJob.h @@ -18,8 +18,7 @@ public: private: void on_socket_connected(); - enum class State - { + enum class State { InStatus, InHeaders, InBody, diff --git a/LibCore/CHttpRequest.h b/LibCore/CHttpRequest.h index 8ab6fef4130..c5a39c9ffd7 100644 --- a/LibCore/CHttpRequest.h +++ b/LibCore/CHttpRequest.h @@ -6,8 +6,7 @@ class CNetworkJob; class CHttpRequest { public: - enum Method - { + enum Method { Invalid, HEAD, GET, diff --git a/LibCore/CIODevice.h b/LibCore/CIODevice.h index 193b44c3bd7..36cbd0e0fd0 100644 --- a/LibCore/CIODevice.h +++ b/LibCore/CIODevice.h @@ -6,8 +6,7 @@ class CIODevice : public CObject { public: - enum OpenMode - { + enum OpenMode { NotOpen = 0, ReadOnly = 1, WriteOnly = 2, @@ -40,8 +39,7 @@ public: bool can_read() const; - enum class SeekMode - { + enum class SeekMode { SetPosition, FromCurrentPosition, FromEndPosition, diff --git a/LibCore/CNetworkJob.h b/LibCore/CNetworkJob.h index 3d8117c754a..eaae27c4640 100644 --- a/LibCore/CNetworkJob.h +++ b/LibCore/CNetworkJob.h @@ -7,8 +7,7 @@ class CNetworkResponse; class CNetworkJob : public CObject { public: - enum class Error - { + enum class Error { None, ConnectionFailed, TransmissionFailed, diff --git a/LibCore/CNotifier.h b/LibCore/CNotifier.h index 736d78e04b3..196cad8388a 100644 --- a/LibCore/CNotifier.h +++ b/LibCore/CNotifier.h @@ -4,8 +4,7 @@ class CNotifier { public: - enum Event - { + enum Event { None = 0, Read = 1, Write = 2, diff --git a/LibCore/CObject.h b/LibCore/CObject.h index 3e73d44fdad..392a94e1897 100644 --- a/LibCore/CObject.h +++ b/LibCore/CObject.h @@ -25,7 +25,7 @@ public: void for_each_child(Callback callback) { for (auto* child : m_children) { - if (callback(*child) == IterationDecision::Abort) + if (callback(*child) == IterationDecision::Break) return; } } diff --git a/LibCore/CSocket.h b/LibCore/CSocket.h index 0de7872fb29..587f80f2905 100644 --- a/LibCore/CSocket.h +++ b/LibCore/CSocket.h @@ -7,8 +7,7 @@ class CNotifier; class CSocket : public CIODevice { public: - enum class Type - { + enum class Type { Invalid, TCP, UDP diff --git a/LibCore/CSocketAddress.h b/LibCore/CSocketAddress.h index efa545f24c6..33ad5c02537 100644 --- a/LibCore/CSocketAddress.h +++ b/LibCore/CSocketAddress.h @@ -4,8 +4,7 @@ class CSocketAddress { public: - enum class Type - { + enum class Type { Invalid, IPv4, Local diff --git a/LibGUI/GAction.h b/LibGUI/GAction.h index e4174e0c959..02bca55e9a3 100644 --- a/LibGUI/GAction.h +++ b/LibGUI/GAction.h @@ -18,8 +18,7 @@ class GWidget; class GAction : public Retainable , public Weakable { public: - enum class ShortcutScope - { + enum class ShortcutScope { None, ApplicationGlobal, WidgetLocal, diff --git a/LibGUI/GDialog.h b/LibGUI/GDialog.h index 7244db5aa09..7e57ef8fbd7 100644 --- a/LibGUI/GDialog.h +++ b/LibGUI/GDialog.h @@ -5,8 +5,7 @@ class GDialog : public GWindow { public: - enum ExecResult - { + enum ExecResult { ExecOK = 0, ExecCancel = 1, ExecAborted = 2 diff --git a/LibGUI/GDirectoryModel.h b/LibGUI/GDirectoryModel.h index 2562b7cc322..41ad4c4a18c 100644 --- a/LibGUI/GDirectoryModel.h +++ b/LibGUI/GDirectoryModel.h @@ -11,8 +11,7 @@ public: static Retained create() { return adopt(*new GDirectoryModel); } virtual ~GDirectoryModel() override; - enum Column - { + enum Column { Icon = 0, Name, Size, diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h index 70da4b4b519..f55f68b5a6f 100644 --- a/LibGUI/GEvent.h +++ b/LibGUI/GEvent.h @@ -10,8 +10,7 @@ class CObject; class GEvent : public CEvent { public: - enum Type - { + enum Type { Show = 1000, Hide, Paint, @@ -218,8 +217,7 @@ public: } }; -enum GMouseButton : byte -{ +enum GMouseButton : byte { None = 0, Left = 1, Right = 2, diff --git a/LibGUI/GFileSystemModel.cpp b/LibGUI/GFileSystemModel.cpp index d39a6ef67c0..3f06e00b95a 100644 --- a/LibGUI/GFileSystemModel.cpp +++ b/LibGUI/GFileSystemModel.cpp @@ -11,8 +11,7 @@ struct GFileSystemModel::Node { String name; Node* parent { nullptr }; Vector children; - enum Type - { + enum Type { Unknown, Directory, File diff --git a/LibGUI/GFileSystemModel.h b/LibGUI/GFileSystemModel.h index 842f9138686..5e7c7545e75 100644 --- a/LibGUI/GFileSystemModel.h +++ b/LibGUI/GFileSystemModel.h @@ -6,8 +6,7 @@ class GFileSystemModel : public GModel { friend class Node; public: - enum Mode - { + enum Mode { Invalid, DirectoriesOnly, FilesAndDirectories diff --git a/LibGUI/GLayout.h b/LibGUI/GLayout.h index 498f0efc6af..39418a712f8 100644 --- a/LibGUI/GLayout.h +++ b/LibGUI/GLayout.h @@ -32,8 +32,7 @@ public: protected: struct Entry { - enum class Type - { + enum class Type { Invalid = 0, Widget, Layout, diff --git a/LibGUI/GMenuItem.h b/LibGUI/GMenuItem.h index 6cb1df8e538..61ec3551791 100644 --- a/LibGUI/GMenuItem.h +++ b/LibGUI/GMenuItem.h @@ -8,8 +8,7 @@ class GMenu; class GMenuItem { public: - enum Type - { + enum Type { Invalid, Action, Separator diff --git a/LibGUI/GMessageBox.h b/LibGUI/GMessageBox.h index 782e12eee3d..e05e0d2e062 100644 --- a/LibGUI/GMessageBox.h +++ b/LibGUI/GMessageBox.h @@ -4,8 +4,7 @@ class GMessageBox : public GDialog { public: - enum class Type - { + enum class Type { None, Information, Warning, diff --git a/LibGUI/GModel.h b/LibGUI/GModel.h index 0aba8900cd6..7efa61375eb 100644 --- a/LibGUI/GModel.h +++ b/LibGUI/GModel.h @@ -12,8 +12,7 @@ class Font; class GAbstractView; -enum class GSortOrder -{ +enum class GSortOrder { None, Ascending, Descending @@ -21,8 +20,7 @@ enum class GSortOrder class GModelNotification { public: - enum Type - { + enum Type { Invalid = 0, ModelUpdated, }; @@ -49,8 +47,7 @@ public: const Font* font { nullptr }; }; - enum class Role - { + enum class Role { Display, Sort, Custom, diff --git a/LibGUI/GProgressBar.h b/LibGUI/GProgressBar.h index 7c4379d9393..0db9e5f5295 100644 --- a/LibGUI/GProgressBar.h +++ b/LibGUI/GProgressBar.h @@ -19,8 +19,7 @@ public: String caption() const { return m_caption; } void set_caption(const StringView& caption) { m_caption = caption; } - enum Format - { + enum Format { NoText, Percentage, ValueSlashMax diff --git a/LibGUI/GScrollBar.h b/LibGUI/GScrollBar.h index 6b10728defa..938328ae707 100644 --- a/LibGUI/GScrollBar.h +++ b/LibGUI/GScrollBar.h @@ -29,8 +29,7 @@ public: virtual const char* class_name() const override { return "GScrollBar"; } - enum Component - { + enum Component { Invalid, DecrementButton, IncrementButton, @@ -72,8 +71,7 @@ private: Orientation m_orientation { Orientation::Vertical }; Component m_hovered_component { Component::Invalid }; - enum class AutomaticScrollingDirection - { + enum class AutomaticScrollingDirection { None = 0, Decrement, Increment, diff --git a/LibGUI/GStackWidget.cpp b/LibGUI/GStackWidget.cpp index 33b6af25ebf..010cfc68552 100644 --- a/LibGUI/GStackWidget.cpp +++ b/LibGUI/GStackWidget.cpp @@ -46,7 +46,7 @@ void GStackWidget::child_event(CChildEvent& event) GWidget* new_active_widget = nullptr; for_each_child_widget([&](auto& new_child) { new_active_widget = &new_child; - return IterationDecision::Abort; + return IterationDecision::Break; }); set_active_widget(new_active_widget); } diff --git a/LibGUI/GTabWidget.cpp b/LibGUI/GTabWidget.cpp index 55b1aaa1437..991a0603505 100644 --- a/LibGUI/GTabWidget.cpp +++ b/LibGUI/GTabWidget.cpp @@ -63,7 +63,7 @@ void GTabWidget::child_event(CChildEvent& event) GWidget* new_active_widget = nullptr; for_each_child_widget([&](auto& new_child) { new_active_widget = &new_child; - return IterationDecision::Abort; + return IterationDecision::Break; }); set_active_widget(new_active_widget); } diff --git a/LibGUI/GTextEditor.h b/LibGUI/GTextEditor.h index d77ceaf174e..124f82b8ca6 100644 --- a/LibGUI/GTextEditor.h +++ b/LibGUI/GTextEditor.h @@ -78,8 +78,7 @@ private: class GTextEditor : public GScrollableWidget { public: - enum Type - { + enum Type { MultiLine, SingleLine }; diff --git a/LibGUI/GToolBar.h b/LibGUI/GToolBar.h index 5dac448e746..ec0c654bb0f 100644 --- a/LibGUI/GToolBar.h +++ b/LibGUI/GToolBar.h @@ -21,8 +21,7 @@ private: virtual void paint_event(GPaintEvent&) override; struct Item { - enum Type - { + enum Type { Invalid, Separator, Action diff --git a/LibGUI/GTreeView.cpp b/LibGUI/GTreeView.cpp index 618b966f077..f58b4a27582 100644 --- a/LibGUI/GTreeView.cpp +++ b/LibGUI/GTreeView.cpp @@ -44,12 +44,12 @@ GModelIndex GTreeView::index_at_content_position(const Point& position, bool& is traverse_in_paint_order([&](const GModelIndex& index, const Rect& rect, const Rect& toggle_rect, int) { if (rect.contains(position)) { result = index; - return IterationDecision::Abort; + return IterationDecision::Break; } if (toggle_rect.contains(position)) { result = index; is_toggle = true; - return IterationDecision::Abort; + return IterationDecision::Break; } return IterationDecision::Continue; }); @@ -104,8 +104,8 @@ void GTreeView::traverse_in_paint_order(Callback callback) const toggle_rect = { toggle_x, rect.y(), toggle_size(), toggle_size() }; toggle_rect.center_vertically_within(rect); } - if (callback(index, rect, toggle_rect, indent_level) == IterationDecision::Abort) - return IterationDecision::Abort; + if (callback(index, rect, toggle_rect, indent_level) == IterationDecision::Break) + return IterationDecision::Break; y_offset += item_height(); // NOTE: Skip traversing children if this index is closed! if (!metadata.open) @@ -115,8 +115,8 @@ void GTreeView::traverse_in_paint_order(Callback callback) const ++indent_level; int row_count = model.row_count(index); for (int i = 0; i < row_count; ++i) { - if (traverse_index(model.index(i, 0, index)) == IterationDecision::Abort) - return IterationDecision::Abort; + if (traverse_index(model.index(i, 0, index)) == IterationDecision::Break) + return IterationDecision::Break; } --indent_level; return IterationDecision::Continue; @@ -205,7 +205,7 @@ void GTreeView::scroll_into_view(const GModelIndex& a_index, Orientation orienta traverse_in_paint_order([&](const GModelIndex& index, const Rect& rect, const Rect&, int) { if (index == a_index) { found_rect = rect; - return IterationDecision::Abort; + return IterationDecision::Break; } return IterationDecision::Continue; }); @@ -270,7 +270,7 @@ void GTreeView::keydown_event(GKeyEvent& event) traverse_in_paint_order([&](const GModelIndex& index, const Rect&, const Rect&, int) { if (index == cursor_index) { found_index = previous_index; - return IterationDecision::Abort; + return IterationDecision::Break; } previous_index = index; return IterationDecision::Continue; @@ -287,7 +287,7 @@ void GTreeView::keydown_event(GKeyEvent& event) traverse_in_paint_order([&](const GModelIndex& index, const Rect&, const Rect&, int) { if (previous_index == cursor_index) { found_index = index; - return IterationDecision::Abort; + return IterationDecision::Break; } previous_index = index; return IterationDecision::Continue; diff --git a/LibGUI/GVariant.h b/LibGUI/GVariant.h index 83193e82ad2..38cdfd713b7 100644 --- a/LibGUI/GVariant.h +++ b/LibGUI/GVariant.h @@ -27,8 +27,7 @@ public: void clear(); ~GVariant(); - enum class Type - { + enum class Type { Invalid, Bool, Int, diff --git a/LibGUI/GWidget.h b/LibGUI/GWidget.h index 5b76187f94f..5c729484cf6 100644 --- a/LibGUI/GWidget.h +++ b/LibGUI/GWidget.h @@ -17,23 +17,19 @@ class GLayout; class GMenu; class GWindow; -enum class SizePolicy -{ +enum class SizePolicy { Fixed, Fill }; -enum class Orientation -{ +enum class Orientation { Horizontal, Vertical }; -enum class HorizontalDirection -{ +enum class HorizontalDirection { Left, Right }; -enum class VerticalDirection -{ +enum class VerticalDirection { Up, Down }; diff --git a/LibGUI/GWindow.h b/LibGUI/GWindow.h index d88438016b3..dddfc024749 100644 --- a/LibGUI/GWindow.h +++ b/LibGUI/GWindow.h @@ -10,8 +10,7 @@ class GWidget; class GWMEvent; -enum class GStandardCursor -{ +enum class GStandardCursor { None = 0, Arrow, IBeam, diff --git a/LibGUI/GWindowType.h b/LibGUI/GWindowType.h index a399dec4a3a..d6208892492 100644 --- a/LibGUI/GWindowType.h +++ b/LibGUI/GWindowType.h @@ -1,7 +1,6 @@ #pragma once -enum class GWindowType -{ +enum class GWindowType { Invalid = 0, Normal, Menu, diff --git a/Servers/WindowServer/WSAPITypes.h b/Servers/WindowServer/WSAPITypes.h index ddc6248de88..0a1a6ea9a6a 100644 --- a/Servers/WindowServer/WSAPITypes.h +++ b/Servers/WindowServer/WSAPITypes.h @@ -20,8 +20,7 @@ struct WSAPI_Rect { WSAPI_Size size; }; -enum WSAPI_WindowType -{ +enum WSAPI_WindowType { Invalid = 0, Normal, Menu, @@ -37,8 +36,7 @@ struct WSAPI_WindowBackingStoreInfo { RGBA32* pixels; }; -enum class WSAPI_MouseButton : unsigned char -{ +enum class WSAPI_MouseButton : unsigned char { NoButton = 0, Left = 1, Right = 2, @@ -46,16 +44,14 @@ enum class WSAPI_MouseButton : unsigned char }; struct WSAPI_KeyModifiers { - enum - { + enum { Shift = 1 << 0, Alt = 1 << 1, Ctrl = 1 << 2, }; }; -enum class WSAPI_StandardCursor : unsigned char -{ +enum class WSAPI_StandardCursor : unsigned char { None = 0, Arrow, IBeam, @@ -65,8 +61,7 @@ enum class WSAPI_StandardCursor : unsigned char ResizeDiagonalBLTR, }; -enum WSAPI_WMEventMask : unsigned -{ +enum WSAPI_WMEventMask : unsigned { WindowRectChanges = 1 << 0, WindowStateChanges = 1 << 1, WindowIconChanges = 1 << 2, @@ -74,8 +69,7 @@ enum WSAPI_WMEventMask : unsigned }; struct WSAPI_ServerMessage { - enum Type : unsigned - { + enum Type : unsigned { Invalid, Error, Paint, @@ -195,8 +189,7 @@ struct WSAPI_ServerMessage { }; struct WSAPI_ClientMessage { - enum Type : unsigned - { + enum Type : unsigned { Invalid, CreateMenubar, DestroyMenubar, diff --git a/Servers/WindowServer/WSClientConnection.h b/Servers/WindowServer/WSClientConnection.h index dd44d8d53f3..9f128f25867 100644 --- a/Servers/WindowServer/WSClientConnection.h +++ b/Servers/WindowServer/WSClientConnection.h @@ -105,7 +105,7 @@ void WSClientConnection::for_each_window_matching(Matching matching, Callback ca { for (auto& it : m_windows) { if (matching(*it.value)) { - if (callback(*it.value) == IterationDecision::Abort) + if (callback(*it.value) == IterationDecision::Break) return; } } @@ -115,7 +115,7 @@ template void WSClientConnection::for_each_window(Callback callback) { for (auto& it : m_windows) { - if (callback(*it.value) == IterationDecision::Abort) + if (callback(*it.value) == IterationDecision::Break) return; } } diff --git a/Servers/WindowServer/WSCompositor.h b/Servers/WindowServer/WSCompositor.h index eb217d88a86..8f9c15f6da4 100644 --- a/Servers/WindowServer/WSCompositor.h +++ b/Servers/WindowServer/WSCompositor.h @@ -10,8 +10,7 @@ class Painter; class WSCursor; -enum class WallpaperMode -{ +enum class WallpaperMode { Simple, Tile, Center, diff --git a/Servers/WindowServer/WSCursor.h b/Servers/WindowServer/WSCursor.h index e16eada5c74..889fdcdef1c 100644 --- a/Servers/WindowServer/WSCursor.h +++ b/Servers/WindowServer/WSCursor.h @@ -2,8 +2,7 @@ #include -enum class WSStandardCursor -{ +enum class WSStandardCursor { None = 0, Arrow, IBeam, diff --git a/Servers/WindowServer/WSEvent.h b/Servers/WindowServer/WSEvent.h index bd6e5ec17e3..d94693f54f4 100644 --- a/Servers/WindowServer/WSEvent.h +++ b/Servers/WindowServer/WSEvent.h @@ -11,8 +11,7 @@ class WSEvent : public CEvent { public: - enum Type - { + enum Type { Invalid = 2000, WM_DeferredCompose, WM_ClientDisconnected, @@ -706,8 +705,7 @@ private: Vector m_rects; }; -enum class MouseButton : byte -{ +enum class MouseButton : byte { None = 0, Left = 1, Right = 2, diff --git a/Servers/WindowServer/WSMenuItem.h b/Servers/WindowServer/WSMenuItem.h index 7b381386e77..0b29d361bae 100644 --- a/Servers/WindowServer/WSMenuItem.h +++ b/Servers/WindowServer/WSMenuItem.h @@ -8,8 +8,7 @@ class WSMenu; class WSMenuItem { public: - enum Type - { + enum Type { None, Text, Separator, diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index 2aaa9f5e02a..aba405aeaba 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -389,7 +389,7 @@ void WSWindowManager::pick_new_active_window() { for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, [&](WSWindow& candidate) { set_active_window(&candidate); - return IterationDecision::Abort; + return IterationDecision::Break; }); } @@ -760,12 +760,12 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Logo && event.type() == WSEvent::MouseDown && event.button() == MouseButton::Left) { hovered_window = &window; start_window_drag(window, event); - return IterationDecision::Abort; + return IterationDecision::Break; } if (window.is_resizable() && m_keyboard_modifiers == Mod_Logo && event.type() == WSEvent::MouseDown && event.button() == MouseButton::Right && !window.is_blocked_by_modal_window()) { hovered_window = &window; start_window_resize(window, event); - return IterationDecision::Abort; + return IterationDecision::Break; } } // Well okay, let's see if we're hitting the frame or the window inside the frame. @@ -778,13 +778,13 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere auto translated_event = event.translated(-window.position()); deliver_mouse_event(window, translated_event); } - return IterationDecision::Abort; + return IterationDecision::Break; } // We are hitting the frame, pass the event along to WSWindowFrame. window.frame().on_mouse_event(event.translated(-window_frame_rect.location())); event_window_with_frame = &window; - return IterationDecision::Abort; + return IterationDecision::Break; }); if (event_window_with_frame != m_resize_candidate.ptr()) @@ -815,7 +815,7 @@ bool WSWindowManager::any_opaque_window_contains_rect(const Rect& rect) } if (window.frame().rect().contains(rect)) { found_containing_window = true; - return IterationDecision::Abort; + return IterationDecision::Break; } return IterationDecision::Continue; }); @@ -843,7 +843,7 @@ bool WSWindowManager::any_opaque_window_above_this_one_contains_rect(const WSWin return IterationDecision::Continue; if (window.frame().rect().contains(rect)) { found_containing_window = true; - return IterationDecision::Abort; + return IterationDecision::Break; } return IterationDecision::Continue; }); @@ -1056,7 +1056,7 @@ Rect WSWindowManager::maximized_window_rect(const WSWindow& window) const // Subtract taskbar window height if present const_cast(this)->for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, [&rect](WSWindow& taskbar_window) { rect.set_height(rect.height() - taskbar_window.height()); - return IterationDecision::Abort; + return IterationDecision::Break; }); return rect; diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h index 6c2fde241f4..4ed5fe48607 100644 --- a/Servers/WindowServer/WSWindowManager.h +++ b/Servers/WindowServer/WSWindowManager.h @@ -29,8 +29,7 @@ class WSWindowSwitcher; class GraphicsBitmap; class WSButton; -enum class ResizeDirection -{ +enum class ResizeDirection { None, Left, UpLeft, @@ -268,12 +267,12 @@ IterationDecision WSWindowManager::for_each_visible_window_of_type_from_back_to_ do_highlight_window_at_end = true; continue; } - if (callback(*window) == IterationDecision::Abort) - return IterationDecision::Abort; + if (callback(*window) == IterationDecision::Break) + return IterationDecision::Break; } if (do_highlight_window_at_end) { - if (callback(*m_highlight_window) == IterationDecision::Abort) - return IterationDecision::Abort; + if (callback(*m_highlight_window) == IterationDecision::Break) + return IterationDecision::Break; } return IterationDecision::Continue; } @@ -281,14 +280,14 @@ IterationDecision WSWindowManager::for_each_visible_window_of_type_from_back_to_ template IterationDecision WSWindowManager::for_each_visible_window_from_back_to_front(Callback callback) { - if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Normal, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Tooltip, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Menu, callback) == IterationDecision::Abort) - return IterationDecision::Abort; + if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Normal, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Tooltip, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Menu, callback) == IterationDecision::Break) + return IterationDecision::Break; return for_each_visible_window_of_type_from_back_to_front(WSWindowType::WindowSwitcher, callback); } @@ -296,8 +295,8 @@ template IterationDecision WSWindowManager::for_each_visible_window_of_type_from_front_to_back(WSWindowType type, Callback callback, bool ignore_highlight) { if (!ignore_highlight && m_highlight_window && m_highlight_window->type() == type && m_highlight_window->is_visible()) { - if (callback(*m_highlight_window) == IterationDecision::Abort) - return IterationDecision::Abort; + if (callback(*m_highlight_window) == IterationDecision::Break) + return IterationDecision::Break; } for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { @@ -309,8 +308,8 @@ IterationDecision WSWindowManager::for_each_visible_window_of_type_from_front_to continue; if (!ignore_highlight && window == m_highlight_window) continue; - if (callback(*window) == IterationDecision::Abort) - return IterationDecision::Abort; + if (callback(*window) == IterationDecision::Break) + return IterationDecision::Break; } return IterationDecision::Continue; } @@ -318,14 +317,14 @@ IterationDecision WSWindowManager::for_each_visible_window_of_type_from_front_to template IterationDecision WSWindowManager::for_each_visible_window_from_front_to_back(Callback callback) { - if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::WindowSwitcher, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Menu, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Taskbar, callback) == IterationDecision::Abort) - return IterationDecision::Abort; - if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Tooltip, callback) == IterationDecision::Abort) - return IterationDecision::Abort; + if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::WindowSwitcher, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Menu, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Taskbar, callback) == IterationDecision::Break) + return IterationDecision::Break; + if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Tooltip, callback) == IterationDecision::Break) + return IterationDecision::Break; return for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, callback); } @@ -335,7 +334,7 @@ void WSWindowManager::for_each_window_listening_to_wm_events(Callback callback) for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { if (!window->listens_to_wm_events()) continue; - if (callback(*window) == IterationDecision::Abort) + if (callback(*window) == IterationDecision::Break) return; } } @@ -344,7 +343,7 @@ template void WSWindowManager::for_each_window(Callback callback) { for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { - if (callback(*window) == IterationDecision::Abort) + if (callback(*window) == IterationDecision::Break) return; } } diff --git a/Servers/WindowServer/WSWindowType.h b/Servers/WindowServer/WSWindowType.h index 5197046f2c9..897e81f74e8 100644 --- a/Servers/WindowServer/WSWindowType.h +++ b/Servers/WindowServer/WSWindowType.h @@ -1,7 +1,6 @@ #pragma once -enum class WSWindowType -{ +enum class WSWindowType { Invalid = 0, Normal, Menu, diff --git a/SharedGraphics/Color.h b/SharedGraphics/Color.h index 8c3af4cabe0..a1e0c819dfc 100644 --- a/SharedGraphics/Color.h +++ b/SharedGraphics/Color.h @@ -12,8 +12,7 @@ inline constexpr dword make_rgb(byte r, byte g, byte b) class Color { public: - enum NamedColor - { + enum NamedColor { Black, White, Red, diff --git a/SharedGraphics/GraphicsBitmap.h b/SharedGraphics/GraphicsBitmap.h index aecad2ed1d7..9e0a24525a4 100644 --- a/SharedGraphics/GraphicsBitmap.h +++ b/SharedGraphics/GraphicsBitmap.h @@ -12,8 +12,7 @@ class GraphicsBitmap : public Retainable { public: - enum class Format - { + enum class Format { Invalid, RGB32, RGBA32, diff --git a/SharedGraphics/Painter.h b/SharedGraphics/Painter.h index 9c8e275e407..ac92a2fe341 100644 --- a/SharedGraphics/Painter.h +++ b/SharedGraphics/Painter.h @@ -38,8 +38,7 @@ public: const Font& font() const { return *state().font; } void set_font(const Font& font) { state().font = &font; } - enum class DrawOp - { + enum class DrawOp { Copy, Xor }; diff --git a/SharedGraphics/StylePainter.h b/SharedGraphics/StylePainter.h index b6432f564c2..996c63c62f7 100644 --- a/SharedGraphics/StylePainter.h +++ b/SharedGraphics/StylePainter.h @@ -3,19 +3,16 @@ class Painter; class Rect; -enum class ButtonStyle -{ +enum class ButtonStyle { Normal, CoolBar }; -enum class FrameShadow -{ +enum class FrameShadow { Plain, Raised, Sunken }; -enum class FrameShape -{ +enum class FrameShape { NoFrame, Box, Container, diff --git a/SharedGraphics/TextAlignment.h b/SharedGraphics/TextAlignment.h index 4327077baa9..bd9d61ac73e 100644 --- a/SharedGraphics/TextAlignment.h +++ b/SharedGraphics/TextAlignment.h @@ -1,7 +1,6 @@ #pragma once -enum class TextAlignment -{ +enum class TextAlignment { TopLeft, CenterLeft, Center, diff --git a/SharedGraphics/TextElision.h b/SharedGraphics/TextElision.h index 054d514e8cf..c5c8032b020 100644 --- a/SharedGraphics/TextElision.h +++ b/SharedGraphics/TextElision.h @@ -1,7 +1,6 @@ #pragma once -enum class TextElision -{ +enum class TextElision { None, Right, }; diff --git a/Shell/LineEditor.h b/Shell/LineEditor.h index 2de7d52e14c..da01c435af6 100644 --- a/Shell/LineEditor.h +++ b/Shell/LineEditor.h @@ -28,8 +28,7 @@ private: int m_history_cursor { 0 }; int m_history_capacity { 100 }; - enum class InputState - { + enum class InputState { Free, ExpectBracket, ExpectFinal, diff --git a/Shell/Parser.h b/Shell/Parser.h index bbd30599d70..294a7ec63ac 100644 --- a/Shell/Parser.h +++ b/Shell/Parser.h @@ -4,8 +4,7 @@ #include struct Redirection { - enum Type - { + enum Type { Pipe, FileWrite, FileWriteAppend, @@ -44,8 +43,7 @@ private: void begin_redirect_read(int fd); void begin_redirect_write(int fd); - enum State - { + enum State { Free, InSingleQuotes, InDoubleQuotes, diff --git a/Userland/crash.cpp b/Userland/crash.cpp index ddef7531e99..207d0f1c30d 100644 --- a/Userland/crash.cpp +++ b/Userland/crash.cpp @@ -10,8 +10,7 @@ static void print_usage_and_exit() int main(int argc, char** argv) { - enum Mode - { + enum Mode { SegmentationViolation, DivisionByZero, IllegalInstruction,