本文整理汇总了C++中DBObjRecord::ListPos方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjRecord::ListPos方法的具体用法?C++ DBObjRecord::ListPos怎么用?C++ DBObjRecord::ListPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjRecord
的用法示例。
在下文中一共展示了DBObjRecord::ListPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
//.........这里部分代码省略.........
case DBTypeGridDiscrete:
{
DBInt value;
char nameStr [DBStringLength];
DBObjRecord *symRec = (data->Table (DBrNSymbols))->Add ("Default Symbol");
DBObjRecord *itemRec;
DBObjTableField *gridValueFLD = itemTable->Field (DBrNGridValue);
DBObjTableField *gridSymbolFLD = itemTable->Field (DBrNSymbol);
DBObjTableField *symbolIDFLD = (data->Table (DBrNSymbols))->Field (DBrNSymbolID);
DBObjTableField *foregroundFLD = (data->Table (DBrNSymbols))->Field (DBrNForeground);
DBObjTableField *backgroundFLD = (data->Table (DBrNSymbols))->Field (DBrNBackground);
DBObjTableField *styleFLD = (data->Table (DBrNSymbols))->Field (DBrNStyle);
symbolIDFLD->Int (symRec,0);
foregroundFLD->Int (symRec,1);
backgroundFLD->Int (symRec,0);
styleFLD->Int (symRec,0);
for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
{
for (i = 0;i < ColNum () * RowNum ();++i)
{
switch (valueType)
{
case DBTableFieldFloat: value = (DBInt) rint (*((float *) ((char *) dataRec->Data () + i * valueSize))); break;
case DBTableFieldInt:
switch (valueSize)
{
case sizeof (DBByte): value = (DBInt) (*((DBByte *) ((char *) dataRec->Data () + i * valueSize))); break;
case sizeof (DBShort): value = (DBInt) (*((DBShort *) ((char *) dataRec->Data () + i * valueSize))); break;
case sizeof (DBInt): value = (DBInt) (*((DBInt *) ((char *) dataRec->Data () + i * valueSize))); break;
default: CMmsgPrint (CMmsgAppError, "Wrong Data Size in: %s %d",__FILE__,__LINE__); return (DBFault);
}
break;
default: CMmsgPrint (CMmsgAppError, "Wrong Data Type in: %s %d",__FILE__,__LINE__); return (DBFault);
}
sprintf (nameStr,"Category%04d",value);
if ((itemRec = itemTable->Item (nameStr)) == (DBObjRecord *) NULL)
{
if ((itemRec = itemTable->Add (nameStr)) == (DBObjRecord *) NULL)
{ CMmsgPrint (CMmsgAppError, "Item Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
gridValueFLD->Int (itemRec,value);
gridSymbolFLD->Record (itemRec,symRec);
}
value = itemRec->RowID ();
switch (valueSize)
{
case sizeof (DBByte): *((DBByte *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
case sizeof (DBShort): *((DBShort *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
case sizeof (DBInt): *((DBInt *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
default: CMmsgPrint (CMmsgAppError, "Wrong Data Size in: %s %d",__FILE__,__LINE__); return (DBFault);
}
}
}
itemTable->ListSort (gridValueFLD);
for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
{
for (i = 0;i < ColNum () * RowNum ();++i)
{
switch (valueSize)
{
case sizeof (DBByte): value = (DBInt) (*((DBByte *) ((char *) dataRec->Data () + i * valueSize))); break;
case sizeof (DBShort): value = (DBInt) (*((DBShort *) ((char *) dataRec->Data () + i * valueSize))); break;
case sizeof (DBInt): value = (DBInt) (*((DBInt *) ((char *) dataRec->Data () + i * valueSize))); break;
default: CMmsgPrint (CMmsgAppError, "Wrong Data Size in: %s %d",__FILE__,__LINE__); return (DBFault);
}
itemRec = itemTable->Item (value);
value = itemRec->ListPos ();
switch (valueSize)
{
case sizeof (DBByte): *((DBByte *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
case sizeof (DBShort): *((DBShort *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
case sizeof (DBInt): *((DBInt *) ((char *) dataRec->Data () + i * valueSize)) = value; break;
default: CMmsgPrint (CMmsgAppError, "Wrong Data Size in: %s %d",__FILE__,__LINE__); return (DBFault);
}
}
}
itemTable->ItemSort ();
gridIF = new DBGridIF (data);
gridIF->DiscreteStats ();
delete gridIF;
} break;
case DBTypeGridContinuous:
{
DBObjTableField *missingValueFLD = itemTable->Field (DBrNMissingValue);
for (dataRec = (data->Arrays ())->First ();dataRec != (DBObjRecord *) NULL;dataRec = (data->Arrays ())->Next ())
{
itemTable->Add (dataRec->Name ());
missingValueFLD->Float (itemTable->Item (),MissingValue ());
}
gridIF = new DBGridIF (data);
gridIF->RecalcStats ();
delete gridIF;
data->Flags (DBDataFlagDispModeContBlueRed,DBSet);
break;
}
default: break;
}
return (DBSuccess);
}