ladybird/Userland/Libraries/LibCore/LocalServer.h
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

40 lines
899 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/Notifier.h>
#include <LibCore/Object.h>
#include <LibCore/Stream.h>
namespace Core {
class LocalServer : public Object {
C_OBJECT(LocalServer)
public:
virtual ~LocalServer() override;
ErrorOr<void> take_over_from_system_server(DeprecatedString const& path = DeprecatedString());
bool is_listening() const { return m_listening; }
bool listen(DeprecatedString const& address);
ErrorOr<NonnullOwnPtr<Stream::LocalSocket>> accept();
Function<void(NonnullOwnPtr<Stream::LocalSocket>)> on_accept;
Function<void(Error)> on_accept_error;
private:
explicit LocalServer(Object* parent = nullptr);
void setup_notifier();
int m_fd { -1 };
bool m_listening { false };
RefPtr<Notifier> m_notifier;
};
}