Index

Package: Archives

Description

package Resources.Archives is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Archive (abstract)

type Archive is abstract new Limited_Object with private;

Ancestors:

Immediate Children:

Resources.Archives.Zip_Archives.Zip_Archive

Primitive operations:

Construct
Load_Raw (overriding Stream_Element_Array)
Load_Resource
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.To_String (Inherited)
An Archive is a data file containing individually addressable files. The Archive class should be subclassed for each archive file format supported by the application.

Types

A_Archive

type A_Archive is access all Archive'Class;

Constants & Global variables

FILE_NOT_FOUND

FILE_NOT_FOUND : exception;
Raised if an archive or a file in an archive can't be found.

READ_ERROR

READ_ERROR : exception;
Raised if a read error occurs while attempting to load an archive. The archive file is probably corrupt.

ARCHIVE_FORMAT_ERROR

ARCHIVE_FORMAT_ERROR : exception;
Raised if the file extension of an archive is not supported.

Subprograms & Entries

Load_Archive

function Load_Archive
( resource: not null A_Resource_File ) return A_Archive;
Loads an Archive into memory from a resource file. The resource can be unloaded independently of the Archive after calling this function.

Exists (abstract)

function Exists
( this: access Archive;
filename: String ) return Boolean is abstract;
Returns true if 'filename' exists in the Archive.

Load_Raw (abstract)

function Load_Raw
( this: access Archive;
filename: String ) return access Stream_Element_Array is abstract;
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.

Load_Resource (abstract)

function Load_Resource
( this: access Archive;
filename: String ) return A_Resource_File is abstract;
Reads 'filename' from the Archive as a resource file. The caller takes ownership of the returned object; closing the archive does not affect it. An exception will be raised on error.

Delete

procedure Delete
( this: in out A_Archive );
Deletes the Archive.