aboutsummaryrefslogtreecommitdiff
path: root/plugins/Plugin.hpp
blob: 1427233bac2daa03e5001f4ec6a94cc4c029f83f (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include "../include/Body.hpp"
#include "../include/DownloadUtils.hpp"
#include <stddef.h>
#include <string>

namespace QuickMedia {
    enum class PluginResult {
        OK,
        ERR,
        NET_ERR
    };

    enum class SearchResult {
        OK,
        ERR,
        NET_ERR
    };

    enum class SuggestionResult {
        OK,
        ERR,
        NET_ERR
    };

    enum class ImageResult {
        OK,
        END,
        ERR,
        NET_ERR
    };

    struct BodyItemImageContext {
        BodyItems *body_items;
        size_t index;
    };

    void html_escape_sequences(std::string &str);
    void html_unescape_sequences(std::string &str);
    std::string url_param_encode(const std::string &param);

    SuggestionResult download_result_to_suggestion_result(DownloadResult download_result);
    PluginResult download_result_to_plugin_result(DownloadResult download_result);
    SearchResult download_result_to_search_result(DownloadResult download_result);
    ImageResult download_result_to_image_result(DownloadResult download_result);
}