Continue work on png writer.
This commit is contained in:
parent
9c8faa534b
commit
86bc0d89f6
19 changed files with 225 additions and 19 deletions
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue