winamp/Src/external_dependencies/openmpt-trunk/include/ancient/src/IMPDecompressor.hpp

45 lines
1.4 KiB
C++
Raw Permalink Normal View History

2024-09-24 12:54:57 +00:00
/* Copyright (C) Teemu Suutari */
#ifndef IMPDECOMPRESSOR_HPP
#define IMPDECOMPRESSOR_HPP
#include "Decompressor.hpp"
#include "XPKDecompressor.hpp"
namespace ancient::internal
{
class IMPDecompressor : public Decompressor, public XPKDecompressor
{
public:
IMPDecompressor(const Buffer &packedData,bool verify);
IMPDecompressor(uint32_t hdr,uint32_t recursionLevel,const Buffer &packedData,std::shared_ptr<XPKDecompressor::State> &state,bool verify);
virtual ~IMPDecompressor();
virtual const std::string &getName() const noexcept override final;
virtual const std::string &getSubName() const noexcept override final;
virtual size_t getPackedSize() const noexcept override final;
virtual size_t getRawSize() const noexcept override final;
virtual void decompressImpl(Buffer &rawData,bool verify) override final;
virtual void decompressImpl(Buffer &rawData,const Buffer &previousData,bool verify) override final;
static bool detectHeader(uint32_t hdr) noexcept;
static bool detectHeaderXPK(uint32_t hdr) noexcept;
static std::shared_ptr<Decompressor> create(const Buffer &packedData,bool exactSizeKnown,bool verify);
static std::shared_ptr<XPKDecompressor> create(uint32_t hdr,uint32_t recursionLevel,const Buffer &packedData,std::shared_ptr<XPKDecompressor::State> &state,bool verify);
private:
const Buffer &_packedData;
uint32_t _rawSize=0;
uint32_t _endOffset=0;
bool _isXPK=false;
};
}
#endif