Changes from Jeremy Bettis. See ChangeLog Jan 21 17:09:09

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1997-05-03 17:05:57 +00:00
parent 1c202f6e66
commit 147720cc3a
4 changed files with 45 additions and 3 deletions

View file

@ -1,5 +1,24 @@
Sat May 3 12:28:48 1997 Andrew McCallum <mccallum@jprc.com>
* src/Makefile.in (GNUSTEP_HEADERS): Added include/NSHost.h.
(GNUSTEP_MFILES): Added NSHost.m.
* src/NSCharacterSet.m ([NSCharacterSet +_bitmapForSet:number:]):
Use NSBundle's pathForResource:ofType:inDirectory method properly.
(Reported by Stevo Crvenkovski <stevoc@lotus.mpt.com.mk>.)
Tue Jan 21 17:09:09 CST 1997 Jeremy Bettis <Jeremy@hksys.com>
* src/NSGCString.m: Add -appendString:.
* src/include/NSString.h: Add +string.
* src/NSString.m: (handle_printf_atsign) Take the description of
the object before the cStringNoCopy.
([NSString +allocWithZone:],[NSMutableString +allocWithZone:])
Only return the concrete class if [self class] == NSString to
allow subclassing.
Tue Mar 4 10:51:22 1997 Andrew McCallum <mccallum@jprc.com>
* src/NSConnection.m: New file.

View file

@ -61,6 +61,7 @@ typedef enum _NSStringEncoding
@protocol NSString <NSCoding, NSCopying, NSMutableCopying>
// Creating Temporary Strings
+ (NSString*) string;
+ (NSString*) stringWithCharacters: (const unichar*)chars
length: (unsigned int)length;
+ (NSString*) stringWithCString: (const char*)byteString

View file

@ -222,6 +222,19 @@ stringDecrementCountAndFillHoleAt(NSGMutableCStringStruct *self,
_contents_chars[_count] = '\0';
}
- (void) appendString: (NSString*)aString
{
unsigned c = [aString cStringLength];
if (_count + c >= _capacity)
{
_capacity = MAX(_capacity*2, _count+c);
OBJC_REALLOC(_contents_chars, char, _capacity);
}
memcpy(_contents_chars + _count, [aString cStringNoCopy], c);
_count += c;
_contents_chars[_count] = '\0';
}
/* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length
{

View file

@ -156,7 +156,7 @@ handle_printf_atsign (FILE *stream,
#endif
len = fprintf(stream, "%*s",
(info->left ? - info->width : info->width),
[string_object cStringNoCopy]);
[[string_object description] cStringNoCopy]);
return len;
}
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
@ -186,7 +186,9 @@ handle_printf_atsign (FILE *stream,
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject ([self _concreteClass], 0, z);
if ([self class] == [NSString class])
return NSAllocateObject ([self _concreteClass], 0, z);
return [super allocWithZone:z];
}
// Creating Temporary Strings
@ -197,6 +199,11 @@ handle_printf_atsign (FILE *stream,
return self;
}
+ (NSString*) string
{
return [[[self alloc] init] autorelease];
}
+ (NSString*) stringWithCString: (const char*) byteString
{
return [[[self alloc] initWithCString:byteString]
@ -1419,7 +1426,9 @@ handle_printf_atsign (FILE *stream,
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject([self _mutableConcreteClass], 0, z);
if ([self class] == [NSMutableString class])
return NSAllocateObject([self _mutableConcreteClass], 0, z);
return [super allocWithZone:z];
}
/* xxx This method may be removed in future. */