Continue work on png writer.

This commit is contained in:
James Grogan 2022-11-23 17:51:36 +00:00
parent 9c8faa534b
commit 86bc0d89f6
19 changed files with 225 additions and 19 deletions

View file

@ -32,9 +32,23 @@ std::ofstream* File::GetOutHandle() const
return mOutHandle.get();
}
unsigned char File::readNextByte()
std::optional<unsigned char> File::readNextByte()
{
return mInHandle->get();
if (mInHandle->good())
{
if (auto val = mInHandle->get(); val == EOF)
{
return std::nullopt;
}
else
{
return val;
}
}
else
{
return std::nullopt;
}
}
void File::Open(bool asBinary)

View file

@ -7,6 +7,7 @@
#include <fstream>
#include <memory>
#include <vector>
#include <optional>
using Path = std::filesystem::path;
@ -48,7 +49,7 @@ public:
void Close();
unsigned char readNextByte();
std::optional<unsigned char> readNextByte();
private: