with Ada.Streams; use Ada.Streams;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Ada.Calendar, Interfaces;
package Zip_Streams is
type Time is private;
type Root_Zipstream_Type is abstract new Ada.Streams.Root_Stream_Type with private;
type Zipstream_Class is access all Root_Zipstream_Type'Class;
procedure Set_Index (S : access Root_Zipstream_Type;
To : Positive) is abstract;
function Index (S : access Root_Zipstream_Type) return Integer is abstract;
function Size (S : access Root_Zipstream_Type) return Integer is abstract;
procedure Set_Name (S : access Root_Zipstream_Type; Stream_Name : String);
procedure SetName (S : access Root_Zipstream_Type; Stream_Name : String) renames Set_Name;
pragma Obsolescent (SetName);
function Get_Name (S : access Root_Zipstream_Type) return String;
function GetName (S : access Root_Zipstream_Type) return String renames Get_Name;
pragma Obsolescent (GetName);
procedure Set_Unicode_Name_Flag (S : access Root_Zipstream_Type;
Value : Boolean);
function Is_Unicode_Name (S : access Root_Zipstream_Type)
return Boolean;
procedure Set_Time (S : access Root_Zipstream_Type;
Modification_Time : Time);
procedure SetTime (S : access Root_Zipstream_Type;
Modification_Time : Time) renames Set_Time;
pragma Obsolescent (SetTime);
procedure Set_Time (S : Zipstream_Class;
Modification_Time : Ada.Calendar.Time);
procedure SetTime (S : Zipstream_Class;
Modification_Time : Ada.Calendar.Time) renames Set_Time;
pragma Obsolescent (SetTime);
function Get_Time (S : access Root_Zipstream_Type)
return Time;
function GetTime (S : access Root_Zipstream_Type)
return Time renames Get_Time;
pragma Obsolescent (GetTime);
function Get_Time (S : Zipstream_Class)
return Ada.Calendar.Time;
function GetTime (S : Zipstream_Class)
return Ada.Calendar.Time renames Get_Time;
pragma Obsolescent (GetTime);
function End_Of_Stream (S : access Root_Zipstream_Type)
return Boolean is abstract;
type Memory_Zipstream is new Root_Zipstream_Type with private;
subtype Unbounded_Stream is Memory_Zipstream;
pragma Obsolescent (Unbounded_Stream);
procedure Get (Str : Memory_Zipstream; Unb : out Unbounded_String);
procedure Set (Str : in out Memory_Zipstream; Unb : Unbounded_String);
type File_Zipstream is new Root_Zipstream_Type with private;
subtype ZipFile_Stream is File_Zipstream;
pragma Obsolescent (ZipFile_Stream);
procedure Open (Str : in out File_Zipstream; Zipfile_Mode : File_Mode);
procedure Create (Str : in out File_Zipstream; Zipfile_Mode : File_Mode);
procedure Close (Str : in out File_Zipstream);
package Calendar is
function Convert (date : Ada.Calendar.Time) return Time;
function Convert (date : Time) return Ada.Calendar.Time;
subtype DOS_Time is Interfaces.Unsigned_32;
function Convert (date : DOS_Time) return Time;
function Convert (date : Time) return DOS_Time;
use Ada.Calendar;
procedure Split (Date : Time;
Year_Num : out Year_Number;
Month_Num : out Month_Number;
Day_Num : out Day_Number;
No_of_Seconds : out Day_Duration);
function Time_Of (Year_Num : Year_Number;
Month_Num : Month_Number;
Day_Num : Day_Number;
No_of_Seconds : Day_Duration := 0.0) return Time;
end Calendar;
private
type Time is new Interfaces.Unsigned_32;
some_time : constant Time := 16789 * 65536;
type Root_Zipstream_Type is abstract new Ada.Streams.Root_Stream_Type with
record
Name : Unbounded_String;
Modification_Time : Time := some_time;
Is_Unicode_Name : Boolean := False;
end record;
type Memory_Zipstream is new Root_Zipstream_Type with
record
Unb : Unbounded_String;
Loc : Integer := 1;
end record;
overriding procedure Read (Zip_Stream : in out Memory_Zipstream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
overriding procedure Write (Zip_Stream : in out Memory_Zipstream;
Item : Stream_Element_Array);
overriding procedure Set_Index (S : access Memory_Zipstream; To : Positive);
overriding function Index (S : access Memory_Zipstream) return Integer;
overriding function Size (S : access Memory_Zipstream) return Integer;
overriding function End_Of_Stream (S : access Memory_Zipstream) return Boolean;
type File_Zipstream is new Root_Zipstream_Type with
record
File : File_Type;
end record;
overriding procedure Read
(Zip_Stream : in out File_Zipstream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
overriding procedure Write
(Zip_Stream : in out File_Zipstream;
Item : Stream_Element_Array);
overriding procedure Set_Index (S : access File_Zipstream; To : Positive);
overriding function Index (S : access File_Zipstream) return Integer;
overriding function Size (S : access File_Zipstream) return Integer;
overriding function End_Of_Stream (S : access File_Zipstream) return Boolean;
end Zip_Streams;