Resource Base
Table of contents
Notice: This documentation is archived. For the latest product features and documentation, please visit Dynamsoft Capture Vision Documentation.

CCodeParser Class

Method Description
CCodeParser Default constructor of CCodeParser object.
~CCodeParser Destructor of CCodeParser object.
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.

CCodeParser

Default constructor of a CCodeParser object.

dynamsoft::dcp::CCodeParser::CCodeParser()

~CCodeParser

Destructor of a CCodeParser object.

dynamsoft::dcp::CCodeParser::~CCodeParser()

Parse

Parses code data for human-readable results.

CParsedResultItem* dynamsoft::dcp::CCodeParser::Parse(const unsigned char* pData, int length, const char* taskSettingName="", int* errorCode = NULL)

Parameters

[in] pData The array of bytes which contain the code string.

[in] length The length of the code string bytes.

[in] taskSettingNameOptional The name of CodeParserTaskSetting which defines the settings used for code parsing.

[in,out] errorCodeOptional The error code.

Return Value

Returns CParsedResultItem which stores the human-readable results.

Code Snippet

char errorBuf[512];
dynamsoft::dcp::CCodeParser::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CCodeParser* dcp = new CCodeParser();
//get code string data (pData, length) somewhere else
CParsedResultItem* dcpResult = dcp->Parse(pData, length);
cout << "CodeType: " << dcpResult->GetCodeType() << endl;
delete dcpResult;
delete dcp;

ResetSettings

Reset all parameters to default values.

int dynamsoft::dcp::CCodeParser::ResetSettings()

Return Value

Returns error code.

Code Snippet

char errorBuf[512];
dynamsoft::dcp::CCodeParser::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CCodeParser* dcp = new CCodeParser();
dcp->ResetSettings();
dcp->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", errorBuf, 512);
// Do something with dcp object
delete dcp;

InitSettingsFromFile

Initialize settings from a given file.

int dynamsoft::dcp::CCodeParser::InitSettingsFromFile(const char* filePath, char errorMsgBuffer[] = NULL, int errorMsgBufferLen = 0)

Parameters

[in] filePath The path of the settings file.

[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 512. The error message will be copied to the buffer.

[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value

Returns error code.

Code Snippet

char errorBuf[512];
dynamsoft::dcp::CCodeParser::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CCodeParser* dcp = new CCodeParser();
dcp->ResetSettings();
dcp->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", errorBuf, 512);
// Do something with dcp object
delete dcp;

InitSettings

Initialize settings from a given string.

int dynamsoft::dcp::CCodeParser::InitSettings (const char* content, char errorMsgBuffer[] = NULL, int errorMsgBufferLen = 0)

Parameters

[in] content A JSON string that represents the content of the settings.

[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 512. The error message will be copied to the buffer.

[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value

Returns error code.

Code Snippet

char errorBuf[512];
dynamsoft::dcp::CCodeParser::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CCodeParser* dcp = new CCodeParser();
dcp->ResetSettings();
dcp->InitSettings("YOUR-SETTING-STRING", errorBuf, 512);
// Do something with dcp object
delete dcp;

See Also

Parameter Organization when Using Dynamsoft Code Parser Independently

Is this page helpful?

YesYes NoNo

In this article:

Version 2.4.10

    • version 2.4.10
    • Version 2.x
      • Version 2.2.10
      • Version 2.2.0
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.0.0
    Change +