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; Name : String);
procedure SetName(S : access Root_Zipstream_Type; 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 : in 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; Mode : File_Mode);
procedure Create (Str : in out File_Zipstream; Mode : File_Mode);
procedure Close (Str : in out File_Zipstream);
package Calendar is
function Convert(date : in Ada.Calendar.Time) return Time;
function Convert(date : in Time) return Ada.Calendar.Time;
subtype DOS_Time is Interfaces.Unsigned_32;
function Convert(date : in DOS_Time) return Time;
function Convert(date : in Time) return DOS_Time;
use Ada.Calendar;
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration);
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
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;
procedure Read
(Stream : in out Memory_Zipstream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
procedure Write
(Stream : in out Memory_Zipstream;
Item : Stream_Element_Array);
procedure Set_Index (S : access Memory_Zipstream; To : Positive);
function Index (S : access Memory_Zipstream) return Integer;
function Size (S : access Memory_Zipstream) return Integer;
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;
procedure Read
(Stream : in out File_Zipstream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
procedure Write
(Stream : in out File_Zipstream;
Item : Stream_Element_Array);
procedure Set_Index (S : access File_Zipstream; To : Positive);
function Index (S : access File_Zipstream) return Integer;
function Size (S : access File_Zipstream) return Integer;
function End_Of_Stream (S : access File_Zipstream) return Boolean;
end Zip_Streams;