本文整理汇总了C++中CAddonCallbacks::GetHelperAddon方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddonCallbacks::GetHelperAddon方法的具体用法?C++ CAddonCallbacks::GetHelperAddon怎么用?C++ CAddonCallbacks::GetHelperAddon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAddonCallbacks
的用法示例。
在下文中一共展示了CAddonCallbacks::GetHelperAddon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: AddOnLog
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());
}
}
示例4: QueueNotification
void CAddonCallbacksAddon::QueueNotification(void *addonData, const queue_msg_t type, 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
{
switch (type)
{
case QUEUE_WARNING:
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, addonHelper->m_addon->Name(), strMessage, 3000, true);
CLog::Log(LOGDEBUG, "CAddonCallbacksAddon - %s - %s - Warning Message: '%s'", __FUNCTION__, addonHelper->m_addon->Name().c_str(), strMessage);
break;
case QUEUE_ERROR:
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, addonHelper->m_addon->Name(), strMessage, 3000, true);
CLog::Log(LOGDEBUG, "CAddonCallbacksAddon - %s - %s - Error Message : '%s'", __FUNCTION__, addonHelper->m_addon->Name().c_str(), strMessage);
break;
case QUEUE_INFO:
default:
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, addonHelper->m_addon->Name(), strMessage, 3000, false);
CLog::Log(LOGDEBUG, "CAddonCallbacksAddon - %s - %s - Info Message : '%s'", __FUNCTION__, addonHelper->m_addon->Name().c_str(), strMessage);
break;
}
}
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());
}
}
示例5: GetAddonSetting
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;
}