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

SharedFolder.h

Go to the documentation of this file.
00001 //
00002 // SharedFolder.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_SHAREDFOLDER_H__3538DA5D_21AB_428B_90C7_E1BE8F1B927E__INCLUDED_)
00023 #define AFX_SHAREDFOLDER_H__3538DA5D_21AB_428B_90C7_E1BE8F1B927E__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CLibraryFile;
00028 class CLibraryList;
00029 
00030 
00031 class CLibraryFolder : public CComObject
00032 {
00033 // Construction
00034 public:
00035         CLibraryFolder(CLibraryFolder* pParent, LPCTSTR pszPath = NULL);
00036         virtual ~CLibraryFolder();
00037 
00038         DECLARE_DYNAMIC(CLibraryFolder)
00039 
00040 // Attributes
00041 public:
00042         DWORD                   m_nScanCookie;
00043         DWORD                   m_nUpdateCookie;
00044         DWORD                   m_nSelectCookie;
00045 public:
00046         CLibraryFolder* m_pParent;
00047         CString                 m_sName;
00048         CString                 m_sNameLC;
00049         CString                 m_sPath;
00050         TRISTATE                m_bShared;
00051         BOOL                    m_bExpanded;
00052         DWORD                   m_nFiles;
00053         QWORD                   m_nVolume;
00054 public:
00055         CMapStringToOb  m_pFolders;
00056         CMapStringToOb  m_pFiles;
00057         HANDLE                  m_hMonitor;
00058         BOOL                    m_bMonitor;
00059 
00060 // Operations
00061 public:
00062         POSITION                GetFolderIterator() const;
00063         CLibraryFolder* GetNextFolder(POSITION& pos) const;
00064         CLibraryFolder* GetFolderByName(LPCTSTR pszName) const;
00065         CLibraryFolder* GetFolderByPath(LPCTSTR pszPath) const;
00066         BOOL                    CheckFolder(CLibraryFolder* pFolder, BOOL bRecursive = FALSE) const;
00067         int                             GetFolderCount() const;
00068 public:
00069         POSITION                GetFileIterator() const;
00070         CLibraryFile*   GetNextFile(POSITION& pos) const;
00071         CLibraryFile*   GetFile(LPCTSTR pszName) const;
00072         int                             GetFileCount() const;
00073         int                             GetFileList(CLibraryList* pList, BOOL bRecursive) const;
00074         int                             GetSharedCount() const;
00075 public:
00076         void                    Scan();
00077         BOOL                    IsShared();
00078 protected:
00079         void                    Serialize(CArchive& ar, int nVersion);
00080         BOOL                    ThreadScan(DWORD nScanCookie = 0);
00081         BOOL                    SetMonitor();
00082         BOOL                    CheckMonitor();
00083         void                    OnDelete();
00084         void                    OnFileRename(CLibraryFile* pFile);
00085         void                    Clear();
00086         void                    PathToName();
00087 
00088         friend class CLibrary;
00089         friend class CLibraryFolders;
00090         friend class CLibraryFile;
00091 
00092 // Automation
00093 protected:
00094         BEGIN_INTERFACE_PART(LibraryFolder, ILibraryFolder)
00095                 DECLARE_DISPATCH()
00096                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00097                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00098                 STDMETHOD(get_Parent)(ILibraryFolder FAR* FAR* ppFolder);
00099                 STDMETHOD(get_Path)(BSTR FAR* psPath);
00100                 STDMETHOD(get_Name)(BSTR FAR* psPath);
00101                 STDMETHOD(get_Shared)(STRISTATE FAR* pnValue);
00102                 STDMETHOD(put_Shared)(STRISTATE nValue);
00103                 STDMETHOD(get_EffectiveShared)(VARIANT_BOOL FAR* pbValue);
00104                 STDMETHOD(get_Folders)(ILibraryFolders FAR* FAR* ppFolders);
00105                 STDMETHOD(get_Files)(ILibraryFiles FAR* FAR* ppFiles);
00106         END_INTERFACE_PART(LibraryFolder)
00107         BEGIN_INTERFACE_PART(LibraryFolders, ILibraryFolders)
00108                 DECLARE_DISPATCH()
00109                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00110                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00111                 STDMETHOD(get__NewEnum)(IUnknown FAR* FAR* ppEnum);
00112                 STDMETHOD(get_Item)(VARIANT vIndex, ILibraryFolder FAR* FAR* ppFolder);
00113                 STDMETHOD(get_Count)(LONG FAR* pnCount);
00114         END_INTERFACE_PART(LibraryFolders)
00115         BEGIN_INTERFACE_PART(LibraryFiles, ILibraryFiles)
00116                 DECLARE_DISPATCH()
00117                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00118                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00119                 STDMETHOD(get__NewEnum)(IUnknown FAR* FAR* ppEnum);
00120                 STDMETHOD(get_Item)(VARIANT vIndex, ILibraryFile FAR* FAR* ppFile);
00121                 STDMETHOD(get_Count)(LONG FAR* pnCount);
00122         END_INTERFACE_PART(LibraryFiles)
00123 
00124         DECLARE_INTERFACE_MAP()
00125 };
00126 
00127 #endif // !defined(AFX_SHAREDFOLDER_H__3538DA5D_21AB_428B_90C7_E1BE8F1B927E__INCLUDED_)

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