mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-21 17:51:52 +00:00
LibCore: Rename CFileStreamReader => CIODeviceStreamReader.
This commit is contained in:
parent
c869d62e16
commit
0f3d191a70
Notes:
sideshowbarker
2024-07-19 12:59:21 +09:00
Author: https://github.com/awesomekling
Commit: 0f3d191a70
2 changed files with 9 additions and 9 deletions
|
@ -1,31 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibCore/CFile.h>
|
||||
|
||||
class CFileStreamReader {
|
||||
public:
|
||||
CFileStreamReader(CFile& file)
|
||||
: m_file(file)
|
||||
{
|
||||
}
|
||||
|
||||
bool handle_read_failure()
|
||||
{
|
||||
return exchange(m_had_failure, false);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CFileStreamReader& operator>>(T& value)
|
||||
{
|
||||
int nread = m_file.read((u8*)&value, sizeof(T));
|
||||
ASSERT(nread == sizeof(T));
|
||||
if (nread != sizeof(T))
|
||||
m_had_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
CFile& m_file;
|
||||
bool m_had_failure { false };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue