CFBundle.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:7k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       CFBundle.h
  3.  
  4.      Contains:   CoreFoundation bundle
  5.  
  6.      Version:    Technology: Mac OS X
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1999-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CFBUNDLE__
  18. #define __CFBUNDLE__
  19. #ifndef __CFBASE__
  20. #include "CFBase.h"
  21. #endif
  22. #ifndef __CFARRAY__
  23. #include "CFArray.h"
  24. #endif
  25. #ifndef __CFSTRING__
  26. #include "CFString.h"
  27. #endif
  28. #ifndef __CFURL__
  29. #include "CFURL.h"
  30. #endif
  31. #ifndef __CFDICTIONARY__
  32. #include "CFDictionary.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. typedef struct __CFBundle * CFBundleRef;
  51. typedef struct __CFBundle * CFPlugInRef;
  52. extern const CFStringRef kCFBundleInfoDictionaryVersionKey;
  53. extern const CFStringRef kCFBundleExecutableKey;
  54. extern const CFStringRef kCFBundleIdentifierKey;
  55. extern const CFStringRef kCFBundleVersionKey;
  56. extern const CFStringRef kCFBundleDevelopmentRegionKey;
  57. extern const CFStringRef kCFBundleNameKey;
  58. /* ===================== Finding Bundles ===================== */
  59. EXTERN_API_C( CFBundleRef )
  60. CFBundleGetMainBundle           (void);
  61. EXTERN_API_C( CFBundleRef )
  62. CFBundleGetBundleWithIdentifier (CFStringRef            bundleID);
  63. /* A bundle can name itself by providing a key in the info dictionary. */
  64. /* This facility is meant to allow bundle-writers to get hold of their */
  65. /* bundle from their code without having to know where it was on the disk. */
  66. /* This is meant to be a replacement mechanism for +bundleForClass: users. */
  67. /* ===================== Creating Bundles ===================== */
  68. EXTERN_API_C( UInt32 )
  69. CFBundleGetTypeID               (void);
  70. EXTERN_API_C( CFBundleRef )
  71. CFBundleCreate                  (CFAllocatorRef         allocator,
  72.                                  CFURLRef               bundleURL);
  73. /* Might return an existing instance with the ref-count bumped. */
  74. EXTERN_API_C( CFArrayRef )
  75. CFBundleCreateBundlesFromDirectory (CFAllocatorRef      allocator,
  76.                                  CFURLRef               directoryURL,
  77.                                  CFStringRef            bundleType);
  78. /* Create instances for all bundles in the given directory matching the given */
  79. /* type (or all of them if bundleType is NULL) */
  80. /* ==================== Basic Bundle Info ==================== */
  81. EXTERN_API_C( CFURLRef )
  82. CFBundleCopyBundleURL           (CFBundleRef            bundle);
  83. EXTERN_API_C( CFDictionaryRef )
  84. CFBundleGetInfoDictionary       (CFBundleRef            bundle);
  85. EXTERN_API_C( CFStringRef )
  86. CFBundleGetIdentifier           (CFBundleRef            bundle);
  87. EXTERN_API_C( CFStringRef )
  88. CFBundleGetDevelopmentRegion    (CFBundleRef            bundle);
  89. EXTERN_API_C( CFURLRef )
  90. CFBundleCopySupportFilesDirectoryURL (CFBundleRef       bundle);
  91. EXTERN_API_C( CFURLRef )
  92. CFBundleCopyResourcesDirectoryURL (CFBundleRef          bundle);
  93. /* ------------- Basic Bundle Info without a CFBundle instance ------------- */
  94. /* This API is provided to enable developers to use access a bundle Info */
  95. /* dictionary without having to create an instance of CFBundle. */
  96. EXTERN_API_C( CFDictionaryRef )
  97. CFBundleCopyInfoDictionaryInDirectory (CFURLRef         bundleURL);
  98. /* ==================== Resource Handling API ==================== */
  99. EXTERN_API_C( CFURLRef )
  100. CFBundleCopyResourceURL         (CFBundleRef            bundle,
  101.                                  CFStringRef            resourceName,
  102.                                  CFStringRef            resourceType,
  103.                                  CFStringRef            subDirName);
  104. EXTERN_API_C( CFArrayRef )
  105. CFBundleCopyResourceURLsOfType  (CFBundleRef            bundle,
  106.                                  CFStringRef            resourceType,
  107.                                  CFStringRef            subDirName);
  108. EXTERN_API_C( CFStringRef )
  109. CFBundleCopyLocalizedString     (CFBundleRef            bundle,
  110.                                  CFStringRef            key,
  111.                                  CFStringRef            value,
  112.                                  CFStringRef            tableName);
  113. #define CFCopyLocalizedString(key, comment) CFBundleCopyLocalizedString(CFBundleGetMainBundle(), (key), (key), NULL)
  114. #define CFCopyLocalizedStringFromTable(key, tbl, comment) CFBundleCopyLocalizedString(CFBundleGetMainBundle(), (key), (key), (tbl))
  115. #define CFCopyLocalizedStringFromTableInBundle(key, tbl, bundle, comment) CFBundleCopyLocalizedString((bundle), (key), (key), (tbl))
  116. /* ------------- Resource Handling without a CFBundle instance ------------- */
  117. /* This API is provided to enable developers to use the CFBundle resource */
  118. /* searching policy without having to create an instance of CFBundle. */
  119. /* Because of caching behavior when a CFBundle instance exists, it will be faster */
  120. /* to actually create a CFBundle if you need to access several resources. */
  121. EXTERN_API_C( CFURLRef )
  122. CFBundleCopyResourceURLInDirectory (CFURLRef            bundleURL,
  123.                                  CFStringRef            resourceName,
  124.                                  CFStringRef            resourceType,
  125.                                  CFStringRef            subDirName);
  126. EXTERN_API_C( CFArrayRef )
  127. CFBundleCopyResourceURLsOfTypeInDirectory (CFURLRef     bundleURL,
  128.                                  CFStringRef            resourceType,
  129.                                  CFStringRef            subDirName);
  130. /* ==================== Primitive Code Loading API ==================== */
  131. /* This API abstracts the variosu different executable formats supported on various platforms. */
  132. /* It can load DYLD, CFM, or DLL shared libraries (on their appropriate platforms) and gives a */
  133. /* uniform API for looking up functions. */
  134. EXTERN_API_C( CFURLRef )
  135. CFBundleCopyExecutableURL       (CFBundleRef            bundle);
  136. EXTERN_API_C( Boolean )
  137. CFBundleIsExecutableLoaded      (CFBundleRef            bundle);
  138. EXTERN_API_C( Boolean )
  139. CFBundleLoadExecutable          (CFBundleRef            bundle);
  140. EXTERN_API_C( void )
  141. CFBundleUnloadExecutable        (CFBundleRef            bundle);
  142. EXTERN_API_C( void *)
  143. CFBundleGetFunctionPointerForName (CFBundleRef          bundle,
  144.                                  CFStringRef            functionName);
  145. EXTERN_API_C( void )
  146. CFBundleGetFunctionPointersForNames (CFBundleRef        bundle,
  147.                                  CFArrayRef             functionNames,
  148.                                  void *                 ftbl[]);
  149. /* ==================== Getting a bundles plugIn ==================== */
  150. EXTERN_API_C( CFPlugInRef )
  151. CFBundleGetPlugIn               (CFBundleRef            bundle);
  152. #if PRAGMA_STRUCT_ALIGN
  153.     #pragma options align=reset
  154. #elif PRAGMA_STRUCT_PACKPUSH
  155.     #pragma pack(pop)
  156. #elif PRAGMA_STRUCT_PACK
  157.     #pragma pack()
  158. #endif
  159. #ifdef PRAGMA_IMPORT_OFF
  160. #pragma import off
  161. #elif PRAGMA_IMPORT
  162. #pragma import reset
  163. #endif
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* __CFBUNDLE__ */