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

LibraryMaps.h

Go to the documentation of this file.
00001 //
00002 // LibraryMaps.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 CLibrary;
00025 class CLibraryFile;
00026 class CQuerySearch;
00027 
00028 
00029 class CLibraryMaps : public CComObject
00030 {
00031 // Consturction
00032 public:
00033         CLibraryMaps();
00034         virtual ~CLibraryMaps();
00035 
00036         DECLARE_DYNAMIC(CLibraryMaps)
00037 
00038 // Attributes
00039 protected:
00040         CMapPtrToPtr            m_pIndexMap;
00041         CMapStringToOb          m_pNameMap;
00042         CMapStringToOb          m_pPathMap;
00043         CLibraryFile**          m_pSHA1Map;
00044         CLibraryFile**          m_pTigerMap;
00045         CLibraryFile**          m_pED2KMap;
00046         CPtrList                        m_pDeleted;
00047 protected:
00048         DWORD                           m_nNextIndex;
00049         DWORD                           m_nFiles;
00050         QWORD                           m_nVolume;
00051 
00052 // File Operations
00053 public:
00054         POSITION                GetFileIterator() const;
00055         CLibraryFile*   GetNextFile(POSITION& pos) const;
00056         int                             GetFileCount() const;
00057         void                    GetStatistics(DWORD* pnFiles, QWORD* pnVolume);
00058 public:
00059         CLibraryFile*   LookupFile(DWORD nIndex, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00060         CLibraryFile*   LookupFileByName(LPCTSTR pszName, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00061         CLibraryFile*   LookupFileByPath(LPCTSTR pszPath, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00062         CLibraryFile*   LookupFileByURN(LPCTSTR pszURN, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00063         CLibraryFile*   LookupFileBySHA1(const SHA1* pSHA1, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00064         CLibraryFile*   LookupFileByTiger(const TIGEROOT* pTiger, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00065         CLibraryFile*   LookupFileByED2K(const MD4* pED2K, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00066 protected:
00067         void                    Clear();
00068         DWORD                   AllocateIndex();
00069         void                    OnFileAdd(CLibraryFile* pFile);
00070         void                    OnFileRemove(CLibraryFile* pFile);
00071         void                    CullDeletedFiles(CLibraryFile* pMatch);
00072         CPtrList*               Search(CQuerySearch* pSearch, int nMaximum, BOOL bLocal);
00073         void                    Serialize1(CArchive& ar, int nVersion);
00074         void                    Serialize2(CArchive& ar, int nVersion);
00075 
00076 // COM
00077 protected:
00078         BEGIN_INTERFACE_PART(LibraryFiles, ILibraryFiles)
00079                 DECLARE_DISPATCH()
00080                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00081                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00082                 STDMETHOD(get__NewEnum)(IUnknown FAR* FAR* ppEnum);
00083                 STDMETHOD(get_Item)(VARIANT vIndex, ILibraryFile FAR* FAR* ppFile);
00084                 STDMETHOD(get_Count)(LONG FAR* pnCount);
00085         END_INTERFACE_PART(LibraryFiles)
00086 
00087         DECLARE_INTERFACE_MAP()
00088 
00089         friend class CLibrary;
00090         friend class CLibraryBuilder;
00091         friend class CLibraryFile;
00092 };
00093 
00094 extern CLibraryMaps LibraryMaps;

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