本文整理汇总了C++中UnicodeString::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::Clear方法的具体用法?C++ UnicodeString::Clear怎么用?C++ UnicodeString::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFileFileInfoString
UnicodeString TConfiguration::GetFileFileInfoString(const UnicodeString & AKey,
const UnicodeString & AFileName, bool AllowEmpty) const
{
TGuard Guard(FCriticalSection);
UnicodeString Result;
void * Info = GetFileApplicationInfo(AFileName);
SCOPE_EXIT
{
if (!AFileName.IsEmpty() && Info)
{
FreeFileInfo(Info);
}
};
if ((Info != nullptr) && (GetTranslationCount(Info) > 0))
{
TTranslation Translation = GetTranslation(Info, 0);
try
{
Result = ::GetFileInfoString(Info, Translation, AKey, AllowEmpty);
}
catch (const std::exception & e)
{
(void)e;
DEBUG_PRINTF("Error: %s", ::MB2W(e.what()).c_str());
Result.Clear();
}
}
else
{
assert(!AFileName.IsEmpty());
}
return Result;
}
示例2: OpenSessionInPutty
void OpenSessionInPutty(const UnicodeString & PuttyPath,
TSessionData * SessionData)
{
UnicodeString Program, Params, Dir;
SplitCommand(PuttyPath, Program, Params, Dir);
Program = ExpandEnvironmentVariables(Program);
if (FindFile(Program))
{
Params = ExpandEnvironmentVariables(Params);
UnicodeString Password = GetGUIConfiguration()->GetPuttyPassword() ? SessionData->GetPassword() : UnicodeString();
UnicodeString Psw = Password;
UnicodeString SessionName;
std::unique_ptr<TRegistryStorage> Storage(new TRegistryStorage(GetConfiguration()->GetPuttySessionsKey()));
Storage->SetAccessMode(smReadWrite);
// make it compatible with putty
Storage->SetMungeStringValues(false);
Storage->SetForceAnsi(true);
if (Storage->OpenRootKey(true))
{
if (Storage->KeyExists(SessionData->GetStorageKey()))
{
SessionName = SessionData->GetSessionName();
}
else
{
std::unique_ptr<TRegistryStorage> SourceStorage(new TRegistryStorage(GetConfiguration()->GetPuttySessionsKey()));
SourceStorage->SetMungeStringValues(false);
SourceStorage->SetForceAnsi(true);
if (SourceStorage->OpenSubKey(StoredSessions->GetDefaultSettings()->GetName(), false) &&
Storage->OpenSubKey(GetGUIConfiguration()->GetPuttySession(), true))
{
Storage->Copy(SourceStorage.get());
Storage->CloseSubKey();
}
std::unique_ptr<TSessionData> ExportData(new TSessionData(L""));
ExportData->Assign(SessionData);
ExportData->SetModified(true);
ExportData->SetName(GetGUIConfiguration()->GetPuttySession());
ExportData->SetPassword(L"");
if (SessionData->GetFSProtocol() == fsFTP)
{
if (GetGUIConfiguration()->GetTelnetForFtpInPutty())
{
ExportData->SetPuttyProtocol(PuttyTelnetProtocol);
ExportData->SetPortNumber(TelnetPortNumber);
// PuTTY does not allow -pw for telnet
Psw.Clear();
}
else
{
ExportData->SetPuttyProtocol(PuttySshProtocol);
ExportData->SetPortNumber(SshPortNumber);
}
}
ExportData->Save(Storage.get(), true);
SessionName = GetGUIConfiguration()->GetPuttySession();
}
}
if (!Params.IsEmpty())
{
Params += L" ";
}
if (!Psw.IsEmpty())
{
Params += FORMAT(L"-pw %s ", EscapePuttyCommandParam(Psw).c_str());
}
//Params += FORMAT(L"-load %s", EscapePuttyCommandParam(SessionName).c_str());
Params += FORMAT(L"-l %s ", EscapePuttyCommandParam(SessionData->GetUserNameExpanded()).c_str());
Params += FORMAT(L"-P %d ", SessionData->GetPortNumber());
Params += FORMAT(L"%s ", EscapePuttyCommandParam(SessionData->GetHostNameExpanded()).c_str());
if (!ExecuteShell(Program, Params))
{
throw Exception(FMTLOAD(EXECUTE_APP_ERROR, Program.c_str()));
}
}
else
{
throw Exception(FMTLOAD(FILE_NOT_FOUND, Program.c_str()));
}
}