Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVmDoc::write_index ( const GP< ByteStream > &  str  ) 

Stored index (top-level) file of the DjVu document in the {indirect} format into the specified stream.

Definition at line 535 of file DjVmDoc.cpp.

References IFFByteStream::close_chunk(), GMapTemplate< KTYPE, VTYPE, TI >::contains(), IFFByteStream::create(), DjVmDir::encode(), IFFByteStream::flush(), IFFByteStream::get_bytestream(), DjVmDir::get_files_list(), and IFFByteStream::put_chunk().

Referenced by expand().

{
   DEBUG_MSG("DjVmDoc::write_index(): Storing DjVm index file\n");
   DEBUG_MAKE_INDENT(3);

   GPList<DjVmDir::File> files_list=dir->get_files_list();
   for(GPosition pos=files_list;pos;++pos)
   {
      GP<DjVmDir::File> file=files_list[pos];
      file->offset=0;

      GPosition data_pos=data.contains(file->get_load_name());
      if (!data_pos)
      G_THROW( ERR_MSG("DjVmDoc.no_data") "\t" + file->get_load_name());
      file->size=data[data_pos]->get_length();
      if (!file->size)
        G_THROW( ERR_MSG("DjVmDoc.zero_file") );
   }

   GP<IFFByteStream> giff=IFFByteStream::create(str);
   IFFByteStream &iff=*giff;
   iff.put_chunk("FORM:DJVM", 1);
   iff.put_chunk("DIRM");
   dir->encode(iff.get_bytestream());
   iff.close_chunk();
   if (nav)
     {
       iff.put_chunk("NAVM");
       nav->encode(iff.get_bytestream());
       iff.close_chunk();
     }
   iff.close_chunk();
   iff.flush();
}


Generated by  Doxygen 1.6.0   Back to index