GSXibKeyedUnarchiver: Change format of customClasses dictionary

This commit is contained in:
Gregory John Casamento 2022-03-29 19:49:35 -04:00
parent 39bd359505
commit 5f3b54e330
3 changed files with 22 additions and 21 deletions

View file

@ -1,3 +1,11 @@
2022-03-29 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSXibKeyedUnarchiver.h
* Source/GSXib5KeyedUnarchiver.h
* Source/GSXib5KeyedUnarchiver.m
* Source/GSXibKeyedUnarchiver.m: Change format of
customClass dictionary.
2022-03-26 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSXibKeyedUnarchiver.h: Add

View file

@ -41,7 +41,7 @@
NSMutableArray *stack;
GSXibElement *currentElement;
NSMutableDictionary *decoded;
NSMutableArray *_customClasses;
NSMutableDictionary *_customClasses;
}
+ (BOOL) checkXib5: (NSData *)data;
@ -64,7 +64,7 @@
withParentClass: (NSString *)parentClassName
forCustomClass: (NSString *)customClassName;
- (NSArray *) customClasses;
- (NSDictionary *) customClasses;
- (NSDictionary *) decoded;

View file

@ -86,22 +86,13 @@
- (NSString *) _substituteClassForClassName: (NSString *)className
{
NSString *result = className;
NSEnumerator *en = [_customClasses objectEnumerator];
NSDictionary *dict = nil;
NSDictionary *dict = [_customClasses objectForKey: className];
// NSLog(@"_customClasses = %@", _customClasses);
while ((dict = [en nextObject]) != nil)
if (dict != nil)
{
NSString *customClassName = [dict objectForKey: @"customClassName"];
if ([customClassName isEqualToString: className])
{
result = [dict objectForKey: @"parentClassName"];
break;
}
result = [dict objectForKey: @"parentClassName"];
}
NSDebugLog(@"result = %@", result);
return result;
}
@ -328,7 +319,7 @@
NSData *theData = data;
// Dictionary which contains custom class information for Gorm/IB.
_customClasses = [[NSMutableArray alloc] initWithCapacity: 10];
_customClasses = [[NSMutableDictionary alloc] init];
theData = [self _preProcessXib: data];
if (theData == nil)
@ -1107,7 +1098,7 @@ didStartElement: (NSString*)elementName
return decoded;
}
- (NSArray *) customClasses
- (NSDictionary *) customClasses
{
return _customClasses;
}
@ -1119,11 +1110,13 @@ didStartElement: (NSString*)elementName
if (theId == nil || customClassName == nil)
return;
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
theId, @"id",
parentClassName, @"parentClassName",
customClassName, @"customClassName",nil];
[_customClasses addObject: dict];
NSMutableDictionary *dict =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
parentClassName, @"parentClassName",
theId, @"id",nil];
[_customClasses setObject: dict
forKey: customClassName];
}
@end