mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 22:20:37 +00:00
* Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h,
* Source/GSModelLoaderFactory.m: Add new method +supportedTypes. * Source/NSBundleAdditions.m: Use this new method to implement NIB resource detection on top of the base methods instead of doing it here. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37421 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
46d7887140
commit
3ad5c33813
4 changed files with 61 additions and 45 deletions
|
@ -130,6 +130,23 @@ static NSMutableDictionary *_modelMap = nil;
|
|||
return [_modelMap objectForKey: type];
|
||||
}
|
||||
|
||||
+ (NSArray *) supportedTypes
|
||||
{
|
||||
NSArray *objectArray = [_modelMap allValues];
|
||||
NSArray *sortedArray = [objectArray sortedArrayUsingSelector:
|
||||
@selector(_comparePriority:)];
|
||||
NSEnumerator *oen = [sortedArray objectEnumerator];
|
||||
Class cls = nil;
|
||||
NSMutableArray *types = [[NSMutableArray alloc] init];
|
||||
|
||||
while ((cls = [oen nextObject]) != nil)
|
||||
{
|
||||
[types addObject: [cls type]];
|
||||
}
|
||||
|
||||
return AUTORELEASE(types);
|
||||
}
|
||||
|
||||
+ (NSString *) supportedModelFileAtPath: (NSString *)modelPath
|
||||
{
|
||||
NSString *result = nil;
|
||||
|
@ -168,7 +185,7 @@ static NSMutableDictionary *_modelMap = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
+ (GSModelLoader *)modelLoaderForFileType: (NSString *)type
|
||||
+ (GSModelLoader *) modelLoaderForFileType: (NSString *)type
|
||||
{
|
||||
Class aClass = [GSModelLoaderFactory classForType: type];
|
||||
GSModelLoader *loader = nil;
|
||||
|
@ -186,7 +203,7 @@ static NSMutableDictionary *_modelMap = nil;
|
|||
return loader;
|
||||
}
|
||||
|
||||
+ (GSModelLoader *)modelLoaderForFileName: (NSString *)modelPath
|
||||
+ (GSModelLoader *) modelLoaderForFileName: (NSString *)modelPath
|
||||
{
|
||||
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
|
||||
GSModelLoader *result = nil;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue