some more refactor

This commit is contained in:
Blue 2023-09-26 14:36:40 -03:00
parent cdaf94e3cd
commit d30e6ed759
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 111 additions and 32 deletions

View file

@ -6,6 +6,7 @@
#include <set>
#include <exception>
#include <string_view>
#include <regex>
#include "loggable.h"
#include "component.h"
@ -16,11 +17,8 @@ class Collection : protected Loggable {
using Sources = std::set<std::string>;
using Downloads = std::map<std::string, std::unique_ptr<Download>>;
using Components = std::map<std::string, std::unique_ptr<Component>>;
public:
class UnknownSource;
class DuplicateSource;
class DuplicatePath;
public:
Collection(
const std::filesystem::path& destination,
const std::string& target,
@ -41,7 +39,7 @@ private:
void sourceRead(const std::string& source, TaskManager::Error err);
void sourceBuilt(const std::string& source, TaskManager::Error err);
bool isRemote(const std::string& source);
static bool isRemote(const std::string& source);
void queueDownload(const std::string& source);
void queueRead(const std::string& source, const std::filesystem::path& location);
@ -56,18 +54,3 @@ private:
Components readingSources;
Components buildingSources;
};
class Collection::UnknownSource : public std::runtime_error {
public:
explicit UnknownSource(const std::string& source);
};
class Collection::DuplicateSource : public std::runtime_error {
public:
explicit DuplicateSource(const std::string& source);
};
class Collection::DuplicatePath : public std::runtime_error {
public:
explicit DuplicatePath(const std::string& source, const std::filesystem::path& path);
};