Guest User

Untitled

a guest
Jun 19th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.21 KB | None | 0 0
  1. /* NSString.h
  2. Copyright (c) 1994-2007, Apple Inc. All rights reserved.
  3. */
  4.  
  5. typedef unsigned short unichar;
  6.  
  7. #import <limits.h>
  8. #import <Foundation/NSObject.h>
  9. #import <Foundation/NSRange.h>
  10. #import <stdarg.h>
  11.  
  12. @class NSData, NSArray, NSDictionary, NSCharacterSet, NSData, NSURL, NSError, NSLocale;
  13.  
  14. FOUNDATION_EXPORT NSString * const NSParseErrorException; // raised by -propertyList
  15.  
  16. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
  17. #define NSMaximumStringLength (INT_MAX-1)
  18. #endif
  19.  
  20. /* These options apply to the various search/find and comparison methods (except where noted).
  21. */
  22. enum {
  23. NSCaseInsensitiveSearch = 1,
  24. NSLiteralSearch = 2, /* Exact character-by-character equivalence */
  25. NSBackwardsSearch = 4, /* Search from end of source string */
  26. NSAnchoredSearch = 8, /* Search is limited to start (or end, if NSBackwardsSearch) of source string */
  27. NSNumericSearch = 64 /* Added in 10.2; Numbers within strings are compared using numeric value, that is, Foo2.txt < Foo7.txt < Foo25.txt; only applies to compare methods, not find */
  28. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  29. ,
  30. NSDiacriticInsensitiveSearch = 128, /* If specified, ignores diacritics (o-umlaut == o) */
  31. NSWidthInsensitiveSearch = 256, /* If specified, ignores width differences ('a' == UFF41) */
  32. NSForcedOrderingSearch = 512 /* If specified, comparisons are forced to return either NSOrderedAscending or NSOrderedDescending if the strings are equivalent but not strictly equal, for stability when sorting (e.g. "aaa" > "AAA" with NSCaseInsensitiveSearch specified) */
  33. #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 */
  34. #if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
  35. ,
  36. NSRegularExpressionSearch = 1024 /* Applies to rangeOfString:... methods only; the search string is treated as an ICU-compatible regular expression; if set, no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch */
  37. #endif /* __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED */
  38. };
  39. typedef NSUInteger NSStringCompareOptions;
  40.  
  41. /* Note that in addition to the values explicitly listed below, NSStringEncoding supports encodings provided by CFString.
  42. See CFStringEncodingExt.h for a list of these encodings.
  43. See CFString.h for functions which convert between NSStringEncoding and CFStringEncoding.
  44. */
  45. enum {
  46. NSASCIIStringEncoding = 1, /* 0..127 only */
  47. NSNEXTSTEPStringEncoding = 2,
  48. NSJapaneseEUCStringEncoding = 3,
  49. NSUTF8StringEncoding = 4,
  50. NSISOLatin1StringEncoding = 5,
  51. NSSymbolStringEncoding = 6,
  52. NSNonLossyASCIIStringEncoding = 7,
  53. NSShiftJISStringEncoding = 8,
  54. NSISOLatin2StringEncoding = 9,
  55. NSUnicodeStringEncoding = 10,
  56. NSWindowsCP1251StringEncoding = 11, /* Cyrillic; same as AdobeStandardCyrillic */
  57. NSWindowsCP1252StringEncoding = 12, /* WinLatin1 */
  58. NSWindowsCP1253StringEncoding = 13, /* Greek */
  59. NSWindowsCP1254StringEncoding = 14, /* Turkish */
  60. NSWindowsCP1250StringEncoding = 15, /* WinLatin2 */
  61. NSISO2022JPStringEncoding = 21, /* ISO 2022 Japanese encoding for e-mail */
  62. NSMacOSRomanStringEncoding = 30,
  63.  
  64. NSUTF16StringEncoding = NSUnicodeStringEncoding, /* An alias for NSUnicodeStringEncoding */
  65.  
  66. #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
  67. NSUTF16BigEndianStringEncoding = 0x90000100, /* NSUTF16StringEncoding encoding with explicit endianness specified */
  68. NSUTF16LittleEndianStringEncoding = 0x94000100, /* NSUTF16StringEncoding encoding with explicit endianness specified */
  69.  
  70. NSUTF32StringEncoding = 0x8c000100,
  71. NSUTF32BigEndianStringEncoding = 0x98000100, /* NSUTF32StringEncoding encoding with explicit endianness specified */
  72. NSUTF32LittleEndianStringEncoding = 0x9c000100 /* NSUTF32StringEncoding encoding with explicit endianness specified */
  73. #endif
  74. };
  75. typedef NSUInteger NSStringEncoding;
  76.  
  77. #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
  78. enum {
  79. NSStringEncodingConversionAllowLossy = 1,
  80. NSStringEncodingConversionExternalRepresentation = 2
  81. };
  82. typedef NSUInteger NSStringEncodingConversionOptions;
  83. #endif
  84.  
  85. FOUNDATION_EXPORT NSString * const NSCharacterConversionException;
  86.  
  87.  
  88. @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
  89.  
  90. /* NSString primitive (funnel) methods. A minimal subclass of NSString just needs to implement these, although we also recommend getCharacters:range:. See below for the other methods.
  91. */
  92. - (NSUInteger)length;
  93. - (unichar)characterAtIndex:(NSUInteger)index;
  94.  
  95. @end
  96.  
  97. @interface NSString (NSStringExtensionMethods)
  98.  
  99. - (void)getCharacters:(unichar *)buffer;
  100. - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange;
  101.  
  102. - (NSString *)substringFromIndex:(NSUInteger)from;
  103. - (NSString *)substringToIndex:(NSUInteger)to;
  104. - (NSString *)substringWithRange:(NSRange)range; // Hint: Use with rangeOfComposedCharacterSequencesForRange: to avoid breaking up composed characters
  105.  
  106. - (NSComparisonResult)compare:(NSString *)string;
  107. - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask;
  108. - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange;
  109. - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange locale:(id)locale; // locale arg used to be a dictionary pre-Leopard. We now accepts NSLocale. Assumes the current locale if non-nil and non-NSLocale.
  110. - (NSComparisonResult)caseInsensitiveCompare:(NSString *)string;
  111. - (NSComparisonResult)localizedCompare:(NSString *)string;
  112. - (NSComparisonResult)localizedCaseInsensitiveCompare:(NSString *)string;
  113.  
  114. - (BOOL)isEqualToString:(NSString *)aString;
  115.  
  116. - (BOOL)hasPrefix:(NSString *)aString;
  117. - (BOOL)hasSuffix:(NSString *)aString;
  118.  
  119. /* These methods return length==0 if the target string is not found. So, to check for containment: ([str rangeOfString:@"target"].length > 0). Note that the length of the range returned by these methods might be different than the length of the target string, due composed characters and such.
  120. */
  121. - (NSRange)rangeOfString:(NSString *)aString;
  122. - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask;
  123. - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange;
  124. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  125. - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange locale:(NSLocale *)locale;
  126. #endif
  127.  
  128. /* These return the range of the first character from the set in the string, not the range of a sequence of characters.
  129. */
  130. - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet;
  131. - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask;
  132. - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask range:(NSRange)searchRange;
  133.  
  134. - (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)index;
  135. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  136. - (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range;
  137. #endif
  138.  
  139. - (NSString *)stringByAppendingString:(NSString *)aString;
  140. - (NSString *)stringByAppendingFormat:(NSString *)format, ...;
  141.  
  142. /* The following convenience methods all skip initial space characters (whitespaceSet) and ignore trailing characters. NSScanner can be used for more "exact" parsing of numbers.
  143. */
  144. - (double)doubleValue;
  145. - (float)floatValue;
  146. - (int)intValue;
  147. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  148. - (NSInteger)integerValue;
  149. - (long long)longLongValue;
  150. - (BOOL)boolValue; // Skips initial space characters (whitespaceSet), or optional -/+ sign followed by zeroes. Returns YES on encountering one of "Y", "y", "T", "t", or a digit 1-9. It ignores any trailing characters.
  151. #endif
  152.  
  153. - (NSArray *)componentsSeparatedByString:(NSString *)separator;
  154. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  155. - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)separator;
  156. #endif
  157.  
  158. - (NSString *)commonPrefixWithString:(NSString *)aString options:(NSStringCompareOptions)mask;
  159.  
  160. - (NSString *)uppercaseString;
  161. - (NSString *)lowercaseString;
  162. - (NSString *)capitalizedString;
  163.  
  164. #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
  165. - (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set;
  166. - (NSString *)stringByPaddingToLength:(NSUInteger)newLength withString:(NSString *)padString startingAtIndex:(NSUInteger)padIndex;
  167. #endif
  168.  
  169. - (void)getLineStart:(NSUInteger *)startPtr end:(NSUInteger *)lineEndPtr contentsEnd:(NSUInteger *)contentsEndPtr forRange:(NSRange)range;
  170. - (NSRange)lineRangeForRange:(NSRange)range;
  171.  
  172. #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED
  173. - (void)getParagraphStart:(NSUInteger *)startPtr end:(NSUInteger *)parEndPtr contentsEnd:(NSUInteger *)contentsEndPtr forRange:(NSRange)range;
  174. - (NSRange)paragraphRangeForRange:(NSRange)range;
  175. #endif
  176.  
  177. - (NSString *)description;
  178.  
  179. - (NSUInteger)hash;
  180.  
  181. /*** Encoding methods ***/
  182.  
  183. - (NSStringEncoding)fastestEncoding; // Result in O(1) time; a rough estimate
  184. - (NSStringEncoding)smallestEncoding; // Result in O(n) time; the encoding in which the string is most compact
  185.  
  186. - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding allowLossyConversion:(BOOL)lossy; // External representation
  187. - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding; // External representation
  188.  
  189. - (BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding;
  190.  
  191. #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
  192. /* Methods to convert NSString to a NULL-terminated cString using the specified encoding. Note, these are the "new" cString methods, and are not deprecated like the older cString methods which do not take encoding arguments.
  193. */
  194. - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding; // "Autoreleased"; NULL return if encoding conversion not possible; for performance reasons, lifetime of this should not be considered longer than the lifetime of the receiving string (if the receiver string is freed, this might go invalid then, before the end of the autorelease scope)
  195. - (BOOL)getCString:(char *)buffer maxLength:(NSUInteger)maxBufferCount encoding:(NSStringEncoding)encoding; // NO return if conversion not possible due to encoding errors or too small of a buffer. The buffer should include room for maxBufferCount bytes; this number should accomodate the expected size of the return value plus the NULL termination character, which this method adds. (So note that the maxLength passed to this method is one more than the one you would have passed to the deprecated getCString:maxLength:.)
  196.  
  197. /* Use this to convert string section at a time into a fixed-size buffer, without any allocations. Does not NULL-terminate.
  198. buffer is the buffer to write to; if NULL, this method can be used to computed size of needed buffer.
  199. maxBufferCount is the length of the buffer in bytes. It's a good idea to make sure this is at least enough to hold one character's worth of conversion.
  200. usedBufferCount is the length of the buffer used up by the current conversion. Can be NULL.
  201. encoding is the encoding to convert to.
  202. options specifies the options to apply.
  203. range is the range to convert.
  204. leftOver is the remaining range. Can be NULL.
  205. YES return indicates some characters were converted. Conversion might usually stop when the buffer fills,
  206. but it might also stop when the conversion isn't possible due to the chosen encoding.
  207. */
  208. - (BOOL)getBytes:(void *)buffer maxLength:(NSUInteger)maxBufferCount usedLength:(NSUInteger *)usedBufferCount encoding:(NSStringEncoding)encoding options:(NSStringEncodingConversionOptions)options range:(NSRange)range remainingRange:(NSRangePointer)leftover;
  209.  
  210. /* These return the maximum and exact number of bytes needed to store the receiver in the specified encoding in non-external representation. The first one is O(1), while the second one is O(n). These do not include space for a terminating null.
  211. */
  212. - (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(1) time; the estimate may be way over what's needed
  213. - (NSUInteger)lengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(n) time; the result is exact
  214. #endif
  215.  
  216. #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
  217. - (NSString *)decomposedStringWithCanonicalMapping;
  218. - (NSString *)precomposedStringWithCanonicalMapping;
  219. - (NSString *)decomposedStringWithCompatibilityMapping;
  220. - (NSString *)precomposedStringWithCompatibilityMapping;
  221. #endif
  222.  
  223. #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
  224. /* Returns a string with the character folding options applied. theOptions is a mask of compare flags with *InsensitiveSearch suffix.
  225. */
  226. - (NSString *)stringByFoldingWithOptions:(NSStringCompareOptions)options locale:(NSLocale *)locale;
  227.  
  228. /* Replace all occurrences of the target string in the specified range with replacement. Specified compare options are used for matching target.
  229. */
  230. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange;
  231.  
  232. /* Replace all occurrences of the target string with replacement. Invokes the above method with 0 options and range of the whole string.
  233. */
  234. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;
  235.  
  236. /* Replace characters in range with the specified string, returning new string.
  237. */
  238. - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement;
  239. #endif
  240.  
  241. - (const char *)UTF8String; // Convenience to return null-terminated UTF8 representation
  242.  
  243. /* User-dependent encoding who value is derived from user's default language and potentially other factors. The use of this encoding might sometimes be needed when interpreting user documents with unknown encodings, in the absence of other hints. This encoding should be used rarely, if at all. Note that some potential values here might result in unexpected encoding conversions of even fairly straightforward NSString content --- for instance, punctuation characters with a bidirectional encoding.
  244. */
  245. + (NSStringEncoding)defaultCStringEncoding; // Should be rarely used
  246.  
  247. + (const NSStringEncoding *)availableStringEncodings;
  248. + (NSString *)localizedNameOfStringEncoding:(NSStringEncoding)encoding;
  249.  
  250. /*** Creation methods ***/
  251.  
  252. /* In general creation methods in NSString do not apply to subclassers, as subclassers are assumed to provide their own init methods which create the string in the way the subclass wishes. Designated initializers of NSString are thus init and initWithCoder:.
  253. */
  254. - (id)init;
  255. - (id)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer; /* "NoCopy" is a hint */
  256. - (id)initWithCharacters:(const unichar *)characters length:(NSUInteger)length;
  257. - (id)initWithUTF8String:(const char *)nullTerminatedCString;
  258. - (id)initWithString:(NSString *)aString;
  259. - (id)initWithFormat:(NSString *)format, ...;
  260. - (id)initWithFormat:(NSString *)format arguments:(va_list)argList;
  261. - (id)initWithFormat:(NSString *)format locale:(id)locale, ...;
  262. - (id)initWithFormat:(NSString *)format locale:(id)locale arguments:(va_list)argList;
  263. - (id)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding;
  264. - (id)initWithBytes:(const void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding;
  265. #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED
  266. - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)freeBuffer; /* "NoCopy" is a hint */
  267. #endif
  268.  
  269. + (id)string;
  270. + (id)stringWithString:(NSString *)string;
  271. + (id)stringWithCharacters:(const unichar *)characters length:(NSUInteger)length;
  272. + (id)stringWithUTF8String:(const char *)nullTerminatedCString;
  273. + (id)stringWithFormat:(NSString *)format, ...;
  274. + (id)localizedStringWithFormat:(NSString *)format, ...;
  275.  
  276. #if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
  277. - (id)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding;
  278. + (id)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc;
  279.  
  280. /* These use the specified encoding. If nil is returned, the optional error return indicates problem that was encountered (for instance, file system or encoding errors).
  281. */
  282. - (id)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
  283. - (id)initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error;
  284. + (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
  285. + (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error;
  286.  
  287. /* These try to determine the encoding, and return the encoding which was used. Note that these methods might get "smarter" in subsequent releases of the system, and use additional techniques for recognizing encodings. If nil is returned, the optional error return indicates problem that was encountered (for instance, file system or encoding errors).
  288. */
  289. - (id)initWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error;
  290. - (id)initWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error;
  291. + (id)stringWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error;
  292. + (id)stringWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error;
  293.  
  294. /* Write to specified url or path using the specified encoding. The optional error return is to indicate file system or encoding errors.
  295. */
  296. - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError **)error;
  297. - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError **)error;
  298.  
  299. #endif
  300.  
  301.  
  302. @end
  303.  
  304.  
  305. @interface NSMutableString : NSString
  306.  
  307. /* NSMutableString primitive (funnel) method. See below for the other mutation methods.
  308. */
  309. - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString;
  310.  
  311. @end
  312.  
  313. @interface NSMutableString (NSMutableStringExtensionMethods)
  314.  
  315. - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc;
  316. - (void)deleteCharactersInRange:(NSRange)range;
  317. - (void)appendString:(NSString *)aString;
  318. - (void)appendFormat:(NSString *)format, ...;
  319. - (void)setString:(NSString *)aString;
  320.  
  321. /* In addition to these two, NSMutableString responds properly to all NSString creation methods.
  322. */
  323. - (id)initWithCapacity:(NSUInteger)capacity;
  324. + (id)stringWithCapacity:(NSUInteger)capacity;
  325.  
  326. #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
  327. /* This method replaces all occurrences of the target string with the replacement string, in the specified range of the receiver string, and returns the number of replacements. NSBackwardsSearch means the search is done from the end of the range (the results could be different); NSAnchoredSearch means only anchored (but potentially multiple) instances will be replaced. NSLiteralSearch and NSCaseInsensitiveSearch also apply. NSNumericSearch is ignored. Use NSMakeRange(0, [receiver length]) to process whole string.
  328. */
  329. - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange;
  330. #endif
  331.  
  332. @end
  333.  
  334.  
  335.  
  336. @interface NSString (NSExtendedStringPropertyListParsing)
  337.  
  338. - (id)propertyList;
  339. - (NSDictionary *)propertyListFromStringsFileFormat;
  340.  
  341. @end
  342.  
  343.  
  344.  
  345. @interface NSString (NSStringDeprecated)
  346.  
  347. /* The methods in this category are deprecated and will be removed from this header file in the near future. These methods use [NSString defaultCStringEncoding] as the encoding to convert to, which means the results depend on the user's language and potentially other settings. This might be appropriate in some cases, but often these methods are misused, resulting in issues when running in languages other then English. UTF8String in general is a much better choice when converting arbitrary NSStrings into 8-bit representations. Additional potential replacement methods are being introduced in NSString as appropriate.
  348. */
  349. - (const char *)cString DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  350. - (const char *)lossyCString DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  351. - (NSUInteger)cStringLength DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  352. - (void)getCString:(char *)bytes DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  353. - (void)getCString:(char *)bytes maxLength:(NSUInteger)maxLength DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  354. - (void)getCString:(char *)bytes maxLength:(NSUInteger)maxLength range:(NSRange)aRange remainingRange:(NSRangePointer)leftoverRange DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  355.  
  356. - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  357. - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  358.  
  359. - (id)initWithContentsOfFile:(NSString *)path DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  360. - (id)initWithContentsOfURL:(NSURL *)url DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  361. + (id)stringWithContentsOfFile:(NSString *)path DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  362. + (id)stringWithContentsOfURL:(NSURL *)url DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  363.  
  364. - (id)initWithCStringNoCopy:(char *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  365. - (id)initWithCString:(const char *)bytes length:(NSUInteger)length DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  366. - (id)initWithCString:(const char *)bytes DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  367. + (id)stringWithCString:(const char *)bytes length:(NSUInteger)length DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  368. + (id)stringWithCString:(const char *)bytes DEPRECATED_IN_MAC_OS_X_VERSION_10_4_AND_LATER;
  369.  
  370. @end
  371.  
  372. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
  373. enum {
  374. NSProprietaryStringEncoding = 65536 /* Installation-specific encoding */
  375. };
  376. #endif
  377.  
  378.  
  379.  
  380.  
  381. /* The rest of this file is bookkeeping stuff that has to be here. Don't use this stuff, don't refer to it.
  382. */
  383. #if !defined(_OBJC_UNICHAR_H_)
  384. #define _OBJC_UNICHAR_H_
  385. #endif
  386. #define NS_UNICHAR_IS_EIGHT_BIT 0
  387.  
  388. @interface NSSimpleCString : NSString {
  389. @protected
  390. char *bytes;
  391. int numBytes;
  392. #if __LP64__
  393. int _unused;
  394. #endif
  395. }
  396. @end
  397.  
  398. @interface NSConstantString : NSSimpleCString
  399. @end
  400.  
  401. #if __LP64__
  402. #else
  403. extern void *_NSConstantStringClassReference;
  404. #endif
Add Comment
Please, Sign In to add comment