Index

Package: Zip_Streams

Description

package Zip_Streams is
Contributed by ITEC - NXP Semiconductors June 2008 The Zip_Streams package defines an abstract stream type with name, time and an index for random access. In addition, this package provides two ready-to-use derivations: - Unbounded_Stream, for using in-memory streaming - ZipFile_Stream, for accessing files Change log: ========== 25-Nov-2009: GdM: Added an own time type -> it is possible to bypass Ada.Calendar 18-Jan-2009: GdM: Fixed Zip_Streams.Read which did read only Item's first element

Packages

Calendar

Classes

Root_Zipstream_Type (abstract)

type Root_Zipstream_Type is abstract new Ada.Streams.Root_Stream_Type with null record;

Ancestors:

Ada.Streams.Root_Stream_Type

Immediate Children:

Primitive operations:

Ada.Streams.Read (Inherited)
Ada.Streams.Write (Inherited)
End_Of_Stream

Unbounded_Stream

type Unbounded_Stream is new Root_Zipstream_Type with private;

Ancestors:

Ada.Streams.Root_Stream_Type

Primitive operations:

End_Of_Stream (overriding End_Of_Stream)
GetName (overriding GetName)
GetTime (overriding GetTime)
Index (overriding Index)
Read (overriding Ada.Streams.Read)
Set_Index (overriding Set_Index)
SetName (overriding SetName)
SetTime (overriding SetTime)
Size (overriding Size)
Write (overriding Ada.Streams.Write)
------------------------------------------------------------------- Unbounded_Stream: stream based on an in-memory Unbounded_String -- -------------------------------------------------------------------

ZipFile_Stream

type ZipFile_Stream is new Root_Zipstream_Type with private;

Ancestors:

Ada.Streams.Root_Stream_Type

Primitive operations:

End_Of_Stream (overriding End_Of_Stream)
GetName (overriding GetName)
GetTime (overriding GetTime)
Index (overriding Index)
Read (overriding Ada.Streams.Read)
Set_Index (overriding Set_Index)
SetName (overriding SetName)
SetTime (overriding SetTime)
Size (overriding Size)
Write (overriding Ada.Streams.Write)
------------------------------------------ ZipFile_Stream: stream based on a file -- ------------------------------------------

Types

Time

type Time is private;
^ we define an own Time (Ada.Calendar's body can be very time-consuming!) See subpackage Calendar below for own Split, Time_Of and Convert from/to Ada.Calendar.Time.

Zipstream_Class

type Zipstream_Class is access all Root_Zipstream_Type'Class;

Subprograms & Entries

Set_Index (abstract)

procedure Set_Index 
(S: access Root_Zipstream_Type;
To: Positive) is abstract;
Set the index on the stream

Index (abstract)

function Index 
(S: access Root_Zipstream_Type) return Integer is abstract;
returns the index of the stream

Size (abstract)

function Size 
(S: access Root_Zipstream_Type) return Integer is abstract;
returns the Size of the stream

SetName (abstract)

procedure SetName
(S: access Root_Zipstream_Type;
Name: String) is abstract;
this procedure sets the name of the stream

GetName (abstract)

function GetName
(S: access Root_Zipstream_Type) return String is abstract;
this procedure returns the name of the stream

SetTime (abstract)

procedure SetTime
(S: access Root_Zipstream_Type;
ModificationTime: Time) is abstract;
this procedure sets the ModificationTime of the stream

SetTime

procedure SetTime
(S: Zipstream_Class;
ModificationTime: Ada.Calendar.Time);
same, with the standard Time type

GetTime (abstract)

function GetTime
(S: access Root_Zipstream_Type) return Time is abstract;
this procedure returns the ModificationTime of the stream

GetTime

function GetTime
(S: Zipstream_Class) return Ada.Calendar.Time;
same, with the standard Time type

End_Of_Stream (abstract)

function End_Of_Stream 
(S: access Root_Zipstream_Type) return Boolean is abstract;
returns true if the index is at the end of the stream, else false

Get

procedure Get 
(Str: Unbounded_Stream;
Unb: out Unbounded_String);
Get the complete value of the stream

Set

procedure Set 
(Str: in out Unbounded_Stream;
Unb: Unbounded_String);
Set a value in the stream, the index will be set to null and old data in the stream will be lost.

Open

procedure Open 
(Str: in out ZipFile_Stream;
Mode: File_Mode);
Open the ZipFile_Stream PRE: Str.Name must be set

Create

procedure Create 
(Str: in out ZipFile_Stream;
Mode: File_Mode);
Creates a file on the disk PRE: Str.Name must be set

Close

procedure Close 
(Str: in out ZipFile_Stream);