From fbf9b77c20305a12d31c6f9c84db1d81dc6c58bb Mon Sep 17 00:00:00 2001 From: mccallum Date: Mon, 3 Apr 1995 03:22:10 +0000 Subject: [PATCH] Use (id ) instead of (String*) Have String protocol include NSString protcol. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@240 72102866-910b-0410-8b05-ffd578937521 --- Headers/gnustep/base/String.h | 75 ++++++++++++++++++++--------------- Source/objects/String.h | 75 ++++++++++++++++++++--------------- 2 files changed, 84 insertions(+), 66 deletions(-) diff --git a/Headers/gnustep/base/String.h b/Headers/gnustep/base/String.h index 3ef69c9db..c2bbd1476 100644 --- a/Headers/gnustep/base/String.h +++ b/Headers/gnustep/base/String.h @@ -29,9 +29,10 @@ Perhaps I'll just get rid of the GNU String objects and just transfer this functionality into NSSTring and friends. */ -#include +#include #include #include +#include #include typedef unsigned short Character; @@ -46,42 +47,42 @@ typedef unsigned short Character; /* Think about changing these names to avoid conflicts with OpenStep? */ -@protocol String +@protocol String // INITIALIZING NEWLY ALLOCATED STRINGS. DON'T FORGET TO RELEASE THEM!; - init; -- initWithString: (String*)aString; -- initWithString: (String*)aString range: (IndexRange)aRange; -- initWithFormat: (String*)aFormatString, ...; -- initWithFormat: (String*)aFormatString arguments: (va_list)arg; +- initWithString: (id )aString; +- initWithString: (id )aString range: (IndexRange)aRange; +- initWithFormat: (id )aFormatString, ...; +- initWithFormat: (id )aFormatString arguments: (va_list)arg; - initWithCString: (const char*)aCharPtr; - initWithCString: (const char*)aCharPtr range: (IndexRange)aRange; //- initWithStream: (Stream*)aStream; //- initWithStream: (Stream*)aStream length: (unsigned)aLength; // GETTING NEW, AUTORELEASED STRING OBJECTS, NO NEED TO RELEASE THESE; -+ (String*) stringWithString: (String*)aString; -+ (String*) stringWithString: (String*)aString range: (IndexRange)aRange; -+ (String*) stringWithFormat: (String*)aFormatString, ...; -+ (String*) stringWithFormat: (String*)aFormatString arguments: (va_list)arg; -+ (String*) stringWithCString: (const char*)aCharPtr; -+ (String*) stringWithCString: (const char*)aCharPtr range: (IndexRange)aRange; ++ stringWithString: (id )aString; ++ stringWithString: (id )aString range: (IndexRange)aRange; ++ stringWithFormat: (id )aFormatString, ...; ++ stringWithFormat: (id )aFormatString arguments: (va_list)arg; ++ stringWithCString: (const char*)aCharPtr; ++ stringWithCString: (const char*)aCharPtr range: (IndexRange)aRange; -- (String*) stringByAppendingFormat: (String*)aString, ...; -- (String*) stringByAppendingFormat: (String*)aString arguments: (va_list)arg; -- (String*) stringByPrependingFormat: (String*)aString, ...; -- (String*) stringByPrependingFormat: (String*)aString arguments: (va_list)arg; -- (String*) stringByAppendingString: (String*)aString; -- (String*) stringByPrependingString: (String*)aString; +- stringByAppendingFormat: (id )aString, ...; +- stringByAppendingFormat: (id )aString arguments: (va_list)arg; +- stringByPrependingFormat: (id )aString, ...; +- stringByPrependingFormat: (id )aString arguments: (va_list)arg; +- stringByAppendingString: (id )aString; +- stringByPrependingString: (id )aString; -//- (String*) substringWithRange: (IndexRange)aRange; -//- (String*) substringWithLength: (unsigned)l; -//- (String*) substringAfterIndex: (unsigned)i; -//- (id ) substringsSeparatedByString: (String*)separator; +//- substringWithRange: (IndexRange)aRange; +//- substringWithLength: (unsigned)l; +//- substringAfterIndex: (unsigned)i; +//- (id ) substringsSeparatedByString: (id )sep; -//- (String*) capitalizedString; -//- (String*) lowercaseString; -//- (String*) uppercaseString; +//- capitalizedString; +//- lowercaseString; +//- uppercaseString; - mutableCopy; - copy; @@ -93,7 +94,7 @@ typedef unsigned short Character; - (unsigned) hash; - (int) compare: anObject; - copy; -- (unsigned) indexOfString: (String*)aString; +- (unsigned) indexOfString: (id )aString; - (unsigned) indexOfChar: (char)aChar; - (unsigned) indexOfLastChar: (char)aChar; //- (unsigned) indexOfCharacter: (Character)aChar; @@ -118,24 +119,32 @@ typedef unsigned short Character; @protocol MutableString -+ (MutableString*) stringWithCapacity: (unsigned)capacity; ++ stringWithCapacity: (unsigned)capacity; - initWithCapacity: (unsigned)capacity; /* This from IndexedCollecting: - removeRange: (IndexRange)range; */ -- (void) insertString: (String*)string atIndex: (unsigned)index; +- (void) insertString: (id )string atIndex: (unsigned)index; -- (void) setString: (String*)string; -- (void) appendString: (String*)string; -- (void) replaceRange: (IndexRange)range withString: (String*)string; +- (void) setString: (id )string; +- (void) appendString: (id )string; +- (void) replaceRange: (IndexRange)range withString: (id )string; @end /* Abstract string classes */ -@interface String : IndexedCollection +@interface String : IndexedCollection @end -@interface MutableString : String +/* To prevent complaints about protocol conformance. */ +@interface String (StringProtocol) +@end + +@interface MutableString : String +@end + +/* To prevent complaints about protocol conformance. */ +@interface MutableString (MutableStringProtocol) @end /* Some concrete string classes */ diff --git a/Source/objects/String.h b/Source/objects/String.h index 3ef69c9db..c2bbd1476 100644 --- a/Source/objects/String.h +++ b/Source/objects/String.h @@ -29,9 +29,10 @@ Perhaps I'll just get rid of the GNU String objects and just transfer this functionality into NSSTring and friends. */ -#include +#include #include #include +#include #include typedef unsigned short Character; @@ -46,42 +47,42 @@ typedef unsigned short Character; /* Think about changing these names to avoid conflicts with OpenStep? */ -@protocol String +@protocol String // INITIALIZING NEWLY ALLOCATED STRINGS. DON'T FORGET TO RELEASE THEM!; - init; -- initWithString: (String*)aString; -- initWithString: (String*)aString range: (IndexRange)aRange; -- initWithFormat: (String*)aFormatString, ...; -- initWithFormat: (String*)aFormatString arguments: (va_list)arg; +- initWithString: (id )aString; +- initWithString: (id )aString range: (IndexRange)aRange; +- initWithFormat: (id )aFormatString, ...; +- initWithFormat: (id )aFormatString arguments: (va_list)arg; - initWithCString: (const char*)aCharPtr; - initWithCString: (const char*)aCharPtr range: (IndexRange)aRange; //- initWithStream: (Stream*)aStream; //- initWithStream: (Stream*)aStream length: (unsigned)aLength; // GETTING NEW, AUTORELEASED STRING OBJECTS, NO NEED TO RELEASE THESE; -+ (String*) stringWithString: (String*)aString; -+ (String*) stringWithString: (String*)aString range: (IndexRange)aRange; -+ (String*) stringWithFormat: (String*)aFormatString, ...; -+ (String*) stringWithFormat: (String*)aFormatString arguments: (va_list)arg; -+ (String*) stringWithCString: (const char*)aCharPtr; -+ (String*) stringWithCString: (const char*)aCharPtr range: (IndexRange)aRange; ++ stringWithString: (id )aString; ++ stringWithString: (id )aString range: (IndexRange)aRange; ++ stringWithFormat: (id )aFormatString, ...; ++ stringWithFormat: (id )aFormatString arguments: (va_list)arg; ++ stringWithCString: (const char*)aCharPtr; ++ stringWithCString: (const char*)aCharPtr range: (IndexRange)aRange; -- (String*) stringByAppendingFormat: (String*)aString, ...; -- (String*) stringByAppendingFormat: (String*)aString arguments: (va_list)arg; -- (String*) stringByPrependingFormat: (String*)aString, ...; -- (String*) stringByPrependingFormat: (String*)aString arguments: (va_list)arg; -- (String*) stringByAppendingString: (String*)aString; -- (String*) stringByPrependingString: (String*)aString; +- stringByAppendingFormat: (id )aString, ...; +- stringByAppendingFormat: (id )aString arguments: (va_list)arg; +- stringByPrependingFormat: (id )aString, ...; +- stringByPrependingFormat: (id )aString arguments: (va_list)arg; +- stringByAppendingString: (id )aString; +- stringByPrependingString: (id )aString; -//- (String*) substringWithRange: (IndexRange)aRange; -//- (String*) substringWithLength: (unsigned)l; -//- (String*) substringAfterIndex: (unsigned)i; -//- (id ) substringsSeparatedByString: (String*)separator; +//- substringWithRange: (IndexRange)aRange; +//- substringWithLength: (unsigned)l; +//- substringAfterIndex: (unsigned)i; +//- (id ) substringsSeparatedByString: (id )sep; -//- (String*) capitalizedString; -//- (String*) lowercaseString; -//- (String*) uppercaseString; +//- capitalizedString; +//- lowercaseString; +//- uppercaseString; - mutableCopy; - copy; @@ -93,7 +94,7 @@ typedef unsigned short Character; - (unsigned) hash; - (int) compare: anObject; - copy; -- (unsigned) indexOfString: (String*)aString; +- (unsigned) indexOfString: (id )aString; - (unsigned) indexOfChar: (char)aChar; - (unsigned) indexOfLastChar: (char)aChar; //- (unsigned) indexOfCharacter: (Character)aChar; @@ -118,24 +119,32 @@ typedef unsigned short Character; @protocol MutableString -+ (MutableString*) stringWithCapacity: (unsigned)capacity; ++ stringWithCapacity: (unsigned)capacity; - initWithCapacity: (unsigned)capacity; /* This from IndexedCollecting: - removeRange: (IndexRange)range; */ -- (void) insertString: (String*)string atIndex: (unsigned)index; +- (void) insertString: (id )string atIndex: (unsigned)index; -- (void) setString: (String*)string; -- (void) appendString: (String*)string; -- (void) replaceRange: (IndexRange)range withString: (String*)string; +- (void) setString: (id )string; +- (void) appendString: (id )string; +- (void) replaceRange: (IndexRange)range withString: (id )string; @end /* Abstract string classes */ -@interface String : IndexedCollection +@interface String : IndexedCollection @end -@interface MutableString : String +/* To prevent complaints about protocol conformance. */ +@interface String (StringProtocol) +@end + +@interface MutableString : String +@end + +/* To prevent complaints about protocol conformance. */ +@interface MutableString (MutableStringProtocol) @end /* Some concrete string classes */