本文整理汇总了C++中wstring::rfind方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::rfind方法的具体用法?C++ wstring::rfind怎么用?C++ wstring::rfind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::rfind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bindBuiltinVariable
/***************************************************************************
* bindBuiltinVariable
***************************************************************************/
bool CCilVm::bindBuiltinVariable( const wstring& strQualifiedName,
CVariable* const pvar )
{
bool bReturn = true;
//Bind the var
if( strQualifiedName.find( STRING_INTERNAL_SCOPEDELIMITER ) != wstring::npos )
{
wstring strRoot = strQualifiedName.substr( 0, strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) );
assert( strRoot.find( STRING_INTERNAL_SCOPEDELIMITER ) == wstring::npos );
wstring strLeaf = strQualifiedName.substr( strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) + 1,
strQualifiedName.length() );
RID ridObject = getMetaData().queryBuiltinObjectRid( strRoot );
if( ridObject == RID_NOTDEFINED )
return false;
//Create property
getPrototypeObject( ridObject ).setProperty( strLeaf,
*pvar );
}
return bReturn;
}
示例2: GetFileExtendName
wstring CStaticPubFunc::GetFileExtendName(wstring strFileName)
{
int intCharPosition;
//Find "\\",Get The File's Name
intCharPosition = strFileName.rfind(L'\\');
if(-1 != intCharPosition)
{
strFileName = strFileName.substr(intCharPosition - 1);
}
//AfxMessageBox(strFileName);
//Find ".",Get the file's extend name
intCharPosition = strFileName.rfind(L'.');
if(-1 != intCharPosition)
{
strFileName = strFileName.substr(intCharPosition - 1);
return strFileName;
}
else
{
//No extend name
return L"";
}
}
示例3: getNameFromSoundString
wstring getNameFromSoundString(wstring sSoundString)
{
size_t end = sSoundString.rfind(TEXT(".flac"));
size_t start = sSoundString.rfind('.', end-1);
if(start == wstring::npos || end == wstring::npos) //Not any numbers heres
return sSoundString;
sSoundString.erase(start, end-start); //Erase the numbers in the middle
return sSoundString; //Done
}
示例4:
CTaskInfo::CTaskInfo(wstring filePath)
{
m_Index = 0;
m_strFilePath = filePath;
int nPos = filePath.rfind('.');
m_strFileExtent = filePath.substr(nPos);
nPos = filePath.rfind('\\');
m_strFileName = filePath.substr(nPos+1);
m_strFileNameWithoutExt = m_strFileName.substr(0,m_strFileName.find('.'));
wstring strFileExtent = _tcslwr((wchar_t*)m_strFileExtent.c_str());
// map<wstring,int>::iterator Iter = theApp.m_pConfig->m_MapFileType.find(strFileExtent);
// if (Iter!=theApp.m_pConfig->m_MapFileType.end())
// {
// //说明找到
// m_nFileType = theApp.m_pConfig->m_MapFileType[m_strFileExtent];
// }
// else
// {
// g_Logger.Debug(__FILE__,__LINE__,_T("没有对应的文件类型%s"),m_strFileExtent.c_str());
// }
// if (_tcsicmp(m_strFileExtent.c_str(),_T(".doc")) ==0)
// {
// m_nFileType = FILETYPE_DOC;
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".docx")) ==0)
// {
// m_nFileType = FILETYPE_DOCX;
//
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".wps")) ==0)
// {
// m_nFileType = FILETYPE_WPS;
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".xls")) ==0)
// {
// m_nFileType = FILETYPE_XLS;
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".xlt")) ==0)
// {
// m_nFileType = FILETYPE_XLT;
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".xlsx")) ==0)
// {
// m_nFileType = FILETYPE_XLSX;
// }
// else if(_tcsicmp(m_strFileExtent.c_str(),_T(".et")) ==0)
// {
// m_nFileType = FILETYPE_ET;
// }
}
示例5: bindBuiltinMethod
/***************************************************************************
* bindBuiltinMethod
***************************************************************************/
bool CCilVm::bindBuiltinMethod( const wstring& strQualifiedName,
PMETHOD const pMethod,
const int32_t iLength )
{
bool bReturn = true;
RID ridMethod = getMetaData().queryBuiltinMethodRid( strQualifiedName );
if( ridMethod == RID_NULL )
return false;
//Bind the API
METHOD_DEF& method = getMetaData().getMethod( ridMethod );
if( method.MethodType != METHOD_NATIVE )
return false;
method.lpFunction = pMethod;
if( strQualifiedName.find( STRING_INTERNAL_SCOPEDELIMITER ) != wstring::npos )
{
wstring strRoot = strQualifiedName.substr( 0, strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) );
assert( strRoot.find( STRING_INTERNAL_SCOPEDELIMITER ) == wstring::npos );
wstring strLeaf = strQualifiedName.substr( strQualifiedName.rfind( STRING_INTERNAL_SCOPEDELIMITER ) + 1,
strQualifiedName.length() );
RID ridObject = getMetaData().queryBuiltinObjectRid( strRoot );
if( ridObject == RID_NOTDEFINED )
return false;
//Create property
getPrototypeObject( ridObject ).setProperty( this,
strLeaf,
ridMethod,
iLength );
}
else
{
//Global method
//e.g. print, eval etc
//Those one need to have correspond static field to keep properties
CG_SYMBOL_INFORMATION& info = querySymbolInformation( strQualifiedName + STRING_OBJECTNAME_POSTFIX );
assert( info.Flags == CG_SYMBOL_FLAG_GLOBAL );
RID rid = info.rid;
assert( rid != RID_NOTDEFINED );
if( rid )
setStaticFieldFunctionObject( rid, ridMethod );
}
return bReturn;
}
示例6: NormalizeDirPathPrefix
void NormalizeDirPathPrefix(wstring & dirPath)
{
if (dirPath.empty())
return;
if (dirPath.rfind(wchar_t(kDirDelimiter)) != dirPath.length() - 1)
dirPath += wchar_t(kDirDelimiter);
}
示例7: str_endswith
bool str_endswith(const wstring &s, const wstring &sfx) {
size_t p = s.rfind(sfx);
if (p != string::npos) {
if (p == (s.length() - sfx.length())) return true;
}
return false;
}
示例8: loadSpriteTypes
/*
This method loads all the sprite types found in the provided sprite type list file
into the game state manager, including their images.
*/
bool PoseurSpriteTypesImporter::loadSpriteTypes(Game *game, wstring spriteTypesListFileName)
{
int slashIndex = spriteTypesListFileName.rfind('/');
dir = string(spriteTypesListFileName.begin(), spriteTypesListFileName.end()).substr(0, slashIndex+1);
const char *spriteTypesListFile = newCharArrayFromWstring(spriteTypesListFileName);
bool success = loadSpriteTypesListInfo(spriteTypesListFile);
if (!success) return false;
for (unsigned int i = 0; i < spriteTypes.size(); i++)
{
success = loadSpriteTypeInfo(spriteTypes[i]);
if (!success) return false;
}
TextureManager *tm = game->getGraphics()->getWorldTextureManager();
WStringTable *wStringTable = tm->getWStringTable();
// NOW LET'S USE ALL THE INFO WE'VE LOADED
// LET'S START BY LOADING THE TEXTURES INTO THE WORLD TEXTURE MANAGER
for (unsigned int i = 0; i < spriteTypes.size(); i++)
{
string spriteType = spriteTypes[i];
unsigned int offset = wStringTable->getNumWStringsInTable();
map<int, string> images = spriteTypesImages[spriteType];
for (int j = 0; j < images.size(); j++)
{
string imageToLoad = images[j];
wstring wImageToLoad(imageToLoad.begin(), imageToLoad.end());
tm->loadTexture(wImageToLoad);
}
AnimatedSpriteType *ast = new AnimatedSpriteType();
unsigned int spriteTypeId = game->getGSM()->getSpriteManager()->addSpriteType(ast);
ast->setSpriteTypeID(spriteTypeId);
Dimensions dim = spriteTypesDimensions[spriteType];
ast->setTextureSize(dim.width, dim.height);
map<string, vector<Pose>> animations = spriteTypesAnimationsLists[spriteType];
map<string, vector<Pose>>::iterator it = animations.begin();
while (it != animations.end())
{
string key = it->first;
wstring wKey(key.begin(), key.end());
ast->addAnimationSequence(wKey);
vector<Pose> poseList = it->second;
vector<Pose>::iterator poseIt = poseList.begin();
while (poseIt != poseList.end())
{
Pose pose = *poseIt;
ast->addAnimationFrame(wKey, pose.imageId + offset - 1, pose.duration);
poseIt++;
}
it++;
}
}
return true;
}
示例9: GetFilePathExt
HRESULT GetFilePathExt(const wstring & path, wstring & ext)
{
int dotPos = path.rfind(L'.');
if (dotPos >= 0) {
ext = path.substr(dotPos + 1);
return S_OK;
}
return E_FAIL;
}
示例10: CrabStringFindWholeWord
wstring CrabStringFindWholeWord(const wstring &t, size_t pos, const wstring &BreakupMark, const wstring &BreakupMarkOnceMore)
{
wstring foundstr;
if(0==pos) {
wstring strR = t;
size_t foundposL = 0;
size_t foundposR = t.find(BreakupMark);
if(BreakupMarkOnceMore.length()>0){ // <added><20150615><dzliu> use another BreakupMarkOnceMore
if(wstring::npos==foundposR){foundposR = strR.find(BreakupMarkOnceMore);}else{
if(strR.find(BreakupMarkOnceMore)<foundposR){foundposR=strR.find(BreakupMarkOnceMore);}
}
}
if(wstring::npos==foundposR){foundposR=t.length()-1;}else{
foundposR=foundposR-1;
}
foundstr = t.substr(foundposL,foundposR-foundposL+1);
} else if(t.length()-1==pos) {
wstring strL = t;
size_t foundposL = t.rfind(BreakupMark);
if(BreakupMarkOnceMore.length()>0){ // <added><20150615><dzliu> use another BreakupMarkOnceMore
if(wstring::npos==foundposL){foundposL = strL.rfind(BreakupMarkOnceMore);}else{
if(strL.rfind(BreakupMarkOnceMore)>foundposL){foundposL=strL.rfind(BreakupMarkOnceMore);}
}
}
if(wstring::npos==foundposL){foundposL=0;}else{
foundposL=foundposL+1;
}
size_t foundposR = t.length()-1;
foundstr = t.substr(foundposL,foundposR-foundposL+1);
} else if(0<pos && t.length()-1>pos) {
wstring strL = t.substr(0,pos);
wstring strR = t.substr(pos);
size_t foundposL = strL.rfind(BreakupMark);
if(BreakupMarkOnceMore.length()>0){ // <added><20150615><dzliu> use another BreakupMarkOnceMore
if(wstring::npos==foundposL){foundposL = strL.rfind(BreakupMarkOnceMore);}else{
if(strL.rfind(BreakupMarkOnceMore)>foundposL){foundposL=strL.rfind(BreakupMarkOnceMore);}
}
}
if(wstring::npos==foundposL){foundposL=0;}else{
foundposL=foundposL+1;
}
size_t foundposR = strR.find(BreakupMark);
if(BreakupMarkOnceMore.length()>0){ // <added><20150615><dzliu> use another BreakupMarkOnceMore
if(wstring::npos==foundposR){foundposR = strR.find(BreakupMarkOnceMore);}else{
if(strR.find(BreakupMarkOnceMore)<foundposR){foundposR=strR.find(BreakupMarkOnceMore);}
}
}
if(wstring::npos==foundposR){foundposR=t.length()-1;}else{
foundposR=foundposR-1+pos;
}
foundstr = t.substr(foundposL,foundposR-foundposL+1);
}
return foundstr;
}
示例11: GetStartTime
void CAvi2Flv::InsertMediaInfo(const wstring &strIn, const wstring& strOut)
{
AVIFILEINFO aviInfo = CAviHelper::AVI_GetFileInfo(strIn);
//转码成功后插数据库
DVRMEDIA_INFO mi;
CString strT;
strT.Format(_T("%d"), aviInfo.dwWidth);
mi.strViewWidth = strT.GetString();
strT.Format(_T("%d"), aviInfo.dwHeight);
mi.strViewHeight = strT.GetString();
wstring strPath = strIn.substr( SHAREDATA.g_strFilePath.GetLength() + 1);
wstring str = strPath.substr(0, strPath.find(_T("\\")) );
mi.strDvrNumber = str;
CTime tm = CTime::GetCurrentTime();
mi.strDataUploadTime = tm.Format(_T("%Y-%m-%d %H:%M:%S"));
mi.strDataIp = SHAREDATA.g_pMainFrame->GetIpAddr().c_str();
mi.strFileName = strIn.substr(strIn.rfind(_T("\\")) + 1);
CFile localFile;
if(!localFile.Open(strIn.c_str(), CFile::modeRead|CFile::shareDenyNone))
{
strT.Format(_T("%s"), 0);
}
else
{
strT.Format(_T("%d"), localFile.GetLength());
localFile.Close();
}
mi.strFileSize = strT;
mi.strFileType = _T("AVI");
strT.Format(_T("%d"), aviInfo.dwRate / aviInfo.dwScale);
mi.strFrameRate = strT;
//wstring sFtpip, sFtpport, sIISip, sIISport;
//bool bRlt = DB.QueryIpPortByDevId(SHAREDATA.g_strDeviceId.GetString(), sFtpip, sFtpport, sIISip, sIISport);
strPath = strOut.substr(SHAREDATA.g_strFilePath.GetLength() + 1);
mi.strFtpFileUrl = strPath; //_T("ftp://") + sFtpip + _T(":") + sFtpport + _T("//") + strPath;
mi.strIISFileUrl = strPath; //_T("http://") + sIISip + _T(":") + sIISport + _T("//") + strPath;
mi.strLocateFilePath = strIn.c_str();
strT.Format(_T("%d"), aviInfo.dwRate / aviInfo.dwScale * aviInfo.dwLength);
mi.strMediaDuration = strT; //毫秒
mi.strMediaStartTime = GetStartTime(strIn);
mi.strMediaEndTime = AddTime(mi.strMediaStartTime, mi.strMediaDuration);
mi.strRecordTime = mi.strMediaStartTime;
mi.strRemark = _T(" ");
mi.strVideoType = _T("AVI");
DB.InsertMediaInfo(mi);
}
示例12:
vector<wstring> StringUtils::splitLast(const wstring& wstr, const wstring& stuff)
{
vector<wstring> strList;
int pos = wstr.rfind(stuff);
if (-1 != pos){
strList.push_back(wstr.substr(0,pos));
strList.push_back(wstr.substr(pos+1, wstr.length()));
}
strList.push_back(wstr);
return strList;
}
示例13: checkTXT
BOOL checkTXT(wstring stri)
{
wstring types[3] = { L".txt", L".cfg", L".hoshou" };
for (int t = 0; t < 3; t++)
{
if(stri.rfind(types[t]) != string::npos)
return TRUE;
}
return FALSE;
}
示例14: extract_file_path
wstring extract_file_path(const wstring& path) {
size_t pos = path.rfind(L'\\');
if (pos == wstring::npos) {
pos = 0;
}
size_t path_root_len;
bool is_unc_path;
locate_path_root(path, path_root_len, is_unc_path);
if ((pos <= path_root_len) && (path_root_len != 0))
return path.substr(0, path_root_len).append(1, L'\\');
else
return path.substr(0, pos);
}
示例15: extract_file_ext
wstring extract_file_ext(const wstring& path) {
size_t ext_pos = path.rfind(L'.');
if (ext_pos == wstring::npos) {
return wstring();
}
size_t name_pos = path.rfind(L'\\');
if (name_pos == wstring::npos) {
name_pos = 0;
}
else {
name_pos++;
}
if (ext_pos <= name_pos)
return wstring();
size_t path_root_len;
bool is_unc_path;
locate_path_root(path, path_root_len, is_unc_path);
if ((ext_pos <= path_root_len) && (path_root_len != 0))
return wstring();
else
return path.substr(ext_pos);
}