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


C++ std_string::c_str方法代码示例

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


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

示例1: FindNGenRec

void FindNGenRec(const std_string& strPath, std_string& strNGenPath, FILETIME& ftCreation)
{
	const std_string strSearch = strPath + _T("*.*");
	const std_string strNGen = _T("ngen.exe");

	WIN32_FIND_DATA wfd;
	ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA));
	HANDLE hFind = FindFirstFile(strSearch.c_str(), &wfd);
	if(hFind == INVALID_HANDLE_VALUE) return;

	while(true)
	{
		if((wfd.cFileName[0] == 0) || (_tcsicmp(wfd.cFileName, _T(".")) == 0) ||
			(_tcsicmp(wfd.cFileName, _T("..")) == 0)) { }
		else if((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
			FindNGenRec((strPath + wfd.cFileName) + _T("\\"), strNGenPath, ftCreation);
		else if(_tcsicmp(wfd.cFileName, strNGen.c_str()) == 0)
		{
			if((wfd.ftCreationTime.dwHighDateTime > ftCreation.dwHighDateTime) ||
				((wfd.ftCreationTime.dwHighDateTime == ftCreation.dwHighDateTime) &&
				(wfd.ftCreationTime.dwLowDateTime > ftCreation.dwLowDateTime)))
			{
				strNGenPath = strPath + wfd.cFileName;
				ftCreation = wfd.ftCreationTime;
			}
		}

		if(FindNextFile(hFind, &wfd) == FALSE) break;
	}

	FindClose(hFind);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:32,代码来源:ShInstUtil.cpp

示例2: FindNGenRec

void FindNGenRec(const std_string& strPath, std_string& strNGenPath,
	ULONGLONG& ullVersion)
{
	const std_string strSearch = strPath + _T("*.*");
	const std_string strNGen = _T("ngen.exe");

	WIN32_FIND_DATA wfd;
	ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA));
	HANDLE hFind = FindFirstFile(strSearch.c_str(), &wfd);
	if(hFind == INVALID_HANDLE_VALUE) return;

	while(true)
	{
		if((wfd.cFileName[0] == 0) || (_tcsicmp(wfd.cFileName, _T(".")) == 0) ||
			(_tcsicmp(wfd.cFileName, _T("..")) == 0)) { }
		else if((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
			FindNGenRec((strPath + wfd.cFileName) + _T("\\"), strNGenPath, ullVersion);
		else if(_tcsicmp(wfd.cFileName, strNGen.c_str()) == 0)
		{
			const std_string strFullPath = strPath + strNGen;
			const ULONGLONG ullThisVer = SiuGetFileVersion(strFullPath);
			if(ullThisVer >= ullVersion)
			{
				strNGenPath = strFullPath;
				ullVersion = ullThisVer;
			}
		}

		if(FindNextFile(hFind, &wfd) == FALSE) break;
	}

	FindClose(hFind);
}
开发者ID:CaledoniaProject,项目名称:KeeThief,代码行数:33,代码来源:ShInstUtil.cpp

示例3: UpdateNativeImage

void UpdateNativeImage(bool bInstall)
{
	const std_string strNGen = FindNGen();
	if(strNGen.size() == 0) return;

	const std_string strKeePassExe = GetKeePassExePath();
	if(strKeePassExe.size() == 0) return;

	std_string strParam = (bInstall ? _T("") : _T("un"));
	strParam += _T("install \"");
	strParam += strKeePassExe + _T("\"");

	SHELLEXECUTEINFO sei;
	ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
	sei.cbSize = sizeof(SHELLEXECUTEINFO);
	sei.fMask = SEE_MASK_NOCLOSEPROCESS;
	sei.lpVerb = _T("open");
	sei.lpFile = strNGen.c_str();
	sei.lpParameters = strParam.c_str();
	sei.nShow = SW_HIDE;
	ShellExecuteEx(&sei);

	if(sei.hProcess != NULL)
	{
		WaitForSingleObject(sei.hProcess, 16000);
		CloseHandle(sei.hProcess);
	}
}
开发者ID:amiryal,项目名称:keepass2,代码行数:28,代码来源:ShInstUtil.cpp

示例4: EnsureTerminatingSeparator

void EnsureTerminatingSeparator(std_string& strPath)
{
	if(strPath.size() == 0) return;
	if(strPath.c_str()[strPath.size() - 1] == _T('\\')) return;

	strPath += _T("\\");
}
开发者ID:amiryal,项目名称:keepass2,代码行数:7,代码来源:ShInstUtil.cpp

示例5: createScene

	bool cSceneManager::createScene(std_string const& filename, int loadingType)
	{
		cSerializeBsd serialize;
		cSerializeBsd::sData data;

		if (!serialize.load(filename, data))
			return false;

		m_worldOctree->addScene(data.getOctreeOnce(), true);
		m_terrain = data.getTerrainOnce();
		m_terrain->initialize();
		memcpy(&m_cullFigure, &data.m_cullFigure, sizeof (sCullFigure));

		assert(m_terrain);

		BUID buid;
		std_string _filename;
		std_string bmdName;
		std_string passName = cFileHelper::getPassNameInFullPassT(filename.c_str());

		if (LOADING_BACKGROUND == loadingType)
		{
			for (UINT i = 0; i < data.getRdSize(); ++i)
			{
				buid = data.m_rdList[i].m_buid;
				cSerializeBmd::makeFileName(buid, bmdName);
				_filename = passName + bmdName;

				sModelLoadInfo info(buid, _filename);
				info.m_pos = data.m_rdList[i].m_position;
				info.m_radian = 0.0f;
				info.m_isScene = true;
				info.m_shareType = (uint)(ST_IB | ST_VB);
				m_modelCache->addLoadingList(info);

				m_entityMgr->createEntity<cEntityModel>(info.getBuid());
			}
		}
		else if (LOADING_DIRECT == loadingType)
		{
			for (UINT i = 0; i < data.getRdSize(); ++i)
			{
				buid = data.m_rdList[i].m_buid;
				cSerializeBmd::makeFileName(buid, bmdName);
				_filename = passName + bmdName;

				createEntity<cEntityModel>(_filename, buid, data.m_rdList[i].m_position, 1.0f, loadingType);
			}
		}
		else if (LOADING_ACCESS == loadingType)
		{
		}

		return true;
	}
开发者ID:prodongi,项目名称:Bread,代码行数:55,代码来源:BreadSceneManager.cpp

示例6: SiuGetFileVersion

ULONGLONG SiuGetFileVersion(const std_string& strFilePath)
{
	DWORD dwDummy = 0;
	const DWORD dwVerSize = GetFileVersionInfoSize(
		strFilePath.c_str(), &dwDummy);
	if(dwVerSize == 0) return 0;

	boost::scoped_array<BYTE> vVerInfo(new BYTE[dwVerSize]);
	if(vVerInfo.get() == NULL) return 0; // Out of memory

	if(GetFileVersionInfo(strFilePath.c_str(), 0, dwVerSize,
		vVerInfo.get()) == FALSE) return 0;

	VS_FIXEDFILEINFO* pFileInfo = NULL;
	UINT uFixedInfoLen = 0;
	if(VerQueryValue(vVerInfo.get(), _T("\\"), (LPVOID*)&pFileInfo,
		&uFixedInfoLen) == FALSE) return 0;
	if(pFileInfo == NULL) return 0;

	return ((static_cast<ULONGLONG>(pFileInfo->dwFileVersionMS) <<
		32) | static_cast<ULONGLONG>(pFileInfo->dwFileVersionLS));
}
开发者ID:CaledoniaProject,项目名称:KeeThief,代码行数:22,代码来源:ShInstUtil.cpp

示例7: RegisterPreLoad

void RegisterPreLoad(bool bRegister)
{
	const std_string strPath = GetKeePassExePath();
	if(strPath.size() == 0) return;

	HKEY hKey = NULL;
	if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
		0, KEY_WRITE, &hKey) != ERROR_SUCCESS) return;
	if(hKey == NULL) return;

	const std_string strItemName = _T("KeePass 2 PreLoad");
	std_string strItemValue = _T("\"");
	strItemValue += strPath;
	strItemValue += _T("\" --preload");

	if(bRegister)
		RegSetValueEx(hKey, strItemName.c_str(), 0, REG_SZ,
			(const BYTE*)strItemValue.c_str(), static_cast<DWORD>((strItemValue.size() +
			1) * sizeof(TCHAR)));
	else
		RegDeleteValue(hKey, strItemName.c_str());

	RegCloseKey(hKey);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:24,代码来源:ShInstUtil.cpp

示例8: load

	bool sCubeTexture::load(std_string const& filename)
	{
		std_string realPath;
		if (!_getFileSystem()->findRealPath(filename, realPath))
		{
			return false;
		}

		if (!checkHResultReturn(D3DXCreateCubeTextureFromFile(cD3DSystem::getD3DDevice(), realPath.c_str(), &m_tex)))
			return false;

		trace(_T("load texture : %s\n"), filename.c_str());

		return true;
	}
开发者ID:prodongi,项目名称:Bread,代码行数:15,代码来源:BreadCubeTexture.cpp

示例9: renderRenderListShader

	void cSceneManager::renderRenderListShader(cShader* shader, std_string const& technique, cBatchRenderManager::vecEntityList const& renderList)
	{
		if (!shader)
			return ;

		uint pass;
		shader->setTechnique(technique.c_str());
		shader->begin(&pass);

		cBatchRenderManager::vecEntityList::const_iterator it = renderList.begin();
		for (; it != renderList.end(); ++it)
		{
			renderRdShader(shader, pass, it->m_rd);
		}

		shader->end();
	}
开发者ID:prodongi,项目名称:Bread,代码行数:17,代码来源:BreadSceneManager.cpp

示例10: renderEntitySingleShader

	void cSceneManager::renderEntitySingleShader(cShader* shader, std_string const& technique, cEntityModel const* entity)
	{
		if (!shader)
			return ;
		if (!entity)
			return ;
		cRenderData* rd = getRenderData(entity->getRenderDataBuid());
		if (!rd)
			return ;

		uint pass;
		shader->setTechnique(technique.c_str());
		shader->begin(&pass);

		renderRdShader(shader, pass, rd);

		shader->end();
	}
开发者ID:prodongi,项目名称:Bread,代码行数:18,代码来源:BreadSceneManager.cpp

示例11: makeLine

	void cFreeType::makeLine(sFreeTypeFontDesc const& desc, std_string const& str, cFreeTypeLine& line)
	{
		cFreeTypeFont* font = m_ftFontCash->get(desc.m_name);
		if (!font)
		{
			assert(0 && _T("failed find font"));
			return ;
		}
		font->setSize(desc.m_size);

		line.setStr(str);

		TCHAR const* c_str = str.c_str();
		for (size_t i = 0; i < str.length(); ++i)
		{
			line.addGlyph(m_ftGlyphCash->getKey(desc, font->getFace(), c_str[i]));
		}
	}
开发者ID:prodongi,项目名称:Bread,代码行数:18,代码来源:BreadFreeType.cpp

示例12: FindEx

DWORD CPwManager::FindEx(const TCHAR *pszFindString, BOOL bCaseSensitive,
	DWORD searchFlags, DWORD nStart)
{
	if(((searchFlags & PWMS_REGEX) != 0) || (pszFindString == NULL) ||
		(pszFindString[0] == 0))
		return this->Find(pszFindString, bCaseSensitive, searchFlags, nStart, DWORD_MAX);

	const std_string strText = pszFindString;
	if(strText != g_strFindCachedString)
	{
		g_vFindCachedSplitted = SU_SplitSearchTerms(strText.c_str());
		g_strFindCachedString = strText;
	}
	const std::vector<std_string>* pvTerms = &g_vFindCachedSplitted;

	if(pvTerms->size() == 0) return nStart;

	DWORD dwIndex = nStart;
	while(dwIndex != DWORD_MAX)
	{
		bool bAllMatch = true;
		for(size_t i = 0; i < pvTerms->size(); ++i)
		{
			const std_string& strTerm = (*pvTerms)[i];
			const DWORD dwRes = this->Find(strTerm.c_str(), bCaseSensitive,
				searchFlags, dwIndex, DWORD_MAX);

			if(dwRes > dwIndex)
			{
				dwIndex = dwRes;
				bAllMatch = false;
				break;
			}
		}

		if(bAllMatch) break;
	}

	return dwIndex;
}
开发者ID:perfectapi,项目名称:keepass1-mirror,代码行数:40,代码来源:PwFindImpl.cpp

示例13:

inline
basic_cstring<CharT>::basic_cstring( std_string const& s )
: m_begin( s.c_str() )
, m_end( m_begin + s.size() )
{
}
开发者ID:argv0,项目名称:riak-cxx,代码行数:6,代码来源:basic_cstring.hpp

示例14: OnInitDialog

BOOL CLanguagesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	NewGUI_TranslateCWnd(this);
	EnumChildWindows(this->m_hWnd, NewGUI_TranslateWindowCb, 0);
	
	NewGUI_XPButton(m_btClose, IDB_CANCEL, IDB_CANCEL);
	NewGUI_XPButton(m_btGetLang, IDB_LANGUAGE, IDB_LANGUAGE);
	NewGUI_XPButton(m_btOpenFolder, IDB_TB_OPEN, IDB_TB_OPEN);

	NewGUI_ConfigSideBanner(&m_banner, this);
	m_banner.SetIcon(AfxGetApp()->LoadIcon(IDI_WORLD),
		KCSB_ICON_LEFT | KCSB_ICON_VCENTER);
	m_banner.SetTitle(TRL("Select Language"));
	m_banner.SetCaption(TRL("Here you can change the user interface language."));

	RECT rcList;
	m_listLang.GetClientRect(&rcList);
	const int wList = rcList.right - rcList.left - GetSystemMetrics(SM_CXVSCROLL);
	const int w2 = (wList * 2) / 20;
	const int w3 = (wList * 3) / 20;
	const int w5 = (wList * 5) / 20;
	m_listLang.InsertColumn(0, TRL("Installed Languages"), LVCFMT_LEFT, w5, 0);
	m_listLang.InsertColumn(1, TRL("Version"), LVCFMT_LEFT, w2, 1);
	m_listLang.InsertColumn(2, TRL("Author"), LVCFMT_LEFT, w5, 2);
	m_listLang.InsertColumn(3, TRL("Contact"), LVCFMT_LEFT, w5, 3);
	m_listLang.InsertColumn(4, TRL("File"), LVCFMT_LEFT, w3, 4);

	// m_ilIcons.Create(CPwSafeApp::GetClientIconsResourceID(), 16, 1, RGB(255,0,255));
	CPwSafeApp::CreateHiColorImageList(&m_ilIcons, IDB_CLIENTICONS_EX, 16);
	m_listLang.SetImageList(&m_ilIcons, LVSIL_SMALL);

	m_listLang.PostMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_SI_REPORT |
		LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE |
		LVS_EX_UNDERLINEHOT | LVS_EX_INFOTIP);

	m_listLang.DeleteAllItems();

	LV_ITEM lvi;
	ZeroMemory(&lvi, sizeof(LV_ITEM));
	lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE, m_listLang.GetItemCount(),
		_T("English"), 0, 0, 1, NULL);

	CString strTemp;
	
	strTemp = PWM_VERSION_STR;
	lvi.iSubItem = 1; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_AUTHOR;
	lvi.iSubItem = 2; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = PWMX_ENGLISH_CONTACT;
	lvi.iSubItem = 3; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	strTemp = TRL("Built-in");
	lvi.iSubItem = 4; lvi.mask = LVIF_TEXT;
	lvi.pszText = (LPTSTR)(LPCTSTR)strTemp;
	m_listLang.SetItem(&lvi);

	const std_string strActive = GetCurrentTranslationTable();

	std_string strFilter = SU_DriveLetterToUpper(Executable::instance().getPathOnly());
	strFilter += PWM_DIR_LANGUAGES;
	strFilter += _T("\\*.lng");

	CFileFind ff;
	BOOL bMore = ff.FindFile(strFilter.c_str(), 0);
	while(bMore != FALSE)
	{
		bMore = ff.FindNextFile();

		// Ignore KeePass 2.x LNGX files (these are found even though
		// "*.lng" is specified as file mask)
		CString strFileName = ff.GetFileName();
		strFileName = strFileName.MakeLower();
		if((strFileName.GetLength() >= 5) && (strFileName.Right(5) == _T(".lngx")))
			continue;

		CString strID = ff.GetFileTitle();
		strID = strID.MakeLower();
		if((strID != _T("standard")) && (strID != _T("english")))
		{
			VERIFY(LoadTranslationTable((LPCTSTR)ff.GetFileTitle()));

			strTemp = (LPCTSTR)ff.GetFileTitle();
			// strTemp += _T(" - "); // Name is used as identifier
			// strTemp += TRL("~LANGUAGENAME");

			lvi.iItem = m_listLang.InsertItem(LVIF_TEXT | LVIF_IMAGE,
				m_listLang.GetItemCount(), strTemp, 0, 0, 1, NULL);

			strTemp = TRL("~LANGUAGEVERSION");
			if(strTemp == _T("~LANGUAGEVERSION")) strTemp.Empty();
//.........这里部分代码省略.........
开发者ID:joshuadugie,项目名称:KeePass-1.x,代码行数:101,代码来源:LanguagesDlg.cpp

示例15: hash

Name::Name(const std_string& name)
	: hash(GenerateStringHash(name.c_str()))
	, text(name)
{
}
开发者ID:bcontant,项目名称:TentGine,代码行数:5,代码来源:Name.cpp


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