当前位置: 首页>>代码示例>>C++>>正文


C++ tstring::rfind方法代码示例

本文整理汇总了C++中tstring::rfind方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::rfind方法的具体用法?C++ tstring::rfind怎么用?C++ tstring::rfind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tstring的用法示例。


在下文中一共展示了tstring::rfind方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExtractFileName

    tstring ExtractFileName(const tstring& path)
    {
        size_t pos1 = path.rfind('\\');
        size_t pos2 = path.rfind('/');

        pos1 = min(pos1, pos2);
        if (pos1 != tstring::npos)
        {
            return path.substr(pos1 + 1);
        }
        return path;
    }
开发者ID:yellowbigbird,项目名称:bird-self-lib,代码行数:12,代码来源:UtilsFile.cpp

示例2: SetNick

void CFulEditCtrl::SetNick(const tstring& aNick) {
	if(isSet(STRIP_ISP)) {
		tstring::size_type pos = aNick.find(_T("["));
		if( pos != tstring::npos ) {
			tstring::size_type rpos = aNick.rfind(_T("]"));
			if( rpos == aNick.length() -1 && rpos > 0 ) // this user has a stupid fucking nick bah ugly hate it
				rpos = aNick.rfind(_T("]"), rpos-1);
			if(rpos != tstring::npos) 
				nick = aNick.substr(rpos+1);
		}
	} else {
		nick = aNick;
	}
}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:14,代码来源:FulEditCtrl.cpp

示例3: GetFileDirectory

tstring FileUtil::GetFileDirectory(const tstring &filename)
{
	tstring directory;
	const size_t last_slash_idx = filename.rfind(_T('\\'));
	if (tstring::npos != last_slash_idx)
	{
		directory = filename.substr(0, last_slash_idx);
	}

	return directory;
}
开发者ID:0359xiaodong,项目名称:ZaoQiBu,代码行数:11,代码来源:FileUtil.cpp

示例4: remove_double_dirs

/// Removes all "../" references from the absolute path fn 
/// If string contains f/d/e/../a replace it with f/d/a/
static void remove_double_dirs(tstring &fn) {
  tstring search;
  search.push_back(DIR_SEPARATOR);
  search.push_back('.');
  search.push_back('.');
  search.push_back(DIR_SEPARATOR);
  
  while (true) {
    size_t loc = fn.find(search);
    if (loc == tstring::npos) 
      break;

    // See if there is another dir separator before the /../ we just
    // found.
    size_t before = fn.rfind(DIR_SEPARATOR, loc-1);
    if (before == tstring::npos) 
      break;

    // Now delete all between before+1 and loc+3
    fn.erase(fn.begin()+before+1, fn.begin()+loc+4);
  }
}
开发者ID:henry-bennett,项目名称:hashdeep,代码行数:24,代码来源:dig.cpp

示例5: get_string_suffix

tstring get_string_suffix(const tstring& str, const tstring& separator) {
    const tstring::size_type last_separator_pos = str.rfind(separator);
    if (last_separator_pos == tstring::npos)
        return str;
    return str.substr(last_separator_pos + separator.size(), tstring::npos);
}
开发者ID:151706061,项目名称:nsis-chinese,代码行数:6,代码来源:util.cpp

示例6: get_string_prefix

tstring get_string_prefix(const tstring& str, const tstring& separator) {
    const tstring::size_type last_separator_pos = str.rfind(separator);
    if (last_separator_pos == string::npos)
        return str;
    return str.substr(0, last_separator_pos);
}
开发者ID:151706061,项目名称:nsis-chinese,代码行数:6,代码来源:util.cpp

示例7: name

	/// Create array of names
	BSTR* scripts = new BSTR[files.size()];
	*names = scripts;
	*count = static_cast<ULONG>(files.size());
	for(ULONG i = 0; i < files.size(); ++i)
	{
		tstring name(files.front());
		files.pop_front();
		scripts[i] = ::SysAllocString(T2OLE(name.c_str()));
	}
CATCH_LOG_COM
}

tstring CScriptsEnumerator::GetArchiveName(const WIN32_FIND_DATA* fileData)
{
TRY_CATCH
	if(!fileData)
		return _T("");
	tstring fileName(fileData->cFileName);
	tstring::size_type pos = fileName.rfind(_T("."));
	if(tstring::npos == pos)
		return _T("");
	tstring name = fileName.substr(0, pos);
	fileName.erase(0, pos + 1);
	if(LowerCase(fileName) != tstring(SCRIPT_FILES_EXT))
		return _T("");
	return name;
CATCH_THROW()
}

开发者ID:uvbs,项目名称:SupportCenter,代码行数:29,代码来源:CScriptsEnumerator.cpp

示例8: ParseParameter

/////////////////////////////////////////////////////////////////////
// 
// Function:    
//
// Description: 
//
/////////////////////////////////////////////////////////////////////
tstring CACreateProjectInitFile::ParseParameter(tstring& strSetupExeName, tstring& strParameter)
{
    tstring strParameterName;
    tstring strEncodedValue;
    tstring strParameterValue;
    tstring strError;
    size_t iParameterStart = 0;
    size_t iParameterEnd = 0;

    strParameterName = strParameter + _T("_");

    strError  = _T("Searching for parameter '");
    strError += strParameterName;
    strError += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strError.c_str()
    );

    iParameterStart = strSetupExeName.rfind(strParameterName);
    if (iParameterStart != tstring::npos) {
        iParameterStart += strParameterName.size();
        iParameterEnd = strSetupExeName.find(_T("_"), iParameterStart);
        if (iParameterEnd == tstring::npos) {
            iParameterEnd = strSetupExeName.find(_T("."), iParameterStart);
            if (iParameterEnd == tstring::npos) {
                return tstring(_T(""));
            }
        }
        strEncodedValue = strSetupExeName.substr(iParameterStart, iParameterEnd - iParameterStart);

        strError  = _T("Found encoded value '");
        strError += strEncodedValue;
        strError += _T("'");

        LogMessage(
            INSTALLMESSAGE_INFO,
            NULL, 
            NULL,
            NULL,
            NULL,
            strError.c_str()
        );

        // WCG didn't want to have to encode their setup cookie value.  So all parameters but the setup cookie
        // are base64 encoded.
        //
        if (strParameterName == _T("asc_")) {

            strParameterValue = strEncodedValue;

        } else {

            CW2A pszASCIIEncodedValue( strEncodedValue.c_str() );
            CA2W pszUnicodeDecodedValue( r_base64_decode(pszASCIIEncodedValue, strlen(pszASCIIEncodedValue)).c_str() );

            strError  = _T("Decoded value '");
            strError += pszUnicodeDecodedValue;
            strError += _T("'");

            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                strError.c_str()
            );

            strParameterValue = pszUnicodeDecodedValue;

        }
    }

    strError  = _T("Returning value '");
    strError += strParameterValue;
    strError += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strError.c_str()
    );

    return strParameterValue;
//.........这里部分代码省略.........
开发者ID:DanAurea,项目名称:boinc,代码行数:101,代码来源:CACreateProjectInitFile.cpp

示例9: AddLevelObject

bool EditorLoader::AddLevelObject(	const tstring& modelPath,
									const tstring& physxModelPath,
									const tstring& normalPath,
									const tstring& diffusePath,
									const tstring& specPath,
									const tstring& glossPath	)
{
	if (modelPath != _T("") && physxModelPath != _T(""))
	{        
        if (physxModelPath.rfind(_T(".nxsoftbody")) == tstring::npos)
        {
            bool rigid = false;
            int ret = MessageBoxA(0, "Load as staticmesh?", "Loading: ", MB_ICONQUESTION | MB_YESNO);
		    switch (ret)
		    {
                case IDYES: rigid = false; break;
                default: rigid = true; break;
            }

            SimpleObject* pObj = new SimpleObject();

		    pObj->SetNormalPath(normalPath);

		    pObj->SetModelPath(modelPath);
		    pObj->SetPhysXModel(physxModelPath);
			
		    pObj->SetDiffusePath(diffusePath);
		    pObj->SetSpecPath(specPath);
		    pObj->SetGlossPath(glossPath);

		    pObj->SetRigid(rigid);

		    Vector3 vLook = m_pRenderContext->GetCamera()->GetLook();
		    vLook.Normalize();

		    pObj->Init(m_pPhysXEngine);

		    pObj->Translate(m_pRenderContext->GetCamera()->GetPosition() + vLook * 10);

		    m_pLevel->AddLevelObject(pObj);
        }
        else
        {
		    Vector3 vLook = m_pRenderContext->GetCamera()->GetLook();
		    vLook.Normalize();
            SimpleSoftbody* pSoftbody = new SimpleSoftbody(m_pRenderContext->GetCamera()->GetPosition() + vLook * 10);

		    pSoftbody->SetModelPath(modelPath);
		    pSoftbody->SetPhysXModel(physxModelPath);
			
		    pSoftbody->SetDiffusePath(diffusePath);
		    pSoftbody->SetSpecPath(specPath);
		    pSoftbody->SetGlossPath(glossPath);
            pSoftbody->SetNormalPath(normalPath);

            pSoftbody->Init(m_pPhysXEngine);

            m_pLevel->AddLevelObject(pSoftbody);
        }
		return true;
	}
	
	return false;
}
开发者ID:BillyKim,项目名称:jello-man,代码行数:64,代码来源:EditorLoader.cpp


注:本文中的tstring::rfind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。