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


C++ VSIVirtualHandle::Eof方法代码示例

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


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

示例1: VSIFEofL

int VSIFEofL( VSILFILE * fp )

{
    VSIVirtualHandle *poFileHandle = (VSIVirtualHandle *) fp;
    
    return poFileHandle->Eof();
}
开发者ID:drownedout,项目名称:datamap,代码行数:7,代码来源:cpl_vsil.cpp

示例2: VSIFEofL

int VSIFEofL( VSILFILE * fp )

{
    VSIVirtualHandle *poFileHandle = reinterpret_cast<VSIVirtualHandle *>( fp );

    return poFileHandle->Eof();
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:7,代码来源:cpl_vsil.cpp

示例3: Eof

int VSIStdoutRedirectHandle::Eof()

{
    return poHandle->Eof();
}
开发者ID:samalone,项目名称:gdal-ios,代码行数:5,代码来源:cpl_vsil_stdout.cpp

示例4: Read

size_t VSIBufferedReaderHandle::Read( void *pBuffer, size_t nSize, size_t nMemb )
{
    const size_t nTotalToRead = nSize * nMemb;
    //CPLDebug( "BUFFERED", "Read(%d)", (int)nTotalToRead);

    if (nSize == 0)
        return 0;

    if (nBufferSize != 0 &&
            nCurOffset >= nBufferOffset && nCurOffset <= nBufferOffset + nBufferSize)
    {
        /* We try to read from an offset located within the buffer */
        const int nReadInBuffer = (int) MIN(nTotalToRead, nBufferOffset + nBufferSize - nCurOffset);
        memcpy(pBuffer, pabyBuffer + nCurOffset - nBufferOffset, nReadInBuffer);
        const int nToReadInFile = nTotalToRead - nReadInBuffer;
        if (nToReadInFile > 0)
        {
            /* The beginning of the the data to read is located in the buffer */
            /* but the end must be read from the file */
            if (bNeedBaseHandleSeek)
                poBaseHandle->Seek(nBufferOffset + nBufferSize, SEEK_SET);
            bNeedBaseHandleSeek = FALSE;
            //CPLAssert(poBaseHandle->Tell() == nBufferOffset + nBufferSize);

            const int nReadInFile = poBaseHandle->Read((GByte*)pBuffer + nReadInBuffer, 1, nToReadInFile);
            const int nRead = nReadInBuffer + nReadInFile;

            nBufferSize = MIN(nRead, MAX_BUFFER_SIZE);
            nBufferOffset = nCurOffset + nRead - nBufferSize;
            memcpy(pabyBuffer, (GByte*)pBuffer + nRead - nBufferSize, nBufferSize);

            nCurOffset += nRead;
            //CPLAssert(poBaseHandle->Tell() == nBufferOffset + nBufferSize);
            //CPLAssert(poBaseHandle->Tell() == nCurOffset);

            bEOF = poBaseHandle->Eof();

            return nRead / nSize;
        }
        else
        {
            /* The data to read is completely located within the buffer */
            nCurOffset += nTotalToRead;
            return nTotalToRead / nSize;
        }
    }
    else
    {
        /* We try either to read before or after the buffer, so a seek is necessary */
        poBaseHandle->Seek(nCurOffset, SEEK_SET);
        bNeedBaseHandleSeek = FALSE;
        const int nReadInFile = poBaseHandle->Read(pBuffer, 1, nTotalToRead);
        nBufferSize = MIN(nReadInFile, MAX_BUFFER_SIZE);
        nBufferOffset = nCurOffset + nReadInFile - nBufferSize;
        memcpy(pabyBuffer, (GByte*)pBuffer + nReadInFile - nBufferSize, nBufferSize);

        nCurOffset += nReadInFile;
        //CPLAssert(poBaseHandle->Tell() == nBufferOffset + nBufferSize);
        //CPLAssert(poBaseHandle->Tell() == nCurOffset);

        bEOF = poBaseHandle->Eof();

        return nReadInFile / nSize;
    }

}
开发者ID:codedis213,项目名称:elastic_search_practice,代码行数:66,代码来源:cpl_vsil_buffered_reader.cpp


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