SIStepMapping Class Reference
| Inherits from | NSObject |
| Declared in | SIStepMapping.h |
Overview
Used to store a cross reference between a step mapping method and the class that contains it. The mapping is tested by using a regular expression. If the text of a step is matched by this regular expression, then the SIStepMapping instance is mapped to the step. Any given SIStep can only map to a single SIStepMapping. but a SIStepMapping instance can execute with data from any number of steps from any number of stories. This provides a way to centralise the code across multiple stories.
Tasks
Properties
-
regexThe regular expression object used to test each mapping.
property -
selectorI the SIStepMapping matches via the regex, this is the selector that will be executed.
property -
targetClassThis is the target class that contains the selector to be executed. This class will be instantiated just once for each story that is executed.
property -
mappedIndicates whether the mapping was mapped.
property
Initialisers
-
+ stepMappingWithClass:selector:regex:error:Factory method for creating an instance of the mapping.
Tasks
-
– canMapToStep:Checks whether this instance can be applied to the passed SIStep. This executes the regular expression against the step and return whether it matched. If a match is made then the mapped property is set to indicate that the step mapping was mapped.
-
– invokeWithCommand:object:error:Called by the SIStep to invoke the implementaton that is mapped to the step.
-
– resetReturns
YESif the step has been mapping during the findMappingInList: method.
Properties
mapped
Indicates whether the mapping was mapped.
@property (nonatomic, assign) BOOL mappedDiscussion
Indicates whether the mapping was mapped.
Declared In
SIStepMapping.hregex
The regular expression object used to test each mapping.
@property (nonatomic, retain) NSRegularExpression *regexDiscussion
The regular expression object used to test each mapping.
Declared In
SIStepMapping.hselector
I the SIStepMapping matches via the regex, this is the selector that will be executed.
@property (nonatomic, assign) SEL selectorDiscussion
I the SIStepMapping matches via the regex, this is the selector that will be executed.
Declared In
SIStepMapping.htargetClass
This is the target class that contains the selector to be executed. This class will be instantiated just once for each story that is executed.
@property (nonatomic, assign) Class targetClassDiscussion
This is the target class that contains the selector to be executed. This class will be instantiated just once for each story that is executed.
Declared In
SIStepMapping.hClass Methods
stepMappingWithClass:selector:regex:error:
Factory method for creating an instance of the mapping.
+ (SIStepMapping *)stepMappingWithClass:(Class)theClass selector:(SEL)aSelector regex:(NSString *)theRegex error:(NSError **)errorParameters
- theClass
the class that the mapping applies to.
- aSelector
the selector to be executed.
- theRegex
the regular expression used to match the text from a step.
- error
a pointer to a reference to an NSError. This is populated if there is an error.
Return Value
the newly created, autoreleased instance.
Discussion
Factory method for creating an instance of the mapping.
Declared In
SIStepMapping.hInstance Methods
canMapToStep:
Checks whether this instance can be applied to the passed SIStep. This executes the regular expression against the step and return whether it matched. If a match is made then the mapped property is set to indicate that the step mapping was mapped.
- (BOOL)canMapToStep:(NSString *)stepParameters
- step
the step to check.
Return Value
YES if the regular expression matches. NO otherwise.
Discussion
Checks whether this instance can be applied to the passed SIStep. This executes the regular expression against the step and return whether it matched. If a match is made then the mapped property is set to indicate that the step mapping was mapped.
Declared In
SIStepMapping.hinvokeWithCommand:object:error:
- (BOOL)invokeWithCommand:(NSString *)command object:(id)object error:(NSError **)errorParameters
- command
the text line from the story.
- object
the instantiated targetClass which contains the implementation code.
- error
a pointer to a reference to an NSError. This is populated if there is an error.
Return Value
YES if the invokation was successful. NO otherwise.
Declared In
SIStepMapping.h