OSDN Git Service

PR other/52438
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-ciormu.ads
index 0b3719b..cfd1676 100644 (file)
@@ -6,25 +6,23 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- This unit was originally developed by Matthew J Heaney.                  --
 ------------------------------------------------------------------------------
@@ -37,6 +35,7 @@
 private with Ada.Containers.Red_Black_Trees;
 private with Ada.Finalization;
 private with Ada.Streams;
+with Ada.Iterator_Interfaces;
 
 generic
    type Element_Type (<>) is private;
@@ -52,7 +51,10 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
    --  Returns False if Left is less than Right, or Right is less than Left;
    --  otherwise, it returns True.
 
-   type Set is tagged private;
+   type Set is tagged private
+   with Default_Iterator => Iterate,
+        Iterator_Element => Element_Type;
+
    pragma Preelaborable_Initialization (Set);
 
    type Cursor is private;
@@ -66,6 +68,12 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
    --  The default value for cursor objects declared without an explicit
    --  initialization expression.
 
+   function Has_Element (Position : Cursor) return Boolean;
+   --  Equivalent to Position /= No_Element
+
+   package Set_Iterator_Interfaces is new
+     Ada.Iterator_Interfaces (Cursor, Has_Element);
+
    function "=" (Left, Right : Set) return Boolean;
    --  If Left denotes the same set object as Right, then equality returns
    --  True. If the length of Left is different from the length of Right, then
@@ -120,6 +128,10 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
    --  change the value of the element while Process is executing (to "tamper
    --  with elements") will raise Program_Error.
 
+   procedure Assign (Target : in out Set; Source : Set);
+
+   function Copy (Source : Set) return Set;
+
    procedure Move (Target : in out Set; Source : in out Set);
    --  If Target denotes the same object as Source, the operation does
    --  nothing. If either Target or Source is busy (cursor tampering is
@@ -284,9 +296,6 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
    function Contains (Container : Set; Item : Element_Type) return Boolean;
    --  Equivalent to Container.Find (Item) /= No_Element
 
-   function Has_Element (Position : Cursor) return Boolean;
-   --  Equivalent to Position /= No_Element
-
    function "<" (Left, Right : Cursor) return Boolean;
    --  Equivalent to Element (Left) < Element (Right)
 
@@ -331,6 +340,15 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
    --  Call Process with a cursor designating each element equivalent to Item,
    --  in order from Container.Ceiling (Item) to Container.Floor (Item).
 
+   function Iterate
+     (Container : Set)
+      return Set_Iterator_Interfaces.Reversible_Iterator'class;
+
+   function Iterate
+     (Container : Set;
+      Start     : Cursor)
+      return Set_Iterator_Interfaces.Reversible_Iterator'class;
+
    generic
       type Key_Type (<>) is private;
 
@@ -439,11 +457,9 @@ private
       Tree : Tree_Types.Tree_Type;
    end record;
 
-   overriding
-   procedure Adjust (Container : in out Set);
+   overriding procedure Adjust (Container : in out Set);
 
-   overriding
-   procedure Finalize (Container : in out Set) renames Clear;
+   overriding procedure Finalize (Container : in out Set) renames Clear;
 
    use Red_Black_Trees;
    use Tree_Types;