Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

DownloadWithSources.h

Go to the documentation of this file.
00001 //
00002 // DownloadWithSources.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #if !defined(AFX_DOWNLOADWITHSOURCES_H__D6932F45_0557_4098_B2F3_AE35BC43ECC0__INCLUDED_)
00023 #define AFX_DOWNLOADWITHSOURCES_H__D6932F45_0557_4098_B2F3_AE35BC43ECC0__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "DownloadBase.h"
00028 
00029 class CDownloadSource;
00030 class CQueryHit;
00031 class CXMLElement;
00032 
00033 
00034 class CDownloadWithSources : public CDownloadBase
00035 {
00036 // Construction
00037 public:
00038         CDownloadWithSources();
00039         virtual ~CDownloadWithSources();
00040         
00041 // Attributes
00042 protected:
00043         CDownloadSource*        m_pSourceFirst;
00044         CDownloadSource*        m_pSourceLast;
00045         int                                     m_nSourceCount;
00046 public:
00047         CStringList                     m_pFailedSources;
00048         CXMLElement*            m_pXML;
00049 
00050 // Operations
00051 public:
00052         CString                         GetSourceURLs(CStringList* pState, int nMaximum, PROTOCOLID nProtocol, CDownloadSource* pExcept);
00053         int                                     GetSourceCount(BOOL bNoPush = FALSE, BOOL bSane = FALSE) const;
00054         int                                     GetBTSourceCount(BOOL bNoPush = FALSE) const;
00055         int                                     GetED2KCompleteSourceCount() const;
00056         BOOL                            CheckSource(CDownloadSource* pSource) const;
00057         void                            ClearSources();
00058 public:
00059         BOOL                            AddSourceHit(CQueryHit* pHit, BOOL bForce = FALSE);
00060         BOOL                            AddSourceED2K(DWORD nClientID, WORD nClientPort, DWORD nServerIP, WORD nServerPort, GGUID* pGUID = NULL);
00061         BOOL                            AddSourceBT(SHA1* pGUID, IN_ADDR* pAddress, WORD nPort);
00062         BOOL                            AddSourceURL(LPCTSTR pszURL, BOOL bURN = FALSE, FILETIME* pLastSeen = NULL);
00063         int                                     AddSourceURLs(LPCTSTR pszURLs, BOOL bURN = FALSE);
00064         virtual BOOL            OnQueryHits(CQueryHit* pHits);
00065         virtual void            Serialize(CArchive& ar, int nVersion);
00066 
00067 // Implementation
00068 protected:
00069         BOOL            AddSourceInternal(CDownloadSource* pSource);
00070         void            RemoveSource(CDownloadSource* pSource, BOOL bBan);
00071         void            SortSource(CDownloadSource* pSource, BOOL bTop);
00072         void            SortSource(CDownloadSource* pSource);
00073 protected:
00074         void            RemoveOverlappingSources(QWORD nOffset, QWORD nLength);
00075         int                     GetSourceColour();
00076 
00077 // Inlines
00078 public:
00079         inline CDownloadSource* GetFirstSource() const
00080         {
00081                 return m_pSourceFirst;
00082         }
00083         
00084         friend class CDownloadSource;
00085         friend class CDownloadTransfer;
00086 };
00087 
00088 #endif // !defined(AFX_DOWNLOADWITHSOURCES_H__D6932F45_0557_4098_B2F3_AE35BC43ECC0__INCLUDED_)

Generated on Thu Dec 15 10:39:41 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2