private with Zip;
private with Zip_Streams.Array_Streams;
package Archives.Zip_Archives is
private
use Zip;
use Zip_Streams.Array_Streams;
----------------------------------------------------------------------------
-- Implements an Archive class for .zip compressed files with .zip and
-- .gfx (tile library) extensions.
type Zip_Archive is new Archive with
record
zipArray : A_Array_Stream;
zipInfo : Zip_info;
end record;
-- 'path' is the absolute path of the archive. Raises an exception on error.
procedure Construct( this : access Zip_Archive; path : String );
-- 'resource' will be copied and not consumed. Raises an exception on error.
procedure Construct( this : access Zip_Archive;
resource : not null A_Resource_File );
procedure Delete( this : in out Zip_Archive );
-- Returns true if 'filename' exists in the Archive.
function Exists( this : access Zip_Archive;
filename : String ) return Boolean;
-- Reads 'filename' from the Archive and opens it as an Allegro bitmap. The
-- caller takes ownership of the returned bitmap; closing the archive does
-- not affect it. An exception is raised on error.
function Load_Bitmap( this : access Zip_Archive;
filename : String ) return A_Bitmap;
pragma Postcondition( Load_Bitmap'Result /= null );
-- Reads 'filename' from the Archive and opens it as an in-memory packfile.
-- The caller takes ownership of the returned packfile; closing the archive
-- does not affect it. An exception is raised on error.
function Load_Packfile( this : access Zip_Archive;
filename : String ) return A_Packfile;
pragma Postcondition( Load_Packfile'Result /= null );
-- Reads 'filename' from the Archive and returns it as a raw in-memory
-- buffer. The caller takes ownership of the returned buffer; closing the
-- Archive does not affect it. An exception is raised on error.
function Load_Raw( this : access Zip_Archive;
filename : String ) return access Stream_Element_Array;
pragma Postcondition( Load_Raw'Result /= null );
end Archives.Zip_Archives;