本文整理汇总了C++中VSIFilesystemHandler::Stat方法的典型用法代码示例。如果您正苦于以下问题:C++ VSIFilesystemHandler::Stat方法的具体用法?C++ VSIFilesystemHandler::Stat怎么用?C++ VSIFilesystemHandler::Stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VSIFilesystemHandler
的用法示例。
在下文中一共展示了VSIFilesystemHandler::Stat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VSIStatL
int VSIStatL( const char * pszFilename, VSIStatBufL *psStatBuf )
{
VSIFilesystemHandler *poFSHandler =
VSIFileManager::GetHandler( pszFilename );
return poFSHandler->Stat( pszFilename, psStatBuf );
}
示例2: VSIStatL
int VSIStatL( const char * pszFilename, VSIStatBufL *psStatBuf )
{
char szAltPath[4];
/* enable to work on "C:" as if it were "C:\" */
if( strlen(pszFilename) == 2 && pszFilename[1] == ':' )
{
szAltPath[0] = pszFilename[0];
szAltPath[1] = pszFilename[1];
szAltPath[2] = '\\';
szAltPath[3] = '\0';
pszFilename = szAltPath;
}
VSIFilesystemHandler *poFSHandler =
VSIFileManager::GetHandler( pszFilename );
return poFSHandler->Stat( pszFilename, psStatBuf );
}
示例3: VSIStatExL
int VSIStatExL( const char * pszFilename, VSIStatBufL *psStatBuf, int nFlags )
{
char szAltPath[4];
/* enable to work on "C:" as if it were "C:\" */
if( strlen(pszFilename) == 2 && pszFilename[1] == ':' )
{
szAltPath[0] = pszFilename[0];
szAltPath[1] = pszFilename[1];
szAltPath[2] = '\\';
szAltPath[3] = '\0';
pszFilename = szAltPath;
}
VSIFilesystemHandler *poFSHandler =
VSIFileManager::GetHandler( pszFilename );
if (nFlags == 0)
nFlags = VSI_STAT_EXISTS_FLAG | VSI_STAT_NATURE_FLAG | VSI_STAT_SIZE_FLAG;
return poFSHandler->Stat( pszFilename, psStatBuf, nFlags );
}
示例4: SplitFilename
char* VSIArchiveFilesystemHandler::SplitFilename(const char *pszFilename,
CPLString &osFileInArchive,
int bCheckMainFileExists)
{
int i = 0;
if (strcmp(pszFilename, GetPrefix()) == 0)
return NULL;
/* Allow natural chaining of VSI drivers without requiring double slash */
CPLString osDoubleVsi(GetPrefix());
osDoubleVsi += "/vsi";
if (strncmp(pszFilename, osDoubleVsi.c_str(), osDoubleVsi.size()) == 0)
pszFilename += strlen(GetPrefix());
else
pszFilename += strlen(GetPrefix()) + 1;
while(pszFilename[i])
{
std::vector<CPLString> oExtensions = GetExtensions();
std::vector<CPLString>::const_iterator iter;
int nToSkip = 0;
for( iter = oExtensions.begin(); iter != oExtensions.end(); ++iter )
{
const CPLString& osExtension = *iter;
if (EQUALN(pszFilename + i, osExtension.c_str(), strlen(osExtension.c_str())))
{
nToSkip = strlen(osExtension.c_str());
break;
}
}
if (nToSkip != 0)
{
VSIStatBufL statBuf;
char* archiveFilename = CPLStrdup(pszFilename);
int bArchiveFileExists = FALSE;
if (archiveFilename[i + nToSkip] == '/' ||
archiveFilename[i + nToSkip] == '\\')
{
archiveFilename[i + nToSkip] = 0;
}
if (!bCheckMainFileExists)
{
bArchiveFileExists = TRUE;
}
else
{
CPLMutexHolder oHolder( &hMutex );
if (oFileList.find(archiveFilename) != oFileList.end() )
{
bArchiveFileExists = TRUE;
}
}
if (!bArchiveFileExists)
{
VSIFilesystemHandler *poFSHandler =
VSIFileManager::GetHandler( archiveFilename );
if (poFSHandler->Stat(archiveFilename, &statBuf,
VSI_STAT_EXISTS_FLAG | VSI_STAT_NATURE_FLAG) == 0 &&
!VSI_ISDIR(statBuf.st_mode))
{
bArchiveFileExists = TRUE;
}
}
if (bArchiveFileExists)
{
if (pszFilename[i + nToSkip] == '/' ||
pszFilename[i + nToSkip] == '\\')
{
char* pszArchiveInFileName = CPLStrdup(pszFilename + i + nToSkip + 1);
/* Replace a/../b by b and foo/a/../b by foo/b */
while(TRUE)
{
char* pszPrevDir = strstr(pszArchiveInFileName, "/../");
if (pszPrevDir == NULL || pszPrevDir == pszArchiveInFileName)
break;
char* pszPrevSlash = pszPrevDir - 1;
while(pszPrevSlash != pszArchiveInFileName &&
*pszPrevSlash != '/')
pszPrevSlash --;
if (pszPrevSlash == pszArchiveInFileName)
memmove(pszArchiveInFileName, pszPrevDir + nToSkip, strlen(pszPrevDir + nToSkip) + 1);
else
memmove(pszPrevSlash + 1, pszPrevDir + nToSkip, strlen(pszPrevDir + nToSkip) + 1);
}
osFileInArchive = pszArchiveInFileName;
CPLFree(pszArchiveInFileName);
}
//.........这里部分代码省略.........