Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuFile::init ( const GP< ByteStream > &  str  ) 

Initializes a DjVuFile# object. This is a simplified initializer, which is not supposed to be used for decoding or creating DjVuFile::s, which include other files.

If the file is stored on the hard drive, you may also use the other constructor and pass it the file's URL and ZERO# port#. The DjVuFile# will read the data itself.

If you want to receive error messages and notifications, you may connect the DjVuFile# to your own {DjVuPort} after it has been constructed.

Parameters:
str The stream containing data for the file.

Definition at line 179 of file DjVuFile.cpp.

References DataPool::create(), file_size, GUTF8String::format(), and GPEnabled::get_count().

Referenced by create().

{
  DEBUG_MSG("DjVuFile::DjVuFile(): ByteStream constructor\n");
  DEBUG_MAKE_INDENT(3);
  
  if (initialized)
    G_THROW( ERR_MSG("DjVuFile.2nd_init") );
  if (!get_count())
    G_THROW( ERR_MSG("DjVuFile.not_secured") );
  
  file_size=0;
  decode_thread=0;
  
  // Read the data from the stream
  data_pool=DataPool::create(str);
  
  // Construct some dummy URL
  GUTF8String buffer;
  buffer.format("djvufile:/%p.djvu", this);
  DEBUG_MSG("DjVuFile::DjVuFile(): url is "<<(const char *)buffer<<"\n");
  url=GURL::UTF8(buffer);
  
  // Set it here because trigger will call other DjVuFile's functions
  initialized=true;
  
  // Add (basically - call) the trigger
  data_pool->add_trigger(-1, static_trigger_cb, this);
}


Generated by  Doxygen 1.6.0   Back to index