InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IFileUtility Class Referenceabstract

#include <IFileUtility.h>

Public Types

enum  SetTemporaryFileFlags { kNone = 0x0, kUserDomainMac = 0x1, kPreferencesFolderTypeMac = 0x2 }
 
enum  Access { kRead, kWrite, kReadWrite }
 

Public Member Functions

virtual ~IFileUtility ()
 
virtual void DeleteFile ()=0
 
virtual bool16 SetTemporaryFile (int32 flags=kNone)=0
 
virtual void SetUniqueName ()=0
 
virtual void GetPathName (PMString *pathName)=0
 
virtual void GetFileName (PMString *fileName)=0
 
virtual const IDFileGetSysFile ()=0
 
virtual void GetDirectory (IDFile &fileSpec)=0
 
virtual bool16 CopyFile (const IDFile &destSpec)=0
 
virtual bool16 FileExists ()=0
 
virtual bool16 IsFolder ()=0
 
virtual bool8 CanOpen (Access access=kReadWrite)=0
 
virtual void GetFileCreatorType (SysOSType *fileType, SysOSType *creator)=0
 
virtual void SetFileCreatorType (SysOSType fileType, SysOSType creator)=0
 
virtual bool16 IsStationery ()=0
 
virtual void SetFileAsStationery (bool16 asStationery)=0
 
virtual uint32 GetModificationDate ()=0
 
virtual uint32 GetCreationDate ()=0
 
virtual PMString GetExtension ()=0
 
virtual uint32 GetFileSize ()=0
 
virtual void CreateDirectory ()=0
 
virtual bool16 DirIsReadOnly ()=0
 
virtual bool16 IsAliasFile ()=0
 
virtual ErrorCode ResolveAliasFile (bool16 suppressUI=kTrue)=0
 
virtual bool16 SetFileReadOnly (bool16 readOnly=kTrue)=0
 
virtual bool16 GetFileVisibility ()=0
 
virtual bool16 SetFileVisibility (bool16 show)=0
 

Detailed Description

Utility interface that provides methods used to manipulate IDFiles and paths.

When possible, it is preferred to manipulate IDFile objects directly rather than using the IFileUtility methods.

See Also
IDFile

Member Enumeration Documentation

Identifiers that denote the type of file access desired. \ You cannot obtain access to a file with an access mode that conflicts with a sharing mode specified in a previous open request (from any process) whose handle is still open.
Enumerator
kRead 

Read access; open the file for reading only.

kWrite 

Write access; open the file for writing only.

kReadWrite 

Read and write access; open the file for reading and writing.

Makes a path to a temporary file in the system's temporary file directory using the current file name. \ This call does not create the temporary file.

Returns
kTrue if success, else kFalse.

Constructor & Destructor Documentation

virtual IFileUtility::~IFileUtility ()
inlinevirtual

Destructor. Destroys the IFileUtility object.

Member Function Documentation

virtual bool8 IFileUtility::CanOpen (Access access = kReadWrite)
pure virtual

Tests whether the file or directory can be opened with the specified access. \ The state of whether a file can be opened may change at any time, so it is best to attempt to open the file immediately following the call to CanOpen().

Parameters
accessIN Type of file access desired.
Returns
kTrue if the file or directory can be opened with the given access, else kFalse.
virtual bool16 IFileUtility::CopyFile (const IDFiledestSpec)
pure virtual

Copies the contents of the file to the given destination file.

Parameters
destFileIN Destination file of the copy operation.
Returns
kTrue if the file was successfully copied, else kFalse.
virtual void IFileUtility::CreateDirectory ()
pure virtual

Creates the directory if it does not already exists.

virtual void IFileUtility::DeleteFile ()
pure virtual

Deletes the file from the file system. \ On the Mac, this call can also be used to delete an empty directory.

virtual bool16 IFileUtility::DirIsReadOnly ()
pure virtual

Tests whether the directory is read-only.

Returns
kTrue if the directory is read-only, else kFalse.
virtual bool16 IFileUtility::FileExists ()
pure virtual

Tests whether the file or directory exists on the file system.

Returns
kTrue if exists, else kFalse.
virtual uint32 IFileUtility::GetCreationDate ()
pure virtual

Returns the date and time the file or directory was created.

Returns
Date and time the file or directory was created.
virtual void IFileUtility::GetDirectory (IDFilefileSpec)
pure virtual

Gets the parent path of the file as an IDFile object.

Parameters
fileSpecOUT Parent path of the file as an IDFile object.
virtual PMString IFileUtility::GetExtension ()
pure virtual

Returns the file's extension.

Returns
File's extension as a string.
virtual void IFileUtility::GetFileCreatorType (SysOSType * fileType,
SysOSType * creator 
)
pure virtual

Gets the type and creator of the file. \ Does nothing on Windows.

Parameters
fileTypeOUT Type of the file.
creatorOUT Creator of the file.
virtual void IFileUtility::GetFileName (PMStringfileName)
pure virtual

Gets the file name of the file as a string.

Parameters
fileNameOUT Pointer to the string to be set to the file's name.
virtual uint32 IFileUtility::GetFileSize ()
pure virtual

Returns the size of a file.

Returns
The size of the file. 0 if the file is empty or does not exist.
virtual bool16 IFileUtility::GetFileVisibility ()
pure virtual

Returns the visibility state of the file.

Returns
kTrue if the file is visible, kFalse if it is hidden.
virtual uint32 IFileUtility::GetModificationDate ()
pure virtual

Returns the date and time the file or directory was last modified.

Returns
Date and time the file or directory was last modified.
virtual void IFileUtility::GetPathName (PMStringpathName)
pure virtual

Gets the full path of the file as a string.

Parameters
pathNameOUT Pointer to the string to be set to the file's full path.
virtual const IDFile& IFileUtility::GetSysFile ()
pure virtual

Returns the file as an IDFile object.

Returns
Reference to file's IDFile object.
virtual bool16 IFileUtility::IsAliasFile ()
pure virtual

Tests whether the file is an alias or shortcut.

Returns
kTrue if the file is an alias or shortcut, else kFalse.
virtual bool16 IFileUtility::IsFolder ()
pure virtual

Tests whether this object refers to a existing directory or an alias to a directory.

Returns
kTrue if a directory or an alias to a directory, else kFalse.
virtual bool16 IFileUtility::IsStationery ()
pure virtual

Tests whether file is marked as stationery.

Returns
kTrue if the file is marked as stationery, else kFalse.
virtual ErrorCode IFileUtility::ResolveAliasFile (bool16 suppressUI = kTrue)
pure virtual

Resolves an alias file by setting the IDFile to the file the alias references.

Parameters
suppressUIIN Denotes whether to prevent the OS from displaying a dialog when the alias cannot be automatically resolved.
Returns
kSuccess if the alias file was successfully resolved,\ kCouldntResolveAliasError if the alias could not be resolved, or\ kFailure if an unexpected error was encountered.
virtual void IFileUtility::SetFileAsStationery (bool16 asStationery)
pure virtual

Sets the stationery bit of the file. \ Does nothing on Windows.

Parameters
asStationeryIN Denotes whether the stationery bit should be set.
virtual void IFileUtility::SetFileCreatorType (SysOSType fileType,
SysOSType creator 
)
pure virtual

Sets the creator and type of the file. \ Does nothing on Windows.

Parameters
fileTypeIN Type of the file.
creatorIN Creator of the file.
virtual bool16 IFileUtility::SetFileReadOnly (bool16 readOnly = kTrue)
pure virtual

Sets the system's read-only attribute for the file.

Parameters
readOnlyIN If kTrue, the file's read-only attribute is set.
virtual bool16 IFileUtility::SetFileVisibility (bool16 show)
pure virtual

Sets the visibility state of the file.

Parameters
showIN Denotes whether the file should be visible or hidden. kTrue to set the file to be visible.
Returns
kTrue if the visibility state of the file was set, else kFalse.
virtual void IFileUtility::SetUniqueName ()
pure virtual

Ensures that the file name is unique within the directory by appending a unique numerical suffix.