adayaml_0.3.0_ab19e387/src/interface/yaml-transformation.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
42
43
44
45
--  part of AdaYaml, (c) 2017 Felix Krause
--  released under the terms of the MIT license, see the file "copying.txt"

with Yaml.Transformator;
with Yaml.Stream_Concept;
private with Ada.Containers.Indefinite_Vectors;

generic
   with package Stream_Impl is new Stream_Concept (<>);
package Yaml.Transformation is
   type Instance is limited new Refcount_Base with private;
   type Reference is tagged private;
   type Accessor (Data : not null access Instance) is null record with
     Implicit_Dereference => Data;

   overriding procedure Finalize (Object : in out Instance);

   function Transform (Original : Stream_Impl.Reference) return Instance;
   function Transform (Original : Stream_Impl.Reference) return Reference;

   function Value (Object : Reference) return Accessor;

   function Next (Object : in out Instance) return Event;

   --  takes ownership of the given pointer.
   procedure Append (Object : in out Instance;
                     T : not null Transformator.Pointer);
private
   type Reference is new Ada.Finalization.Controlled with record
      Data : not null access Instance;
   end record;

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

   subtype Not_Null_Pointer is not null Transformator.Pointer;

   package Transformator_Vectors is new Ada.Containers.Indefinite_Vectors
     (Positive, Not_Null_Pointer, Transformator."=");

   type Instance is limited new Refcount_Base with record
      Original : Stream_Impl.Reference;
      Transformators : Transformator_Vectors.Vector;
   end record;
end Yaml.Transformation;