InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FileTypeRegistry Class Reference

#include <FileTypeRegistry.h>

Public Types

typedef K2Vector< FileTypeInfoFileTypeInfoList
 
typedef K2Vector< OSType > OSTypeList
 
typedef K2Vector< PMStringFileExtensionList
 
typedef K2Vector< PMStringFileMimeTypeList
 

Public Member Functions

 FileTypeRegistry ()
 
virtual ~FileTypeRegistry ()
 

Static Public Member Functions

static bool16 FileTypeIsRegistered (FileTypeInfoID id)
 
static void AddCurrentFileType (FileTypeInfoID id, const FileTypeInfo &fileInfo)
 
static void RemoveCurrentFileType (FileTypeInfoID id)
 
static void RemoveAllFileType (FileTypeInfoID id)
 
static FileTypeInfo GetCurrentFileTypeInfo (FileTypeInfoID id)
 
static bool16 GetAllFileTypeInfo (FileTypeInfoID id, FileTypeInfoList &list, bool16 clearList)
 
static OSType GetCurrentFileType (FileTypeInfoID id)
 
static bool16 GetAllFileType (FileTypeInfoID id, OSTypeList &list, bool16 clearList)
 
static OSType GetCurrentFileCreator (FileTypeInfoID id)
 
static bool16 GetAllFileCreator (FileTypeInfoID id, OSTypeList &list, bool16 clearList)
 
static PMString GetCurrentFileExtension (FileTypeInfoID id)
 
static bool16 GetCurrentMagicByte (FileTypeInfoID id, DBUtils::MagicBytes magic)
 
static bool16 GetAllFileExtension (FileTypeInfoID id, FileExtensionList &list, bool16 clearList)
 
static PMString GetCurrentFileMimeType (FileTypeInfoID id)
 
static bool16 GetAllFileMimeType (FileTypeInfoID id, FileMimeTypeList &list, bool16 clearList)
 
static FileTypeInfoID GetFileTypeInfoIDForFile (const IDFile &file)
 

Detailed Description

A global registry of file type information (file type, creator, file extension, and mime type) with a key of type FileTypeInfoID.

There may be more than one set of file type information associated with a single key. For example, for the "document" key, we could have different sets of information for different versions of the product. This could happen if we decide to change the PC file extension and/or Mac file type from one version to the next.

The last set of information added to each key is considered to be the "current" information. When you call FileTypeRegistry::GetFileTypeInfo(), for example, you are given the most-recently-added information. The moral: add historical info first and the current info last.

Does not rely on the object model (so it can be used at startup).

Data from all resources of type FileTypeTable in the application are added to the registry.

Constructor & Destructor Documentation

FileTypeRegistry::FileTypeRegistry ()

Default constructor. Constructs a FileTypeRegistry object.

virtual FileTypeRegistry::~FileTypeRegistry ()
virtual

Destructor. Destroys the FileTypeRegistry object.

Member Function Documentation

static void FileTypeRegistry::AddCurrentFileType (FileTypeInfoID id,
const FileTypeInfofileInfo 
)
static

Adds a set of file type information for the specified file type ID. \ The added entry is considered to be the "current" information and will be returned by the various GetCurrent...() methods.

Parameters
idIN File type information ID.
fileInfoIN File type information to add for the given ID.
static bool16 FileTypeRegistry::FileTypeIsRegistered (FileTypeInfoID id)
static

Checks if a file type information ID is registered.

Parameters
idIN File type information ID to check.
Returns
kTrue if the file type information ID is registered, else kFalse.
static bool16 FileTypeRegistry::GetAllFileCreator (FileTypeInfoID id,
OSTypeListlist,
bool16 clearList 
)
static

Returns all the Mac creators for the given file type information ID. \ Duplicate creators are not added to the list.

Parameters
idIN File type information ID to return all the Mac creators for.
listIN List to add the Mac creators to.
clearListIN Denotes whether to clear the given list before adding the Mac creators for the given ID.
Returns
kTrue if any Mac creators were added to the list, else kFalse.
static bool16 FileTypeRegistry::GetAllFileExtension (FileTypeInfoID id,
FileExtensionListlist,
bool16 clearList 
)
static

Returns all the file extensions for the given file type information ID. \ The returned extensions are always in lowercase. \ Duplicate extensions are not added to the list.

Parameters
idIN File type information ID to return all the extensions for.
listIN List to add the extensions to.
clearListIN Denotes whether to clear the given list before adding the extensions for the given ID.
Returns
kTrue if any lowercase file extensions were added to the list, else kFalse.
static bool16 FileTypeRegistry::GetAllFileMimeType (FileTypeInfoID id,
FileMimeTypeListlist,
bool16 clearList 
)
static

Returns all the file mimetypes for the given file type information ID. \ The returned mimetypes are always in lowercase. \ Duplicate mimetypes are not added to the list.

Parameters
idIN File type information ID to return all the mimetypes for.
listIN List to add the mimetypes to.
clearListIN Denotes whether to clear the given list before adding the mimetypes for the given ID.
Returns
kTrue if any lowercase file mimetypes were added to the list, else kFalse.
static bool16 FileTypeRegistry::GetAllFileType (FileTypeInfoID id,
OSTypeListlist,
bool16 clearList 
)
static

Returns all the Mac file types for the given file type information ID. \ Duplicate file types are not added to the list.

Parameters
idIN File type information ID to return all the Mac file types for.
listIN List to add the Mac file types to.
clearListIN Denotes whether to clear the given list before adding the Mac file types for the given ID.
Returns
kTrue if any Mac file types were added to the list, else kFalse.
static bool16 FileTypeRegistry::GetAllFileTypeInfo (FileTypeInfoID id,
FileTypeInfoListlist,
bool16 clearList 
)
static

Returns all the file type information entries for the given file type information ID. \ Duplicate entries are not added to the list.

Parameters
idIN File type information ID to return all the entries for.
listIN List to add the file type information entries to.
clearListIN Denotes whether to clear the given list before adding the file type information entries for the given ID.
Returns
kTrue if file type information entries were added to the list, else kFalse.
static OSType FileTypeRegistry::GetCurrentFileCreator (FileTypeInfoID id)
static

Returns the "current" Mac creator for the given file type information ID.

Parameters
idIN File type information ID to return the current Mac creator for.
Returns
Current Mac creator for the given ID.
static PMString FileTypeRegistry::GetCurrentFileExtension (FileTypeInfoID id)
static

Returns the "current" file extension for the given file type information ID. \ The returned extension is always in lowercase.

Parameters
idIN File type information ID to return the current file extension for.
Returns
Current lowercase file extension for the given ID.
static PMString FileTypeRegistry::GetCurrentFileMimeType (FileTypeInfoID id)
static

Returns the "current" file mimetype for the given file type information ID. \ The returned mimetype is always in lowercase.

Parameters
idIN File type information ID to return the current mimetype for.
Returns
Current lowercase file mimetype for the given ID.
static OSType FileTypeRegistry::GetCurrentFileType (FileTypeInfoID id)
static

Returns the "current" Mac file type for the given file type information ID.

Parameters
idIN File type information ID to return the current Mac file type for.
Returns
Current Mac file type for the given ID.
static FileTypeInfo FileTypeRegistry::GetCurrentFileTypeInfo (FileTypeInfoID id)
static

Returns the "current" file type information entry for the given file type information ID.

Parameters
idIN File type information ID to return the current entry for.
Returns
Current file type information for the given ID.
static bool16 FileTypeRegistry::GetCurrentMagicByte (FileTypeInfoID id,
DBUtils::MagicBytes magic 
)
static

Returns the "current" magic bytes for the given file type information ID.

Parameters
idIN File type information ID to return the current magic bytes for.
magicOUT Current magic bytes for the given ID.
Returns
kTrue if the magic bytes were set, else kFalse.
static FileTypeInfoID FileTypeRegistry::GetFileTypeInfoIDForFile (const IDFilefile)
static

Returns the best matching FileTypteInfoID for the given file. \ On the mac, the file's finder filetype is compared first. If more than one match is found, then the file's creator is taken into account, followed by file's extension if necessary. \ On windows, only the file's extension is relevant.

Parameters
fileIN File to find the best matching FileTypteInfoID for.
Returns
Best matching FileTypteInfoID for the given file.
static void FileTypeRegistry::RemoveAllFileType (FileTypeInfoID id)
static

Un-registers a file type information ID. Removes all entries for the given ID.

Parameters
idIN File type information ID to remove all entries for.
static void FileTypeRegistry::RemoveCurrentFileType (FileTypeInfoID id)
static

Un-registers a file type information ID. Removes the current entry for the given ID.

Parameters
idIN File type information ID to remove the current entry for.