mpd/src/io/Reader.hxx

32 lines
618 B
C++
Raw Normal View History

// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
2014-08-07 18:10:23 +02:00
2019-12-16 17:02:35 +01:00
#ifndef READER_HXX
#define READER_HXX
2014-08-07 18:10:23 +02:00
#include <cstddef>
2014-08-07 18:10:23 +02:00
/**
* An interface that can read bytes from a stream until the stream
* ends.
*
* This interface is simpler and less cumbersome to use than
* #InputStream.
*/
class Reader {
public:
Reader() = default;
Reader(const Reader &) = delete;
/**
* Read data from the stream.
*
* @return the number of bytes read into the given buffer or 0
* on end-of-stream
2014-08-07 18:10:23 +02:00
*/
2021-10-13 11:28:04 +02:00
[[gnu::nonnull]]
2021-12-07 11:49:59 +01:00
virtual std::size_t Read(void *data, std::size_t size) = 0;
2014-08-07 18:10:23 +02:00
};
#endif