some more thoughts of how to organize it better
This commit is contained in:
parent
02df7de0c3
commit
7b9112c0dd
8 changed files with 363 additions and 29 deletions
|
@ -6,13 +6,20 @@
|
|||
#include <set>
|
||||
#include <exception>
|
||||
|
||||
class Collection {
|
||||
#include "loggable.h"
|
||||
#include "component.h"
|
||||
#include "taskmanager.h"
|
||||
|
||||
class Collection : protected Loggable {
|
||||
public:
|
||||
class UnknownSource;
|
||||
class DuplicateSource;
|
||||
class DuplicatePath;
|
||||
|
||||
Collection();
|
||||
Collection(
|
||||
const std::shared_ptr<Logger>& logger,
|
||||
const std::shared_ptr<TaskManager>& taskManager
|
||||
);
|
||||
|
||||
unsigned int sourcesTotal() const;
|
||||
unsigned int sourcesPending() const;
|
||||
|
@ -21,13 +28,21 @@ public:
|
|||
|
||||
bool hasSource(const std::string& source) const;
|
||||
void addSource(const std::string& source);
|
||||
void sourceError(const std::string& source);
|
||||
void sourceSuccess(const std::string& source, const std::filesystem::path& path);
|
||||
|
||||
private:
|
||||
void sourceDownloadError(const std::string& source);
|
||||
void sourceBuildError(const std::string& source);
|
||||
void sourceDownaloded(const std::string& source);
|
||||
void sourceBuilt(const std::string& source);
|
||||
|
||||
private:
|
||||
std::shared_ptr<TaskManager> taskManager;
|
||||
std::set<std::string> errorSources;
|
||||
std::set<std::string> pendingSources;
|
||||
std::map<std::string, std::filesystem::path> successSources; //would be nice to have a bimap here
|
||||
std::map<std::string, std::unique_ptr<Component>> failedSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> downloadedSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> buildingSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> successSources;
|
||||
};
|
||||
|
||||
class Collection::UnknownSource : public std::runtime_error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue