Refactor visitors into separate files

This also includes some small improvements that I don't remember right now
This commit is contained in:
King_DuckZ 2025-04-05 19:59:21 +01:00
commit 72d52860f6
8 changed files with 323 additions and 202 deletions

View file

@ -4,12 +4,15 @@
#include <boost/spirit/home/x3/support/ast/variant.hpp>
#include <map>
#include <vector>
#include <array>
#include <cstdint>
namespace duck {
typedef std::string_view TorrentStringType;
typedef long long int TorrentIntType;
struct TorrentValue : public boost::spirit::x3::variant<
long long,
TorrentIntType,
TorrentStringType,
boost::spirit::x3::forward_ast< std::vector<TorrentValue> >,
boost::spirit::x3::forward_ast< std::map<TorrentStringType, TorrentValue> >
@ -19,5 +22,6 @@ struct TorrentValue : public boost::spirit::x3::variant<
};
std::vector<TorrentValue> parse_torrent (std::string_view binary_data);
std::vector<std::array<std::uint32_t, 5>> collect_hashes (std::string_view hashes);
std::vector<std::array<std::uint32_t, 5>> collect_hashes (const std::vector<TorrentValue>& values);
} //namespace duck