1 /* 2 * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 #pragma once 20 21 #include <string> 22 #include "forward.h" 23 #include "noexcept.h" 24 #include "Transfer.h" 25 #include "MerkleTree.h" 26 #include "Flags.h" 27 #include "Streams.h" 28 29 namespace dcpp { 30 31 using std::string; 32 33 /** 34 * Comes as an argument in the DownloadManagerListener functions. 35 * Use it to retrieve information about the ongoing transfer. 36 */ 37 class Download : public Transfer, public Flags { 38 public: 39 enum { 40 FLAG_ZDOWNLOAD = 1 << 1, 41 FLAG_TREE_TRIED = 1 << 2, 42 FLAG_TTH_CHECK = 1 << 3, 43 FLAG_XML_BZ_LIST = 1 << 4, 44 FLAG_OVERLAP = 0x100 45 }; 46 47 Download(UserConnection& conn, QueueItem& qi, const string& path, bool supportsTrees) noexcept; 48 49 virtual void getParams(const UserConnection& aSource, StringMap& params); 50 51 virtual ~Download(); 52 53 /** @return Target filename without path. */ 54 string getTargetFileName(); 55 56 /** @internal */ getDownloadTarget()57 const string& getDownloadTarget() { 58 return (getTempTarget().empty() ? getPath() : getTempTarget()); 59 } 60 61 /** @internal */ getTigerTree()62 TigerTree& getTigerTree() { return tt; } getPFS()63 string& getPFS() { return pfs; } 64 /** @internal */ 65 AdcCommand getCommand(bool zlib); 66 67 GETSET(string, tempTarget, TempTarget); 68 GETSET(OutputStream*, file, File); 69 GETSET(bool, treeValid, TreeValid); 70 private: 71 Download(const Download&); 72 Download& operator=(const Download&); 73 74 TigerTree tt; 75 string pfs; 76 }; 77 78 } // namespace dcpp 79