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


C++ CPVRChannel::SetUniqueID方法代码示例

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


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

示例1: UpdateChannel

bool CPVRChannelGroupInternal::UpdateChannel(const CPVRChannel &channel)
{
  CPVRChannel *updateChannel = (CPVRChannel *) GetByUniqueID(channel.UniqueID());

  if (!updateChannel)
  {
    updateChannel = new CPVRChannel(channel.IsRadio());
    PVRChannelGroupMember newMember = { updateChannel, 0 };
    push_back(newMember);
    updateChannel->SetUniqueID(channel.UniqueID());
  }
  updateChannel->UpdateFromClient(channel);

  return updateChannel->Persist(!m_bLoaded);
}
开发者ID:vanegithub,项目名称:xbmc,代码行数:15,代码来源:PVRChannelGroupInternal.cpp

示例2: UpdateGroupEntries

bool CPVRChannelGroupInternal::UpdateGroupEntries(const CPVRChannelGroup &channels)
{
  bool bChanged = false;
  int iCurSize = size();

  CPVRChannelGroup *newChannels = new CPVRChannelGroup(m_bRadio);

  CPVRDatabase *database = g_PVRManager.GetTVDatabase();
  if (!database || !database->Open())
    return bChanged;

  /* go through the channel list and check for updated or new channels */
  for (unsigned int iChannelPtr = 0; iChannelPtr < channels.size(); iChannelPtr++)
  {
    const CPVRChannel *channel = channels.at(iChannelPtr).channel;

    /* check if this channel is present in this container */
    CPVRChannel *existingChannel = (CPVRChannel *) GetByClient(channel->UniqueID(), channel->ClientID());
    if (existingChannel)
    {
      /* if it's present, update the current tag */
      if (existingChannel->UpdateFromClient(*channel))
      {
        bChanged = true;

        CLog::Log(LOGINFO,"PVRChannelGroupInternal - %s - updated %s channel '%s'",
            __FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str());
      }
    }
    else
    {
      /* new channel */
      CPVRChannel *newChannel = new CPVRChannel(m_bRadio);
      newChannel->SetUniqueID(channel->UniqueID(), false);
      newChannel->UpdateFromClient(*channel);
      newChannels->AddToGroup(newChannel);
      int iChannelNumber = iCurSize == 0 ? channel->ClientChannelNumber() : 0;
      InsertInGroup(newChannel, iChannelNumber, false);
      bChanged = true;

      CLog::Log(LOGINFO,"PVRChannelGroupInternal - %s - added %s channel '%s' at position %d",
          __FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str(), iChannelNumber);
    }
  }

  /* persist changes */
  for (unsigned int iChannelPtr = 0; iChannelPtr < newChannels->size(); iChannelPtr++)
    ((CPVRChannel *) newChannels->GetByIndex(iChannelPtr))->Persist(false); /* write immediately to get a db id */
  delete newChannels;

  /* check for deleted channels */
  unsigned int iSize = size();
  for (unsigned int iChannelPtr = 0; iChannelPtr < iSize; iChannelPtr++)
  {
    CPVRChannel *channel = (CPVRChannel *) GetByIndex(iChannelPtr);
    if (!channel)
      continue;
    if (channels.GetByClient(channel->UniqueID(), channel->ClientID()) == NULL)
    {
      /* channel was not found */
      CLog::Log(LOGINFO,"PVRChannelGroupInternal - %s - deleted %s channel '%s'",
          __FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str());

      /* remove this channel from all non-system groups */
      ((CPVRChannelGroups *) g_PVRChannelGroups->Get(m_bRadio))->RemoveFromAllGroups(channel);

      delete at(iChannelPtr).channel;
      erase(begin() + iChannelPtr);
      iChannelPtr--;
      iSize--;
      bChanged = true;
    }
  }

  database->Close();

  /* try to find channel icons */
  SearchAndSetChannelIcons();
  CacheIcons();

  if (bChanged || HasChanges())
  {
    /* remove invalid channels */
    RemoveInvalidChannels();

    /* sort by client channel number if this is the first time */
    if (iCurSize == 0)
      SortByClientChannelNumber();

    /* renumber to make sure all channels have a channel number.
       new channels were added at the back, so they'll get the highest numbers */
    Renumber();

    return Persist();
  }
  else
  {
    return true;
  }
}
开发者ID:,项目名称:,代码行数:100,代码来源:


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