本文整理汇总了C++中UString::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::Delete方法的具体用法?C++ UString::Delete怎么用?C++ UString::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UString
的用法示例。
在下文中一共展示了UString::Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetProperty
HRESULT CMultiMethodProps::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
{
UString name = nameSpec;
name.MakeLower_Ascii();
if (name.IsEmpty())
return E_INVALIDARG;
if (name[0] == 'x')
{
name.Delete(0);
_level = 9;
return ParsePropToUInt32(name, value, _level);
}
if (name.IsPrefixedBy_Ascii_NoCase("yx"))
{
name.Delete(0, 2);
UInt32 v = 9;
RINOK(ParsePropToUInt32(name, value, v));
_analysisLevel = (int)v;
return S_OK;
}
if (name.IsEqualTo("crc"))
{
name.Delete(0, 3);
_crcSize = 4;
return ParsePropToUInt32(name, value, _crcSize);
}
UInt32 number;
unsigned index = ParseStringToUInt32(name, number);
UString realName = name.Ptr(index);
if (index == 0)
{
if (name.IsPrefixedBy_Ascii_NoCase("mt"))
{
#ifndef _7ZIP_ST
RINOK(ParseMtProp(name.Ptr(2), value, _numProcessors, _numThreads));
#endif
return S_OK;
}
if (name.IsEqualTo("f"))
{
HRESULT res = PROPVARIANT_to_bool(value, _autoFilter);
if (res == S_OK)
return res;
if (value.vt != VT_BSTR)
return E_INVALIDARG;
return _filterMethod.ParseMethodFromPROPVARIANT(UString(), value);
}
number = 0;
}
if (number > 64)
return E_FAIL;
for (int j = _methods.Size(); j <= (int)number; j++)
_methods.Add(COneMethodInfo());
return _methods[number].ParseMethodFromPROPVARIANT(realName, value);
}
示例2: ResolveDotsFolders
static bool ResolveDotsFolders(UString &s)
{
#ifdef _WIN32
s.Replace(L'/', WCHAR_PATH_SEPARATOR);
#endif
for (int i = 0;;)
{
wchar_t c = s[i];
if (c == 0)
return true;
if (c == '.' && (i == 0 || s[i - 1] == WCHAR_PATH_SEPARATOR))
{
wchar_t c1 = s[i + 1];
if (c1 == '.')
{
wchar_t c2 = s[i + 2];
if (c2 == WCHAR_PATH_SEPARATOR || c2 == 0)
{
if (i == 0)
return false;
int k = i - 2;
for (; k >= 0; k--)
if (s[k] == WCHAR_PATH_SEPARATOR)
break;
unsigned num;
if (k >= 0)
{
num = i + 2 - k;
i = k;
}
else
{
num = (c2 == 0 ? (i + 2) : (i + 3));
i = 0;
}
s.Delete(i, num);
continue;
}
}
else
{
if (c1 == WCHAR_PATH_SEPARATOR || c1 == 0)
{
unsigned num = 2;
if (i != 0)
i--;
else if (c1 == 0)
num = 1;
s.Delete(i, num);
continue;
}
}
}
i++;
}
}
示例3: SetProperties
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
{
COM_TRY_BEGIN
_binds.Clear();
BeforeSetProperty();
for (int i = 0; i < numProperties; i++)
{
UString name = names[i];
name.MakeUpper();
if (name.IsEmpty())
return E_INVALIDARG;
const PROPVARIANT &value = values[i];
if (name[0] == 'B')
{
name.Delete(0);
CBind bind;
RINOK(GetBindInfo(name, bind));
_binds.Add(bind);
continue;
}
RINOK(SetProperty(name, value));
}
return S_OK;
COM_TRY_END
}
示例4: LoadFullPathAndShow
void CPanel::LoadFullPathAndShow()
{
LoadFullPath();
_appState->FolderHistory.AddString(_currentFolderPrefix);
_headerComboBox.SetText(_currentFolderPrefix);
#ifdef _WIN32 // FIXME
COMBOBOXEXITEM item;
item.mask = 0;
UString path = _currentFolderPrefix;
if (path.Length() > 3 && path[path.Length() - 1] == WCHAR_PATH_SEPARATOR)
path.Delete(path.Length() - 1);
CFileInfoW info;
DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
if (NFile::NFind::FindFile(path, info))
attrib = info.Attrib;
item.iImage = GetRealIconIndex(path, attrib);
if (item.iImage >= 0)
{
item.iSelectedImage = item.iImage;
item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
}
item.iItem = -1;
_headerComboBox.SetItem(&item);
#endif
RefreshTitle();
}
示例5: GetCorrectPath
UString GetCorrectPath(const UString &path)
{
UString result = path;
int first;
for (first = 0; first < result.Length(); first++)
if (result[first] != ' ')
break;
while(result.Length() > first)
{
if (
#ifdef _WIN32
result[first] == L'\\' ||
#endif
result[first] == L'/')
{
result.Delete(first);
continue;
}
break;
}
#ifdef _WIN32
result.Replace(L"..\\", L"");
#endif
result.Replace(L"../", L"");
ReplaceDisk(result);
return result;
}
示例6: OpenParentFolder
void CPanel::OpenParentFolder()
{
printf("CPanel::OpenParentFolder\n");
LoadFullPath(); // Maybe we don't need it ??
UString focucedName;
if (!_currentFolderPrefix.IsEmpty())
{
UString string = _currentFolderPrefix;
string.Delete(string.Length() - 1);
int pos = string.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0)
pos = 0;
else
pos++;
focucedName = string.Mid(pos);
}
printf("CPanel::OpenParentFolder focucedName=%ls\n",(const wchar_t *)focucedName);
CDisableTimerProcessing disableTimerProcessing1(*this);
CMyComPtr<IFolderFolder> newFolder;
_folder->BindToParentFolder(&newFolder);
if (newFolder)
_folder = newFolder;
else
{
if (_parentFolders.IsEmpty())
{
SetToRootFolder();
if (focucedName.IsEmpty())
focucedName = GetItemName(0);
}
else
{
_folder.Release();
_library.Free();
CFolderLink &link = _parentFolders.Back();
_folder = link.ParentFolder;
_library.Attach(link.Library.Detach());
focucedName = link.ItemName;
if (_parentFolders.Size () > 1)
OpenParentArchiveFolder();
_parentFolders.DeleteBack();
}
}
UStringVector selectedItems;
/*
if (!focucedName.IsEmpty())
selectedItems.Add(focucedName);
*/
LoadFullPath();
// ::SetCurrentDirectory(::_currentFolderPrefix);
RefreshListCtrl(focucedName, -1, true, selectedItems);
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
RefreshStatusBar();
printf("CPanel::OpenParentFolder-end\n");
}
示例7: ReduceString
static void ReduceString(UString &s)
{
const unsigned kMaxSize = 64;
if (s.Len() <= kMaxSize)
return;
s.Delete(kMaxSize / 2, s.Len() - kMaxSize);
s.Insert(kMaxSize / 2, L" ... ");
}
示例8: GetBindInfoPart
static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream)
{
stream = 0;
int index = ParseStringToUInt32(srcString, coder);
if (index == 0)
return E_INVALIDARG;
srcString.Delete(0, index);
if (srcString[0] == 'S')
{
srcString.Delete(0);
int index = ParseStringToUInt32(srcString, stream);
if (index == 0)
return E_INVALIDARG;
srcString.Delete(0, index);
}
return S_OK;
}
示例9: GetOSName2
UString GetOSName2(const UString &name)
{
if (name.IsEmpty())
return UString();
UString newName = GetOSName(name);
if (newName[newName.Length() - 1] == kOSDirDelimiter)
newName.Delete(newName.Length() - 1);
return newName;
}
示例10: AddName
static void AddName(UStringVector &strings, UString &s)
{
s.Trim();
if (s.Len() >= 2 && s[0] == kQuoteChar && s.Back() == kQuoteChar)
{
s.DeleteBack();
s.Delete(0);
}
if (!s.IsEmpty())
strings.Add(s);
}
示例11: GetBindInfo
static HRESULT GetBindInfo(UString &srcString, CBind &bind)
{
RINOK(GetBindInfoPart(srcString, bind.OutCoder, bind.OutStream));
if (srcString[0] != ':')
return E_INVALIDARG;
srcString.Delete(0);
RINOK(GetBindInfoPart(srcString, bind.InCoder, bind.InStream));
if (!srcString.IsEmpty())
return E_INVALIDARG;
return S_OK;
}
示例12: StripFile
// Strip the file name from the full path, keeping the trailing /
void StripFile(UString& path)
{
// remove file name
int last = path.ReverseFind(L'/');
if (last != -1) {
int namelen = path.Length() - last;
path.Delete(last + 1, namelen - 1);
} else {// file not directory
path.Empty();
}
}
示例13: ShowErrorMessageSpec
static void ShowErrorMessageSpec(const UString &name)
{
UString message = NError::MyFormatMessage(::GetLastError());
int pos = message.Find(L"%1");
if (pos >= 0)
{
message.Delete(pos, 2);
message.Insert(pos, name);
}
ShowErrorMessage(NULL, message);
}
示例14: AddMessage
void CMessagesDialog::AddMessage(LPCWSTR message)
{
UString s = message;
while (!s.IsEmpty())
{
int pos = s.Find(L'\n');
if (pos < 0)
break;
AddMessageDirect(s.Left(pos));
s.Delete(0, pos + 1);
}
AddMessageDirect(s);
}
示例15: ReplaceDisk
static void ReplaceDisk(UString &s)
{
int i;
for (i = 0; i < s.Length(); i++)
if (s[i] != ' ')
break;
if (s.Length() > i + 1)
{
if (s[i + 1] == L':')
{
s.Delete(i + 1);
// s.Insert(i + 1, L'_');
}
}
}