本文整理汇总了C++中DDFRecord::GetSizeFieldTag方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::GetSizeFieldTag方法的具体用法?C++ DDFRecord::GetSizeFieldTag怎么用?C++ DDFRecord::GetSizeFieldTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::GetSizeFieldTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int nArgc, char ** papszArgv )
{
DDFModule oModule;
const char *pszFilename = NULL;
int bFSPTHack = FALSE;
int bXML = FALSE;
bool bAllDetails = 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 if( EQUAL(papszArgv[iArg],"-xml_all_details") )
{
bXML = TRUE;
bAllDetails = true;
}
else
pszFilename = papszArgv[iArg];
}
if( pszFilename == NULL )
{
printf( "Usage: 8211dump [-xml|-xml_all_details] [-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. */
/* -------------------------------------------------------------------- */
if( bXML )
{
printf("<DDFModule");
if( bAllDetails )
{
printf(" _interchangeLevel=\"%c\"", oModule.GetInterchangeLevel());
printf(" _leaderIden=\"%c\"", oModule.GetLeaderIden());
printf(" _inlineCodeExtensionIndicator=\"%c\"", oModule.GetCodeExtensionIndicator());
printf(" _versionNumber=\"%c\"", oModule.GetVersionNumber());
printf(" _appIndicator=\"%c\"", oModule.GetAppIndicator());
printf(" _extendedCharSet=\"%s\"", oModule.GetExtendedCharSet());
printf(" _fieldControlLength=\"%d\"", oModule.GetFieldControlLength());
printf(" _sizeFieldLength=\"%d\"", oModule.GetSizeFieldLength());
printf(" _sizeFieldPos=\"%d\"", oModule.GetSizeFieldPos());
printf(" _sizeFieldTag=\"%d\"", oModule.GetSizeFieldTag());
}
printf(">\n");
int nFieldDefnCount = oModule.GetFieldCount();
for( int i = 0; i < nFieldDefnCount; i++ )
{
DDFFieldDefn* poFieldDefn = oModule.GetField(i);
const char* pszDataStructCode = NULL;
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;
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
{
if( psSubIter->eType == CXT_Element &&
strcmp(psSubIter->pszValue, "DDFSubfieldDefn") == 0 )
{
poFDefn->AddSubfield( CPLGetXMLValue(psSubIter, "name", ""),
CPLGetXMLValue(psSubIter, "format", "") );
}
psSubIter = psSubIter->psNext;
}
pszFormatControls = CPLGetXMLValue(psIter, "formatControls", NULL);
if( pszFormatControls )
poFDefn->SetFormatControls(pszFormatControls);
oModule.AddField( poFDefn );
}
else if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "DDFRecord") == 0 )
{
//const bool bFirstRecord = !bCreated;
if( !bCreated )
{
oModule.Create( pszOutFilename );
bCreated = TRUE;
}
DDFRecord *poRec = new DDFRecord( &oModule );
std::map<std::string, int> oMapField;
//if( !bFirstRecord )
// poRec->SetReuseHeader(atoi(CPLGetXMLValue(psIter, "reuseHeader", CPLSPrintf("%d", poRec->GetReuseHeader()))));
poRec->SetSizeFieldLength(atoi(CPLGetXMLValue(psIter, "_sizeFieldLength", CPLSPrintf("%d", poRec->GetSizeFieldLength()))));
poRec->SetSizeFieldPos(atoi(CPLGetXMLValue(psIter, "_sizeFieldPos", CPLSPrintf("%d", poRec->GetSizeFieldPos()))));
poRec->SetSizeFieldTag(atoi(CPLGetXMLValue(psIter, "_sizeFieldTag", CPLSPrintf("%d", poRec->GetSizeFieldTag()))));
CPLXMLNode* psSubIter = psIter->psChild;
while( psSubIter != NULL )
{
if( psSubIter->eType == CXT_Element &&
strcmp(psSubIter->pszValue, "DDFField") == 0 )
{
const char* pszFieldName = CPLGetXMLValue(psSubIter, "name", "");
DDFFieldDefn* poFieldDefn = oModule.FindFieldDefn( pszFieldName );
if( poFieldDefn == NULL )
{
fprintf(stderr, "Can't find field '%s'\n", pszFieldName );
exit(1);
}
int nFieldOcc = oMapField[pszFieldName];
oMapField[pszFieldName] ++ ;
DDFField *poField = poRec->AddField( poFieldDefn );
const char* pszValue = CPLGetXMLValue(psSubIter, "value", NULL);
if( pszValue != NULL && STARTS_WITH(pszValue, "0x") )
{
pszValue += 2;
int nDataLen = (int)strlen(pszValue) / 2;
char* pabyData = (char*) malloc(nDataLen);
for(int i=0;i<nDataLen;i++)
{
char c;
int nHigh, nLow;
c = pszValue[2*i];
if( c >= 'A' && c <= 'F' )
nHigh = 10 + c - 'A';