Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuFile::remove_anno ( void   ) 

Clears this file of all annotations.

Definition at line 2432 of file DjVuFile.cpp.

References anno, IFFByteStream::close_chunk(), IFFByteStream::copy(), DataPool::create(), ByteStream::create(), ByteStream::EndOfFile, IFFByteStream::get_bytestream(), IFFByteStream::get_chunk(), and IFFByteStream::put_chunk().

{
  DEBUG_MSG("DjVuFile::remove_anno()\n");
  const GP<ByteStream> str_in(data_pool->get_stream());
  const GP<ByteStream> gstr_out(ByteStream::create());
  
  GUTF8String chkid;
  const GP<IFFByteStream> giff_in(IFFByteStream::create(str_in));
  IFFByteStream &iff_in=*giff_in;
  if (!iff_in.get_chunk(chkid))
    G_THROW( ByteStream::EndOfFile );
  
  const GP<IFFByteStream> giff_out(IFFByteStream::create(gstr_out));
  IFFByteStream &iff_out=*giff_out;
  iff_out.put_chunk(chkid);
  
  while(iff_in.get_chunk(chkid))
  {
    if (!is_annotation(chkid))
    {
      iff_out.put_chunk(chkid);
      iff_out.copy(*iff_in.get_bytestream());
      iff_out.close_chunk();
    }
    iff_in.close_chunk();
  }
  
  iff_out.close_chunk();
  
  gstr_out->seek(0, SEEK_SET);
  data_pool=DataPool::create(gstr_out);
  chunks_number=-1;
  
  anno=0;
  
  flags|=MODIFIED;
  data_pool->clear_stream();
}


Generated by  Doxygen 1.6.0   Back to index