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


C++ CPVRChannelGroups::RemoveFromAllGroups方法代码示例

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


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

示例1: RemoveDeletedChannels

bool CPVRChannelGroup::RemoveDeletedChannels(const CPVRChannelGroup &channels)
{
  bool bReturn(false);
  CPVRChannelGroups *groups = g_PVRChannelGroups->Get(m_bRadio);

  CSingleLock lock(m_critSection);

  /* check for deleted channels */
  for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end();)
  {
    CSingleLock lock(channels.m_critSection);
    if (channels.m_members.find((*it).channel->StorageId()) == channels.m_members.end())
    {
      /* channel was not found */
      CLog::Log(LOGINFO,"PVRChannelGroup - %s - deleted %s channel '%s' from group '%s'",
          __FUNCTION__, m_bRadio ? "radio" : "TV", (*it).channel->ChannelName().c_str(), GroupName().c_str());

      m_members.erase((*it).channel->StorageId());

      //we need a copy of our iterators data so that we can find it later on
      //if the vector has changed.
      auto group = *it;
      /* remove this channel from all non-system groups if this is the internal group */
      if (IsInternalGroup())
      {
        groups->RemoveFromAllGroups((*it).channel);

        /* since it was not found in the internal group, it was deleted from the backend */
        group.channel->Delete();
      }

      //our vector can have been modified during the call to RemoveFromAllGroups
      //make no assumption and search for the value to be removed
      auto possiblyRemovedGroup = std::find_if(m_sortedMembers.begin(), m_sortedMembers.end(), [&group](const PVRChannelGroupMember& it)
      {
        return  group.channel == it.channel &&
                group.iChannelNumber == it.iChannelNumber &&
                group.iSubChannelNumber == it.iSubChannelNumber;
      });

      if (possiblyRemovedGroup != m_sortedMembers.end())
        m_sortedMembers.erase(possiblyRemovedGroup);
      
      //We have to start over from the beginning, list can have been modified and
      //resorted, there's no safe way to continue where we left of
      it = m_sortedMembers.begin();
      m_bChanged = true;
      bReturn = true;
    }
    else
    {
      ++it;
    }
  }

  return bReturn;
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:57,代码来源:PVRChannelGroup.cpp


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