Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

GP< DataPool > DjVmDoc::get_data ( const GUTF8String id  )  const

Returns contents of file with ID id# from the document. Please refer to {DjVmDir} for the explanation of what IDs mean.

Definition at line 243 of file DjVmDoc.cpp.

References GMapTemplate< KTYPE, VTYPE, TI >::contains(), ByteStream::create(), and IFFByteStream::get_chunk().

Referenced by write().

{
  GPosition pos;
  if (!data.contains(id, pos))
    G_THROW(GUTF8String( ERR_MSG("DjVmDoc.cant_find") "\t") + id);
  const GP<DataPool> pool(data[pos]);
   // First check that the file is in IFF format
  G_TRY
  {
    const GP<ByteStream> str_in(pool->get_stream());
    const GP<IFFByteStream> giff_in=IFFByteStream::create(str_in);
    IFFByteStream &iff_in=*giff_in;
    GUTF8String chkid;
    int size=iff_in.get_chunk(chkid);
    if (size<0 || size>0x7fffffff)
      G_THROW( ERR_MSG("DjVmDoc.not_IFF") "\t" + id);
  }
  G_CATCH_ALL 
  {
    G_THROW( ERR_MSG("DjVmDoc.not_IFF") "\t" + id);
  }
  G_ENDCATCH;
  return pool;
}


Generated by  Doxygen 1.6.0   Back to index