void Metalink4Writer::write_hashes(const MetalinkFile& file) { const std::vector<MetalinkHash>& hashes = file.get_file_hashes(); for(std::vector<MetalinkHash>::const_iterator i = hashes.begin(), eoi = hashes.end(); i != eoi; ++i) { start(wxT("hash")); add_attr(wxT("type"), (*i).type); end(wxT("hash"), (*i).value); } }
MetalinkFile Metalink3Writer::convert_hash_types(const MetalinkFile& file) { std::vector<MetalinkHash> hashes = file.get_file_hashes(); for(std::vector<MetalinkHash>::iterator i = hashes.begin(), eoi = hashes.end(); i != eoi; ++i) { (*i).type = convert_hash_type((*i).type); } wxString piece_type = convert_hash_type(file.get_piece_hash_type()); MetalinkFile file2 = file; file2.set_file_hashes(hashes); file2.set_piece_hash_type(piece_type); return file2; }
bool Metalink3Writer::has_hashes(const MetalinkFile& file) { return !file.get_file_hashes().empty(); }