当前位置: 首页>>代码示例>>C++>>正文


C++ DDFSubfieldDefn::ExtractIntData方法代码示例

本文整理汇总了C++中DDFSubfieldDefn::ExtractIntData方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFSubfieldDefn::ExtractIntData方法的具体用法?C++ DDFSubfieldDefn::ExtractIntData怎么用?C++ DDFSubfieldDefn::ExtractIntData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DDFSubfieldDefn的用法示例。


在下文中一共展示了DDFSubfieldDefn::ExtractIntData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Set

int SDTSModId::Set( DDFField *poField )

{
    const char  *pachData = poField->GetData();
    DDFFieldDefn *poDefn = poField->GetFieldDefn();

    if( poDefn->GetSubfieldCount() >= 2
        && poDefn->GetSubfield(0)->GetWidth() == 4 )
    {
        if( strlen(pachData) < 5 )
            return FALSE;

        memcpy( szModule, pachData, 4 );
        szModule[4] = '\0';

        nRecord = atoi( pachData + 4 );
    }
    else
    {
        DDFSubfieldDefn *poSF
            = poField->GetFieldDefn()->FindSubfieldDefn( "MODN" );
        if( poSF == nullptr )
            return FALSE;
        int nBytesRemaining;
        pachData = poField->GetSubfieldData(poSF, &nBytesRemaining);
        if( pachData == nullptr )
            return FALSE;
        snprintf( szModule, sizeof(szModule), "%s",
                 poSF->ExtractStringData( pachData, nBytesRemaining, nullptr) );

        poSF = poField->GetFieldDefn()->FindSubfieldDefn( "RCID" );
        if( poSF != nullptr )
        {
            pachData = poField->GetSubfieldData(poSF, &nBytesRemaining);
            if( pachData != nullptr )
                nRecord = poSF->ExtractIntData( pachData, nBytesRemaining, nullptr);
        }
    }

    if( poDefn->GetSubfieldCount() == 3 )
    {
        DDFSubfieldDefn *poSF = poField->GetFieldDefn()->FindSubfieldDefn( "OBRP" );
        if( poSF != nullptr )
        {
            int nBytesRemaining;
            pachData
                = poField->GetSubfieldData(poSF, &nBytesRemaining);
            if( pachData != nullptr )
            {
                snprintf( szOBRP, sizeof(szOBRP), "%s",
                        poSF->ExtractStringData( pachData, nBytesRemaining, nullptr) );
            }
        }
    }

    return FALSE;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:57,代码来源:sdtslib.cpp

示例2: Set

int SDTSModId::Set( DDFField *poField )

{
    const char  *pachData = poField->GetData();
    DDFFieldDefn *poDefn = poField->GetFieldDefn();

    if( poDefn->GetSubfieldCount() >= 2 
        && poDefn->GetSubfield(0)->GetWidth() == 4 )
    {
        memcpy( szModule, pachData, 4 );
        szModule[4] = '\0';

        nRecord = atoi( pachData + 4 );
    }
    else
    {
        DDFSubfieldDefn *poSF;
        int             nBytesRemaining;
        const char  *pachData;

        poSF = poField->GetFieldDefn()->FindSubfieldDefn( "MODN" );
        pachData = poField->GetSubfieldData(poSF, &nBytesRemaining);
        strncpy( szModule,
                 poSF->ExtractStringData( pachData, nBytesRemaining, NULL),
                 sizeof(szModule) );
        szModule[sizeof(szModule)-1] = '\0';

        poSF = poField->GetFieldDefn()->FindSubfieldDefn( "RCID" );
        pachData = poField->GetSubfieldData(poSF, &nBytesRemaining);
        nRecord = poSF->ExtractIntData( pachData, nBytesRemaining, NULL);
    }

    if( poDefn->GetSubfieldCount() == 3 )
    {
        DDFSubfieldDefn         *poSF;

        poSF = poField->GetFieldDefn()->FindSubfieldDefn( "OBRP" );
        if( poSF != NULL )
        {
            int         nBytesRemaining;
            const char  *pachData;

            pachData = poField->GetSubfieldData(poSF, &nBytesRemaining);
            strncpy( szOBRP, 
                     poSF->ExtractStringData( pachData, nBytesRemaining, NULL),
                     sizeof(szOBRP) );
            
            szOBRP[sizeof(szOBRP)-1] = '\0';
        }
    }

    return FALSE;
}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:53,代码来源:sdtslib.cpp

示例3: main


//.........这里部分代码省略.........
                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;
                        DDFSubfieldDefn* poSubFieldDefn = poDefn->GetSubfield(iSubField);
                        const char* pszSubFieldName = poSubFieldDefn->GetName();
                        printf("    <DDFSubfield name=\"%s\" ", pszSubFieldName);
                        DDFDataType eType = poSubFieldDefn->GetType();
                        const char* pachSubdata = pachData + iOffset;
                        int nMaxBytes = nDataSize - iOffset;
                        if( eType == DDFFloat )
                            printf("type=\"float\">%f",
                                   poSubFieldDefn->ExtractFloatData( pachSubdata, nMaxBytes, NULL ) );
                        else if( eType == DDFInt )
                            printf("type=\"integer\">%d",
                                   poSubFieldDefn->ExtractIntData( pachSubdata, nMaxBytes, NULL ) );
                        else if( eType == DDFBinaryString )
                        {
                            int     nBytes, i;
                            GByte   *pabyBString = (GByte *)
                                poSubFieldDefn->ExtractStringData( pachSubdata, nMaxBytes, &nBytes );

                            printf( "type=\"binary\">0x" );
                            for( i = 0; i < nBytes; i++ )
                                printf( "%02X", pabyBString[i] );
                        }
                        else
                        {
                            GByte* pabyString = (GByte *)poSubFieldDefn->ExtractStringData( pachSubdata, nMaxBytes, NULL );
                            int bBinary = FALSE;
                            int i;
                            for( i = 0; pabyString[i] != '\0'; i ++ )
                            {
                                if( pabyString[i] < 32 || pabyString[i] > 127 )
                                {
                                    bBinary = TRUE;
                                    break;
                                }
                            }
                            if( bBinary )
                            {
                                printf( "type=\"binary\">0x" );
                                for( i = 0; pabyString[i] != '\0'; i ++ )
                                    printf( "%02X", pabyString[i] );
                            }
                            else
                            {
                                char* pszEscaped = CPLEscapeString((const char*)pabyString, -1, CPLES_XML);
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:67,代码来源:8211dump.cpp

示例4: switch

static void
WriteAttrRecordToDBF( DBFHandle hDBF, int iRecord, 
                      SDTSTransfer * poTransfer, DDFField * poSR )

{
/* -------------------------------------------------------------------- */
/*      Process each subfield in the record.                            */
/* -------------------------------------------------------------------- */
    DDFFieldDefn        *poFDefn = poSR->GetFieldDefn();
        
    for( int iSF=0; iSF < poFDefn->GetSubfieldCount(); iSF++ )
    {
        DDFSubfieldDefn *poSFDefn = poFDefn->GetSubfield( iSF );
        int                     iField;
        int                     nMaxBytes;
        const char *    pachData = poSR->GetSubfieldData(poSFDefn,
                                                         &nMaxBytes);

/* -------------------------------------------------------------------- */
/*      Identify the related DBF field, if any.                         */
/* -------------------------------------------------------------------- */
        for( iField = 0; iField < hDBF->nFields; iField++ )
        {
            if( EQUALN(poSFDefn->GetName(),
                       hDBF->pszHeader+iField*32,10) )
                break;
        }

        if( iField == hDBF->nFields )
            iField = -1;
            
/* -------------------------------------------------------------------- */
/*      Handle each of the types.                                       */
/* -------------------------------------------------------------------- */
        switch( poSFDefn->GetType() )
        {
          case DDFString:
            const char  *pszValue;

            pszValue = poSFDefn->ExtractStringData(pachData, nMaxBytes,
                                                   NULL);

            if( iField != -1 )
                DBFWriteStringAttribute(hDBF, iRecord, iField, pszValue );
            break;

          case DDFFloat:
            double      dfValue;

            dfValue = poSFDefn->ExtractFloatData(pachData, nMaxBytes,
                                                 NULL);

            if( iField != -1 )
                DBFWriteDoubleAttribute( hDBF, iRecord, iField, dfValue );
            break;

          case DDFInt:
            int         nValue;

            nValue = poSFDefn->ExtractIntData(pachData, nMaxBytes, NULL);

            if( iField != -1 )
                DBFWriteIntegerAttribute( hDBF, iRecord, iField, nValue );
            break;

          default:
            break;
        }
    } /* next subfield */
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:70,代码来源:sdts2shp.cpp

示例5: switch

static void
AssignAttrRecordToFeature( OGRFeature * poFeature,
                           CPL_UNUSED SDTSTransfer * poTransfer,
                           DDFField * poSR )
{
/* -------------------------------------------------------------------- */
/*      Process each subfield in the record.                            */
/* -------------------------------------------------------------------- */
    DDFFieldDefn        *poFDefn = poSR->GetFieldDefn();

    for( int iSF=0; iSF < poFDefn->GetSubfieldCount(); iSF++ )
    {
        DDFSubfieldDefn *poSFDefn = poFDefn->GetSubfield( iSF );
        int                     iField;
        int                     nMaxBytes;
        const char *    pachData = poSR->GetSubfieldData(poSFDefn,
                                                         &nMaxBytes);
/* -------------------------------------------------------------------- */
/*      Indentify this field on the feature.                            */
/* -------------------------------------------------------------------- */
        iField = poFeature->GetFieldIndex( poSFDefn->GetName() );

/* -------------------------------------------------------------------- */
/*      Handle each of the types.                                       */
/* -------------------------------------------------------------------- */
        switch( poSFDefn->GetType() )
        {
          case DDFString:
            const char  *pszValue;

            pszValue = poSFDefn->ExtractStringData(pachData, nMaxBytes,
                                                   NULL);

            if( iField != -1 )
                poFeature->SetField( iField, pszValue );
            break;

          case DDFFloat:
            double      dfValue;

            dfValue = poSFDefn->ExtractFloatData(pachData, nMaxBytes,
                                                 NULL);

            if( iField != -1 )
                poFeature->SetField( iField, dfValue );
            break;

          case DDFInt:
            int         nValue;

            nValue = poSFDefn->ExtractIntData(pachData, nMaxBytes, NULL);

            if( iField != -1 )
                poFeature->SetField( iField, nValue );
            break;

          default:
            break;
        }
    } /* next subfield */
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:61,代码来源:ogrsdtslayer.cpp


注:本文中的DDFSubfieldDefn::ExtractIntData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。