Add a read_announce_list() to TorrentRead

announce-list is very annoyingly a list of lists. I don't
have any useful primitive to manage that case in TorrentRead,
so for now I've done a not-so-elegant implementation where I
step around the visitor, use my knowledge of the variant and
access the outer list directly through boost::get(). I'm not
necessarily convinced that this is bad since on the other hand
the solution consistent with the rest of the implementation
would involve searching for "/[[x]]/[[y]]" which has its own
overhead. I mean, variant contains a vector, I can access it
normally. Visitor is a convenience thing, I don't see why
parser's client code should be obliged to pretend the variant
cannot be accessed directly.
This commit is contained in:
King_DuckZ 2025-04-07 02:39:35 +01:00
commit d04b4d8274
3 changed files with 61 additions and 20 deletions

View file

@ -55,6 +55,7 @@ public:
std::string_view read_hashes() const;
std::string_view read_created_by() const;
std::string_view read_announce() const;
std::vector<std::vector<std::string_view>> read_announce_list() const;
std::time_t read_creation_date() const;
private: