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


C++ CDateTime::IsValid方法代码示例

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


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

示例1: GetEPGDate

CDateTime CPVRChannelGroup::GetEPGDate(EpgDateType epgDateType) const
{
  CDateTime date;
  CSingleLock lock(m_critSection);
  
  for (std::vector<PVRChannelGroupMember>::const_iterator it = m_members.begin(); it != m_members.end(); it++)
  {
    if (it->channel && !it->channel->IsHidden())
    {
      CEpg* epg = it->channel->GetEPG();
      if (epg)
      {
        CDateTime epgDate;
        switch (epgDateType)
        {
          case EPG_FIRST_DATE:
            epgDate = epg->GetFirstDate();
            if (epgDate.IsValid() && (!date.IsValid() || epgDate < date))
              date = epgDate;
            break;
            
          case EPG_LAST_DATE:
            epgDate = epg->GetLastDate();
            if (epgDate.IsValid() && (!date.IsValid() || epgDate > date))
              date = epgDate;
            break;
        }
      }
    }
  }
  
  return date;
}
开发者ID:Dr-Romantic,项目名称:xbmc,代码行数:33,代码来源:PVRChannelGroup.cpp

示例2: GetEPGDate

CDateTime CPVRChannelGroup::GetEPGDate(EpgDateType epgDateType) const
{
  CDateTime date;
  CEpgPtr epg;
  CPVRChannelPtr channel;
  CSingleLock lock(m_critSection);

  for (PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
  {
    channel = it->second.channel;
    if (!channel->IsHidden() && (epg = channel->GetEPG()))
    {
      CDateTime epgDate;
      switch (epgDateType)
      {
        case EPG_FIRST_DATE:
          epgDate = epg->GetFirstDate();
          if (epgDate.IsValid() && (!date.IsValid() || epgDate < date))
            date = epgDate;
          break;

        case EPG_LAST_DATE:
          epgDate = epg->GetLastDate();
          if (epgDate.IsValid() && (!date.IsValid() || epgDate > date))
            date = epgDate;
          break;
      }
    }
  }

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

示例3: GetFirstEPGDate

const CDateTime CEpgContainer::GetFirstEPGDate(void) const
{
  CDateTime returnValue;

  CSingleLock lock(m_critSection);
  for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
  {
    CDateTime entry = at(iEpgPtr)->GetFirstDate();
    if (entry.IsValid() && (!returnValue.IsValid() || entry < returnValue))
      returnValue = entry;
  }

  return returnValue;
}
开发者ID:RoboSK,项目名称:xbmc,代码行数:14,代码来源:EpgContainer.cpp

示例4: GetCachedTexture

bool CTextureDatabase::GetCachedTexture(const CStdString &url, CTextureDetails &details)
{
  try
  {
    if (NULL == m_pDB.get()) return false;
    if (NULL == m_pDS.get()) return false;

    CStdString sql = PrepareSQL("SELECT id, cachedurl, lasthashcheck, imagehash, width, height FROM texture JOIN sizes ON (texture.id=sizes.idtexture AND sizes.size=1) WHERE url='%s'", url.c_str());
    m_pDS->query(sql.c_str());
    if (!m_pDS->eof())
    { // have some information
      details.id = m_pDS->fv(0).get_asInt();
      details.file  = m_pDS->fv(1).get_asString();
      CDateTime lastCheck;
      lastCheck.SetFromDBDateTime(m_pDS->fv(2).get_asString());
      if (lastCheck.IsValid() && lastCheck + CDateTimeSpan(1,0,0,0) < CDateTime::GetCurrentDateTime())
        details.hash = m_pDS->fv(3).get_asString();
      details.width = m_pDS->fv(4).get_asInt();
      details.height = m_pDS->fv(5).get_asInt();
      m_pDS->close();
      return true;
    }
    m_pDS->close();
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s, failed on url '%s'", __FUNCTION__, url.c_str());
  }
  return false;
}
开发者ID:A600,项目名称:xbmc,代码行数:30,代码来源:TextureDatabase.cpp

示例5: GetLastEPGDate

const CDateTime CEpgContainer::GetLastEPGDate(void)
{
  CDateTime returnValue;

  CSingleLock lock(m_critSection);
  for (map<unsigned int, CEpg *>::iterator it = m_epgs.begin(); it != m_epgs.end(); it++)
  {
    lock.Leave();
    CDateTime entry = it->second->GetLastDate();
    if (entry.IsValid() && (!returnValue.IsValid() || entry > returnValue))
      returnValue = entry;
    lock.Enter();
  }

  return returnValue;
}
开发者ID:koying,项目名称:xbmc-pivos,代码行数:16,代码来源:EpgContainer.cpp

示例6: GetCachedTexture

bool CTextureDatabase::GetCachedTexture(const CStdString &url, CStdString &cacheFile, CStdString &imageHash)
{
  try
  {
    if (NULL == m_pDB.get()) return false;
    if (NULL == m_pDS.get()) return false;

    CStdString sql = PrepareSQL("select id, cachedurl, lasthashcheck, imagehash from texture where url='%s'", url.c_str());
    m_pDS->query(sql.c_str());

    if (!m_pDS->eof())
    { // have some information
      int textureID = m_pDS->fv(0).get_asInt();
      cacheFile = m_pDS->fv(1).get_asString();
      CDateTime lastCheck;
      lastCheck.SetFromDBDateTime(m_pDS->fv(2).get_asString());
      if (!lastCheck.IsValid() || lastCheck + CDateTimeSpan(1,0,0,0) < CDateTime::GetCurrentDateTime())
        imageHash = m_pDS->fv(3).get_asString();
      m_pDS->close();
      // update the use count
      sql = PrepareSQL("update texture set usecount=usecount+1, lastusetime=CURRENT_TIMESTAMP where id=%u", textureID);
      m_pDS->exec(sql.c_str());
      return true;
    }
    m_pDS->close();
  }
  catch (...)
  {
    CLog::Log(LOGERROR, "%s, failed on url '%s'", __FUNCTION__, url.c_str());
  }
  return false;
}
开发者ID:Ayu222,项目名称:android,代码行数:32,代码来源:TextureDatabase.cpp

示例7: SetWakeupCommand

bool CPVRManager::SetWakeupCommand(void)
{
  if (!g_guiSettings.GetBool("pvrpowermanagement.enabled"))
    return false;

  const CStdString strWakeupCommand = g_guiSettings.GetString("pvrpowermanagement.setwakeupcmd", false);
  if (!strWakeupCommand.IsEmpty() && m_timers)
  {
    time_t iWakeupTime;
    const CDateTime nextEvent = m_timers->GetNextEventTime();
    if (nextEvent.IsValid())
    {
      nextEvent.GetAsTime(iWakeupTime);
        
      CStdString strExecCommand;
      strExecCommand.Format("%s %d", strWakeupCommand, iWakeupTime);
        
      const int iReturn = system(strExecCommand.c_str());
      if (iReturn != 0)
        CLog::Log(LOGERROR, "%s - failed to execute wakeup command '%s': %s (%d)", __FUNCTION__, strExecCommand.c_str(), strerror(iReturn), iReturn);
        
      return iReturn == 0;
    }
  }

  return false;
}
开发者ID:AnXi-TieGuanYin-Tea,项目名称:plex-home-theatre,代码行数:27,代码来源:PVRManager.cpp

示例8: GetLastEPGDate

const CDateTime CEpgContainer::GetLastEPGDate(void)
{
    CDateTime returnValue;

    CSingleLock lock(m_critSection);
    for (const auto &epgEntry : m_epgs)
    {
        lock.Leave();
        CDateTime entry = epgEntry.second->GetLastDate();
        if (entry.IsValid() && (!returnValue.IsValid() || entry > returnValue))
            returnValue = entry;
        lock.Enter();
    }

    return returnValue;
}
开发者ID:RodrigoHahn,项目名称:xbmc,代码行数:16,代码来源:EpgContainer.cpp

示例9: GetFirstEPGDate

const CDateTime CEpgContainer::GetFirstEPGDate(void)
{
  CDateTime returnValue;

  CSingleLock lock(m_critSection);
  for (EPGMAP_CITR it = m_epgs.begin(); it != m_epgs.end(); it++)
  {
    lock.Leave();
    CDateTime entry = it->second->GetFirstDate();
    if (entry.IsValid() && (!returnValue.IsValid() || entry < returnValue))
      returnValue = entry;
    lock.Enter();
  }

  return returnValue;
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:16,代码来源:EpgContainer.cpp

示例10: SetWakeupCommand

bool CPVRManager::SetWakeupCommand(void)
{
  if (!CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPOWERMANAGEMENT_ENABLED))
    return false;

  const std::string strWakeupCommand = CSettings::GetInstance().GetString(CSettings::SETTING_PVRPOWERMANAGEMENT_SETWAKEUPCMD);
  if (!strWakeupCommand.empty() && m_timers)
  {
    time_t iWakeupTime;
    const CDateTime nextEvent = m_timers->GetNextEventTime();
    if (nextEvent.IsValid())
    {
      nextEvent.GetAsTime(iWakeupTime);

      std::string strExecCommand = StringUtils::Format("%s %ld", strWakeupCommand.c_str(), iWakeupTime);

      const int iReturn = system(strExecCommand.c_str());
      if (iReturn != 0)
        CLog::Log(LOGERROR, "%s - failed to execute wakeup command '%s': %s (%d)", __FUNCTION__, strExecCommand.c_str(), strerror(iReturn), iReturn);

      return iReturn == 0;
    }
  }

  return false;
}
开发者ID:dpvip,项目名称:xbmc,代码行数:26,代码来源:PVRManager.cpp

示例11: SetMode

void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const std::string &initial)
{
  m_mode = mode;
  m_block = 0;
  m_lastblock = 0;
  if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
  {
    CDateTime dateTime;
    if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS)
    {
      // check if we have a pure number
      if (initial.find_first_not_of("0123456789") == std::string::npos)
      {
        long seconds = strtol(initial.c_str(), nullptr, 10);
        dateTime = seconds;
      }
      else
      {
        std::string tmp = initial;
        // if we are handling seconds and if the string only contains
        // "mm:ss" we need to add dummy "hh:" to get "hh:mm:ss"
        if (m_mode == INPUT_TIME_SECONDS && tmp.length() <= 5)
          tmp = "00:" + tmp;
        dateTime.SetFromDBTime(tmp);
      }
    }
    else if (m_mode == INPUT_DATE)
    {
      std::string tmp = initial;
      StringUtils::Replace(tmp, '/', '.');
      dateTime.SetFromDBDate(tmp);
    }

    if (!dateTime.IsValid())
      return;

    dateTime.GetAsSystemTime(m_datetime);
    m_lastblock = (m_mode == INPUT_DATE) ? 2 : 1;
  }
  else if (m_mode == INPUT_IP_ADDRESS)
  {
    m_lastblock = 3;
    auto blocks = StringUtils::Split(initial, '.');
    if (blocks.size() != 4)
      return;

    for (size_t i = 0; i < blocks.size(); ++i)
    {
      if (blocks[i].length() > 3)
        return;

      m_ip[i] = static_cast<uint8_t>(atoi(blocks[i].c_str()));
    }
  }
  else if (m_mode == INPUT_NUMBER || m_mode == INPUT_PASSWORD)
    m_number = initial;
}
开发者ID:idekker,项目名称:xbmc,代码行数:57,代码来源:GUIDialogNumeric.cpp

示例12: PersistTags

bool CEpg::PersistTags(void) const
{
  bool bReturn = false;
  CEpgDatabase *database = g_EpgContainer.GetDatabase();

  if (!database || !database->IsOpen())
  {
    CLog::Log(LOGERROR, "EPG - %s - could not load the database", __FUNCTION__);
    return bReturn;
  }

  CDateTime first = GetFirstDate();
  CDateTime last = GetLastDate();

  time_t iStart(0), iEnd(0);
  if (first.IsValid())
    first.GetAsTime(iStart);
  if (last.IsValid())
    last.GetAsTime(iEnd);
  database->Delete(*this, iStart, iEnd);

  if (m_tags.size() > 0)
  {
    for (map<CDateTime, CEpgInfoTag *>::const_iterator it = m_tags.begin(); it != m_tags.end(); it++)
    {
      if (!it->second->Persist())
      {
        CLog::Log(LOGERROR, "failed to persist epg tag %d", it->second->UniqueBroadcastID());
        bReturn = false;
      }
    }
  }
  else
  {
    /* Return true if we have no tags, so that no error is logged */
    bReturn = true;
  }

  return bReturn;
}
开发者ID:Omel,项目名称:xbmc,代码行数:40,代码来源:Epg.cpp

示例13: Format

wxString CTimeFormat::Format(CDateTime const& time)
{
	wxString ret;
	if( time.IsValid() ) {
		if( time.GetAccuracy() > CDateTime::days ) {
			ret = FormatDateTime(time.Degenerate());
		}
		else {
			ret = FormatDate(time.Degenerate());
		}
	}
	return ret;
}
开发者ID:Typz,项目名称:FileZilla,代码行数:13,代码来源:timeformatting.cpp

示例14: Modified

bool CXmlFile::Modified()
{
	wxCHECK(!m_fileName.empty(), false);

	if (!m_modificationTime.IsValid())
		return true;

	CDateTime const modificationTime = CLocalFileSystem::GetModificationTime(m_fileName);
	if (modificationTime.IsValid() && modificationTime == m_modificationTime)
		return false;

	return true;
}
开发者ID:Typz,项目名称:FileZilla,代码行数:13,代码来源:xmlfunctions.cpp

示例15: LastRepoUpdate

CDateTime CAddonInstaller::LastRepoUpdate() const
{
  CDateTime update;
  VECADDONS addons;
  CAddonMgr::Get().GetAddons(ADDON_REPOSITORY,addons);
  for (unsigned int i=0;i<addons.size();++i)
  {
    CAddonDatabase database;
    database.Open();
    CDateTime lastUpdate = database.GetRepoTimestamp(addons[i]->ID());
    if (lastUpdate.IsValid() && lastUpdate > update)
      update = lastUpdate;
  }
  return update;
}
开发者ID:7orlum,项目名称:xbmc,代码行数:15,代码来源:AddonInstaller.cpp


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