本文整理汇总了C++中UStringVector::Back方法的典型用法代码示例。如果您正苦于以下问题:C++ UStringVector::Back方法的具体用法?C++ UStringVector::Back怎么用?C++ UStringVector::Back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UStringVector
的用法示例。
在下文中一共展示了UStringVector::Back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextFile
bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &resPath, DWORD &errorCode)
{
filled = false;
for (;;)
{
if (Enumerators.IsEmpty())
{
if (Index >= FileNames.Size())
return true;
const UString &path = FileNames[Index];
int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
resPath.Empty();
if (pos >= 0)
resPath = path.Left(pos + 1);
if (!NFind::FindFile(BasePrefix + path, fileInfo))
{
errorCode = ::GetLastError();
resPath = path;
return false;
}
Index++;
break;
}
bool found;
if (!Enumerators.Back().Next(fileInfo, found))
{
errorCode = ::GetLastError();
resPath = Prefixes.Back();
return false;
}
if (found)
{
resPath = Prefixes.Back();
break;
}
Enumerators.DeleteBack();
Prefixes.DeleteBack();
}
resPath += fileInfo.Name;
if (!FlatMode && fileInfo.IsDir())
{
UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
Prefixes.Add(prefix);
}
filled = true;
return true;
}
示例2: 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);
}
}
示例3: AddItem
void CCensor::AddItem(bool include, const UString &path, bool recursive)
{
UStringVector pathParts;
SplitPathToParts(path, pathParts);
bool forFile = true;
if (pathParts.Back().IsEmpty())
{
forFile = false;
pathParts.DeleteBack();
}
const UString &front = pathParts.Front();
bool isAbs = false;
if (front.IsEmpty())
isAbs = true;
else if (front.Length() == 2 && front[1] == L':')
isAbs = true;
else
{
for (int i = 0; i < pathParts.Size(); i++)
{
const UString &part = pathParts[i];
if (part == L".." || part == L".")
{
isAbs = true;
break;
}
}
}
int numAbsParts = 0;
if (isAbs)
if (pathParts.Size() > 1)
numAbsParts = pathParts.Size() - 1;
else
numAbsParts = 1;
UString prefix;
for (int i = 0; i < numAbsParts; i++)
{
const UString &front = pathParts.Front();
if (DoesNameContainWildCard(front))
break;
prefix += front;
prefix += WCHAR_PATH_SEPARATOR;
pathParts.Delete(0);
}
int index = FindPrefix(prefix);
if (index < 0)
index = Pairs.Add(CPair(prefix));
CItem item;
item.PathParts = pathParts;
item.ForDir = true;
item.ForFile = forFile;
item.Recursive = recursive;
Pairs[index].Head.AddItem(include, item);
}
示例4: Correct_FsPath
void Correct_FsPath(bool absIsAllowed, UStringVector &parts, bool isDir)
{
unsigned i = 0;
if (absIsAllowed)
{
#if defined(_WIN32) && !defined(UNDER_CE)
bool isDrive = false;
#endif
if (parts[0].IsEmpty())
{
i = 1;
#if defined(_WIN32) && !defined(UNDER_CE)
if (parts.Size() > 1 && parts[1].IsEmpty())
{
i = 2;
if (parts.Size() > 2 && parts[2] == L"?")
{
i = 3;
if (parts.Size() > 3 && NWindows::NFile::NName::IsDrivePath2(parts[3]))
{
isDrive = true;
i = 4;
}
}
}
#endif
}
#if defined(_WIN32) && !defined(UNDER_CE)
else if (NWindows::NFile::NName::IsDrivePath2(parts[0]))
{
isDrive = true;
i = 1;
}
if (isDrive)
{
// we convert "c:name" to "c:\name", if absIsAllowed path.
UString &ds = parts[i - 1];
if (ds.Len() > 2)
{
parts.Insert(i, ds.Ptr(2));
ds.DeleteFrom(2);
}
}
#endif
}
for (; i < parts.Size();)
{
UString &s = parts[i];
Correct_PathPart(s);
if (s.IsEmpty())
{
if (isDir || i != parts.Size() - 1)
{
parts.Delete(i);
continue;
}
s = k_EmptyReplaceName;
}
else
{
#ifdef _WIN32
CorrectUnsupportedName(s);
#endif
}
i++;
}
if (!isDir)
{
if (parts.IsEmpty())
parts.Add((UString)k_EmptyReplaceName);
else
{
UString &s = parts.Back();
if (s.IsEmpty())
s = k_EmptyReplaceName;
}
}
}