CRemotePidlManager Class Reference

#include <RemotePidlManager.h>

Inheritance diagram for CRemotePidlManager:

CPidlManager

List of all members.

Public Member Functions

HRESULT Create (LPCWSTR pwszPath, LPCWSTR pwszOwner, LPCWSTR pwszGroup, DWORD dwPermissions, ULONGLONG uSize, time_t dtModified, BOOL fIsFolder, PITEMID_CHILD *ppidlOut)
 Create a new terminated PIDL using the passed-in file information.
PREMOTEPIDL Validate (PCIDLIST_RELATIVE)
 Validate that pidl is a REMOTEPIDL and return correctly typecast.
HRESULT IsValid (PCIDLIST_RELATIVE)
 Check if the fingerprint stored in the PIDL corresponds to a REMOTEPIDL.
CString GetPath (LPCITEMIDLIST pidl)
 Get the path of the file from a (possibly multilevel) PIDL.
CString GetOwner (LPCITEMIDLIST pidl)
 Get the name of the file's owner from a (possibly multilevel) PIDL.
CString GetGroup (LPCITEMIDLIST pidl)
 Get the name of the file's group name from a (possibly multilevel) PIDL.
DWORD GetPermissions (LPCITEMIDLIST pidl)
 Get the Unix file permissions from a (possibly multilevel) PIDL.
CString GetPermissionsStr (LPCITEMIDLIST pidl)
 Get the Unix file permissions in typical drwxrwxrwx form from a PIDL.
ULONGLONG GetFileSize (LPCITEMIDLIST pidl)
 Get the file's size from a (possibly multilevel) PIDL.
CTime GetLastModified (LPCITEMIDLIST pidl)
 Get the time and date that the file was last changed from a PIDL.
BOOL IsFolder (LPCITEMIDLIST pidl)
 Determine if the file represented by the PIDL is actually a folder.

Private Member Functions

PREMOTEPIDL GetDataSegment (LPCITEMIDLIST pidl)
 Walk to last item in PIDL (if multilevel) and return item as a REMOTEPIDL.


Detailed Description

Definition at line 51 of file RemotePidlManager.h.


Member Function Documentation

HRESULT CRemotePidlManager::Create ( LPCWSTR  pwszPath,
LPCWSTR  pwszOwner,
LPCWSTR  pwszGroup,
DWORD  dwPermissions,
ULONGLONG  uSize,
time_t  dtModified,
BOOL  fIsFolder,
PITEMID_CHILD *  ppidlOut 
)

Create a new terminated PIDL using the passed-in file information.

Parameters:
[in] pwszPath Path of the file on the remote file-system
[in] pwszOwner Name of the file owner on the remote system
[in] pwszGroup Name of the file group on the remote system
[in] dwPermissions Value of the file's Unix permissions bits
[in] uSize Size of the file in bytes
[in] dtModified Date that the file was last modified as a Unix timestamp
[in] fIsFolder Indicates if the file is folder
[out] ppidlOut Location that the resultant PIDL should be stored at
Returns:
Whether the PIDL was successfully created
Return values:
S_OK if PIDL successful created at location ppidlOut
E_OUTOFMEMORY otherwise

Definition at line 41 of file RemotePidlManager.cpp.

References REMOTEPIDL::cb, CPidlManager::CopyWSZString(), CPidlManager::GetNextItem(), IsValid(), and REMOTEPIDL_FINGERPRINT.

Referenced by CRemoteEnumIDList::Next().

PREMOTEPIDL CRemotePidlManager::Validate ( PCIDLIST_RELATIVE  pidl  ) 

Validate that pidl is a REMOTEPIDL and return correctly typecast.

Parameters:
pidl PIDL to be validated
Returns:
Whether pidl is a valid REMOTEPIDL
Return values:
pidl as a REMOTEPIDL if fingerprint matches REMOTEPIDL_FINGERPRINT
NULL otherwise
or if the function is being used as a simple boolean check
true if fingerprint matches REMOTEPIDL_FINGERPRINT
false otherwise
Namespace extensions are heavily dependent on passing around various types of PIDL (relative, absolute, single-level, multi-level, created by us, created by others). Being very primitive structures, they are not inherently type-safe and therefore it is sensible to check that a PIDL we are about to use is what we expect it to be.

Validate() checks that pidl is a REMOTEPIDL by comparing its stored fingerprint with that which it should have given when created. If validation succeeds, pidl is returned appropriately typecast giving easy access to fields of REMOTEPIDL.

Warning:
This is not a debug-only function. If the checking should only be performed at runtime, it should be wrapped in another debug function:
 ATLASSERT(Validate(pidl)); 
See also:
IsValid() | REMOTEPIDL

Definition at line 114 of file RemotePidlManager.cpp.

References REMOTEPIDL_FINGERPRINT.

Referenced by GetDataSegment(), and IsValid().

HRESULT CRemotePidlManager::IsValid ( PCIDLIST_RELATIVE  pidl  ) 

Check if the fingerprint stored in the PIDL corresponds to a REMOTEPIDL.

Parameters:
pidl PIDL to be validated
Returns:
Whether pidl is a valid REMOTEPIDL
Return values:
S_OK if pidl is of type REMOTEPIDL
E_INVALIDARG otherwise
This function is very similar to Validate() except that a standard COM success code is returned rather than a PIDL or a boolean.

See also:
Validate() | REMOTEPIDL

Definition at line 143 of file RemotePidlManager.cpp.

References Validate().

Referenced by Create(), and GetDataSegment().

CString CRemotePidlManager::GetPath ( LPCITEMIDLIST  pidl  ) 

Get the path of the file from a (possibly multilevel) PIDL.

Parameters:
pidl The PIDL from which to retrieve the path
Returns:
The path of the file as a CString or an empty CString if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the path from is the last item before the terminator.

Definition at line 160 of file RemotePidlManager.cpp.

References GetDataSegment().

CString CRemotePidlManager::GetOwner ( LPCITEMIDLIST  pidl  ) 

Get the name of the file's owner from a (possibly multilevel) PIDL.

Parameters:
pidl The PIDL from which to retrieve the name
Returns:
The file owner's username as a CString or an empty CString if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the name from is the last item before the terminator.

Definition at line 178 of file RemotePidlManager.cpp.

References GetDataSegment().

CString CRemotePidlManager::GetGroup ( LPCITEMIDLIST  pidl  ) 

Get the name of the file's group name from a (possibly multilevel) PIDL.

Parameters:
pidl The PIDL from which to retrieve the name
Returns:
The file's group name as a CString or an empty CString if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the name from is the last item before the terminator.

Definition at line 196 of file RemotePidlManager.cpp.

References GetDataSegment().

DWORD CRemotePidlManager::GetPermissions ( LPCITEMIDLIST  pidl  ) 

Get the Unix file permissions from a (possibly multilevel) PIDL.

Parameters:
pidl The PIDL from which to retrieve the permissions
Returns:
The file's Unix permissions as a numeric value or 0 if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the permissions from is the last item before the terminator.

Definition at line 214 of file RemotePidlManager.cpp.

References GetDataSegment().

CString CRemotePidlManager::GetPermissionsStr ( LPCITEMIDLIST  pidl  ) 

Get the Unix file permissions in typical drwxrwxrwx form from a PIDL.

Parameters:
pidl The PIDL from which to retrieve the permissions
Returns:
The file's Unix permissions as a CString in drwxrwxrwx form or an empty CString if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the permissions from is the last item before the terminator.
Todo:
Implement this by calling function created for early Swish prototype. Currently, 'todo' is returned.

Definition at line 236 of file RemotePidlManager.cpp.

ULONGLONG CRemotePidlManager::GetFileSize ( LPCITEMIDLIST  pidl  ) 

Get the file's size from a (possibly multilevel) PIDL.

Parameters:
pidl The PIDL from which to retrieve the size
Returns:
The file's size in bytes or 0 if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the size from is the last item before the terminator.

Definition at line 255 of file RemotePidlManager.cpp.

References GetDataSegment().

CTime CRemotePidlManager::GetLastModified ( LPCITEMIDLIST  pidl  ) 

Get the time and date that the file was last changed from a PIDL.

Parameters:
pidl The PIDL from which to retrieve the date
Returns:
The date of last file modification as a CTime or 0 if the last item of pidl was not a valid REMOTEPIDL.
Precondition:
Assumes that the REMOTEPIDL to retrieve the date from is the last item before the terminator.

Definition at line 273 of file RemotePidlManager.cpp.

References GetDataSegment().

BOOL CRemotePidlManager::IsFolder ( LPCITEMIDLIST  pidl  ) 

Determine if the file represented by the PIDL is actually a folder.

Parameters:
pidl The PIDL to be checked
Returns:
TRUE if the PIDL represents a folder (directory) rather than a file or other filesystem object and FALSE otherwise.
Precondition:
Assumes that the REMOTEPIDL to be checked is the last item before the terminator.

Definition at line 291 of file RemotePidlManager.cpp.

References GetDataSegment().

PREMOTEPIDL CRemotePidlManager::GetDataSegment ( LPCITEMIDLIST  pidl  )  [private]

Walk to last item in PIDL (if multilevel) and return item as a REMOTEPIDL.

Parameters:
pidl The PIDL to retrieve the last REMOTEPIDL data segment from
Returns:
The last item in pidl if it is a valid REMOTEPIDL or NULL otherwise.
Precondition:
Assumes that the REMOTEPIDL to be retrieved is the last item before the terminator.

Reimplemented from CPidlManager.

Definition at line 309 of file RemotePidlManager.cpp.

References CPidlManager::GetDataSegment(), IsValid(), and Validate().

Referenced by GetFileSize(), GetGroup(), GetLastModified(), GetOwner(), GetPath(), GetPermissions(), and IsFolder().


The documentation for this class was generated from the following files:
Generated on Mon Nov 12 22:43:55 2007 for Swish by  doxygen 1.5.3