Revision: 7528
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7528&view=rev
Author:   hofman
Date:     2011-10-28 11:20:26 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
use array kvc methods for subtemplates

Modified Paths:
--------------
    trunk/SKTemplateParser.m
    trunk/SKTemplateTag.h
    trunk/SKTemplateTag.m

Modified: trunk/SKTemplateParser.m
===================================================================
--- trunk/SKTemplateParser.m    2011-10-28 11:15:55 UTC (rev 7527)
+++ trunk/SKTemplateParser.m    2011-10-28 11:20:26 UTC (rev 7528)
@@ -470,12 +470,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]))
                         [result appendString:keyValue];
@@ -729,12 +729,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 ((tmpAttrStr = [self 
attributedStringFromTemplateArray:subtemplate usingObject:object 
atIndex:anIndex]))
                         [result appendAttributedString:tmpAttrStr];

Modified: trunk/SKTemplateTag.h
===================================================================
--- trunk/SKTemplateTag.h       2011-10-28 11:15:55 UTC (rev 7527)
+++ trunk/SKTemplateTag.h       2011-10-28 11:20:26 UTC (rev 7528)
@@ -127,9 +127,9 @@
 
 @property (nonatomic, readonly) SKTemplateTagMatchType matchType;
 @property (nonatomic, readonly) NSArray *matchStrings;
-@property (nonatomic, readonly) NSArray *subtemplates;
 
-- (NSArray *)subtemplateAtIndex:(NSUInteger)index;
+- (NSUInteger)countOfSubtemplates;
+- (NSArray *)objectInSubtemplatesAtIndex:(NSUInteger)anIndex;
 
 @end
 

Modified: trunk/SKTemplateTag.m
===================================================================
--- trunk/SKTemplateTag.m       2011-10-28 11:15:55 UTC (rev 7527)
+++ trunk/SKTemplateTag.m       2011-10-28 11:20:26 UTC (rev 7528)
@@ -178,7 +178,7 @@
 
 @implementation SKConditionTemplateTag
 
-@synthesize matchType, matchStrings, subtemplates;
+@synthesize matchType, matchStrings;
 
 - (id)initWithKeyPath:(NSString *)aKeyPath 
matchType:(SKTemplateTagMatchType)aMatchType matchStrings:(NSArray 
*)aMatchStrings subtemplates:(NSArray *)aSubtemplates {
     self = [super initWithKeyPath:aKeyPath];
@@ -198,7 +198,11 @@
 
 - (SKTemplateTagType)type { return SKConditionTemplateTagType; }
 
-- (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 = [SKTemplateParser 
arrayByParsingTemplateString:subtemplate isSubtemplate:YES];
@@ -213,7 +217,7 @@
 
 @implementation SKRichConditionTemplateTag
 
-- (NSArray *)subtemplateAtIndex:(NSUInteger)anIndex {
+- (NSArray *)objectInSubtemplatesAtIndex:(NSUInteger)anIndex {
     id subtemplate = [subtemplates objectAtIndex:anIndex];
     if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
         subtemplate = [SKTemplateParser 
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
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to