InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MBaseResourceAccessX.h
1 /*************************************************************************
2  *
3  * ADOBE CONFIDENTIAL
4  * ___________________
5  *
6  * Copyright 2025 Adobe
7  * All Rights Reserved.
8  *
9  * NOTICE: All information contained herein is, and remains
10  * the property of Adobe and its suppliers, if any. The intellectual
11  * and technical concepts contained herein are proprietary to Adobe
12  * and its suppliers and are protected by all applicable intellectual
13  * property laws, including trade secret and copyright laws.
14  * Dissemination of this information or reproduction of this material
15  * is strictly forbidden unless prior written permission is obtained
16  * from Adobe.
17  **************************************************************************/
18 
19 #ifndef __MBaseResourceAccessX__
20 #define __MBaseResourceAccessX__
21 
22 #include "IResourceAccess.h"
23 #include <boost/shared_ptr.hpp>
24 #include <memory> // Add for unique_ptr
25 
26 #ifdef __OBJC__
27 #import <Foundation/Foundation.h>
28 #else
29 #include <objc/objc-runtime.h>
30 class NSBundle;
31 #endif
32 
33 // Forward declares
34 class PMString;
35 class ResourceLockX;
36 class IDFile;
37 
48 public:
51  bool16 fDefaultAccess; // Flag indicating if default (main bundle) resources should be used
52  NSBundle* fBundle; // Bundle containing the resources (nil for default)
53  std::unique_ptr<IDFile> fRsrcFile; // Legacy resource file reference (kept for compatibility)
54  int16 fOpenCount; // Counter for number of times resource is opened
55 
57  };
58 
61 
66 
71  MBaseResourceAccessX(const IDFile* resourceFile, ResourceFileInfo*);
72 
77  MBaseResourceAccessX(NSBundle* bundle, ResourceFileInfo*);
78 
84 
85  virtual ~MBaseResourceAccessX();
86 
88  virtual const IDFile* GetResourceFile();
89  ResourceFileInfo* GetResourceFileInfo() { return fResourceFileInfo; }
90 
91  NSBundle* GetBundle() const;
92 
95  static void SetAppBundle(NSBundle* appBundle);
96 
97  // Resource file operations
98  virtual bool16 OpenResourceFile();
99  virtual void CloseResourceFile();
100 
101 protected:
102  void CleanupResourceAccess();
103 
104 private:
105  ResourceFileInfo* fPluginResourceFileInfo; // Points to shared plugin resource info
106  ResourceFileInfo* fResourceFileInfo; // Points to either plugin info or new instance
107  boost::shared_ptr<ResourceLockX> fResourceLock;
108 
109  static NSBundle* sAppBundle; // Main application bundle
110 };
111 
112 #endif