Пример #1
0
ModuleResource Module::GetResource(const std::string& path) const
{
  if (!d->resourceContainer.IsValid())
  {
    return ModuleResource();
  }
  ModuleResource result(path, d->resourceContainer);
  if (result) return result;
  return ModuleResource();
}
Пример #2
0
ModuleResource Module::GetResource(const std::string& path) const
{
  if (d->resourceTreePtrs.empty())
  {
    return ModuleResource();
  }

  for (std::size_t i = 0; i < d->resourceTreePtrs.size(); ++i)
  {
    if (!d->resourceTreePtrs[i]->IsValid()) continue;
    ModuleResource result(path, d->resourceTreePtrs[i], d->resourceTreePtrs);
    if (result) return result;
  }
  return ModuleResource();
}
Пример #3
0
std::vector<ModuleResource> Module::FindResources(const std::string& path, const std::string& filePattern,
                                                  bool recurse) const
{
  std::vector<ModuleResource> result;
  if (d->resourceTreePtrs.empty()) return result;

  for (std::size_t i = 0; i < d->resourceTreePtrs.size(); ++i)
  {
    if (!d->resourceTreePtrs[i]->IsValid()) continue;

    std::vector<std::string> nodes;
    d->resourceTreePtrs[i]->FindNodes(path, filePattern, recurse, nodes);
    for (std::vector<std::string>::iterator nodeIter = nodes.begin();
         nodeIter != nodes.end(); ++nodeIter)
    {
      result.push_back(ModuleResource(*nodeIter, d->resourceTreePtrs[i], d->resourceTreePtrs));
    }
  }
  return result;
}