22 lines
398 B
C++
22 lines
398 B
C++
#include "files.h"
|
|
|
|
Files::Files() {
|
|
}
|
|
|
|
void Files::addNewFile(std::shared_ptr<File> file) {
|
|
Hash hash = file->createHash();
|
|
|
|
// find first matching file
|
|
for(uint32_t i = 0; i < files.size(); ++i) {
|
|
MergeFile& mf = files.at(i);
|
|
|
|
if(mf.addFile(file, std::move(hash))) {
|
|
// successfully added
|
|
return;
|
|
}
|
|
}
|
|
|
|
// no suitable mergefile found
|
|
files.emplace_back(file, std::move(hash));
|
|
}
|