VC中使用SCRIPT 正则写的LRC歌词分析类(4)
}
IRegExpSubPtr=NULL;
matches=NULL;
matches2=NULL;
regExpPtr=NULL;
}
catch(...){};
//---------------------
//CoUninitialize();
return m_reText;
}
void LRCOBJECT::AddToList(const char * text)
{
//lrcBoxclassList
Release();
CString m_Text,m_strtmp;
lrcBox* pLrcBox;
float m_t,m_t2;
//CoInitialize(NULL);
CString debg,ttt;
try
{
IRegExpPtr regExpPtr(__uuidof(RegExp));
regExpPtr->PutGlobal(VARIANT_TRUE);
regExpPtr->PutPattern("[([^:]+):([^]]+)](.*)[
]");
IMatchCollectionPtr matches = regExpPtr->Execute(text);
int m_count=matches->GetCount();
ISubMatchesPtr pSubMatch;
if(m_count>0)
{
for(int i=0;i<m_count;i++)
{
pSubMatch=((IMatch2Ptr)matches->GetItem(i))->GetSubMatches();//SubMatches;
m_Text= (pSubMatch->GetItem(2)).bstrVal;
//::MessageBox(::GetTopWindow(::GetDesktopWindow()),m_Text, "URL CLIENT", MB_OK);
m_t=float(atof((CString)(pSubMatch->GetItem(0)).bstrVal));
m_t2=float(atof((CString)(pSubMatch->GetItem(1)).bstrVal));
m_t=m_t*60 + m_t2;
pLrcBox=new lrcBox(m_t,m_Text);
//Length++;
lrcBoxclassList.AddTail(pLrcBox);
}
}
pSubMatch=NULL;
matches=NULL;
regExpPtr=NULL;
}
catch(...)
{
Release();
}
//-----------------------------
//-----------------------------
//CoUninitialize();
PaiXu();
}