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

Library.h

Go to the documentation of this file.
00001 //
00002 // Library.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_LIBRARY_H__28EBDAFA_BD15_4BBF_874D_1B6116B0E603__INCLUDED_)
00023 #define AFX_LIBRARY_H__28EBDAFA_BD15_4BBF_874D_1B6116B0E603__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CQuerySearch;
00028 class CLibraryFile;
00029 class CLibraryFolder;
00030 class CAlbumFolder;
00031 
00032 
00033 class CLibrary : public CComObject
00034 {
00035 // Construction
00036 public:
00037         CLibrary();
00038         virtual ~CLibrary();
00039 
00040         DECLARE_DYNAMIC(CLibrary)
00041 
00042 // Attributes
00043 public:
00044         CMutex                  m_pSection;
00045         DWORD                   m_nUpdateCookie;
00046         DWORD                   m_nScanCount;
00047 protected:
00048         DWORD                   m_nScanCookie;
00049         DWORD                   m_nUpdateSaved;
00050         int                             m_nFileSwitch;
00051         DWORD                   m_nInhibit;
00052 protected:
00053         HANDLE                  m_hThread;
00054         BOOL                    m_bThread;
00055         CEvent                  m_pWakeup;
00056 public:
00057         HINSTANCE               m_hKernel;
00058         BOOL                    (WINAPI* m_pfnGFAEW)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
00059         BOOL                    (WINAPI* m_pfnGFAEA)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
00060 
00061 // Sync Operations
00062 public:
00063         void                    Update()
00064         {
00065                 CQuickLock oLock( m_pSection );
00066                 m_nUpdateCookie = GetTickCount();
00067         }
00068         void                    Inhibit(BOOL bInhibit);
00069 
00070 // File and Folder Operations
00071 public:
00072         CLibraryFile*   LookupFile(DWORD nIndex, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00073         CAlbumFolder*   GetAlbumRoot();
00074 protected:
00075         void                    AddFile(CLibraryFile* pFile);
00076         void                    RemoveFile(CLibraryFile* pFile);
00077         void                    OnFileDelete(CLibraryFile* pFile);
00078 
00079 // General Operations
00080 public:
00081         CPtrList*               Search(CQuerySearch* pSearch, int nMaximum = 0, BOOL bLocal = FALSE);
00082         void                    Clear();
00083         BOOL                    Load();
00084         void                    Save();
00085         void                    StartThread();
00086         void                    StopThread();
00087 protected:
00088         void                    Serialize(CArchive& ar);
00089 private:
00090         static UINT             ThreadStart(LPVOID pParam);
00091         void                    OnRun();
00092         BOOL                    ThreadScan();
00093 
00094         friend class CLibraryFolder;
00095         friend class CLibraryFile;
00096         friend class CLibraryBuilder;
00097 
00098 // Automation
00099 protected:
00100         BEGIN_INTERFACE_PART(Library, ILibrary)
00101                 DECLARE_DISPATCH()
00102                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00103                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00104                 STDMETHOD(get_Folders)(ILibraryFolders FAR* FAR* ppFolders);
00105                 STDMETHOD(get_Albums)(IUnknown FAR* FAR* ppAlbums);
00106                 STDMETHOD(get_Files)(ILibraryFiles FAR* FAR* ppFiles);
00107                 STDMETHOD(FindByName)(BSTR sName, ILibraryFile FAR* FAR* ppFile);
00108                 STDMETHOD(FindByPath)(BSTR sPath, ILibraryFile FAR* FAR* ppFile);
00109                 STDMETHOD(FindByURN)(BSTR sURN, ILibraryFile FAR* FAR* ppFile);
00110                 STDMETHOD(FindByIndex)(LONG nIndex, ILibraryFile FAR* FAR* ppFile);
00111         END_INTERFACE_PART(Library)
00112 
00113         DECLARE_INTERFACE_MAP()
00114 
00115 };
00116 
00117 extern CLibrary Library;
00118 
00119 #include "LibraryList.h"
00120 #include "LibraryMaps.h"
00121 
00122 #endif // !defined(AFX_LIBRARY_H__28EBDAFA_BD15_4BBF_874D_1B6116B0E603__INCLUDED_)

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