本文整理汇总了C++中FSList::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ FSList::Count方法的具体用法?C++ FSList::Count怎么用?C++ FSList::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSList
的用法示例。
在下文中一共展示了FSList::Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcDir
int64_t OperDirCalcThread::CalcDir( FS* fs, FSPath path )
{
if ( Info()->Stopped() ) { return -1; }
{
//lock
MutexLock lock( Node().GetMutex() );
if ( !Node().Data() ) { return -1; }
OperDirCalcData* data = ( OperDirCalcData* )Node().Data();
MutexLock l1( &data->resMutex );
data->currentPath = path;
}
Node().SendSignal( 10 );
FSList list;
int err;
if ( fs->ReadDir( &list, path, &err, Info() ) )
{
MutexLock lock( Node().GetMutex() );
if ( !Node().Data() ) { return -1; }
MutexLock l1( &( ( OperDirCalcData* )Node().Data() )->resMutex );
( ( OperDirCalcData* )Node().Data() )->badDirs++;
return -1;
};
int count = list.Count();
std::vector<FSNode*> p = list.GetArray();
//list.SortByName(p.ptr(), count, true, false);
int lastPathPos = path.Count();
FSPath filePath = path;
int64_t fileCount = 0;
int64_t folderCount = 0;
int64_t sumSize = 0;
int i;
for ( i = 0; i < count; i++ )
{
if ( p[i]->IsDir() )
{
folderCount++;
continue;
};
fileCount++;
if ( p[i]->IsReg() && !p[i]->IsLnk() )
{
sumSize += p[i]->Size();
}
}
{
//lock
MutexLock lock( Node().GetMutex() );
if ( !Node().Data() ) { return -1; }
OperDirCalcData* data = ( OperDirCalcData* )Node().Data();
MutexLock l1( &data->resMutex );
data->fileCount += fileCount;
data->folderCount += folderCount;
data->sumSize += sumSize;
}
Node().SendSignal( 20 );
for ( i = 0; i < count; i++ )
{
if ( p[i]->IsDir() && !p[i]->extType && p[i]->st.link.IsEmpty() )
{
if ( Info()->Stopped() )
{
return -1;
}
path.SetItemStr( lastPathPos, p[i]->Name() );
sumSize += CalcDir( fs, path );
}
}
return sumSize;
}