www.pudn.com > MCIWnd_MediaPlayer.rar > PlayList.cpp
#include "StdAfx.h"
#include ".\playlist.h"
CPlayList::CPlayList(void)
{
}
CPlayList::~CPlayList(void)
{
}
int CPlayList::AddFile(CString file)
{
PlayNode no;
no.fileName=file.Mid(file.ReverseFind('\\')+1);
no.path=file;
fileList.AddTail(no);
return fileList.GetCount();
}
int CPlayList::AddDir(CString dir)
{
return 0;
}
CString CPlayList::GetCur(int index)
{
POSITION ps=fileList.GetHeadPosition();
while(index-->0&&ps!=NULL)
{
fileList.GetNext(ps);
}
return ((PlayNode)fileList.GetAt(ps)).path;
}
int CPlayList::Reset(void)
{
fileList.RemoveAll();
return 0;
}
int CPlayList::Del(int index)
{
POSITION ps=fileList.GetHeadPosition();
while(index-->0&&ps!=NULL)
{
fileList.GetNext(ps);
}
fileList.RemoveAt(ps);
return fileList.GetCount();
}