Revision: 30046
http://sourceforge.net/p/bibdesk/svn/30046
Author: hofman
Date: 2026-02-23 17:41:29 +0000 (Mon, 23 Feb 2026)
Log Message:
-----------
synthesize setters
Modified Paths:
--------------
trunk/bibdesk/BDSKConverter.h
trunk/bibdesk/BDSKConverter.m
Modified: trunk/bibdesk/BDSKConverter.h
===================================================================
--- trunk/bibdesk/BDSKConverter.h 2026-02-23 10:19:24 UTC (rev 30045)
+++ trunk/bibdesk/BDSKConverter.h 2026-02-23 17:41:29 UTC (rev 30046)
@@ -57,13 +57,13 @@
@discussion This was a pain to write, and more of a pain to link. :)
*/
@interface BDSKConverter : NSObject {
- NSCharacterSet *finalCharSet;
- NSCharacterSet *accentCharSet;
- NSDictionary<NSString *, NSString *> *detexifyConversions;
- NSDictionary<NSString *, NSString *> *texifyConversions;
- NSDictionary<NSString *, NSString *> *texifyAccents;
- NSDictionary<NSString *, NSString *> *detexifyAccents;
- NSCharacterSet *baseCharacterSetForTeX;
+ NSCharacterSet *finalCharacterSet;
+ NSCharacterSet *accentCharacterSet;
+ NSDictionary<NSString *, NSString *> *texifyConversions;
+ NSDictionary<NSString *, NSString *> *detexifyConversions;
+ NSDictionary<NSString *, NSString *> *texifyAccents;
+ NSDictionary<NSString *, NSString *> *detexifyAccents;
+ NSCharacterSet *baseCharacterSetForTeX;
}
/*!
@method sharedConverter
Modified: trunk/bibdesk/BDSKConverter.m
===================================================================
--- trunk/bibdesk/BDSKConverter.m 2026-02-23 10:19:24 UTC (rev 30045)
+++ trunk/bibdesk/BDSKConverter.m 2026-02-23 17:41:29 UTC (rev 30046)
@@ -40,13 +40,14 @@
#import "NSError_BDSKExtensions.h"
@interface BDSKConverter ()
-- (void)setDetexifyAccents:(NSDictionary *)newAccents;
-- (void)setAccentCharacterSet:(NSCharacterSet *)charSet;
-- (void)setBaseCharacterSetForTeX:(NSCharacterSet *)charSet;
-- (void)setTexifyAccents:(NSDictionary *)newAccents;
-- (void)setFinalCharSet:(NSCharacterSet *)charSet;
-- (void)setTexifyConversions:(NSDictionary *)newConversions;
-- (void)setDeTexifyConversions:(NSDictionary *)newConversions;
+@property (nonatomic, copy) NSCharacterSet *finalCharacterSet;
+@property (nonatomic, copy) NSCharacterSet *accentCharacterSet;
+@property (nonatomic, copy) NSDictionary *texifyConversions;
+@property (nonatomic, copy) NSDictionary *detexifyConversions;
+@property (nonatomic, copy) NSDictionary *texifyAccents;
+@property (nonatomic, copy) NSDictionary *detexifyAccents;
+@property (nonatomic, copy) NSCharacterSet *baseCharacterSetForTeX;
+
static BOOL convertComposedCharacterToTeX(NSMutableString *charString,
NSCharacterSet *baseCharacterSetForTeX, NSCharacterSet *accentCharSet,
NSDictionary *texifyAccents);
static BOOL convertTeXStringToComposedCharacter(NSMutableString *texString,
NSDictionary *detexifyAccents);
@end
@@ -53,6 +54,8 @@
@implementation BDSKConverter
+@synthesize finalCharacterSet, accentCharacterSet, detexifyConversions,
texifyConversions, texifyAccents, detexifyAccents, baseCharacterSetForTeX;
+
static BDSKConverter *sharedConverter = nil;
+ (BDSKConverter *)sharedConverter{
@@ -110,23 +113,23 @@
}
[self setTexifyConversions:tmpTexifyDict];
- [self setDeTexifyConversions:tmpDetexifyDict];
+ [self setDetexifyConversions:tmpDetexifyDict];
// create a characterset from the characters we know how to convert
NSMutableCharacterSet *workingSet;
- workingSet = [[NSCharacterSet characterSetWithRange:NSMakeRange(0x80,
0x1d0)] mutableCopy]; //this should get all the characters in Latin-1
Supplement, Latin Extended-A, and Latin Extended-B
+ workingSet = [NSMutableCharacterSet
characterSetWithRange:NSMakeRange(0x80, 0x1d0)]; //this should get all the
characters in Latin-1 Supplement, Latin Extended-A, and Latin Extended-B
[workingSet addCharactersInRange:NSMakeRange(0x1e00, 0x100)]; //this
should get all the characters in Latin Extended Additional.
[workingSet formIntersectionWithCharacterSet:[NSCharacterSet
decomposableCharacterSet]];
for (NSString *string in [tmpTexifyDict allKeys])
[workingSet addCharactersInString:string];
- [self setFinalCharSet:workingSet];
+ [self setFinalCharacterSet:workingSet];
// build a character set of [a-z][A-Z] representing the base character
set that we can decompose and recompose as TeX
NSRange ucRange = NSMakeRange('A', 26);
NSRange lcRange = NSMakeRange('a', 26);
- workingSet = [[NSCharacterSet characterSetWithRange:ucRange] mutableCopy];
+ workingSet = [NSMutableCharacterSet characterSetWithRange:ucRange];
[workingSet addCharactersInRange:lcRange];
[self setBaseCharacterSetForTeX:workingSet];
@@ -161,7 +164,7 @@
ch = CFStringGetCharacterFromInlineBuffer(&inlineBuffer, idx);
- if ([finalCharSet characterIsMember:ch]){
+ if ([finalCharacterSet characterIsMember:ch]){
r = [precomposedString
rangeOfComposedCharacterSequenceAtIndex:idx];
@@ -181,7 +184,7 @@
offset += [TEXString length] - 1;
// fall back to Unicode decomposition/conversion of the
mutable string
- } else if(convertComposedCharacterToTeX(tmpConv,
baseCharacterSetForTeX, accentCharSet, texifyAccents)){
+ } else if(convertComposedCharacterToTeX(tmpConv,
baseCharacterSetForTeX, accentCharacterSet, texifyAccents)){
if (convertedSoFar == nil)
convertedSoFar = [precomposedString mutableCopy];
[convertedSoFar replaceCharactersInRange:NSMakeRange((idx
+ offset), 1) withString:tmpConv];
@@ -374,50 +377,6 @@
return NO;
}
-#pragma mark Private
-
-- (void)setDetexifyAccents:(NSDictionary *)newAccents{
- if(detexifyAccents != newAccents){
- detexifyAccents = [newAccents copy];
- }
-}
-
-- (void)setAccentCharacterSet:(NSCharacterSet *)charSet{
- if(accentCharSet != charSet){
- accentCharSet = [charSet copy];
- }
-}
-
-- (void)setBaseCharacterSetForTeX:(NSCharacterSet *)charSet{
- if(baseCharacterSetForTeX != charSet){
- baseCharacterSetForTeX = [charSet copy];
- }
-}
-
-- (void)setTexifyAccents:(NSDictionary *)newAccents{
- if(texifyAccents != newAccents){
- texifyAccents = [newAccents copy];
- }
-}
-
-- (void)setFinalCharSet:(NSCharacterSet *)charSet{
- if(finalCharSet != charSet){
- finalCharSet = [charSet copy];
- }
-}
-
-- (void)setTexifyConversions:(NSDictionary *)newConversions{
- if(texifyConversions != newConversions){
- texifyConversions = [newConversions copy];
- }
-}
-
-- (void)setDeTexifyConversions:(NSDictionary *)newConversions{
- if(detexifyConversions != newConversions){
- detexifyConversions = [newConversions copy];
- }
-}
-
@end
@implementation NSString (BDSKConverter)
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