mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Add a forward declaration header
You can now #include <AK/Forward.h> to get most of the AK types as forward declarations. Header dependency explosion is one of the main contributors to compile times at the moment, so this is a step towards smaller include graphs.
This commit is contained in:
parent
8249e666fc
commit
3bbf4610d2
Notes:
sideshowbarker
2024-07-19 09:20:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3bbf4610d24
35 changed files with 178 additions and 53 deletions
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
|
109
AK/Forward.h
Normal file
109
AK/Forward.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* 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<typename T>
|
||||
class SinglyLinkedList;
|
||||
|
||||
template<typename T>
|
||||
class DoublyLinkedList;
|
||||
|
||||
template<typename T>
|
||||
class InlineLinkedList;
|
||||
|
||||
template<typename T, int capacity>
|
||||
class CircularQueue;
|
||||
|
||||
template<typename T>
|
||||
class Badge;
|
||||
|
||||
template<typename T>
|
||||
class FixedArray;
|
||||
|
||||
template<typename>
|
||||
class Function;
|
||||
|
||||
template<typename Out, typename... In>
|
||||
class Function<Out(In...)>;
|
||||
|
||||
template<typename T>
|
||||
class NonnullRefPtr;
|
||||
|
||||
template<typename T>
|
||||
class NonnullOwnPtr;
|
||||
|
||||
template<typename T>
|
||||
class RefPtr;
|
||||
|
||||
template<typename T>
|
||||
class OwnPtr;
|
||||
|
||||
template<typename T>
|
||||
class WeakPtr;
|
||||
|
||||
template<typename T, int inline_capacity = 0>
|
||||
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;
|
|
@ -26,10 +26,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/NetworkOrdered.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
typedef u32 in_addr_t;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/IPv4Address.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
|
@ -33,10 +34,6 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
class JsonArray;
|
||||
class JsonObject;
|
||||
class StringBuilder;
|
||||
|
||||
class JsonValue {
|
||||
public:
|
||||
enum class Type {
|
||||
|
|
|
@ -112,4 +112,10 @@ DebugLogStream dbg()
|
|||
return stream;
|
||||
}
|
||||
|
||||
DebugLogStream::~DebugLogStream()
|
||||
{
|
||||
char newline = '\n';
|
||||
write(&newline, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <stdarg.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
#include <inttypes.h>
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringImpl.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <stdarg.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
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 };
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
|
|
@ -26,14 +26,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
class ByteBuffer;
|
||||
class String;
|
||||
class StringImpl;
|
||||
|
||||
class StringView {
|
||||
public:
|
||||
StringView() {}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Utf8View.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/kmalloc.h>
|
||||
|
@ -44,9 +45,6 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
template<typename T, int inline_capacity>
|
||||
class Vector;
|
||||
|
||||
template<typename VectorType, typename ElementType>
|
||||
class VectorIterator {
|
||||
public:
|
||||
|
@ -132,7 +130,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template<typename T, int inline_capacity = 0>
|
||||
template<typename T, int inline_capacity>
|
||||
class Vector {
|
||||
public:
|
||||
Vector()
|
||||
|
|
|
@ -26,13 +26,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
|
||||
class HexEditor : public GUI::ScrollableWidget {
|
||||
C_OBJECT(HexEditor)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <grp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
// Has to be defined before including due to legacy Unices
|
||||
#define SYSLOG_NAMES 1
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibELF/ELFDynamicObject.h>
|
||||
#include <LibELF/ELFImage.h>
|
||||
#include <LibELF/exec_elf.h>
|
||||
#include <mman.h>
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibELF/ELFDynamicObject.h>
|
||||
#include <LibELF/ELFImage.h>
|
||||
#include <LibELF/exec_elf.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define ALIGN_ROUND_UP(x, align) ((((size_t)(x)) + align - 1) & (~(align - 1)))
|
||||
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibELF/ELFDynamicObject.h>
|
||||
#include <LibELF/exec_elf.h>
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static const char* name_for_dtag(Elf32_Sword d_tag);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <LibBareMetal/Memory/VirtualAddress.h>
|
||||
#include <LibELF/exec_elf.h>
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ProgressBar.h>
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibGfx/CharacterBitmap.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/StylePainter.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ScrollBar.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/CharacterBitmap.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/StylePainter.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Shortcut.h>
|
||||
|
||||
namespace GUI {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/NetworkOrdered.h>
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Color.h"
|
||||
#include "Point.h"
|
||||
#include "Rect.h"
|
||||
#include "Size.h"
|
||||
#include <AK/String.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
#include <LibGfx/TextElision.h>
|
||||
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "Rect.h"
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
|
||||
struct StyleProperty {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/PNGLoader.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
#include <LibHTML/DOM/HTMLElement.h>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace IPC {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
class MDBlock {
|
||||
public:
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "DNSQuestion.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
#define T_A 1
|
||||
#define T_NS 2
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue