1. private with Zip; 
  2. private with Zip_Streams.Array_Streams; 
  3.  
  4. package Archives.Zip_Archives is 
  5.  
  6. private 
  7.  
  8.     use Zip; 
  9.     use Zip_Streams.Array_Streams; 
  10.  
  11.     ---------------------------------------------------------------------------- 
  12.  
  13.     -- Implements an Archive class for .zip compressed files with .zip and 
  14.     -- .gfx (tile library) extensions. 
  15.     type Zip_Archive is new Archive with 
  16.         record 
  17.             zipArray : A_Array_Stream; 
  18.             zipInfo  : Zip_info; 
  19.         end record; 
  20.  
  21.     -- 'path' is the absolute path of the archive. Raises an exception on error. 
  22.     procedure Construct( this : access Zip_Archive; path : String ); 
  23.  
  24.     -- 'resource' will be copied and not consumed. Raises an exception on error. 
  25.     procedure Construct( this     : access Zip_Archive; 
  26.                          resource : not null A_Resource_File ); 
  27.  
  28.     procedure Delete( this : in out Zip_Archive ); 
  29.  
  30.     -- Returns true if 'filename' exists in the Archive. 
  31.     function Exists( this     : access Zip_Archive; 
  32.                      filename : String ) return Boolean; 
  33.  
  34.     -- Reads 'filename' from the Archive and opens it as an Allegro bitmap. The 
  35.     -- caller takes ownership of the returned bitmap; closing the archive does 
  36.     -- not affect it. An exception is raised on error. 
  37.     function Load_Bitmap( this     : access Zip_Archive; 
  38.                           filename : String ) return A_Bitmap; 
  39.     pragma Postcondition( Load_Bitmap'Result /= null ); 
  40.  
  41.     -- Reads 'filename' from the Archive and opens it as an in-memory packfile. 
  42.     -- The caller takes ownership of the returned packfile; closing the archive 
  43.     -- does not affect it. An exception is raised on error. 
  44.     function Load_Packfile( this     : access Zip_Archive; 
  45.                             filename : String ) return A_Packfile; 
  46.     pragma Postcondition( Load_Packfile'Result /= null ); 
  47.  
  48.     -- Reads 'filename' from the Archive and returns it as a raw in-memory 
  49.     -- buffer. The caller takes ownership of the returned buffer; closing the 
  50.     -- Archive does not affect it. An exception is raised on error. 
  51.     function Load_Raw( this     : access Zip_Archive; 
  52.                        filename : String ) return access Stream_Element_Array; 
  53.     pragma Postcondition( Load_Raw'Result /= null ); 
  54.  
  55. end Archives.Zip_Archives;