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];
void * stream() const noexcept
Get the native stream handler.
StdError & operator=(const StdError &)=delete
virtual size_t Write(const void *buffer, size_t size)=0
Write a byte buffer base method.
void Flush() override
Flush the stream.
StdError(StdError &&stream)=delete
void swap(StdError &stream) noexcept
Swap two instances.
StdError(const StdError &)=delete
StdError & operator=(StdError &&stream)=delete
bool IsValid() const noexcept
Is stream valid?
StdOutput & operator=(StdOutput &&stream)=delete
void swap(StdOutput &stream) noexcept
Swap two instances.
StdOutput & operator=(const StdOutput &)=delete
virtual size_t Write(const void *buffer, size_t size)=0
Write a byte buffer base method.
StdOutput(const StdOutput &)=delete
void * stream() const noexcept
Get the native stream handler.
void Flush() override
Flush 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.