Revision: 18195
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18195&view=rev
Author: hofman
Date: 2011-10-28 11:23:59 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
use array kvc methods for subtemplates
Modified Paths:
--------------
trunk/bibdesk/BDSKTemplateDocument.m
trunk/bibdesk/BDSKTemplateParser.m
trunk/bibdesk/BDSKTemplateTag.h
trunk/bibdesk/BDSKTemplateTag.m
Modified: trunk/bibdesk/BDSKTemplateDocument.m
===================================================================
--- trunk/bibdesk/BDSKTemplateDocument.m 2011-10-28 06:34:01 UTC (rev
18194)
+++ trunk/bibdesk/BDSKTemplateDocument.m 2011-10-28 11:23:59 UTC (rev
18195)
@@ -1356,12 +1356,12 @@
}
- (id)tokenForConditionTag:(BDSKConditionTemplateTag *)tag defaultFont:(NSFont
*)defaultFont {
- NSInteger count = [[tag subtemplates] count];
+ NSInteger count = [tag countOfSubtemplates];
if ([(BDSKConditionTemplateTag *)tag matchType] !=
BDSKTemplateTagMatchOther || count > 2)
return nil;
- NSArray *nonemptyTemplate = [tag subtemplateAtIndex:0];
- NSArray *emptyTemplate = count > 1 ? [tag subtemplateAtIndex:1] : nil;
+ NSArray *nonemptyTemplate = [tag objectInSubtemplatesAtIndex:0];
+ NSArray *emptyTemplate = count > 1 ? [tag objectInSubtemplatesAtIndex:1] :
nil;
id token = nil;
if ([nonemptyTemplate count] == 1 && [(BDSKTemplateTag *)[nonemptyTemplate
lastObject] type] == BDSKTextTemplateTagType) {
@@ -1448,10 +1448,10 @@
return nil;
NSArray *matchStrings = [(BDSKConditionTemplateTag *)tag matchStrings];
- NSUInteger i = 0, keyCount = [matchStrings count], count =
[[(BDSKConditionTemplateTag *)tag subtemplates] count];
+ NSUInteger i = 0, keyCount = [matchStrings count], count =
[(BDSKConditionTemplateTag *)tag countOfSubtemplates];
for (i = 0; i < count; i++) {
- if ((itemTemplate = [self
convertItemTemplate:[(BDSKConditionTemplateTag *)tag subtemplateAtIndex:i]
defaultFont:defaultFont]))
+ if ((itemTemplate = [self
convertItemTemplate:[(BDSKConditionTemplateTag *)tag
objectInSubtemplatesAtIndex:i] defaultFont:defaultFont]))
[result setObject:itemTemplate forKey:i < keyCount ?
[(NSString *)[matchStrings objectAtIndex:i] entryType] : @""];
else return nil;
}
Modified: trunk/bibdesk/BDSKTemplateParser.m
===================================================================
--- trunk/bibdesk/BDSKTemplateParser.m 2011-10-28 06:34:01 UTC (rev 18194)
+++ trunk/bibdesk/BDSKTemplateParser.m 2011-10-28 11:23:59 UTC (rev 18195)
@@ -483,12 +483,12 @@
if ([matchString hasPrefix:@"$"])
matchString = [templateValueForKeyPath(object,
[matchString substringFromIndex:1], anIndex) templateStringValue] ?: @"";
if (matchesCondition(keyValue, matchString, [tag
matchType])) {
- subtemplate = [tag subtemplateAtIndex:i];
+ subtemplate = [tag objectInSubtemplatesAtIndex:i];
break;
}
}
- if (subtemplate == nil && [[tag subtemplates] count] > count)
- subtemplate = [tag subtemplateAtIndex:count];
+ if (subtemplate == nil && [tag countOfSubtemplates] > count)
+ subtemplate = [tag objectInSubtemplatesAtIndex:count];
if (subtemplate != nil) {
if ((keyValue = [self stringFromTemplateArray:subtemplate
usingObject:object atIndex:anIndex delegate:delegate]))
[result appendString:keyValue];
@@ -787,12 +787,12 @@
if ([matchString hasPrefix:@"$"])
matchString = [templateValueForKeyPath(object,
[matchString substringFromIndex:1], anIndex) templateStringValue] ?: @"";
if (matchesCondition(keyValue, matchString, [tag
matchType])) {
- subtemplate = [tag subtemplateAtIndex:i];
+ subtemplate = [tag objectInSubtemplatesAtIndex:i];
break;
}
}
- if (subtemplate == nil && [[tag subtemplates] count] > count) {
- subtemplate = [tag subtemplateAtIndex:count];
+ if (subtemplate == nil && [tag countOfSubtemplates] > count) {
+ subtemplate = [tag objectInSubtemplatesAtIndex:count];
}
if (subtemplate != nil) {
NSAttributedString *tmpAttrStr = [self
attributedStringFromTemplateArray:subtemplate usingObject:object
atIndex:anIndex delegate:delegate];
Modified: trunk/bibdesk/BDSKTemplateTag.h
===================================================================
--- trunk/bibdesk/BDSKTemplateTag.h 2011-10-28 06:34:01 UTC (rev 18194)
+++ trunk/bibdesk/BDSKTemplateTag.h 2011-10-28 11:23:59 UTC (rev 18195)
@@ -134,8 +134,8 @@
- (BDSKTemplateTagMatchType)matchType;
- (NSArray *)matchStrings;
-- (NSArray *)subtemplates;
-- (NSArray *)subtemplateAtIndex:(NSUInteger)anIndex;
+- (NSUInteger)countOfSubtemplates;
+- (NSArray *)objectInSubtemplatesAtIndex:(NSUInteger)anIndex;
@end
Modified: trunk/bibdesk/BDSKTemplateTag.m
===================================================================
--- trunk/bibdesk/BDSKTemplateTag.m 2011-10-28 06:34:01 UTC (rev 18194)
+++ trunk/bibdesk/BDSKTemplateTag.m 2011-10-28 11:23:59 UTC (rev 18195)
@@ -233,15 +233,15 @@
return matchType;
}
-- (NSArray *)subtemplates {
- return subtemplates;
-}
-
- (NSArray *)matchStrings {
return matchStrings;
}
-- (NSArray *)subtemplateAtIndex:(NSUInteger)anIndex {
+- (NSUInteger)countOfSubtemplates {
+ return [subtemplates count];
+}
+
+- (NSArray *)objectInSubtemplatesAtIndex:(NSUInteger)anIndex {
id subtemplate = [subtemplates objectAtIndex:anIndex];
if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
subtemplate = [BDSKTemplateParser
arrayByParsingTemplateString:subtemplate isSubtemplate:YES];
@@ -256,7 +256,7 @@
@implementation BDSKRichConditionTemplateTag
-- (NSArray *)subtemplateAtIndex:(NSUInteger)anIndex {
+- (NSArray *)objectInSubtemplatesAtIndex:(NSUInteger)anIndex {
id subtemplate = [subtemplates objectAtIndex:anIndex];
if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
subtemplate = [BDSKTemplateParser
arrayByParsingTemplateAttributedString:subtemplate isSubtemplate:YES];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit