| 1 |
/* |
| 2 |
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2023 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 14 июн. 2018 г. |
| 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_IO_STRINWRITER_H_ |
| 23 |
#define LSP_PLUG_IN_IO_STRINWRITER_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/io/IOutSequence.h> |
| 27 |
|
| 28 |
namespace lsp |
| 29 |
{ |
| 30 |
namespace io |
| 31 |
{ |
| 32 |
class OutStringSequence: public IOutSequence |
| 33 |
{ |
| 34 |
private: |
| 35 |
LSPString *pOut; |
| 36 |
bool bDelete; |
| 37 |
|
| 38 |
public: |
| 39 |
explicit OutStringSequence(); |
| 40 |
explicit OutStringSequence(LSPString *out, bool del = false); |
| 41 |
OutStringSequence(const OutStringSequence &) = delete; |
| 42 |
OutStringSequence(OutStringSequence &&) = delete; |
| 43 |
virtual ~OutStringSequence() override; |
| 44 |
|
| 45 |
OutStringSequence & operator = (const OutStringSequence &) = delete; |
| 46 |
OutStringSequence & operator = (OutStringSequence &&) = delete; |
| 47 |
|
| 48 |
public: |
| 49 |
status_t wrap(LSPString *out, bool del); |
| 50 |
|
| 51 |
public: |
| 52 |
virtual status_t write(lsp_wchar_t c) override; |
| 53 |
virtual status_t write(const lsp_wchar_t *c, size_t count) override; |
| 54 |
virtual status_t write_ascii(const char *s) override; |
| 55 |
virtual status_t write_ascii(const char *s, size_t count) override; |
| 56 |
virtual status_t writeln_ascii(const char *s) override; |
| 57 |
virtual status_t write(const LSPString *s) override; |
| 58 |
virtual status_t write(const LSPString *s, ssize_t first) override; |
| 59 |
virtual status_t write(const LSPString *s, ssize_t first, ssize_t last) override; |
| 60 |
virtual status_t flush() override; |
| 61 |
virtual status_t close() override; |
| 62 |
}; |
| 63 |
|
| 64 |
} /* namespace io */ |
| 65 |
} /* namespace lsp */ |
| 66 |
|
| 67 |
#endif /* LSP_PLUG_IN_IO_STRINWRITER_H_ */ |