本文整理汇总了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;
}
示例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;
}