Logo Search packages:      
Sourcecode: djvulibre version File versions

GP< DataPool > DjVuDocEditor::request_data ( const DjVuPort source,
const GURL url 
) [virtual]

This request is issued when decoder needs additional data for decoding. Both {DjVuFile} and {DjVuDocument} are initialized with a URL, not the document data. As soon as they need the data, they call this function, whose responsibility is to locate the source of the data basing on the URL# passed and return it back in the form of the {DataPool}. If this particular receiver is unable to fullfil the request, it should return #0#.

Reimplemented from DjVuDocument.

Definition at line 233 of file DjVuDocEditor.cpp.

References GURL::fname(), and DjVuDocument::request_data().

   DEBUG_MSG("DjVuDocEditor::request_data(): url='" << url << "'\n");

      // Check if we have either original data or converted (to new format),
      // if all the story is about the DjVuDocument's data
   if (url==doc_url)
     return doc_pool;

      // Now see if we have any file matching the url
   const GP<DjVmDir::File> frec(djvm_dir->name_to_file(url.fname()));
   if (frec)
      GCriticalSectionLock lock(&files_lock);
      GPosition pos;
      if (files_map.contains(frec->get_load_name(), pos))
         const GP<File> f(files_map[pos]);
         if (f->file && f->file->get_init_data_pool())
            return f->file->get_init_data_pool();// Favor DjVuFile's knowledge
         else if (f->pool) return f->pool;

      // Finally let DjVuDocument cope with it. It may be a connected DataPool
      // for a BUNDLED format. Or it may be a file. Anyway, it was not
      // manually included, so it should be in the document.
   const GP<DataPool> pool(DjVuDocument::request_data(source, url));

      // We do NOT update the 'File' structure, because our rule is that
      // we keep a separate copy of DataPool in 'File' only if it cannot
      // be retrieved from DjVuDocument (like it has been "inserted" or
      // corresponds to a modified file).
   return pool;

Generated by  Doxygen 1.6.0   Back to index