playlist/Plugin: pass InputStreamPtr&& to open_stream()
Obsolete class CloseSongEnumerator, which was a kludge.
This commit is contained in:
@@ -26,6 +26,11 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
TextInputStream::TextInputStream(InputStreamPtr &&_is)
|
||||
:is(std::move(_is)) {}
|
||||
|
||||
TextInputStream::~TextInputStream() {}
|
||||
|
||||
char *
|
||||
TextInputStream::ReadLine()
|
||||
{
|
||||
@@ -54,7 +59,7 @@ TextInputStream::ReadLine()
|
||||
--dest.size;
|
||||
|
||||
Error error;
|
||||
size_t nbytes = is.LockRead(dest.data, dest.size, error);
|
||||
size_t nbytes = is->LockRead(dest.data, dest.size, error);
|
||||
if (nbytes > 0)
|
||||
buffer.Append(nbytes);
|
||||
else if (error.IsDefined()) {
|
||||
|
@@ -20,12 +20,13 @@
|
||||
#ifndef MPD_TEXT_INPUT_STREAM_HXX
|
||||
#define MPD_TEXT_INPUT_STREAM_HXX
|
||||
|
||||
#include "input/Ptr.hxx"
|
||||
#include "util/StaticFifoBuffer.hxx"
|
||||
|
||||
class InputStream;
|
||||
|
||||
class TextInputStream {
|
||||
InputStream &is;
|
||||
InputStreamPtr is;
|
||||
StaticFifoBuffer<char, 4096> buffer;
|
||||
|
||||
public:
|
||||
@@ -35,12 +36,16 @@ public:
|
||||
*
|
||||
* @param _is an open #InputStream object
|
||||
*/
|
||||
explicit TextInputStream(InputStream &_is)
|
||||
:is(_is) {}
|
||||
explicit TextInputStream(InputStreamPtr &&_is);
|
||||
~TextInputStream();
|
||||
|
||||
TextInputStream(const TextInputStream &) = delete;
|
||||
TextInputStream& operator=(const TextInputStream &) = delete;
|
||||
|
||||
InputStreamPtr &&StealInputStream() {
|
||||
return std::move(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next line from the stream with newline character stripped.
|
||||
*
|
||||
|
Reference in New Issue
Block a user