本文整理汇总了C++中ADDONDEPS::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ ADDONDEPS::insert方法的具体用法?C++ ADDONDEPS::insert怎么用?C++ ADDONDEPS::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADDONDEPS
的用法示例。
在下文中一共展示了ADDONDEPS::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDeps
ADDONDEPS CAddonMgr::GetDeps(const CStdString &id)
{
ADDONDEPS result;
cp_status_t status;
cp_plugin_info_t *info = m_cpluff->get_plugin_info(m_cp_context,id.c_str(),&status);
if (info)
{
for (unsigned int i=0;i<info->num_imports;++i)
result.insert(make_pair(CStdString(info->imports[i].plugin_id),
make_pair(AddonVersion(info->version),
AddonVersion(info->version))));
m_cpluff->release_info(m_cp_context, info);
}
return result;
}
示例2: GetAddon
bool CAddonDatabase::GetAddon(int id, AddonPtr &addon)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS2.get()) return false;
std::string sql = "SELECT addon.*,"
" broken.reason,"
" addonextra.key, addonextra.value,"
" dependencies.addon, dependencies.version, dependencies.optional"
" FROM addon"
" LEFT JOIN broken"
" ON broken.addonID = addon.addonID"
" LEFT JOIN addonextra"
" ON addonextra.id = addon.id"
" LEFT JOIN dependencies"
" ON dependencies.id = addon.id";
sql += PrepareSQL(" WHERE addon.id=%i", id);
m_pDS2->query(sql);
if (!m_pDS2->eof())
{
const dbiplus::query_data &data = m_pDS2->get_result_set().records;
const dbiplus::sql_record* const record = data[0];
CAddonBuilder builder;
builder.SetId(record->at(addon_addonID).get_asString());
builder.SetType(TranslateType(record->at(addon_type).get_asString()));
builder.SetVersion(AddonVersion(record->at(addon_version).get_asString()));
builder.SetMinVersion(AddonVersion(record->at(addon_minversion).get_asString()));
builder.SetName(record->at(addon_name).get_asString());
builder.SetSummary(record->at(addon_summary).get_asString());
builder.SetDescription(record->at(addon_description).get_asString());
builder.SetChangelog(record->at(addon_changelog).get_asString());
builder.SetDisclaimer(record->at(addon_disclaimer).get_asString());
builder.SetAuthor(record->at(addon_author).get_asString());
builder.SetBroken(record->at(broken_reason).get_asString());
builder.SetPath(record->at(addon_path).get_asString());
builder.SetIcon(record->at(addon_icon).get_asString());
builder.SetFanart(record->at(addon_fanart).get_asString());
InfoMap extrainfo;
ADDONDEPS dependencies;
/* while this is a cartesion join and we'll typically get multiple rows, we rely on the fact that
extrainfo and dependencies are maps, so insert() will insert the first instance only */
for (dbiplus::query_data::const_iterator i = data.begin(); i != data.end(); ++i)
{
const dbiplus::sql_record* const record = *i;
if (!record->at(addonextra_key).get_asString().empty())
extrainfo.insert(std::make_pair(record->at(addonextra_key).get_asString(), record->at(addonextra_value).get_asString()));
if (!m_pDS2->fv(dependencies_addon).get_asString().empty())
dependencies.insert(std::make_pair(record->at(dependencies_addon).get_asString(), std::make_pair(AddonVersion(record->at(dependencies_version).get_asString()), record->at(dependencies_optional).get_asBool())));
}
builder.SetExtrainfo(std::move(extrainfo));
builder.SetDependencies(std::move(dependencies));
addon = builder.Build();
return NULL != addon.get();
}
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon %i", __FUNCTION__, id);
}
addon.reset();
return false;
}