本文整理汇总了C++中TABINDFile::FindNext方法的典型用法代码示例。如果您正苦于以下问题:C++ TABINDFile::FindNext方法的具体用法?C++ TABINDFile::FindNext怎么用?C++ TABINDFile::FindNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TABINDFile
的用法示例。
在下文中一共展示了TABINDFile::FindNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildKey
long *OGRMIAttrIndex::GetAllMatches( OGRField *psKey )
{
GByte *pabyKey = BuildKey( psKey );
long *panFIDList = NULL, nFID;
int nFIDCount=0, nFIDMax=2;
panFIDList = (long *) CPLMalloc(sizeof(long) * 2);
nFID = poINDFile->FindFirst( iIndex, pabyKey );
while( nFID > 0 )
{
if( nFIDCount >= nFIDMax-1 )
{
nFIDMax = nFIDMax * 2 + 10;
panFIDList = (long *) CPLRealloc(panFIDList, sizeof(long)*nFIDMax);
}
panFIDList[nFIDCount++] = nFID - 1;
nFID = poINDFile->FindNext( iIndex, pabyKey );
}
panFIDList[nFIDCount] = OGRNullFID;
return panFIDList;
}
示例2: BuildKey
GIntBig *OGRMIAttrIndex::GetAllMatches( OGRField *psKey, GIntBig* panFIDList, int* nFIDCount, int* nLength )
{
GByte *pabyKey = BuildKey( psKey );
if (panFIDList == nullptr)
{
panFIDList = static_cast<GIntBig *>(CPLMalloc(sizeof(GIntBig) * 2));
*nFIDCount = 0;
*nLength = 2;
}
GIntBig nFID = poINDFile->FindFirst( iIndex, pabyKey );
while( nFID > 0 )
{
if( *nFIDCount >= *nLength-1 )
{
*nLength = (*nLength) * 2 + 10;
panFIDList = static_cast<GIntBig *>(CPLRealloc(panFIDList, sizeof(GIntBig)* (*nLength)));
}
panFIDList[(*nFIDCount)++] = nFID - 1;
nFID = poINDFile->FindNext( iIndex, pabyKey );
}
panFIDList[*nFIDCount] = OGRNullFID;
return panFIDList;
}
示例3: SearchIndex
/**********************************************************************
* SearchIndex()
*
* Search a TAB dataset's .IND file for pszVal in index nIndexNo
**********************************************************************/
static int SearchIndex(const char *pszFname, int nIndexNo, const char *pszVal)
{
TABFile oTABFile;
TABINDFile *poINDFile;
/*---------------------------------------------------------------------
* Try to open source file
*--------------------------------------------------------------------*/
if (oTABFile.Open(pszFname, "rb") != 0)
{
printf("Failed to open %s as a TABFile.\n", pszFname);
return -1;
}
/*---------------------------------------------------------------------
* Fetch IND file handle
*--------------------------------------------------------------------*/
if ((poINDFile = oTABFile.GetINDFileRef()) == NULL)
{
printf("Dataset %s has no .IND file\n", pszFname);
return -1;
}
/*---------------------------------------------------------------------
* Search the index.
* For now we search only 'char' index types!!!
*--------------------------------------------------------------------*/
GByte *pKey;
int nRecordNo;
pKey = poINDFile->BuildKey(nIndexNo, pszVal);
nRecordNo = poINDFile->FindFirst(nIndexNo, pKey);
if (nRecordNo < 1)
{
printf("Value '%s' not found in index #%d\n", pszVal, nIndexNo);
}
else
{
while(nRecordNo > 0)
{
printf("Record %d...\n", nRecordNo);
nRecordNo = poINDFile->FindNext(nIndexNo, pKey);
}
}
/*---------------------------------------------------------------------
* Cleanup and exit.
*--------------------------------------------------------------------*/
oTABFile.Close();
return 0;
}