本文整理汇总了C++中VECADDONS类的典型用法代码示例。如果您正苦于以下问题:C++ VECADDONS类的具体用法?C++ VECADDONS怎么用?C++ VECADDONS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VECADDONS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Search
bool CAddonDatabase::Search(const CStdString& search, VECADDONS& addons)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
CStdString strSQL;
strSQL=PrepareSQL("SELECT addonID FROM addon WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", search.c_str(), search.c_str(), search.c_str());
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
if (m_pDS->num_rows() == 0) return false;
while (!m_pDS->eof())
{
AddonPtr addon;
GetAddon(m_pDS->fv(0).get_asString(),addon);
if (addon->Type() >= ADDON_UNKNOWN+1 && addon->Type() < ADDON_SCRAPER_LIBRARY)
addons.push_back(addon);
m_pDS->next();
}
m_pDS->close();
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed", __FUNCTION__);
}
return false;
}
开发者ID:Anankin,项目名称:xbmc,代码行数:31,代码来源:AddonDatabase.cpp
示例2: GetAddons
bool CAddonDatabase::GetAddons(VECADDONS& addons)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS2.get()) return false;
CStdString sql = PrepareSQL("select distinct addonID from addon");
m_pDS->query(sql.c_str());
while (!m_pDS->eof())
{
AddonPtr addon;
if (GetAddon(m_pDS->fv(0).get_asString(),addon))
addons.push_back(addon);
m_pDS->next();
}
m_pDS->close();
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed", __FUNCTION__);
}
return false;
}
开发者ID:Anankin,项目名称:xbmc,代码行数:25,代码来源:AddonDatabase.cpp
示例3: AddRepository
int CAddonDatabase::AddRepository(const CStdString& id, const VECADDONS& addons, const CStdString& checksum)
{
try
{
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;
CStdString sql;
int idRepo = GetRepoChecksum(id,sql);
if (idRepo > -1)
DeleteRepository(idRepo);
BeginTransaction();
CDateTime time = CDateTime::GetCurrentDateTime();
sql = PrepareSQL("insert into repo (id,addonID,checksum,lastcheck) values (NULL,'%s','%s','%s')",id.c_str(),checksum.c_str(),time.GetAsDBDateTime().c_str());
m_pDS->exec(sql.c_str());
idRepo = (int)m_pDS->lastinsertid();
for (unsigned int i=0;i<addons.size();++i)
AddAddon(addons[i],idRepo);
CommitTransaction();
return idRepo;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on repo '%s'", __FUNCTION__, id.c_str());
RollbackTransaction();
}
return -1;
}
开发者ID:Anankin,项目名称:xbmc,代码行数:31,代码来源:AddonDatabase.cpp
示例4: AddonsFromRepoXML
bool CAddonMgr::AddonsFromRepoXML(const TiXmlElement *root, VECADDONS &addons)
{
// create a context for these addons
cp_status_t status;
cp_context_t *context = m_cpluff->create_context(&status);
if (!root || !context)
return false;
// each addon XML should have a UTF-8 declaration
TiXmlDeclaration decl("1.0", "UTF-8", "");
const TiXmlElement *element = root->FirstChildElement("addon");
while (element)
{
// dump the XML back to text
std::string xml;
xml << decl;
xml << *element;
cp_status_t status;
cp_plugin_info_t *info = m_cpluff->load_plugin_descriptor_from_memory(context, xml.c_str(), xml.size(), &status);
if (info)
{
AddonPtr addon = GetAddonFromDescriptor(info);
if (addon.get())
addons.push_back(addon);
m_cpluff->release_info(context, info);
}
element = element->NextSiblingElement("addon");
}
m_cpluff->destroy_context(context);
return true;
}
开发者ID:Foozle303,项目名称:xbmc,代码行数:31,代码来源:AddonManager.cpp
示例5: UpdateButtons
void CGUIControllerWindow::UpdateButtons(void)
{
using namespace ADDON;
VECADDONS addons;
CONTROL_ENABLE_ON_CONDITION(CONTROL_GET_MORE, CAddonMgr::GetInstance().GetInstallableAddons(addons, ADDON::ADDON_GAME_CONTROLLER) && !addons.empty());
}
开发者ID:mhueske,项目名称:xbmc,代码行数:7,代码来源:GUIControllerWindow.cpp
示例6: PrepareSQL
bool CAddonDatabase::FindByAddonId(const std::string& addonId, ADDON::VECADDONS& result)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
std::string sql = PrepareSQL(
"SELECT addons.version, addons.name, addons.summary, addons.description, addons.metadata,"
"repo.addonID AS repoID FROM addons "
"JOIN addonlinkrepo ON addonlinkrepo.idAddon=addons.id "
"JOIN repo ON repo.id=addonlinkrepo.idRepo "
"WHERE "
"repo.checksum IS NOT NULL AND repo.checksum != '' "
"AND EXISTS (SELECT * FROM installed WHERE installed.addonID=repoID AND installed.enabled=1) "
"AND addons.addonID='%s'", addonId.c_str());
VECADDONS addons;
m_pDS->query(sql.c_str());
while (!m_pDS->eof())
{
CAddonBuilder builder;
builder.SetId(addonId);
builder.SetVersion(AddonVersion(m_pDS->fv(0).get_asString()));
builder.SetName(m_pDS->fv(1).get_asString());
builder.SetSummary(m_pDS->fv(2).get_asString());
builder.SetDescription(m_pDS->fv(3).get_asString());
DeserializeMetadata(m_pDS->fv(4).get_asString(), builder);
builder.SetOrigin(m_pDS->fv(5).get_asString());
auto addon = builder.Build();
if (addon)
addons.push_back(std::move(addon));
else
CLog::Log(LOGERROR, "CAddonDatabase: failed to build %s", addonId.c_str());
m_pDS->next();
}
m_pDS->close();
result = std::move(addons);
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon %s", __FUNCTION__, addonId.c_str());
}
return false;
}
开发者ID:IchabodFletchman,项目名称:xbmc,代码行数:47,代码来源:AddonDatabase.cpp
示例7: GetAddons
bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, bool enabled /* = true */)
{
CSingleLock lock(m_critSection);
addons.clear();
cp_status_t status;
int num;
CStdString ext_point(TranslateType(type));
cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num);
for(int i=0; i <num; i++)
{
AddonPtr addon(Factory(exts[i]));
if (addon && m_database.IsAddonDisabled(addon->ID()) != enabled)
addons.push_back(addon);
}
m_cpluff->release_info(m_cp_context, exts);
return addons.size() > 0;
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:17,代码来源:AddonManager.cpp
示例8: onMigrate
std::vector<std::string> CAddonSystemSettings::MigrateAddons(std::function<void(void)> onMigrate)
{
auto getIncompatible = [](){
VECADDONS incompatible;
CServiceBroker::GetAddonMgr().GetAddons(incompatible);
incompatible.erase(std::remove_if(incompatible.begin(), incompatible.end(),
[](const AddonPtr a){ return CServiceBroker::GetAddonMgr().IsCompatible(*a); }), incompatible.end());
return incompatible;
};
if (getIncompatible().empty())
return std::vector<std::string>();
if (CServiceBroker::GetSettings().GetInt(CSettings::SETTING_ADDONS_AUTOUPDATES) == AUTO_UPDATES_ON)
{
onMigrate();
if (CServiceBroker::GetRepositoryUpdater().CheckForUpdates())
CServiceBroker::GetRepositoryUpdater().Await();
CLog::Log(LOGINFO, "ADDON: waiting for add-ons to update...");
CAddonInstaller::GetInstance().InstallUpdatesAndWait();
}
auto incompatible = getIncompatible();
for (const auto& addon : incompatible)
CLog::Log(LOGNOTICE, "ADDON: %s version %s is incompatible", addon->ID().c_str(), addon->Version().asString().c_str());
std::vector<std::string> changed;
for (const auto& addon : incompatible)
{
if (!UnsetActive(addon))
{
CLog::Log(LOGWARNING, "ADDON: failed to unset %s", addon->ID().c_str());
continue;
}
if (!CServiceBroker::GetAddonMgr().DisableAddon(addon->ID()))
{
CLog::Log(LOGWARNING, "ADDON: failed to disable %s", addon->ID().c_str());
}
changed.push_back(addon->Name());
}
return changed;
}
开发者ID:HofiOne,项目名称:xbmc,代码行数:45,代码来源:AddonSystemSettings.cpp
示例9: StartServices
bool CAddonMgr::StartServices()
{
CLog::Log(LOGDEBUG, "ADDON: Starting service addons.");
VECADDONS services;
if (!GetAddons(ADDON_SERVICE, services))
return false;
bool ret = true;
for (IVECADDONS it = services.begin(); it != services.end(); ++it)
{
boost::shared_ptr<CService> service = boost::dynamic_pointer_cast<CService>(*it);
if (service)
ret &= service->Start();
}
return ret;
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:18,代码来源:AddonManager.cpp
示例10: bReturn
bool CActiveAEDSP::UpdateAddons(void)
{
VECADDONS addons;
AE_DSP_ADDON dspAddon;
bool bReturn(CAddonMgr::GetInstance().GetAddons(ADDON_ADSPDLL, addons, true));
size_t usableAddons;
if (bReturn)
{
CSingleLock lock(m_critUpdateSection);
m_addons = addons;
}
usableAddons = m_addons.size();
/* handle "new" addons which aren't yet in the db - these have to be added first */
for (VECADDONS::const_iterator itr = addons.begin(); itr != addons.end(); ++itr)
{
dspAddon = std::dynamic_pointer_cast<CActiveAEDSPAddon>(*itr);
bool newRegistration = false;
if (RegisterAudioDSPAddon(dspAddon, &newRegistration) < 0 || newRegistration)
{
CAddonMgr::GetInstance().DisableAddon(dspAddon->ID());
--usableAddons;
}
}
if ((!bReturn || usableAddons == 0) && !m_noAddonWarningDisplayed &&
!CAddonMgr::GetInstance().HasAddons(ADDON_ADSPDLL, false) &&
IsActivated())
{
// No audio DSP add-ons could be found
// You need a add-on installed for the process of audio DSP signal. System becomes disabled.
m_noAddonWarningDisplayed = true;
CGUIDialogOK::ShowAndGetInput(CVariant{19273}, CVariant{19274});
CSettings::GetInstance().SetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED, false);
CGUIMessage msg(GUI_MSG_UPDATE, WINDOW_SETTINGS_SYSTEM, 0);
g_windowManager.SendThreadMessage(msg, WINDOW_SETTINGS_SYSTEM);
CApplicationMessenger::GetInstance().SendMsg(TMSG_SETAUDIODSPSTATE, ACTIVE_AE_DSP_STATE_OFF);
}
return bReturn;
}
开发者ID:stef64,项目名称:xbmc,代码行数:44,代码来源:ActiveAEDSP.cpp
示例11: lock
void CRepositoryUpdater::OnJobComplete(unsigned int jobID, bool success, CJob* job)
{
CSingleLock lock(m_criticalSection);
m_jobs.erase(std::find(m_jobs.begin(), m_jobs.end(), job));
if (m_jobs.empty())
{
CLog::Log(LOGDEBUG, "CRepositoryUpdater: done.");
m_doneEvent.Set();
VECADDONS updates = CAddonMgr::GetInstance().GetAvailableUpdates();
if (CSettings::GetInstance().GetInt(CSettings::SETTING_ADDONS_AUTOUPDATES) == AUTO_UPDATES_NOTIFY)
{
if (!updates.empty())
{
if (updates.size() == 1)
CGUIDialogKaiToast::QueueNotification(
updates[0]->Icon(), updates[0]->Name(), g_localizeStrings.Get(24068),
TOAST_DISPLAY_TIME, false, TOAST_DISPLAY_TIME);
else
CGUIDialogKaiToast::QueueNotification(
"", g_localizeStrings.Get(24001), g_localizeStrings.Get(24061),
TOAST_DISPLAY_TIME, false, TOAST_DISPLAY_TIME);
for (const auto &addon : updates)
CEventLog::GetInstance().Add(EventPtr(new CAddonManagementEvent(addon, 24068)));
}
}
if (CSettings::GetInstance().GetInt(CSettings::SETTING_ADDONS_AUTOUPDATES) == AUTO_UPDATES_ON)
{
for (const auto& addon : updates)
{
if (!CAddonMgr::GetInstance().IsBlacklisted(addon->ID()))
CAddonInstaller::GetInstance().InstallOrUpdate(addon->ID());
}
}
ScheduleUpdate();
m_events.Publish(RepositoryUpdated{});
}
}
开发者ID:FreeUK,项目名称:ZDMC,代码行数:43,代码来源:RepositoryUpdater.cpp
示例12: SetItem
bool CGUIDialogAddonInfo::SetItem(const CFileItemPtr& item)
{
*m_item = *item;
m_rollbackVersions.clear();
// grab the local addon, if it's available
m_localAddon.reset();
m_addon.reset();
if (CAddonMgr::Get().GetAddon(item->GetProperty("Addon.ID").asString(), m_localAddon)) // sets m_addon if installed regardless of enabled state
m_item->SetProperty("Addon.Enabled", "true");
else
m_item->SetProperty("Addon.Enabled", "false");
m_item->SetProperty("Addon.Installed", m_addon ? "true" : "false");
CAddonDatabase database;
database.Open();
database.GetAddon(item->GetProperty("Addon.ID").asString(),m_addon);
if (TranslateType(item->GetProperty("Addon.intType").asString()) == ADDON_REPOSITORY)
{
CAddonDatabase database;
database.Open();
VECADDONS addons;
if (m_addon)
database.GetRepository(m_addon->ID(), addons);
else if (m_localAddon) // sanity
database.GetRepository(m_localAddon->ID(), addons);
int tot=0;
for (int i = ADDON_UNKNOWN+1;i<ADDON_VIZ_LIBRARY;++i)
{
int num=0;
for (unsigned int j=0;j<addons.size();++j)
{
if (addons[j]->Type() == (TYPE)i)
++num;
}
m_item->SetProperty(CStdString("Repo.") + TranslateType((TYPE)i), num);
tot += num;
}
m_item->SetProperty("Repo.Addons", tot);
}
return true;
}
开发者ID:DrHerbz,项目名称:xbmc,代码行数:43,代码来源:GUIDialogAddonInfo.cpp
示例13: lock
void CAddonMgr::UpdateRepos(bool force)
{
CSingleLock lock(m_critSection);
if (!force && m_watch.IsRunning() && m_watch.GetElapsedSeconds() < 600)
return;
m_watch.StartZero();
VECADDONS addons;
GetAddons(ADDON_REPOSITORY,addons);
for (unsigned int i=0;i<addons.size();++i)
{
RepositoryPtr repo = boost::dynamic_pointer_cast<CRepository>(addons[i]);
CDateTime lastUpdate = m_database.GetRepoTimestamp(repo->ID());
if (force || !lastUpdate.IsValid() || lastUpdate + CDateTimeSpan(0,6,0,0) < CDateTime::GetCurrentDateTime())
{
CLog::Log(LOGDEBUG,"Checking repository %s for updates",repo->Name().c_str());
CJobManager::GetInstance().AddJob(new CRepositoryUpdateJob(repo), NULL);
}
}
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:19,代码来源:AddonManager.cpp
示例14: CURL
bool CGameUtils::HasGameExtension(const std::string &path)
{
using namespace ADDON;
// Get filename from CURL so that top-level zip directories will become
// normal paths:
//
// zip://%2Fpath_to_zip_file.zip/ -> /path_to_zip_file.zip
//
std::string filename = CURL(path).GetFileNameWithoutPath();
// Get the file extension
std::string extension = URIUtils::GetExtension(filename);
if (extension.empty())
return false;
StringUtils::ToLower(extension);
// Look for a game client that supports this extension
VECADDONS gameClients;
CBinaryAddonCache& addonCache = CServiceBroker::GetBinaryAddonCache();
addonCache.GetAddons(gameClients, ADDON_GAMEDLL);
for (auto& gameClient : gameClients)
{
GameClientPtr gc(std::static_pointer_cast<CGameClient>(gameClient));
if (gc->IsExtensionValid(extension))
return true;
}
// Check remote add-ons
gameClients.clear();
if (CServiceBroker::GetAddonMgr().GetInstallableAddons(gameClients, ADDON_GAMEDLL))
{
for (auto& gameClient : gameClients)
{
GameClientPtr gc(std::static_pointer_cast<CGameClient>(gameClient));
if (gc->IsExtensionValid(extension))
return true;
}
}
return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:43,代码来源:GameUtils.cpp
示例15: CreateCodec
ICodec* CodecFactory::CreateCodec(const CStdString& strFileType)
{
VECADDONS codecs;
CAddonMgr::Get().GetAddons(ADDON_AUDIODECODER, codecs);
for (size_t i=0;i<codecs.size();++i)
{
boost::shared_ptr<CAudioDecoder> dec(boost::static_pointer_cast<CAudioDecoder>(codecs[i]));
if (dec->GetExtensions().find("."+strFileType) != std::string::npos)
{
CAudioDecoder* result = new CAudioDecoder(*dec);
static_cast<AudioDecoderDll&>(*result).Create();
return result;
}
}
if (strFileType.Equals("pcm") || strFileType.Equals("l16"))
return new PCMCodec();
return new DVDPlayerCodec();
}
开发者ID:fritsch,项目名称:xbmc-cmake,代码行数:20,代码来源:CodecFactory.cpp
示例16: GetDisabledAddons
void CBinaryAddonCache::GetDisabledAddons(VECADDONS& addons, const TYPE& type)
{
VECADDONS myAddons;
GetInstalledAddons(myAddons, type);
for (auto &addon : myAddons)
{
if (CAddonMgr::GetInstance().IsAddonDisabled(addon->ID()))
addons.emplace_back(std::move(addon));
}
}
开发者ID:Razzeee,项目名称:xbmc,代码行数:11,代码来源:BinaryAddonCache.cpp
示例17: LastUpdated
CDateTime CRepositoryUpdater::LastUpdated() const
{
VECADDONS repos;
if (!CAddonMgr::GetInstance().GetAddons(repos, ADDON_REPOSITORY) || repos.empty())
return CDateTime();
CAddonDatabase db;
db.Open();
std::vector<CDateTime> updateTimes;
std::transform(repos.begin(), repos.end(), std::back_inserter(updateTimes),
[&](const AddonPtr& repo)
{
auto lastCheck = db.LastChecked(repo->ID());
if (lastCheck.first.IsValid() && lastCheck.second == repo->Version())
return lastCheck.first;
return CDateTime();
});
return *std::min_element(updateTimes.begin(), updateTimes.end());
}
开发者ID:FreeUK,项目名称:ZDMC,代码行数:20,代码来源:RepositoryUpdater.cpp
示例18: CreateCodec
ICodec* CodecFactory::CreateCodec(const std::string &strFileType)
{
std::string fileType = strFileType;
StringUtils::ToLower(fileType);
VECADDONS codecs;
CAddonMgr::GetInstance().GetAddons(ADDON_AUDIODECODER, codecs);
for (size_t i=0;i<codecs.size();++i)
{
std::shared_ptr<CAudioDecoder> dec(std::static_pointer_cast<CAudioDecoder>(codecs[i]));
std::vector<std::string> exts = StringUtils::Split(dec->GetExtensions(), "|");
if (std::find(exts.begin(), exts.end(), "."+fileType) != exts.end())
{
CAudioDecoder* result = new CAudioDecoder(*dec);
static_cast<AudioDecoderDll&>(*result).Create();
return result;
}
}
VideoPlayerCodec *dvdcodec = new VideoPlayerCodec();
return dvdcodec;
}
开发者ID:EraYaN,项目名称:xbmc,代码行数:21,代码来源:CodecFactory.cpp
示例19: ClearServices
void CGUIDialogSubtitles::FillServices()
{
std::string previousService = m_currentService;
ClearServices();
VECADDONS addons;
ADDON::CAddonMgr::GetInstance().GetAddons(addons, ADDON_SUBTITLE_MODULE);
if (addons.empty())
{
UpdateStatus(NO_SERVICES);
return;
}
std::string defaultService;
const CFileItem &item = g_application.CurrentUnstackedItem();
if (item.GetVideoContentType() == VIDEODB_CONTENT_TVSHOWS ||
item.GetVideoContentType() == VIDEODB_CONTENT_EPISODES)
// Set default service for tv shows
defaultService = CSettings::GetInstance().GetString(CSettings::SETTING_SUBTITLES_TV);
else
// Set default service for filemode and movies
defaultService = CSettings::GetInstance().GetString(CSettings::SETTING_SUBTITLES_MOVIE);
std::string service = addons.front()->ID();
for (VECADDONS::const_iterator addonIt = addons.begin(); addonIt != addons.end(); ++addonIt)
{
CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*addonIt, "plugin://" + (*addonIt)->ID(), false));
m_serviceItems->Add(item);
// If we don't have used a previous service use the default service, otherwise use the previous service
if ((previousService.empty() && (*addonIt)->ID() == defaultService) || (*addonIt)->ID() == previousService)
service = (*addonIt)->ID();
}
// Bind our services to the UI
CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_SERVICELIST, 0, 0, m_serviceItems);
OnMessage(msg);
SetService(service);
}
开发者ID:un1versal,项目名称:kodi,代码行数:40,代码来源:GUIDialogSubtitles.cpp
示例20: lock
bool CAddonMgr::GetAllOutdatedAddons(VECADDONS &addons, bool enabled /*= true*/)
{
CSingleLock lock(m_critSection);
for (int i = ADDON_UNKNOWN+1; i < ADDON_VIZ_LIBRARY; ++i)
{
VECADDONS temp;
if (CAddonMgr::Get().GetAddons((TYPE)i, temp, enabled))
{
AddonPtr repoAddon;
for (unsigned int j = 0; j < temp.size(); j++)
{
// Ignore duplicates due to add-ons with multiple extension points
bool found = false;
for (VECADDONS::const_iterator addonIt = addons.begin(); addonIt != addons.end(); addonIt++)
{
if ((*addonIt)->ID() == temp[j]->ID())
found = true;
}
if (found || !m_database.GetAddon(temp[j]->ID(), repoAddon))
continue;
if (temp[j]->Version() < repoAddon->Version() &&
!m_database.IsAddonBlacklisted(temp[j]->ID(),
repoAddon->Version().c_str()))
addons.push_back(repoAddon);
}
}
}
return !addons.empty();
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:31,代码来源:AddonManager.cpp
注:本文中的VECADDONS类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论