mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 13:40:49 +00:00
Add version of GSStoryboaddKeyedUnarchiver
This commit is contained in:
parent
d3661d974c
commit
2ae0dbc0da
6 changed files with 90 additions and 3 deletions
|
@ -346,6 +346,7 @@ GSToolTips.m \
|
|||
GSToolbarView.m \
|
||||
GSToolbarCustomizationPalette.m \
|
||||
GSStandardWindowDecorationView.m \
|
||||
GSStoryboardKeyedUnarchiver.m \
|
||||
GSWindowDecorationView.m \
|
||||
GSPrinting.m \
|
||||
GSPrintOperation.m \
|
||||
|
|
43
Source/GSStoryboardKeyedUnarchiver.h
Normal file
43
Source/GSStoryboardKeyedUnarchiver.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* Definition of class GSStoryboardKeyedUnarchiver
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 14-05-2024
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _GSStoryboardKeyedUnarchiver_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _GSStoryboardKeyedUnarchiver_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import "GSXib5KeyedUnarchiver.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@interface GSStoryboardKeyedUnarchiver : GSXib5KeyedUnarchiver
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GSStoryboardKeyedUnarchiver_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
30
Source/GSStoryboardKeyedUnarchiver.m
Normal file
30
Source/GSStoryboardKeyedUnarchiver.m
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Implementation of class GSStoryboardKeyedUnarchiver
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 14-05-2024
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import "GSStoryboardKeyedUnarchiver.h"
|
||||
|
||||
@implementation GSStoryboardKeyedUnarchiver
|
||||
|
||||
@end
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
GSXibElement *_orderedObjects;
|
||||
GSXibElement *_flattenedProperties;
|
||||
GSXibElement *_runtimeAttributes;
|
||||
GSXibElement *_scenes;
|
||||
NSMutableDictionary *_orderedObjectsDict;
|
||||
NSArray *_resources;
|
||||
}
|
||||
|
|
|
@ -747,6 +747,11 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"connectionRecords", @"key",
|
||||
nil]];
|
||||
|
||||
_scenes = [[GSXibElement alloc] initWithType: @"array"
|
||||
andAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"scenes", @"key",
|
||||
nil]];
|
||||
|
||||
// objectRecords...
|
||||
[_objectRecords setElement: _orderedObjects forKey: @"orderedObjects"];
|
||||
|
||||
|
|
|
@ -35,10 +35,13 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/NSXMLDocument.h>
|
||||
|
||||
#import "GNUstepGUI/GSXibKeyedUnarchiver.h"
|
||||
#import "GNUstepGUI/GSXibElement.h"
|
||||
#import "GNUstepGUI/GSNibLoading.h"
|
||||
|
||||
#import "GSXib5KeyedUnarchiver.h"
|
||||
#import "GSStoryboardKeyedUnarchiver.h"
|
||||
|
||||
@implementation GSXibKeyedUnarchiver
|
||||
|
||||
|
@ -49,6 +52,7 @@
|
|||
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData: data
|
||||
options: 0
|
||||
error: NULL];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return NO;
|
||||
|
@ -63,6 +67,7 @@
|
|||
return [documentNodes count] != 0;
|
||||
}
|
||||
#else
|
||||
|
||||
// We now default to checking XIB 5 versions
|
||||
return YES;
|
||||
#endif
|
||||
|
@ -75,6 +80,7 @@
|
|||
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData: data
|
||||
options: 0
|
||||
error: NULL];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return NO;
|
||||
|
@ -82,15 +88,16 @@
|
|||
else
|
||||
{
|
||||
// Test to see if this is an Xcode 5 XIB...
|
||||
NSArray *nodes = [document nodesForXPath: @"/scene" error: NULL];
|
||||
NSArray *nodes = [document nodesForXPath: @"/scenes" error: NULL];
|
||||
|
||||
// Need at LEAST ONE scene node...we should find something a bit more
|
||||
// specific to check here...
|
||||
return [nodes count] != 0;
|
||||
}
|
||||
#else
|
||||
|
||||
// We now default to checking XIB 5 versions
|
||||
return YES;
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -100,7 +107,7 @@
|
|||
|
||||
if ([self checkStoryboard: data])
|
||||
{
|
||||
unarchiver = [[GSXib5KeyedUnarchiver alloc] initForReadingWithData: data];
|
||||
unarchiver = [[GSStoryboardKeyedUnarchiver alloc] initForReadingWithData: data];
|
||||
}
|
||||
else if ([self checkXib5: data])
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue