本文整理汇总了C++中DDFRecord::GetDataSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::GetDataSize方法的具体用法?C++ DDFRecord::GetDataSize怎么用?C++ DDFRecord::GetDataSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::GetDataSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int nArgc, char ** papszArgv )
{
DDFModule oModule;
const char *pszFilename = nullptr;
int bFSPTHack = FALSE;
for( int iArg = 1; iArg < nArgc; iArg++ )
{
if( EQUAL(papszArgv[iArg],"-fspt_repeating") )
bFSPTHack = TRUE;
else
pszFilename = papszArgv[iArg];
}
if( pszFilename == nullptr )
{
printf( "Usage: 8211view filename\n" );
exit( 1 );
}
/* -------------------------------------------------------------------- */
/* Open the file. Note that by default errors are reported to */
/* stderr, so we don't bother doing it ourselves. */
/* -------------------------------------------------------------------- */
if( !oModule.Open( pszFilename ) )
{
exit( 1 );
}
if( bFSPTHack )
{
DDFFieldDefn *poFSPT = oModule.FindFieldDefn( "FSPT" );
if( poFSPT == nullptr )
fprintf( stderr,
"unable to find FSPT field to set repeating flag.\n" );
else
poFSPT->SetRepeatingFlag( TRUE );
}
/* -------------------------------------------------------------------- */
/* Loop reading records till there are none left. */
/* -------------------------------------------------------------------- */
DDFRecord *poRecord = nullptr;
int iRecord = 0;
while( (poRecord = oModule.ReadRecord()) != nullptr )
{
printf( "Record %d (%d bytes)\n",
++iRecord, poRecord->GetDataSize() );
/* ------------------------------------------------------------ */
/* Loop over each field in this particular record. */
/* ------------------------------------------------------------ */
for( int iField = 0; iField < poRecord->GetFieldCount(); iField++ )
{
DDFField *poField = poRecord->GetField( iField );
ViewRecordField( poField );
}
}
}
示例2: main
//.........这里部分代码省略.........
printf("<DDFFieldDefn tag=\"%s\" fieldName=\"%s\""
" dataStructCode=\"%s\" dataTypeCode=\"%s\"",
poFieldDefn->GetName(),
poFieldDefn->GetDescription(),
pszDataStructCode,
pszDataTypeCode);
int nSubfieldCount = poFieldDefn->GetSubfieldCount();
if( bAllDetails || nSubfieldCount == 0 )
{
printf(" arrayDescr=\"%s\"", poFieldDefn->GetArrayDescr());
printf(" formatControls=\"%s\"", poFieldDefn->GetFormatControls());
}
printf(">\n");
for( int iSubField = 0; iSubField < nSubfieldCount; iSubField++ )
{
DDFSubfieldDefn* poSubFieldDefn = poFieldDefn->GetSubfield(iSubField);
printf(" <DDFSubfieldDefn name=\"%s\" format=\"%s\"/>\n",
poSubFieldDefn->GetName(), poSubFieldDefn->GetFormat());
}
printf("</DDFFieldDefn>\n");
}
// DDFRecord *poRecord;
for( DDFRecord *poRecord = oModule.ReadRecord();
poRecord != NULL;
poRecord = oModule.ReadRecord() )
{
printf("<DDFRecord");
if( bAllDetails )
{
if( poRecord->GetReuseHeader() )
printf(" reuseHeader=\"1\"");
printf(" dataSize=\"%d\"", poRecord->GetDataSize());
printf(" _sizeFieldTag=\"%d\"", poRecord->GetSizeFieldTag());
printf(" _sizeFieldPos=\"%d\"", poRecord->GetSizeFieldPos());
printf(" _sizeFieldLength=\"%d\"", poRecord->GetSizeFieldLength());
}
printf(">\n");
int nFieldCount = poRecord->GetFieldCount();
for( int iField = 0; iField < nFieldCount; iField++ )
{
DDFField* poField = poRecord->GetField(iField);
DDFFieldDefn* poDefn = poField->GetFieldDefn();
const char* pszFieldName = poDefn->GetName();
printf(" <DDFField name=\"%s\"", pszFieldName);
if( poField->GetRepeatCount() > 1 )
printf(" repeatCount=\"%d\"", poField->GetRepeatCount());
int iOffset = 0, nLoopCount;
int nRepeatCount = poField->GetRepeatCount();
const char* pachData = poField->GetData();
int nDataSize = poField->GetDataSize();
if( nRepeatCount == 1 && poDefn->GetSubfieldCount() == 0 )
{
printf(" value=\"0x");
for( int i = 0; i < nDataSize - 1; i++ )
printf( "%02X", pachData[i] );
printf("\">\n");
}
else
printf(">\n");
for( nLoopCount = 0; nLoopCount < nRepeatCount; nLoopCount++ )
{
for( int iSubField = 0; iSubField < poDefn->GetSubfieldCount(); iSubField++ )
{
int nBytesConsumed;