| 1 |
/* |
| 2 |
* Copyright (C) 2022 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2022 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 20 окт. 2022 г. |
| 7 |
* |
| 8 |
* lsp-runtime-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-runtime-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_FMT_LSPC_CHUNKWRITERSTREAM_H_ |
| 23 |
#define LSP_PLUG_IN_FMT_LSPC_CHUNKWRITERSTREAM_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/io/IOutStream.h> |
| 27 |
|
| 28 |
namespace lsp |
| 29 |
{ |
| 30 |
namespace lspc |
| 31 |
{ |
| 32 |
class ChunkWriter; |
| 33 |
|
| 34 |
class ChunkWriterStream: public io::IOutStream |
| 35 |
{ |
| 36 |
private: |
| 37 |
ChunkWriterStream & operator = (const ChunkWriterStream &); |
| 38 |
|
| 39 |
private: |
| 40 |
ChunkWriter *pWriter; |
| 41 |
bool bDelete; |
| 42 |
|
| 43 |
private: |
| 44 |
void do_close(); |
| 45 |
|
| 46 |
public: |
| 47 |
ChunkWriterStream(ChunkWriter *writer, bool free = false); |
| 48 |
virtual ~ChunkWriterStream(); |
| 49 |
|
| 50 |
public: |
| 51 |
virtual wssize_t position() override; |
| 52 |
virtual ssize_t write(const void *buf, size_t count) override; |
| 53 |
virtual ssize_t writeb(int v) override; |
| 54 |
virtual status_t flush() override; |
| 55 |
virtual status_t close() override; |
| 56 |
}; |
| 57 |
|
| 58 |
} /* namespace lspc */ |
| 59 |
} /* namespace lsp */ |
| 60 |
|
| 61 |
// Definition of lsp::lspc::ChunkWriter |
| 62 |
#include <lsp-plug.in/fmt/lspc/ChunkWriter.h> |
| 63 |
|
| 64 |
#endif /* LSP_PLUG_IN_FMT_LSPC_CHUNKWRITERSTREAM_H_ */ |