blob: 3afd1f4b48e45178d0504c9bdd8095e36fb0af49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* Copyright (c) 2023, Tim Schumacher <timschumi@gmx.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/MaybeOwned.h>
#include <AK/Stream.h>
namespace AK {
class CountingStream : public Stream {
public:
CountingStream(MaybeOwned<Stream>);
u64 read_bytes() const;
virtual ErrorOr<Bytes> read_some(Bytes) override;
virtual ErrorOr<void> discard(size_t discarded_bytes) override;
virtual ErrorOr<size_t> write_some(ReadonlyBytes) override;
virtual bool is_eof() const override;
virtual bool is_open() const override;
virtual void close() override;
private:
MaybeOwned<Stream> m_stream;
u64 m_read_bytes { 0 };
};
}
|