1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibCore: Make IODevice::can_read_line() const

This also makes LibHTTP's Job::can_read_line() const, as IODevice was
keeping that from being const.
Fixes #2219
This commit is contained in:
AnotherTest 2020-05-15 10:45:09 +04:30 committed by Andreas Kling
parent 5386508119
commit 3485613f4a
7 changed files with 15 additions and 17 deletions

View file

@ -73,7 +73,7 @@ void HttpJob::register_on_ready_to_write(Function<void()> callback)
callback();
}
bool HttpJob::can_read_line()
bool HttpJob::can_read_line() const
{
return m_socket->can_read_line();
}

View file

@ -53,7 +53,7 @@ public:
protected:
virtual void register_on_ready_to_read(Function<void()>) override;
virtual void register_on_ready_to_write(Function<void()>) override;
virtual bool can_read_line() override;
virtual bool can_read_line() const override;
virtual ByteBuffer read_line(size_t) override;
virtual bool can_read() const override;
virtual ByteBuffer receive(size_t) override;

View file

@ -104,7 +104,7 @@ void HttpsJob::register_on_ready_to_write(Function<void()> callback)
};
}
bool HttpsJob::can_read_line()
bool HttpsJob::can_read_line() const
{
return m_socket->can_read_line();
}

View file

@ -53,7 +53,7 @@ public:
protected:
virtual void register_on_ready_to_read(Function<void()>) override;
virtual void register_on_ready_to_write(Function<void()>) override;
virtual bool can_read_line() override;
virtual bool can_read_line() const override;
virtual ByteBuffer read_line(size_t) override;
virtual bool can_read() const override;
virtual ByteBuffer receive(size_t) override;

View file

@ -51,8 +51,7 @@ protected:
void on_socket_connected();
virtual void register_on_ready_to_read(Function<void()>) = 0;
virtual void register_on_ready_to_write(Function<void()>) = 0;
// FIXME: I want const but Core::IODevice::can_read_line populates a cache with this
virtual bool can_read_line() = 0;
virtual bool can_read_line() const = 0;
virtual ByteBuffer read_line(size_t) = 0;
virtual bool can_read() const = 0;
virtual ByteBuffer receive(size_t) = 0;