DSCodeParser Class
The DSCodeParser class enable users to configure the code parser settings or parse the content.
Definition
Assembly: DynamsoftCaptureVisionBundle.xcframework
- Objective-C
- Swift
@interface DSCodeParser : NSObjectclass CodeParser : NSObject
Method Summary
| Method | Description |
|---|---|
init |
The constructor. |
initSettingsFromFile |
Initialize runtime settings with the settings in a given JSON file. |
initSettings |
Initialize runtime settings with the settings in a given JSON string. |
parse |
Parses code data for readable results. |
resetSettings |
Reset runtime settings to default. |
Method Detail
init
Default constructor of a CodeParser object.
- Objective-C
- Swift
- (instancetype)init;init()
InitSettingsFromFile
Initialize settings from a given file.
- Objective-C
- Swift
- (BOOL)initSettingsFromFile:(NSString *)filePath error:(NSError * _Nullable * _Nullable)error;func initSettingsFromFile(_ filePath:String) throws -> BOOL
Parameters
filePath: The path of the settings file.
InitSettings
Initialize settings from a given string.
- Objective-C
- Swift
- (BOOL)initSettings:(NSString *)content error:(NSError * _Nullable * _Nullable)error;func initSettings(_ content:String) throws -> BOOL
Parameters
content: A JSON string that represents the content of the settings.
Parse
Parses code data for human-readable results.
- Objective-C
- Swift
- (nullable DSParsedResultItem *)parse:(NSData *)bytes taskSettingName:(NSString *)taskSettingName error:(NSError * _Nullable * _Nullable)error;func parse(_ bytes:Data, taskSettingName:String) throws -> ParsedResultItem
Parameters
bytes The array of bytes which contain the code string.
taskSettingNameOptional The name of CodeParserTaskSetting which defines the settings used for code parsing.
Return Value
Returns ParsedResultItem which stores the human-readable results.
ResetSettings
Reset all parameters to default values.
- Objective-C
- Swift
- (void)resetSettings;func resetSettings()