Revision: 28522
http://sourceforge.net/p/bibdesk/svn/28522
Author: hofman
Date: 2024-01-03 17:26:44 +0000 (Wed, 03 Jan 2024)
Log Message:
-----------
remove custom dictionary and set methods to create CF objects with custom
callbacks. Also remove these callbacks.
Modified Paths:
--------------
trunk/bibdesk/BDSKCFCallBacks.h
trunk/bibdesk/BDSKCFCallBacks.m
trunk/bibdesk/BibAuthor.h
trunk/bibdesk/BibAuthor.m
trunk/bibdesk/BibItem.m
trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
trunk/bibdesk/NSSet_BDSKExtensions.h
trunk/bibdesk/NSSet_BDSKExtensions.m
Removed Paths:
-------------
trunk/bibdesk/NSDictionary_BDSKExtensions.h
trunk/bibdesk/NSDictionary_BDSKExtensions.m
Modified: trunk/bibdesk/BDSKCFCallBacks.h
===================================================================
--- trunk/bibdesk/BDSKCFCallBacks.h 2024-01-03 17:09:50 UTC (rev 28521)
+++ trunk/bibdesk/BDSKCFCallBacks.h 2024-01-03 17:26:44 UTC (rev 28522)
@@ -49,6 +49,4 @@
extern const CFDictionaryKeyCallBacks
kBDSKCaseInsensitiveStringDictionaryKeyCallBacks;
-extern const CFSetCallBacks kBDSKCaseInsensitiveStringSetCallBacks;
-
extern const CFBagCallBacks kBDSKCaseInsensitiveStringBagCallBacks;
Modified: trunk/bibdesk/BDSKCFCallBacks.m
===================================================================
--- trunk/bibdesk/BDSKCFCallBacks.m 2024-01-03 17:09:50 UTC (rev 28521)
+++ trunk/bibdesk/BDSKCFCallBacks.m 2024-01-03 17:26:44 UTC (rev 28522)
@@ -40,15 +40,15 @@
#import "CFString_BDSKExtensions.h"
const void *BDSKNSObjectRetain(CFAllocatorRef allocator, const void *value) {
- return [(id)value retain];
+ return CFRetain(value);
}
void BDSKNSObjectRelease(CFAllocatorRef allocator, const void *value) {
- [(id)value release];
+ CFRelease(value);
}
CFStringRef BDSKNSObjectCopyDescription(const void *value) {
- return (CFStringRef)[[(id)value description] retain];
+ return CFCopyDescription(value);
}
Boolean BDSKCaseInsensitiveStringEqual(const void *value1, const void *value2)
{
@@ -59,24 +59,6 @@
return BDCaseInsensitiveStringHash(value);
}
-const CFDictionaryKeyCallBacks
kBDSKCaseInsensitiveStringDictionaryKeyCallBacks = {
- 0, // version
- BDSKNSObjectRetain,
- BDSKNSObjectRelease,
- BDSKNSObjectCopyDescription,
- BDSKCaseInsensitiveStringEqual,
- BDSKCaseInsensitiveStringHash
-};
-
-const CFSetCallBacks kBDSKCaseInsensitiveStringSetCallBacks = {
- 0, // version
- BDSKNSObjectRetain,
- BDSKNSObjectRelease,
- BDSKNSObjectCopyDescription,
- BDSKCaseInsensitiveStringEqual,
- BDSKCaseInsensitiveStringHash
-};
-
const CFBagCallBacks kBDSKCaseInsensitiveStringBagCallBacks = {
0, // version
BDSKNSObjectRetain,
Modified: trunk/bibdesk/BibAuthor.h
===================================================================
--- trunk/bibdesk/BibAuthor.h 2024-01-03 17:09:50 UTC (rev 28521)
+++ trunk/bibdesk/BibAuthor.h 2024-01-03 17:26:44 UTC (rev 28522)
@@ -134,16 +134,9 @@
@end
-extern const CFDictionaryKeyCallBacks kBDSKAuthorFuzzyDictionaryKeyCallBacks;
-extern const CFArrayCallBacks kBDSKAuthorFuzzyArrayCallBacks;
-extern const CFSetCallBacks kBDSKAuthorFuzzySetCallBacks;
extern const CFBagCallBacks kBDSKAuthorFuzzyBagCallBacks;
-@interface NSMutableSet (BibAuthor)
-- (id)initForFuzzyAuthors;
-@end
-
@interface NSArray (BibAuthorMultipleCompare)
- (NSComparisonResult)sortCompareToAuthorArray:(NSArray *)other;
@end
Modified: trunk/bibdesk/BibAuthor.m
===================================================================
--- trunk/bibdesk/BibAuthor.m 2024-01-03 17:09:50 UTC (rev 28521)
+++ trunk/bibdesk/BibAuthor.m 2024-01-03 17:26:44 UTC (rev 28522)
@@ -604,42 +604,16 @@
// fuzzy equality requires that last names be equal case-insensitively, so
equal objects are guaranteed the same hash
CFHashCode BibAuthorFuzzyHash(const void *item)
{
- BDSKASSERT([(id)item isKindOfClass:[BibAuthor class]]);
+ BDSKASSERT([(__bridge id)item isKindOfClass:[BibAuthor class]]);
return [(BibAuthor *)item fuzzyHash];
}
-Boolean BibAuthorFuzzyEqual(const void *value1, const void *value2)
+Boolean BibAuthorFuzzyEqual(const void *item1, const void *item2)
{
- BDSKASSERT([(id)value1 isKindOfClass:[BibAuthor class]] && [(id)value2
isKindOfClass:[BibAuthor class]]);
- return [(BibAuthor *)value1 fuzzyEqual:(BibAuthor *)value2];
+ BDSKASSERT([(__bridge id)item1 isKindOfClass:[BibAuthor class]] &&
[(__bridge id)item2 isKindOfClass:[BibAuthor class]]);
+ return [(BibAuthor *)item1 fuzzyEqual:(BibAuthor *)item2];
}
-const CFDictionaryKeyCallBacks kBDSKAuthorFuzzyDictionaryKeyCallBacks = {
- 0,
- BDSKNSObjectRetain,
- BDSKNSObjectRelease,
- BDSKNSObjectCopyDescription,
- BibAuthorFuzzyEqual,
- BibAuthorFuzzyHash,
-};
-
-const CFArrayCallBacks kBDSKAuthorFuzzyArrayCallBacks = {
- 0, // version
- BDSKNSObjectRetain, // retain
- BDSKNSObjectRelease, // release
- BDSKNSObjectCopyDescription,
- BibAuthorFuzzyEqual,
-};
-
-const CFSetCallBacks kBDSKAuthorFuzzySetCallBacks = {
- 0, // version
- BDSKNSObjectRetain, // retain
- BDSKNSObjectRelease, // release
- BDSKNSObjectCopyDescription,
- BibAuthorFuzzyEqual,
- BibAuthorFuzzyHash,
-};
-
const CFBagCallBacks kBDSKAuthorFuzzyBagCallBacks = {
0, // version
BDSKNSObjectRetain, // retain
@@ -650,14 +624,6 @@
};
-@implementation NSMutableSet (BibAuthor)
-- (id)initForFuzzyAuthors {
- [[self init] release];
- return (NSMutableSet *)CFSetCreateMutable(CFAllocatorGetDefault(), 0,
&kBDSKAuthorFuzzySetCallBacks);
-}
-@end
-
-
@implementation NSArray (BibAuthorMultipleCompare)
// Added at request of a user who wants to sort in a journal-style order of
author/year. Since our table subsort is only 2 deep, this is the most
reasonable place to do the comparison for an arbitrary number of authors.
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2024-01-03 17:09:50 UTC (rev 28521)
+++ trunk/bibdesk/BibItem.m 2024-01-03 17:26:44 UTC (rev 28522)
@@ -119,72 +119,11 @@
@end
-
-CFHashCode BibItemCaseInsensitiveCiteKeyHash(const void *item)
-{
- BDSKASSERT([(id)item isKindOfClass:[BibItem class]]);
- return BDCaseInsensitiveStringHash([(BibItem *)item citeKey]);
-}
-
-CFHashCode BibItemEquivalenceHash(const void *item)
-{
- BDSKASSERT([(id)item isKindOfClass:[BibItem class]]);
-
- NSString *type = [(BibItem *)item pubType] ?: @"";
- CFHashCode hash = BDCaseInsensitiveStringHash(type);
- NSUInteger prime = 31;
- NSUInteger factor = 1;
-
- // hash only the standard fields; are these all we should compare?
- BDSKTypeManager *btm = [BDSKTypeManager sharedManager];
- NSMutableArray *keys = [[NSMutableArray alloc] initWithCapacity:20];
- [keys addObjectsFromArray:[btm requiredFieldsForType:type]];
- [keys addObjectsFromArray:[btm optionalFieldsForType:type]];
- [keys removeObject:BDSKLocalUrlString];
- for (NSString *key in keys) {
- factor *= prime;
- hash += factor * [[(BibItem *)item stringValueOfField:key inherit:NO]
?: @"" hash];
- }
- [keys release];
-
- return hash;
-}
-
-Boolean BibItemEqualityTest(const void *value1, const void *value2)
-{
- return ([(BibItem *)value1 isEqualToItem:(BibItem *)value2]);
-}
-
-Boolean BibItemEquivalenceTest(const void *value1, const void *value2)
-{
- return ([(BibItem *)value1 isEquivalentToItem:(BibItem *)value2]);
-}
-
-// Values are BibItems; used to determine if pubs are duplicates. Items must
not be edited while contained in a set using these callbacks, so dispose of the
set before any editing operations.
-const CFSetCallBacks kBDSKBibItemEqualitySetCallBacks = {
- 0, // version
- BDSKNSObjectRetain, // retain
- BDSKNSObjectRelease, // release
- BDSKNSObjectCopyDescription,
- BibItemEqualityTest,
- BibItemCaseInsensitiveCiteKeyHash,
-};
-
-// Values are BibItems; used to determine if pubs are duplicates. Items must
not be edited while contained in a set using these callbacks, so dispose of the
set before any editing operations.
-const CFSetCallBacks kBDSKBibItemEquivalenceSetCallBacks = {
- 0, // version
- BDSKNSObjectRetain, // retain
- BDSKNSObjectRelease, // release
- BDSKNSObjectCopyDescription,
- BibItemEquivalenceTest,
- BibItemEquivalenceHash,
-};
-
static NSURL *createUniqueURL(void)
{
- NSString *uuidStr = (id)BDCreateUniqueString();
- NSURL *identifierURL = [[NSURL alloc] initWithString:[@"bdskidentifier://"
stringByAppendingString:uuidStr]];
- [uuidStr release];
+ CFStringRef uuidStr = BDCreateUniqueString();
+ NSURL *identifierURL = [[NSURL alloc] initWithString:[@"bdskidentifier://"
stringByAppendingString:(__bridge NSString *)uuidStr]];
+ CFRelease(uuidStr);
return identifierURL;
}
Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2024-01-03 17:09:50 UTC
(rev 28521)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2024-01-03 17:26:44 UTC
(rev 28522)
@@ -406,7 +406,6 @@
CE2A0ACA22459A4B00A8F31C /* NSColor_BDSKExtensions.h in Headers
*/ = {isa = PBXBuildFile; fileRef = CEF2EEE40F3462A900A7989E /*
NSColor_BDSKExtensions.h */; };
CE2A0ACB22459A4B00A8F31C /* NSData_BDSKExtensions.h in Headers
*/ = {isa = PBXBuildFile; fileRef = F96F11940AAF4FD100815D06 /*
NSData_BDSKExtensions.h */; };
CE2A0ACC22459A4B00A8F31C /* NSDate_BDSKExtensions.h in Headers
*/ = {isa = PBXBuildFile; fileRef = F9235017089A813E00EFEB06 /*
NSDate_BDSKExtensions.h */; };
- CE2A0ACD22459A4B00A8F31C /* NSDictionary_BDSKExtensions.h in
Headers */ = {isa = PBXBuildFile; fileRef = CE6775140A8506A7003CFC58 /*
NSDictionary_BDSKExtensions.h */; };
CE2A0ACE22459A4B00A8F31C /* NSError_BDSKExtensions.h in Headers
*/ = {isa = PBXBuildFile; fileRef = F9F5E20B0AE307C0007EBB31 /*
NSError_BDSKExtensions.h */; };
CE2A0ACF22459A4B00A8F31C /* NSEvent_BDSKExtensions.h in Headers
*/ = {isa = PBXBuildFile; fileRef = CEEC1A301091F31600530207 /*
NSEvent_BDSKExtensions.h */; };
CE2A0AD022459A4B00A8F31C /* NSFileManager_BDSKExtensions.h in
Headers */ = {isa = PBXBuildFile; fileRef = F95CC0C0087F5378002C5694 /*
NSFileManager_BDSKExtensions.h */; };
@@ -522,7 +521,6 @@
CE6759F526A356F0003B1FFA /* BDSKGroupCellView.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE6759F326A356F0003B1FFA /* BDSKGroupCellView.m
*/; };
CE675A0D26A359EC003B1FFA /* BDSKGroupBubbleView.h in Headers */
= {isa = PBXBuildFile; fileRef = CE675A0B26A359EC003B1FFA /*
BDSKGroupBubbleView.h */; };
CE675A0E26A359EC003B1FFA /* BDSKGroupBubbleView.m in Sources */
= {isa = PBXBuildFile; fileRef = CE675A0C26A359EC003B1FFA /*
BDSKGroupBubbleView.m */; };
- CE6775170A8506A7003CFC58 /* NSDictionary_BDSKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE6775150A8506A7003CFC58 /*
NSDictionary_BDSKExtensions.m */; };
CE6958F6223A9B94001239A6 /* BDSKDownloader.h in Headers */ =
{isa = PBXBuildFile; fileRef = CE6958F4223A9B94001239A6 /* BDSKDownloader.h */;
};
CE6958F7223A9B94001239A6 /* BDSKDownloader.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE6958F5223A9B94001239A6 /* BDSKDownloader.m */;
};
CE6BC8F42710960700ADCE71 /* ScriptHookTemplate.scpt in
Resources */ = {isa = PBXBuildFile; fileRef = CE6BC8F32710960600ADCE71 /*
ScriptHookTemplate.scpt */; };
@@ -1637,8 +1635,6 @@
CE6759F326A356F0003B1FFA /* BDSKGroupCellView.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
BDSKGroupCellView.m; sourceTree = "<group>"; };
CE675A0B26A359EC003B1FFA /* BDSKGroupBubbleView.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path =
BDSKGroupBubbleView.h; sourceTree = "<group>"; };
CE675A0C26A359EC003B1FFA /* BDSKGroupBubbleView.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
BDSKGroupBubbleView.m; sourceTree = "<group>"; };
- CE6775140A8506A7003CFC58 /* NSDictionary_BDSKExtensions.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = NSDictionary_BDSKExtensions.h; sourceTree = "<group>"; };
- CE6775150A8506A7003CFC58 /* NSDictionary_BDSKExtensions.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = NSDictionary_BDSKExtensions.m; sourceTree =
"<group>"; };
CE6958F4223A9B94001239A6 /* BDSKDownloader.h */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BDSKDownloader.h;
sourceTree = "<group>"; };
CE6958F5223A9B94001239A6 /* BDSKDownloader.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
BDSKDownloader.m; sourceTree = "<group>"; };
CE6BC8F32710960600ADCE71 /* ScriptHookTemplate.scpt */ = {isa =
PBXFileReference; lastKnownFileType = file; path = ScriptHookTemplate.scpt;
sourceTree = "<group>"; };
@@ -2776,7 +2772,6 @@
F9025DC80969AD2C008A551C /*
NSCharacterSet_BDSKExtensions.m */,
F96F11950AAF4FD100815D06 /*
NSData_BDSKExtensions.m */,
F9235018089A813E00EFEB06 /*
NSDate_BDSKExtensions.m */,
- CE6775150A8506A7003CFC58 /*
NSDictionary_BDSKExtensions.m */,
F9F5E20C0AE307C0007EBB31 /*
NSError_BDSKExtensions.m */,
F95CC0C1087F5378002C5694 /*
NSFileManager_BDSKExtensions.m */,
CE3255FE0A1748D0002D6E4C /*
NSGeometry_BDSKExtensions.m */,
@@ -3576,7 +3571,6 @@
CEF2EEE40F3462A900A7989E /*
NSColor_BDSKExtensions.h */,
F96F11940AAF4FD100815D06 /*
NSData_BDSKExtensions.h */,
F9235017089A813E00EFEB06 /*
NSDate_BDSKExtensions.h */,
- CE6775140A8506A7003CFC58 /*
NSDictionary_BDSKExtensions.h */,
F9F5E20B0AE307C0007EBB31 /*
NSError_BDSKExtensions.h */,
CEEC1A301091F31600530207 /*
NSEvent_BDSKExtensions.h */,
F95CC0C0087F5378002C5694 /*
NSFileManager_BDSKExtensions.h */,
@@ -3760,7 +3754,6 @@
CE2A0A0D224599E900A8F31C /* BDSKGradientView.h
in Headers */,
CE2A0A26224599EF00A8F31C /*
BDSKLineNumberView.h in Headers */,
CE2A0AEE22459A5100A8F31C /*
WokSearchLiteService.h in Headers */,
- CE2A0ACD22459A4B00A8F31C /*
NSDictionary_BDSKExtensions.h in Headers */,
CE2A0A57224599F600A8F31C /* BDSKRuntime.h in
Headers */,
CE2A09C52245997A00A8F31C /*
BDSKBookmark+Scripting.h in Headers */,
CE2A0A7622459A2D00A8F31C /* BDSKSmartGroup.h in
Headers */,
@@ -4882,7 +4875,6 @@
CE3A32D60A345C2400984DC2 /*
NSAttributedString_BDSKExtensions.m in Sources */,
CE6DACC50A503ECF00123185 /* BDSKToolbarItem.m
in Sources */,
F9FD63DD0A61B87800F9871B /*
NSMenu_BDSKExtensions.m in Sources */,
- CE6775170A8506A7003CFC58 /*
NSDictionary_BDSKExtensions.m in Sources */,
CE6759F526A356F0003B1FFA /* BDSKGroupCellView.m
in Sources */,
CE95A57C0A88883300334DFA /*
BDSKReadMeController.m in Sources */,
CE624DB72030BCAE004B6E0B /* BDSKSIAMParser.m in
Sources */,
Deleted: trunk/bibdesk/NSDictionary_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSDictionary_BDSKExtensions.h 2024-01-03 17:09:50 UTC (rev
28521)
+++ trunk/bibdesk/NSDictionary_BDSKExtensions.h 2024-01-03 17:26:44 UTC (rev
28522)
@@ -1,82 +0,0 @@
-//
-// NSDictionary_BDSKExtensions.h
-// Bibdesk
-//
-// Created by Christiaan Hofman on 8/5/06.
-/*
- This software is Copyright (c) 2006
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- Omni Source License 2007
-
- OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
-
- Omni Source Code software is available from The Omni Group on their
- web site at http://www.omnigroup.com/www.omnigroup.com.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- Any original copyright notices and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface NSDictionary (BDSKExtensions)
-
-+ (id)newWithObjects:(id *)objects forCaseInsensitiveKeys:(NSString **)keys
count:(NSUInteger)count;
-+ (id)newForCaseInsensitiveKeysWithDictionary:(NSDictionary *)aDictionary;
-
-@end
-
-#pragma mark -
-
-@interface NSMutableDictionary (BDSKExtensions)
-
-+ (id)newForCaseInsensitiveKeys;
-
-@end
Deleted: trunk/bibdesk/NSDictionary_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSDictionary_BDSKExtensions.m 2024-01-03 17:09:50 UTC (rev
28521)
+++ trunk/bibdesk/NSDictionary_BDSKExtensions.m 2024-01-03 17:26:44 UTC (rev
28522)
@@ -1,100 +0,0 @@
-//
-// NSDictionary_BDSKExtensions.m
-// Bibdesk
-//
-// Created by Christiaan Hofman on 8/5/06.
-/*
- This software is Copyright (c) 2006
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- Some methods in this category are copied from OmniFoundation
- and are subject to the following licence:
-
- Omni Source License 2007
-
- OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
-
- Omni Source Code software is available from The Omni Group on their
- web site at http://www.omnigroup.com/www.omnigroup.com.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- Any original copyright notices and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#import "NSDictionary_BDSKExtensions.h"
-#import "BDSKCFCallBacks.h"
-
-
-@implementation NSDictionary (BDSKExtensions)
-
-+ (id)newWithObjects:(id *)objects forCaseInsensitiveKeys:(NSString **)keys
count:(NSUInteger)count {
- return (id)CFDictionaryCreate(CFAllocatorGetDefault(), (const void
**)keys, (const void **)objects, count,
&kBDSKCaseInsensitiveStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
-}
-
-+ (id)newForCaseInsensitiveKeysWithDictionary:(NSDictionary *)aDictionary{
- CFIndex count = [aDictionary count];
- BDSKASSERT(count < 256);
- NSString *keys[count];
- id values[count];
- if (count)
- CFDictionaryGetKeysAndValues((CFDictionaryRef)aDictionary, (const void
**)keys, (const void **)values);
- return [self newWithObjects:values forCaseInsensitiveKeys:keys
count:count];
-}
-
-@end
-
-#pragma mark -
-
-@implementation NSMutableDictionary (BDSKExtensions)
-
-+ (id)newForCaseInsensitiveKeys{
- return (NSMutableDictionary
*)CFDictionaryCreateMutable(CFAllocatorGetDefault(), 0,
&kBDSKCaseInsensitiveStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
-}
-
-@end
Modified: trunk/bibdesk/NSSet_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSSet_BDSKExtensions.h 2024-01-03 17:09:50 UTC (rev
28521)
+++ trunk/bibdesk/NSSet_BDSKExtensions.h 2024-01-03 17:26:44 UTC (rev
28522)
@@ -40,17 +40,6 @@
@interface NSSet (BDSKExtensions)
-+ (id)setForCaseInsensitiveStringsWithObjects:(id)firstObj, ...;
-+ (id)setForCaseInsensitiveStringsWithArray:(NSArray *)array;
-
- (id)nonEmpty;
@end
-
-@interface NSMutableSet (BDSKExtensions)
-
-+ (id)setForCaseInsensitiveStrings;
-
-+ (id)newForCaseInsensitiveStrings;
-
-@end
Modified: trunk/bibdesk/NSSet_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSSet_BDSKExtensions.m 2024-01-03 17:09:50 UTC (rev
28521)
+++ trunk/bibdesk/NSSet_BDSKExtensions.m 2024-01-03 17:26:44 UTC (rev
28522)
@@ -42,38 +42,6 @@
@implementation NSSet (BDSKExtensions)
-+ (id)setForCaseInsensitiveStringsWithObjects:(id)object, ...;
-{
- CFMutableSetRef set = CFSetCreateMutable(CFAllocatorGetDefault(), 0,
&kBDSKCaseInsensitiveStringSetCallBacks);
- va_list objList;
-
- if(object != nil){
- CFSetAddValue(set, (const void *)object);
- va_start(objList, object);
- while((object = va_arg(objList, id)) != nil)
- CFSetAddValue(set, (const void *)object);
- va_end(objList);
- }
-
- // CFSetCreateCopy uses same callbacks as original set
- NSSet *returnSet = (NSSet *)CFSetCreateCopy(CFAllocatorGetDefault(), set);
- CFRelease(set);
- return [returnSet autorelease];
-}
-
-+ (id)setForCaseInsensitiveStringsWithArray:(NSArray *)array;
-{
- CFMutableSetRef set = CFSetCreateMutable(CFAllocatorGetDefault(), 0,
&kBDSKCaseInsensitiveStringSetCallBacks);
-
- for(id object in array)
- CFSetAddValue(set, (const void *)object);
-
- // CFSetCreateCopy uses same callbacks as original set
- NSSet *returnSet = (NSSet *)CFSetCreateCopy(CFAllocatorGetDefault(), set);
- CFRelease(set);
- return [returnSet autorelease];
-}
-
- (id)nonEmpty {
NSMutableSet *nonEmptySet = [NSMutableSet set];
for (id obj in self)
@@ -83,18 +51,3 @@
}
@end
-
-@implementation NSMutableSet (BDSKExtensions)
-
-+ (id)setForCaseInsensitiveStrings;
-{
- return [[self newForCaseInsensitiveStrings] autorelease];
-}
-
-+ (id)newForCaseInsensitiveStrings
-{
- // ignore capacity, as it will fix the number of items we can use
- return (NSMutableSet *)CFSetCreateMutable(kCFAllocatorDefault, 0,
&kBDSKCaseInsensitiveStringSetCallBacks);
-}
-
-@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit