GBCommentsProcessor Class Reference
Inherits from | NSObject |
Declared in | GBCommentsProcessor.h GBCommentsProcessor.m |
Overview
Implements comments processing.
The main responsibility of this class is to process comments. As it's a helper class for GBProcessor
, it's processing is driven by the processor, so there's no need to create instances elsewhere.
Tasks
Initialization & disposal
-
+ processorWithSettingsProvider:
Returns autoreleased processor to work with the givenGBApplicationSettingsProvider
implementor. -
– initWithSettingsProvider:
Initializes the processor to work with the givenGBApplicationSettingsProvider
implementor.
Processing handling
-
– processComment:withContext:store:
Processes the givenGBComment
using the given context and store. -
– processComment:withStore:
Processes the givenGBComment
using the given store.
Class Methods
processorWithSettingsProvider:
Returns autoreleased processor to work with the given GBApplicationSettingsProvider
implementor.
+ (id)processorWithSettingsProvider:(id)settingsProvider
Parameters
- settingsProvider
- Application-wide settings provider to use for checking parameters.
Return Value
Returns initialized instance or nil
if initialization fails.
Discussion
This is the designated initializer.
Exceptions
- NSException
- Thrown if the given application is
nil
.
Declared In
GBCommentsProcessor.h
Instance Methods
initWithSettingsProvider:
Initializes the processor to work with the given GBApplicationSettingsProvider
implementor.
- (id)initWithSettingsProvider:(id)settingsProvider
Parameters
- settingsProvider
- Application-wide settings provider to use for checking parameters.
Return Value
Returns initialized instance or nil
if initialization fails.
Discussion
This is the designated initializer.
Exceptions
- NSException
- Thrown if the given application is
nil
.
Declared In
GBCommentsProcessor.h
processComment:withContext:store:
Processes the given GBComment
using the given context and store.
- (void)processComment:(GBComment *)comment withContext:(id<GBObjectDataProviding>)context store:(id)store
Parameters
- comment
- The comment to process.
- context
- The
GBObjectDataProviding
identifying current context for handling links ornil
.
- store
- The store to process against.
Discussion
This method processes the given comment's string value and prepares all derives values. It uses the given store for dependent values such as links and similar, so make sure the store has all possible objects already registered. In order to properly handle "local" links, the method also takes context
parameter which identifies top-level object to which the object which's comment we're processing belongs to. You can pass nil
however this prevents any local links being processed!
Exceptions
- NSException
- Thrown if any of the given parameters is invalid or processing encounters unexpected error.
See Also
Declared In
GBCommentsProcessor.h
processComment:withStore:
Processes the given GBComment
using the given store.
- (void)processComment:(GBComment *)comment withStore:(id)store
Parameters
- comment
- The comment to process.
- store
- The store to process against.
Discussion
This method processes the given comment's string value and prepares all derives values. It uses the given store for dependent values such as links and similar, so make sure the store has all possible objects already registered. Sending this message has the same effect as sending processComment:withContext:store:
to receiver and passing nil
for context.
Important: This method is provided for simpler unit testing and should not be used by the application. The most important reason for keeping it, is the fact that we introduced context handling when implementing links at which time we already had many unit tests relying on this method. So the easiest way for not being forced to refactor all these tests was to keep the method. It doesn't bloat the class interface either...
Exceptions
- NSException
- Thrown if any of the given parameters is invalid or processing encounters unexpected error.
See Also
Declared In
GBCommentsProcessor.h