当前位置: 首页>>代码示例>>C++>>正文


C++ CTextureDatabase::GetTextures方法代码示例

本文整理汇总了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;
}
开发者ID:AndyPeterman,项目名称:mrmc,代码行数:18,代码来源:TextureCacheJob.cpp

示例2: GetTextures

JSONRPC_STATUS CTextureOperations::GetTextures(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, 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;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:67,代码来源:TextureOperations.cpp


注:本文中的CTextureDatabase::GetTextures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。