-
Notifications
You must be signed in to change notification settings - Fork 0
/
serde.ads
33 lines (24 loc) · 910 Bytes
/
serde.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
with Ada.Streams;
with Bupstash_Types;
generic
type Ptr is access Ada.Streams.Stream_Element_Array;
package Serde is
type Serde_Ctx is tagged limited private;
function Init(Raw: Ptr) return Serde_Ctx;
function Next_Binary_String(Ctx: in out Serde_Ctx;
Length: in Integer) return String;
function Next_U8(Ctx: in out Serde_Ctx) return Bupstash_Types.U8;
function Next_U64(Ctx: in out Serde_Ctx) return Bupstash_Types.U64;
function Next_Bare_UInt(Ctx: in out Serde_Ctx)
return Bupstash_Types.U64;
function Next_Variable_String(Ctx: in out Serde_Ctx) return String;
function Get_Offset(Ctx: in Serde_Ctx)
return Ada.Streams.Stream_Element_Offset;
private
type Serde_Ctx is tagged limited record
Raw: Ptr;
Offset: Ada.Streams.Stream_Element_Offset;
end record;
function Get_Offset(Ctx: in Serde_Ctx)
return Ada.Streams.Stream_Element_Offset is (Ctx.Offset);
end Serde;