yum-mirror/VkFFT

git clone https://git.yummers.dev/yum-mirror/VkFFT

Tolmachev DmitriiMetal support in VkFFTba7001c

develop
16.5 KiB374 linesraw
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2//
3// Foundation/NSBundle.hpp
4//
5// Copyright 2020-2021 Apple Inc.
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License at
10//
11//     http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS,
15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16// See the License for the specific language governing permissions and
17// limitations under the License.
18//
19//-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
21#pragma once
22
23//-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
25#include "NSDefines.hpp"
26#include "NSNotification.hpp"
27#include "NSObject.hpp"
28#include "NSTypes.hpp"
29
30//-------------------------------------------------------------------------------------------------------------------------------------------------------------
31
32namespace NS
33{
34_NS_CONST(NotificationName, BundleDidLoadNotification);
35_NS_CONST(NotificationName, BundleResourceRequestLowDiskSpaceNotification);
36
37class String* LocalizedString(const String* pKey, const String*);
38class String* LocalizedStringFromTable(const String* pKey, const String* pTbl, const String*);
39class String* LocalizedStringFromTableInBundle(const String* pKey, const String* pTbl, const class Bundle* pBdle, const String*);
40class String* LocalizedStringWithDefaultValue(const String* pKey, const String* pTbl, const class Bundle* pBdle, const String* pVal, const String*);
41
42class Bundle : public Referencing<Bundle>
43{
44public:
45    static Bundle*    mainBundle();
46
47    static Bundle*    bundle(const class String* pPath);
48    static Bundle*    bundle(const class URL* pURL);
49
50    static Bundle*    alloc();
51
52    Bundle*           init(const class String* pPath);
53    Bundle*           init(const class URL* pURL);
54
55    class Array*      allBundles() const;
56    class Array*      allFrameworks() const;
57
58    bool              load();
59    bool              unload();
60
61    bool              isLoaded() const;
62
63    bool              preflightAndReturnError(class Error** pError) const;
64    bool              loadAndReturnError(class Error** pError);
65
66    class URL*        bundleURL() const;
67    class URL*        resourceURL() const;
68    class URL*        executableURL() const;
69    class URL*        URLForAuxiliaryExecutable(const class String* pExecutableName) const;
70
71    class URL*        privateFrameworksURL() const;
72    class URL*        sharedFrameworksURL() const;
73    class URL*        sharedSupportURL() const;
74    class URL*        builtInPlugInsURL() const;
75    class URL*        appStoreReceiptURL() const;
76
77    class String*     bundlePath() const;
78    class String*     resourcePath() const;
79    class String*     executablePath() const;
80    class String*     pathForAuxiliaryExecutable(const class String* pExecutableName) const;
81
82    class String*     privateFrameworksPath() const;
83    class String*     sharedFrameworksPath() const;
84    class String*     sharedSupportPath() const;
85    class String*     builtInPlugInsPath() const;
86
87    class String*     bundleIdentifier() const;
88    class Dictionary* infoDictionary() const;
89    class Dictionary* localizedInfoDictionary() const;
90    class Object*     objectForInfoDictionaryKey(const class String* pKey);
91
92    class String*     localizedString(const class String* pKey, const class String* pValue = nullptr, const class String* pTableName = nullptr) const;
93};
94}
95
96//-------------------------------------------------------------------------------------------------------------------------------------------------------------
97
98_NS_PRIVATE_DEF_CONST(NS::NotificationName, BundleDidLoadNotification);
99_NS_PRIVATE_DEF_CONST(NS::NotificationName, BundleResourceRequestLowDiskSpaceNotification);
100
101//-------------------------------------------------------------------------------------------------------------------------------------------------------------
102
103_NS_INLINE NS::String* NS::LocalizedString(const String* pKey, const String*)
104{
105    return Bundle::mainBundle()->localizedString(pKey, nullptr, nullptr);
106}
107
108//-------------------------------------------------------------------------------------------------------------------------------------------------------------
109
110_NS_INLINE NS::String* NS::LocalizedStringFromTable(const String* pKey, const String* pTbl, const String*)
111{
112    return Bundle::mainBundle()->localizedString(pKey, nullptr, pTbl);
113}
114
115//-------------------------------------------------------------------------------------------------------------------------------------------------------------
116
117_NS_INLINE NS::String* NS::LocalizedStringFromTableInBundle(const String* pKey, const String* pTbl, const Bundle* pBdl, const String*)
118{
119    return pBdl->localizedString(pKey, nullptr, pTbl);
120}
121
122//-------------------------------------------------------------------------------------------------------------------------------------------------------------
123
124_NS_INLINE NS::String* NS::LocalizedStringWithDefaultValue(const String* pKey, const String* pTbl, const Bundle* pBdl, const String* pVal, const String*)
125{
126    return pBdl->localizedString(pKey, pVal, pTbl);
127}
128
129//-------------------------------------------------------------------------------------------------------------------------------------------------------------
130
131_NS_INLINE NS::Bundle* NS::Bundle::mainBundle()
132{
133    return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(mainBundle));
134}
135
136//-------------------------------------------------------------------------------------------------------------------------------------------------------------
137
138_NS_INLINE NS::Bundle* NS::Bundle::bundle(const class String* pPath)
139{
140    return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(bundleWithPath_), pPath);
141}
142
143//-------------------------------------------------------------------------------------------------------------------------------------------------------------
144
145_NS_INLINE NS::Bundle* NS::Bundle::bundle(const class URL* pURL)
146{
147    return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(bundleWithURL_), pURL);
148}
149
150//-------------------------------------------------------------------------------------------------------------------------------------------------------------
151
152_NS_INLINE NS::Bundle* NS::Bundle::alloc()
153{
154    return Object::sendMessage<Bundle*>(_NS_PRIVATE_CLS(NSBundle), _NS_PRIVATE_SEL(alloc));
155}
156
157//-------------------------------------------------------------------------------------------------------------------------------------------------------------
158
159_NS_INLINE NS::Bundle* NS::Bundle::init(const String* pPath)
160{
161    return Object::sendMessage<Bundle*>(this, _NS_PRIVATE_SEL(initWithPath_), pPath);
162}
163
164//-------------------------------------------------------------------------------------------------------------------------------------------------------------
165
166_NS_INLINE NS::Bundle* NS::Bundle::init(const URL* pURL)
167{
168    return Object::sendMessage<Bundle*>(this, _NS_PRIVATE_SEL(initWithURL_), pURL);
169}
170
171//-------------------------------------------------------------------------------------------------------------------------------------------------------------
172
173_NS_INLINE NS::Array* NS::Bundle::allBundles() const
174{
175    return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(allBundles));
176}
177
178//-------------------------------------------------------------------------------------------------------------------------------------------------------------
179
180_NS_INLINE NS::Array* NS::Bundle::allFrameworks() const
181{
182    return Object::sendMessage<Array*>(this, _NS_PRIVATE_SEL(allFrameworks));
183}
184
185//-------------------------------------------------------------------------------------------------------------------------------------------------------------
186
187_NS_INLINE bool NS::Bundle::load()
188{
189    return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(load));
190}
191
192//-------------------------------------------------------------------------------------------------------------------------------------------------------------
193
194_NS_INLINE bool NS::Bundle::unload()
195{
196    return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(unload));
197}
198
199//-------------------------------------------------------------------------------------------------------------------------------------------------------------
200
201_NS_INLINE bool NS::Bundle::isLoaded() const
202{
203    return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(isLoaded));
204}
205
206//-------------------------------------------------------------------------------------------------------------------------------------------------------------
207
208_NS_INLINE bool NS::Bundle::preflightAndReturnError(Error** pError) const
209{
210    return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(preflightAndReturnError_), pError);
211}
212
213//-------------------------------------------------------------------------------------------------------------------------------------------------------------
214
215_NS_INLINE bool NS::Bundle::loadAndReturnError(Error** pError)
216{
217    return Object::sendMessage<bool>(this, _NS_PRIVATE_SEL(loadAndReturnError_), pError);
218}
219
220//-------------------------------------------------------------------------------------------------------------------------------------------------------------
221
222_NS_INLINE NS::URL* NS::Bundle::bundleURL() const
223{
224    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(bundleURL));
225}
226
227//-------------------------------------------------------------------------------------------------------------------------------------------------------------
228
229_NS_INLINE NS::URL* NS::Bundle::resourceURL() const
230{
231    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(resourceURL));
232}
233
234//-------------------------------------------------------------------------------------------------------------------------------------------------------------
235
236_NS_INLINE NS::URL* NS::Bundle::executableURL() const
237{
238    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(executableURL));
239}
240
241//-------------------------------------------------------------------------------------------------------------------------------------------------------------
242
243_NS_INLINE NS::URL* NS::Bundle::URLForAuxiliaryExecutable(const String* pExecutableName) const
244{
245    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(URLForAuxiliaryExecutable_), pExecutableName);
246}
247
248//-------------------------------------------------------------------------------------------------------------------------------------------------------------
249
250_NS_INLINE NS::URL* NS::Bundle::privateFrameworksURL() const
251{
252    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(privateFrameworksURL));
253}
254
255//-------------------------------------------------------------------------------------------------------------------------------------------------------------
256
257_NS_INLINE NS::URL* NS::Bundle::sharedFrameworksURL() const
258{
259    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(sharedFrameworksURL));
260}
261
262//-------------------------------------------------------------------------------------------------------------------------------------------------------------
263
264_NS_INLINE NS::URL* NS::Bundle::sharedSupportURL() const
265{
266    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(sharedSupportURL));
267}
268
269//-------------------------------------------------------------------------------------------------------------------------------------------------------------
270
271_NS_INLINE NS::URL* NS::Bundle::builtInPlugInsURL() const
272{
273    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(builtInPlugInsURL));
274}
275
276//-------------------------------------------------------------------------------------------------------------------------------------------------------------
277
278_NS_INLINE NS::URL* NS::Bundle::appStoreReceiptURL() const
279{
280    return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(appStoreReceiptURL));
281}
282
283//-------------------------------------------------------------------------------------------------------------------------------------------------------------
284
285_NS_INLINE NS::String* NS::Bundle::bundlePath() const
286{
287    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(bundlePath));
288}
289
290//-------------------------------------------------------------------------------------------------------------------------------------------------------------
291
292_NS_INLINE NS::String* NS::Bundle::resourcePath() const
293{
294    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(resourcePath));
295}
296
297//-------------------------------------------------------------------------------------------------------------------------------------------------------------
298
299_NS_INLINE NS::String* NS::Bundle::executablePath() const
300{
301    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(executablePath));
302}
303
304//-------------------------------------------------------------------------------------------------------------------------------------------------------------
305
306_NS_INLINE NS::String* NS::Bundle::pathForAuxiliaryExecutable(const String* pExecutableName) const
307{
308    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(pathForAuxiliaryExecutable_), pExecutableName);
309}
310
311//-------------------------------------------------------------------------------------------------------------------------------------------------------------
312
313_NS_INLINE NS::String* NS::Bundle::privateFrameworksPath() const
314{
315    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(privateFrameworksPath));
316}
317
318//-------------------------------------------------------------------------------------------------------------------------------------------------------------
319
320_NS_INLINE NS::String* NS::Bundle::sharedFrameworksPath() const
321{
322    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(sharedFrameworksPath));
323}
324
325//-------------------------------------------------------------------------------------------------------------------------------------------------------------
326
327_NS_INLINE NS::String* NS::Bundle::sharedSupportPath() const
328{
329    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(sharedSupportPath));
330}
331
332//-------------------------------------------------------------------------------------------------------------------------------------------------------------
333
334_NS_INLINE NS::String* NS::Bundle::builtInPlugInsPath() const
335{
336    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(builtInPlugInsPath));
337}
338
339//-------------------------------------------------------------------------------------------------------------------------------------------------------------
340
341_NS_INLINE NS::String* NS::Bundle::bundleIdentifier() const
342{
343    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(bundleIdentifier));
344}
345
346//-------------------------------------------------------------------------------------------------------------------------------------------------------------
347
348_NS_INLINE NS::Dictionary* NS::Bundle::infoDictionary() const
349{
350    return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(infoDictionary));
351}
352
353//-------------------------------------------------------------------------------------------------------------------------------------------------------------
354
355_NS_INLINE NS::Dictionary* NS::Bundle::localizedInfoDictionary() const
356{
357    return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(localizedInfoDictionary));
358}
359
360//-------------------------------------------------------------------------------------------------------------------------------------------------------------
361
362_NS_INLINE NS::Object* NS::Bundle::objectForInfoDictionaryKey(const String* pKey)
363{
364    return Object::sendMessage<Object*>(this, _NS_PRIVATE_SEL(objectForInfoDictionaryKey_), pKey);
365}
366
367//-------------------------------------------------------------------------------------------------------------------------------------------------------------
368
369_NS_INLINE NS::String* NS::Bundle::localizedString(const String* pKey, const String* pValue /* = nullptr */, const String* pTableName /* = nullptr */) const
370{
371    return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(localizedStringForKey_value_table_), pKey, pValue, pTableName);
372}
373
374//-------------------------------------------------------------------------------------------------------------------------------------------------------------