InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MBaseResourceAccess.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: robin briggs
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 __MBaseResourceAccess__
25 #define __MBaseResourceAccess__
26 
27 #include "IResourceAccess.h"
28 #include <boost/shared_ptr.hpp>
29 
30 // Forward declares
31 class PMString;
32 class ResourceLock;
33 
45 {
46 public:
47 
51  bool16 fDefaultAccess;
53  int16 fOpenCount;
55  ResFileRefNum fRefNum;
57  bool16 fUseBundle;
61  CFBundleRef fBundleRef;
62  };
63 
73  MBaseResourceAccess(const IDFile *resourceFile, ResourceFileInfo*);
77  MBaseResourceAccess(const CFBundleRef bundleRef, ResourceFileInfo*);
82 
84  virtual ~MBaseResourceAccess();
85 
87  virtual const IDFile *GetResourceFile();
88 
92  ResourceFileInfo* GetResourceFileInfo() { return(fResourceFileInfo); }
93 
96  static void SetAppResource(const int16 appRefNum);
97 
98 private:
99  static int16 gAppRefNum; // refNum for the applications resource file (always open).
100 
101  void OpenResourceFileWithRetry();
102  bool16 OpenResourceFile();
103  void CloseResourceFile();
104 
105  ResourceFileInfo *fPluginResourceFileInfo;
106  ResourceFileInfo *fResourceFileInfo;
107  int16 fPreviousRefNum;
108 
109  boost::shared_ptr<ResourceLock> fResourceLock; // needed because of the shared global resource handler
110 };
111 
112 #endif // __MPlugInResourceAccess__