Inherits NSObject.
Instance Methods | |
(nullable SBSParserResult *) | - parseString:error: |
(nullable SBSParserResult *) | - parseRawData:error: |
(BOOL) | - setOptions:error: |
Detailed Description
Defines the interface for a data string parser. Parsers are capable of parsing one particular data format, which is passed to them during construction.
The parser is created through parserForFormat:error: (SBSBarcodePicker). Note that you need to have a valid license to use the parser feature.
For documentation on the available formats, go to the official parser library documentation.
- Since
- 5.6
Method Documentation
- (nullable SBSParserResult *) parseString: | (nonnull NSString *) | string | |
error: | (NSError *_Nullable *_Nullable) | outError | |
Parses the data string and returns the contained fields in the result object. In case the result could not be parsed, the error message is accessible as part of the outError parameter.
- Parameters
-
string The string to parse. Must not be nil. outError Upon failure will be set to an instance of NSError containing details on why the data could not be parsed. Can be nil.
- Returns
- The result object. Before accessing the fields of the result, you must ensure that the string was correctly parsed, that is, outError has not been set.
- Since
- 5.6
- (nullable SBSParserResult *) parseRawData: | (nonnull NSData *) | data | |
error: | (NSError *_Nullable *_Nullable) | outError | |
Parses the raw data and returns the contained fields in the result object. In case the result could not be parsed, the error message is accessible as part of the outError parameter.
Use this variant for binary formats that can't safely be represented as unicode code points.
- Parameters
-
data The data to parse. Must not be nil. outError Upon failure will be set to an instance of NSError containing details on why the data could not be parsed. Can be nil.
- Returns
- The result object. Before accessing the fields of the result, you must ensure that the string was correctly parsed, that is, outError has not been set.
- Since
- 5.6
- (BOOL) setOptions: | (nonnull NSDictionary *) | opts | |
error: | (NSError *_Nullable *_Nullable) | outError | |
Apply the option map to the parser, allowing the user to fine-tune the behavior of the parser.
Available options depend on the data format and are specified in the respective documentation. If the case that the options object is invalid and the operation fails, the error message is accessible as part of the outError parameter.
- Parameters
-
opts The options dictionary. Must not be nil. outError Upon failure will be set to an instance of NSError containing details on why the operation failed. Can be nil.
- Since
- 5.6
The documentation for this class was generated from the following file: