VC中使用SCRIPT 正则写的LRC歌词分析类(2)
}
//---------------------
/*
短整型(int)
i = atoi(temp);
长整型(long)
l = atol(temp);
浮点(double)
d = atof(temp);
*/
regExpPtr->PutPattern("[offset:(-?d+)]");
matches = regExpPtr->Execute((const char * )Text); //用指针要出错
if(matches->GetCount()>0)
{
pMatch=((IMatch2Ptr)matches->GetItem(0))->GetSubMatches();//SubMatches;
by= (pMatch->GetItem(0)).bstrVal;
try
{
oTime=float(atof(by));
}catch(...){};
}
//-----------------------------------------
regExpPtr->PutPattern("[by:([^[]:]+)]");
matches = regExpPtr->Execute((const char * )Text); //用指针要出错
if(matches->GetCount()>0)
{
pMatch=((IMatch2Ptr)matches->GetItem(0))->GetSubMatches();//SubMatches;
by= (pMatch->GetItem(0)).bstrVal;
}
regExpPtr->PutPattern("[d+:[d.]+]");
matches = regExpPtr->Execute((const char * )Text); //用指针要出错
if(matches->GetCount()>0)
{
isLrcFile=TRUE;
}
else
{
isLrcFile=FALSE;
}
pMatch=NULL;
matches=NULL;
regExpPtr=NULL;
//"[d+:[d.]+]"
}
//catch(_com_error& e)
//{
//}
catch(...)
{
}
CoUninitialize();