本文整理汇总了C++中UString::Add_Space_if_NotEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::Add_Space_if_NotEmpty方法的具体用法?C++ UString::Add_Space_if_NotEmpty怎么用?C++ UString::Add_Space_if_NotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UString
的用法示例。
在下文中一共展示了UString::Add_Space_if_NotEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitDialog
BOOL CLangPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
UString temp = NWindows::MyLoadString(IDS_LANG_ENGLISH);
NativeLangString(temp, NWindows::MyLoadString(IDS_LANG_NATIVE));
int index = (int)m_cmbLang.AddString(GetSystemString(temp));
m_cmbLang.SetItemData(index, _paths.Size());
_paths.Add(L"-");
m_cmbLang.SetCurSel(0);
const FString dirPrefix = GetLangDirPrefix();
NWindows::NFile::NFind::CEnumerator enumerator(dirPrefix + FTEXT("*.txt"));
NWindows::NFile::NFind::CFileInfo fi;
CLang lang;
UString error;
while (enumerator.Next(fi))
{
if (fi.IsDir())
continue;
const int kExtSize = 4;
if (fi.Name.Len() < kExtSize)
continue;
unsigned pos = fi.Name.Len() - kExtSize;
if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".txt"))
continue;
if (!LangOpen(lang, dirPrefix + fi.Name))
{
error.Add_Space_if_NotEmpty();
error += fs2us(fi.Name);
continue;
}
const UString shortName = fs2us(fi.Name.Left(pos));
UString s = shortName;
const wchar_t *eng = lang.Get(IDS_LANG_ENGLISH);
if (eng)
s = eng;
const wchar_t *native = lang.Get(IDS_LANG_NATIVE);
if (native)
NativeLangString(s, native);
index = (int)m_cmbLang.AddString(GetSystemString(s));
m_cmbLang.SetItemData(index, _paths.Size());
_paths.Add(shortName);
if (g_LangID.IsEqualTo_NoCase(shortName))
m_cmbLang.SetCurSel(index);
}
if (!error.IsEmpty())
::MessageBoxW(m_hWnd, error, L"Error in Lang file", MB_ICONERROR);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例2: OnInit
bool CLangPage::OnInit()
{
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
_langCombo.Attach(GetItem(IDC_LANG_LANG));
UString temp = MyLoadString(IDS_LANG_ENGLISH);
NativeLangString(temp, MyLoadString(IDS_LANG_NATIVE));
int index = (int)_langCombo.AddString(temp);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(L"-");
_langCombo.SetCurSel(0);
const FString dirPrefix = GetLangDirPrefix();
NFile::NFind::CEnumerator enumerator(dirPrefix + FTEXT("*.txt"));
NFile::NFind::CFileInfo fi;
CLang lang;
UString error;
while (enumerator.Next(fi))
{
if (fi.IsDir())
continue;
const int kExtSize = 4;
if (fi.Name.Len() < kExtSize)
continue;
unsigned pos = fi.Name.Len() - kExtSize;
if (!StringsAreEqualNoCase_Ascii(fi.Name.Ptr(pos), ".txt"))
continue;
if (!LangOpen(lang, dirPrefix + fi.Name))
{
error.Add_Space_if_NotEmpty();
error += fs2us(fi.Name);
continue;
}
const UString shortName = fs2us(fi.Name.Left(pos));
UString s = shortName;
const wchar_t *eng = lang.Get(IDS_LANG_ENGLISH);
if (eng)
s = eng;
const wchar_t *native = lang.Get(IDS_LANG_NATIVE);
if (native)
NativeLangString(s, native);
index = (int)_langCombo.AddString(s);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(shortName);
if (g_LangID.IsEqualTo_NoCase(shortName))
_langCombo.SetCurSel(index);
}
if (!error.IsEmpty())
MessageBoxW(0, error, L"Error in Lang file", MB_ICONERROR);
return CPropertyPage::OnInit();
}
示例3: SetStatus
void CThreadCrc::SetStatus(const UString &s2)
{
UString s = s2;
if (!Enumerator.BasePrefix.IsEmpty())
{
s.Add_Space_if_NotEmpty();
s += fs2us(Enumerator.BasePrefix);
}
ProgressDialog.Sync.Set_Status(s);
}