本文整理汇总了C++中tstring::find方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::find方法的具体用法?C++ tstring::find怎么用?C++ tstring::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tstring
的用法示例。
在下文中一共展示了tstring::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetObjectType
tstring GetObjectType(tstring s)
{
tstring Result;
tstring::size_type n = s.find('.');
if(n == tstring::npos)return Result;
n++;
tstring::size_type n1 =s.find(' ',n);
if(n1==tstring::npos)n1 = s.size();
tstring ext = s.substr(n,n1-n);
if(_tcsncmp(ext.c_str(),_T("ROOM"),4)==0)return _T("ROOM");
else if(_tcsncmp(ext.c_str(),_T("PEOPLE"),6))return _T("PEOPLE");
else if(_tcsncmp(ext.c_str(),_T("CONTAINER"),9))return _T("CONTAINER");
else {
SHFILEINFO sfi;
::SHGetFileInfo(
(LPCTSTR)s.c_str(),
FILE_ATTRIBUTE_NORMAL,
&sfi,
sizeof(SHFILEINFO),
SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES);
Result = sfi.szTypeName;
return Result;
}
};
示例2: replaceVariables
void VariableHandler::replaceVariables(tstring &source)
{
tstring::size_type startPos, endPos;
startPos = 0;
endPos = tstring::npos;
do
{
startPos = source.find(_T('$'), startPos);
if (startPos != tstring::npos)
{
endPos = source.find(_T('$'), startPos + 1);
if (endPos == tstring::npos)
break;
}
if (endPos != tstring::npos)
{
tstring varValue = (*_variables)[source.substr(startPos + 1, endPos - startPos - 1)];
source.replace(startPos, endPos - startPos + 1, varValue);
startPos = startPos + varValue.size();
endPos = tstring::npos;
}
} while(startPos != tstring::npos);
}
示例3: Colorize
void CFulEditCtrl::Colorize(const tstring& aLine, int begin) {
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
ColorList *cList = HighlightManager::getInstance()->getList();
int end = GetTextLengthEx(GTL_NUMCHARS);
SetSel(begin, end);
//otroligt fulhack, måste lagas riktigt nån gång
SetSelectionCharFormat(selFormat);
logged = false;
//compare the last line against all strings in the vector
for(ColorIter i = cList->begin(); i != cList->end(); ++i) {
ColorSettings* cs = &(*i);
int pos;
//set start position for find
if( cs->getIncludeNick() ) {
pos = 0;
} else {
pos = aLine.find(_T(">"));
if(pos == tstring::npos)
pos = aLine.find(_T("**")) + nick.length();
}
//prepare the charformat
cf.dwMask = CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_ITALIC;
cf.dwEffects = 0;
if(cs->getBold()) cf.dwEffects |= CFE_BOLD;
if(cs->getItalic()) cf.dwEffects |= CFE_ITALIC;
if(cs->getUnderline()) cf.dwEffects |= CFE_UNDERLINE;
if(cs->getStrikeout()) cf.dwEffects |= CFE_STRIKEOUT;
if(cs->getHasBgColor()){
cf.dwMask |= CFM_BACKCOLOR;
cf.crBackColor = cs->getBgColor();
}
if(cs->getHasFgColor()){
cf.dwMask |= CFM_COLOR;
cf.crTextColor = cs->getFgColor();
}
while( pos != string::npos ){
if(cs->usingRegexp())
pos = RegExpMatch(cs, cf, aLine, begin);
else
pos = FullTextMatch(cs, cf, aLine, pos, begin);
}
matchedPopup = false;
matchedSound = false;
}//end for
}//end Colorize
示例4: ConvertTString
D3DXVECTOR3 ConvertTString(const tstring & value)
{
D3DXVECTOR3 vec;
int index = value.find(';', 0);
vec.x = ConvertTString<float>(value.substr(0, index));
int index2 = value.find(';', ++index);
vec.y = ConvertTString<float>(value.substr(index, index2 - index));
vec.z = ConvertTString<float>(value.substr(++index2, value.size() - index2));
return vec;
}
示例5:
uvec3 string_cast<uvec3, tstring>
(const tstring & value)
{
uvec3 vec;
int32 index = value.find(';', 0);
vec.x = string_cast<uint32>(value.substr(0, index));
int32 index2 = value.find(';', ++index);
vec.y = string_cast<uint32>(value.substr(index, index2 - index));
vec.z = string_cast<uint32>(value.substr(++index2, value.size() - index2));
return vec;
}
示例6: lay
pos string_cast<pos, tstring>
(const tstring & value)
{
pos pos;
int32 index = value.find(';', 0);
pos.x = string_cast<float32>(value.substr(0, index));
int32 index2 = value.find(';', ++index);
pos.y = string_cast<float32>(value.substr(index, index2 - index));
pos.l = lay(string_cast<int32>(value.substr(++index2, value.size() - index2)));
return pos;
}
示例7: setMatch
void ColorSettings::setMatch(const tstring& match) {
if (match.compare(_T("$ts$")) == 0) {
bTimestamps = true;
} else if (match.compare(_T("$users$")) == 0) {
bUsers = true;
} else if (match.find(_T("$mynick$")) != tstring::npos) {
bMyNick = true;
} else if (match.find(_T("$Re:")) == 0) {
bUsingRegexp = true;
}
strMatch = match;
}
示例8: HandleRequestService
bool CCoBroker::HandleRequestService(const tstring& dstUserId, ULONG dstSvcId, const tstring& srcUserId, ULONG srcSvcId, ULONG rId, ULONG rType, ULONG param, const tstring& params)
{
TRY_CATCH
HRESULT result;
EBrokerStartTypes startParam=BST_SAME;
tstring url;
{
tstring::size_type iBeginUrl=params.find(_T(";;"));
if(iBeginUrl!=tstring::npos)
{
tstring::size_type iEndUrl=params.find(_T(";;"),iBeginUrl+2);
url=params.substr(iBeginUrl+2,(tstring::npos!=iEndUrl)?iEndUrl-iBeginUrl-2:tstring::npos);
}
}
Log.Add(_MESSAGE_,_T("***HandleRequestService*** url=[%s]"),url.c_str());
const TCHAR SESSION_ID_PARAMETER_NAME[]=_T("supportRequestId=");
tstring::size_type iWebSId=url.find(SESSION_ID_PARAMETER_NAME);
if(iWebSId!=tstring::npos&&iWebSId+_countof(SESSION_ID_PARAMETER_NAME)<url.size())
{
iWebSId+=_countof(SESSION_ID_PARAMETER_NAME)-1;
tstring::size_type iWebSIdEnd=url.find_first_of(_T("&#"),iWebSId);
if(tstring::npos==iWebSIdEnd)
iWebSIdEnd=url.length();
tstring sId=url.substr(iWebSId,iWebSIdEnd-iWebSId);
Log.Add(_MESSAGE_,_T("***HandleRequestService*** sId=[%s]"),sId.c_str());
SHA1Hash hash_buf;
CRYPTO_INSTANCE.MakeHash((char*)sId.c_str(),sId.length()*sizeof(tstring::value_type),hash_buf);
tstring hashString;
for(int i=0;i<sizeof(hash_buf);++i)
//hashString+=i2tstring((int)(unsigned char)hash_buf[i],16);
hashString+=Format(_T("%02x"),(int)(unsigned char)hash_buf[i]);
url.insert(iWebSIdEnd,tstring(_T("&sri="))+hashString);
}
//Log.Add(_WARNING_,_T("***HandleRequestService*** HASHING TURN OFF"));
Log.Add(_MESSAGE_,_T("***HandleRequestService*** url=[%s]"),url.c_str());
CAtlFile cnfg;
if(S_OK==cnfg.Create(Format(_T("%s\\%s"),GetModulePath(GetCurrentModule()).c_str(),_T("Broker.cfg")).c_str(),GENERIC_READ,0,OPEN_EXISTING))
{
TRY_CATCH
DWORD readLen=0;
readLen=GetFileSize(cnfg.m_h,NULL);
if(INVALID_FILE_SIZE==readLen&&readLen>32768)
throw MCException_Win("Broker.cfg size obtaining failed or file too large");
std::auto_ptr<char> buf(new char[readLen]);
if(!ReadFile(cnfg.m_h,buf.get(),readLen,&readLen,NULL))
throw MCException_Win("Broker.cfg file reading failed");
startParam=EBrokerStartTypes(atol(buf.get()));
Log.Add(_MESSAGE_,_T("***HandleRequestService*** file startParam=[0x%x]"),startParam);
CATCH_LOG()
}
示例9:
void ShellCache::CPathFilter::AddEntries(const tstring& s, bool include)
{
size_t pos = 0, pos_ant = 0;
pos = s.find(L'\n', pos_ant);
while (pos != tstring::npos)
{
AddEntry(s.substr(pos_ant, pos - pos_ant), include);
pos_ant = pos + 1;
pos = s.find(L'\n', pos_ant);
}
if (!s.empty())
AddEntry(s.substr(pos_ant, s.size() - 1), include);
}
示例10: quote_if_spaces
void quote_if_spaces(tstring& path) {
int has_space = path.find(tstring(_T(" ")), 0);
if (has_space == std::string::npos) return;
path = _T("\"") + path + _T("\"");
return;
}
示例11: OnVCardReturned
void CSearchBussinessPartnerPage::OnVCardReturned( tstring& strAccount, sUserVCard& oneInfo )
{
if (tstring::npos != strAccount.find(m_strFindPhoneNo))
{
SetSearchResult(oneInfo);
}
}
示例12: RegPathToHkeyAndSubKey
BOOL CRegistryTool::RegPathToHkeyAndSubKey(tstring regPath,HKEY *hKey,tstring *strSubKey)
{
int iPos;
tstring strRootKey;
BOOL bResult = FALSE;
if(regPath.size()==0)
return FALSE;
iPos = regPath.find("\\");
if(iPos == tstring::npos)
return FALSE;
strRootKey = regPath.substr(0,iPos);
if(strRootKey.size()==0)
return FALSE;
if(StringToRootKey(strRootKey,hKey))
bResult = TRUE;
*strSubKey = regPath.substr(iPos+1,regPath.size()-iPos-1);
return bResult;
}
示例13: if
int
CLink::UrlType(
const tstring& strUrl )
{
int urlType;
const tstring slashSlash = _T("//");
const tstring bslashBslash = _T("\\\\");
if ( ( strUrl.compare( 0, 2, slashSlash ) == 0 ) ||
( strUrl.compare( 0, 2, bslashBslash ) == 0 ) )
{
urlType = urlType_Absolute;
}
else if ( ( strUrl[0] == _T('\\') ) || ( strUrl[0] == _T('/') ) )
{
urlType = urlType_LocalAbsolute;
}
else
{
if ( strUrl.find( _T(':') ) != tstring::npos )
{
urlType = urlType_Absolute;
}
else
{
urlType = urlType_Relative;
}
}
return urlType;
}
示例14: Add
virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) {
tstringstream flashParam;
tstring::size_type pos = templateName.find('.');
tstring filename = (pos != tstring::npos) ? templateName.substr(0, pos) : templateName;
flashParam << TEXT("<invoke name=\"Add\" returntype=\"xml\"><arguments><number>") << layer << TEXT("</number><string>") << filename << TEXT("</string><number>0</number>") << (playOnLoad?TEXT("<true/>"):TEXT("<false/>")) << TEXT("<string>") << label << TEXT("</string><string><![CDATA[ ") << data << TEXT(" ]]></string></arguments></invoke>");
LOG << LogLevel::Debug << TEXT("Invoking add-command");
pFlashProducer_->Param(flashParam.str());
}
示例15: dcassert
ChatCommandContext::ChatCommandContext(const tstring& s) {
dcassert(isCommand(s));
const string::size_type i = s.find(' ');
if (i != string::npos) {
param = s.substr(i + 1);
command = s.substr(1, i - 1);
}
else {
command = s.substr(1);
}
}