/* * This file Copyright (C) Mnemosyne LLC * * It may be used under the GNU GPL versions 2 or 3 * or any future license endorsed by Mnemosyne LLC. * */ #pragma once #include #include #include #include "transmission.h" #include "announce-list.h" struct tr_error; struct tr_variant; class tr_magnet_metainfo { public: bool parseMagnet(std::string_view magnet_link, tr_error** error = nullptr); std::string magnet() const; auto const& infoHash() const { return info_hash_; } auto const& name() const { return name_; } auto webseedCount() const { return std::size(webseed_urls_); } auto const& webseed(size_t i) const { return webseed_urls_[i]; } auto& announceList() { return announce_list_; } auto const& announceList() const { return announce_list_; } std::string const& infoHashString() const { return info_hash_str_; } void setName(std::string_view name) { name_ = name; } protected: tr_announce_list announce_list_; std::vector webseed_urls_; tr_sha1_digest_t info_hash_; std::string info_hash_str_; std::string name_; };