home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSBundle.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.2 KB  |  75 lines

  1. /*    NSBundle.h
  2.     Dynamically loadable code with resources
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSObject.h>
  7.  
  8. @class NSArray, NSDictionary, NSString;
  9.  
  10. /* Because NSBundle caches allocated instances, subclasses should be prepared
  11.    to receive an already initialized object back from [super initWithPath:] */
  12. @interface NSBundle : NSObject {
  13. @private
  14.     struct {
  15.     unsigned int    _externRetain : 1;
  16.     unsigned int    _retainCount : 7;
  17.     unsigned int    _bundleType : 3;
  18.     unsigned int    _codeLoaded : 1;
  19.     unsigned int    _codeAttempted : 1;
  20.     unsigned int    _reserved : 19;
  21.     }            _flags;
  22.     id            _infoDictionary;
  23.     void        *_classes;
  24.     Class        _principalClass;
  25.     void        *_reserved3;
  26.     void        *_reserved2;
  27.     void        *_reserved1;
  28.     void        *_reserved;
  29. }
  30.  
  31. + (NSBundle *)mainBundle;
  32. + (NSBundle *)bundleWithPath:(NSString *)path;
  33. - (id)initWithPath:(NSString *)path;
  34.  
  35. + (NSBundle *)bundleForClass:(Class)aClass;
  36.  
  37. #if !defined(STRICT_40)
  38. + (NSArray *)allBundles;
  39. + (NSArray *)allFrameworks;
  40. #endif
  41.  
  42. - (NSString *)bundlePath;
  43. - (NSString *)resourcePath;
  44.  
  45. - (Class)classNamed:(NSString *)className;
  46.  
  47. - (Class)principalClass;
  48.  
  49. + (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)path;
  50. - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext;
  51. - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath;
  52.  
  53. - (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)subpath;
  54.  
  55. - (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName;
  56.  
  57. #if !defined(STRICT_OPENSTEP)
  58.  
  59. - (NSDictionary *)infoDictionary;
  60.  
  61. #endif /* !STRICT_OPENSTEP */
  62.  
  63. @end
  64.  
  65. #define NSLocalizedString(key, comment) \
  66.         [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
  67. #define NSLocalizedStringFromTable(key, tbl, comment) \
  68.         [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
  69. #define NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment) \
  70.         [bundle localizedStringForKey:(key) value:@"" table:(tbl)]
  71.  
  72. FOUNDATION_EXPORT NSString *NSBundleDidLoadNotification;
  73. FOUNDATION_EXPORT NSString *NSLoadedClasses;    // notification key
  74.  
  75.