本文整理汇总了C++中tstring::at方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::at方法的具体用法?C++ tstring::at怎么用?C++ tstring::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::at方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IocpServerTransport
Win32NamedPipeServerTransport::Win32NamedPipeServerTransport(
const tstring & pipeName) :
IocpServerTransport(),
mpSec(RCF_DEFAULT_INIT),
mQueuedAccepts(RCF_DEFAULT_INIT),
mPipeNameLock(INVALID_HANDLE_VALUE)
{
if (pipeName.empty())
{
// Generate a pipe name dynamically, that won't conflict with any
// other test executables that may be running concurrently.
std::pair<tstring, HANDLE> pipeAndHandle = generateNewPipeName();
mPipeName = pipeAndHandle.first + RCF_T("_0");
mPipeNameLock = pipeAndHandle.second;
}
else
{
if (pipeName.at(0) == RCF_T('\\'))
{
mPipeName = pipeName;
}
else
{
mPipeName = RCF_T("\\\\.\\pipe\\") + pipeName;
}
}
}
示例2:
void litehtml::el_before_after_base::add_text( const tstring& txt )
{
tstring word;
tstring esc;
for(tstring::size_type i = 0; i < txt.length(); i++)
{
if( (txt.at(i) == _t(' ')) || (txt.at(i) == _t('\t')) || (txt.at(i) == _t('\\') && !esc.empty()) )
{
if(esc.empty())
{
if(!word.empty())
{
element::ptr el = std::make_shared<el_text>(word.c_str(), get_document());
appendChild(el);
word.clear();
}
element::ptr el = std::make_shared<el_space>(txt.substr(i, 1).c_str(), get_document());
appendChild(el);
} else
{
word += convert_escape(esc.c_str() + 1);
esc.clear();
if(txt.at(i) == _t('\\'))
{
esc += txt.at(i);
}
}
} else
{
if(!esc.empty() || txt.at(i) == _t('\\'))
{
esc += txt.at(i);
} else
{
word += txt.at(i);
}
}
}
if(!esc.empty())
{
word += convert_escape(esc.c_str() + 1);
}
if(!word.empty())
{
element::ptr el = std::make_shared<el_text>(word.c_str(), get_document());
appendChild(el);
word.clear();
}
}
示例3: GetFiles
void GetFiles(const tstring& path, vector<tstring>& files, const tstring& mask /* = string() */)
{
tstring root = path;
const TCHAR ch = path.at(path.length() - 1);
if (TEXT('\\') != ch)
{
root += TEXT('\\');
}
tstring pattern;
if (mask.empty())
{
pattern = root + TEXT('*');
}
else
{
pattern = root + mask;
}
WIN32_FIND_DATA data;
ZeroMemory(&data, sizeof(data));
HANDLE handle = FindFirstFile(pattern.c_str(), &data);
if (INVALID_HANDLE_VALUE == handle)
{
return;
}
try
{
for (BOOL status = TRUE; status; status = FindNextFile(handle, &data))
{
tstring st = data.cFileName;
if ((TEXT(".") == st) || (TEXT("..") == st))
{
continue;
}
if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
files.push_back(root + st);
}
}
FindClose(handle);
}
catch (const bad_alloc&)
{
FindClose(handle);
throw;
}
}
示例4: OnResponse
void CFTPProtocolOutput::OnResponse(const tstring& strResponse)
{
if( strResponse.length()==0 )
return;
COLORREF crText = RGB(0, 150, 0);
switch( strResponse.at(0) )
{
case _T('4'):
crText = RGB(200, 200, 0);
break;
case _T('5'):
crText = RGB(255, 0, 0);
break;
}
WriteLine(_T("< ") + CString(strResponse.c_str()) + _T("\n"), crText);
}