InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MResourceAccess.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
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 __MResourceAccess__
25 #define __MResourceAccess__
26 
27 #include "MBaseResourceAccess.h"
28 
29 // This is required for the linker due to the friend declarations below.
30 extern "C" {
31  void InitConnection();
32  void TerminateConnection();
33 }
34 
46 {
47 public:
55  MResourceAccess(const IDFile *resourceFile);
59  MResourceAccess(const CFBundleRef bundleRef);
63  MResourceAccess(PluginID plugin);
64 
67 
69  static void SetResourceFile(const IDFile *rsrcFileLocation);
71  static void SetPluginBundle(const CFBundleRef bundleRef);
72 
73 private:
74  // The IDFile pointer in gPluginResourceFileInfo needs to be allocated very
75  // early in InitConnection() and deallocated in TerminateConnection(). Make
76  // the functions friends to give them access to gPluginResourceFileInfo.
77  friend class PlugIn;
78  friend class MResourceAccessCleanerUpper;
79  friend void InitConnection();
80  static ResourceFileInfo gPluginResourceFileInfo;
81 
82 #ifdef DEBUG
83  int32 fOldNumResAccesses; // to catch unneeded usages
84 #endif
85 };
86 
87 // Used by the runtime to destruct the static MResourceAccess::gPluginResourceFileInfo a bit earlier than usual,
88 // to aid our leak tracking code.
90 {
91 public:
92  MResourceAccessCleanerUpper(char * dylibName = nil);
94 
95  char* fDylibName;
96 };
97 
98 
99 #endif // __MResourceAccess__