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:
mccallum 1995-04-03 03:23:45 +00:00
parent fbf9b77c20
commit 95bc03e7f4
6 changed files with 36 additions and 30 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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