diff options
Diffstat (limited to 'backend/pkgtools.cpp')
| -rw-r--r-- | backend/pkgtools.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/backend/pkgtools.cpp b/backend/pkgtools.cpp index 58a752f..80dc4d8 100644 --- a/backend/pkgtools.cpp +++ b/backend/pkgtools.cpp @@ -12,6 +12,8 @@ module; #include <glib-object.h> #include <string> #include <regex> +#include <forward_list> +#include <filesystem> export module katja.pkgtools; @@ -19,6 +21,8 @@ import katja.utils; export namespace katja { +using cache_entry = std::pair<std::string, std::filesystem::path>; + class Pkgtools { public: @@ -160,7 +164,7 @@ public: sqlite3_finalize(statement); } - virtual GSList *collect_cache_info (const char *tmpl) noexcept = 0; + virtual std::forward_list<cache_entry> collect_cache_info(const char *tmpl) noexcept = 0; virtual void generate_cache(JobData *job_data, const char *tmpl) noexcept = 0; protected: @@ -170,10 +174,11 @@ protected: /** * katja::cmp_repo: **/ -int cmp_repo(const void *a, const void *b) +template<class InputIt> +InputIt cmp_repo(InputIt first, InputIt last, const char *a) { - auto repo = static_cast<const Pkgtools *> (a); - - return g_strcmp0(repo->name.c_str(), (char *) b); + return std::find_if(first, last, [a](std::unique_ptr<Pkgtools>& repo) { + return repo->name == a; + }); } } |
