Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode
.vs
30 changes: 30 additions & 0 deletions include/Bootil/Utility/Compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

namespace Bootil
{
namespace Threads
{
class Thread;
}

namespace Compression
{
class BOOTIL_EXPORT Job
Expand All @@ -15,6 +20,12 @@ namespace Bootil
virtual float GetProgress() = 0;
};

class BOOTIL_EXPORT ThreadedJob : public Job
{
public:
virtual void Join() = 0;
};

//
// You can use this class to get progress when extracting.
// Return false in OnProgress to cancel the process
Expand All @@ -26,6 +37,13 @@ namespace Bootil
virtual bool OnProgress( float fPercent, unsigned int iDataSize, unsigned int iDataProcessed ) = 0;
};

class BOOTIL_EXPORT OutputFile
{
public:
virtual int Write(const void* pData, unsigned int iLenght) = 0;
virtual void End(bool success) = 0;
};

namespace FastLZ
{
BOOTIL_EXPORT bool Is( const void* pData, unsigned int iLength );
Expand All @@ -45,6 +63,18 @@ namespace Bootil
BOOTIL_EXPORT Job* ExtractInThread( const void* pData, unsigned int iLength, const Bootil::BString & strOutputFile );
}

namespace BZIP2
{
BOOTIL_EXPORT bool Compress(void* pData, unsigned int iLength, Bootil::Buffer& output, int iLevel = 8, int iWorkFactor = 30, ProgressCallback* pProgress = NULL);
BOOTIL_EXPORT bool Compress(void* pData, unsigned int iLength, OutputFile* output, int iLevel = 8, int iWorkFactor = 30, ProgressCallback* pProgress = NULL);

BOOTIL_EXPORT bool Extract(void* pData, unsigned int iLength, Bootil::Buffer& output, bool small = false, ProgressCallback* pProgress = NULL);
BOOTIL_EXPORT bool Extract(void* pData, unsigned int iLength, OutputFile* output, bool small = false, ProgressCallback* pProgress = NULL);

BOOTIL_EXPORT ThreadedJob* CompressInThread(void* pData, unsigned int iLength, OutputFile* output, int iLevel = 8, int iWorkFactor = 30);
BOOTIL_EXPORT ThreadedJob* ExtractInThread(void* pData, unsigned int iLength, OutputFile* output, bool small = false);
}

namespace GZip
{
BOOTIL_EXPORT bool Compress( const void* pData, unsigned int iLength, Bootil::Buffer & output );
Expand Down
Loading