本文整理汇总了C++中CDirItems::AddDirFileInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ CDirItems::AddDirFileInfo方法的具体用法?C++ CDirItems::AddDirFileInfo怎么用?C++ CDirItems::AddDirFileInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDirItems
的用法示例。
在下文中一共展示了CDirItems::AddDirFileInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateAltStreams
static HRESULT EnumerateAltStreams(
const NFind::CFileInfo &fi,
const NWildcard::CCensorNode &curNode,
int phyParent, int logParent, const FString &fullPath,
const UStringVector &addArchivePrefix, // prefix from curNode
CDirItems &dirItems)
{
NFind::CStreamEnumerator enumerator(fullPath);
for (;;)
{
NFind::CStreamInfo si;
bool found;
if (!enumerator.Next(si, found))
{
return dirItems.AddError(fullPath + FTEXT(":*")); // , (DWORD)E_FAIL
}
if (!found)
return S_OK;
if (si.IsMainStream())
continue;
UStringVector addArchivePrefixNew = addArchivePrefix;
UString reducedName = si.GetReducedName();
addArchivePrefixNew.Back() += reducedName;
if (curNode.CheckPathToRoot(false, addArchivePrefixNew, true))
continue;
NFind::CFileInfo fi2 = fi;
fi2.Name += us2fs(reducedName);
fi2.Size = si.Size;
fi2.Attrib &= ~FILE_ATTRIBUTE_DIRECTORY;
fi2.IsAltStream = true;
dirItems.AddDirFileInfo(phyParent, logParent, -1, fi2);
}
}
示例2: EnumerateForItem
static HRESULT EnumerateForItem(
NFind::CFileInfo &fi,
const NWildcard::CCensorNode &curNode,
int phyParent, int logParent, const FString &phyPrefix,
const UStringVector &addArchivePrefix, // prefix from curNode
CDirItems &dirItems,
bool enterToSubFolders)
{
const UString name = fs2us(fi.Name);
bool enterToSubFolders2 = enterToSubFolders;
UStringVector addArchivePrefixNew = addArchivePrefix;
addArchivePrefixNew.Add(name);
{
UStringVector addArchivePrefixNewTemp(addArchivePrefixNew);
if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fi.IsDir()))
return S_OK;
}
int dirItemIndex = -1;
bool addAllSubStreams = false;
if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fi.IsDir()))
{
int secureIndex = -1;
#ifdef _USE_SECURITY_CODE
if (dirItems.ReadSecure)
{
RINOK(dirItems.AddSecurityItem(phyPrefix + fi.Name, secureIndex));
}
#endif
dirItemIndex = dirItems.Items.Size();
dirItems.AddDirFileInfo(phyParent, logParent, secureIndex, fi);
if (fi.IsDir())
enterToSubFolders2 = true;
addAllSubStreams = true;
}
#ifndef UNDER_CE
if (dirItems.ScanAltStreams)
{
RINOK(EnumerateAltStreams(fi, curNode, phyParent, logParent,
phyPrefix + fi.Name,
addArchivePrefixNew,
addAllSubStreams,
dirItems));
}
if (dirItemIndex >= 0)
{
CDirItem &dirItem = dirItems.Items[dirItemIndex];
RINOK(dirItems.SetLinkInfo(dirItem, fi, phyPrefix));
if (dirItem.ReparseData.Size() != 0)
return S_OK;
}
#endif
if (!fi.IsDir())
return S_OK;
const NWildcard::CCensorNode *nextNode = 0;
if (addArchivePrefix.IsEmpty())
{
int index = curNode.FindSubNode(name);
if (index >= 0)
nextNode = &curNode.SubNodes[index];
}
if (!enterToSubFolders2 && nextNode == 0)
return S_OK;
addArchivePrefixNew = addArchivePrefix;
if (nextNode == 0)
{
nextNode = &curNode;
addArchivePrefixNew.Add(name);
}
return EnumerateDirItems_Spec(
*nextNode, phyParent, logParent, fi.Name, phyPrefix,
addArchivePrefixNew,
dirItems,
enterToSubFolders2);
}