Zmiana metody kompresji na chunkowanie, zmiana nazwy z Void Archive na expak

This commit is contained in:
yanczi 2025-09-30 00:33:16 +02:00
parent f6150b0d17
commit aef8daae9b
15 changed files with 320 additions and 93 deletions

54
CompressingManager.h Normal file
View file

@ -0,0 +1,54 @@
#pragma once
#include <vector>
#include <cstdint>
#include <cstring>
#include <lz4.h>
#include <stdexcept>
#include <algorithm>
#include <iostream>
#define BLOCK_SIZE 131072 // 128KB
struct BlockSize
{
uint32_t raw;
uint32_t zip;
};
class CompressingManager
{
public:
CompressingManager();
~CompressingManager();
// Kompresja danych
std::vector<char> compress(const std::vector<char>&);
// Dekompresja
std::vector<char> decompress(const std::vector<char>&);
private:
std::vector<BlockSize> blockSizes;
// Przekonwertuj zmienn¹ na ci¹g na vector
template <typename T>
void addIntToVector(std::vector<char>& vec, const T& val)
{
size_t tmpSize = vec.size();
vec.resize(tmpSize + sizeof(val));
std::memcpy(vec.data() + tmpSize, &val, sizeof(val));
}
// Pobierz zmienn¹ z vectora
template <typename T>
T getIntFromVector(const std::vector<char>& vec, size_t& offset)
{
T tmp{};
std::memcpy(&tmp, vec.data() + offset, sizeof(tmp));
offset += sizeof(tmp);
return tmp;
}
};