dedup/inc/mergefile.h

29 lines
675 B
C
Raw Permalink Normal View History

2022-10-21 19:39:55 +02:00
#pragma once
2022-10-22 00:43:34 +02:00
#include <memory>
2022-10-21 19:39:55 +02:00
#include <vector>
#include "file.h"
#include "hash.h"
// eine liste an gleichen Dateien, die gemerged werden sollen
class MergeFile {
public:
2022-10-22 00:43:34 +02:00
MergeFile(std::shared_ptr<File> file, Hash&& h);
2022-10-21 19:39:55 +02:00
2022-10-22 00:43:34 +02:00
const Hash& getHash() const;
2022-10-21 19:39:55 +02:00
2022-10-22 00:43:34 +02:00
// try to add a file, returns true on success
bool addFile(std::shared_ptr<File> f, const Hash& h);
std::vector<std::shared_ptr<File>>& getFiles();
const std::vector<std::shared_ptr<File>>& getFiles() const;
// make sure the main file, which should be the base for the other files is stored at the begin of the vector
void updateMainFile();
2022-10-21 19:39:55 +02:00
private:
std::vector<std::shared_ptr<File>> files;
Hash hash;
};