本文整理汇总了C++中UStringVector::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ UStringVector::Clear方法的具体用法?C++ UStringVector::Clear怎么用?C++ UStringVector::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UStringVector
的用法示例。
在下文中一共展示了UStringVector::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void CProxyArc2::GetDirPathParts(int dirIndex, UStringVector &pathParts, bool &isAltStreamDir) const
{
pathParts.Clear();
isAltStreamDir = false;
if (dirIndex == k_Proxy2_RootDirIndex)
return;
if (dirIndex == k_Proxy2_AltRootDirIndex)
{
isAltStreamDir = true;
return;
}
while (dirIndex >= k_Proxy2_NumRootDirs)
{
const CProxyDir2 &dir = Dirs[dirIndex];
const CProxyFile2 &file = Files[dir.ArcIndex];
if (pathParts.IsEmpty() && dirIndex == file.AltDirIndex)
isAltStreamDir = true;
pathParts.Insert(0, file.Name);
int par = file.Parent;
if (par < 0)
break;
dirIndex = Files[par].DirIndex;
}
}
示例2: MyGetLogicalDriveStrings
bool MyGetLogicalDriveStrings(UStringVector &driveStrings)
{
driveStrings.Clear();
if (g_IsNT)
{
UINT32 size = GetLogicalDriveStringsW(0, NULL);
if (size == 0)
return false;
UString buffer;
UINT32 newSize = GetLogicalDriveStringsW(size, buffer.GetBuffer(size));
if (newSize == 0)
return false;
if (newSize > size)
return false;
UString string;
for (UINT32 i = 0; i < newSize; i++)
{
WCHAR c = buffer[i];
if (c == L'\0')
{
driveStrings.Add(string);
string.Empty();
}
else
string += c;
}
return string.IsEmpty();
}
CSysStringVector driveStringsA;
bool res = MyGetLogicalDriveStrings(driveStringsA);
for (int i = 0; i < driveStringsA.Size(); i++)
driveStrings.Add(GetUnicodeString(driveStringsA[i]));
return res;
}
示例3: GetValue_Strings
LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings)
{
strings.Clear();
CByteBuffer buffer;
UInt32 dataSize;
LONG res = QueryValue(valueName, buffer, dataSize);
if (res != ERROR_SUCCESS)
return res;
if (dataSize % sizeof(wchar_t) != 0)
return E_FAIL;
const wchar_t *data = (const wchar_t *)(const Byte *)buffer;
unsigned numChars = dataSize / sizeof(wchar_t);
UString s;
for (unsigned i = 0; i < numChars; i++)
{
wchar_t c = data[i];
if (c == 0)
{
strings.Add(s);
s.Empty();
}
else
s += c;
}
return res;
}
示例4: GetSelectedNames
void CPanel::GetSelectedNames(UStringVector &selectedNames)
{
selectedNames.Clear();
CRecordVector<UInt32> indices;
GetSelectedItemsIndices(indices);
selectedNames.Reserve(indices.Size());
for (int i = 0; i < indices.Size(); i++)
selectedNames.Add(GetItemRelPath(indices[i]));
/*
for (int i = 0; i < _listView.GetItemCount(); i++)
{
const int kSize = 1024;
WCHAR name[kSize + 1];
LVITEMW item;
item.iItem = i;
item.pszText = name;
item.cchTextMax = kSize;
item.iSubItem = 0;
item.mask = LVIF_TEXT | LVIF_PARAM;
if (!_listView.GetItem(&item))
continue;
int realIndex = GetRealIndex(item);
if (realIndex == kParentIndex)
continue;
if (_selectedStatusVector[realIndex])
selectedNames.Add(item.pszText);
}
*/
selectedNames.Sort();
}
示例5: SetFilter
void CBrowseDialog::SetFilter(const UString &s)
{
Filters.Clear();
UString mask;
unsigned i;
for (i = 0; i < s.Len(); i++)
{
wchar_t c = s[i];
if (c == ';')
{
if (!mask.IsEmpty())
Filters.Add(mask);
mask.Empty();
}
else
mask += c;
}
if (!mask.IsEmpty())
Filters.Add(mask);
ShowAllFiles = Filters.IsEmpty();
for (i = 0; i < Filters.Size(); i++)
{
const UString &f = Filters[i];
if (f == L"*.*" || f == L"*")
{
ShowAllFiles = true;
break;
}
}
}
示例6: QueryFileNames
void CDrop::QueryFileNames(UStringVector &fileNames)
{
fileNames.Clear();
UINT numFiles = QueryCountOfFiles();
fileNames.Reserve(numFiles);
for(UINT i = 0; i < numFiles; i++)
fileNames.Add(QueryFileName(i));
}
示例7: ReadStringList
static void ReadStringList(LPCTSTR valueName, UStringVector &folders)
{
folders.Clear();
NSynchronization::CCriticalSectionLock lock(g_CS);
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
key.GetValue_Strings(valueName, folders);
}
示例8: SortStrings
void SortStrings(const UStringVector &src, UStringVector &dest)
{
CIntVector indices;
SortStringsToIndices(src, indices);
dest.Clear();
dest.Reserve(indices.Size());
for (int i = 0; i < indices.Size(); i++)
dest.Add(src[indices[i]]);
}
示例9: GetArguments
static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts)
{
parts.Clear();
for(int i = 0; i < numArguments; i++)
{
UString s = MultiByteToUnicodeString(arguments[i]);
parts.Add(s);
}
}
示例10: mySplitCommandLine
void mySplitCommandLine(int numArguments,const char *arguments[],UStringVector &parts) {
{ // define P7ZIP_HOME_DIR
static char p7zip_home_dir[MAX_PATH];
AString dir,name;
my_windows_split_path(arguments[0],dir,name);
snprintf(p7zip_home_dir,sizeof(p7zip_home_dir),"P7ZIP_HOME_DIR=%s/",(const char *)dir);
p7zip_home_dir[sizeof(p7zip_home_dir)-1] = 0;
putenv(p7zip_home_dir);
}
#ifdef ENV_HAVE_LOCALE
// set the program's current locale from the user's environment variables
setlocale(LC_ALL,"");
// auto-detect which conversion p7zip should use
char *locale = setlocale(LC_CTYPE,0);
if (locale) {
size_t len = strlen(locale);
char *locale_upper = (char *)malloc(len+1);
if (locale_upper) {
strcpy(locale_upper,locale);
for(size_t i=0;i<len;i++)
locale_upper[i] = toupper(locale_upper[i] & 255);
if ( (strcmp(locale_upper,"") != 0)
&& (strcmp(locale_upper,"C") != 0)
&& (strcmp(locale_upper,"POSIX") != 0) ) {
global_use_utf16_conversion = 1;
}
free(locale_upper);
}
}
#elif defined(LOCALE_IS_UTF8)
global_use_utf16_conversion = 1; // assume LC_CTYPE="utf8"
#else
global_use_utf16_conversion = 0; // assume LC_CTYPE="C"
#endif
parts.Clear();
for(int ind=0;ind < numArguments; ind++) {
if ((ind <= 2) && (strcmp(arguments[ind],"-no-utf16") == 0)) {
global_use_utf16_conversion = 0;
} else if ((ind <= 2) && (strcmp(arguments[ind],"-utf16") == 0)) {
global_use_utf16_conversion = 1;
} else {
UString tmp = MultiByteToUnicodeString(arguments[ind]);
// tmp.Trim(); " " is a valid filename ...
if (!tmp.IsEmpty()) {
parts.Add(tmp);
}
}
}
}
示例11: GetPathParts
void CProxyFolder::GetPathParts(UStringVector &pathParts) const
{
pathParts.Clear();
const CProxyFolder *current = this;
while (current->Parent != NULL)
{
pathParts.Insert(0, current->Name);
current = current->Parent;
}
}
示例12: mySplitCommandLineW
void mySplitCommandLineW(int numArguments, TCHAR **arguments,UStringVector &parts) {
parts.Clear();
for(int ind=0;ind < numArguments; ind++) {
UString tmp = arguments[ind];
// tmp.Trim(); " " is a valid filename ...
if (!tmp.IsEmpty()) {
parts.Add(tmp);
}
}
}
示例13: GetDirPathParts
void CProxyArc::GetDirPathParts(int dirIndex, UStringVector &pathParts) const
{
pathParts.Clear();
while (dirIndex >= 0)
{
const CProxyDir &dir = Dirs[dirIndex];
dirIndex = dir.ParentDir;
if (dirIndex < 0)
break;
pathParts.Insert(0, dir.Name);
}
}
示例14: GetFilePaths
void CContentsView::GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths, bool allowFolders)
{
const UString prefix = GetFsPath();
FOR_VECTOR (i, indices)
{
int index = indices[i];
if (!allowFolders && IsItem_Folder(index))
{
paths.Clear();
break;
}
paths.Add(prefix + GetItemRelPath2(index));
}
示例15: SplitCommandLine
void SplitCommandLine(const UString &s, UStringVector &parts)
{
UString sTemp = s;
sTemp.Trim();
parts.Clear();
for (;;)
{
UString s1, s2;
if (SplitCommandLine(sTemp, s1, s2))
parts.Add(s1);
if (s2.IsEmpty())
break;
sTemp = s2;
}
}