9#ifndef CPPCOMMON_SYSTEM_STREAM_H
10#define CPPCOMMON_SYSTEM_STREAM_H
36 explicit operator bool() const noexcept {
return IsValid(); }
39 void*
stream() const noexcept;
50 size_t Read(
void* buffer,
size_t size) override;
63 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
64 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
66 static const size_t StorageSize = 8;
67 static const size_t StorageAlign = 8;
68 alignas(StorageAlign) std::byte _storage[StorageSize];
87 explicit operator bool() const noexcept {
return IsValid(); }
90 void*
stream() const noexcept;
101 size_t Write(const
void* buffer,
size_t size) override;
106 void Flush() override;
115 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
116 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
118 static const size_t StorageSize = 8;
119 static const size_t StorageAlign = 8;
120 alignas(StorageAlign) std::byte _storage[StorageSize];
139 explicit operator bool()
const {
return IsValid(); }
142 void*
stream() const noexcept;
153 size_t Write(const
void* buffer,
size_t size) override;
158 void Flush() override;
167 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
168 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
170 static const size_t StorageSize = 8;
171 static const size_t StorageAlign = 8;
172 alignas(StorageAlign) std::byte _storage[StorageSize];
size_t Write(const void *buffer, size_t size) override
Write a byte buffer into the stream.
void * stream() const noexcept
Get the native stream handler.
StdError & operator=(StdError &&stream)=delete
void Flush() override
Flush the stream.
friend void swap(StdError &stream1, StdError &stream2) noexcept
StdError(StdError &&stream)=delete
StdError & operator=(const StdError &)=delete
StdError(const StdError &)=delete
bool IsValid() const noexcept
Is stream valid?
StdOutput & operator=(const StdOutput &)=delete
StdOutput(const StdOutput &)=delete
void * stream() const noexcept
Get the native stream handler.
friend void swap(StdOutput &stream1, StdOutput &stream2) noexcept
void Flush() override
Flush the stream.
StdOutput & operator=(StdOutput &&stream)=delete
size_t Write(const void *buffer, size_t size) override
Write a byte buffer into the stream.
StdOutput(StdOutput &&stream)=delete
bool IsValid() const noexcept
Is stream valid?
C++ Common project definitions.
Reader interface definition.
Standard input/output/error stream inline implementation.
Writer interface definition.