本文整理汇总了C++中CTextureDatabase::GetTextures方法的典型用法代码示例。如果您正苦于以下问题:C++ CTextureDatabase::GetTextures方法的具体用法?C++ CTextureDatabase::GetTextures怎么用?C++ CTextureDatabase::GetTextures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextureDatabase
的用法示例。
在下文中一共展示了CTextureDatabase::GetTextures方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoWork
bool CTextureRemoveJob::DoWork()
{
// clear thumb database
CVariant items;
CTextureDatabase db;
if (db.Open())
{
db.GetTextures(items, "");
db.Close();
for (unsigned int index = 0; index < items.size(); index++)
{
int id = (int)items[index]["textureid"].asInteger();
CTextureCache::GetInstance().ClearCachedImage(id);
}
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(617),"", 3000, true);
}
return true;
}
示例2: GetTextures
JSONRPC_STATUS CTextureOperations::GetTextures(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CFileItemList listItems;
CTextureDatabase db;
if (!db.Open())
return InternalError;
CDatabase::Filter dbFilter;
const CVariant &filter = parameterObject["filter"];
if (filter.isObject())
{
CVariant xspObj(CVariant::VariantTypeObject);
if (filter.isMember("field"))
{
xspObj["and"] = CVariant(CVariant::VariantTypeArray);
xspObj["and"].push_back(filter);
}
else
xspObj = filter;
// decipher the rules
CDatabaseQueryRuleCombination rule;
if (!rule.Load(xspObj, &db))
return InvalidParams;
dbFilter.AppendWhere(rule.GetWhereClause(db, ""));
}
// fetch textures from the database
CVariant items = CVariant(CVariant::VariantTypeArray);
if (!db.GetTextures(items, dbFilter))
return InternalError;
// return only what was asked for, plus textureid
CVariant prop = parameterObject["properties"];
prop.push_back("textureid");
if (!items.empty() && prop.isArray())
{
std::set<std::string> fields;
CVariant &item = items[0];
for (CVariant::const_iterator_map field = item.begin_map(); field != item.end_map(); ++field)
{
if (std::find(prop.begin_array(), prop.end_array(), field->first) == prop.end_array())
fields.insert(field->first);
}
// erase these fields
for (CVariant::iterator_array item = items.begin_array(); item != items.end_array(); ++item)
{
for (std::set<std::string>::const_iterator i = fields.begin(); i != fields.end(); ++i)
item->erase(*i);
}
if (fields.find("url") == fields.end())
{
// wrap cached url to something retrieval from Files.GetFiles()
for (CVariant::iterator_array item = items.begin_array(); item != items.end_array(); ++item)
{
CVariant &cachedUrl = (*item)["url"];
cachedUrl = CTextureUtils::GetWrappedImageURL(cachedUrl.asString());
}
}
}
result["textures"] = items;
return OK;
}