mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Move methods to Additions for use with gdl2 on MacOSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15723 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
114911c687
commit
938106220c
16 changed files with 173 additions and 125 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2003-01-26 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Compiling gdl2 on MacOSX.
|
||||||
|
* Headers/gnustep/base/NSObject.h (-notImplemented:,
|
||||||
|
-subclassResponsibility:, -shouldNotImplement:, -compare:): Move
|
||||||
|
to GSCategories category.
|
||||||
|
* Headers/gnustep/base/NSString.h (-stringByDeletingPrefix:,
|
||||||
|
-stringByDeletingSuffix:, -deleteSuffix:, -deletePrefix:): Idem.
|
||||||
|
* Source/NSObject: Move methods to Additions/GSCategories.m
|
||||||
|
* Source/NSString: Idem.
|
||||||
|
|
||||||
|
* Source/Additions/GSCompatibility.h (GetEncodingName): Add.
|
||||||
|
* Source/Additions/GSCompatibility.m (GetEncodingName): Cocoa
|
||||||
|
implementation.
|
||||||
|
|
||||||
2003-01-24 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-01-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Additions/GSCategories.m: Changed name of md5 digest method
|
* Source/Additions/GSCategories.m: Changed name of md5 digest method
|
||||||
|
|
|
@ -272,7 +272,6 @@ enum {NSNotFound = 0x7fffffff};
|
||||||
|
|
||||||
@interface NSObject (NEXTSTEP)
|
@interface NSObject (NEXTSTEP)
|
||||||
- error:(const char *)aString, ...;
|
- error:(const char *)aString, ...;
|
||||||
- notImplemented:(SEL)aSel;
|
|
||||||
/* - (const char *) name;
|
/* - (const char *) name;
|
||||||
Removed because OpenStep has -(NSString*)name; */
|
Removed because OpenStep has -(NSString*)name; */
|
||||||
@end
|
@end
|
||||||
|
@ -283,11 +282,8 @@ enum {NSNotFound = 0x7fffffff};
|
||||||
GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
|
|
||||||
@interface NSObject (GNU)
|
@interface NSObject (GNU)
|
||||||
- (NSComparisonResult) compare: (id)anObject;
|
|
||||||
- (id) makeImmutableCopyOnFail: (BOOL)force;
|
- (id) makeImmutableCopyOnFail: (BOOL)force;
|
||||||
- (Class) transmuteClassTo: (Class)aClassObject;
|
- (Class) transmuteClassTo: (Class)aClassObject;
|
||||||
- (id) subclassResponsibility: (SEL)aSel;
|
|
||||||
- (id) shouldNotImplement: (SEL)aSel;
|
|
||||||
+ (Class) autoreleaseClass;
|
+ (Class) autoreleaseClass;
|
||||||
+ (void) setAutoreleaseClass: (Class)aClass;
|
+ (void) setAutoreleaseClass: (Class)aClass;
|
||||||
+ (void) enableDoubleReleaseCheck: (BOOL)enable;
|
+ (void) enableDoubleReleaseCheck: (BOOL)enable;
|
||||||
|
@ -295,6 +291,14 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||||
- (id) write: (TypedStream*)aStream;
|
- (id) write: (TypedStream*)aStream;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface NSObject (GSCategories)
|
||||||
|
- notImplemented:(SEL)aSel;
|
||||||
|
- (id) subclassResponsibility: (SEL)aSel;
|
||||||
|
- (id) shouldNotImplement: (SEL)aSel;
|
||||||
|
|
||||||
|
- (NSComparisonResult) compare: (id)anObject;
|
||||||
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -362,9 +362,12 @@ extern struct objc_class _NSConstantStringClassReference;
|
||||||
|
|
||||||
#ifndef NO_GNUSTEP
|
#ifndef NO_GNUSTEP
|
||||||
|
|
||||||
@interface NSString (GNUstep)
|
@interface NSString (GSCategories)
|
||||||
- (NSString*) stringByDeletingPrefix: (NSString*)prefix;
|
- (NSString*) stringByDeletingPrefix: (NSString*)prefix;
|
||||||
- (NSString*) stringByDeletingSuffix: (NSString*)suffix;
|
- (NSString*) stringByDeletingSuffix: (NSString*)suffix;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSString (GNUstep)
|
||||||
- (NSString*) stringByReplacingString: (NSString*)replace
|
- (NSString*) stringByReplacingString: (NSString*)replace
|
||||||
withString: (NSString*)by;
|
withString: (NSString*)by;
|
||||||
- (NSString*) stringByTrimmingLeadSpaces;
|
- (NSString*) stringByTrimmingLeadSpaces;
|
||||||
|
@ -372,9 +375,12 @@ extern struct objc_class _NSConstantStringClassReference;
|
||||||
- (NSString*) stringByTrimmingSpaces;
|
- (NSString*) stringByTrimmingSpaces;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSMutableString (GNUstep)
|
@interface NSMutableString (GSCategories)
|
||||||
- (void) deleteSuffix: (NSString*)suffix;
|
- (void) deleteSuffix: (NSString*)suffix;
|
||||||
- (void) deletePrefix: (NSString*)prefix;
|
- (void) deletePrefix: (NSString*)prefix;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSMutableString (GNUstep)
|
||||||
- (NSString*) immutableProxy;
|
- (NSString*) immutableProxy;
|
||||||
- (void) replaceString: (NSString*)replace
|
- (void) replaceString: (NSString*)replace
|
||||||
withString: (NSString*)by;
|
withString: (NSString*)by;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSRange.h>
|
#include <Foundation/NSRange.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -421,4 +421,130 @@ static void MD5Transform (unsigned long buf[4], unsigned long const in[16])
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension methods for the NSObject class
|
||||||
|
*/
|
||||||
|
@implementation NSObject (GSCategories)
|
||||||
|
|
||||||
|
- (id) notImplemented: (SEL)aSel
|
||||||
|
{
|
||||||
|
[NSException
|
||||||
|
raise: NSGenericException
|
||||||
|
format: @"method %s not implemented in %s(%s)",
|
||||||
|
aSel ? sel_get_name(aSel) : "(null)",
|
||||||
|
object_get_class_name(self),
|
||||||
|
GSObjCIsInstance(self) ? "instance" : "class"];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) shouldNotImplement: (SEL)aSel
|
||||||
|
{
|
||||||
|
[NSException
|
||||||
|
raise: NSGenericException
|
||||||
|
format: @"%s(%s) should not implement %s",
|
||||||
|
object_get_class_name(self),
|
||||||
|
GSObjCIsInstance(self) ? "instance" : "class",
|
||||||
|
aSel ? sel_get_name(aSel) : "(null)"];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) subclassResponsibility: (SEL)aSel
|
||||||
|
{
|
||||||
|
[NSException raise: NSGenericException
|
||||||
|
format: @"subclass %s(%s) should override %s",
|
||||||
|
object_get_class_name(self),
|
||||||
|
GSObjCIsInstance(self) ? "instance" : "class",
|
||||||
|
aSel ? sel_get_name(aSel) : "(null)"];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the receiver with anObject to see which is greater.
|
||||||
|
* The default implementation orders by memory location.
|
||||||
|
*/
|
||||||
|
- (int) compare: (id)anObject
|
||||||
|
{
|
||||||
|
if (anObject == self)
|
||||||
|
{
|
||||||
|
return NSOrderedSame;
|
||||||
|
}
|
||||||
|
if (anObject == nil)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"nil argument for compare:"];
|
||||||
|
}
|
||||||
|
if ([self isEqual: anObject])
|
||||||
|
{
|
||||||
|
return NSOrderedSame;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Ordering objects by their address is pretty useless,
|
||||||
|
* so subclasses should override this is some useful way.
|
||||||
|
*/
|
||||||
|
if (self > anObject)
|
||||||
|
{
|
||||||
|
return NSOrderedDescending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NSOrderedAscending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension methods for the NSObject class
|
||||||
|
*/
|
||||||
|
@implementation NSString (GSCategories)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string formed by removing the prefix string from the
|
||||||
|
* receiver. Raises an exception if the prefix is not present.
|
||||||
|
*/
|
||||||
|
- (NSString*) stringByDeletingPrefix: (NSString*)prefix
|
||||||
|
{
|
||||||
|
NSCAssert2([self hasPrefix: prefix],
|
||||||
|
@"'%@' does not have the prefix '%@'", self, prefix);
|
||||||
|
return [self substringFromIndex: [prefix length]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string formed by removing the suffix string from the
|
||||||
|
* receiver. Raises an exception if the suffix is not present.
|
||||||
|
*/
|
||||||
|
- (NSString*) stringByDeletingSuffix: (NSString*)suffix
|
||||||
|
{
|
||||||
|
NSCAssert2([self hasSuffix: suffix],
|
||||||
|
@"'%@' does not have the suffix '%@'", self, suffix);
|
||||||
|
return [self substringToIndex: ([self length] - [suffix length])];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSMutableString (GSCategories)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified suffix from the string. Raises an exception
|
||||||
|
* if the suffix is not present.
|
||||||
|
*/
|
||||||
|
- (void) deleteSuffix: (NSString*)suffix
|
||||||
|
{
|
||||||
|
NSCAssert2([self hasSuffix: suffix],
|
||||||
|
@"'%@' does not have the suffix '%@'", self, suffix);
|
||||||
|
[self deleteCharactersInRange:
|
||||||
|
NSMakeRange([self length] - [suffix length], [suffix length])];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified prefix from the string. Raises an exception
|
||||||
|
* if the prefix is not present.
|
||||||
|
*/
|
||||||
|
- (void) deletePrefix: (NSString*)prefix
|
||||||
|
{
|
||||||
|
NSCAssert2([self hasPrefix: prefix],
|
||||||
|
@"'%@' does not have the prefix '%@'", self, prefix);
|
||||||
|
[self deleteCharactersInRange: NSMakeRange(0, [prefix length])];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -65,6 +65,8 @@ typedef enum _NSGNUstepStringEncoding
|
||||||
NSBIG5StringEncoding // Traditional chinese
|
NSBIG5StringEncoding // Traditional chinese
|
||||||
} NSGNUstepStringEncoding;
|
} NSGNUstepStringEncoding;
|
||||||
|
|
||||||
|
NSString *GetEncodingName(NSStringEncoding availableEncodingValue);
|
||||||
|
|
||||||
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
||||||
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
||||||
[NSException raise: NSRangeException \
|
[NSException raise: NSRangeException \
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
/* FIXME: Need to initialize this */
|
/* FIXME: Need to initialize this */
|
||||||
NSRecursiveLock *gnustep_global_lock = NULL;
|
NSRecursiveLock *gnustep_global_lock = NULL;
|
||||||
|
|
||||||
|
NSString *GetEncodingName(NSStringEncoding availableEncodingValue)
|
||||||
|
{
|
||||||
|
return (NSString *)CFStringGetNameOfEncoding(CFStringConvertNSStringEncodingToEncoding(availableEncodingValue));
|
||||||
|
}
|
||||||
|
|
||||||
@implementation NSArray (GSCompatibility)
|
@implementation NSArray (GSCompatibility)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
$Date$ $Revision$
|
$Date$ $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#include <gnustep/base/GSMime.h>
|
#include <gnustep/base/GSMime.h>
|
||||||
#include <gnustep/base/GSCategories.h>
|
#include <gnustep/base/GSCategories.h>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
$Date$ $Revision$
|
$Date$ $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <base/preface.h>
|
#include <base/preface.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</chapter>
|
</chapter>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include "GSCompatibility.h"
|
#include "GSCompatibility.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBXML
|
#ifdef HAVE_LIBXML
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSBundle.h>
|
#include <Foundation/NSBundle.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <base/preface.h>
|
#include <base/preface.h>
|
||||||
#include <base/behavior.h>
|
#include <base/behavior.h>
|
||||||
|
|
|
@ -1877,17 +1877,6 @@ static BOOL double_release_check_enabled = NO;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) notImplemented: (SEL)aSel
|
|
||||||
{
|
|
||||||
[NSException
|
|
||||||
raise: NSGenericException
|
|
||||||
format: @"method %s not implemented in %s(%s)",
|
|
||||||
aSel ? sel_get_name(aSel) : "(null)",
|
|
||||||
object_get_class_name(self),
|
|
||||||
GSObjCIsInstance(self) ? "instance" : "class"];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) doesNotRecognize: (SEL)aSel
|
- (id) doesNotRecognize: (SEL)aSel
|
||||||
{
|
{
|
||||||
[NSException raise: NSGenericException
|
[NSException raise: NSGenericException
|
||||||
|
@ -1957,39 +1946,6 @@ static BOOL double_release_check_enabled = NO;
|
||||||
double_release_check_enabled = enable;
|
double_release_check_enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare the receiver with anObject to see which is greater.
|
|
||||||
* The default implementation orders by memory location.
|
|
||||||
*/
|
|
||||||
- (int) compare: (id)anObject
|
|
||||||
{
|
|
||||||
if (anObject == self)
|
|
||||||
{
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
if (anObject == nil)
|
|
||||||
{
|
|
||||||
[NSException raise: NSInvalidArgumentException
|
|
||||||
format: @"nil argument for compare:"];
|
|
||||||
}
|
|
||||||
if ([self isEqual: anObject])
|
|
||||||
{
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Ordering objects by their address is pretty useless,
|
|
||||||
* so subclasses should override this is some useful way.
|
|
||||||
*/
|
|
||||||
if (self > anObject)
|
|
||||||
{
|
|
||||||
return NSOrderedDescending;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NSOrderedAscending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default (NSObject) implementation of this method simply calls
|
* The default (NSObject) implementation of this method simply calls
|
||||||
* the -description method and discards the locale
|
* the -description method and discards the locale
|
||||||
|
@ -2111,27 +2067,6 @@ static BOOL double_release_check_enabled = NO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) subclassResponsibility: (SEL)aSel
|
|
||||||
{
|
|
||||||
[NSException raise: NSGenericException
|
|
||||||
format: @"subclass %s(%s) should override %s",
|
|
||||||
object_get_class_name(self),
|
|
||||||
GSObjCIsInstance(self) ? "instance" : "class",
|
|
||||||
aSel ? sel_get_name(aSel) : "(null)"];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) shouldNotImplement: (SEL)aSel
|
|
||||||
{
|
|
||||||
[NSException
|
|
||||||
raise: NSGenericException
|
|
||||||
format: @"%s(%s) should not implement %s",
|
|
||||||
object_get_class_name(self),
|
|
||||||
GSObjCIsInstance(self) ? "instance" : "class",
|
|
||||||
aSel ? sel_get_name(aSel) : "(null)"];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (int) streamVersion: (TypedStream*)aStream
|
+ (int) streamVersion: (TypedStream*)aStream
|
||||||
{
|
{
|
||||||
#ifndef NeXT_RUNTIME
|
#ifndef NeXT_RUNTIME
|
||||||
|
|
|
@ -4262,29 +4262,6 @@ handle_printf_atsign (FILE *stream,
|
||||||
* The methods in this category are not available in MacOS-X
|
* The methods in this category are not available in MacOS-X
|
||||||
*/
|
*/
|
||||||
@implementation NSString (GNUstep)
|
@implementation NSString (GNUstep)
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a string formed by removing the prefix string from the
|
|
||||||
* receiver. Raises an exception if the prefix is not present.
|
|
||||||
*/
|
|
||||||
- (NSString*) stringByDeletingPrefix: (NSString*)prefix
|
|
||||||
{
|
|
||||||
NSCAssert2([self hasPrefix: prefix],
|
|
||||||
@"'%@' does not have the prefix '%@'", self, prefix);
|
|
||||||
return [self substringFromIndex: [prefix length]];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a string formed by removing the suffix string from the
|
|
||||||
* receiver. Raises an exception if the suffix is not present.
|
|
||||||
*/
|
|
||||||
- (NSString*) stringByDeletingSuffix: (NSString*)suffix
|
|
||||||
{
|
|
||||||
NSCAssert2([self hasSuffix: suffix],
|
|
||||||
@"'%@' does not have the suffix '%@'", self, suffix);
|
|
||||||
return [self substringToIndex: ([self length] - [suffix length])];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string formed by removing leading white space from the
|
* Returns a string formed by removing leading white space from the
|
||||||
* receiver.
|
* receiver.
|
||||||
|
@ -4419,28 +4396,6 @@ handle_printf_atsign (FILE *stream,
|
||||||
@implementation NSMutableString (GNUstep)
|
@implementation NSMutableString (GNUstep)
|
||||||
@class NSImmutableString;
|
@class NSImmutableString;
|
||||||
@class GSImmutableString;
|
@class GSImmutableString;
|
||||||
/**
|
|
||||||
* Removes the specified suffix from the string. Raises an exception
|
|
||||||
* if the suffix is not present.
|
|
||||||
*/
|
|
||||||
- (void) deleteSuffix: (NSString*)suffix
|
|
||||||
{
|
|
||||||
NSCAssert2([self hasSuffix: suffix],
|
|
||||||
@"'%@' does not have the suffix '%@'", self, suffix);
|
|
||||||
[self deleteCharactersInRange:
|
|
||||||
NSMakeRange([self length] - [suffix length], [suffix length])];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the specified prefix from the string. Raises an exception
|
|
||||||
* if the prefix is not present.
|
|
||||||
*/
|
|
||||||
- (void) deletePrefix: (NSString*)prefix
|
|
||||||
{
|
|
||||||
NSCAssert2([self hasPrefix: prefix],
|
|
||||||
@"'%@' does not have the prefix '%@'", self, prefix);
|
|
||||||
[self deleteCharactersInRange: NSMakeRange(0, [prefix length])];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a proxy to the receiver which will allow access to the
|
* Returns a proxy to the receiver which will allow access to the
|
||||||
|
|
Loading…
Reference in a new issue