InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mresourcefilecache.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: David Burnard, Michael Burbidge
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __MResourceFileCache_h__
25 #define __MResourceFileCache_h__
26 
27 #include "K2Vector.h"
28 #include "KeyValuePair.h"
29 
30 //========================================================================================
31 // STRUCT RFCacheKey
32 //========================================================================================
33 
34 struct RFCacheKey
35 {
36  typedef base_type data_type; // only on mac
37  IDFile fSysFile;
38  RFCacheKey() {} // required by K2Vector
39  RFCacheKey(const IDFile&);
40  bool16 operator==(const RFCacheKey&) const;
41 };
42 
43 //========================================================================================
44 // STRUCT BRMCacheKey
45 //========================================================================================
46 
48 {
49  typedef base_type data_type; // only on mac
50  CFBundleRef fBundleRef;
51  BRMCacheKey() {} // required by K2Vector
52  BRMCacheKey(const CFBundleRef);
53  bool16 operator==(const BRMCacheKey&) const;
54 };
55 
56 //========================================================================================
57 // STRUCT RFCacheValue
58 //========================================================================================
59 
61 {
62  typedef base_type data_type;
63  ResFileRefNum fRefNum;
64  int16 fOpenCount;
65 
66  bool16 operator==(const RFCacheValue&) const;
67 };
68 
69 //========================================================================================
70 // Class MResourceFileCache
71 
84 {
85 public:
86  enum { kDefaultRFCacheLength = 8 };
87 
90 
92  int16 OpenResourceFile(const IDFile&);
94  void CloseResourceFile(const IDFile&);
95 
97  int16 OpenBundleResourceMap(const CFBundleRef);
99  void CloseBundleResourceMap(const CFBundleRef);
100 
102  void CloseUnusedFiles();
103 
105  bool16 DisableUnloading(bool16 disable = kTrue);
106 
110 
111 private:
112  bool16 fUnloadingDisabled;
115 };
116 
117 #endif // __MResourceFileCache_h__