diff --git a/AK/FileSystemPath.h b/AK/FileSystemPath.h index 4cf257dbdc..9400292c67 100644 --- a/AK/FileSystemPath.h +++ b/AK/FileSystemPath.h @@ -27,6 +27,7 @@ #pragma once #include +#include namespace AK { diff --git a/AK/Forward.h b/AK/Forward.h new file mode 100644 index 0000000000..e1b66768f1 --- /dev/null +++ b/AK/Forward.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2020, Andreas Kling + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace AK { + +class Bitmap; +class ByteBuffer; +class IPv4Address; +class JsonArray; +class JsonObject; +class JsonValue; +class String; +class StringBuilder; +class StringImpl; +class StringView; +class URL; + +template +class SinglyLinkedList; + +template +class DoublyLinkedList; + +template +class InlineLinkedList; + +template +class CircularQueue; + +template +class Badge; + +template +class FixedArray; + +template +class Function; + +template +class Function; + +template +class NonnullRefPtr; + +template +class NonnullOwnPtr; + +template +class RefPtr; + +template +class OwnPtr; + +template +class WeakPtr; + +template +class Vector; + +} + +using AK::Badge; +using AK::Bitmap; +using AK::ByteBuffer; +using AK::CircularQueue; +using AK::DoublyLinkedList; +using AK::FixedArray; +using AK::Function; +using AK::InlineLinkedList; +using AK::IPv4Address; +using AK::JsonArray; +using AK::JsonObject; +using AK::JsonValue; +using AK::NonnullOwnPtr; +using AK::NonnullRefPtr; +using AK::OwnPtr; +using AK::RefPtr; +using AK::SinglyLinkedList; +using AK::String; +using AK::StringBuilder; +using AK::StringImpl; +using AK::StringView; +using AK::URL; +using AK::Vector; diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index be729938e2..6d5dc6f535 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -26,10 +26,11 @@ #pragma once -#include #include #include #include +#include +#include typedef u32 in_addr_t; diff --git a/AK/JsonValue.h b/AK/JsonValue.h index a109b671be..c0780e331c 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include @@ -33,10 +34,6 @@ namespace AK { -class JsonArray; -class JsonObject; -class StringBuilder; - class JsonValue { public: enum class Type { diff --git a/AK/LogStream.cpp b/AK/LogStream.cpp index b6d2b5396d..c6702fea6c 100644 --- a/AK/LogStream.cpp +++ b/AK/LogStream.cpp @@ -112,4 +112,10 @@ DebugLogStream dbg() return stream; } +DebugLogStream::~DebugLogStream() +{ + char newline = '\n'; + write(&newline, 1); +} + } diff --git a/AK/LogStream.h b/AK/LogStream.h index 6cf7b45ddd..8e00ad278d 100644 --- a/AK/LogStream.h +++ b/AK/LogStream.h @@ -62,11 +62,7 @@ private: class DebugLogStream final : public LogStream { public: DebugLogStream() {} - virtual ~DebugLogStream() override - { - char newline = '\n'; - write(&newline, 1); - } + virtual ~DebugLogStream() override; virtual void write(const char* characters, int length) const override { diff --git a/AK/String.cpp b/AK/String.cpp index 4e064b8070..4149a15467 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -27,10 +27,10 @@ #include #include #include -#include +#include #ifndef KERNEL -#include +# include #endif #ifdef KERNEL diff --git a/AK/String.h b/AK/String.h index 71c4a48293..fea82b40b0 100644 --- a/AK/String.h +++ b/AK/String.h @@ -26,12 +26,11 @@ #pragma once -#include +#include #include #include #include #include -#include namespace AK { diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index e60f1c8826..da97a970c8 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include namespace AK { @@ -96,6 +96,11 @@ String StringBuilder::to_string() return String((const char*)m_buffer.data(), m_length); } +String StringBuilder::build() +{ + return to_string(); +} + StringView StringBuilder::string_view() const { return StringView { (const char*)m_buffer.data(), m_length }; diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index de99291bf5..1ffa801ddd 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -26,8 +26,8 @@ #pragma once -#include -#include +#include +#include #include namespace AK { @@ -45,8 +45,7 @@ public: void appendf(const char*, ...); void appendvf(const char*, va_list); - String build() { return to_string(); } - + String build(); String to_string(); ByteBuffer to_byte_buffer(); diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 7082b608d7..69657e78cd 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -24,8 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include +#include namespace AK { diff --git a/AK/StringView.h b/AK/StringView.h index 6eab64ceec..4bf12a5364 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -26,14 +26,11 @@ #pragma once -#include +#include +#include namespace AK { -class ByteBuffer; -class String; -class StringImpl; - class StringView { public: StringView() {} diff --git a/AK/Utf8View.cpp b/AK/Utf8View.cpp index 847bef01f7..885721f7e9 100644 --- a/AK/Utf8View.cpp +++ b/AK/Utf8View.cpp @@ -24,8 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include +#include namespace AK { diff --git a/AK/Vector.h b/AK/Vector.h index ed8b02b576..f8d003e6cd 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -27,6 +27,7 @@ #pragma once #include +#include #include #include #include @@ -44,9 +45,6 @@ namespace AK { -template -class Vector; - template class VectorIterator { public: @@ -132,7 +130,7 @@ public: } }; -template +template class Vector { public: Vector() diff --git a/Applications/HexEditor/HexEditor.h b/Applications/HexEditor/HexEditor.h index 42adcb105e..9e1ce1f713 100644 --- a/Applications/HexEditor/HexEditor.h +++ b/Applications/HexEditor/HexEditor.h @@ -26,13 +26,14 @@ #pragma once +#include #include #include #include #include #include -#include #include +#include class HexEditor : public GUI::ScrollableWidget { C_OBJECT(HexEditor) diff --git a/Libraries/LibC/grp.cpp b/Libraries/LibC/grp.cpp index 21d4a73650..4b0726875d 100644 --- a/Libraries/LibC/grp.cpp +++ b/Libraries/LibC/grp.cpp @@ -25,6 +25,7 @@ */ #include +#include #include #include #include diff --git a/Libraries/LibC/pwd.cpp b/Libraries/LibC/pwd.cpp index 794438a51f..00bf40476e 100644 --- a/Libraries/LibC/pwd.cpp +++ b/Libraries/LibC/pwd.cpp @@ -25,6 +25,7 @@ */ #include +#include #include #include #include diff --git a/Libraries/LibC/syslog.cpp b/Libraries/LibC/syslog.cpp index 180eb22fde..650347da96 100644 --- a/Libraries/LibC/syslog.cpp +++ b/Libraries/LibC/syslog.cpp @@ -27,6 +27,7 @@ // Has to be defined before including due to legacy Unices #define SYSLOG_NAMES 1 +#include #include #include #include diff --git a/Libraries/LibELF/ELFDynamicLoader.h b/Libraries/LibELF/ELFDynamicLoader.h index e5cc508e89..c3932714d4 100644 --- a/Libraries/LibELF/ELFDynamicLoader.h +++ b/Libraries/LibELF/ELFDynamicLoader.h @@ -26,14 +26,14 @@ #pragma once -#include -#include -#include -#include - +#include #include #include #include +#include +#include +#include +#include #define ALIGN_ROUND_UP(x, align) ((((size_t)(x)) + align - 1) & (~(align - 1))) diff --git a/Libraries/LibELF/ELFDynamicObject.cpp b/Libraries/LibELF/ELFDynamicObject.cpp index 0e8aafaf91..5a98a0ae04 100644 --- a/Libraries/LibELF/ELFDynamicObject.cpp +++ b/Libraries/LibELF/ELFDynamicObject.cpp @@ -24,12 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +#include #include #include - -#include - -#include #include static const char* name_for_dtag(Elf32_Sword d_tag); diff --git a/Libraries/LibELF/ELFDynamicObject.h b/Libraries/LibELF/ELFDynamicObject.h index 5e88f2665d..80eb9db281 100644 --- a/Libraries/LibELF/ELFDynamicObject.h +++ b/Libraries/LibELF/ELFDynamicObject.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include diff --git a/Libraries/LibGUI/ProgressBar.cpp b/Libraries/LibGUI/ProgressBar.cpp index 4e55e3720b..b957a159c1 100644 --- a/Libraries/LibGUI/ProgressBar.cpp +++ b/Libraries/LibGUI/ProgressBar.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include diff --git a/Libraries/LibGUI/ScrollBar.cpp b/Libraries/LibGUI/ScrollBar.cpp index c50f3fb7b4..27c3531ad9 100644 --- a/Libraries/LibGUI/ScrollBar.cpp +++ b/Libraries/LibGUI/ScrollBar.cpp @@ -24,12 +24,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include +#include +#include #include #include +#include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Shortcut.cpp b/Libraries/LibGUI/Shortcut.cpp index 37fa479450..cc76d78a75 100644 --- a/Libraries/LibGUI/Shortcut.cpp +++ b/Libraries/LibGUI/Shortcut.cpp @@ -25,6 +25,7 @@ */ #include +#include #include namespace GUI { diff --git a/Libraries/LibGfx/PNGLoader.cpp b/Libraries/LibGfx/PNGLoader.cpp index 0b293dbac7..863c63d806 100644 --- a/Libraries/LibGfx/PNGLoader.cpp +++ b/Libraries/LibGfx/PNGLoader.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include diff --git a/Libraries/LibGfx/Painter.h b/Libraries/LibGfx/Painter.h index 7e8cfb838f..1775c1b3d2 100644 --- a/Libraries/LibGfx/Painter.h +++ b/Libraries/LibGfx/Painter.h @@ -26,12 +26,13 @@ #pragma once -#include "Color.h" -#include "Point.h" -#include "Rect.h" -#include "Size.h" #include #include +#include +#include +#include +#include +#include #include #include diff --git a/Libraries/LibGfx/Rect.cpp b/Libraries/LibGfx/Rect.cpp index bff5d90ae3..af663bfc09 100644 --- a/Libraries/LibGfx/Rect.cpp +++ b/Libraries/LibGfx/Rect.cpp @@ -24,8 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "Rect.h" #include +#include +#include namespace Gfx { diff --git a/Libraries/LibHTML/CSS/StyleDeclaration.h b/Libraries/LibHTML/CSS/StyleDeclaration.h index 52a0e8ddc7..ebe8a6d3ca 100644 --- a/Libraries/LibHTML/CSS/StyleDeclaration.h +++ b/Libraries/LibHTML/CSS/StyleDeclaration.h @@ -27,6 +27,7 @@ #pragma once #include +#include #include struct StyleProperty { diff --git a/Libraries/LibHTML/CSS/StyleValue.cpp b/Libraries/LibHTML/CSS/StyleValue.cpp index 591e8bdcaa..0a19807c81 100644 --- a/Libraries/LibHTML/CSS/StyleValue.cpp +++ b/Libraries/LibHTML/CSS/StyleValue.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.h b/Libraries/LibHTML/DOM/HTMLImageElement.h index 7035b1706d..345c32665c 100644 --- a/Libraries/LibHTML/DOM/HTMLImageElement.h +++ b/Libraries/LibHTML/DOM/HTMLImageElement.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include diff --git a/Libraries/LibIPC/Message.h b/Libraries/LibIPC/Message.h index a8f4bccd5b..73dc9c689d 100644 --- a/Libraries/LibIPC/Message.h +++ b/Libraries/LibIPC/Message.h @@ -26,7 +26,7 @@ #pragma once -#include +#include namespace IPC { diff --git a/Libraries/LibMarkdown/MDBlock.h b/Libraries/LibMarkdown/MDBlock.h index b22265f422..facceb359a 100644 --- a/Libraries/LibMarkdown/MDBlock.h +++ b/Libraries/LibMarkdown/MDBlock.h @@ -26,7 +26,7 @@ #pragma once -#include +#include class MDBlock { public: diff --git a/Servers/LookupServer/DNSRequest.h b/Servers/LookupServer/DNSRequest.h index ae42a0fe35..2b55dd75fb 100644 --- a/Servers/LookupServer/DNSRequest.h +++ b/Servers/LookupServer/DNSRequest.h @@ -27,9 +27,8 @@ #pragma once #include "DNSQuestion.h" -#include -#include #include +#include #define T_A 1 #define T_NS 2 diff --git a/Servers/ProtocolServer/Download.h b/Servers/ProtocolServer/Download.h index 360e407c47..4653d69eab 100644 --- a/Servers/ProtocolServer/Download.h +++ b/Servers/ProtocolServer/Download.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include diff --git a/Userland/chown.cpp b/Userland/chown.cpp index d5009dff24..54202c2f72 100644 --- a/Userland/chown.cpp +++ b/Userland/chown.cpp @@ -25,6 +25,7 @@ */ #include +#include #include #include #include @@ -69,7 +70,7 @@ int main(int argc, char** argv) if (!ok) { new_gid = getgrnam(parts[1].characters())->gr_gid; - if(!new_gid) { + if (!new_gid) { fprintf(stderr, "Invalid gid: '%s'\n", parts[1].characters()); return 1; }