Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /XspfManager/XspfMRuleRowTemplate.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 348 - (hide annotations) (download)
Sun May 9 01:25:25 2010 UTC (13 years, 11 months ago) by masakih
File size: 1662 byte(s)
XspfMRule関連をごっそり変更。
1 masakih 348 //
2     // XspfMRuleRowTemplate.m
3     //
4     // Created by Hori,Masaki on 10/05/04.
5     // Copyright 2010 masakih. All rights reserved.
6     //
7    
8     #import "XspfMRuleRowTemplate.h"
9    
10     #import "XspfMRule.h"
11    
12     @implementation XspfMRuleRowTemplate
13     + (id)rowTemplateWithPath:(NSString *)path
14     {
15     return [[[self alloc] initWithPath:path] autorelease];
16     }
17     - (id)initWithPath:(NSString *)path
18     {
19     [super init];
20    
21     NSArray *rowsTemplate = [NSArray arrayWithContentsOfFile:path];
22     if(!rowsTemplate) {
23     exit(12345);
24     }
25    
26     NSMutableDictionary *result = [NSMutableDictionary dictionary];
27     for(id row in rowsTemplate) {
28     id name = [row valueForKey:@"name"];
29     id rule = [XspfMRule ruleWithPlist:row];
30     [result setObject:rule forKey:name];
31     }
32     rowTemplate = [result retain];
33    
34     return self;
35     }
36    
37     + (NSString *)templateKeyForLeftKeyPath:(NSString *)leftKeypath
38     {
39     NSString *key = nil;
40     if([XspfMRule isStringKeyPath:leftKeypath]) {
41     key = @"String";
42     } else if([XspfMRule isNumberKeyPath:leftKeypath]) {
43     key = @"Number";
44     } else if([XspfMRule isDateKeyPath:leftKeypath]) {
45     key = @"AbDate";
46     } else if([XspfMRule isRateKeyPath:leftKeypath]) {
47     key = @"Rate";
48     } else if([XspfMRule isLabelKeyPath:leftKeypath]) {
49     key = @"Label";
50     }
51    
52     return key;
53     }
54     - (NSString *)templateKeyForLeftKeyPath:(NSString *)leftKeypath
55     {
56     return [[self class] templateKeyForLeftKeyPath:leftKeypath];
57     }
58     - (id)criteriaForKeyPath:(NSString *)keyPath
59     {
60     NSString *key = [self templateKeyForLeftKeyPath:keyPath];
61     if(key) {
62     id row = [rowTemplate valueForKey:key];
63     id c = [[[row childAtIndex:0] copy] autorelease];
64     if(!c) return nil;
65     [c setValue:keyPath];
66     return [NSArray arrayWithObject:c];
67     }
68    
69     return nil;
70     }
71     @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26