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

#include <mresourcefilecache.h>

Public Types

enum  { kDefaultRFCacheLength = 8 }
 

Public Member Functions

int16 OpenResourceFile (const IDFile &)
 
void CloseResourceFile (const IDFile &)
 
int16 OpenBundleResourceMap (const CFBundleRef)
 
void CloseBundleResourceMap (const CFBundleRef)
 
void CloseUnusedFiles ()
 
bool16 DisableUnloading (bool16 disable=kTrue)
 

Static Public Attributes

static MResourceFileCache fResourceFileCache
 

Detailed Description

Implementation of a cache for open resource files This avoids repeated opening/closing of resource files during drawing/etc. Caching happens behind the scenes and is transparent to almost all clients.

The one exception is that a bug in the Mac OS X Nav services dialogs can clobber one of our resource files if we have any unused but cached resource files. To avoid this call MResourceFileCache::fResourceFileCache.CloseUnusedFiles() to empty the cache of unused files just prior to using a Nav Services dialog, and at the end of any callbacks that might cause a resource file to be opened or closed.

See Also
ResourceEnabler, MResourceAccess

Member Function Documentation

void MResourceFileCache::CloseBundleResourceMap (const CFBundleRef )

close a bundle resource map (it may be cached instead)

void MResourceFileCache::CloseResourceFile (const IDFile)

close a resource file (it may be cached instead)

void MResourceFileCache::CloseUnusedFiles ()

close all cached but unused bundle resource maps and resource files

bool16 MResourceFileCache::DisableUnloading (bool16 disable = kTrue)

Flag to disable unloading of cached but unused resource files and bundle maps. (unloading is not disabled by default)

int16 MResourceFileCache::OpenBundleResourceMap (const CFBundleRef )

open a bundle resource map and return the refNum (it may already be open if cached)

int16 MResourceFileCache::OpenResourceFile (const IDFile)

open a resource file and return the refNum (it may already be open if cached)

Member Data Documentation

MResourceFileCache MResourceFileCache::fResourceFileCache
static

Provides access to the resource cache.