本文整理汇总了C++中TSTR::Substr方法的典型用法代码示例。如果您正苦于以下问题:C++ TSTR::Substr方法的具体用法?C++ TSTR::Substr怎么用?C++ TSTR::Substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSTR
的用法示例。
在下文中一共展示了TSTR::Substr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atoi
void DxStdMtl2::PatchInLightNodes()
{
for(int i = 0; i< sceneLights.Count(); i++)
{
int curLightIndex = -1;
for(int j=0; j<elementContainer.NumberofElementsByType(EffectElements::kEleLight);j++)
{
LightElement * le = static_cast<LightElement*>(elementContainer.GetElementByType(j, EffectElements::kEleLight));
TSTR paramName = le->GetParameterName();
int actualLength = paramName.first('_');
for(int k=0; k<actualLength;k++)
{
if(isdigit(paramName[k]))
{
TSTR numChar = paramName.Substr(k,actualLength-k);
int index = atoi(numChar.data());
if(index == i)
{
le->AddLight(sceneLights[i]->GetLightNode());
break;
}
}
}
}
}
}
示例2: GetAudioStream
PAVISTREAM GetAudioStream(TSTR name,TCHAR *dir)
{
HRESULT hr;
PAVIFILE pfile;
PAVISTREAM pstream = NULL;
BOOL res = TRUE;
#ifndef INTERIM_64_BIT // CCJ
// RB 5/10/99: Reworked this a bit. Added the current scene dir as a possible search location.
// Also now using SplitPathFile() instead of doing it by hand.
hr = AVIFileOpen(&pfile,name,OF_READ,NULL);
if (hr) {
TSTR fileName, tryName;
SplitPathFile(name, NULL, &fileName);
// Try the given directory (which is the sound dir)
tryName = TSTR(dir) + TSTR(_T("\\")) + fileName;
hr = AVIFileOpen(&pfile,tryName,OF_READ,NULL);
if (hr) {
// Try the scene directory
TSTR sceneName = GetCOREInterface()->GetCurFilePath();
TSTR scenePath;
SplitPathFile(sceneName, &scenePath, NULL);
tryName = scenePath + TSTR(_T("\\")) + fileName;
hr = AVIFileOpen(&pfile,tryName,OF_READ,NULL);
}
#if 0
// Try the file in the given directory
int i = name.Length()-1;
while (i>0) {
if (name[i]=='\\' ||
name[i]==':' ||
name[i]=='/') {
i++;
break;
}
i--;
}
if (name.Length()-i>0) {
TSTR newname = TSTR(dir) + TSTR(_T("\\")) + name.Substr(i,name.Length()-i);
hr = AVIFileOpen(&pfile,newname,OF_READ,NULL);
}
#endif
}
if (hr) return NULL;
AVIFileGetStream(pfile,&pstream,streamtypeAUDIO,0);
AVIFileRelease(pfile);
if (!pstream) return NULL;
// Verify it's PCM
PCMWAVEFORMAT wf;
LONG l = sizeof(wf);
AVIStreamReadFormat(pstream,0,&wf,&l);
if (!l) {
AVIStreamRelease(pstream);
return NULL;
}
if (wf.wf.wFormatTag != WAVE_FORMAT_PCM) {
AVIStreamRelease(pstream);
return NULL;
}
#endif // INTERIM_64_BIT
return pstream;
}
示例3: CancelException
int Unreal3DExport::DoExport( const TCHAR *name, ExpInterface *ei, Interface *i, BOOL suppressPrompts, DWORD options )
{
int Result = FALSE;
// Set a global prompt display switch
bShowPrompts = suppressPrompts ? false : true;
bExportSelected = (options & SCENE_EXPORT_SELECTED) ? true : false;
// Get file names
SplitFilename(TSTR(name), &FilePath, &FileName, &FileExt);
if( MatchPattern(FileName,TSTR(_T("*_d")),TRUE)
|| MatchPattern(FileName,TSTR(_T("*_a")),TRUE) )
{
FileName = FileName.Substr(0,FileName.length()-2);
}
ModelFileName = FilePath + _T("\\") + FileName + TSTR(_T("_d")) + FileExt;
AnimFileName = FilePath + _T("\\") + FileName + TSTR(_T("_a")) + FileExt;
ScriptFileName = FilePath + _T("\\") + FileName + TSTR(_T("_rc.uc"));
// Open Log
fLog = _tfopen(FilePath + _T("\\") + FileName + _T(".log") ,_T("wb"));
// Init
pInt = GetCOREInterface();
pInt->ProgressStart( GetString(IDS_INFO_INIT), TRUE, fn, this);
Progress += U3D_PROGRESS_INIT;
try
{
MyErrorProc pErrorProc;
SetErrorCallBack(&pErrorProc);
ReadConfig();
//if(bShowPrompts)
/*DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_PANEL),
GetActiveWindow(),
Unreal3DExportOptionsDlgProc, (LPARAM)this);*/
//if(showPrompts)
{
// Prompt the user with our dialogbox, and get all the options.
if(!DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_PANEL),
GetActiveWindow(),
Unreal3DExportOptionsDlgProc, (LPARAM)this))
{
throw CancelException();
}
}
// Enumerate interesting nodes
Init();
// Fetch data from nodes
GetTris();
GetAnim();
// Prepare data for writing
Prepare();
// Write to files
WriteScript();
WriteModel();
WriteTracking();
// Show optional summary
ShowSummary();
WriteConfig();
Result = IMPEXP_SUCCESS;
}
catch( CancelException& )
{
Result = IMPEXP_CANCEL;
}
catch( MAXException& e )
{
if( bShowPrompts && !e.message.isNull() )
{
MaxMsgBox(pInt->GetMAXHWnd(),e.message,ShortDesc(),MB_OK|MB_ICONERROR);
}
Result = IMPEXP_FAIL;
}
// Release scene
if( pScene != NULL )
{
pScene->ReleaseIGame();
pScene = NULL;
}
// Close files
//.........这里部分代码省略.........