Ejemplo n.º 1
0
 DataLocation::Ptr Open(const Parameters::Accessor& /*params*/, DataLocation::Ptr location, const Analysis::Path& inPath) const override
 {
   const String& pathComp = inPath.GetIterator()->Get();
   std::size_t offset = 0;
   if (RawPath.GetIndex(pathComp, offset))
   {
     const Binary::Container::Ptr inData = location->GetData();
     const Binary::Container::Ptr subData = inData->GetSubcontainer(offset, inData->Size() - offset);
     return CreateNestedLocation(location, subData, Description->Id(), pathComp); 
   }
   return DataLocation::Ptr();
 }
Ejemplo n.º 2
0
 DataLocation::Ptr OpenDataFromArchive(Plugin::Ptr plugin, const Formats::Packed::Decoder& decoder,
   DataLocation::Ptr inputData, const Analysis::Path& pathToOpen)
 {
   const String pathComponent = pathToOpen.GetIterator()->Get();
   if (!IsArchivePluginPathComponent(pathComponent))
   {
     return DataLocation::Ptr();
   }
   const String pluginId = DecodeArchivePluginFromPathComponent(pathComponent);
   if (pluginId != plugin->Id())
   {
     return DataLocation::Ptr();
   }
   const Binary::Container::Ptr rawData = inputData->GetData();
   if (Formats::Packed::Container::Ptr subData = decoder.Decode(*rawData))
   {
     return CreateNestedLocation(inputData, subData, pluginId, pathComponent);
   }
   return DataLocation::Ptr();
 }
Ejemplo n.º 3
0
 Formats::Archived::File::Ptr FindFile(const Formats::Archived::Container& container, const Analysis::Path& path) const
 {
   Analysis::Path::Ptr resolved = Analysis::ParsePath(String(), Text::MODULE_SUBPATH_DELIMITER[0]);
   for (const Analysis::Path::Iterator::Ptr components = path.GetIterator();
        components->IsValid(); components->Next())
   {
     resolved = resolved->Append(components->Get());
     const String filename = resolved->AsString();
     Dbg("Trying '%1%'", filename);
     if (Formats::Archived::File::Ptr file = container.FindFile(filename))
     {
       Dbg("Found");
       return file;
     }
     if (!SupportDirectories)
     {
       break;
     }
   }
   return Formats::Archived::File::Ptr();
 }