本文整理汇总了C++中AptIntf::getDepends方法的典型用法代码示例。如果您正苦于以下问题:C++ AptIntf::getDepends方法的具体用法?C++ AptIntf::getDepends怎么用?C++ AptIntf::getDepends使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AptIntf
的用法示例。
在下文中一共展示了AptIntf::getDepends方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backend_depends_on_or_requires_thread
static void backend_depends_on_or_requires_thread(PkBackendJob *job, GVariant *params, gpointer user_data)
{
PkRoleEnum role;
PkBitfield filters;
gchar **package_ids;
gboolean recursive;
gchar *pi;
g_variant_get(params, "(t^a&sb)",
&filters,
&package_ids,
&recursive);
role = pk_backend_job_get_role(job);
pk_backend_job_set_allow_cancel(job, true);
AptIntf *apt = static_cast<AptIntf*>(pk_backend_job_get_user_data(job));
if (!apt->init()) {
g_debug("Failed to create apt cache");
return;
}
pk_backend_job_set_status(job, PK_STATUS_ENUM_QUERY);
PkgList output;
for (uint i = 0; i < g_strv_length(package_ids); ++i) {
if (apt->cancelled()) {
break;
}
pi = package_ids[i];
if (pk_package_id_check(pi) == false) {
pk_backend_job_error_code(job,
PK_ERROR_ENUM_PACKAGE_ID_INVALID,
"%s",
pi);
return;
}
const pkgCache::VerIterator &ver = apt->aptCacheFile()->resolvePkgID(pi);
if (ver.end()) {
pk_backend_job_error_code(job,
PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
"Couldn't find package %s",
pi);
return;
}
if (role == PK_ROLE_ENUM_DEPENDS_ON) {
apt->getDepends(output, ver, recursive);
} else {
apt->getRequires(output, ver, recursive);
}
}
// It's faster to emit the packages here than in the matching part
apt->emitPackages(output, filters);
}