2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2014-07-30 19:10:28 +02:00
|
|
|
|
2018-07-19 14:02:37 +02:00
|
|
|
#ifndef STDIO_OUTPUT_STREAM_HXX
|
|
|
|
#define STDIO_OUTPUT_STREAM_HXX
|
2014-07-30 19:10:28 +02:00
|
|
|
|
|
|
|
#include "OutputStream.hxx"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
class StdioOutputStream final : public OutputStream {
|
|
|
|
FILE *const file;
|
|
|
|
|
|
|
|
public:
|
2019-01-22 09:03:35 +01:00
|
|
|
explicit StdioOutputStream(FILE *_file) noexcept:file(_file) {}
|
2014-07-30 19:10:28 +02:00
|
|
|
|
|
|
|
/* virtual methods from class OutputStream */
|
2023-05-15 11:00:21 +02:00
|
|
|
void Write(std::span<const std::byte> src) override {
|
|
|
|
fwrite(src.data(), 1, src.size(), file);
|
2014-07-30 19:10:28 +02:00
|
|
|
|
|
|
|
/* this class is debug-only and ignores errors */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|