yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
develop
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 : 45static Bundle * mainBundle () ; 46 47static Bundle * bundle ( const class String * pPath ) ; 48static Bundle * bundle ( const class URL * pURL ) ; 49 50static Bundle * alloc () ; 51 52Bundle * init ( const class String * pPath ) ; 53Bundle * init ( const class URL * pURL ) ; 54 55class Array * allBundles () const ; 56class Array * allFrameworks () const ; 57 58bool load () ; 59bool unload () ; 60 61bool isLoaded () const ; 62 63bool preflightAndReturnError ( class Error ** pError ) const ; 64bool loadAndReturnError ( class Error ** pError ) ; 65 66class URL * bundleURL () const ; 67class URL * resourceURL () const ; 68class URL * executableURL () const ; 69class URL * URLForAuxiliaryExecutable ( const class String * pExecutableName ) const ; 70 71class URL * privateFrameworksURL () const ; 72class URL * sharedFrameworksURL () const ; 73class URL * sharedSupportURL () const ; 74class URL * builtInPlugInsURL () const ; 75class URL * appStoreReceiptURL () const ; 76 77class String * bundlePath () const ; 78class String * resourcePath () const ; 79class String * executablePath () const ; 80class String * pathForAuxiliaryExecutable ( const class String * pExecutableName ) const ; 81 82class String * privateFrameworksPath () const ; 83class String * sharedFrameworksPath () const ; 84class String * sharedSupportPath () const ; 85class String * builtInPlugInsPath () const ; 86 87class String * bundleIdentifier () const ; 88class Dictionary * infoDictionary () const ; 89class Dictionary * localizedInfoDictionary () const ; 90class Object * objectForInfoDictionaryKey ( const class String * pKey ) ; 91 92class 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{ 105return 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{ 112return 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{ 119return 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{ 126return pBdl -> localizedString ( pKey , pVal , pTbl ) ; 127} 128 129//------------------------------------------------------------------------------------------------------------------------------------------------------------- 130 131_NS_INLINE NS :: Bundle * NS :: Bundle :: mainBundle () 132{ 133return 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{ 140return 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{ 147return 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{ 154return 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{ 161return 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{ 168return Object :: sendMessage < Bundle *> ( this , _NS_PRIVATE_SEL ( initWithURL_ ) , pURL ) ; 169} 170 171//------------------------------------------------------------------------------------------------------------------------------------------------------------- 172 173_NS_INLINE NS :: Array * NS :: Bundle :: allBundles () const 174{ 175return Object :: sendMessage < Array *> ( this , _NS_PRIVATE_SEL ( allBundles )) ; 176} 177 178//------------------------------------------------------------------------------------------------------------------------------------------------------------- 179 180_NS_INLINE NS :: Array * NS :: Bundle :: allFrameworks () const 181{ 182return Object :: sendMessage < Array *> ( this , _NS_PRIVATE_SEL ( allFrameworks )) ; 183} 184 185//------------------------------------------------------------------------------------------------------------------------------------------------------------- 186 187_NS_INLINE bool NS :: Bundle :: load () 188{ 189return Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( load )) ; 190} 191 192//------------------------------------------------------------------------------------------------------------------------------------------------------------- 193 194_NS_INLINE bool NS :: Bundle :: unload () 195{ 196return Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( unload )) ; 197} 198 199//------------------------------------------------------------------------------------------------------------------------------------------------------------- 200 201_NS_INLINE bool NS :: Bundle :: isLoaded () const 202{ 203return Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( isLoaded )) ; 204} 205 206//------------------------------------------------------------------------------------------------------------------------------------------------------------- 207 208_NS_INLINE bool NS :: Bundle :: preflightAndReturnError ( Error ** pError ) const 209{ 210return Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( preflightAndReturnError_ ) , pError ) ; 211} 212 213//------------------------------------------------------------------------------------------------------------------------------------------------------------- 214 215_NS_INLINE bool NS :: Bundle :: loadAndReturnError ( Error ** pError ) 216{ 217return Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( loadAndReturnError_ ) , pError ) ; 218} 219 220//------------------------------------------------------------------------------------------------------------------------------------------------------------- 221 222_NS_INLINE NS :: URL * NS :: Bundle :: bundleURL () const 223{ 224return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( bundleURL )) ; 225} 226 227//------------------------------------------------------------------------------------------------------------------------------------------------------------- 228 229_NS_INLINE NS :: URL * NS :: Bundle :: resourceURL () const 230{ 231return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( resourceURL )) ; 232} 233 234//------------------------------------------------------------------------------------------------------------------------------------------------------------- 235 236_NS_INLINE NS :: URL * NS :: Bundle :: executableURL () const 237{ 238return 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{ 245return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( URLForAuxiliaryExecutable_ ) , pExecutableName ) ; 246} 247 248//------------------------------------------------------------------------------------------------------------------------------------------------------------- 249 250_NS_INLINE NS :: URL * NS :: Bundle :: privateFrameworksURL () const 251{ 252return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( privateFrameworksURL )) ; 253} 254 255//------------------------------------------------------------------------------------------------------------------------------------------------------------- 256 257_NS_INLINE NS :: URL * NS :: Bundle :: sharedFrameworksURL () const 258{ 259return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( sharedFrameworksURL )) ; 260} 261 262//------------------------------------------------------------------------------------------------------------------------------------------------------------- 263 264_NS_INLINE NS :: URL * NS :: Bundle :: sharedSupportURL () const 265{ 266return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( sharedSupportURL )) ; 267} 268 269//------------------------------------------------------------------------------------------------------------------------------------------------------------- 270 271_NS_INLINE NS :: URL * NS :: Bundle :: builtInPlugInsURL () const 272{ 273return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( builtInPlugInsURL )) ; 274} 275 276//------------------------------------------------------------------------------------------------------------------------------------------------------------- 277 278_NS_INLINE NS :: URL * NS :: Bundle :: appStoreReceiptURL () const 279{ 280return Object :: sendMessage < URL *> ( this , _NS_PRIVATE_SEL ( appStoreReceiptURL )) ; 281} 282 283//------------------------------------------------------------------------------------------------------------------------------------------------------------- 284 285_NS_INLINE NS :: String * NS :: Bundle :: bundlePath () const 286{ 287return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( bundlePath )) ; 288} 289 290//------------------------------------------------------------------------------------------------------------------------------------------------------------- 291 292_NS_INLINE NS :: String * NS :: Bundle :: resourcePath () const 293{ 294return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( resourcePath )) ; 295} 296 297//------------------------------------------------------------------------------------------------------------------------------------------------------------- 298 299_NS_INLINE NS :: String * NS :: Bundle :: executablePath () const 300{ 301return 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{ 308return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( pathForAuxiliaryExecutable_ ) , pExecutableName ) ; 309} 310 311//------------------------------------------------------------------------------------------------------------------------------------------------------------- 312 313_NS_INLINE NS :: String * NS :: Bundle :: privateFrameworksPath () const 314{ 315return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( privateFrameworksPath )) ; 316} 317 318//------------------------------------------------------------------------------------------------------------------------------------------------------------- 319 320_NS_INLINE NS :: String * NS :: Bundle :: sharedFrameworksPath () const 321{ 322return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( sharedFrameworksPath )) ; 323} 324 325//------------------------------------------------------------------------------------------------------------------------------------------------------------- 326 327_NS_INLINE NS :: String * NS :: Bundle :: sharedSupportPath () const 328{ 329return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( sharedSupportPath )) ; 330} 331 332//------------------------------------------------------------------------------------------------------------------------------------------------------------- 333 334_NS_INLINE NS :: String * NS :: Bundle :: builtInPlugInsPath () const 335{ 336return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( builtInPlugInsPath )) ; 337} 338 339//------------------------------------------------------------------------------------------------------------------------------------------------------------- 340 341_NS_INLINE NS :: String * NS :: Bundle :: bundleIdentifier () const 342{ 343return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( bundleIdentifier )) ; 344} 345 346//------------------------------------------------------------------------------------------------------------------------------------------------------------- 347 348_NS_INLINE NS :: Dictionary * NS :: Bundle :: infoDictionary () const 349{ 350return Object :: sendMessage < Dictionary *> ( this , _NS_PRIVATE_SEL ( infoDictionary )) ; 351} 352 353//------------------------------------------------------------------------------------------------------------------------------------------------------------- 354 355_NS_INLINE NS :: Dictionary * NS :: Bundle :: localizedInfoDictionary () const 356{ 357return Object :: sendMessage < Dictionary *> ( this , _NS_PRIVATE_SEL ( localizedInfoDictionary )) ; 358} 359 360//------------------------------------------------------------------------------------------------------------------------------------------------------------- 361 362_NS_INLINE NS :: Object * NS :: Bundle :: objectForInfoDictionaryKey ( const String * pKey ) 363{ 364return 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{ 371return Object :: sendMessage < String *> ( this , _NS_PRIVATE_SEL ( localizedStringForKey_value_table_ ) , pKey , pValue , pTableName ) ; 372} 373 374//-------------------------------------------------------------------------------------------------------------------------------------------------------------