adayaml_0.3.0_ab19e387/Parser_Tools/src/interface/text-builder.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--  part of ParserTools, (c) 2017 Felix Krause
--  released under the terms of the MIT license, see the file "copying.txt"

with Text.Pool;

package Text.Builder is
   type Reference is new Ada.Finalization.Controlled with private;

   procedure Init (Object : in out Reference; Pool : Text.Pool.Reference;
                   Initial_Size : Positive := 255);

   function Create (Pool : Text.Pool.Reference;
                    Initial_Size : Positive := 255) return Reference;

   function Initialized (Object : Reference) return Boolean;

   procedure Append (Object : in out Reference; Value : String)
     with Pre => Object.Initialized;

   procedure Append (Object : in out Reference; Value : Character)
     with Pre => Object.Initialized;

   procedure Append (Object : in out Reference; Value : Text.Reference)
     with Pre => Object.Initialized;

   function Lock (Object : in out Reference) return Text.Reference;

   function Length (Object : Reference) return Natural;
private
   type Reference is new Ada.Finalization.Controlled with record
      Pool : Text.Pool.Reference;
      Buffer : UTF_8_String_Access;
      Next : System.Storage_Elements.Storage_Offset := 1;
   end record;

   overriding procedure Adjust (Object : in out Reference);
   overriding procedure Finalize (Object : in out Reference);

   procedure Grow (Object : in out Reference;
                   Size : System.Storage_Elements.Storage_Offset);
end Text.Builder;