aboutsummaryrefslogtreecommitdiff
path: root/plugins/Manga.hpp
blob: 13c494ed784d8e6384f861b8ef7f4dcb9f3a5099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "Plugin.hpp"
#include <functional>
#include <mutex>

namespace QuickMedia {
    // Return false to stop iteration
    using PageCallback = std::function<bool(const std::string &url)>;

    struct Creator {
        std::string name;
        std::string url;
    };

    class Manga : public Plugin {
    public:
        Manga(const std::string &plugin_name) : Plugin(plugin_name) {}
        bool is_manga() override { return true; }
        virtual ImageResult get_number_of_images(const std::string &url, int &num_images) = 0;
        virtual ImageResult for_each_page_in_chapter(const std::string &chapter_url, PageCallback callback) = 0;
        virtual bool extract_id_from_url(const std::string &url, std::string &manga_id) = 0;

        virtual PluginResult get_creators_manga_list(const std::string &url, BodyItems &result_items) { (void)url; (void)result_items; return {}; }

        const std::vector<Creator>& get_creators() const;
    protected:
        std::vector<Creator> creators;
    };
}