LibCore+LibIPC: Move various encode/decode specializations to LibIPC

This removes a dependency on LibIPC from LibCore.
This commit is contained in:
rmg-x 2025-06-13 18:20:29 -05:00 committed by Tim Flynn
commit a4d931d14a
Notes: github-actions[bot] 2025-06-14 20:04:39 +00:00
7 changed files with 22 additions and 34 deletions

View file

@ -7,7 +7,6 @@
#include <AK/Try.h> #include <AK/Try.h>
#include <LibCore/AnonymousBuffer.h> #include <LibCore/AnonymousBuffer.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibIPC/File.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>

View file

@ -12,7 +12,6 @@
#include <AK/RefCounted.h> #include <AK/RefCounted.h>
#include <AK/RefPtr.h> #include <AK/RefPtr.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <LibIPC/Forward.h>
namespace Core { namespace Core {
@ -75,13 +74,3 @@ private:
}; };
} }
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Core::AnonymousBuffer const&);
template<>
ErrorOr<Core::AnonymousBuffer> decode(Decoder&);
}

View file

@ -8,7 +8,6 @@
#include <AK/ByteString.h> #include <AK/ByteString.h>
#include <AK/StringView.h> #include <AK/StringView.h>
#include <LibIPC/Forward.h>
#include <time.h> #include <time.h>
namespace Core { namespace Core {
@ -107,13 +106,3 @@ struct Formatter<Core::DateTime> : StandardFormatter {
}; };
} }
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Core::DateTime const&);
template<>
ErrorOr<Core::DateTime> decode(Decoder&);
}

View file

@ -49,6 +49,8 @@ class TimeZoneWatcher;
class UDPServer; class UDPServer;
class UDPSocket; class UDPSocket;
struct ProxyData;
enum class TimerShouldFireWhenNotVisible; enum class TimerShouldFireWhenNotVisible;
#ifdef AK_OS_MACH #ifdef AK_OS_MACH

View file

@ -9,7 +9,6 @@
#include <AK/Error.h> #include <AK/Error.h>
#include <AK/IPv4Address.h> #include <AK/IPv4Address.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <LibIPC/Forward.h>
#include <LibURL/URL.h> #include <LibURL/URL.h>
namespace Core { namespace Core {
@ -48,13 +47,3 @@ struct ProxyData {
}; };
} }
namespace IPC {
template<>
ErrorOr<void> encode(Encoder&, Core::ProxyData const&);
template<>
ErrorOr<Core::ProxyData> decode(Decoder&);
}

View file

@ -17,6 +17,7 @@
#include <AK/Try.h> #include <AK/Try.h>
#include <AK/TypeList.h> #include <AK/TypeList.h>
#include <AK/Variant.h> #include <AK/Variant.h>
#include <LibCore/Forward.h>
#include <LibCore/SharedCircularQueue.h> #include <LibCore/SharedCircularQueue.h>
#include <LibCore/Socket.h> #include <LibCore/Socket.h>
#include <LibIPC/Concepts.h> #include <LibIPC/Concepts.h>
@ -117,6 +118,15 @@ ErrorOr<File> decode(Decoder&);
template<> template<>
ErrorOr<Empty> decode(Decoder&); ErrorOr<Empty> decode(Decoder&);
template<>
ErrorOr<Core::AnonymousBuffer> decode(Decoder&);
template<>
ErrorOr<Core::DateTime> decode(Decoder&);
template<>
ErrorOr<Core::ProxyData> decode(Decoder&);
template<Concepts::Array T> template<Concepts::Array T>
ErrorOr<T> decode(Decoder& decoder) ErrorOr<T> decode(Decoder& decoder)
{ {

View file

@ -11,6 +11,7 @@
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <AK/StdLibExtras.h> #include <AK/StdLibExtras.h>
#include <AK/Variant.h> #include <AK/Variant.h>
#include <LibCore/Forward.h>
#include <LibCore/SharedCircularQueue.h> #include <LibCore/SharedCircularQueue.h>
#include <LibIPC/Concepts.h> #include <LibIPC/Concepts.h>
#include <LibIPC/File.h> #include <LibIPC/File.h>
@ -116,6 +117,15 @@ ErrorOr<void> encode(Encoder&, File const&);
template<> template<>
ErrorOr<void> encode(Encoder&, Empty const&); ErrorOr<void> encode(Encoder&, Empty const&);
template<>
ErrorOr<void> encode(Encoder&, Core::AnonymousBuffer const&);
template<>
ErrorOr<void> encode(Encoder&, Core::DateTime const&);
template<>
ErrorOr<void> encode(Encoder&, Core::ProxyData const&);
template<Concepts::Span T> template<Concepts::Span T>
ErrorOr<void> encode(Encoder& encoder, T const& span) ErrorOr<void> encode(Encoder& encoder, T const& span)
{ {