Revision: 11882
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11882&view=rev
Author: hofman
Date: 2007-12-12 10:15:08 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
Add a method to check if a string is empty or nil as a complex string and use
that for inheriting a value. Macros that happen to expand to an empty string
should not be inherited.
Modified Paths:
--------------
trunk/bibdesk/BDSKComplexString.h
trunk/bibdesk/BDSKComplexString.m
trunk/bibdesk/BibItem.m
Modified: trunk/bibdesk/BDSKComplexString.h
===================================================================
--- trunk/bibdesk/BDSKComplexString.h 2007-12-12 14:17:12 UTC (rev 11881)
+++ trunk/bibdesk/BDSKComplexString.h 2007-12-12 18:15:08 UTC (rev 11882)
@@ -78,6 +78,8 @@
@interface NSString (BDSKComplexStringExtensions)
++ (BOOL)isEmptyAsComplexString:(NSString *)aString;
+
/*!
@method stringWithNodes:macroResolver:
@abstract Returns a newly allocated and initialized complex string build
with an array of BDSKStringNodes as its nodes.
Modified: trunk/bibdesk/BDSKComplexString.m
===================================================================
--- trunk/bibdesk/BDSKComplexString.m 2007-12-12 14:17:12 UTC (rev 11881)
+++ trunk/bibdesk/BDSKComplexString.m 2007-12-12 18:15:08 UTC (rev 11882)
@@ -688,6 +688,10 @@
return nodes;
}
++ (BOOL)isEmptyAsComplexString:(NSString *)aString{
+ return aString == nil || [aString isEqualAsComplexString:@""];
+}
+
- (BOOL)isEqualAsComplexString:(NSString *)other{
// we can assume that we are not complex, as BDSKComplexString
overrides this
if ([other isComplex])
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2007-12-12 14:17:12 UTC (rev 11881)
+++ trunk/bibdesk/BibItem.m 2007-12-12 18:15:08 UTC (rev 11882)
@@ -1184,11 +1184,11 @@
- (NSString *)valueOfField: (NSString *)key inherit: (BOOL)inherit{
NSString* value = [pubFields objectForKey:key];
- if (inherit && BDIsEmptyString((CFStringRef)value) &&
[fieldsToWriteIfEmpty containsObject:key] == NO) {
+ if (inherit && [NSString isEmptyAsComplexString:value] &&
[fieldsToWriteIfEmpty containsObject:key] == NO) {
BibItem *parent = [self crossrefParent];
if (parent) {
NSString *parentValue = [parent valueOfField:key
inherit:NO];
- if (BDIsEmptyString((CFStringRef)parentValue) == FALSE)
+ if ([NSString isEmptyAsComplexString:parentValue] == NO)
return [NSString
stringWithInheritedValue:parentValue];
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit