mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
More tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8534 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5d3f3cc453
commit
be5162cd2b
9 changed files with 133 additions and 91 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,11 +1,19 @@
|
|||
2001-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
General tidyups to simplify code and to make class names
|
||||
consistent with the other libraries.
|
||||
* Headers/Foundation/NSGAttributedString.h: removed
|
||||
* Source/NSGAttributedString.m: renamed to GSAttributedString.m
|
||||
concrete classes renamed for consistency with other gstep libs.
|
||||
* Source/NSGDictionary.m: renamed to GSDictionary.m
|
||||
concrete classes renamed for consistency with other gstep libs.
|
||||
* Source/NSAttributedString.m: classes renamed
|
||||
* Source/GNUmakefile: replace NSGAttrinbutedString with GS.
|
||||
* Source/NSDictionary.m: classes renamed
|
||||
* Source/GNUmakefile: replace NSGAttrinbutedString with and
|
||||
NSGDictionary with GS prefixed classes.
|
||||
Don't try to install old header.
|
||||
* Source/NSString.m: updates for class renaming.
|
||||
* Source/NSSerializer.m: ditto
|
||||
|
||||
2001-01-08 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -29,17 +29,6 @@
|
|||
@class NSArray, NSString, NSEnumerator;
|
||||
|
||||
@interface NSDictionary : NSObject <NSCoding, NSCopying, NSMutableCopying>
|
||||
- (id) initWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned)count;
|
||||
- (unsigned) count;
|
||||
- (id) objectForKey: (id)aKey;
|
||||
- (NSEnumerator*) keyEnumerator;
|
||||
- (NSEnumerator*) objectEnumerator;
|
||||
@end
|
||||
|
||||
@interface NSDictionary (NonCore)
|
||||
|
||||
+ (id) dictionary;
|
||||
+ (id) dictionaryWithContentsOfFile: (NSString*)path;
|
||||
+ (id) dictionaryWithDictionary: (NSDictionary*)aDict;
|
||||
|
@ -49,27 +38,34 @@
|
|||
forKeys: (id*)keys
|
||||
count: (unsigned)count;
|
||||
+ (id) dictionaryWithObjectsAndKeys: (id)object, ...;
|
||||
|
||||
- (NSArray*) allKeys;
|
||||
- (NSArray*) allKeysForObject: (id)anObject;
|
||||
- (NSArray*) allValues;
|
||||
- (unsigned) count; // Primitive
|
||||
- (NSString*) description;
|
||||
- (NSString*) descriptionInStringsFileFormat;
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
|
||||
indent: (unsigned int)level;
|
||||
|
||||
- (id) initWithContentsOfFile: (NSString*)path;
|
||||
- (id) initWithDictionary: (NSDictionary*)otherDictionary;
|
||||
- (id) initWithDictionary: (NSDictionary*)otherDictionary
|
||||
copyItems: (BOOL)shouldCopy;
|
||||
- (id) initWithObjects: (NSArray*)objects forKeys: (NSArray*)keys;
|
||||
- (id) initWithObjectsAndKeys: (id)object, ...;
|
||||
|
||||
- (id) initWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned)count; // Primitive
|
||||
- (BOOL) isEqualToDictionary: (NSDictionary*)other;
|
||||
|
||||
- (NSArray*) allKeys;
|
||||
- (NSArray*) allKeysForObject: (id)anObject;
|
||||
- (NSArray*) allValues;
|
||||
- (NSEnumerator*) keyEnumerator; // Primitive
|
||||
- (NSArray*) keysSortedByValueUsingSelector: (SEL)comp;
|
||||
- (NSEnumerator*) objectEnumerator; // Primitive
|
||||
- (id) objectForKey: (id)aKey; // Primitive
|
||||
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)anObject;
|
||||
|
||||
- (NSString*) description;
|
||||
- (NSString*) descriptionInStringsFileFormat;
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
|
||||
indent: (unsigned int)level;
|
||||
|
||||
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile;
|
||||
|
||||
/* Accessing file attributes is a catagory declared in NSFileManager.h*/
|
||||
|
@ -77,18 +73,15 @@
|
|||
@end
|
||||
|
||||
@interface NSMutableDictionary: NSDictionary
|
||||
- (id) initWithCapacity: (unsigned)numItems;
|
||||
- (void) setObject: (id)anObject forKey: (id)aKey;
|
||||
- (void) removeObjectForKey: (id)aKey;
|
||||
@end
|
||||
|
||||
@interface NSMutableDictionary (NonCore)
|
||||
|
||||
+ (id) dictionaryWithCapacity: (unsigned)numItems;
|
||||
|
||||
- (void) removeAllObjects;
|
||||
- (void) removeObjectsForKeys: (NSArray*)keyArray;
|
||||
- (void) addEntriesFromDictionary: (NSDictionary*)otherDictionary;
|
||||
- (id) initWithCapacity: (unsigned)numItems; // Primitive
|
||||
- (void) removeAllObjects;
|
||||
- (void) removeObjectForKey: (id)aKey; // Primitive
|
||||
- (void) removeObjectsForKeys: (NSArray*)keyArray;
|
||||
- (void) setObject: (id)anObject forKey: (id)aKey; // Primitive
|
||||
- (void) setDictionary: (NSDictionary*)otherDictionary;
|
||||
|
||||
@end
|
||||
|
|
|
@ -147,6 +147,7 @@ BASE_MFILES = \
|
|||
GSArray.m \
|
||||
GSAttributedString.m \
|
||||
GSCountedSet.m \
|
||||
GSDictionary.m \
|
||||
GSHTTPURLHandle.m \
|
||||
GSMime.m \
|
||||
GSSet.m \
|
||||
|
@ -183,7 +184,6 @@ NSFileHandle.m \
|
|||
NSFileManager.m \
|
||||
NSFormatter.m \
|
||||
NSGeometry.m \
|
||||
NSGDictionary.m \
|
||||
NSHashTable.m \
|
||||
NSHost.m \
|
||||
NSInvocation.m \
|
||||
|
|
|
@ -829,3 +829,32 @@ SANITY();
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface NSGAttributedString : NSAttributedString
|
||||
@end
|
||||
@implementation NSGAttributedString
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
|
||||
RELEASE(self);
|
||||
self = (id)NSAllocateObject([GSAttributedString class], 0, NSDefaultMallocZone());
|
||||
self = [self initWithCoder: aCoder];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGMutableAttributedString : NSMutableAttributedString
|
||||
@end
|
||||
@implementation NSGMutableAttributedString
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
|
||||
RELEASE(self);
|
||||
self = (id)NSAllocateObject([GSMutableAttributedString class], 0, NSDefaultMallocZone());
|
||||
self = [self initWithCoder: aCoder];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -49,42 +49,41 @@
|
|||
@class NSDictionaryNonCore;
|
||||
@class NSMutableDictionaryNonCore;
|
||||
|
||||
@interface NSGDictionary : NSDictionary
|
||||
@interface GSDictionary : NSDictionary
|
||||
{
|
||||
@public
|
||||
GSIMapTable_t map;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGMutableDictionary : NSMutableDictionary
|
||||
@interface GSMutableDictionary : NSMutableDictionary
|
||||
{
|
||||
@public
|
||||
GSIMapTable_t map;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGDictionaryKeyEnumerator : NSEnumerator
|
||||
@interface GSDictionaryKeyEnumerator : NSEnumerator
|
||||
{
|
||||
NSGDictionary *dictionary;
|
||||
GSDictionary *dictionary;
|
||||
GSIMapEnumerator_t enumerator;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGDictionaryObjectEnumerator : NSGDictionaryKeyEnumerator
|
||||
@interface GSDictionaryObjectEnumerator : GSDictionaryKeyEnumerator
|
||||
@end
|
||||
|
||||
@implementation NSGDictionary
|
||||
@implementation GSDictionary
|
||||
|
||||
static SEL nxtSel;
|
||||
static SEL objSel;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSGDictionary class])
|
||||
if (self == [GSDictionary class])
|
||||
{
|
||||
nxtSel = @selector(nextObject);
|
||||
objSel = @selector(objectForKey:);
|
||||
behavior_class_add_class(self, [NSDictionaryNonCore class]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,13 +243,13 @@ static SEL objSel;
|
|||
|
||||
- (NSEnumerator*) keyEnumerator
|
||||
{
|
||||
return AUTORELEASE([[NSGDictionaryKeyEnumerator allocWithZone:
|
||||
return AUTORELEASE([[GSDictionaryKeyEnumerator allocWithZone:
|
||||
NSDefaultMallocZone()] initWithDictionary: self]);
|
||||
}
|
||||
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return AUTORELEASE([[NSGDictionaryObjectEnumerator allocWithZone:
|
||||
return AUTORELEASE([[GSDictionaryObjectEnumerator allocWithZone:
|
||||
NSDefaultMallocZone()] initWithDictionary: self]);
|
||||
}
|
||||
|
||||
|
@ -270,14 +269,13 @@ static SEL objSel;
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSGMutableDictionary
|
||||
@implementation GSMutableDictionary
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSGMutableDictionary class])
|
||||
if (self == [GSMutableDictionary class])
|
||||
{
|
||||
behavior_class_add_class(self, [NSMutableDictionaryNonCore class]);
|
||||
behavior_class_add_class(self, [NSGDictionary class]);
|
||||
behavior_class_add_class(self, [GSDictionary class]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,12 +330,12 @@ static SEL objSel;
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSGDictionaryKeyEnumerator
|
||||
@implementation GSDictionaryKeyEnumerator
|
||||
|
||||
- (id) initWithDictionary: (NSDictionary*)d
|
||||
{
|
||||
[super init];
|
||||
dictionary = (NSGDictionary*)RETAIN(d);
|
||||
dictionary = (GSDictionary*)RETAIN(d);
|
||||
enumerator = GSIMapEnumeratorForMap(&dictionary->map);
|
||||
return self;
|
||||
}
|
||||
|
@ -361,7 +359,7 @@ static SEL objSel;
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSGDictionaryObjectEnumerator
|
||||
@implementation GSDictionaryObjectEnumerator
|
||||
|
||||
- (id) nextObject
|
||||
{
|
||||
|
@ -375,3 +373,32 @@ static SEL objSel;
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@interface NSGDictionary : NSDictionary
|
||||
@end
|
||||
@implementation NSGDictionary
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
|
||||
RELEASE(self);
|
||||
self = (id)NSAllocateObject([GSDictionary class], 0, NSDefaultMallocZone());
|
||||
self = [self initWithCoder: aCoder];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NSGMutableDictionary : NSMutableDictionary
|
||||
@end
|
||||
@implementation NSGMutableDictionary
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
NSLog(@"Warning - decoding archive containing obsolete %@ object - please delete/replace this archive", NSStringFromClass([self class]));
|
||||
RELEASE(self);
|
||||
self = (id)NSAllocateObject([GSMutableDictionary class], 0, NSDefaultMallocZone());
|
||||
self = [self initWithCoder: aCoder];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
@class GSAttributedString;
|
||||
@class GSMutableAttributedString;
|
||||
@class NSGMutableDictionary;
|
||||
@class GSMutableDictionary;
|
||||
static Class dictionaryClass = 0;
|
||||
|
||||
static SEL eqSel;
|
||||
|
@ -100,7 +100,7 @@ static Class GSMutableAttributedStringClass;
|
|||
= [NSMutableAttributedString class];
|
||||
GSMutableAttributedStringClass
|
||||
= [GSMutableAttributedString class];
|
||||
dictionaryClass = [NSGMutableDictionary class];
|
||||
dictionaryClass = [GSMutableDictionary class];
|
||||
|
||||
eqSel = @selector(isEqual:);
|
||||
setSel = @selector(setAttributes:range:);
|
||||
|
|
|
@ -36,21 +36,16 @@
|
|||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
|
||||
@interface NSDictionaryNonCore : NSDictionary
|
||||
@end
|
||||
@interface NSMutableDictionaryNonCore: NSMutableDictionary
|
||||
@end
|
||||
|
||||
@implementation NSDictionary
|
||||
|
||||
@class NSGDictionary;
|
||||
@class NSGMutableDictionary;
|
||||
@class GSDictionary;
|
||||
@class GSMutableDictionary;
|
||||
|
||||
static Class NSArray_class;
|
||||
static Class NSDictionary_abstract_class;
|
||||
static Class NSMutableDictionary_abstract_class;
|
||||
static Class NSDictionary_concrete_class;
|
||||
static Class NSMutableDictionary_concrete_class;
|
||||
static Class NSDictionaryClass;
|
||||
static Class NSMutableDictionaryClass;
|
||||
static Class GSDictionaryClass;
|
||||
static Class GSMutableDictionaryClass;
|
||||
|
||||
static SEL eqSel;
|
||||
static SEL nxtSel;
|
||||
|
@ -63,12 +58,11 @@ static SEL appSel;
|
|||
{
|
||||
if (self == [NSDictionary class])
|
||||
{
|
||||
behavior_class_add_class (self, [NSDictionaryNonCore class]);
|
||||
NSArray_class = [NSArray class];
|
||||
NSDictionary_abstract_class = [NSDictionary class];
|
||||
NSMutableDictionary_abstract_class = [NSMutableDictionary class];
|
||||
NSDictionary_concrete_class = [NSGDictionary class];
|
||||
NSMutableDictionary_concrete_class = [NSGMutableDictionary class];
|
||||
NSDictionaryClass = [NSDictionary class];
|
||||
NSMutableDictionaryClass = [NSMutableDictionary class];
|
||||
GSDictionaryClass = [GSDictionary class];
|
||||
GSMutableDictionaryClass = [GSMutableDictionary class];
|
||||
|
||||
eqSel = @selector(isEqual:);
|
||||
nxtSel = @selector(nextObject);
|
||||
|
@ -81,9 +75,9 @@ static SEL appSel;
|
|||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if (self == NSDictionary_abstract_class)
|
||||
if (self == NSDictionaryClass)
|
||||
{
|
||||
return NSAllocateObject(NSDictionary_concrete_class, 0, z);
|
||||
return NSAllocateObject(GSDictionaryClass, 0, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -131,13 +125,13 @@ static SEL appSel;
|
|||
|
||||
- (id) mutableCopyWithZone: (NSZone*)z
|
||||
{
|
||||
return [[NSMutableDictionary_concrete_class allocWithZone: z]
|
||||
return [[GSMutableDictionaryClass allocWithZone: z]
|
||||
initWithDictionary: self];
|
||||
}
|
||||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSDictionary_abstract_class;
|
||||
return NSDictionaryClass;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
|
@ -192,9 +186,6 @@ static SEL appSel;
|
|||
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSDictionaryNonCore
|
||||
|
||||
+ (id) dictionary
|
||||
{
|
||||
|
@ -431,7 +422,7 @@ static SEL appSel;
|
|||
}
|
||||
NS_ENDHANDLER
|
||||
RELEASE(myString);
|
||||
if ([result isKindOfClass: NSDictionary_abstract_class])
|
||||
if ([result isKindOfClass: NSDictionaryClass])
|
||||
{
|
||||
[self initWithDictionary: result];
|
||||
return self;
|
||||
|
@ -453,7 +444,7 @@ static SEL appSel;
|
|||
if (other == self)
|
||||
return YES;
|
||||
|
||||
if ([other isKindOfClass: NSDictionary_abstract_class])
|
||||
if ([other isKindOfClass: NSDictionaryClass])
|
||||
return [self isEqualToDictionary: other];
|
||||
|
||||
return NO;
|
||||
|
@ -904,16 +895,14 @@ static NSString *indentStrings[] = {
|
|||
{
|
||||
if (self == [NSMutableDictionary class])
|
||||
{
|
||||
behavior_class_add_class (self, [NSMutableDictionaryNonCore class]);
|
||||
behavior_class_add_class (self, [NSDictionaryNonCore class]);
|
||||
}
|
||||
}
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if (self == NSMutableDictionary_abstract_class)
|
||||
if (self == NSMutableDictionaryClass)
|
||||
{
|
||||
return NSAllocateObject(NSMutableDictionary_concrete_class, 0, z);
|
||||
return NSAllocateObject(GSMutableDictionaryClass, 0, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -940,7 +929,7 @@ static NSString *indentStrings[] = {
|
|||
objects[i] = (*objImp)(self, objSel, key);
|
||||
objects[i] = [objects[i] copyWithZone: z];
|
||||
}
|
||||
newDictionary = [[NSDictionary_concrete_class allocWithZone: z]
|
||||
newDictionary = [[GSDictionaryClass allocWithZone: z]
|
||||
initWithObjects: objects
|
||||
forKeys: keys
|
||||
count: count];
|
||||
|
@ -955,7 +944,7 @@ static NSString *indentStrings[] = {
|
|||
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return NSMutableDictionary_abstract_class;
|
||||
return NSMutableDictionaryClass;
|
||||
}
|
||||
|
||||
/* This is the designated initializer */
|
||||
|
@ -975,10 +964,6 @@ static NSString *indentStrings[] = {
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSMutableDictionaryNonCore
|
||||
|
||||
+ (id) dictionaryWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include <Foundation/NSNotificationQueue.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
|
||||
@class NSGDictionary;
|
||||
@class NSGMutableDictionary;
|
||||
@class GSDictionary;
|
||||
@class GSMutableDictionary;
|
||||
@class NSDataMalloc;
|
||||
@class GSInlineArray;
|
||||
@class GSMutableArray;
|
||||
|
@ -690,8 +690,8 @@ deserializeFromInfo(_NSDeserializerInfo* info)
|
|||
IACls = [GSInlineArray class];
|
||||
MACls = [GSMutableArray class];
|
||||
DCls = [NSDataMalloc class];
|
||||
IDCls = [NSGDictionary class];
|
||||
MDCls = [NSGMutableDictionary class];
|
||||
IDCls = [GSDictionary class];
|
||||
MDCls = [GSMutableDictionary class];
|
||||
USCls = [GSUnicodeString class];
|
||||
CSCls = [GSCString class];
|
||||
csInitImp = [CSCls instanceMethodForSelector: csInitSel];
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
@class GSMutableString;
|
||||
@class GSPlaceholderString;
|
||||
@class GSMutableArray;
|
||||
@class NSGMutableDictionary;
|
||||
@class GSMutableDictionary;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -4029,7 +4029,7 @@ setupPl()
|
|||
plAdd = (id (*)(id, SEL, id))
|
||||
[plArray instanceMethodForSelector: @selector(addObject:)];
|
||||
|
||||
plDictionary = [NSGMutableDictionary class];
|
||||
plDictionary = [GSMutableDictionary class];
|
||||
plSet = (id (*)(id, SEL, id, id))
|
||||
[plDictionary instanceMethodForSelector: @selector(setObject:forKey:)];
|
||||
|
||||
|
|
Loading…
Reference in a new issue