Files
Aerofoil/unpacktool/DecompressorProxyReader.cpp

46 lines
781 B
C++
Raw Normal View History

2020-05-09 21:05:58 -04:00
#include "DecompressorProxyReader.h"
#include "IDecompressor.h"
DecompressorProxyReader::DecompressorProxyReader(IDecompressor *decompressor)
: m_decompressor(decompressor)
, m_currentPosition(0)
{
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
size_t DecompressorProxyReader::Read(void *buffer, size_t sz)
{
if (!m_decompressor->ReadBytes(buffer, sz))
return 0;
m_currentPosition += sz;
2020-10-19 17:45:45 -04:00
return sz;
2020-05-09 21:05:58 -04:00
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
size_t DecompressorProxyReader::FileSize() const
{
2020-10-19 17:45:45 -04:00
return 0;
2020-05-09 21:05:58 -04:00
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
bool DecompressorProxyReader::SeekStart(FilePos_t pos)
{
2020-10-19 17:45:45 -04:00
return pos == m_currentPosition;
2020-05-09 21:05:58 -04:00
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
bool DecompressorProxyReader::SeekCurrent(FilePos_t pos)
{
2020-10-19 17:45:45 -04:00
return pos == 0;
2020-05-09 21:05:58 -04:00
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
bool DecompressorProxyReader::SeekEnd(FilePos_t pos)
{
2020-10-19 17:45:45 -04:00
return false;
2020-05-09 21:05:58 -04:00
}
2020-10-19 17:45:45 -04:00
2020-05-09 21:05:58 -04:00
IFileReader::FilePos_t DecompressorProxyReader::GetPosition() const
{
return m_currentPosition;
}