00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 class CLibrary;
00025 class CLibraryFile;
00026 class CQuerySearch;
00027
00028
00029 class CLibraryMaps : public CComObject
00030 {
00031
00032 public:
00033 CLibraryMaps();
00034 virtual ~CLibraryMaps();
00035
00036 DECLARE_DYNAMIC(CLibraryMaps)
00037
00038
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
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
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;