diff options
Diffstat (limited to 'gcc/ada/a-ciorse.ads')
-rw-r--r-- | gcc/ada/a-ciorse.ads | 74 |
1 files changed, 68 insertions, 6 deletions
diff --git a/gcc/ada/a-ciorse.ads b/gcc/ada/a-ciorse.ads index 9d60bdcac89..3700c15e6b3 100644 --- a/gcc/ada/a-ciorse.ads +++ b/gcc/ada/a-ciorse.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -33,7 +33,8 @@ private with Ada.Containers.Red_Black_Trees; private with Ada.Finalization; -private with Ada.Streams; +with Ada.Streams; use Ada.Streams; +with Ada.Iterator_Interfaces; generic type Element_Type (<>) is private; @@ -47,7 +48,13 @@ package Ada.Containers.Indefinite_Ordered_Sets is function Equivalent_Elements (Left, Right : Element_Type) return Boolean; - type Set is tagged private; + type Set is tagged private + with + Constant_Indexing => Constant_Reference, + Variable_Indexing => Reference, + Default_Iterator => Iterate, + Iterator_Element => Element_Type; + pragma Preelaborable_Initialization (Set); type Cursor is private; @@ -56,6 +63,52 @@ package Ada.Containers.Indefinite_Ordered_Sets is Empty_Set : constant Set; No_Element : constant Cursor; + function Has_Element (Position : Cursor) return Boolean; + + package Ordered_Set_Iterator_Interfaces is new + Ada.Iterator_Interfaces (Cursor, Has_Element); + + type Constant_Reference_Type + (Element : not null access constant Element_Type) is + private + with + Implicit_Dereference => Element; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Constant_Reference_Type); + + for Constant_Reference_Type'Read use Read; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Constant_Reference_Type); + + for Constant_Reference_Type'Write use Write; + + function Constant_Reference + (Container : Set; Position : Cursor) + return Constant_Reference_Type; + + type Reference_Type (Element : not null access Element_Type) is private + with + Implicit_Dereference => Element; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Reference_Type); + + for Reference_Type'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Reference_Type); + + for Reference_Type'Read use Read; + + function Reference + (Container : Set; Position : Cursor) + return Reference_Type; function "=" (Left, Right : Set) return Boolean; @@ -168,8 +221,6 @@ package Ada.Containers.Indefinite_Ordered_Sets is function Contains (Container : Set; Item : Element_Type) return Boolean; - function Has_Element (Position : Cursor) return Boolean; - function "<" (Left, Right : Cursor) return Boolean; function ">" (Left, Right : Cursor) return Boolean; @@ -190,6 +241,12 @@ package Ada.Containers.Indefinite_Ordered_Sets is (Container : Set; Process : not null access procedure (Position : Cursor)); + function Iterate (Container : Set) + return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class; + + function Iterate (Container : Set; Start : Cursor) + return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class; + generic type Key_Type (<>) is private; @@ -271,7 +328,6 @@ private use Red_Black_Trees; use Tree_Types; use Ada.Finalization; - use Ada.Streams; type Set_Access is access all Set; for Set_Access'Storage_Size use 0; @@ -307,6 +363,12 @@ private for Set'Read use Read; + type Constant_Reference_Type + (Element : not null access constant Element_Type) is null record; + + type Reference_Type + (Element : not null access Element_Type) is null record; + Empty_Set : constant Set := (Controlled with Tree => (First => null, Last => null, |