RemoteEnumIDList.h

Go to the documentation of this file.
00001 /*  Declaration of remote folder contents enumerator via IEnumIDList interface
00002 
00003     Copyright (C) 2007  Alexander Lamaison <awl03@doc.ic.ac.uk>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 */
00019 
00020 #ifndef REMOTEENUMIDLIST_H
00021 #define REMOTEENUMIDLIST_H
00022 
00023 #if _MSC_VER > 1000
00024 #pragma once
00025 #endif // _MSC_VER > 1000
00026 
00027 #include "stdafx.h"
00028 #include "resource.h"       // main symbols
00029 
00030 #include "RemoteFolder.h"   // For back-reference to parent folder
00031 
00032 struct FILEDATA
00033 {
00034         BOOL fIsFolder;
00035         CString strPath;
00036         CString strOwner;
00037         CString strGroup;
00038         CString strAuthor;
00039 
00040         ULONGLONG uSize; // 64-bit allows files up to 16 Ebibytes (a lot)
00041         time_t dtModified;
00042         DWORD dwPermissions;
00043 };
00044 
00045 
00046 // IRemoteEnumIDList
00047 [
00048         object,
00049         uuid("b816a83d-5022-11dc-9153-0090f5284f85"),
00050         helpstring("IRemoteEnumIDList Interface"),
00051         pointer_default(unique)
00052 ]
00053 __interface IRemoteEnumIDList : IUnknown
00054 {
00055 };
00056 
00057 
00058 // CRemoteEnumIDList
00059 [
00060         coclass,
00061         default(IRemoteEnumIDList),
00062         threading(apartment),
00063         vi_progid("Swish.RemoteEnumIDList"),
00064         progid("Swish.RemoteEnumIDList.1"),
00065         version(1.0),
00066         uuid("b816a83e-5022-11dc-9153-0090f5284f85"),
00067         helpstring("RemoteEnumIDList Class")
00068 ]
00069 class ATL_NO_VTABLE CRemoteEnumIDList :
00070         public IRemoteEnumIDList,
00071         public IEnumIDList
00072 {
00073 public:
00074         CRemoteEnumIDList() : m_pFolder(NULL), m_iPos(0)
00075         {
00076         }
00077 
00078         ~CRemoteEnumIDList()
00079         {
00080                 ATLASSERT(m_pFolder);
00081 
00082                 // Release folder that should have been incremented in BindToFolder
00083                 if (m_pFolder)
00084                         m_pFolder->Release();
00085         }
00086 
00087         DECLARE_PROTECT_FINAL_CONSTRUCT()
00088         HRESULT FinalConstruct()
00089         {
00090                 return S_OK;
00091         }
00092         void FinalRelease()
00093         {
00094         }
00095 
00096         HRESULT BindToFolder( CRemoteFolder* pFolder );
00097         HRESULT Connect( PCWSTR szUser, PCWSTR szHost, PCWSTR szPath, UINT uPort );
00098 
00099     // IEnumIDList
00100     IFACEMETHODIMP Next(
00101                 ULONG celt,
00102                 __out_ecount_part(celt, *pceltFetched) PITEMID_CHILD *rgelt,
00103                 __out_opt ULONG *pceltFetched );
00104     IFACEMETHODIMP Skip( DWORD celt );
00105     IFACEMETHODIMP Reset();
00106     IFACEMETHODIMP Clone( __deref_out IEnumIDList **ppenum );
00107 
00108 private:
00109         CRemoteFolder* m_pFolder;
00110         std::vector<FILEDATA> m_vListing;
00111         ULONG m_iPos; // Current position
00112     CRemotePidlManager m_PidlManager;
00113 };
00114 
00115 #endif // REMOTEENUMIDLIST_H

Generated on Mon Nov 12 22:43:53 2007 for Swish by  doxygen 1.5.3