mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
CIODevice: Add a virtual did_update_fd() no notify subclasses of fd change.
This will allow subclasses to react when the file descriptor changes.
This commit is contained in:
parent
8ed078e5b2
commit
8f4fba95c0
Notes:
sideshowbarker
2024-07-19 13:02:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8f4fba95c0f
2 changed files with 12 additions and 1 deletions
|
@ -241,3 +241,12 @@ int CIODevice::printf(const char* format, ...)
|
|||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CIODevice::set_fd(int fd)
|
||||
{
|
||||
if (m_fd == fd)
|
||||
return;
|
||||
|
||||
m_fd = fd;
|
||||
did_update_fd(fd);
|
||||
}
|
||||
|
|
|
@ -56,11 +56,13 @@ public:
|
|||
protected:
|
||||
explicit CIODevice(CObject* parent = nullptr);
|
||||
|
||||
void set_fd(int fd) { m_fd = fd; }
|
||||
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; }
|
||||
|
||||
virtual void did_update_fd(int) {}
|
||||
|
||||
private:
|
||||
bool populate_read_buffer();
|
||||
bool can_read_from_fd() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue