Use (id <String>) instead of (String*)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@241 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1995-04-03 03:23:45 +00:00
parent 752988059d
commit b9bb18e543
6 changed files with 36 additions and 30 deletions

View file

@ -33,7 +33,7 @@
#include <objects/Dictionary.h>
#include <objects/Queue.h>
#include <objects/mframe.h>
#include <objects/String.h>
#include <foundation/NSString.h>
#include <assert.h>
@interface Connection (GettingCoderInterface)
@ -448,7 +448,7 @@ static int messagesReceivedCount;
if we're connecting to another Connection that already registered
with that name. */
+ (Connection*) newRegisteringAtName: (String*)n withRootObject: anObj
+ (Connection*) newRegisteringAtName: (id <String>)n withRootObject: anObj
{
id newPort;
id newConn;
@ -460,12 +460,12 @@ static int messagesReceivedCount;
return newConn;
}
+ (Proxy*) rootProxyAtName: (String*)n
+ (Proxy*) rootProxyAtName: (id <String>)n
{
return [self rootProxyAtName:n onHost:@""];
}
+ (Proxy*) rootProxyAtName: (String*)n onHost: (String*)h
+ (Proxy*) rootProxyAtName: (id <String>)n onHost: (id <String>)h
{
id p = [default_port_class newPortFromRegisterWithName:n onHost:h];
return [self rootProxyAtPort:p];

View file

@ -23,6 +23,7 @@
#include <objects/String.h>
#include <objects/IndexedCollectionPrivate.h>
#include <objects/NSString.h>
/* memcpy(), strlen(), strcmp() are gcc builtin's */
#include <limits.h>

View file

@ -36,6 +36,7 @@
#include <foundation/NSString.h>
#include <objects/IndexedCollection.h>
#include <objects/IndexedCollectionPrivate.h>
#include <objects/String.h>
#include <limits.h>
@implementation NSString
@ -45,6 +46,7 @@
static done = 0;
if (!done)
{
class_add_behavior([NSString class], [String class]);
class_add_behavior([NSString class], [IndexedCollection class]);
done = 1;
}

View file

@ -26,13 +26,13 @@
@implementation Port
+ newRegisteredPortWithName: (String*)n
+ newRegisteredPortWithName: (id <String>)n
{
[self notImplemented:_cmd];
return nil;
}
+ newPortFromRegisterWithName: (String*)n onHost: (String*)host
+ newPortFromRegisterWithName: (id <String>)n onHost: (id <String>)host
{
[self notImplemented:_cmd];
return nil;

View file

@ -93,7 +93,7 @@ name_to_port_number (const char *name)
return self;
}
+ newPortFromRegisterWithName: (String*)name onHost: (String*)h
+ newPortFromRegisterWithName: (id <String>)name onHost: (id <String>)h
{
id p;
int n;
@ -108,7 +108,7 @@ name_to_port_number (const char *name)
return p;
}
+ newRegisteredPortWithName: (String*)name
+ newRegisteredPortWithName: (id <String>)name
{
int n;
@ -241,7 +241,7 @@ s1.sin_addr.s_addr == s2.sin_addr.s_addr)
return sp;
}
+ newRemoteWithNumber: (int)n onHost: (String*)h
+ newRemoteWithNumber: (int)n onHost: (id <String>)h
{
struct sockaddr_in remote_addr;
struct hostent *hp;

View file

@ -49,7 +49,10 @@
+ (void) initialize
{
if (self == [String class])
[self setVersion:0]; /* beta release */
{
[self setVersion:0]; /* beta release */
/* xxx eventually: class_add_behavior_category(NSStringStuff) */
}
}
// INITIALIZING;
@ -97,7 +100,7 @@
}
#if HAVE_VSPRINTF
- initWithFormat: (String*)aFormatString arguments: (va_list)arg
- initWithFormat: (id <String>)aFormatString arguments: (va_list)arg
{
char buf[128]; /* xxx horrible, disgusting, fix this */
vsprintf(buf, [aFormatString cString], arg);
@ -112,7 +115,7 @@
}
#endif /* HAVE_VSPRINTF */
- initWithFormat: (String*)aFormatString, ...
- initWithFormat: (id <String>)aFormatString, ...
{
va_list ap;
va_start(ap, aFormatString);
@ -135,17 +138,17 @@
return [self initWithCString:""];
}
- initWithString: (String*)aString range: (IndexRange)aRange
- initWithString: (id <String>)aString range: (IndexRange)aRange
{
return [self initWithCString:[aString cString] range:aRange];
}
- initWithString: (String*)aString length: (unsigned)aLength
- initWithString: (id <String>)aString length: (unsigned)aLength
{
return [self initWithCString:[aString cString]];
}
- initWithString: (String*)aString
- initWithString: (id <String>)aString
{
return [self initWithCString:[aString cString]];
}
@ -153,19 +156,19 @@
// GETTING NEW, AUTORELEASED STRING OBJECTS, NO NEED TO RELEASE THESE;
+ (String*) stringWithString: (String*)aString range: (IndexRange)aRange
+ stringWithString: (id <String>)aString range: (IndexRange)aRange
{
return [[[CString alloc] initWithString:aString range:aRange]
autorelease];
}
+ (String*) stringWithString: (String*)aString
+ stringWithString: (id <String>)aString
{
return [[[CString alloc] initWithString:aString]
autorelease];
}
+ (String*) stringWithFormat: (String*)aFormatString, ...
+ stringWithFormat: (id <String>)aFormatString, ...
{
va_list ap;
id ret;
@ -177,56 +180,56 @@
return ret;
}
+ (String*) stringWithFormat: (String*)aFormatString arguments: (va_list)arg
+ stringWithFormat: (id <String>)aFormatString arguments: (va_list)arg
{
return [[[CString alloc] initWithFormat:aFormatString arguments:arg]
autorelease];
}
+ (String*) stringWithCString: (const char*)cp range: (IndexRange)r
+ stringWithCString: (const char*)cp range: (IndexRange)r
{
return [[[CString alloc] initWithCString:cp range:r]
autorelease];
}
+ (String*) stringWithCString: (const char*)aCharPtr
+ stringWithCString: (const char*)aCharPtr
{
return [[[CString alloc] initWithCString:aCharPtr]
autorelease];
}
- (String*) stringByAppendingFormat: (String*)aString, ...
- stringByAppendingFormat: (id <String>)aString, ...
{
[self notImplemented:_cmd];
return nil;
}
- (String*) stringByAppendingFormat: (String*)aString arguments: (va_list)arg
- stringByAppendingFormat: (id <String>)aString arguments: (va_list)arg
{
[self notImplemented:_cmd];
return nil;
}
- (String*) stringByPrependingFormat: (String*)aString, ...
- stringByPrependingFormat: (id <String>)aString, ...
{
[self notImplemented:_cmd];
return nil;
}
- (String*) stringByPrependingFormat: (String*)aString arguments: (va_list)arg
- stringByPrependingFormat: (id <String>)aString arguments: (va_list)arg
{
[self notImplemented:_cmd];
return nil;
}
- (String*) stringByAppendingString: (String*)aString
- stringByAppendingString: (id <String>)aString
{
[self notImplemented:_cmd];
return nil;
}
- (String*) stringByPrependingString: (String*)aString
- stringByPrependingString: (id <String>)aString
{
[self notImplemented:_cmd];
return nil;
@ -255,12 +258,12 @@
- copy
{
return [[[self class] alloc] initWithString:self];
return [[[self class] alloc] initWithString:(NSString*)self];
}
- mutableCopy
{
return [[MutableCString alloc] initWithString:self];
return [[MutableCString alloc] initWithString:(NSString*)self];
}
// TESTING;
@ -330,7 +333,7 @@
return (strrchr(s, aChar) - s);
}
- (unsigned) indexOfString: (String*)aString
- (unsigned) indexOfString: (id <String>)aString
{
const char *s = [self cString];
return (strstr(s, [aString cString]) - s);