DTwainRange::operator [ ]

Top  Previous  Next

Syntax

DTwainDoubleArray:

double operator [ ] (LONG n) const;

 

DTwainLongArray:

long operator [ ] (LONG n) const;

 

Parameters

n

Position within the range.

 

Return Value

If successful, returns the nth value defined by the range, where n ranges from 0 to DTwainRange::Count( ) - 1 (the maximum number of values defined for the range - 1)   If unsuccessful, either CDTwainSource::InvalidDouble is returned for the DTwainDoubleRange type, or CDTwainInterface::InvalidLong is returned for the DTwainLongRange type.

 

Comments

The overloaded [] operator is equivalent to DTwainRange::GetExpandedValue. For example if the DTwainRange has the following characteristics:

 

minimum = -10

Maximum Value = 10

Step size = 2

 

The expanded range will consist of the following values

-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10

 

The following program code describes the above example:

 

DTwainLongRange Range(-10, 10, 2, 0, 0);

LONG Value = Range[2]; // This will return -6, since it is in position 2 of the range