本文整理汇总了C++中tstring::end方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::end方法的具体用法?C++ tstring::end怎么用?C++ tstring::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateSqlInsert
int CDBCommandBuilderBase::GenerateSqlInsert(const IDBRecord& rec, tstring& buffer)
{
buffer.append(TEXT("INSERT INTO "));
WrapperIdentifier(TableSchema_->DBName.c_str(), buffer);
buffer.append(TEXT(" ("));
for (int i = 0; i < TableSchema_->Columns.size(); ++i)
{
WrapperIdentifier(TableSchema_->Columns[i].DBName.c_str(), buffer);
buffer.append(TEXT(", "));
}
*(buffer.end() - 2) = ')';
buffer.append(TEXT("VALUES ("));
for (int i = 0; i < TableSchema_->Columns.size(); ++i)
{
WrapperValue(rec.GetField(i).c_str(), TableSchema_->Columns[i].DBType, buffer);
buffer.append(TEXT(", "));
}
*(buffer.end() - 2) = ')';
return 1;
}
示例2: format_rate
tstring format_rate(const IQuotesProvider *pProvider, MCONTACT hContact, const tstring &rsFrmt)
{
tstring sResult;
for (tstring::const_iterator i = rsFrmt.begin(); i != rsFrmt.end();) {
TCHAR chr = *i;
switch (chr) {
default:
sResult += chr;
++i;
break;
case _T('\\'):
++i;
if (i != rsFrmt.end()) {
TCHAR t = *i;
switch (t) {
case _T('%'): sResult += _T("%"); break;
case _T('t'): sResult += _T("\t"); break;
case _T('n'): sResult += _T("\n"); break;
case _T('\\'): sResult += _T("\\"); break;
default: sResult += chr; sResult += t; break;
}
++i;
}
else sResult += chr;
break;
case _T('%'):
++i;
if (i != rsFrmt.end()) {
chr = *i;
byte nWidth = 0;
if (::isdigit(chr)) {
nWidth = chr - 0x30;
++i;
if (i == rsFrmt.end()) {
sResult += chr;
break;
}
else chr = *i;
}
CQuotesProviderVisitorFormater visitor(hContact, chr, nWidth);
pProvider->Accept(visitor);
const tstring& s = visitor.GetResult();
sResult += s;
++i;
}
else sResult += chr;
break;
}
}
return sResult;
}
示例3: tstring
tstring nf::Parser::ExtractPrefix(tstring const &CommandString)
{
//можем обойтись без регулярного выражения
if (CommandString.empty()) return _T("");
tstring::const_iterator p = std::find(++CommandString.begin(), CommandString.end(), _T(':'));
if (p == CommandString.end()) return _T("");
return tstring(CommandString.begin(), p + 1);
}
示例4: ToWString
std::wstring SystemWindowsClass::ToWString(const tstring &s)
#endif
{
#ifdef _UNICODE
string
#else
wstring
#endif
result(s.begin(), s.end());
// copy from one to another
result.assign(s.begin(), s.end());
return result;
}
示例5: FormatChatLine
void ChatCtrl::FormatChatLine(const tstring& sMyNick, tstring& sText, CHARFORMAT2& cf, bool isMyMessage, const tstring& sAuthor, LONG lSelBegin, bool bUseEmo) {
// Set text format
tstring sMsgLower(sText.length(), NULL);
std::transform(sText.begin(), sText.end(), sMsgLower.begin(), _totlower);
LONG lSelEnd = lSelBegin + sText.size();
SetSel(lSelBegin, lSelEnd);
SetSelectionCharFormat(isMyMessage ? WinUtil::m_ChatTextMyOwn : cf);
// highlight all occurences of my nick
long lMyNickStart = -1, lMyNickEnd = -1;
size_t lSearchFrom = 0;
tstring sNick(sMyNick.length(), NULL);
std::transform(sMyNick.begin(), sMyNick.end(), sNick.begin(), _totlower);
bool found = false;
while((lMyNickStart = sMsgLower.find(sNick, lSearchFrom)) != tstring::npos) {
lMyNickEnd = lMyNickStart + (long)sNick.size();
SetSel(lSelBegin + lMyNickStart, lSelBegin + lMyNickEnd);
SetSelectionCharFormat(WinUtil::m_TextStyleMyNick);
lSearchFrom = lMyNickEnd;
found = true;
}
if(found) {
if( !SETTING(CHATNAMEFILE).empty() && !BOOLSETTING(SOUNDS_DISABLED) &&
!sAuthor.empty() && (stricmp(sAuthor.c_str(), sNick) != 0)) {
::PlaySound(Text::toT(SETTING(CHATNAMEFILE)).c_str(), NULL, SND_FILENAME | SND_ASYNC);
}
}
// highlight all occurences of favourite users' nicks
FavoriteManager::FavoriteMap ul = FavoriteManager::getInstance()->getFavoriteUsers();
for(FavoriteManager::FavoriteMap::const_iterator i = ul.begin(); i != ul.end(); ++i) {
const FavoriteUser& pUser = i->second;
lSearchFrom = 0;
sNick = Text::toT(pUser.getNick());
std::transform(sNick.begin(), sNick.end(), sNick.begin(), _totlower);
while((lMyNickStart = sMsgLower.find(sNick, lSearchFrom)) != tstring::npos) {
lMyNickEnd = lMyNickStart + (long)sNick.size();
SetSel(lSelBegin + lMyNickStart, lSelBegin + lMyNickEnd);
SetSelectionCharFormat(WinUtil::m_TextStyleFavUsers);
lSearchFrom = lMyNickEnd;
}
}
// Links and smilies
FormatEmoticonsAndLinks(sText, sMsgLower, lSelBegin, bUseEmo);
}
示例6: PostProcessSummary
void XmlTreeView::PostProcessSummary(tstring& str)
{
// Replace empty strings.
if (str.empty())
{
str = TXT("(empty)");
return;
}
bool bWhitespaceOnly = true;
// Find if only whitespace characters.
for (tstring::const_iterator it = str.begin(); ((it != str.end()) && bWhitespaceOnly); ++it)
{
if (!tisspace(static_cast<utchar>(*it)))
bWhitespaceOnly = false;
}
// Replace "invisible" strings.
if (bWhitespaceOnly)
{
str = TXT("(whitespace)");
return;
}
// Trim string.
if (str.length() > App.m_nDefMaxItemLen)
{
str.erase(App.m_nDefMaxItemLen, str.length()-App.m_nDefMaxItemLen);
str += TXT("...");
}
}
示例7: SaveLevel
void EditorLoader::SaveLevel(const tstring& fileName)
{
if (fileName != _T(""))
{
string s(fileName.begin(), fileName.end());
m_pLevel->Serialize(s);
}
}
示例8: Register
// HKEY_CLASSES_ROOT
// FileMarker.AVI - AVI - Windows 기본 비디오 파일
// shell
// Mark - Daum 팟플레이어의 재생목록(&I)에 추가하기
// command - "C:\Program Files (x86)\DAUM\PotPlayer\PotPlayer.exe" "%1" /ADD
bool CRegisterMenu::Register(const tstring& strAppName, tstring strExt,
tstring strMenu, tstring strMenuDisplay,
tstring strCommand, tstring strDesc)
{
if (strAppName.empty() || strExt.empty() || strDesc.empty() ||
strMenu.empty() || strMenuDisplay.empty() || strCommand.empty())
return false;
if (!RegisterExtKey(strExt, strMenu, strMenuDisplay, strCommand))
return false;
// remove '.'
strExt.erase(std::remove(strExt.begin(), strExt.end(), _T('.')), strExt.end());
// Uppercase extension
CStringUtil::MakeUpper(strExt);
tstring strAppExt = strAppName + _T(".") + strExt;
LPCTSTR strSubKeys[] = { strAppExt.c_str(),
_T("shell"),
strMenu.c_str(),
_T("command") };
LPCTSTR strValues[] = { strDesc.c_str(),
_T(""),
strMenuDisplay.c_str(),
strCommand.c_str() };
tstring strSubKey;
tstring strValue;
for (int i = 0; i < _countof(strSubKeys); ++i)
{
strSubKey += strSubKeys[i];
strSubKey += _T("\\");
strValue = strValues[i];
if (!RegisterMenu(strSubKey, strValue))
return false;
}
// SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, NULL, NULL);
return true;
}
示例9: TXOwl
void
TLvColumn::SetText(const tstring& text)
{
if (!IsRepresentable<int>(text.size() + 1))
throw TXOwl(_T("TLvColumn::SetText: The text argument is too large (>INT_MAX)"));
Buffer.assign(text.begin(), text.end());
Buffer.push_back(_T('\0'));
SetTextBuffer(&Buffer[0], static_cast<int>(Buffer.size()));
}
示例10: GetDefaultLanguage
std::string GetDefaultLanguage()
{
static std::string language;
if (language.empty())
{
const tstring tLanguage = GetString(IDS_LANGUAGE);
language.assign(tLanguage.begin(), tLanguage.end());
}
return language;
}
示例11: UnRegister
bool CRegisterMenu::UnRegister(tstring strAppName, tstring strExt, tstring strMenu)
{
if ( strAppName.empty()
|| strExt.empty()
|| strMenu.empty())
return false;
if (!UnRegisterExtKey(strExt, strMenu))
{
return false;
}
// remove '.'
strExt.erase(std::remove(strExt.begin(), strExt.end(), _T('.')), strExt.end());
// Uppercase extension
CStringUtil::MakeUpper(strExt);
tstring strAppExt = strAppName + _T(".") + strExt;
return UnRegisterMenu(strAppExt);
}
示例12:
void litehtml::css_length::fromString( const tstring& str, const tstring& predefs, int defValue )
{
// TODO: Make support for calc
if(str.substr(0, 4) == _t("calc"))
{
m_is_predefined = true;
m_predef = 0;
return;
}
int predef = value_index(str.c_str(), predefs.c_str(), -1);
if(predef >= 0)
{
m_is_predefined = true;
m_predef = predef;
} else
{
m_is_predefined = false;
tstring num;
tstring un;
bool is_unit = false;
for(tstring::const_iterator chr = str.begin(); chr != str.end(); chr++)
{
if(!is_unit)
{
if(t_isdigit(*chr) || *chr == _t('.') || *chr == _t('+') || *chr == _t('-'))
{
num += *chr;
} else
{
is_unit = true;
}
}
if(is_unit)
{
un += *chr;
}
}
if(!num.empty())
{
m_value = (float) t_strtod(num.c_str(), 0);
m_units = (css_units) value_index(un.c_str(), css_units_strings, css_units_none);
} else
{
// not a number so it is predefined
m_is_predefined = true;
m_predef = defValue;
}
}
}
示例13: Colorize
void SystemFrame::Colorize(const tstring& line, LONG Begin){
tstring::const_iterator start = line.begin();
tstring::const_iterator end = line.end();
boost::match_results<tstring::const_iterator> result;
int pos=0;
while(boost::regex_search(start, end, result, reg, boost::match_default)) {
ctrlPad.SetSel(pos + Begin + result.position(), pos + Begin + result.position() + result.length());
ctrlPad.SetSelectionCharFormat(WinUtil::m_ChatTextServer);
start = result[0].second;
pos=pos+result.position() + result.length();
}
}
示例14: escapeUnicode
string ChatCtrl::escapeUnicode(tstring str) {
TCHAR buf[8];
memzero(buf, sizeof(buf));
int dist = 0;
tstring::iterator i;
while((i = std::find_if(str.begin() + dist, str.end(), std::bind2nd(std::greater<TCHAR>(), 0x7f))) != str.end()) {
dist = (i+1) - str.begin(); // Random Acess iterators FTW
snwprintf(buf, sizeof(buf), _T("%hd"), int(*i));
str.replace(i, i+1, _T("\\ud\\u") + tstring(buf) + _T("?"));
memzero(buf, sizeof(buf));
}
return Text::fromT(str);
}
示例15: GenerateConditionStr
void CDBCommandBuilderBase::GenerateConditionStr(const IDBRecord& rec, const CDBRecordComparison& cmp, tstring& buffer)
{
if(cmp.KeyFields().size() > 0)
{
buffer.append(TEXT(" WHERE "));
for (int i = 0; i < cmp.KeyFields().size(); ++i)
{
int field = cmp.KeyFields()[i];
GenerateFieldConditionStr((*TableSchema_)[field], rec.GetField(field), buffer);
buffer.append(TEXT(" AND "));
}
*(buffer.end() - 4) = '\0';
}
}