Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuDocEditor::set_file_name ( const GUTF8String id,
const GUTF8String name 
)

Changes the name of the file with ID id# to name#. Refer to {DjVmDir} for the explanation of {IDs}, {names} and {titles}.

Definition at line 1283 of file DjVuDocEditor.cpp.

References DjVuDocument::id_to_url(), and DjVmDir::set_file_name().

Referenced by set_page_name().

{
   DEBUG_MSG("DjVuDocEditor::set_file_name(), id='" << id << "', name='" << name << "'\n");
   DEBUG_MAKE_INDENT(3);

      // It's important to get the URL now, because later (after we
      // change DjVmDir) id_to_url() will be returning a modified value
   GURL url=id_to_url(id);

      // Change DjVmDir. It will check if the name is unique
   djvm_dir->set_file_name(id, name);

      // Now find DjVuFile (if any) and rename it
   GPosition pos;
   if (files_map.contains(id, pos))
   {
      GP<File> file=files_map[pos];
      GP<DataPool> pool=file->pool;
      if (pool) pool->load_file();
      GP<DjVuFile> djvu_file=file->file;
      if (djvu_file) djvu_file->set_name(name);
   }
}


Generated by  Doxygen 1.6.0   Back to index