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


C++ CAddonCallbacks类代码示例

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


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

示例1: if

void CAddonCallbacksPVR::PVRRecording(void *addonData, const char *strName, const char *strFileName, bool bOnOff)
{
  CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
  if (addon == NULL)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksPVR - %s - called with a null pointer", __FUNCTION__);
    return;
  }

  CAddonCallbacksPVR* addonHelper = addon->GetHelperPVR();

  CStdString strLine1;
  if (bOnOff)
    strLine1.Format(g_localizeStrings.Get(19197), addonHelper->m_addon->Name());
  else
    strLine1.Format(g_localizeStrings.Get(19198), addonHelper->m_addon->Name());

  CStdString strLine2;
  if (strName)
    strLine2 = strName;
  else if (strFileName)
    strLine2 = strFileName;
  else
    strLine2 = "";

  /* display a notification for 5 seconds */
  CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, strLine1, strLine2, 5000, false);

  CLog::Log(LOGDEBUG, "CAddonCallbacksPVR - %s - recording %s on client '%s'. name='%s' filename='%s'",
      __FUNCTION__, bOnOff ? "started" : "finished", addonHelper->m_addon->Name().c_str(), strName, strFileName);
}
开发者ID:Kr0nZ,项目名称:xbmc,代码行数:31,代码来源:AddonCallbacksPVR.cpp

示例2:

CActiveAEDSPAddon *CAddonCallbacksADSP::GetAudioDSPAddon(void *addonData)
{
  CAddonCallbacks *addon = static_cast<CAddonCallbacks *>(addonData);
  if (!addon || !addon->GetHelperADSP())
  {
    CLog::Log(LOGERROR, "Audio DSP - %s - called with a null pointer", __FUNCTION__);
    return NULL;
  }

  return dynamic_cast<CActiveAEDSPAddon *>(addon->GetHelperADSP()->m_addon);
}
开发者ID:69thelememt,项目名称:xbmc,代码行数:11,代码来源:AddonCallbacksAudioDSP.cpp

示例3:

CPVRClient *CAddonCallbacksPVR::GetPVRClient(void *addonData)
{
  CAddonCallbacks *addon = static_cast<CAddonCallbacks *>(addonData);
  if (!addon || !addon->GetHelperPVR())
  {
    CLog::Log(LOGERROR, "PVR - %s - called with a null pointer", __FUNCTION__);
    return NULL;
  }

  return dynamic_cast<CPVRClient *>(addon->GetHelperPVR()->m_addon);
}
开发者ID:Fury04,项目名称:xbmc,代码行数:11,代码来源:AddonCallbacksPVR.cpp

示例4: GetLocalizedString

char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long dwCode)
{
  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
  if (!helper || g_application.m_bStop)
    return NULL;

  CAddonCallbacksAddon* addonHelper = helper->GetHelperAddon();

  CStdString string;
  if (dwCode >= 30000 && dwCode <= 30999)
    string = addonHelper->m_addon->GetString(dwCode).c_str();
  else if (dwCode >= 32000 && dwCode <= 32999)
    string = addonHelper->m_addon->GetString(dwCode).c_str();
  else
    string = g_localizeStrings.Get(dwCode).c_str();

  char* buffer = strdup(string.c_str());
  return buffer;
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:19,代码来源:AddonCallbacksAddon.cpp

示例5: GetLocalizedString

const char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long dwCode)
{
  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
  if (!helper)
    return NULL;

  CAddonCallbacksAddon* addonHelper = helper->GetHelperAddon();

  CStdString string;
  if (dwCode >= 30000 && dwCode <= 30999)
    string = addonHelper->m_addon->GetString(dwCode).c_str();
  else if (dwCode >= 32000 && dwCode <= 32999)
    string = addonHelper->m_addon->GetString(dwCode).c_str();
  else
    string = g_localizeStrings.Get(dwCode).c_str();

  char *buffer = (char*) malloc (string.length()+1);
  strcpy(buffer, string.c_str());
  return buffer;
}
开发者ID:MickeXBMC,项目名称:xbmc,代码行数:20,代码来源:AddonCallbacksAddon.cpp

示例6: PVRAddMenuHook

void CAddonCallbacksPVR::PVRAddMenuHook(void *addonData, PVR_MENUHOOK *hook)
{
  CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
  if (addon == NULL || hook == NULL)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksPVR - %s - called with a null pointer", __FUNCTION__);
    return;
  }

  CAddonCallbacksPVR* addonHelper = addon->GetHelperPVR();
  CPVRClient* client  = (CPVRClient*) addonHelper->m_addon;
  PVR_MENUHOOKS *hooks = client->GetMenuHooks();

  PVR_MENUHOOK hookInt;
  hookInt.iHookId            = hook->iHookId;
  hookInt.iLocalizedStringId = hook->iLocalizedStringId;

  /* add this new hook */
  hooks->push_back(hookInt);
}
开发者ID:Kr0nZ,项目名称:xbmc,代码行数:20,代码来源:AddonCallbacksPVR.cpp

示例7: switch

void CAddonCallbacksAddon::AddOnLog(void *addonData, const addon_log_t addonLogLevel, const char *strMessage)
{
  CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
  if (addon == NULL || strMessage == NULL)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - called with a null pointer", __FUNCTION__);
    return;
  }

  CAddonCallbacksAddon* addonHelper = addon->GetHelperAddon();

  try
  {
    int xbmcLogLevel = LOGNONE;
    switch (addonLogLevel)
    {
      case LOG_ERROR:
        xbmcLogLevel = LOGERROR;
        break;
      case LOG_INFO:
        xbmcLogLevel = LOGINFO;
        break;
      case LOG_NOTICE:
        xbmcLogLevel = LOGNOTICE;
        break;
      case LOG_DEBUG:
      default:
        xbmcLogLevel = LOGDEBUG;
        break;
    }

    CStdString strXbmcMessage;
    strXbmcMessage.Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage);
    CLog::Log(xbmcLogLevel, "%s", strXbmcMessage.c_str());
  }
  catch (std::exception &e)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - exception '%s' caught in call in add-on '%s'. please contact the developer of this addon: %s",
        __FUNCTION__, e.what(), addonHelper->m_addon->Name().c_str(), addonHelper->m_addon->Author().c_str());
  }
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:41,代码来源:AddonCallbacksAddon.cpp

示例8: while

bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSettingName, void *settingValue)
{
  CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
  if (addon == NULL || strSettingName == NULL || settingValue == NULL)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - called with a null pointer", __FUNCTION__);
    return false;
  }

  CAddonCallbacksAddon* addonHelper = addon->GetHelperAddon();

  try
  {
    CLog::Log(LOGDEBUG, "CAddonCallbacksAddon - %s - add-on '%s' requests setting '%s'", __FUNCTION__, addonHelper->m_addon->Name().c_str(), strSettingName);

    if (!addonHelper->m_addon->ReloadSettings())
    {
      CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - could't get settings for add-on '%s'", __FUNCTION__, addonHelper->m_addon->Name().c_str());
      return false;
    }

    const TiXmlElement *category = addonHelper->m_addon->GetSettingsXML()->FirstChildElement("category");
    if (!category) // add a default one...
      category = addonHelper->m_addon->GetSettingsXML();

    while (category)
    {
      const TiXmlElement *setting = category->FirstChildElement("setting");
      while (setting)
      {
        const char *id = setting->Attribute("id");
        const char *type = setting->Attribute("type");

        if (strcmpi(id, strSettingName) == 0 && type)
        {
          if (strcmpi(type, "text")   == 0 || strcmpi(type, "ipaddress") == 0 ||
              strcmpi(type, "folder") == 0 || strcmpi(type, "action")    == 0 ||
              strcmpi(type, "music")  == 0 || strcmpi(type, "pictures")  == 0 ||
              strcmpi(type, "folder") == 0 || strcmpi(type, "programs")  == 0 ||
              strcmpi(type, "file")  == 0 || strcmpi(type, "fileenum")  == 0)
          {
            strcpy((char*) settingValue, addonHelper->m_addon->GetSetting(id).c_str());
            return true;
          }
          else if (strcmpi(type, "number") == 0 || strcmpi(type, "enum") == 0 ||
                   strcmpi(type, "labelenum") == 0)
          {
            *(int*) settingValue = (int) atoi(addonHelper->m_addon->GetSetting(id));
            return true;
          }
          else if (strcmpi(type, "bool") == 0)
          {
            *(bool*) settingValue = (bool) (addonHelper->m_addon->GetSetting(id) == "true" ? true : false);
            return true;
          }
        }
        setting = setting->NextSiblingElement("setting");
      }
      category = category->NextSiblingElement("category");
    }
    CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - can't find setting '%s' in '%s'", __FUNCTION__, strSettingName, addonHelper->m_addon->Name().c_str());
  }
  catch (std::exception &e)
  {
    CLog::Log(LOGERROR, "CAddonCallbacksAddon - %s - exception '%s' caught in call in add-on '%s'. please contact the developer of this addon: %s",
        __FUNCTION__, e.what(), addonHelper->m_addon->Name().c_str(), addonHelper->m_addon->Author().c_str());
  }

  return false;
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:70,代码来源:AddonCallbacksAddon.cpp


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