コード例 #1
0
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);
    }
}
コード例 #2
0
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;
}
コード例 #3
0
bool Metalink3Writer::has_hashes(const MetalinkFile& file)
{
    return !file.get_file_hashes().empty();
}