public method IO2GOffersTable.getCell

Brief

Gets the value of a cell.

Declaration
C++
virtual const void *  getCell (int row, int column) = 0

Parameters
row

The index of a row. The index must be between 0 and IO2GGenericTableResponseReader.size() - 1.

column

The index of a column. The index must be between 0 and IO2GTableColumnCollection.size() - 1.

Returns

Returns the cell value that can be of different types. To determine a type, it is necessary to get a column by using the IO2GGenericTableResponseReader.columns and the IO2GTableColumnCollection.get methods. The index passed to the latter method should be the same as the column parameter. The type of value is defined by using the IO2GTableColumn.getType method. The IO2GTableColumn::O2GTableColumnType enumerator returned by the above method contains the returned value type. A client application must cast void* data to the returned type and copy the value.
Column types and cast operations:

Column type

getCell value

IO2GTableColumn.Integer

The method returns a pointer to a 32-bit integer value on a 32-bit operation system or a 64 bit integer on a 64-bit system.
Cast operation: int value = *(int*)reader.getCell(columnIndex);

IO2GTableColumn.Double

The method returns a pointer to a 64-bit floating-point value.
Cast operation: double value = *(double*)reader.getCell(column);

IO2GTableColumn.Boolean

The method returns a pointer to a boolean value.
Cast operation: bool value = *(bool*)reader.getCell(column);

IO2GTableColumn.Date

The method returns a pointer to a 64-bit floating-point value.
Cast operation: double OLEdate= *(double*)reader.getCell(column);

The date is in the OLE Automation Date format. An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, December 30, 1899, and whose fractional component represents the time on that day divided by 24.

If it is not specified explicitly, all the date/time values are in the UTC time zone.

IO2GTableColumn.String

The method returns a pointer to a zero-terminated ASCII string.
Cast operation: std::string value = (const char*)reader.getCell(column);

Details

The method is used to work with an abstract table. The method provides common access to a row value independently of a row type (a table type).

Example

Prints rows by using a GenericTableResponseReader [hide]

    void printGenericTableInterface(IO2GGenericTableResponseReader *genericReader)
    {
    IO2GTableColumnCollection *columns = genericReader->columns();
 
    // Print table values
    for (int i = 0; i < genericReader->size(); i++)
    {
        std::ostringstream stream;
        int count = columns->size();
        for (int j = 0; j < count; j++)
        {
            const void* value = genericReader->getCell(i, j);
            std::string sIsValid = genericReader->isCellValid(i, j) ? "True" : "False";
            switch (column->getType())
            {
            case IO2GTableColumn::Integer:
            {
                int iValue = *(const int*)(value);
                stream << column->getID() << "=" << iValue << " Valid=" << sIsValid << " ";
            }
            break;
            case IO2GTableColumn::Double:
            {
                double dblValue = *(const double*)(value);
                stream << column->getID() << "=" << dblValue << " Valid=" << sIsValid << " ";
            }
            break;
            case IO2GTableColumn::Boolean:
            {
                bool bValue = *(const bool*)(value);
                const char* value = bValue ? "True" : "False";
                stream << column->getID() << "=" << value << " Valid=" << sIsValid << " ";
            }
            break;
            case IO2GTableColumn::Date:
            {
                DATE date = *(DATE*)(value);
                std::string sDate = dateToString(date);
                stream << column->getID() << "=" << sDate.c_str() << " Valid=" << sIsValid << " ";
            }
            break;
            case IO2GTableColumn::String:
            {
                const char* szValue = (const char*)value;
                stream << column->getID() << "=" << szValue << " Valid=" << sIsValid << " ";
            }
            break;
            }
            column->release();
        }
        row->release();!
        stream << std::ends;
        std::cout << stream.str().c_str();
    }
    columns->release();
 
}

Declared in IO2GGenericTableResponseReader

back