diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-02 20:08:27 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-02 20:08:27 +0200 |
commit | 65cf7681a04f2511db8c7829e9828b53a6676c88 (patch) | |
tree | 6e7db509cf2bce4a10fa6d8bc89a9eae88d893fa /plugins | |
parent | 109c797d7c89223c9eed07dc322448b5c5fe3373 (diff) |
Convert to sfml, starting on manganelo and youtube
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Manganelo.hpp | 10 | ||||
-rw-r--r-- | plugins/Plugin.hpp | 38 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 10 |
3 files changed, 58 insertions, 0 deletions
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp new file mode 100644 index 0000000..fd56b85 --- /dev/null +++ b/plugins/Manganelo.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "Plugin.hpp" + +namespace QuickMedia { + class Manganelo : public Plugin { + public: + SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; + }; +}
\ No newline at end of file diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp new file mode 100644 index 0000000..bc518a8 --- /dev/null +++ b/plugins/Plugin.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include <string> +#include <vector> +#include <memory> + +namespace QuickMedia { + class BodyItem { + public: + BodyItem(const std::string &_title): title(_title) { + + } + + std::string title; + std::string cover_url; + }; + + enum class SearchResult { + OK, + ERR, + NET_ERR + }; + + enum class DownloadResult { + OK, + ERR, + NET_ERR + }; + + class Plugin { + public: + virtual ~Plugin() = default; + + virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) = 0; + protected: + DownloadResult download_to_string(const std::string &url, std::string &result); + }; +}
\ No newline at end of file diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp new file mode 100644 index 0000000..ea2918d --- /dev/null +++ b/plugins/Youtube.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "Plugin.hpp" + +namespace QuickMedia { + class Youtube : public Plugin { + public: + SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) override; + }; +}
\ No newline at end of file |