本文整理汇总了C++中TSTRING函数的典型用法代码示例。如果您正苦于以下问题:C++ TSTRING函数的具体用法?C++ TSTRING怎么用?C++ TSTRING使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TSTRING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// !SMT!-S
LRESULT UsersFrame::onIgnorePrivate(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
int i = -1;
while ((i = ctrlUsers.GetNextItem(i, LVNI_SELECTED)) != -1)
{
UserInfo *ui = ctrlUsers.getItemData(i);
FavoriteManager::getInstance()->setNormalPM(ui->getUser());
ui->columns[COLUMN_IGNORE].clear();
switch (wID)
{
case IDC_PM_IGNORED:
ui->columns[COLUMN_IGNORE] = TSTRING(IGNORE_S);
FavoriteManager::getInstance()->setIgnorePM(ui->getUser(), true);
break;
case IDC_PM_FREE:
ui->columns[COLUMN_IGNORE] = TSTRING(FREE_PM_ACCESS);
FavoriteManager::getInstance()->setFreePM(ui->getUser(), true);
break;
};
updateUser(ui->getUser());
ctrlUsers.updateItem(i);
}
return 0;
}
示例2: getValues
LRESULT FulHighlightDialog::onOk(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/){
try{
getValues();
}catch(...) {
WinUtil::showMessageBox(TSTRING(BAD_REGEXP), MB_OK | MB_ICONEXCLAMATION);
return TRUE;
}
if(cs.getMatch().empty()){
WinUtil::showMessageBox(TSTRING(ADD_EMPTY), MB_OK | MB_ICONEXCLAMATION);
return TRUE;
}
if(cs.getMatch().find(_T("$Re:")) == 0) {
string str1 = "^$";
string str2 = (Text::fromT(cs.getMatch())).substr(4);
try {
boost::regex reg(str1);
if(boost::regex_search(str2.begin(), str2.end(), reg)){
//....
}
} catch(...) {
WinUtil::showMessageBox(TSTRING(BAD_REGEXP), MB_ICONEXCLAMATION);
return TRUE;
}
}
EndDialog(IDOK);
return 0;
}
示例3: _T
uint64_t UserInfoSimple::inputSlotTime()
{
static tstring deftext = _T("00:30");
LineDlg dlg;
dlg.description = TSTRING(EXTRA_SLOT_TIME_FORMAT);
dlg.title = TSTRING(EXTRA_SLOT_TIMEOUT);
dlg.line = deftext;
if (dlg.DoModal() == IDOK)
{
deftext = dlg.line;
unsigned int n = 0;
for (size_t i = 0; i < deftext.length(); i++) // TODO: cleanup.
{
if (deftext[i] == L':') n++;
}
unsigned int d, h, m;
switch (n)
{
case 1:
if (swscanf(deftext.c_str(), L"%u:%u", &h, &m) == 2)
return (h * 3600 + m * 60);
break;
case 2:
if (swscanf(deftext.c_str(), L"%u:%u:%u", &d, &h, &m) == 3)
return (d * 3600 * 24 + h * 3600 + m * 60);
break;
}
::MessageBox(GetForegroundWindow(), CTSTRING(INVALID_TIME_FORMAT), CTSTRING(ERRORS), MB_OK | MB_ICONERROR);
}
return 0;
}
示例4: TestStrings
void TestStrings()
{
cDebug d("TestStrings");
cFCOPropTSTRING pt1;
cFCOPropTSTRING pt2;
pt1.SetValue(TSTRING(_T("bar")));
pt2.SetValue(TSTRING(_T("foo")));
cFCOPropInt64 pi64;
pi64.SetValue(8675309);
d.TraceDebug(_T("property TSTRING = (should be \"bar\") %s\n"), pt1.AsString().c_str());
TEST(pt1.AsString() == "bar");
d.TraceDebug(_T("property TSTRING = (should be \"foo\") %s\n"), pt2.AsString().c_str());
TEST(pt2.AsString() == "foo");
d.TraceDebug("bar == foo = %d\n", pt1.Compare(&pt2, iFCOProp::OP_EQ));
TEST(iFCOProp::CMP_FALSE == pt1.Compare(&pt2, iFCOProp::OP_EQ));
d.TraceDebug("bar == bar = %d\n", pt1.Compare(&pt1, iFCOProp::OP_EQ));
TEST(iFCOProp::CMP_TRUE == pt1.Compare(&pt1, iFCOProp::OP_EQ));
d.TraceDebug("bar == 456 = %d\n", pt1.Compare(&pi64, iFCOProp::OP_EQ));
TEST(iFCOProp::CMP_WRONG_PROP_TYPE == pt1.Compare(&pi64, iFCOProp::OP_EQ));
d.TraceDebug("Leaving...\n");
return;
}
示例5: TSTRING
/// <summary>
/// <para name='Name'>SLog::getDateTimeString</para>
/// <para name='Purpose'>Return a formatted date time string</para>
/// </summary>
/// <param name='logFormat'>indicate whether to return the date time string in log format or decoration format</param>
/// <returns>a formatted date/time string</returns>
/// <remarks>
/// <para name='Notes'></para>
/// <para name='Author'>Kenn Guilstorf</para>
/// <para name='LastModified'>2015-10-26</para>
/// </remarks>
TSTRING SLog::getDateTimeString(bool logFormat)
{
TSTRING retValue;
TSTRING strFormat;
TCHAR* chBuffer = new TCHAR[50];
SYSTEMTIME st;
if (logFormat)
{
strFormat = TSTRING(_T("%04d-%02d-%02d %02d:%02d:%02d.%03d | "));
}
else
{
strFormat = TSTRING(_T(".%04d%02d%02d.%02d%02d%02d%03d"));
}
GetLocalTime(&st);
SPRINTF(chBuffer,
50,
strFormat.c_str(),
(int)st.wYear,
(int)st.wMonth,
(int)st.wDay,
(int)st.wHour,
(int)st.wMinute,
(int)st.wSecond,
(int)st.wMilliseconds);
retValue = TSTRING(chBuffer);
return retValue;
}
示例6: AppendPathSeparator
void SharePage::addDirectory(const tstring& aPath)
{
tstring path = aPath;
AppendPathSeparator(path);
//if (path.length()) //[+]PPA
// if (path[ path.length() - 1 ] != _T('\\'))
// path += _T('\\');
try
{
LineDlg virt;
virt.title = TSTRING(VIRTUAL_NAME);
virt.description = TSTRING(VIRTUAL_NAME_LONG);
virt.line = Text::toT(ShareManager::validateVirtual(
Util::getLastDir(Text::fromT(path))));
if (virt.DoModal(m_hWnd) == IDOK)
{
CWaitCursor l_cursor_wait; //-V808
ShareManager::getInstance()->addDirectory(Text::fromT(path), Text::fromT(virt.line), true);
int i = ctrlDirectories.insert(ctrlDirectories.GetItemCount(), virt.line);
ctrlDirectories.SetItemText(i, 1, path.c_str());
ctrlDirectories.SetItemText(i, 2, Util::formatBytesW(ShareManager::getShareSize(Text::fromT(path))).c_str());
ctrlTotal.SetWindowText(ShareManager::getShareSizeformatBytesW().c_str());
}
}
catch (const ShareException& e)
{
MessageBox(Text::toT(e.getError()).c_str(), T_APPNAME_WITH_VERSION, MB_ICONSTOP | MB_OK);
}
}
示例7: sizeof
LRESULT FavoriteDirsPage::onClickedRename(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
TCHAR buf[MAX_PATH];
LVITEM item = { 0 };
item.mask = LVIF_TEXT;
item.cchTextMax = sizeof(buf);
item.pszText = buf;
int i = -1;
while((i = ctrlDirectories.GetNextItem(i, LVNI_SELECTED)) != -1) {
item.iItem = i;
item.iSubItem = 0;
ctrlDirectories.GetItem(&item);
LineDlg virt;
virt.title = TSTRING(FAVORITE_DIR_NAME);
virt.description = TSTRING(FAVORITE_DIR_NAME_LONG);
virt.line = tstring(buf);
if(virt.DoModal(m_hWnd) == IDOK) {
if (FavoriteManager::getInstance()->renameFavoriteDir(Text::fromT(buf), Text::fromT(virt.line))) {
ctrlDirectories.SetItemText(i, 0, virt.line.c_str());
} else {
MessageBox(CTSTRING(DIRECTORY_ADD_ERROR));
}
}
}
return 0;
}
示例8: setHelpId
bool SettingsDialog::initDialog() {
// set this to IDH_STARTPAGE so that clicking in an empty space of the dialog generates a WM_HELP message with no error; then SettingsDialog::handleHelp will convert IDH_STARTPAGE to the current page's help id
setHelpId(IDH_STARTPAGE);
WinUtil::setHelpIds(this, helpItems);
setText(T_("Settings"));
attachChild(pageTree, IDC_SETTINGS_PAGES);
pageTree->onSelectionChanged(std::tr1::bind(&SettingsDialog::handleSelectionChanged, this));
{
ButtonPtr button = attachChild<Button>(IDOK);
button->setText(T_("OK"));
button->onClicked(std::tr1::bind(&SettingsDialog::handleOKClicked, this));
button = attachChild<Button>(IDCANCEL);
button->setText(T_("Cancel"));
button->onClicked(std::tr1::bind(&SettingsDialog::endDialog, this, IDCANCEL));
button = attachChild<Button>(IDHELP);
button->setText(T_("Help"));
button->onClicked(std::tr1::bind(&SettingsDialog::handleHelp, this, handle(), IDH_STARTPAGE));
}
addPage(T_("Personal information"), new GeneralPage(this));
addPage(T_("Connection settings"), new NetworkPage(this));
{
HTREEITEM item = addPage(T_("Downloads"), new DownloadPage(this));
addPage(T_("Favorites"), new FavoriteDirsPage(this), item);
addPage(T_("Queue"), new QueuePage(this), item);
}
addPage(T_("Sharing"), new UploadPage(this));
{
HTREEITEM item = addPage(T_("Appearance"), new AppearancePage(this));
addPage(T_("Colors and sounds"), new Appearance2Page(this), item);
addPage(T_("Tabs"), new TabsPage(this), item);
addPage(T_("Windows"), new WindowsPage(this), item);
}
{
HTREEITEM item = addPage(T_("Advanced"), new AdvancedPage(this));
addPage(T_("Logs"), new LogPage(this), item);
addPage(T_("Experts only"), new Advanced3Page(this), item);
addPage(T_("User Commands"), new UCPage(this), item);
addPage(T_("Security Certificates"), new CertificatesPage(this), item);
}
addPage(TSTRING(SETTINGS_APPEARANCE_PAGE), new FdmAppearancePage(this));
addPage(TSTRING(SETTINGS_BANDWIDTH), new BandwidthLimitPage(this));
addPage(TSTRING(SETTINGS_SPAM), new FdmSpamPage(this));
updateTitle();
return false;
}
示例9: callAsync
void PublicHubsFrame::on(Corrupted, const string& l) noexcept {
if (l.empty()) {
callAsync([=] { onFinished(TSTRING(HUBLIST_CACHE_CORRUPTED)); });
} else {
callAsync([=] { onFinished(TSTRING(HUBLIST_DOWNLOAD_CORRUPTED) + _T(" (") + Text::toT(l) + _T(")")); });
}
}
示例10: switch
tstring ADLSearch::SourceTypeToDisplayString(SourceType t) {
switch(t) {
default:
case OnlyFile: return TSTRING(FILENAME);
case OnlyDirectory: return TSTRING(DIRECTORY);
case FullPath: return TSTRING(ADLS_FULL_PATH);
}
}
示例11: TSTRING
void PopupManager::ShowPm(const tstring& nick, const tstring& msg, HWND owner){
int pos = msg.find_first_of(_T(">"))+1;
if(pos == tstring::npos )
pos = 0;
tstring s = TSTRING(POPUP_NEW_PM) + _T(" ") + nick + _T(" ") + TSTRING(POPUP_MSG) + msg.substr(pos);
Show(s, owner);
}
示例12: TSTRING
void ListFilter::addMethodBox(HWND parent) {
RECT rc = { 0, 0, 100, 110 };
method.Create(parent, rc, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL |
WS_VSCROLL | CBS_DROPDOWNLIST, WS_EX_CLIENTEDGE);
method.SetFont(WinUtil::systemFont);
tstring methods[StringMatch::METHOD_LAST] = { TSTRING(PARTIAL_MATCH), TSTRING(REGULAR_EXPRESSION), TSTRING(WILDCARD), TSTRING(EXACT_MATCH) };
for(auto& str : methods)
method.AddString(str.c_str());
method.SetCurSel(defMethod);
}
示例13: buf
LRESULT SharePage::onClickedRename(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
AutoArray <TCHAR> buf(FULL_MAX_PATH);
LVITEM item = {0};
item.mask = LVIF_TEXT;
item.cchTextMax = FULL_MAX_PATH;
item.pszText = buf.data();
bool setDirty = false;
int i = -1;
while ((i = ctrlDirectories.GetNextItem(i, LVNI_SELECTED)) != -1)
{
item.iItem = i;
item.iSubItem = 0;
ctrlDirectories.GetItem(&item);
tstring vName = buf.data();
item.iSubItem = 1;
ctrlDirectories.GetItem(&item);
tstring rPath = buf.data();
try
{
LineDlg virt;
virt.title = TSTRING(VIRTUAL_NAME);
virt.description = TSTRING(VIRTUAL_NAME_LONG);
virt.line = vName;
if (virt.DoModal(m_hWnd) == IDOK)
{
if (stricmp(buf.data(), virt.line) != 0)
{
ShareManager::getInstance()->renameDirectory(Text::fromT(rPath), Text::fromT(virt.line));
ctrlDirectories.SetItemText(i, 0, virt.line.c_str());
setDirty = true;
}
else
{
MessageBox(CTSTRING(SKIP_RENAME), T_APPNAME_WITH_VERSION, MB_ICONINFORMATION | MB_OK);
}
}
}
catch (const ShareException& e)
{
MessageBox(Text::toT(e.getError()).c_str(), T_APPNAME_WITH_VERSION, MB_ICONSTOP | MB_OK);
}
}
if (setDirty)
ShareManager::getInstance()->setDirty();
return 0;
}
示例14: TSTRING
void UsersFrame::UserInfo::update(const FavoriteUser& u) {
columns[COLUMN_NICK] = Text::toT(u.getNick());
columns[COLUMN_HUB] = user->isOnline() ? WinUtil::getHubNames(u.getUser()).first : Text::toT(u.getUrl());
columns[COLUMN_SEEN] = user->isOnline() ? TSTRING(ONLINE) : Text::toT(Util::formatTime("%Y-%m-%d %H:%M", u.getLastSeen()));
columns[COLUMN_DESCRIPTION] = Text::toT(u.getDescription());
columns[COLUMN_CID] = Text::toT(u.getUser()->getCID().toBase32());
}
示例15: dcassert
const tstring FinishedItem::getText(uint8_t col) const {
dcassert(col >= 0 && col < COLUMN_LAST);
switch(col) {
case COLUMN_FILE: return Text::toT(Util::getFileName(getTarget()));
case COLUMN_DONE: return Text::toT(Util::formatTime("%Y-%m-%d %H:%M:%S", getTime()));
case COLUMN_PATH: return Text::toT(Util::getFilePath(getTarget()));
case COLUMN_NICK: return Text::toT(ClientManager::getInstance()->getFormatedNicks(getUser()));
case COLUMN_HUB: {
if (getUser().user->isOnline()) {
return Text::toT(ClientManager::getInstance()->getFormatedHubNames(getUser()));
} else {
auto ofu = ClientManager::getInstance()->getOfflineUser(getUser().user->getCID());
return TSTRING(OFFLINE) + (ofu ? _T(" ( ") + Text::toT(ofu->getUrl()) + _T(" ) ") : _T(""));
}
}
case COLUMN_SIZE: return Util::formatBytesW(getSize());
case COLUMN_SPEED: return Util::formatBytesW(getAvgSpeed()) + _T("/s");
case COLUMN_TYPE: {
tstring filetype = Text::toT(Util::getFileExt(Text::fromT(getText(COLUMN_FILE))));
if(!filetype.empty() && filetype[0] == _T('.'))
filetype.erase(0, 1);
return filetype;
}
default: return Util::emptyStringT;
}
}