From 83963f9d2ad2120fd788e4b488f529fa34c75662 Mon Sep 17 00:00:00 2001 From: fredkiefer Date: Wed, 11 Dec 2019 23:46:44 +0100 Subject: [PATCH] More code simplifications. --- Source/GSXib5KeyedUnarchiver.m | 301 ++++++++++++++++----------------- 1 file changed, 148 insertions(+), 153 deletions(-) diff --git a/Source/GSXib5KeyedUnarchiver.m b/Source/GSXib5KeyedUnarchiver.m index 139f5b36c..8c465738b 100644 --- a/Source/GSXib5KeyedUnarchiver.m +++ b/Source/GSXib5KeyedUnarchiver.m @@ -329,16 +329,14 @@ static NSArray *XmlConnectionRecordTags = nil; { if (self == [GSXib5KeyedUnarchiver class]) { - @synchronized(self) - { - // Only check one since we're going to load all once... - if (XmltagToObjectClassCrossReference == nil) - { - // These define XML tags (i.e. isSeparatorItem, NSWindowStyleMask->styleMask, etc) - // Note, that unless the associated cross referenced key contains an aattribute that matches the - // original OLD key type you will need to potentially add a decoding method, and if so, the - // 'XmlKeyToDecoderSelectorMap' variable below should contain the key to it's associated decoding - // method for cross referencing... - XmlKeyMapTable = [NSDictionary dictionaryWithObjectsAndKeys: - @"isSeparatorItem", @"NSIsSeparator", + // These cross-reference from the OLD key to the NEW key that can be referenced and it's value + // or object returned verbatum. IF an OLD XIB key does not exist and contains the 'NS' prefix + // the key processing will strip the 'NS' prefix, make the first letter lowercase then check + // whether that key exists and use it's presence during 'containsValueForKey:' processing, and + // use it's value for 'decodeXxxForKey:' processing. So, the keys here should ONLY be those + // that cannot be generated autoamatically by this processing. + // (i.e. NSIsSeparator->isSeparatorItem, NSWindowStyleMask->styleMask, etc) + // Note, that unless the associated cross referenced key contains an aattribute that matches the + // original OLD key type you will need to potentially add a decoding method, and if so, the + // 'XmlKeyToDecoderSelectorMap' variable below should contain the key to it's associated decoding + // method for cross referencing... + XmlKeyMapTable = [NSDictionary dictionaryWithObjectsAndKeys: + @"isSeparatorItem", @"NSIsSeparator", //@"systemMenu", @"NSName", @"customClass", @"NSClassName", @"catalog", @"NSCatalogName", @@ -415,7 +413,6 @@ static NSArray *XmlConnectionRecordTags = nil; @"contentView", @"NSWindowView", @"customClass", @"NSWindowClass", @"title", @"NSWindowTitle", - @"initialPositionMask", @"windowPositionMask", @"contentRect", @"NSWindowRect", @"insertionPointColor", @"NSInsertionColor", @"vertical", @"NSIsVertical", @@ -432,55 +429,55 @@ static NSArray *XmlConnectionRecordTags = nil; @"name", @"NSBinding", @"items", @"NSMenuItems", nil]; - RETAIN(XmlKeyMapTable); + RETAIN(XmlKeyMapTable); - // These define keys that are always "CONTAINED" since they typically are a combination of key values - // stored as separate and/or multiple attributed values that may be combined as in the case of flags - // and masks. There are some that have NO direct cross reference (i.e. NSSupport, NSBGColor, etc) - // Each of the ones listed here will MOST PROBABLY have an entry in the 'XmlKeyToDecoderSelectorMap' - // below that provides a cross referenced to an asociated decoding method... - // If there is an easy way to check whether an existing OLD XIB key is contained within the XIB 5 - // version the 'containsValueForKey:' method in this file should be modified and the key omitted from this - // list (i.e. NSContents, NSAlternateContents, NSIntercellSpacingWidth, NSIntercellSpacingHeight, etc)... - XmlKeysDefined = [NSArray arrayWithObjects: @"NSWindowBacking", @"NSWTFlags", - @"NSvFlags", @"NSBGColor", - @"NSSize", //@"IBIsSystemFont", - //@"NSHeaderClipView", - @"NSHScroller", @"NSVScroller", @"NSsFlags", @"NSsFlags2", - @"NSColumnAutoresizingStyle", @"NSTvFlags", @"NScvFlags", - @"NSSupport", @"NSName", - @"NSMenuItem", - @"NSDocView", - @"NSSliderType", - @"NSCellPrototype", @"NSBrFlags", @"NSNumberOfVisibleColumns", - @"NSWhite", @"NSRGB", @"NSCYMK", - //@"NSContents", @"NSAlternateContents", - @"NSCellFlags", @"NSCellFlags2", - @"NSButtonFlags", @"NSButtonFlags2", - @"NSSelectedIndex", @"NSAltersState", @"NSUsesItemFromMenu", - @"NSNormalImage", @"NSAlternateImage", - @"NSBorderType", @"NSBoxType", @"NSTitlePosition", - @"NSTitleCell", @"NSOffsets", - @"NSMatrixFlags", @"NSNumCols", @"NSNumRows", - @"NSSharedData", @"NSFlags", @"NSTVFlags", @"NSDefaultParagraphStyle", - @"NSpiFlags", nil]; - RETAIN(XmlKeysDefined); + // These define keys that are always "CONTAINED" since they typically are a combination of key values + // stored as separate and/or multiple attributed values that may be combined as in the case of flags + // and masks. There are some that have NO direct cross reference (i.e. NSSupport, NSBGColor, etc) + // Each of the ones listed here will MOST PROBABLY have an entry in the 'XmlKeyToDecoderSelectorMap' + // below that provides a cross referenced to an asociated decoding method... + // If there is an easy way to check whether an existing OLD XIB key is contained within the XIB 5 + // version the 'containsValueForKey:' method in this file should be modified and the key omitted from this + // list (i.e. NSContents, NSAlternateContents, NSIntercellSpacingWidth, NSIntercellSpacingHeight, etc)... + XmlKeysDefined = [NSArray arrayWithObjects: @"NSWindowBacking", @"NSWTFlags", + @"NSvFlags", @"NSBGColor", + @"NSSize", //@"IBIsSystemFont", + //@"NSHeaderClipView", + @"NSHScroller", @"NSVScroller", @"NSsFlags", @"NSsFlags2", + @"NSColumnAutoresizingStyle", @"NSTvFlags", @"NScvFlags", + @"NSSupport", @"NSName", + @"NSMenuItem", + @"NSDocView", + @"NSSliderType", + @"NSCellPrototype", @"NSBrFlags", @"NSNumberOfVisibleColumns", + @"NSWhite", @"NSRGB", @"NSCYMK", + //@"NSContents", @"NSAlternateContents", + @"NSCellFlags", @"NSCellFlags2", + @"NSButtonFlags", @"NSButtonFlags2", + @"NSSelectedIndex", @"NSAltersState", @"NSUsesItemFromMenu", + @"NSNormalImage", @"NSAlternateImage", + @"NSBorderType", @"NSBoxType", @"NSTitlePosition", + @"NSTitleCell", @"NSOffsets", + @"NSMatrixFlags", @"NSNumCols", @"NSNumRows", + @"NSSharedData", @"NSFlags", @"NSTVFlags", @"NSDefaultParagraphStyle", + @"NSpiFlags", nil]; + RETAIN(XmlKeysDefined); - // These define XML tags (i.e. '