VC中使用SCRIPT 正则写的LRC歌词分析类(5)
void LRCOBJECT::PaiXu(void)
{
if(lrcBoxclassList.IsEmpty())
{
return;
}
bool biaoZhi=false;
lrcBox * tmp1,* tmp2,*tmp3;
//var tmp2;
int i,dangQian=(int)lrcBoxclassList.GetCount();
POSITION ps,ps2;
//---------------------
/*
CString m_text,tmp,tm;
int oo;
oo=0;
ps=lrcBoxclassList.GetHeadPosition();
while(ps != NULL)
{
tmp.Format("%d",++oo);
m_text+=tmp+" - "+((lrcBox *)lrcBoxclassList.GetNext(ps))->lrcText;
}
::MessageBox(::GetTopWindow(::GetDesktopWindow()),m_text, "URL CLIENT", MB_OK);
*/
//----------------------------
do{
biaoZhi=0;//冒泡标志
for(i=0;i<(dangQian-1);i++){
ps= lrcBoxclassList.FindIndex(i);
ps2=lrcBoxclassList.FindIndex(i+1);
tmp1=(lrcBox*)lrcBoxclassList.GetAt(ps);
tmp2=(lrcBox*)lrcBoxclassList.GetAt(ps2);
if(tmp1->lrcTime >tmp2->lrcTime)
{//互换
tmp3=tmp1;
lrcBoxclassList.SetAt(ps,tmp2);
lrcBoxclassList.SetAt(ps2,tmp3);
biaoZhi=true;
}//if
}//for
}
while(biaoZhi);
//-------------------------------
/*
oo=0;
ps=lrcBoxclassList.GetHeadPosition();
m_text.Empty();
float uu;
while(ps != NULL)
{
tmp.Format("%d",++oo);
uu=((lrcBox *)lrcBoxclassList.GetAt(ps))->lrcTime;
tm.Format("%f",uu);
m_text+=tmp+" - " +tm+ " "+((lrcBox *)lrcBoxclassList.GetNext(ps))->lrcText;
}
::MessageBox(::GetTopWindow(::GetDesktopWindow()),m_text, "URL CLIENT", MB_OK);
*/
}