1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:27:35 +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

@ -65,8 +65,7 @@ public:
bool write(const u8*, int size);
bool write(const StringView&);
// FIXME: I would like this to be const but currently it needs to call populate_read_buffer().
bool can_read_line();
bool can_read_line() const;
bool can_read() const;
@ -88,20 +87,20 @@ protected:
void set_fd(int);
void set_mode(OpenMode mode) { m_mode = mode; }
void set_error(int error) { m_error = error; }
void set_eof(bool eof) { m_eof = eof; }
void set_error(int error) const { m_error = error; }
void set_eof(bool eof) const { m_eof = eof; }
virtual void did_update_fd(int) {}
virtual void did_update_fd(int) { }
private:
bool populate_read_buffer();
bool populate_read_buffer() const;
bool can_read_from_fd() const;
int m_fd { -1 };
int m_error { 0 };
bool m_eof { false };
OpenMode m_mode { NotOpen };
Vector<u8> m_buffered_data;
mutable int m_error { 0 };
mutable bool m_eof { false };
mutable Vector<u8> m_buffered_data;
};
}