Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
IOutputStream.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstddef>
6#include <optional>
7#include <string_view>
8
9namespace ph
10{
11
13{
14public:
19 virtual void write(std::size_t numBytes, const std::byte* bytes) = 0;
20
25 virtual void writeString(std::string_view str) = 0;
26
31 virtual void seekPut(std::size_t pos) = 0;
32
37 virtual std::optional<std::size_t> tellPut() = 0;
38
42 operator bool () const override = 0;
43
50 virtual std::size_t writeSome(std::size_t numBytes, const std::byte* bytes);
51
57 void writeLine(std::string_view str);
58};
59
60// In-header Implementations:
61
62inline std::size_t IOutputStream::writeSome(const std::size_t numBytes, const std::byte* out_bytes)
63{
64 write(numBytes, out_bytes);
65 return numBytes;
66}
67
68inline void IOutputStream::writeLine(std::string_view str)
69{
70 writeString(str);
71 writeString("\n");
72}
73
74}// end namespace ph
Definition IDataStream.h:9
Definition IOutputStream.h:13
virtual std::size_t writeSome(std::size_t numBytes, const std::byte *bytes)
Write some data in the form of raw bytes. The method may return before finish writing all bytes....
Definition IOutputStream.h:62
virtual void write(std::size_t numBytes, const std::byte *bytes)=0
Write data in the form of raw bytes in one go. The method does not return before finishing the writin...
void writeLine(std::string_view str)
Write a line. Equivalent to calling writeString(std::string_view) with ' ' as an extra character.
Definition IOutputStream.h:68
virtual std::optional< std::size_t > tellPut()=0
Get the current output position of the stream. The unit of the position is defined by the implementat...
virtual void seekPut(std::size_t pos)=0
Set the output position of the stream. The unit of the position is defined by the implementation.
virtual void writeString(std::string_view str)=0
Write a string in one go.
The root for all renderer implementations.
Definition EEngineProject.h:6