本文整理汇总了C++中CAtlList::SwapElements方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::SwapElements方法的具体用法?C++ CAtlList::SwapElements怎么用?C++ CAtlList::SwapElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlList
的用法示例。
在下文中一共展示了CAtlList::SwapElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindMainMovie
HRESULT CHdmvClipInfo::FindMainMovie(LPCTSTR strFolder, CString& strPlaylistFile, CAtlList<PlaylistItem>& MainPlaylist, CAtlList<PlaylistItem>& MPLSPlaylists)
{
HRESULT hr = E_FAIL;
CString strPath(strFolder);
CString strFilter;
MPLSPlaylists.RemoveAll();
CAtlList<PlaylistItem> Playlist;
WIN32_FIND_DATA fd = {0};
strPath.Replace(_T("\\PLAYLIST\\"), _T("\\"));
strPath.Replace(_T("\\STREAM\\"), _T("\\"));
strPath += _T("\\BDMV\\");
strFilter.Format(_T("%sPLAYLIST\\*.mpls"), strPath);
HANDLE hFind = FindFirstFile(strFilter, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
REFERENCE_TIME rtMax = 0;
REFERENCE_TIME rtCurrent;
CString strCurrentPlaylist;
do {
strCurrentPlaylist.Format(_T("%sPLAYLIST\\%s"), strPath, fd.cFileName);
Playlist.RemoveAll();
// Main movie shouldn't have duplicate M2TS filename...
if (ReadPlaylist(strCurrentPlaylist, rtCurrent, Playlist) == S_OK) {
if (rtCurrent > rtMax) {
rtMax = rtCurrent;
strPlaylistFile = strCurrentPlaylist;
MainPlaylist.RemoveAll();
POSITION pos = Playlist.GetHeadPosition();
while (pos) {
MainPlaylist.AddTail(Playlist.GetNext(pos));
}
hr = S_OK;
}
if (rtCurrent >= (REFERENCE_TIME)MIN_LIMIT * 600000000) {
PlaylistItem Item;
Item.m_strFileName = strCurrentPlaylist;
Item.m_rtIn = 0;
Item.m_rtOut = rtCurrent;
MPLSPlaylists.AddTail(Item);
}
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
if (MPLSPlaylists.GetCount() > 1) {
// bubble sort
for (size_t j = 0; j < MPLSPlaylists.GetCount(); j++) {
for (size_t i = 0; i < MPLSPlaylists.GetCount() - 1; i++) {
if (MPLSPlaylists.GetAt(MPLSPlaylists.FindIndex(i)).Duration() < MPLSPlaylists.GetAt(MPLSPlaylists.FindIndex(i + 1)).Duration()) {
MPLSPlaylists.SwapElements(MPLSPlaylists.FindIndex(i), MPLSPlaylists.FindIndex(i + 1));
}
}
}
}
return hr;
}