Meta: Tweak .clang-format to not wrap braces after enums.

This commit is contained in:
Andreas Kling 2019-06-07 17:13:23 +02:00
parent 9145917bf0
commit 39d1a9ae66
Notes: sideshowbarker 2024-07-19 13:41:04 +09:00
97 changed files with 186 additions and 312 deletions

View file

@ -10,4 +10,3 @@ IndentPPDirectives: AfterHash
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
AfterEnum: true

View file

@ -84,8 +84,7 @@ public:
{
}
enum class CaseSensitivity
{
enum class CaseSensitivity {
CaseInsensitive,
CaseSensitive,
};

View file

@ -60,8 +60,7 @@ public:
void grow(int size);
private:
enum ConstructionMode
{
enum ConstructionMode {
Uninitialized,
Copy,
Wrap,

View file

@ -8,8 +8,7 @@ namespace AK {
template<typename T>
class RetainPtr {
public:
enum AdoptTag
{
enum AdoptTag {
Adopt
};

View file

@ -34,8 +34,7 @@ inline void release_if_not_null(T* ptr)
template<typename T>
class CONSUMABLE(unconsumed) Retained {
public:
enum AdoptTag
{
enum AdoptTag {
Adopt
};

View file

@ -271,16 +271,14 @@ struct RemovePointer<T* const volatile> {
template<typename T, typename U>
struct IsSame {
enum
{
enum {
value = 0
};
};
template<typename T>
struct IsSame<T, T> {
enum
{
enum {
value = 1
};
};

View file

@ -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);

View file

@ -1,5 +1,7 @@
#pragma once
#include <AK/IterationDecision.h>
#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;
}

View file

@ -26,8 +26,7 @@ public:
Function<void(const StringView&)> on_status_message;
Function<void(int done, int total)> on_thumbnail_progress;
enum ViewMode
{
enum ViewMode {
Invalid,
List,
Icon

View file

@ -7,8 +7,7 @@ class IRCChannel;
class IRCChannelMemberListModel final : public GModel {
public:
enum Column
{
enum Column {
Name
};
static Retained<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }

View file

@ -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<char, 32> prefix;
Vector<char, 32> command;
Vector<char, 256> current_parameter;
enum
{
enum {
Start,
InPrefix,
InCommand,

View file

@ -6,8 +6,7 @@ class IRCLogBuffer;
class IRCLogBufferModel final : public GModel {
public:
enum Column
{
enum Column {
Timestamp = 0,
Name,
Text,

View file

@ -11,8 +11,7 @@ class GTextEditor;
class IRCWindow : public GWidget {
public:
enum Type
{
enum Type {
Server,
Channel,
Query,

View file

@ -8,8 +8,7 @@ class IRCWindow;
class IRCWindowListModel final : public GModel {
public:
enum Column
{
enum Column {
Name,
};

View file

@ -11,8 +11,7 @@ class GraphWidget;
class ProcessModel final : public GModel {
public:
enum Column
{
enum Column {
Icon = 0,
Name,
CPU,

View file

@ -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,

View file

@ -15,8 +15,7 @@ class VBForm;
class VBProperty;
class VBWidgetPropertyModel;
enum class Direction
{
enum class Direction {
None,
Left,
UpLeft,

View file

@ -7,8 +7,7 @@ class VBProperty;
class VBWidgetPropertyModel : public GModel {
public:
enum Column
{
enum Column {
Name = 0,
Value,
__Count

View file

@ -1,7 +1,6 @@
#pragma once
enum class VBWidgetType
{
enum class VBWidgetType {
None = 0,
GWidget,
GButton,

View file

@ -71,8 +71,7 @@ private:
template<typename Callback>
void for_each_square(Callback);
enum class Face
{
enum class Face {
Default,
Good,
Bad

View file

@ -5,8 +5,8 @@
#include <AK/Retained.h>
#include <AK/Types.h>
#include <Kernel/KResult.h>
#include <Kernel/VirtualAddress.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/VirtualAddress.h>
class FileDescription;
class Process;

View file

@ -8,8 +8,7 @@ class FileDescription;
class FIFO final : public File {
public:
enum class Direction : byte
{
enum class Direction : byte {
Neither,
Reader,
Writer

View file

@ -8,8 +8,8 @@
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/VirtualAddress.h>
#include <Kernel/Net/Socket.h>
#include <Kernel/VirtualAddress.h>
class File;
class TTY;

View file

@ -14,8 +14,7 @@
#include <Kernel/kmalloc.h>
#include <LibC/errno_numbers.h>
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,

View file

@ -3,8 +3,7 @@
#include <AK/Assertions.h>
#include <LibC/errno_numbers.h>
enum KSuccessTag
{
enum KSuccessTag {
KSuccess
};

View file

@ -2,8 +2,7 @@
#include <AK/Types.h>
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,

View file

@ -5,16 +5,14 @@
#include <Kernel/Net/MACAddress.h>
struct ARPOperation {
enum : word
{
enum : word {
Request = 1,
Response = 2,
};
};
struct ARPHardwareType {
enum : word
{
enum : word {
Ethernet = 1,
};
};

View file

@ -3,8 +3,7 @@
#include <AK/Types.h>
struct EtherType {
enum : word
{
enum : word {
ARP = 0x0806,
IPv4 = 0x0800,
};

View file

@ -4,8 +4,7 @@
#include <Kernel/Net/MACAddress.h>
struct ICMPType {
enum
{
enum {
EchoReply = 0,
EchoRequest = 8,
};

View file

@ -5,8 +5,7 @@
#include <AK/NetworkOrdered.h>
#include <AK/Types.h>
enum class IPv4Protocol : word
{
enum class IPv4Protocol : word {
ICMP = 1,
TCP = 6,
UDP = 17,

View file

@ -9,16 +9,14 @@
#include <Kernel/Lock.h>
#include <Kernel/UnixTypes.h>
enum class SocketRole : byte
{
enum class SocketRole : byte {
None,
Listener,
Accepted,
Connected,
Connecting
};
enum class ShouldBlock
{
enum class ShouldBlock {
No = 0,
Yes = 1
};

View file

@ -3,8 +3,7 @@
#include <Kernel/Net/IPv4.h>
struct TCPFlags {
enum : word
{
enum : word {
FIN = 0x01,
SYN = 0x02,
RST = 0x04,

View file

@ -7,8 +7,7 @@ public:
static Retained<TCPSocket> create(int protocol);
virtual ~TCPSocket() override;
enum class State
{
enum class State {
Disconnected,
Connecting,
Connected,

View file

@ -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;
});

View file

@ -38,8 +38,7 @@ public:
static Vector<pid_t> all_pids();
static Vector<Process*> 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;

View file

@ -3,7 +3,9 @@
#include <AK/Types.h>
#include <LibC/fd_set.h>
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

View file

@ -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,

View file

@ -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,

View file

@ -254,8 +254,7 @@ ShouldUnblockThread Thread::dispatch_one_pending_signal()
return dispatch_signal(signal);
}
enum class DefaultSignalAction
{
enum class DefaultSignalAction {
Terminate,
Ignore,
DumpCore,

View file

@ -6,9 +6,9 @@
#include <AK/RetainPtr.h>
#include <AK/Vector.h>
#include <Kernel/KResult.h>
#include <Kernel/VirtualAddress.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/VM/Region.h>
#include <Kernel/VirtualAddress.h>
#include <Kernel/i386.h>
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;
}

View file

@ -12,17 +12,16 @@
#include <AK/Vector.h>
#include <AK/Weakable.h>
#include <Kernel/FileSystem/InodeIdentifier.h>
#include <Kernel/VirtualAddress.h>
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/VM/Region.h>
#include <Kernel/VM/VMObject.h>
#include <Kernel/VirtualAddress.h>
#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,

View file

@ -12,8 +12,7 @@ class Region : public Retainable<Region> {
friend class MemoryManager;
public:
enum Access
{
enum Access {
Read = 1,
Write = 2,
Execute = 4,

View file

@ -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,

View file

@ -4,8 +4,7 @@
__BEGIN_DECLS
enum
{
enum {
LC_ALL,
LC_NUMERIC,
LC_CTYPE,

View file

@ -1,7 +1,6 @@
#pragma once
enum IOCtlNumber
{
enum IOCtlNumber {
TIOCGPGRP,
TIOCSPGRP,
TCGETS,

View file

@ -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,
};

View file

@ -5,8 +5,7 @@
class CDirIterator {
public:
enum Flags
{
enum Flags {
NoFlags = 0x0,
SkipDots = 0x1,
};

View file

@ -9,8 +9,7 @@ class CObject;
class CEvent {
public:
enum Type
{
enum Type {
Invalid = 0,
Quit,
Timer,

View file

@ -21,8 +21,7 @@ public:
int exec();
enum class WaitMode
{
enum class WaitMode {
WaitForEvents,
PollForEvents,
};

View file

@ -14,8 +14,7 @@ public:
virtual bool open(CIODevice::OpenMode) override;
enum class ShouldCloseFileDescription
{
enum class ShouldCloseFileDescription {
No = 0,
Yes
};

View file

@ -18,8 +18,7 @@ public:
private:
void on_socket_connected();
enum class State
{
enum class State {
InStatus,
InHeaders,
InBody,

View file

@ -6,8 +6,7 @@ class CNetworkJob;
class CHttpRequest {
public:
enum Method
{
enum Method {
Invalid,
HEAD,
GET,

View file

@ -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,

View file

@ -7,8 +7,7 @@ class CNetworkResponse;
class CNetworkJob : public CObject {
public:
enum class Error
{
enum class Error {
None,
ConnectionFailed,
TransmissionFailed,

View file

@ -4,8 +4,7 @@
class CNotifier {
public:
enum Event
{
enum Event {
None = 0,
Read = 1,
Write = 2,

View file

@ -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;
}
}

View file

@ -7,8 +7,7 @@ class CNotifier;
class CSocket : public CIODevice {
public:
enum class Type
{
enum class Type {
Invalid,
TCP,
UDP

View file

@ -4,8 +4,7 @@
class CSocketAddress {
public:
enum class Type
{
enum class Type {
Invalid,
IPv4,
Local

View file

@ -18,8 +18,7 @@ class GWidget;
class GAction : public Retainable<GAction>
, public Weakable<GAction> {
public:
enum class ShortcutScope
{
enum class ShortcutScope {
None,
ApplicationGlobal,
WidgetLocal,

View file

@ -5,8 +5,7 @@
class GDialog : public GWindow {
public:
enum ExecResult
{
enum ExecResult {
ExecOK = 0,
ExecCancel = 1,
ExecAborted = 2

View file

@ -11,8 +11,7 @@ public:
static Retained<GDirectoryModel> create() { return adopt(*new GDirectoryModel); }
virtual ~GDirectoryModel() override;
enum Column
{
enum Column {
Icon = 0,
Name,
Size,

View file

@ -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,

View file

@ -11,8 +11,7 @@ struct GFileSystemModel::Node {
String name;
Node* parent { nullptr };
Vector<Node*> children;
enum Type
{
enum Type {
Unknown,
Directory,
File

View file

@ -6,8 +6,7 @@ class GFileSystemModel : public GModel {
friend class Node;
public:
enum Mode
{
enum Mode {
Invalid,
DirectoriesOnly,
FilesAndDirectories

View file

@ -32,8 +32,7 @@ public:
protected:
struct Entry {
enum class Type
{
enum class Type {
Invalid = 0,
Widget,
Layout,

View file

@ -8,8 +8,7 @@ class GMenu;
class GMenuItem {
public:
enum Type
{
enum Type {
Invalid,
Action,
Separator

View file

@ -4,8 +4,7 @@
class GMessageBox : public GDialog {
public:
enum class Type
{
enum class Type {
None,
Information,
Warning,

View file

@ -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,

View file

@ -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

View file

@ -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,

View file

@ -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);
}

View file

@ -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);
}

View file

@ -78,8 +78,7 @@ private:
class GTextEditor : public GScrollableWidget {
public:
enum Type
{
enum Type {
MultiLine,
SingleLine
};

View file

@ -21,8 +21,7 @@ private:
virtual void paint_event(GPaintEvent&) override;
struct Item {
enum Type
{
enum Type {
Invalid,
Separator,
Action

View file

@ -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;

View file

@ -27,8 +27,7 @@ public:
void clear();
~GVariant();
enum class Type
{
enum class Type {
Invalid,
Bool,
Int,

View file

@ -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
};

View file

@ -10,8 +10,7 @@
class GWidget;
class GWMEvent;
enum class GStandardCursor
{
enum class GStandardCursor {
None = 0,
Arrow,
IBeam,

View file

@ -1,7 +1,6 @@
#pragma once
enum class GWindowType
{
enum class GWindowType {
Invalid = 0,
Normal,
Menu,

View file

@ -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,

View file

@ -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<typename Callback>
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;
}
}

View file

@ -10,8 +10,7 @@
class Painter;
class WSCursor;
enum class WallpaperMode
{
enum class WallpaperMode {
Simple,
Tile,
Center,

View file

@ -2,8 +2,7 @@
#include <SharedGraphics/GraphicsBitmap.h>
enum class WSStandardCursor
{
enum class WSStandardCursor {
None = 0,
Arrow,
IBeam,

View file

@ -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<Rect, 32> m_rects;
};
enum class MouseButton : byte
{
enum class MouseButton : byte {
None = 0,
Left = 1,
Right = 2,

View file

@ -8,8 +8,7 @@ class WSMenu;
class WSMenuItem {
public:
enum Type
{
enum Type {
None,
Text,
Separator,

View file

@ -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<WSWindowManager*>(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;

View file

@ -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<typename Callback>
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<typename Callback>
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<typename Callback>
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<typename Callback>
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;
}
}

View file

@ -1,7 +1,6 @@
#pragma once
enum class WSWindowType
{
enum class WSWindowType {
Invalid = 0,
Normal,
Menu,

View file

@ -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,

View file

@ -12,8 +12,7 @@
class GraphicsBitmap : public Retainable<GraphicsBitmap> {
public:
enum class Format
{
enum class Format {
Invalid,
RGB32,
RGBA32,

View file

@ -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
};

View file

@ -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,

View file

@ -1,7 +1,6 @@
#pragma once
enum class TextAlignment
{
enum class TextAlignment {
TopLeft,
CenterLeft,
Center,

View file

@ -1,7 +1,6 @@
#pragma once
enum class TextElision
{
enum class TextElision {
None,
Right,
};

View file

@ -28,8 +28,7 @@ private:
int m_history_cursor { 0 };
int m_history_capacity { 100 };
enum class InputState
{
enum class InputState {
Free,
ExpectBracket,
ExpectFinal,

View file

@ -4,8 +4,7 @@
#include <AK/Vector.h>
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,

View file

@ -10,8 +10,7 @@ static void print_usage_and_exit()
int main(int argc, char** argv)
{
enum Mode
{
enum Mode {
SegmentationViolation,
DivisionByZero,
IllegalInstruction,