Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuDocument::save_as ( const GURL where,
const bool  bundled = 0 
) [virtual]

This function can be used instead of {write}() and {expand}(). It allows to save the document either in the new BUNDLED# format or in the new INDIRECT# format depending on the value of parameter bundled#.

Depending on the document's type, the meaning of where# is: {itemize} For BUNDLED# documents this is the name of the file For INDIRECT# documents this is the name of top-level index file. All document files will be saved into the save directory where the index file will resize.

Reimplemented in DjVuDocEditor.

Definition at line 1771 of file DjVuDocument.cpp.

References GURL::base(), ByteStream::create(), expand(), ByteStream::flush(), GURL::fname(), DataPool::load_file(), needs_compression(), ByteStream::seek(), and write().

{
   DEBUG_MSG("DjVuDocument::save_as(): where='" << where <<
           "', bundled=" << bundled << "\n");
   DEBUG_MAKE_INDENT(3);
   
   if (needs_compression())
   { 
     if(!djvu_compress_codec)
     {
       G_THROW( ERR_MSG("DjVuDocument.comp_codec") );
     }
     GP<ByteStream> gmbs=ByteStream::create();
     write(gmbs);
     ByteStream &mbs=*gmbs;
     mbs.flush();
     mbs.seek(0,SEEK_SET);
     (*djvu_compress_codec)(gmbs,where,bundled);
   }else if (bundled)
   {
      DataPool::load_file(where);
      write(ByteStream::create(where, "wb"));
   } else 
   {
     expand(where.base(), where.fname());
   }
}


Generated by  Doxygen 1.6.0   Back to index