mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Minor tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5293 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0056c7226a
commit
d4c4e59396
3 changed files with 142 additions and 144 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri Nov 26 19:46:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Headers/Foundation/NSString.h: Tidied and fixed return types for
|
||||
for a few methods.
|
||||
* Source/NSString.m: ditto.
|
||||
|
||||
Sun Nov 21 6:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSNotificationQueue.m: Applied patch by Dan Pascu to fix bug
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Interface for NSObject for GNUStep
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Date: 1995
|
||||
|
@ -66,62 +66,62 @@ typedef enum _NSStringEncoding
|
|||
/* NB. Must not have an encoding with value zero - so we can use zero to
|
||||
tell that a variable that should contain an encoding has not yet been
|
||||
initialised */
|
||||
GSUndefinedEncoding = 0,
|
||||
NSASCIIStringEncoding = 1,
|
||||
NSNEXTSTEPStringEncoding = 2,
|
||||
NSJapaneseEUCStringEncoding = 3,
|
||||
NSUTF8StringEncoding = 4,
|
||||
NSISOLatin1StringEncoding = 5,
|
||||
NSSymbolStringEncoding = 6,
|
||||
NSNonLossyASCIIStringEncoding = 7,
|
||||
NSShiftJISStringEncoding = 8,
|
||||
NSISOLatin2StringEncoding = 9,
|
||||
NSUnicodeStringEncoding = 10,
|
||||
NSWindowsCP1251StringEncoding = 11,
|
||||
NSWindowsCP1252StringEncoding = 12,
|
||||
NSWindowsCP1253StringEncoding = 13,
|
||||
NSWindowsCP1254StringEncoding = 14,
|
||||
NSWindowsCP1250StringEncoding = 15,
|
||||
NSISO2022JPStringEncoding = 21,
|
||||
GSUndefinedEncoding = 0,
|
||||
NSASCIIStringEncoding = 1,
|
||||
NSNEXTSTEPStringEncoding = 2,
|
||||
NSJapaneseEUCStringEncoding = 3,
|
||||
NSUTF8StringEncoding = 4,
|
||||
NSISOLatin1StringEncoding = 5,
|
||||
NSSymbolStringEncoding = 6,
|
||||
NSNonLossyASCIIStringEncoding = 7,
|
||||
NSShiftJISStringEncoding = 8,
|
||||
NSISOLatin2StringEncoding = 9,
|
||||
NSUnicodeStringEncoding = 10,
|
||||
NSWindowsCP1251StringEncoding = 11,
|
||||
NSWindowsCP1252StringEncoding = 12,
|
||||
NSWindowsCP1253StringEncoding = 13,
|
||||
NSWindowsCP1254StringEncoding = 14,
|
||||
NSWindowsCP1250StringEncoding = 15,
|
||||
NSISO2022JPStringEncoding = 21,
|
||||
// GNUstep additions
|
||||
NSCyrillicStringEncoding = 22
|
||||
NSCyrillicStringEncoding = 22
|
||||
|
||||
} NSStringEncoding;
|
||||
|
||||
enum {
|
||||
NSOpenStepUnicodeReservedBase = 0xF400
|
||||
NSOpenStepUnicodeReservedBase = 0xF400
|
||||
};
|
||||
|
||||
@protocol NSString <NSCoding, NSCopying, NSMutableCopying>
|
||||
|
||||
// Creating Temporary Strings
|
||||
+ (NSString*) string;
|
||||
+ (NSString*) stringWithCharacters: (const unichar*)chars
|
||||
length: (unsigned int)length;
|
||||
+ (NSString*) stringWithCString: (const char*)byteString
|
||||
length: (unsigned int)length;
|
||||
+ (NSString*) stringWithCString: (const char*) byteString;
|
||||
+ (NSString*) stringWithFormat: (NSString*)format,...;
|
||||
+ (NSString*) stringWithContentsOfFile:(NSString *)path;
|
||||
+ (id) string;
|
||||
+ (id) stringWithCharacters: (const unichar*)chars
|
||||
length: (unsigned int)length;
|
||||
+ (id) stringWithCString: (const char*)byteString
|
||||
length: (unsigned int)length;
|
||||
+ (id) stringWithCString: (const char*) byteString;
|
||||
+ (id) stringWithFormat: (NSString*)format,...;
|
||||
+ (id) stringWithContentsOfFile:(NSString *)path;
|
||||
|
||||
// Initializing Newly Allocated Strings
|
||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||
length: (unsigned int)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
length: (unsigned int)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
- (id) initWithCharacters: (const unichar*)chars
|
||||
length: (unsigned int)length;
|
||||
length: (unsigned int)length;
|
||||
- (id) initWithCStringNoCopy: (char*)byteString
|
||||
length: (unsigned int)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
length: (unsigned int)length
|
||||
freeWhenDone: (BOOL)flag;
|
||||
- (id) initWithCString: (const char*)byteString
|
||||
length: (unsigned int)length;
|
||||
length: (unsigned int)length;
|
||||
- (id) initWithCString: (const char*)byteString;
|
||||
- (id) initWithString: (NSString*)string;
|
||||
- (id) initWithFormat: (NSString*)format,...;
|
||||
- (id) initWithFormat: (NSString*)format
|
||||
arguments: (va_list)argList;
|
||||
arguments: (va_list)argList;
|
||||
- (id) initWithData: (NSData*)data
|
||||
encoding: (NSStringEncoding)encoding;
|
||||
encoding: (NSStringEncoding)encoding;
|
||||
- (id) initWithContentsOfFile: (NSString*)path;
|
||||
- (id) init;
|
||||
|
||||
|
@ -132,7 +132,7 @@ enum {
|
|||
- (unichar) characterAtIndex: (unsigned int)index;
|
||||
- (void) getCharacters: (unichar*)buffer;
|
||||
- (void) getCharacters: (unichar*)buffer
|
||||
range: (NSRange)aRange;
|
||||
range: (NSRange)aRange;
|
||||
|
||||
// Combining Strings
|
||||
- (NSString*) stringByAppendingFormat: (NSString*)format,...;
|
||||
|
@ -147,16 +147,16 @@ enum {
|
|||
// Finding Ranges of Characters and Substrings
|
||||
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet;
|
||||
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet
|
||||
options: (unsigned int)mask;
|
||||
options: (unsigned int)mask;
|
||||
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
- (NSRange) rangeOfString: (NSString*)string;
|
||||
- (NSRange) rangeOfString: (NSString*)string
|
||||
options: (unsigned int)mask;
|
||||
options: (unsigned int)mask;
|
||||
- (NSRange) rangeOfString: (NSString*)aString
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
|
||||
// Determining Composed Character Sequences
|
||||
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex;
|
||||
|
@ -168,10 +168,10 @@ enum {
|
|||
// Identifying and Comparing Strings
|
||||
- (NSComparisonResult) compare: (NSString*)aString;
|
||||
- (NSComparisonResult) compare: (NSString*)aString
|
||||
options: (unsigned int)mask;
|
||||
options: (unsigned int)mask;
|
||||
- (NSComparisonResult) compare: (NSString*)aString
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
options: (unsigned int)mask
|
||||
range: (NSRange)aRange;
|
||||
- (BOOL) hasPrefix: (NSString*)aString;
|
||||
- (BOOL) hasSuffix: (NSString*)aString;
|
||||
- (BOOL) isEqual: (id)anObject;
|
||||
|
@ -180,7 +180,7 @@ enum {
|
|||
|
||||
// Getting a Shared Prefix
|
||||
- (NSString*) commonPrefixWithString: (NSString*)aString
|
||||
options: (unsigned int)mask;
|
||||
options: (unsigned int)mask;
|
||||
|
||||
// Changing Case
|
||||
- (NSString*) capitalizedString;
|
||||
|
@ -192,11 +192,11 @@ enum {
|
|||
- (unsigned int) cStringLength;
|
||||
- (void) getCString: (char*)buffer;
|
||||
- (void) getCString: (char*)buffer
|
||||
maxLength: (unsigned int)maxLength;
|
||||
maxLength: (unsigned int)maxLength;
|
||||
- (void) getCString: (char*)buffer
|
||||
maxLength: (unsigned int)maxLength
|
||||
range: (NSRange)aRange
|
||||
remainingRange: (NSRange*)leftoverRange;
|
||||
maxLength: (unsigned int)maxLength
|
||||
range: (NSRange)aRange
|
||||
remainingRange: (NSRange*)leftoverRange;
|
||||
|
||||
// Getting Numeric Values
|
||||
- (float) floatValue;
|
||||
|
@ -206,7 +206,7 @@ enum {
|
|||
- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;
|
||||
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding;
|
||||
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
|
||||
allowLossyConversion: (BOOL)flag;
|
||||
allowLossyConversion: (BOOL)flag;
|
||||
+ (NSStringEncoding) defaultCStringEncoding;
|
||||
- (NSString*) description;
|
||||
- (NSStringEncoding) fastestEncoding;
|
||||
|
@ -214,9 +214,9 @@ enum {
|
|||
|
||||
// Manipulating File System Paths
|
||||
- (unsigned int) completePathIntoString: (NSString**)outputName
|
||||
caseSensitive: (BOOL)flag
|
||||
matchesIntoArray: (NSArray**)outputArray
|
||||
filterTypes: (NSArray*)filterTypes;
|
||||
caseSensitive: (BOOL)flag
|
||||
matchesIntoArray: (NSArray**)outputArray
|
||||
filterTypes: (NSArray*)filterTypes;
|
||||
- (const char*) fileSystemRepresentation;
|
||||
- (BOOL) getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)l;
|
||||
- (NSString*) lastPathComponent;
|
||||
|
@ -252,13 +252,13 @@ enum {
|
|||
- (BOOL) writeToFile: (NSString*)filename
|
||||
atomically: (BOOL)useAuxiliaryFile;
|
||||
- (double) doubleValue;
|
||||
+ (NSStringEncoding*)availableStringEncodings;
|
||||
+ (NSString*)localizedNameOfStringEncoding:(NSStringEncoding)encoding;
|
||||
- (void)getLineStart:(unsigned int *)startIndex
|
||||
end:(unsigned int *)lineEndIndex
|
||||
contentsEnd:(unsigned int *)contentsEndIndex
|
||||
forRange:(NSRange)aRange;
|
||||
- (NSRange)lineRangeForRange:(NSRange)aRange;
|
||||
+ (NSStringEncoding*) availableStringEncodings;
|
||||
+ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding;
|
||||
- (void) getLineStart: (unsigned int *)startIndex
|
||||
end: (unsigned int *)lineEndIndex
|
||||
contentsEnd: (unsigned int *)contentsEndIndex
|
||||
forRange: (NSRange)aRange;
|
||||
- (NSRange) lineRangeForRange: (NSRange)aRange;
|
||||
- (const char*) lossyCString;
|
||||
#endif
|
||||
|
||||
|
@ -282,21 +282,10 @@ enum {
|
|||
@protocol NSMutableString <NSString>
|
||||
|
||||
// Creating Temporary Strings
|
||||
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity;
|
||||
#if 0
|
||||
These methods were already declared above with different return type.
|
||||
Including them again here with different return type causes a
|
||||
compiler warning.
|
||||
+ (NSMutableString*) stringWithCharacters: (const unichar*)characters
|
||||
length: (unsigned)length;
|
||||
+ (NSMutableString*) stringWithCString: (const char*)byteString;
|
||||
+ (NSMutableString*) stringWithCString: (const char*)bytes
|
||||
length:(unsigned)length;
|
||||
+ (NSMutableString*) stringWithFormat: (NSString*)format, ...;
|
||||
#endif
|
||||
+ (NSMutableString*) stringWithCapacity: (unsigned)capacity;
|
||||
|
||||
// Initializing Newly Allocated Strings
|
||||
- initWithCapacity:(unsigned)capacity;
|
||||
- (id) initWithCapacity: (unsigned)capacity;
|
||||
|
||||
// Modify A String
|
||||
- (void) appendFormat: (NSString*)format, ...;
|
||||
|
@ -304,7 +293,7 @@ compiler warning.
|
|||
- (void) deleteCharactersInRange: (NSRange)range;
|
||||
- (void) insertString: (NSString*)aString atIndex:(unsigned)index;
|
||||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString;
|
||||
withString: (NSString*)aString;
|
||||
- (void) setString: (NSString*)aString;
|
||||
|
||||
@end
|
||||
|
@ -327,33 +316,33 @@ compiler warning.
|
|||
|
||||
#ifndef NO_GNUSTEP
|
||||
@interface NSString (GSString)
|
||||
-(NSString*)stringWithoutSuffix:(NSString*)_suffix;
|
||||
-(NSString*)stringWithoutPrefix:(NSString*)_prefix;
|
||||
-(NSString*)stringByReplacingString:(NSString*)_replace
|
||||
withString:(NSString*)_by;
|
||||
- (NSString*) stringWithoutSuffix: (NSString*)_suffix;
|
||||
- (NSString*) stringWithoutPrefix: (NSString*)_prefix;
|
||||
- (NSString*) stringByReplacingString: (NSString*)_replace
|
||||
withString: (NSString*)_by;
|
||||
@end
|
||||
|
||||
@interface NSString(GSTrimming)
|
||||
-(NSString*)stringByTrimmingLeadWhiteSpaces;
|
||||
-(NSString*)stringByTrimmingTailWhiteSpaces;
|
||||
-(NSString*)stringByTrimmingWhiteSpaces;
|
||||
- (NSString*) stringByTrimmingLeadWhiteSpaces;
|
||||
- (NSString*) stringByTrimmingTailWhiteSpaces;
|
||||
- (NSString*) stringByTrimmingWhiteSpaces;
|
||||
|
||||
-(NSString*)stringByTrimmingLeadSpaces;
|
||||
-(NSString*)stringByTrimmingTailSpaces;
|
||||
-(NSString*)stringByTrimmingSpaces;
|
||||
- (NSString*) stringByTrimmingLeadSpaces;
|
||||
- (NSString*) stringByTrimmingTailSpaces;
|
||||
- (NSString*) stringByTrimmingSpaces;
|
||||
@end
|
||||
|
||||
@interface NSMutableString (GSString)
|
||||
-(void)removeSuffix:(NSString*)_suffix;
|
||||
-(void)removePrefix:(NSString*)_prefix;
|
||||
-(void)replaceString:(NSString*)_replace
|
||||
withString:(NSString*)_by;
|
||||
- (void) removeSuffix: (NSString*)_suffix;
|
||||
- (void) removePrefix: (NSString*)_prefix;
|
||||
- (void) replaceString: (NSString*)_replace
|
||||
withString: (NSString*)_by;
|
||||
@end
|
||||
|
||||
@interface NSMutableString (GSTrimming)
|
||||
-(void)trimLeadSpaces;
|
||||
-(void)trimTailSpaces;
|
||||
-(void)trimSpaces;
|
||||
- (void) trimLeadSpaces;
|
||||
- (void) trimTailSpaces;
|
||||
- (void) trimSpaces;
|
||||
@end
|
||||
#endif /* NO_GNUSTEP */
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
}
|
||||
|
||||
+ allocWithZone: (NSZone*)z
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if ([self class] == [NSString class])
|
||||
return NSAllocateObject ([self _concreteClass], 0, z);
|
||||
|
@ -307,44 +307,44 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
// Creating Temporary Strings
|
||||
|
||||
+ (NSString*) string
|
||||
+ (id) string
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] init]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithString: (NSString*)aString
|
||||
+ (id) stringWithString: (NSString*)aString
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithString: aString]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCharacters: (const unichar*)chars
|
||||
length: (unsigned)length
|
||||
+ (id) stringWithCharacters: (const unichar*)chars
|
||||
length: (unsigned)length
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCharacters: chars length: length]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCString: (const char*) byteString
|
||||
+ (id) stringWithCString: (const char*) byteString
|
||||
{
|
||||
return AUTORELEASE([[NSString_c_concrete_class allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCString: byteString]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCString: (const char*)byteString
|
||||
length: (unsigned)length
|
||||
+ (id) stringWithCString: (const char*)byteString
|
||||
length: (unsigned)length
|
||||
{
|
||||
return AUTORELEASE([[NSString_c_concrete_class allocWithZone:
|
||||
NSDefaultMallocZone()] initWithCString: byteString length: length]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithContentsOfFile: (NSString *)path
|
||||
+ (id) stringWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path]);
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithFormat: (NSString*)format,...
|
||||
+ (id) stringWithFormat: (NSString*)format,...
|
||||
{
|
||||
va_list ap;
|
||||
id ret;
|
||||
|
@ -359,8 +359,8 @@ handle_printf_atsign (FILE *stream,
|
|||
return ret;
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithFormat: (NSString*)format
|
||||
arguments: (va_list)argList
|
||||
+ (id) stringWithFormat: (NSString*)format
|
||||
arguments: (va_list)argList
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithFormat: format arguments: argList]);
|
||||
|
@ -379,8 +379,8 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
|
||||
- (id) initWithCharactersNoCopy: (unichar*)chars
|
||||
length: (unsigned)length
|
||||
freeWhenDone: (BOOL)flag
|
||||
length: (unsigned)length
|
||||
freeWhenDone: (BOOL)flag
|
||||
{
|
||||
if (flag)
|
||||
return [self initWithCharactersNoCopy: chars
|
||||
|
@ -609,7 +609,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
|
||||
- (id) initWithFormat: (NSString*)format
|
||||
locale: (NSDictionary*)dictionary
|
||||
locale: (NSDictionary*)dictionary
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return self;
|
||||
|
@ -1194,10 +1194,10 @@ handle_printf_atsign (FILE *stream,
|
|||
return NSMakeRange(startIndex, lineEndIndex - startIndex);
|
||||
}
|
||||
|
||||
- (void)getLineStart: (unsigned *)startIndex
|
||||
end: (unsigned *)lineEndIndex
|
||||
contentsEnd: (unsigned *)contentsEndIndex
|
||||
forRange: (NSRange)aRange
|
||||
- (void) getLineStart: (unsigned *)startIndex
|
||||
end: (unsigned *)lineEndIndex
|
||||
contentsEnd: (unsigned *)contentsEndIndex
|
||||
forRange: (NSRange)aRange
|
||||
{
|
||||
unichar thischar;
|
||||
unsigned start, end, len;
|
||||
|
@ -1444,7 +1444,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
|
||||
- (void) getCString: (char*)buffer
|
||||
maxLength: (unsigned)maxLength
|
||||
maxLength: (unsigned)maxLength
|
||||
{
|
||||
[self getCString: buffer maxLength: maxLength
|
||||
range: ((NSRange){0, [self length]})
|
||||
|
@ -1524,12 +1524,12 @@ handle_printf_atsign (FILE *stream,
|
|||
return _DefaultStringEncoding;
|
||||
}
|
||||
|
||||
+ (NSStringEncoding*)availableStringEncodings
|
||||
+ (NSStringEncoding*) availableStringEncodings
|
||||
{
|
||||
return _availableEncodings;
|
||||
}
|
||||
|
||||
+ (NSString*)localizedNameOfStringEncoding: (NSStringEncoding)encoding
|
||||
+ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding
|
||||
{
|
||||
id ourbundle;
|
||||
id ourname;
|
||||
|
@ -1651,9 +1651,9 @@ handle_printf_atsign (FILE *stream,
|
|||
// Manipulating File System Paths
|
||||
|
||||
- (unsigned) completePathIntoString: (NSString**)outputName
|
||||
caseSensitive: (BOOL)flag
|
||||
matchesIntoArray: (NSArray**)outputArray
|
||||
filterTypes: (NSArray*)filterTypes
|
||||
caseSensitive: (BOOL)flag
|
||||
matchesIntoArray: (NSArray**)outputArray
|
||||
filterTypes: (NSArray*)filterTypes
|
||||
{
|
||||
NSString *base_path = [self stringByDeletingLastPathComponent];
|
||||
NSString *last_compo = [self lastPathComponent];
|
||||
|
@ -1707,12 +1707,12 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
|
||||
/* Return a string for passing to OS calls to handle file system objects. */
|
||||
- (const char*)fileSystemRepresentation
|
||||
- (const char*) fileSystemRepresentation
|
||||
{
|
||||
return [self cString];
|
||||
}
|
||||
|
||||
- (BOOL)getFileSystemRepresentation: (char*)buffer maxLength: (unsigned)size
|
||||
- (BOOL) getFileSystemRepresentation: (char*)buffer maxLength: (unsigned)size
|
||||
{
|
||||
const char* ptr = [self cString];
|
||||
if (strlen(ptr) > size)
|
||||
|
@ -2250,12 +2250,13 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString
|
||||
{
|
||||
return [self compare: aString options: NSCaseInsensitiveSearch
|
||||
range: ((NSRange){0, [self length]})];
|
||||
return [self compare: aString
|
||||
options: NSCaseInsensitiveSearch
|
||||
range: ((NSRange){0, [self length]})];
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString*)filename
|
||||
atomically: (BOOL)useAuxiliaryFile
|
||||
atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
id d;
|
||||
if (!(d = [self dataUsingEncoding: [NSString defaultCStringEncoding]]))
|
||||
|
@ -2357,7 +2358,7 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
/* NSCopying Protocol */
|
||||
|
||||
- copyWithZone: (NSZone*)zone
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
if ([self isKindOfClass: [NSMutableString class]] ||
|
||||
NSShouldRetainWithZone(self, zone) == NO)
|
||||
|
@ -2558,7 +2559,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
|
||||
- (void) replaceCharactersInRange: (NSRange)range
|
||||
withString: (NSString*)aString
|
||||
withString: (NSString*)aString
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
@ -2691,7 +2692,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
NSCAssert2([self hasSuffix: _suffix],
|
||||
@"'%@' has not the suffix '%@'",self,_suffix);
|
||||
return [self substringToIndex: ([self length]-[_suffix length])];
|
||||
return [self substringToIndex: ([self length] - [_suffix length])];
|
||||
}
|
||||
|
||||
- (NSString*) stringWithoutPrefix: (NSString*)_prefix
|
||||
|
@ -2701,17 +2702,17 @@ handle_printf_atsign (FILE *stream,
|
|||
return [self substringFromIndex: [_prefix length]];
|
||||
}
|
||||
|
||||
- (NSString*) stringByReplacingString: (NSString*)_replace
|
||||
withString: (NSString*)_by
|
||||
- (NSString*) stringByReplacingString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
{
|
||||
NSRange range = [self rangeOfString: _replace];
|
||||
NSRange range = [self rangeOfString: replace];
|
||||
|
||||
if (range.length > 0)
|
||||
{
|
||||
NSMutableString *tmp = [self mutableCopy];
|
||||
NSString *str;
|
||||
|
||||
[tmp replaceString: _replace withString: _by];
|
||||
[tmp replaceString: replace withString: by];
|
||||
str = AUTORELEASE([tmp copy]);
|
||||
RELEASE(tmp);
|
||||
return str;
|
||||
|
@ -2728,34 +2729,36 @@ handle_printf_atsign (FILE *stream,
|
|||
NSCAssert2([self hasSuffix: _suffix],
|
||||
@"'%@' has not the suffix '%@'",self,_suffix);
|
||||
[self deleteCharactersInRange:
|
||||
NSMakeRange([self length]-[_suffix length],[_suffix length])];
|
||||
NSMakeRange([self length] - [_suffix length], [_suffix length])];
|
||||
}
|
||||
|
||||
- (void) removePrefix: (NSString*)_prefix;
|
||||
{
|
||||
NSCAssert2([self hasPrefix: _prefix],
|
||||
@"'%@' has not the prefix '%@'",self,_prefix);
|
||||
[self deleteCharactersInRange: NSMakeRange(0,[_prefix length])];
|
||||
[self deleteCharactersInRange: NSMakeRange(0, [_prefix length])];
|
||||
}
|
||||
|
||||
- (void) replaceString: (NSString*)_replace
|
||||
withString: (NSString*)_by
|
||||
- (void) replaceString: (NSString*)replace
|
||||
withString: (NSString*)by
|
||||
{
|
||||
NSRange range=[self rangeOfString: _replace];
|
||||
if (range.length>0)
|
||||
NSRange range = [self rangeOfString: replace];
|
||||
|
||||
if (range.length > 0)
|
||||
{
|
||||
unsigned byLen=[_by length];
|
||||
unsigned byLen = [by length];
|
||||
|
||||
do
|
||||
{
|
||||
[self replaceCharactersInRange: range
|
||||
withString: _by];
|
||||
range.location+=byLen;
|
||||
range.length=[self length]-range.location;
|
||||
range=[self rangeOfString: _replace
|
||||
options: 0
|
||||
range: range];
|
||||
withString: by];
|
||||
range.location += byLen;
|
||||
range.length = [self length] - range.location;
|
||||
range = [self rangeOfString: replace
|
||||
options: 0
|
||||
range: range];
|
||||
}
|
||||
while (range.length>0);
|
||||
while (range.length > 0);
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue