1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- ADA.STRINGS.TEXT_OUTPUT.BUFFERS -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2020, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32package Ada.Strings.Text_Output.Buffers is 33 34 type Buffer (<>) is new Sink with private; 35 36 function New_Buffer 37 (Indent_Amount : Natural := Default_Indent_Amount; 38 Chunk_Length : Positive := Default_Chunk_Length) return Buffer; 39 40 procedure Destroy (S : in out Buffer); 41 -- Reclaim any heap-allocated data, and render the Buffer unusable. 42 -- It would make sense to do this via finalization, but we wish to 43 -- avoid controlled types in the generated code for 'Image. 44 45 function Get_UTF_8 (S : Buffer'Class) return UTF_8_Lines; 46 -- Get the characters in S, encoded as UTF-8. 47 48 function UTF_8_Length (S : Buffer'Class) return Natural; 49 procedure Get_UTF_8 50 (S : Buffer'Class; Result : out UTF_8_Lines) with 51 Pre => Result'First = 1 and Result'Last = UTF_8_Length (S); 52 -- This is a procedure version of the Get_UTF_8 function, for 53 -- efficiency. The Result String must be the exact right length. 54 55 function Get (S : Buffer'Class) return String; 56 function Wide_Get (S : Buffer'Class) return Wide_String; 57 function Wide_Wide_Get (S : Buffer'Class) return Wide_Wide_String; 58 -- Get the characters in S, decoded as [[Wide_]Wide_]String. 59 -- There is no need for procedure versions of these, because 60 -- they are intended primarily to implement the [[Wide_]Wide_]Image 61 -- attribute, which is already a function. 62 63private 64 type Chunk_Count is new Natural; 65 type Buffer is new Sink with record 66 Num_Extra_Chunks : Natural := 0; 67 -- Number of chunks in the linked list, not including Initial_Chunk. 68 end record; 69 70 overriding procedure Full_Method (S : in out Buffer); 71 overriding procedure Flush_Method (S : in out Buffer) is null; 72 73end Ada.Strings.Text_Output.Buffers; 74