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

CollectionFile.h

Go to the documentation of this file.
00001 //
00002 // CollectionFile.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 #pragma once
00023 
00024 class CZIPFile;
00025 class CXMLElement;
00026 class CLibraryFile;
00027 
00028 
00029 class CCollectionFile : public CComObject
00030 {
00031 // Construction
00032 public:
00033         CCollectionFile();
00034         virtual ~CCollectionFile();
00035         DECLARE_DYNAMIC(CCollectionFile)
00036 
00037 // Member File Class
00038 public:
00039         class File
00040         {
00041         // Construction
00042         public:
00043                 File(CCollectionFile* pParent);
00044                 ~File();
00045 
00046         // Attributes
00047         public:
00048                 CCollectionFile*        m_pParent;
00049                 BOOL                            m_bSHA1;
00050                 SHA1                            m_pSHA1;
00051                 BOOL                            m_bMD5;
00052                 MD5                                     m_pMD5;
00053                 BOOL                            m_bTiger;
00054                 TIGEROOT                        m_pTiger;
00055                 BOOL                            m_bED2K;
00056                 MD4                                     m_pED2K;
00057         public:
00058                 CString                         m_sName;
00059                 QWORD                           m_nSize;
00060                 CXMLElement*            m_pMetadata;
00061                 CString                         m_sSource;
00062 
00063         // Operations
00064         public:
00065                 BOOL    Parse(CXMLElement* pXML);
00066                 BOOL    IsComplete() const;
00067                 BOOL    IsDownloading() const;
00068                 BOOL    Download();
00069                 BOOL    ApplyMetadata(CLibraryFile* pShared);
00070 
00071         };
00072 
00073 // Operations
00074 public:
00075         BOOL            Open(LPCTSTR pszFile);
00076         BOOL            Attach(HANDLE hFile);
00077         void            Close();
00078 public:
00079         File*           FindByURN(LPCTSTR pszURN);
00080         File*           FindFile(CLibraryFile* pShared, BOOL bApply = FALSE);
00081         int                     GetMissingCount();
00082 protected:
00083         BOOL            LoadManifest(CZIPFile& pZIP);
00084         static CXMLElement* CloneMetadata(CXMLElement* pMetadata);
00085 
00086 // Attributes
00087 protected:
00088         CPtrList                m_pFiles;
00089         CString                 m_sTitle;
00090         CString                 m_sThisURI;
00091         CString                 m_sParentURI;
00092         CXMLElement*    m_pMetadata;
00093 
00094 // Inlines
00095 public:
00096         inline BOOL IsOpen() const
00097         {
00098                 return ( m_pFiles.GetCount() > 0 );
00099         }
00100 
00101         inline POSITION GetFileIterator() const
00102         {
00103                 return m_pFiles.GetHeadPosition();
00104         }
00105 
00106         inline File* GetNextFile(POSITION& pos) const
00107         {
00108                 return (File*)m_pFiles.GetNext( pos );
00109         }
00110 
00111         inline int GetFileCount() const
00112         {
00113                 return m_pFiles.GetCount();
00114         }
00115 
00116         inline CString GetTitle() const
00117         {
00118                 return m_sTitle;
00119         }
00120 
00121         inline CString GetThisURI() const
00122         {
00123                 return m_sThisURI;
00124         }
00125 
00126         inline CString GetParentURI() const
00127         {
00128                 return m_sParentURI;
00129         }
00130 
00131         inline CXMLElement* GetMetadata() const
00132         {
00133                 return m_pMetadata;
00134         }
00135 };

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