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


C++ StdString::GetToken方法代码示例

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


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

示例1: EditDocument

//---------------------------------------------------------------------
// Function:	EditDocument
// Description:	Edit an GUIEditor Document retrieving initial data 
//					from a archive
// Parameters:	ar = archive to load into document
// Returns:		DWORD = possible error or 0 for no error
//---------------------------------------------------------------------
DWORD CGUIEditor::EditDocument()
{
	if (!m_bCreated)
	{
		SetupTabBar();
		m_bCreated = true;
	}
	if (!m_bDocOpen)
	{
		StdString res;
		ReadINIKey(_T("LastUsedResolution"), res, _T("GUIEditor"), _T("800x600"));
		StdString x, y;
		res.GetToken(_T("x"), x);
		res.GetToken(_T("x"), y);
		UINT iX, iY;
		iX = (UINT)atoi(x.c_str());
		iY = (UINT)atoi(y.c_str());
		CreateDocView(iX, iY);
	}
	else
	{
		MessageBox(NULL, _T("Can't have more than one GUI open at a time"), _T("Sorry, mac"), MB_OK);
	}
	return NO_ERROR;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:32,代码来源:GUIEditor.cpp

示例2: OnLoadFile

DWORD CSoundLoader::OnLoadFile(DWORD size, void *params)
{
	VERIFY_MESSAGE_SIZE(size, sizeof(TCHAR *));
	TCHAR *pFileName = (TCHAR *)params;
	
	StdString fileName = pFileName;

	fileName.tolower();

	DWORD retval = MSG_HANDLED_STOP;
	CHashString hszFileName(fileName);

	set<DWORD>::iterator fileIter = m_FilesLoaded.find(hszFileName.GetUniqueID());
	if (fileIter != m_FilesLoaded.end())
	{
		// this file has already been loaded (hopefully correctly)
		return retval;
	}

	StdString extension, currentToken;
	fileName.GetToken(_T("."), currentToken);

	while (_tcscmp(currentToken, _T("")) != 0)
	{
		extension = currentToken;
		fileName.GetToken(_T("."), currentToken);
	}
	
	static CHashString hszWav(_T("wav"));
	static CHashString hszOgg(_T("ogg"));
	static CHashString hszMP3(_T("mp3"));
	static CHashString hszXmp(_T("xmp"));

	CHashString hszExt(extension);
	DWORD extID = hszExt.GetUniqueID();

	if ((extID == hszWav.GetUniqueID()) ||
		(extID == hszOgg.GetUniqueID()) ||
		(extID == hszMP3.GetUniqueID()))
	{
		bool success = LoadSoundFile(fileName, &hszExt);
		if (!success)
		{
			m_ToolBox->Log(LOGWARNING, _T("Failed to load sound %s\n"), (const TCHAR*)fileName);
			retval = MSG_WARNING;
		}
		else
		{
			m_FilesLoaded.insert(hszFileName.GetUniqueID());
		}
	}

	else if (extID == hszXmp.GetUniqueID())
	{
		bool success = LoadPlaylistFile(fileName);
		if (!success)
		{
			m_ToolBox->Log(LOGWARNING, _T("Failed to load playlist %s\n"), (const TCHAR*)fileName);
			retval = MSG_WARNING;
		}
		else
		{
			m_FilesLoaded.insert(hszFileName.GetUniqueID());
		}
	}

	return retval;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:68,代码来源:SoundLoader.cpp


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