本文整理汇总了C++中DDFFieldDefn::SetRepeatingFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFFieldDefn::SetRepeatingFlag方法的具体用法?C++ DDFFieldDefn::SetRepeatingFlag怎么用?C++ DDFFieldDefn::SetRepeatingFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFFieldDefn
的用法示例。
在下文中一共展示了DDFFieldDefn::SetRepeatingFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int nArgc, char ** papszArgv )
{
DDFModule oModule;
const char *pszFilename = NULL;
int bFSPTHack = FALSE;
int bXML = FALSE;
/* -------------------------------------------------------------------- */
/* Check arguments. */
/* -------------------------------------------------------------------- */
for( int iArg = 1; iArg < nArgc; iArg++ )
{
if( EQUAL(papszArgv[iArg],"-fspt_repeating") )
bFSPTHack = TRUE;
else if( EQUAL(papszArgv[iArg],"-xml") )
bXML = TRUE;
else
pszFilename = papszArgv[iArg];
}
if( pszFilename == NULL )
{
printf( "Usage: 8211dump [-xml] [-fspt_repeating] filename\n" );
exit( 1 );
}
/* -------------------------------------------------------------------- */
/* Open file. */
/* -------------------------------------------------------------------- */
if( !oModule.Open( pszFilename ) )
exit( 1 );
/* -------------------------------------------------------------------- */
/* Apply FSPT hack if required. */
/* -------------------------------------------------------------------- */
if( bFSPTHack )
{
DDFFieldDefn *poFSPT = oModule.FindFieldDefn( "FSPT" );
if( poFSPT == NULL )
fprintf( stderr,
"unable to find FSPT field to set repeating flag.\n" );
else
poFSPT->SetRepeatingFlag( TRUE );
}
/* -------------------------------------------------------------------- */
/* Dump header, and all records. */
/* -------------------------------------------------------------------- */
DDFRecord *poRecord;
if( bXML )
{
printf("<DDFModule>\n");
int nFieldDefnCount = oModule.GetFieldCount();
for( int i = 0; i < nFieldDefnCount; i++ )
{
DDFFieldDefn* poFieldDefn = oModule.GetField(i);
const char* pszDataStructCode;
switch( poFieldDefn->GetDataStructCode() )
{
case dsc_elementary:
pszDataStructCode = "elementary";
break;
case dsc_vector:
pszDataStructCode = "vector";
break;
case dsc_array:
pszDataStructCode = "array";
break;
case dsc_concatenated:
pszDataStructCode = "concatenated";
break;
default:
pszDataStructCode = "(unknown)";
break;
}
const char* pszDataTypeCode;
switch( poFieldDefn->GetDataTypeCode() )
{
case dtc_char_string:
pszDataTypeCode = "char_string";
break;
case dtc_implicit_point:
pszDataTypeCode = "implicit_point";
break;
case dtc_explicit_point:
pszDataTypeCode = "explicit_point";
break;
case dtc_explicit_point_scaled:
pszDataTypeCode = "explicit_point_scaled";
//.........这里部分代码省略.........
示例2: 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 );
}
}
}