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

#include <ICoreFilename.h>

Inheritance diagram for ICoreFilename:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ICOREFILENAME }
 

Public Member Functions

virtual void ReadWrite (IPMStream *s)=0
 
virtual int32 Initialize (const IDFile *name)=0
 
virtual int32 Initialize (PMString *filename, PMString *volname, int32 dirid, const PMString *fullPath=nil)=0
 
virtual int32 Initialize (ICoreFilename *cfn)=0
 
virtual int32 Initialize (NameInfo *ni, const PMString *fullPath=nil)=0
 
virtual int32 Initialize (PMString *fullpath)=0
 
virtual int32 SetBaseName (PMString *name)=0
 
virtual int32 GetSysFile (IDFile *name)=0
 
virtual int32 GetSysFile (NameInfo &ni, IDFile *name) const =0
 
virtual int32 GetNameInfo (NameInfo *ni)=0
 
virtual PMStringGetFilename ()=0
 
virtual PMStringGetVolume ()=0
 
virtual int32 GetDirID ()=0
 
virtual ClassID GetClassID ()=0
 
virtual IDFileGetFile ()=0
 
virtual void GetExtension (PMString *extension)=0
 
virtual PMStringGetBaseName ()=0
 
virtual PMStringGetFullName (bool16 *bChangedName=nil)=0
 
virtual int32 GetFileInfo (uint64 *size, uint64 *time, IDataLink *link=nil)=0
 
virtual bool16 FileExists ()=0
 
virtual bool16 DirectoryExists ()=0
 
virtual int32 Copy (ICoreFilename *dirname, ProgressParam *pp)=0
 
virtual int32 Delete ()=0
 
virtual int32 Touch ()=0
 
virtual FILE * fileopen (PMString *mode)=0
 
virtual int32 GetTypeAndCreator (uint32 *type, uint32 *creator)=0
 
virtual int32 GetDiskFreeSpace (uint64 *free)=0
 
virtual int32 FindRelative (ICoreFilename *dirname, ICoreFilename *newname)=0
 
virtual int32 Combine (ICoreFilename *dirname, ICoreFilename *pcombined)=0
 
virtual bool16 CompareBaseName (ICoreFilename *cfn)=0
 
virtual bool16 CompareDirectory (ICoreFilename *cfn)=0
 
virtual bool16 IsFileOpen ()=0
 
virtual bool16 IsFileLocked ()=0
 
virtual void SetTypeAndCreator (uint32 fileType, uint32 creator)=0
 
virtual int32 CreateFolder (PMString *name)=0
 
virtual ICoreFilenameCreateChildFolderFilename (const PMString &childFolder, PMString &filePart)=0
 
virtual bool32 ConvertToUNC ()=0
 
virtual bool16 IsFileOpenExclusive ()=0
 
virtual bool32 SwitchToParentDir ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

ICoreFilename provides file I/0 and filename features in a core way.

See also newer IDFile and associated classes.

There are currently two styles of names, PC and Macintosh. Either style can exist on either platform.

A pc name has a filename, no volname (0) and no dirid (0). The filename is a fully qualified pathname, up to 259 characters.

A Mac name has all three parameters. The filename and volname have a maximum length of 31 characters. The dirid must not be 0.

You can create a ICoreFilename object as follows: InterfacePtr<ICoreFilename> cfn((ICoreFilename *)::CreateObject(kCoreFilenameBoss, IID_ICOREFILENAME));

Member Function Documentation

virtual int32 ICoreFilename::Combine (ICoreFilenamedirname,
ICoreFilenamepcombined 
)
pure virtual

Method to create a new ICoreFilename from a directory and the file's base name.

Parameters
dirnameis the directory for the new name.
pcombinedreturns the new name, directory plus the file's base name.
Returns
0 when the method succeeds and non-zero otherwise.
virtual bool16 ICoreFilename::CompareBaseName (ICoreFilenamecfn)
pure virtual

Method to compare the base name of two ICoreFilenames.

Parameters
cfncontains the name to compare.
Returns
true when the base names are the same.
virtual bool16 ICoreFilename::CompareDirectory (ICoreFilenamecfn)
pure virtual

Method to compare the directory name of two ICoreFilenames.

Parameters
cfncontains the name to compare.
Returns
true when the directory names are the same.
virtual bool32 ICoreFilename::ConvertToUNC ()
pure virtual

If the file is on a network drive, convert the path name to UNC from the drive letter one.

Returns
true when the name is converted (it is on a network drive). Always returns false on Macintosh.
virtual int32 ICoreFilename::Copy (ICoreFilenamedirname,
ProgressParampp 
)
pure virtual

Method to copy a file.

Parameters
dirnameis the destination directory.
ppis an optional progress callback, pass nil for no callback.
Returns
0 when the method succeeds and non-zero otherwise.
virtual ICoreFilename* ICoreFilename::CreateChildFolderFilename (const PMStringchildFolder,
PMStringfilePart 
)
pure virtual

Method to create a new ICoreFilename. The directory comes from the child directory within current directory.

Parameters
childFolderis a directory within the current directory. The current directory is the directory of the associated file.
filePartis the base name for the new ICoreFilename.
Returns
ICoreFilename when the method succeeds and nil otherwise.
virtual int32 ICoreFilename::CreateFolder (PMStringname)
pure virtual

Method to create a directory.

Parameters
nameis the directory name to create in the current directory. The current directory is the directory of the associated file. If name is nil, create the current directory.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::Delete ()
pure virtual

Method to delete the file.

Returns
0 when the method succeeds and non-zero otherwise.
virtual bool16 ICoreFilename::DirectoryExists ()
pure virtual

Method to determine whether the directory the file is in exists.

Returns
true when the directory exists.
virtual bool16 ICoreFilename::FileExists ()
pure virtual

Method to determine whether the file exists.

Returns
true when the file exists.
virtual FILE* ICoreFilename::fileopen (PMStringmode)
pure virtual

Method to open the file using the standard C file I/O method.

Parameters
modeto open the file. Writable = "w", Readonly = "r", Writeable binary = "wb". See fopen.
Returns
a FILE pointer or nil when the file cannot be opened.
virtual int32 ICoreFilename::FindRelative (ICoreFilenamedirname,
ICoreFilenamenewname 
)
pure virtual

Method to quickly find the file relative to the given directory.

Parameters
dirnameis the directory where relative search is based on.
newnamereturns the name when found.
Returns
0 when the file is found and non-zero otherwise.
virtual PMString* ICoreFilename::GetBaseName ()
pure virtual

Method to get the associated base name, the filename without path information.

Returns
the base name.
virtual ClassID ICoreFilename::GetClassID ()
pure virtual

Method to get the associated Class ID (part of NameInfo).

Returns
the Class ID.
virtual int32 ICoreFilename::GetDirID ()
pure virtual

Method to get the associated Dir ID.

Returns
the Dir ID.
virtual int32 ICoreFilename::GetDiskFreeSpace (uint64 * free)
pure virtual

Method to determine the amount of free bytes on the file's disk.

Parameters
freeparameter to get the free disk space in bytes.
Returns
0 when the method succeeds and non-zero otherwise.
virtual void ICoreFilename::GetExtension (PMStringextension)
pure virtual

Method to get the associated file extension.

Returns
the file extension.
virtual IDFile* ICoreFilename::GetFile ()
pure virtual

Method to get the associated IDFile.

Returns
the IDFile.
virtual int32 ICoreFilename::GetFileInfo (uint64 * size,
uint64 * time,
IDataLinklink = nil 
)
pure virtual

Get the file size and file modified time stamp information.

Parameters
sizeoptional parameter to get the size of the file in bytes. Pass nil if you don't want the size.
timeoptional parameter to get the file's modified time stamp. See GlobalTime.h. Pass nil if you don't want the time stamp.
Thelink parameter is a hack to fix dirID problem on MAC when file is located on network file system such as NFS or SMB. When link is not nil, IDataLink object could be updated to reflect correct dirID for current session. This operation will not dirty document. Generally, you should use default value. It is not used on windows.
Returns
0 when the method succeeds and non-zero otherwise.
virtual PMString* ICoreFilename::GetFilename ()
pure virtual

Method to get the associated filename.

Returns
the filename.
virtual PMString* ICoreFilename::GetFullName (bool16 * bChangedName = nil)
pure virtual

Method to get the associated full path name.

Parameters
bChangedNameoptional parameter to return whether the name was changed (initialized).
Returns
the full path name.
virtual int32 ICoreFilename::GetNameInfo (NameInfo * ni)
pure virtual

Method to get the NameInfo that represents this ICoreFilename.

Parameters
nito get.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::GetSysFile (IDFilename)
pure virtual

Method to get the IDFile that represents this ICoreFilename.

Parameters
nameto get.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::GetSysFile (NameInfo & ni,
IDFilename 
) const
pure virtual

Method to get the system file information that represents this ICoreFilename. GetSysFile which can be used without calling Initialize.

Parameters
niNameInfo to get.
nameto get.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::GetTypeAndCreator (uint32 * type,
uint32 * creator 
)
pure virtual

Method to determine the file's Macintosh type and creator.

Parameters
typeoptional parameter to get the Macintosh type, 0 is returned on Windows. Pass nil if you don't want this information.
creatoroptional parameter to get the Macintosh creator, 0 is returned on Windows. Pass nil if you don't want this information.
Returns
0 when the method succeeds and non-zero otherwise.
virtual PMString* ICoreFilename::GetVolume ()
pure virtual

Method to get the associated volume name.

Returns
the volume name.
virtual int32 ICoreFilename::Initialize (const IDFilename)
pure virtual

Method to initialize.

Parameters
nameis an IDFile to initialize from.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::Initialize (PMStringfilename,
PMStringvolname,
int32 dirid,
const PMStringfullPath = nil 
)
pure virtual

Method to initialize.

Parameters
filenameis the filename to initialize from. For Macintosh style names, filename is the name without path or extension. For Windows style names, filename is a fully qualitfied path name.
volnameis the volume name on the Macintosh or nil for Windows.
diridis the directory ID on the Macintosh or 0 for Windows.
fullPathis an optional full path name.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::Initialize (ICoreFilenamecfn)
pure virtual

Method to initialize.

Parameters
cfnis an ICoreFilename to initialize from.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::Initialize (NameInfo * ni,
const PMStringfullPath = nil 
)
pure virtual

Method to initialize.

Parameters
niis an NameInfo to initialize from.
fullPathis an optional full path name.
Returns
0 when the method succeeds and non-zero otherwise.
virtual int32 ICoreFilename::Initialize (PMStringfullpath)
pure virtual

Method to initialize.

Parameters
fullPathis a full path name.
Returns
0 when the method succeeds and non-zero otherwise.
virtual bool16 ICoreFilename::IsFileLocked ()
pure virtual

Method to determine whether the file is locked, IDFile::kLocked bit. See IDFile::GetAttribute.

Returns
true when the file is locked.
virtual bool16 ICoreFilename::IsFileOpen ()
pure virtual

Method to determine whether the file is open. See IDFile::IsOpen.

Returns
true when the file is open.
virtual bool16 ICoreFilename::IsFileOpenExclusive ()
pure virtual

Method to determine whether the file is currently open for exclusive read access.

Returns
true when the file is open exclusive.
virtual void ICoreFilename::ReadWrite (IPMStreams)
pure virtual

Method to stream out the CoreFilename data.

Parameters
sis the stream to write to.
virtual int32 ICoreFilename::SetBaseName (PMStringname)
pure virtual

Method to change the base name. The base name is the filename without path information.

Parameters
nameto become the base name.
Returns
0 when the method succeeds and non-zero otherwise.
virtual void ICoreFilename::SetTypeAndCreator (uint32 fileType,
uint32 creator 
)
pure virtual

Method to set the Macintosh type and creator.

Parameters
fileTypeis the Macintosh file type.
creatoris the Macintosh creator.
virtual bool32 ICoreFilename::SwitchToParentDir ()
pure virtual

Method to moves up one level in the file system hierarchy.

Returns
true when the method succeeds.
virtual int32 ICoreFilename::Touch ()
pure virtual

Method to update the file's modified time stamp to the current time.

Returns
0 when the method succeeds and non-zero otherwise.