]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ada/libgnat/a-cborma.adb
[Ada] Ada2020: AI12-0304 Put_Image attrs of lang-def types
[thirdparty/gcc.git] / gcc / ada / libgnat / a-cborma.adb
index 6f59471cb7c2a06b33cfe6bd1a26e4c96b9874df..23e21dac073c25828fe2b96a905826d7b2481360 100644 (file)
@@ -38,6 +38,7 @@ pragma Elaborate_All
   (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys);
 
 with System; use type System.Address;
+with System.Put_Images;
 
 package body Ada.Containers.Bounded_Ordered_Maps with
   SPARK_Mode => Off
@@ -1289,6 +1290,36 @@ is
       end;
    end Query_Element;
 
+   ---------------
+   -- Put_Image --
+   ---------------
+
+   procedure Put_Image
+     (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+   is
+      First_Time : Boolean := True;
+      use System.Put_Images;
+
+      procedure Put_Key_Value (Position : Cursor);
+      procedure Put_Key_Value (Position : Cursor) is
+      begin
+         if First_Time then
+            First_Time := False;
+         else
+            Simple_Array_Between (S);
+         end if;
+
+         Key_Type'Put_Image (S, Key (Position));
+         Put_Arrow (S);
+         Element_Type'Put_Image (S, Element (Position));
+      end Put_Key_Value;
+
+   begin
+      Array_Before (S);
+      Iterate (V, Put_Key_Value'Access);
+      Array_After (S);
+   end Put_Image;
+
    ----------
    -- Read --
    ----------