本文整理汇总了C++中CEpgInfoTagPtr::SetEpg方法的典型用法代码示例。如果您正苦于以下问题:C++ CEpgInfoTagPtr::SetEpg方法的具体用法?C++ CEpgInfoTagPtr::SetEpg怎么用?C++ CEpgInfoTagPtr::SetEpg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEpgInfoTagPtr
的用法示例。
在下文中一共展示了CEpgInfoTagPtr::SetEpg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateEntry
bool CEpg::UpdateEntry(const CEpgInfoTagPtr &tag, bool bUpdateDatabase /* = false */)
{
CEpgInfoTagPtr infoTag;
{
CSingleLock lock(m_critSection);
std::map<CDateTime, CEpgInfoTagPtr>::iterator it = m_tags.find(tag->StartAsUTC());
bool bNewTag(false);
if (it != m_tags.end())
{
infoTag = it->second;
}
else
{
infoTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
infoTag->SetUniqueBroadcastID(tag->UniqueBroadcastID());
m_tags.insert(std::make_pair(tag->StartAsUTC(), infoTag));
bNewTag = true;
}
infoTag->Update(*tag, bNewTag);
infoTag->SetEpg(this);
infoTag->SetPVRChannel(m_pvrChannel);
if (bUpdateDatabase)
m_changedTags.insert(std::make_pair(infoTag->UniqueBroadcastID(), infoTag));
}
infoTag->SetTimer(g_PVRTimers->GetTimerForEpgTag(infoTag));
infoTag->SetRecording(g_PVRRecordings->GetRecordingForEpgTag(infoTag));
return true;
}
示例2: UpdateEntry
bool CEpg::UpdateEntry(const CEpgInfoTag &tag, bool bUpdateDatabase /* = false */, bool bSort /* = true */)
{
CEpgInfoTagPtr infoTag;
CSingleLock lock(m_critSection);
map<CDateTime, CEpgInfoTagPtr>::iterator it = m_tags.find(tag.StartAsUTC());
bool bNewTag(false);
if (it != m_tags.end())
{
infoTag = it->second;
}
else
{
/* create a new tag if no tag with this ID exists */
infoTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
infoTag->SetUniqueBroadcastID(tag.UniqueBroadcastID());
m_tags.insert(make_pair(tag.StartAsUTC(), infoTag));
bNewTag = true;
}
infoTag->Update(tag, bNewTag);
infoTag->SetEpg(this);
infoTag->SetPVRChannel(m_pvrChannel);
if (bUpdateDatabase)
m_changedTags.insert(make_pair(infoTag->UniqueBroadcastID(), infoTag));
return true;
}
示例3: AddEntry
void CEpg::AddEntry(const CEpgInfoTag &tag)
{
CEpgInfoTagPtr newTag;
CPVRChannelPtr channel;
{
CSingleLock lock(m_critSection);
std::map<CDateTime, CEpgInfoTagPtr>::iterator itr = m_tags.find(tag.StartAsUTC());
if (itr != m_tags.end())
newTag = itr->second;
else
{
newTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
m_tags.insert(make_pair(tag.StartAsUTC(), newTag));
}
channel = m_pvrChannel;
}
if (newTag)
{
newTag->Update(tag);
newTag->SetPVRChannel(channel);
newTag->SetEpg(this);
newTag->SetTimer(g_PVRTimers->GetTimerForEpgTag(newTag));
newTag->SetRecording(g_PVRRecordings->GetRecordingForEpgTag(newTag));
}
}
示例4: UpdateEntry
bool CEpg::UpdateEntry(const CEpgInfoTagPtr &tag, EPG_EVENT_STATE newState, std::map<CDateTime, CEpgInfoTagPtr>::iterator &eit, bool bUpdateDatabase /* = false */)
{
CEpgInfoTagPtr infoTag;
bool bNewTag(false);
CSingleLock lock(m_critSection);
if (newState == EPG_EVENT_CREATED || newState == EPG_EVENT_UPDATED)
{
// Reuse passed iterator in favor of doing expensive find self
auto it = (eit == m_tags.end()) ? m_tags.find(tag->StartAsUTC()) : eit;
if (it != m_tags.end())
{
if (newState == EPG_EVENT_CREATED)
CLog::Log(LOGERROR, "EPG - %s - Error: EPG_EVENT_CREATED: uid %d found! Updating existing event.", __FUNCTION__, tag->UniqueBroadcastID());
infoTag = it->second;
}
else
{
if (newState == EPG_EVENT_UPDATED)
CLog::Log(LOGERROR, "EPG - %s - Error: EPG_EVENT_UPDATED: uid %d not found. Inserting new event.", __FUNCTION__, tag->UniqueBroadcastID());
infoTag.reset(new CEpgInfoTag(this, m_pvrChannel, m_strName, m_pvrChannel ? m_pvrChannel->IconPath() : ""));
infoTag->SetUniqueBroadcastID(tag->UniqueBroadcastID());
m_tags.insert(std::make_pair(tag->StartAsUTC(), infoTag));
bNewTag = true;
}
}
else if (newState == EPG_EVENT_DELETED)
{
// Reuse passed iterator in favor of doing expensive find self
auto it = (eit == m_tags.end()) ? m_tags.find(tag->StartAsUTC()) : eit;
if (it == m_tags.end())
{
// not guranteed that deleted tag contains valid start time. search sequential.
for (it = m_tags.begin(); it != m_tags.end(); ++it)
{
if (it->second->UniqueBroadcastID() == tag->UniqueBroadcastID())
break;
}
}
if (it != m_tags.end())
{
it->second->ClearTimer();
m_tags.erase(it);
if (bUpdateDatabase)
m_deletedTags.insert(std::make_pair(infoTag->UniqueBroadcastID(), infoTag));
}
else
{
CLog::Log(LOGERROR, "EPG - %s - Error: EPG_EVENT_DELETED: uid %d not found.", __FUNCTION__, tag->UniqueBroadcastID());
return false;
}
return true;
}
else
{
CLog::Log(LOGERROR, "EPG - %s - unknownn epg event state '%d'.", __FUNCTION__, newState);
return false;
}
infoTag->Update(*tag, bNewTag);
infoTag->SetEpg(this);
infoTag->SetPVRChannel(m_pvrChannel);
if (bUpdateDatabase)
m_changedTags.insert(std::make_pair(infoTag->UniqueBroadcastID(), infoTag));
return true;
}