Working with Properties
The interfaces of ABBYY FlexiCapture SDK objects have various properties and methods. As Visual Basic users are familiar with the notion of property, we will discuss the way the properties are handled in C++.
For a C++ user, a property is a couple of methods (get and put for read-write properties) or a single get method (for read-only properties). However, the "Native COM support" featured by Microsoft Visual C++ makes the way the properties are handled more like the one used in Visual Basic. This is the way implied by the sense on the noun "property."
The ABBYY FlexiCapture SDK properties may be of the following types:
IDL | Visual Basic type | C++ type | C# |
VARIANT_BOOL (VARIANT_TRUE or VARIANT_FALSE) | Boolean (with two values, True and False) | VARIANT_BOOL (with two values VARIANT_TRUE and VARIANT_FALSE) | bool (true or false) |
int | Integer | int | int |
double | Double | double | int |
BSTR, a pointer to Unicode string. Zero value specifies an empty string. | String | BSTR, a pointer to Unicode string. Zero value specifies an empty string. | string |
__int64 | Int64 | __int64 | Int64 |
HANDLE* | |||
IUnknown-derived interface | Object | IUnknown-derived interface | object |
enum | Enumeration | Enumeration | enum |
See the details of working with different types of properties below:
Working with simple properties
Working with string properties
Working with object properties
Working with read-only object properties
Certain ABBYY FlexiCapture SDK objects have read-only object properties. This does not mean that such properties cannot be changed, this only means that they cannot be changed directly. In raw C++, if you want to change such a property, you need to pass a reference to the property object to a new variable, and then use this variable to change it. Below you can see a C++ sample for the IProject::Batches property which is represented by a read-only collection:
IProject* pProject = 0; IBatches* pBatches = 0; IBatch* pBatch = 0; ... // The pBatches variable receives a reference to the batches collection from the Project pProject->get_Batches( &pBatches ); // Add one more element to the batches collection pBatches->AddNew( L"BatchName", &pBatch ); ...
See also
15.08.2023 13:19:30