#pragma once #include #include #include #include #include #include "loggable.h" #include "component.h" #include "taskmanager.h" class Collection : protected Loggable { public: class UnknownSource; class DuplicateSource; class DuplicatePath; Collection( const std::shared_ptr& logger, const std::shared_ptr& taskManager ); unsigned int sourcesTotal() const; unsigned int sourcesPending() const; unsigned int sourcesError() const; unsigned int sourcesSuccess() const; bool hasSource(const std::string& source) const; void addSource(const std::string& source); 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; std::set errorSources; std::set pendingSources; std::map> failedSources; std::map> downloadedSources; std::map> buildingSources; std::map> successSources; }; 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); };