Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVmDoc::read ( const GP< DataPool > &  data_pool  ) 

Reads contents of a {bundled} multipage DjVu document from the {DataPool}.

Definition at line 416 of file DjVmDoc.cpp.

References IFFByteStream::close_chunk(), DataPool::create(), ByteStream::create(), DjVmDir::decode(), GMapTemplate< KTYPE, VTYPE, TI >::empty(), IFFByteStream::get_bytestream(), IFFByteStream::get_chunk(), DjVmDir::get_files_list(), and DjVmDir::is_indirect().

{
   DEBUG_MSG("DjVmDoc::read(): reading the BUNDLED doc contents from the pool\n");
   DEBUG_MAKE_INDENT(3);
   
   const GP<ByteStream> str(pool->get_stream());
   
   GP<IFFByteStream> giff=IFFByteStream::create(str);
   IFFByteStream &iff=*giff;
   GUTF8String chkid;
   iff.get_chunk(chkid);
   if (chkid!="FORM:DJVM")
      G_THROW( ERR_MSG("DjVmDoc.no_form_djvm") );

   iff.get_chunk(chkid);
   if (chkid!="DIRM")
      G_THROW( ERR_MSG("DjVmDoc.no_dirm_chunk") );
   dir->decode(iff.get_bytestream());
   iff.close_chunk();

   data.empty();

   if (dir->is_indirect())
      G_THROW( ERR_MSG("DjVmDoc.cant_read_indr") );

   GPList<DjVmDir::File> files_list=dir->get_files_list();
   for(GPosition pos=files_list;pos;++pos)
   {
      DjVmDir::File * f=files_list[pos];
      
      DEBUG_MSG("reading contents of file '" << f->get_load_name() << "'\n");
      data[f->get_load_name()]=DataPool::create(pool, f->offset, f->size);
   }
}


Generated by  Doxygen 1.6.0   Back to index