1 /* 2 This file is part of the metalink program 3 Copyright (C) 2008 A. Bram Neijt <bneijt@gmail.com> 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 21 22 23 #include "MetalinkFile.ih" 24 finalize()25void MetalinkFile::finalize() 26 { 27 28 std::ostringstream record; 29 record << "\t<file name=\"" << Globals::XMLQuotedSafe(d_filename) << "\">\n"; 30 if(d_sizeSet) 31 record << "\t\t<size>" << d_size << "</size>\n"; 32 record << "\t\t<verification>\n"; 33 _foreach(v, d_vers) 34 { 35 record << "\t\t\t<hash type=\"" << v->first << "\">" 36 << v->second 37 << "</hash>\n"; 38 } 39 40 _foreach(v, d_verificationLines) 41 { 42 record << "\t\t\t" << (*v) << "\n"; 43 } 44 45 record << "\t\t</verification>\n"; 46 record << "\t\t<resources>\n"; 47 48 _foreach(mirror, *d_ml) 49 record << "\t\t\t" << mirror->asXMLWithFile(d_filename) << "\n"; 50 51 _foreach(p, d_paths) 52 record << "\t\t\t<url type=\"" << p->first << "\">" << Globals::XMLSafe(p->second) << "</url>\n"; 53 record << "\t\t</resources>\n"; 54 record << "\t</file>"; 55 assign(record.str()); 56 } 57