PageRenderTime 30ms CodeModel.GetById 21ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/JMRMapping.h

http://rtm2cocoa.googlecode.com/
C++ Header | 128 lines | 89 code | 28 blank | 11 comment | 0 complexity | a47317bf170b0f6c0990970c8bf69e45 MD5 | raw file
  1//
  2//  JMRMapping.h
  3
  4/*
  5
  6This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
  7
  8*/
  9
 10#import <Foundation/Foundation.h>
 11#import "JMRScalarMappingType.h"
 12#import "JMRConstantMappingType.h"
 13
 14@class JMRObjectMapping;
 15@class JMRSwitchMappingType;
 16
 17@interface JMRMapping : NSObject {
 18    // delimiters: / for path, @ for attribute
 19    NSString *_xmlPath;
 20    NSString *_objectPath;
 21
 22    BOOL _isList;
 23
 24    JMRScalarMappingType *_scalarType;
 25    
 26    // if isObject
 27    JMRObjectMapping *_objectMapping;
 28}
 29
 30-(id)scalarValue:(NSString *)value;
 31-(NSString *)stringForValue:(id)object;
 32-(void)assignValue:(id)value toObject:(id)object;
 33-(BOOL)isConstant;
 34-(BOOL)isScalar;
 35-(BOOL)isSwitch;
 36-(BOOL)isObject;
 37-(BOOL)isList;
 38
 39// initializers
 40-(id)initWithXmlPath:(NSString *)xmlPath objectPath:(NSString *)objectPath;
 41
 42-(id)initWithXmlPath:(NSString *)xmlPath
 43          objectPath:(NSString *)objectPath
 44           formatter:(NSFormatter *)formatter;
 45
 46-(id)initWithXmlPath:(NSString *)xmlPath
 47          objectPath:(NSString *)objectPath
 48              format:(NSString *)format;
 49
 50-(id)initWithXmlPath:(NSString *)xmlPath
 51          objectPath:(NSString *)objectPath
 52           formatter:(NSFormatter *)formatter
 53        defaultString:(NSString *)defaultString;
 54
 55-(id)initWithXmlPath:(NSString *)xmlPath
 56       constantValue:(NSString *)constantValue;
 57
 58-(id)initWithXmlPath:(NSString *)xmlPath
 59          objectPath:(NSString *)objectPath
 60       objectMapping:(JMRObjectMapping *)objectMapping;
 61
 62-(id)initWithXmlPath:(NSString *)xmlPath
 63          objectPath:(NSString *)objectPath
 64         mappingType:(JMRMappingType *)mappingType;
 65// accessors
 66
 67-(JMRScalarMappingType *)defaultScalarType;
 68-(JMRScalarMappingType *)scalarType;
 69-(void)setScalarType:(JMRScalarMappingType *)value;
 70
 71-(JMRMappingType *)mappingType;
 72-(void)setMappingType:(JMRMappingType *)value;
 73
 74-(NSString *)xmlPath;
 75-(void)setXmlPath:(NSString *)value;
 76-(NSString *)objectPath;
 77-(void)setObjectPath:(NSString *)value;
 78-(JMRObjectMapping *)objectMapping;
 79-(void)setObjectMapping:(JMRObjectMapping *)value;
 80-(NSString *)defaultString;
 81-(void)setDefaultString:(NSString *)value;
 82-(NSFormatter *)formatter;
 83-(void)setFormatter:(NSFormatter *)value;
 84-(BOOL)isList;
 85-(void)setIsList:(BOOL)value;
 86-(JMRObjectMapping *)objectMapping;
 87-(void)setObjectMapping:(JMRObjectMapping *)value;
 88-(void)setFormat:(NSString *)value;
 89-(void)dealloc;
 90
 91+(void)setDefaultFormatter:(NSFormatter *)formatter;
 92
 93+(JMRMapping *)mappingWithXmlPath:(NSString *)xmlPath
 94                       objectPath:(NSString *)objectPath;
 95    
 96+(JMRMapping *)mappingWithXmlPath:(NSString *)xmlPath
 97                       objectPath:(NSString *)objectPath
 98                        formatter:(NSFormatter *)formatter;
 99
100+(JMRMapping *)listMappingWithXmlPath:(NSString *)xmlPath
101                           objectPath:(NSString *)objectPath
102                            formatter:(NSFormatter *)formatter;
103
104+(JMRMapping *)mappingWithXmlPath:(NSString *)xmlPath
105                       objectPath:(NSString *)objectPath
106                        formatter:(NSFormatter *)formatter
107                    defaultString:(NSString *)defaultString;
108
109+(JMRMapping *)listMappingWithXmlPath:(NSString *)xmlPath
110                           objectPath:(NSString *)objectPath
111                            formatter:(NSFormatter *)formatter
112                        defaultString:(NSString *)defaultString;
113
114+(JMRMapping *)constantMappingWithXmlPath:(NSString *)xmlPath
115                                    value:(NSString *)value;
116
117+(JMRMapping *)mappingWithXmlPath:(NSString *)xmlPath
118                       objectPath:(NSString *)objectPath
119                    objectMapping:(JMRObjectMapping *)objectMapping;
120
121+(JMRMapping *)listMappingWithXmlPath:(NSString *)xmlPath
122                           objectPath:(NSString *)objectPath
123                        objectMapping:(JMRObjectMapping *)objectMapping;
124
125+(JMRMapping *)mappingWithXmlPath:(NSString *)xmlPath
126                       objectPath:(NSString *)objectPath
127                      mappingType:(JMRMappingType *)mappingType;
128@end