本文整理汇总了C++中UStringVector::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ UStringVector::Size方法的具体用法?C++ UStringVector::Size怎么用?C++ UStringVector::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UStringVector
的用法示例。
在下文中一共展示了UStringVector::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToCensorFromNonSwitchesStrings
static void AddToCensorFromNonSwitchesStrings(
int startIndex,
NWildcard::CCensor &wildcardCensor,
const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
bool thereAreSwitchIncludes, UINT codePage)
{
if (nonSwitchStrings.Size() == startIndex && (!thereAreSwitchIncludes))
AddNameToCensor(wildcardCensor, kUniversalWildcard, true, type);
for (int i = startIndex; i < nonSwitchStrings.Size(); i++)
{
const UString &s = nonSwitchStrings[i];
if (s[0] == kFileListID)
AddToCensorFromListFile(wildcardCensor, s.Mid(1), true, type, codePage);
else
AddNameToCensor(wildcardCensor, s, true, type);
}
}
示例2: ParseStrings
void CParser::ParseStrings(const CSwitchForm *switchForms,
const UStringVector &commandStrings)
{
int numCommandStrings = commandStrings.Size();
for (int i = 0; i < numCommandStrings; i++)
if (!ParseString(commandStrings[i], switchForms))
NonSwitchStrings.Add(commandStrings[i]);
}
示例3: EnumerateDirItemsAndSort
void EnumerateDirItemsAndSort(NWildcard::CCensor &wildcardCensor,
UStringVector &sortedPaths,
UStringVector &sortedFullPaths)
{
UStringVector paths;
{
CDirItems dirItems;
{
UStringVector errorPaths;
CRecordVector<DWORD> errorCodes;
HRESULT res = EnumerateItems(wildcardCensor, dirItems, NULL, errorPaths, errorCodes);
if (res != S_OK || errorPaths.Size() > 0)
throw "cannot find archive";
}
for (int i = 0; i < dirItems.Items.Size(); i++)
{
const CDirItem &dirItem = dirItems.Items[i];
if (!dirItem.IsDir())
paths.Add(dirItems.GetPhyPath(i));
}
}
if (paths.Size() == 0)
throw "there is no such archive";
UStringVector fullPaths;
int i;
for (i = 0; i < paths.Size(); i++)
{
UString fullPath;
NFile::NDirectory::MyGetFullPathName(paths[i], fullPath);
fullPaths.Add(fullPath);
}
CIntVector indices;
SortFileNames(fullPaths, indices);
sortedPaths.Reserve(indices.Size());
sortedFullPaths.Reserve(indices.Size());
for (i = 0; i < indices.Size(); i++)
{
int index = indices[i];
sortedPaths.Add(paths[index]);
sortedFullPaths.Add(fullPaths[index]);
}
}
示例4: SortFileNames
void SortFileNames(const UStringVector &strings, CIntVector &indices)
{
indices.Clear();
int numItems = strings.Size();
indices.Reserve(numItems);
for(int i = 0; i < numItems; i++)
indices.Add(i);
indices.Sort(CompareStrings, (void *)&strings);
}
示例5: AddToCensorFromListFile
static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
{
UStringVector names;
if (!ReadNamesFromListFile(fileName, names, codePage))
throw kIncorrectListFile;
for (int i = 0; i < names.Size(); i++)
AddNameToCensor(wildcardCensor, names[i], include, type);
}
示例6: AddUniqueStringToHeadOfList
void AddUniqueStringToHeadOfList(UStringVector &list, const UString &s)
{
for (unsigned i = 0; i < list.Size();)
if (s.IsEqualTo_NoCase(list[i]))
list.Delete(i);
else
i++;
list.Insert(0, s);
}
示例7: AddToCensorFromNonSwitchesStrings
static void AddToCensorFromNonSwitchesStrings(
CObjectVector<CRenamePair> *renamePairs,
unsigned startIndex,
NWildcard::CCensor &censor,
const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
bool wildcardMatching,
bool thereAreSwitchIncludes, Int32 codePage)
{
if ((renamePairs || nonSwitchStrings.Size() == startIndex) && !thereAreSwitchIncludes)
AddNameToCensor(censor, kUniversalWildcard, true, type,
true // wildcardMatching
);
int oldIndex = -1;
for (unsigned i = startIndex; i < nonSwitchStrings.Size(); i++)
{
const UString &s = nonSwitchStrings[i];
if (s.IsEmpty())
throw CArcCmdLineException(kEmptyFilePath);
if (s[0] == kFileListID)
AddToCensorFromListFile(renamePairs, censor, s.Ptr(1), true, type, wildcardMatching, codePage);
else if (renamePairs)
{
if (oldIndex == -1)
oldIndex = i;
else
{
// NRecursedType::EEnum type is used for global wildcard (-i! switches)
AddRenamePair(renamePairs, nonSwitchStrings[oldIndex], s, NRecursedType::kNonRecursed, wildcardMatching);
// AddRenamePair(renamePairs, nonSwitchStrings[oldIndex], s, type);
oldIndex = -1;
}
}
else
AddNameToCensor(censor, s, true, type, wildcardMatching);
}
if (oldIndex != -1)
{
throw CArcCmdLineException("There is no second file name for rename pair:", nonSwitchStrings[oldIndex]);
}
}
示例8: CreateComplexDirectory
void CExtractCallbackImp::CreateComplexDirectory(const UStringVector &dirPathParts)
{
UString fullPath = _directoryPath;
for(int i = 0; i < dirPathParts.Size(); i++)
{
fullPath += dirPathParts[i];
NDirectory::MyCreateDirectory(fullPath);
fullPath += NName::kDirDelimiter;
}
}
示例9: ProcessVirt
HRESULT CThreadCombine::ProcessVirt()
{
NFile::NIO::COutFile outFile;
if (!outFile.Create(OutputPath, false))
{
HRESULT res = GetLastError();
ErrorPath1 = OutputPath;
return res;
}
CProgressSync &sync = ProgressDialog.Sync;
sync.SetProgress(TotalSize, 0);
CMyBuffer bufferObject;
if (!bufferObject.Allocate(kBufSize))
return E_OUTOFMEMORY;
Byte *buffer = (Byte *)(void *)bufferObject;
UInt64 pos = 0;
for (int i = 0; i < Names.Size(); i++)
{
NFile::NIO::CInFile inFile;
const UString nextName = InputDirPrefix + Names[i];
if (!inFile.Open(nextName))
{
HRESULT res = GetLastError();
ErrorPath1 = nextName;
return res;
}
sync.SetCurrentFileName(nextName);
for (;;)
{
UInt32 processedSize;
if (!inFile.Read(buffer, kBufSize, processedSize))
{
HRESULT res = GetLastError();
ErrorPath1 = nextName;
return res;
}
if (processedSize == 0)
break;
UInt32 needSize = processedSize;
if (!outFile.Write(buffer, needSize, processedSize))
{
HRESULT res = GetLastError();
ErrorPath1 = OutputPath;
return res;
}
if (needSize != processedSize)
throw g_Message_FileWriteError;
pos += processedSize;
RINOK(sync.SetPosAndCheckPaused(pos));
}
}
return S_OK;
}
示例10: MergePath
UString CParsedPath::MergePath() const
{
UString result = Prefix;
for (int i = 0; i < PathParts.Size(); i++)
{
if (i != 0)
result += kDirDelimiter;
result += PathParts[i];
}
return result;
}
示例11: MakePathNameFromParts
UString MakePathNameFromParts(const UStringVector &parts)
{
UString result;
for (int i = 0; i < parts.Size(); i++)
{
if (i != 0)
result += WCHAR_PATH_SEPARATOR;
result += parts[i];
}
return result;
}
示例12: JoinStrings
UString JoinStrings(const UStringVector &srcStrings)
{
UString destString;
for (int i = 0; i < srcStrings.Size(); i++)
{
if (i != 0)
destString += L' ';
destString += srcStrings[i];
}
return destString;
}
示例13: GetCurrentDir
void CPlugin::GetCurrentDir()
{
m_CurrentDir.Empty();
UStringVector pathParts;
GetPathParts(pathParts);
for (int i = 0; i < pathParts.Size(); i++)
{
m_CurrentDir += WCHAR_PATH_SEPARATOR;
m_CurrentDir += pathParts[i];
}
}
示例14: SortFileNames
void SortFileNames(const UStringVector &strings, CUIntVector &indices)
{
const unsigned numItems = strings.Size();
indices.ClearAndSetSize(numItems);
if (numItems == 0)
return;
unsigned *vals = &indices[0];
for (unsigned i = 0; i < numItems; i++)
vals[i] = i;
indices.Sort(CompareStrings, (void *)&strings);
}
示例15: MakeCorrectPath
void MakeCorrectPath(UStringVector &pathParts)
{
for (int i = 0; i < pathParts.Size();)
{
UString &s = pathParts[i];
s = GetCorrectFileName(s);
if (s.IsEmpty())
pathParts.Delete(i);
else
i++;
}
}