当前位置: 首页>>代码示例>>C++>>正文


C++ CAtlList::AddHead方法代码示例

本文整理汇总了C++中CAtlList::AddHead方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::AddHead方法的具体用法?C++ CAtlList::AddHead怎么用?C++ CAtlList::AddHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAtlList的用法示例。


在下文中一共展示了CAtlList::AddHead方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoAtlCustomTraitsList

void DoAtlCustomTraitsList()
{
   // Declare the array, with our data type and traits class 

   CAtlList < MyData, MyTraits > MyList;

   // Create some variables of our data type

   MyData add_item, search_item;

   // Add some elements to the list.

   add_item.ID = 1;
   _stprintf_s(add_item.name, _T("Rumpelstiltskin"));
   _stprintf_s(add_item.address, _T("One Grimm Way"));

   MyList.AddHead(add_item);

   add_item.ID = 2;
   _stprintf_s(add_item.name, _T("Rapunzel"));
   _stprintf_s(add_item.address, _T("One Grimm Way"));

   MyList.AddHead(add_item);

   add_item.ID = 3;
   _stprintf_s(add_item.name, _T("Cinderella"));
   _stprintf_s(add_item.address, _T("Two Grimm Way"));

   MyList.AddHead(add_item);

   // Create an element which will be used
   // to search the list for a match.

   search_item.ID = 2;
   _stprintf_s(search_item.name, _T("Don't care"));
   _stprintf_s(search_item.address, _T("Don't care"));

   // Perform a comparison by searching for a match
   // between any element in the list, and our
   // search item. This operation will use the
   // (overridden) comparison operator and will
   // find a match when the IDs are the same.

   POSITION i;

   i = MyList.Find(search_item);

   if (i != NULL)
      _tprintf_s(_T("Item found!\n"));
   else
      _tprintf_s(_T("Item not found.\n"));
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:52,代码来源:atl-collection-classes_1.cpp

示例2: SetupList

void CFavoriteOrganizeDlg::SetupList(bool fSave)
{
    int i = m_tab.GetCurSel();

    if (fSave) {
        CAtlList<CString> sl;

        for (int j = 0; j < m_list.GetItemCount(); j++) {
            CAtlList<CString> args;
            ExplodeEsc(m_sl[i].GetAt((POSITION)m_list.GetItemData(j)), args, _T(';'));
            args.RemoveHead();
            args.AddHead(m_list.GetItemText(j, 0));
            sl.AddTail(ImplodeEsc(args, _T(';')));
        }

        m_sl[i].RemoveAll();
        m_sl[i].AddTailList(&sl);
    } else {
        m_list.DeleteAllItems();

        POSITION pos = m_sl[i].GetHeadPosition(), tmp;
        while (pos) {
            tmp = pos;

            CAtlList<CString> sl;
            ExplodeEsc(m_sl[i].GetNext(pos), sl, _T(';'), 3);

            int n = m_list.InsertItem(m_list.GetItemCount(), sl.RemoveHead());
            m_list.SetItemData(n, (DWORD_PTR)tmp);

            if (!sl.IsEmpty()) {
                REFERENCE_TIME rt = 0;
                if (1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) {
                    DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt);

                    CString str;
                    str.Format(_T("[%02d:%02d:%02d]"), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
                    m_list.SetItemText(n, 1, str);
                }
            }
        }

        UpdateColumnsSizes();
    }
}
开发者ID:GottfriedCP,项目名称:mpc-hc,代码行数:45,代码来源:FavoriteOrganizeDlg.cpp

示例3: ParseBDMVPlayList

bool CPlayerPlaylistBar::ParseBDMVPlayList(CString fn)
{
    CHdmvClipInfo ClipInfo;
    CString strPlaylistFile;
    CAtlList<CHdmvClipInfo::PlaylistItem>   MainPlaylist;

    CPath Path(fn);
    Path.RemoveFileSpec();
    Path.RemoveFileSpec();

    if (SUCCEEDED(ClipInfo.FindMainMovie(Path + L"\\", strPlaylistFile, MainPlaylist, ((CMainFrame*)GetParentFrame())->m_MPLSPlaylist))) {
        CAtlList<CString> strFiles;
        strFiles.AddHead(strPlaylistFile);
        Append(strFiles, MainPlaylist.GetCount() > 1, NULL);
    }

    return m_pl.GetCount() > 0;
}
开发者ID:Azpidatziak,项目名称:mpc-hc,代码行数:18,代码来源:PlayerPlaylistBar.cpp

示例4: Render

HRESULT XySubRenderProviderWrapper::Render( REFERENCE_TIME now, POSITION pos, double fps )
{
    if(m_pSubPic && m_pSubPic->GetStart() <= now && now < m_pSubPic->GetStop())
    {
        return S_OK;
    }
    HRESULT hr = E_FAIL;

    //should always re-alloc one for the old be in used by the consumer
    m_pSubPic = NULL;
    ASSERT(m_allocator);
    if(FAILED(m_allocator->AllocDynamicEx(&m_pSubPic))) {
        XY_LOG_ERROR("Failed to allocate subpic");
        return E_FAIL;
    }
    ASSERT(m_pSubPic);

    if(FAILED(m_provider->Lock())) {
        return hr;
    }

    CMemSubPic * mem_subpic = dynamic_cast<CMemSubPic*>((ISubPicEx *)m_pSubPic);
    ASSERT(mem_subpic);
    SubPicDesc spd;
    if(SUCCEEDED(m_pSubPic->Lock(spd)))
    {
        CAtlList<CRect> rectList;
        DWORD color = 0xFF000000;
        if(SUCCEEDED(m_pSubPic->ClearDirtyRect(color)))
        {
            hr = m_provider->RenderEx(spd, now, fps, rectList);

            if (!m_provider->IsAnimated(pos))
            {
                REFERENCE_TIME start = m_provider->GetStart(pos, fps);
                REFERENCE_TIME stop = m_provider->GetStop(pos, fps);
                XY_LOG_TRACE(XY_LOG_VAR_2_STR(start)<<XY_LOG_VAR_2_STR(stop));
                m_pSubPic->SetStart(start);
                m_pSubPic->SetStop(stop);
            }
            else
            {
                m_pSubPic->SetStart(now);
                m_pSubPic->SetStop(now+1);
            }
        }
        else
        {
            rectList.AddHead(CRect(CPoint(0,0),m_original_video_size));
            XY_LOG_ERROR("Failed to clear subpic!");
        }
        hr = m_pSubPic->UnlockEx(&rectList);
        ASSERT(SUCCEEDED(hr));
        if (FAILED(hr))
        {
            XY_LOG_ERROR("Failed to unlock subpic. "<<XY_LOG_VAR_2_STR(hr));
        }
        CRect dirty_rect;
        hr = m_pSubPic->GetDirtyRect(&dirty_rect);
        ASSERT(SUCCEEDED(hr));
        if (!dirty_rect.IsRectEmpty())
        {
            if (!m_use_dst_alpha)
            {
                hr = mem_subpic->FlipAlphaValue(dirty_rect);//fixme: mem_subpic.type is now MSP_RGBA_F, not MSP_RGBA
                ASSERT(SUCCEEDED(hr));
                if (FAILED(hr))
                {
                    XY_LOG_ERROR("Failed. "<<XY_LOG_VAR_2_STR(hr));
                    return hr;
                }
            }
        }
        else
        {
            hr = S_FALSE;
        }
    }

    m_provider->Unlock();
    if (hr == S_OK)
    {
        CRect video_rect(CPoint(0,0), m_original_video_size);
        m_xy_sub_render_frame = DEBUG_NEW XySubRenderFrameWrapper(mem_subpic, video_rect, video_rect, now, &hr);
    }
    else
    {
        m_xy_sub_render_frame = NULL;
    }
    return hr;
}
开发者ID:aracnoz,项目名称:xy-VSFilter,代码行数:91,代码来源:XySubRenderProviderWrapper.cpp

示例5: ATLASSERT

   // Define the integer list
   CAtlList<int> myList;

   // Populate the list
   POSITION myPos = myList.AddHead(1);
   myPos = myList.InsertBefore(myPos, 2);
   myPos = myList.InsertBefore(myPos, 3);

   // Confirm the head value is as expected
   ATLASSERT(myList.GetHead() == 3);  
开发者ID:terryjintry,项目名称:OLSource1,代码行数:10,代码来源:catllist-class_12.cpp


注:本文中的CAtlList::AddHead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。